Rev 18616 | Rev 18624 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18616 | Rev 18623 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | ******************************************************************************/ |
21 | ******************************************************************************/ |
22 | void add_to_buffer(char *tmp); /* add tmp_buffer to the buffer */ |
22 | void add_to_buffer(char *tmp); /* add tmp_buffer to the buffer */ |
23 | void sync_input(FILE *infile);/* proceed with inputfile */ |
23 | void sync_input(FILE *infile);/* proceed with inputfile */ |
24 | void reset();/* reset some global variables like "use_filled", "use_dashed" */ |
24 | void reset();/* reset some global variables like "use_filled", "use_dashed" */ |
25 | int get_token(FILE *infile); /* read next char until EOL*/ |
25 | int get_token(FILE *infile); /* read next char until EOL*/ |
26 | - | ||
- | 26 | char *fillcolor; |
|
27 | int |
27 | int x2px(double x); |
28 | int |
28 | int y2px(double y); |
29 | 29 | ||
30 | double px2x(int x); |
30 | double px2x(int x); |
31 | double px2y(int y); |
31 | double px2y(int y); |
32 | double get_real(FILE *infile,int last); /* read a value; calculation and symbols allowed */ |
32 | double get_real(FILE *infile,int last); /* read a value; calculation and symbols allowed */ |
33 | char *str_replace ( const char *word, const char *sub_word, const char *rep_word ); |
33 | char *str_replace ( const char *word, const char *sub_word, const char *rep_word ); |
34 | char |
34 | char *get_color(FILE *infile,int last); /* read hex-color or colorname -> hex */ |
35 | char *get_string(FILE *infile,int last); /* get the string at the end of a command */ |
35 | char *get_string(FILE *infile,int last); /* get the string at the end of a command */ |
36 | char *get_string_argument(FILE *infile,int last); /* the same, but with "comma" as separator */ |
36 | char *get_string_argument(FILE *infile,int last); /* the same, but with "comma" as separator */ |
37 | int hypgeodaux(double *q, double* res, int full); |
37 | int hypgeodaux(double *q, double* res, int full); |
38 | char *convert_hex2rgb(char *hexcolor); |
38 | char *convert_hex2rgb(char *hexcolor); |
39 | void make_js_include(int canvas_root_id); |
39 | void make_js_include(int canvas_root_id); |
Line 439... | Line 439... | ||
439 | case 5: stroke_color = get_color(infile,1);/* name or hex color */ |
439 | case 5: stroke_color = get_color(infile,1);/* name or hex color */ |
440 | if(use_rotate == TRUE ){rotate(4,angle,rotationcenter,2);} |
440 | if(use_rotate == TRUE ){rotate(4,angle,rotationcenter,2);} |
441 | if(use_affine == TRUE ){ transform(4,2);} |
441 | if(use_affine == TRUE ){ transform(4,2);} |
442 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
442 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
443 | decimals = find_number_of_digits(precision); |
443 | decimals = find_number_of_digits(precision); |
444 | - | ||
445 | tmp_buffer=my_newmem(MAX_BUFFER); |
444 | tmp_buffer=my_newmem(MAX_BUFFER); |
446 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,8,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[1],decimals,double_data[3],arrow_head,arrow_head,arrow_head,arrow_head,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,my_sliders,rotation_center,use_offset)); |
445 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,8,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[1],decimals,double_data[3],arrow_head,arrow_head,arrow_head,arrow_head,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,my_sliders,rotation_center,use_offset)); |
447 | if(onclick != 0){object_cnt++;} |
446 | if(onclick != 0){object_cnt++;} |
448 | /* object_cnt++;*/ |
447 | /* object_cnt++;*/ |
449 | add_to_buffer(tmp_buffer);reset(); |
448 | add_to_buffer(tmp_buffer);reset(); |
450 | dragstuff[8] = 1; |
449 | dragstuff[8] = 1; |
451 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
450 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
452 | break; |
451 | break; |
453 | } |
452 | } |
454 | } |
453 | } |
455 | break; |
454 | break; |
456 | case ARROWS: |
455 | case ARROWS: |
457 | /* |
456 | /* |
458 | @ arrows color,head (px),x1,y1,x2,y2...x_n,y_n |
457 | @ arrows color,head (px),x1,y1,x2,y2...x_n,y_n |
Line 477... | Line 476... | ||
477 | } |
476 | } |
478 | i++; |
477 | i++; |
479 | } |
478 | } |
480 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
479 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
481 | if( use_affine == TRUE ){ transform(i-1,2);} |
480 | if( use_affine == TRUE ){ transform(i-1,2);} |
482 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
481 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
483 | decimals = find_number_of_digits(precision); |
482 | decimals = find_number_of_digits(precision); |
484 | for(c = 0 ; c < i-1 ; c = c+4){ |
483 | for(c = 0 ; c < i-1 ; c = c+4){ |
485 | tmp_buffer=my_newmem(MAX_BUFFER); |
484 | tmp_buffer=my_newmem(MAX_BUFFER); |
486 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,8,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],arrow_head,arrow_head,arrow_head,arrow_head,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,my_sliders,rotation_center,use_offset)); |
485 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,8,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],arrow_head,arrow_head,arrow_head,arrow_head,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,my_sliders,rotation_center,use_offset)); |
487 | add_to_buffer(tmp_buffer); |
486 | add_to_buffer(tmp_buffer); |
488 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
487 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
489 | } |
488 | } |
490 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
489 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
Line 662... | Line 661... | ||
662 | break; |
661 | break; |
663 | default: break; |
662 | default: break; |
664 | } |
663 | } |
665 | } |
664 | } |
666 | reset(); |
665 | reset(); |
667 | break; |
666 | break; |
668 | case BGCOLOR: |
667 | case BGCOLOR: |
669 | /* |
668 | /* |
670 | @ bgcolor colorname or #hex |
669 | @ bgcolor colorname or #hex |
671 | @ use this color as background of the "div" containing the canvas(es) |
670 | @ use this color as background of the "div" containing the canvas(es) |
672 | @%bgcolor%size 400,400%xrange -10,10%yrange -10,10%bgcolor lightblue |
671 | @%bgcolor%size 400,400%xrange -10,10%yrange -10,10%bgcolor lightblue |
Line 695... | Line 694... | ||
695 | */ |
694 | */ |
696 | URL = get_string(infile,1); |
695 | URL = get_string(infile,1); |
697 | fprintf(js_include_file,"/* set background image to canvas div */\ncanvas_div.style.backgroundImage = \"url(%s)\";canvas_div.style.backgroundSize = \"%dpx %dpx\";\n",URL,xsize,ysize); |
696 | fprintf(js_include_file,"/* set background image to canvas div */\ncanvas_div.style.backgroundImage = \"url(%s)\";canvas_div.style.backgroundSize = \"%dpx %dpx\";\n",URL,xsize,ysize); |
698 | break; |
697 | break; |
699 | case BLINK: |
698 | case BLINK: |
700 | /* |
699 | /* |
701 | @ blink time(seconds) |
700 | @ blink time(seconds) |
702 | @ NOT IMPLEMETED -YET |
701 | @ NOT IMPLEMETED -YET |
703 | */ |
702 | */ |
704 | break; |
703 | break; |
705 | case BOXPLOT: |
704 | case BOXPLOT: |
Line 752... | Line 751... | ||
752 | } |
751 | } |
753 | decimals = find_number_of_digits(precision); |
752 | decimals = find_number_of_digits(precision); |
754 | /*function draw_boxplot(canvas_type,xy,hw,cxy,data,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype0,dashtype1)*/ |
753 | /*function draw_boxplot(canvas_type,xy,hw,cxy,data,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype0,dashtype1)*/ |
755 | tmp_buffer=my_newmem(MAX_BUFFER); |
754 | tmp_buffer=my_newmem(MAX_BUFFER); |
756 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"draw_boxplot(%d,%d,%.*f,%.*f,[%.*f,%.*f,%.*f,%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d);\n",BOXPLOT_CANVAS+boxplot_cnt,int_data[0],decimals,double_data[0],decimals,double_data[1],decimals,double_data[2],decimals,double_data[3],decimals,double_data[4],decimals,double_data[5],decimals,double_data[6],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1])); |
755 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"draw_boxplot(%d,%d,%.*f,%.*f,[%.*f,%.*f,%.*f,%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d);\n",BOXPLOT_CANVAS+boxplot_cnt,int_data[0],decimals,double_data[0],decimals,double_data[1],decimals,double_data[2],decimals,double_data[3],decimals,double_data[4],decimals,double_data[5],decimals,double_data[6],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1])); |
757 | add_to_buffer(tmp_buffer); |
756 | add_to_buffer(tmp_buffer); |
758 | boxplot_cnt++; |
757 | boxplot_cnt++; |
759 | reset(); |
758 | reset(); |
760 | break; |
759 | break; |
761 | case BOXPLOTDATA: |
760 | case BOXPLOTDATA: |
762 | /* |
761 | /* |
Line 819... | Line 818... | ||
819 | default:break; |
818 | default:break; |
820 | } |
819 | } |
821 | } |
820 | } |
822 | break; |
821 | break; |
823 | case CHEMTEX: |
822 | case CHEMTEX: |
824 | /* |
823 | /* |
825 | chemtex |
824 | chemtex |
826 | keyword...needs to be the first command in the script (even before the ''size`` command) |
825 | keyword...needs to be the first command in the script (even before the ''size`` command) |
827 | only for KaTeX enabled typesetting ! |
826 | only for KaTeX enabled typesetting ! |
828 | will include 80kB large js-library for chemisty typesetting |
827 | will include 80kB large js-library for chemisty typesetting |
829 | using <a href="http://85.148.206.56/wims/download/katex.for.wims.tar.gz">KaTeX</a> : <code>katex x,y,\\ce{ chemistry tex code} like : \\ce{ Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2- }</code> |
828 | using <a href="http://85.148.206.56/wims/download/katex.for.wims.tar.gz">KaTeX</a> : <code>katex x,y,\\ce{ chemistry tex code} like : \\ce{ Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2- }</code> |
Line 842... | Line 841... | ||
842 | @ alternative: disk |
841 | @ alternative: disk |
843 | @ use command <code>fillcolor color</code> to set the fillcolor |
842 | @ use command <code>fillcolor color</code> to set the fillcolor |
844 | @ may be set <a href='#drag'>draggable</a> / <a href='#onclick'>onclick</a> |
843 | @ may be set <a href='#drag'>draggable</a> / <a href='#onclick'>onclick</a> |
845 | @ will shrink / expand on zoom out / zoom in |
844 | @ will shrink / expand on zoom out / zoom in |
846 | @%circle%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%drag xy%circle 0,0,60,red%zoom red |
845 | @%circle%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%drag xy%circle 0,0,60,red%zoom red |
847 | */ |
846 | */ |
848 | for(i=0;i<4;i++){ |
847 | for(i=0;i<4;i++){ |
849 | switch(i){ |
848 | switch(i){ |
850 | case 0: double_data[0] = get_real(infile,0);break; /* x */ |
849 | case 0: double_data[0] = get_real(infile,0);break; /* x */ |
851 | case 1: double_data[1] = get_real(infile,0);break; /* y */ |
850 | case 1: double_data[1] = get_real(infile,0);break; /* y */ |
852 | case 2: double_data[2] = px2x((get_real(infile,0))/2) - px2x(0);break; /* for zoom in/out: radius in 'dx' xrange*/ |
851 | case 2: double_data[2] = px2x((get_real(infile,0))/2) - px2x(0);break; /* for zoom in/out: radius in 'dx' xrange*/ |
853 | case 3: stroke_color = get_color(infile,1);/* name or hex color */ |
852 | case 3: stroke_color = get_color(infile,1);/* name or hex color */ |
- | 853 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
|
854 | if(use_rotate == TRUE ){rotate(2,angle,rotationcenter,2);} |
854 | if(use_rotate == TRUE ){rotate(2,angle,rotationcenter,2);} |
855 | if(use_affine == TRUE ){ transform(2,2);} |
855 | if(use_affine == TRUE ){ transform(2,2);} |
856 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
856 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
857 | decimals = find_number_of_digits(precision); |
857 | decimals = find_number_of_digits(precision); |
858 | tmp_buffer=my_newmem(MAX_BUFFER); |
858 | tmp_buffer=my_newmem(MAX_BUFFER); |
859 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[1],double_data[2],double_data[2],line_width,stroke_color,stroke_opacity, |
859 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[1],double_data[2],double_data[2],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,my_sliders,rotation_center,use_offset)); |
860 | add_to_buffer(tmp_buffer); |
860 | add_to_buffer(tmp_buffer); |
861 | if(onclick != 0){object_cnt++;}/* object_cnt++;*/ |
861 | if(onclick != 0){object_cnt++;}/* object_cnt++;*/ |
862 | dragstuff[13] = 1; |
862 | dragstuff[13] = 1; |
863 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
863 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
864 | reset(); |
864 | reset(); |
Line 879... | Line 879... | ||
879 | @%circles_drag%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%drag xy%circles blue,0,0,2,2,2,3,-3,-3,3,3,3,4,3,-4,2%zoom red |
879 | @%circles_drag%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%drag xy%circles blue,0,0,2,2,2,3,-3,-3,3,3,3,4,3,-4,2%zoom red |
880 | @%circles_onclick%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%onclick%circles blue,0,0,2,2,2,3,-3,-3,3,3,3,4,3,-4,2%zoom red |
880 | @%circles_onclick%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor lightblue%opacity 255,50%onclick%circles blue,0,0,2,2,2,3,-3,-3,3,3,3,4,3,-4,2%zoom red |
881 | @%circles_drag_slider%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%drag xy%# Click circles(s) to activate%opacity 200,50%fillcolor orange%rotationcenter 2,3%slider 0,2*pi,300,30,angle degrees,Rotate%slider -5,5*pi,300,30,x display,move in x-direction%slider -10,10*pi,300,30,y display,move in y-direction%fcircles blue,0,0,0.5,2,2,1,-3,-3,1.5,3,3,0.5,3,-4,0.5 |
881 | @%circles_drag_slider%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%drag xy%# Click circles(s) to activate%opacity 200,50%fillcolor orange%rotationcenter 2,3%slider 0,2*pi,300,30,angle degrees,Rotate%slider -5,5*pi,300,30,x display,move in x-direction%slider -10,10*pi,300,30,y display,move in y-direction%fcircles blue,0,0,0.5,2,2,1,-3,-3,1.5,3,3,0.5,3,-4,0.5 |
882 | */ |
882 | */ |
883 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
883 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
884 | fill_color |
884 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
885 | i=1; |
885 | i=1; |
886 | while( ! done ){ /* get next item until EOL*/ |
886 | while( ! done ){ /* get next item until EOL*/ |
887 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
887 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
888 | switch (i%3){ |
888 | switch (i%3){ |
889 | case 1:double_data[i-1] = get_real(infile,0);break; /* x */ |
889 | case 1:double_data[i-1] = get_real(infile,0);break; /* x */ |
Line 897... | Line 897... | ||
897 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
897 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
898 | 898 | ||
899 | decimals = find_number_of_digits(precision); |
899 | decimals = find_number_of_digits(precision); |
900 | for(c = 0 ; c < i-1 ; c = c+3){ |
900 | for(c = 0 ; c < i-1 ; c = c+3){ |
901 | tmp_buffer=my_newmem(MAX_BUFFER); |
901 | tmp_buffer=my_newmem(MAX_BUFFER); |
902 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+1],double_data[c+2],double_data[c+2],line_width,stroke_color,stroke_opacity, |
902 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+1],double_data[c+2],double_data[c+2],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,my_sliders,rotation_center,use_offset)); |
903 | add_to_buffer(tmp_buffer); |
903 | add_to_buffer(tmp_buffer); |
904 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
904 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
905 | } |
905 | } |
906 | reset(); |
906 | reset(); |
907 | dragstuff[13] = 1; |
907 | dragstuff[13] = 1; |
Line 1116... | Line 1116... | ||
1116 | y The y coordinate where to place the image on the canvas: dy1 = int_data[5] |
1116 | y The y coordinate where to place the image on the canvas: dy1 = int_data[5] |
1117 | width The width of the image to use (stretch or reduce the image): dx2 - dx1 = int_data[6] |
1117 | width The width of the image to use (stretch or reduce the image): dx2 - dx1 = int_data[6] |
1118 | height The height of the image to use (stretch or reduce the image): dy2 - dy1 = int_data[7] |
1118 | height The height of the image to use (stretch or reduce the image): dy2 - dy1 = int_data[7] |
1119 | */ |
1119 | */ |
1120 | case COPYRESIZED: |
1120 | case COPYRESIZED: |
1121 | /* |
1121 | /* |
1122 | @ copyresized x1,y2,x2,y2,dx1,dy1,dx2,dy2,image_file_url |
1122 | @ copyresized x1,y2,x2,y2,dx1,dy1,dx2,dy2,image_file_url |
1123 | @ The image may be any "bitmap" or "SVG" |
1123 | @ The image may be any "bitmap" or "SVG" |
1124 | @ Insert the region from (x1,y1) to (x2,y2) (in pixels) of [ filename], <br>possibly resized,<br>to the region of (dx1,dy1) to (dx2,dy2) in x/y-range |
1124 | @ Insert the region from (x1,y1) to (x2,y2) (in pixels) of [ filename], <br>possibly resized,<br>to the region of (dx1,dy1) to (dx2,dy2) in x/y-range |
1125 | @ (dx1:dy1) must be left top corner; (dx2:dy2) must be right bottom corner of inserted image |
1125 | @ (dx1:dy1) must be left top corner; (dx2:dy2) must be right bottom corner of inserted image |
1126 | @ If x1=y1=x2=y2=-1, the whole [filename / URL ] is copied and resized. |
1126 | @ If x1=y1=x2=y2=-1, the whole [filename / URL ] is copied and resized. |
Line 1297... | Line 1297... | ||
1297 | stroke_color = get_color(infile,0); |
1297 | stroke_color = get_color(infile,0); |
1298 | char *fun1 = get_string_argument(infile,1); |
1298 | char *fun1 = get_string_argument(infile,1); |
1299 | if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");} |
1299 | if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");} |
1300 | tmp_buffer=my_newmem(MAX_BUFFER); |
1300 | tmp_buffer=my_newmem(MAX_BUFFER); |
1301 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,9,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,eval(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,rotationcenter),line_width,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,my_sliders,rotation_center,use_offset)); |
1301 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,9,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,eval(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,rotationcenter),line_width,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,my_sliders,rotation_center,use_offset)); |
1302 | add_to_buffer(tmp_buffer); |
1302 | add_to_buffer(tmp_buffer); |
1303 | } |
1303 | } |
1304 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
1304 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
1305 | dragstuff[9] = 1; |
1305 | dragstuff[9] = 1; |
1306 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
1306 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
1307 | reset(); |
1307 | reset(); |
Line 1479... | Line 1479... | ||
1479 | */ |
1479 | */ |
1480 | for(i=0;i<2;i++){ |
1480 | for(i=0;i<2;i++){ |
1481 | switch(i){ |
1481 | switch(i){ |
1482 | case 0 : dashtype[0] = (int) line_width*( get_real(infile,0)) ; break; |
1482 | case 0 : dashtype[0] = (int) line_width*( get_real(infile,0)) ; break; |
1483 | case 1 : dashtype[1] = (int) line_width*( get_real(infile,1)) ; break; |
1483 | case 1 : dashtype[1] = (int) line_width*( get_real(infile,1)) ; break; |
1484 | } |
1484 | } |
1485 | } |
1485 | } |
1486 | break; |
1486 | break; |
1487 | case DIAMONDFILL: |
1487 | case DIAMONDFILL: |
1488 | /* |
1488 | /* |
1489 | @ diamondfill x0,y0,dx,dy,color |
1489 | @ diamondfill x0,y0,dx,dy,color |
1490 | @ x0,y0 in xrange / yrange |
1490 | @ x0,y0 in xrange / yrange |
Line 1500... | Line 1500... | ||
1500 | decimals = find_number_of_digits(precision); |
1500 | decimals = find_number_of_digits(precision); |
1501 | for(i=0;i<5;i++){ |
1501 | for(i=0;i<5;i++){ |
1502 | switch(i){ |
1502 | switch(i){ |
1503 | case 0: double_data[0] = get_real(infile,0); break; /* x */ |
1503 | case 0: double_data[0] = get_real(infile,0); break; /* x */ |
1504 | case 1: double_data[1] = get_real(infile,0); break; /* y */ |
1504 | case 1: double_data[1] = get_real(infile,0); break; /* y */ |
1505 | case 2: int_data[0] = (int) (get_real(infile,0)); break; /* dx pixel */ |
1505 | case 2: int_data[0] = (int) (get_real(infile,0)); break; /* dx pixel */ |
1506 | case 3: int_data[1] = (int) (get_real(infile,0)); break; /* dy pixel*/ |
1506 | case 3: int_data[1] = (int) (get_real(infile,0)); break; /* dy pixel*/ |
1507 | case 4: stroke_color = get_color(infile,1); |
1507 | case 4: stroke_color = get_color(infile,1); |
1508 | if(use_rotate == TRUE ){rotate(2,angle,rotationcenter,2);} |
1508 | if(use_rotate == TRUE ){rotate(2,angle,rotationcenter,2);} |
1509 | if(use_affine == TRUE ){ transform(2,2);} |
1509 | if(use_affine == TRUE ){ transform(2,2);} |
1510 | /* draw_diamondfill(ctx,x0,y0,dx,dy,linewidth,color,opacity,xsize,ysize) */ |
1510 | /* draw_diamondfill(ctx,x0,y0,dx,dy,linewidth,color,opacity,xsize,ysize) */ |
1511 | tmp_buffer=my_newmem(MAX_BUFFER); |
1511 | tmp_buffer=my_newmem(MAX_BUFFER); |
Line 1627... | Line 1627... | ||
1627 | @%ellipses%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor orange%opacity 200,40%linewidth 3%onclick%ellipses red,-3,0,2,4,0,0,4,2,3,0,6,2 |
1627 | @%ellipses%size 400,400%xrange -10,10%yrange -10,10%filled%fillcolor orange%opacity 200,40%linewidth 3%onclick%ellipses red,-3,0,2,4,0,0,4,2,3,0,6,2 |
1628 | */ |
1628 | */ |
1629 | 1629 | ||
1630 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
1630 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
1631 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
1631 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
1632 | fill_color |
1632 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
1633 | i=1; |
1633 | i=1; |
1634 | while( ! done ){ /* get next item until EOL*/ |
1634 | while( ! done ){ /* get next item until EOL*/ |
1635 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
1635 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
1636 | switch (i%4){ |
1636 | switch (i%4){ |
1637 | case 1:double_data[i-1] = get_real(infile,0);break; /* x */ |
1637 | case 1:double_data[i-1] = get_real(infile,0);break; /* x */ |
Line 1644... | Line 1644... | ||
1644 | } |
1644 | } |
1645 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,4);} |
1645 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,4);} |
1646 | if(use_affine == TRUE ){ transform(i-1,4);} |
1646 | if(use_affine == TRUE ){ transform(i-1,4);} |
1647 | decimals = find_number_of_digits(precision); |
1647 | decimals = find_number_of_digits(precision); |
1648 | for(c = 0 ; c < i-1 ; c = c+4){ |
1648 | for(c = 0 ; c < i-1 ; c = c+4){ |
1649 | check_string_length(string_length) |
1649 | check_string_length(string_length); |
1650 |
|
1650 | tmp_buffer=my_newmem(MAX_BUFFER); |
1651 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,3,[%.*f],[%.*f],[%.*f],[%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+1],decimals,double_data[c+2],decimals,double_data[c+3],line_width,stroke_color,stroke_opacity, |
1651 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,3,[%.*f],[%.*f],[%.*f],[%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+1],decimals,double_data[c+2],decimals,double_data[c+3],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,my_sliders,rotation_center,use_offset)); |
1652 | add_to_buffer(tmp_buffer); |
1652 | add_to_buffer(tmp_buffer); |
1653 | if(onclick != 0){object_cnt++;} /* object_cnt++; */ |
1653 | if(onclick != 0){object_cnt++;} /* object_cnt++; */ |
1654 | } |
1654 | } |
1655 | reset(); |
1655 | reset(); |
1656 | dragstuff[3] = 1; |
1656 | dragstuff[3] = 1; |
Line 1703... | Line 1703... | ||
1703 | break; |
1703 | break; |
1704 | case FILLCOLOR: |
1704 | case FILLCOLOR: |
1705 | /* |
1705 | /* |
1706 | @ fillcolor colorname or #hex |
1706 | @ fillcolor colorname or #hex |
1707 | @ set the color: mainly used for command 'userdraw obj,stroke_color' |
1707 | @ set the color: mainly used for command 'userdraw obj,stroke_color' |
1708 | @ all fillable massive objects will have a fillcolor == strokecolor (just to be compatible with flydraw...) |
- | |
1709 | @ see <a href="#fillpattern">fillpattern</a> for non-solid color filling. |
1708 | @ see <a href="#fillpattern">fillpattern</a> for non-solid color filling. |
1710 | */ |
1709 | */ |
1711 |
|
1710 | fillcolor = get_color(infile,1); |
- | 1711 | fill_color = fillcolor; /*to check with userdraw */ |
|
1712 | break; |
1712 | break; |
1713 | case FILLPATTERN: |
1713 | case FILLPATTERN: |
1714 | /* |
1714 | /* |
1715 | @ fillpattern grid | hatch | diamond | dot | image_url |
1715 | @ fillpattern grid | hatch | diamond | dot | image_url |
1716 | @ alternative: settile image_url |
1716 | @ alternative: settile image_url |
Line 3854... | Line 3854... | ||
3854 | 0,1 2,3 |
3854 | 0,1 2,3 |
3855 | 6,7 4,5 |
3855 | 6,7 4,5 |
3856 | x = [0,2,4,6] |
3856 | x = [0,2,4,6] |
3857 | y = [1,3,5,7] |
3857 | y = [1,3,5,7] |
3858 | */ |
3858 | */ |
- | 3859 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
|
3859 | if(use_rotate == TRUE ){rotate(8,angle,rotationcenter,2);} |
3860 | if(use_rotate == TRUE ){rotate(8,angle,rotationcenter,2);} |
3860 | if(use_affine == TRUE ){ transform(8,2);} |
3861 | if(use_affine == TRUE ){ transform(8,2);} |
3861 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
3862 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
3862 | tmp_buffer=my_newmem(MAX_BUFFER); |
3863 | tmp_buffer=my_newmem(MAX_BUFFER); |
3863 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[4],decimals,double_data[6],decimals,double_data[1],decimals,double_data[3],decimals,double_data[5],decimals,double_data[7],line_width,line_width,line_width,stroke_color,stroke_opacity, |
3864 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[4],decimals,double_data[6],decimals,double_data[1],decimals,double_data[3],decimals,double_data[5],decimals,double_data[7],line_width,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,my_sliders,rotation_center,use_offset)); |
3864 | add_to_buffer(tmp_buffer); |
3865 | add_to_buffer(tmp_buffer); |
3865 | if(onclick != 0){object_cnt++;} |
3866 | if(onclick != 0){object_cnt++;} |
3866 | /* object_cnt++; */ |
3867 | /* object_cnt++; */ |
3867 | reset(); |
3868 | reset(); |
3868 | break; |
3869 | break; |
Line 3874... | Line 3875... | ||
3874 | case RECTS: |
3875 | case RECTS: |
3875 | /* |
3876 | /* |
3876 | @ rects color,x1,y1,x2,y2,..... |
3877 | @ rects color,x1,y1,x2,y2,..... |
3877 | @ use command <code>frect color,x1,y1,x2,y2,.....</code> for a filled rectangle |
3878 | @ use command <code>frect color,x1,y1,x2,y2,.....</code> for a filled rectangle |
3878 | @ use command/keyword <a href='#filled'>filled</a> before command <code>rects color,x1,y1,x2,y2,....</code> |
3879 | @ use command/keyword <a href='#filled'>filled</a> before command <code>rects color,x1,y1,x2,y2,....</code> |
3879 | @ use command <code>fillcolor color</code> before ''frects`` to set the fill |
3880 | @ use command <code>fillcolor color</code> before ''frects`` to set the fill color. |
3880 | @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> individually |
3881 | @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> individually |
3881 | @%rects%size 400,400%xrange -10,10%yrange -10,10%rects red,0,0,4,-4,0,5,4,1 |
3882 | @%rects%size 400,400%xrange -10,10%yrange -10,10%rects red,0,0,4,-4,0,5,4,1 |
3882 | */ |
3883 | */ |
3883 | /* using closed PATH (type=5) in stead of ctx.rect (type=1)!!! |
3884 | /* using closed PATH (type=5) in stead of ctx.rect (type=1)!!! |
3884 | 0,1 2,3 .....8,9 10,11..... |
3885 | 0,1 2,3 .....8,9 10,11..... |
3885 | 6,7 4,5 .....14,15 12,13..... |
3886 | 6,7 4,5 .....14,15 12,13..... |
3886 | x = [0,2,4,6,8,10,12,14...] |
3887 | x = [0,2,4,6,8,10,12,14...] |
3887 | y = [1,3,5,7,9,11,13,15...] |
3888 | y = [1,3,5,7,9,11,13,15...] |
3888 | */ |
3889 | */ |
3889 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
3890 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
3890 | fill_color |
3891 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
3891 | i=0; |
3892 | i=0; |
3892 | while( ! done ){ /* get next item until EOL*/ |
3893 | while( ! done ){ /* get next item until EOL*/ |
3893 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
3894 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
3894 | if(i%2 == 0 ){ |
3895 | if(i%2 == 0 ){ |
3895 | double_data[i] = get_real(infile,0); /* x */ |
3896 | double_data[i] = get_real(infile,0); /* x */ |
Line 3904... | Line 3905... | ||
3904 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
3905 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
3905 | 3906 | ||
3906 | decimals = find_number_of_digits(precision); |
3907 | decimals = find_number_of_digits(precision); |
3907 | for(c = 0 ; c < i-1 ; c = c+4){ |
3908 | for(c = 0 ; c < i-1 ; c = c+4){ |
3908 | tmp_buffer=my_newmem(MAX_BUFFER); |
3909 | tmp_buffer=my_newmem(MAX_BUFFER); |
3909 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+2],decimals,double_data[c],decimals,double_data[c+1],decimals,double_data[c+1],decimals,double_data[c+3],decimals,double_data[c+3],line_width,line_width,line_width,stroke_color,stroke_opacity, |
3910 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+2],decimals,double_data[c],decimals,double_data[c+1],decimals,double_data[c+1],decimals,double_data[c+3],decimals,double_data[c+3],line_width,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,my_sliders,rotation_center,use_offset)); |
3910 | add_to_buffer(tmp_buffer); |
3911 | add_to_buffer(tmp_buffer); |
3911 | if(onclick != 0){object_cnt++;} |
3912 | if(onclick != 0){object_cnt++;} |
3912 | /* object_cnt++; */ |
3913 | /* object_cnt++; */ |
3913 | } |
3914 | } |
3914 | dragstuff[5] = 1; |
3915 | dragstuff[5] = 1; |
Line 3975... | Line 3976... | ||
3975 | @%roundrects%size 400,400%xrange -10,10%yrange -10,10%roundrects blue,5,0,0,4,-4,5,4,1,2 |
3976 | @%roundrects%size 400,400%xrange -10,10%yrange -10,10%roundrects blue,5,0,0,4,-4,5,4,1,2 |
3976 | */ |
3977 | */ |
3977 | 3978 | ||
3978 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
3979 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
3979 | int_data[0] = (int) (get_real(infile,0)); /* radius value in pixels */ |
3980 | int_data[0] = (int) (get_real(infile,0)); /* radius value in pixels */ |
3980 | fill_color |
3981 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
3981 | i=0; |
3982 | i=0; |
3982 | while( ! done ){ /* get next item until EOL*/ |
3983 | while( ! done ){ /* get next item until EOL*/ |
3983 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
3984 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
3984 | if(i%2 == 0 ){ |
3985 | if(i%2 == 0 ){ |
3985 | double_data[i] = get_real(infile,0); /* x */ |
3986 | double_data[i] = get_real(infile,0); /* x */ |
Line 3996... | Line 3997... | ||
3996 | for(c = 0 ; c < i-1 ; c = c+4){ |
3997 | for(c = 0 ; c < i-1 ; c = c+4){ |
3997 | /* ensure no inverted roundrect is produced... */ |
3998 | /* ensure no inverted roundrect is produced... */ |
3998 | if( double_data[c] > double_data[c+2] ){double_data[c+4] = double_data[c];double_data[c] = double_data[c+2];double_data[c+2] = double_data[c+4];} |
3999 | if( double_data[c] > double_data[c+2] ){double_data[c+4] = double_data[c];double_data[c] = double_data[c+2];double_data[c+2] = double_data[c+4];} |
3999 | if( double_data[c+3] > double_data[c+1] ){double_data[c+4] = double_data[c+1];double_data[c+1] = double_data[c+3];double_data[c+3] = double_data[c+4];} |
4000 | if( double_data[c+3] > double_data[c+1] ){double_data[c+4] = double_data[c+1];double_data[c+1] = double_data[c+3];double_data[c+3] = double_data[c+4];} |
4000 | tmp_buffer=my_newmem(MAX_BUFFER); |
4001 | tmp_buffer=my_newmem(MAX_BUFFER); |
4001 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,6,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],int_data[0],int_data[0],int_data[0],int_data[0],line_width,stroke_color,stroke_opacity, |
4002 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,6,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],int_data[0],int_data[0],int_data[0],int_data[0],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,my_sliders,rotation_center,use_offset)); |
4002 | add_to_buffer(tmp_buffer); |
4003 | add_to_buffer(tmp_buffer); |
4003 | if(onclick != 0){object_cnt++;} |
4004 | if(onclick != 0){object_cnt++;} |
4004 | /* object_cnt++; */ |
4005 | /* object_cnt++; */ |
4005 | } |
4006 | } |
4006 | dragstuff[6] = 1; |
4007 | dragstuff[6] = 1; |
Line 4266... | Line 4267... | ||
4266 | tmp_buffer=my_newmem(MAX_BUFFER); |
4267 | tmp_buffer=my_newmem(MAX_BUFFER); |
4267 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,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,my_sliders,rotation_center,use_offset)); |
4268 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,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,my_sliders,rotation_center,use_offset)); |
4268 | add_to_buffer(tmp_buffer); |
4269 | add_to_buffer(tmp_buffer); |
4269 | if(onclick != 0){object_cnt++;} |
4270 | if(onclick != 0){object_cnt++;} |
4270 | /* object_cnt++;*/ |
4271 | /* object_cnt++;*/ |
4271 | } |
4272 | } |
4272 | reset(); |
4273 | reset(); |
4273 | dragstuff[4] = 1; |
4274 | dragstuff[4] = 1; |
4274 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
4275 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
4275 | break; |
4276 | break; |
4276 | case SETLIMITS: |
4277 | case SETLIMITS: |
4277 | /* |
4278 | /* |
Line 4393... | Line 4394... | ||
4393 | int_data[c] = i; c++; |
4394 | int_data[c] = i; c++; |
4394 | } |
4395 | } |
4395 | my_sliders = data2js_array(int_data,use_slider - last_slider+1); |
4396 | my_sliders = data2js_array(int_data,use_slider - last_slider+1); |
4396 | break; |
4397 | break; |
4397 | case SGRAPH: |
4398 | case SGRAPH: |
4398 | /* |
4399 | /* |
4399 | @ sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color |
4400 | @ sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color |
4400 | @ primitive implementation of a ''broken scale`` graph... |
4401 | @ primitive implementation of a ''broken scale`` graph... |
4401 | @ not very versatile: only usable in combination with userdraw <br>eg no other objects will obey this "coordinate system"<br>if you want to place an object into this coordinate system, be aware that 10% or 20% of xsize and/or ysize is ''lost``.<br>Use these "formulas" to recalculate the virtual coordinates:<br>factor=0.8 in case xstart != xmin (or ystart != ymin)<br>factor=0.9 in case xstart = xmin (or ystart = ymin)<br>px_x_point = ((factor*xsize)/(xmax - xstart))*(x_point - xmax)+xsize<br>x_recalculated = px*(xmax - xmin)/xsize + $xmin<br>px_y_point = -1*factor*y_point*ysize/(ymax - ystart) + ymax*factor*ysize/(ymax - ystart)<br>y_recalculated = ymax - py*(ymax - ymin)/ysize<br> |
4402 | @ not very versatile: only usable in combination with userdraw <br>eg no other objects will obey this "coordinate system"<br>if you want to place an object into this coordinate system, be aware that 10% or 20% of xsize and/or ysize is ''lost``.<br>Use these "formulas" to recalculate the virtual coordinates:<br>factor=0.8 in case xstart != xmin (or ystart != ymin)<br>factor=0.9 in case xstart = xmin (or ystart = ymin)<br>px_x_point = ((factor*xsize)/(xmax - xstart))*(x_point - xmax)+xsize<br>x_recalculated = px*(xmax - xmin)/xsize + $xmin<br>px_y_point = -1*factor*y_point*ysize/(ymax - ystart) + ymax*factor*ysize/(ymax - ystart)<br>y_recalculated = ymax - py*(ymax - ymin)/ysize<br> |
4402 | @%sgraph%size 400,400%xrange 0,10000%yrange 0,100%sgraph 9000,50,100,10,4,4,grey,blue%userinput_xy%linewidth 2%userdraw segments,red%precision 0%mouse blue,22 |
4403 | @%sgraph%size 400,400%xrange 0,10000%yrange 0,100%sgraph 9000,50,100,10,4,4,grey,blue%userinput_xy%linewidth 2%userdraw segments,red%precision 0%mouse blue,22 |
4403 | */ |
4404 | */ |
Line 4703... | Line 4704... | ||
4703 | case 5: temp = get_string_argument(infile,1); |
4704 | case 5: temp = get_string_argument(infile,1); |
4704 | tmp_buffer=my_newmem(MAX_BUFFER); |
4705 | tmp_buffer=my_newmem(MAX_BUFFER); |
4705 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "draw_textareas(%d,%d,%d,%d,%d,%d,%d,\"%s\",\"%s\");\n",canvas_root_id,input_cnt,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],css_class,temp)); |
4706 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "draw_textareas(%d,%d,%d,%d,%d,%d,%d,\"%s\",\"%s\");\n",canvas_root_id,input_cnt,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],css_class,temp)); |
4706 | add_to_buffer(tmp_buffer); |
4707 | add_to_buffer(tmp_buffer); |
4707 | input_cnt++;break; |
4708 | input_cnt++;break; |
4708 | default: break; |
4709 | default: break; |
4709 | } |
4710 | } |
4710 | } |
4711 | } |
4711 | if(reply_format == 0 ){reply_format = 15;} |
4712 | if(reply_format == 0 ){reply_format = 15;} |
4712 | reset(); |
4713 | reset(); |
4713 | break; |
4714 | break; |
4714 | case TEXTFILL: |
4715 | case TEXTFILL: |
4715 | /* |
4716 | /* |
4716 | @ textfill x0,y0,color,some_text |
4717 | @ textfill x0,y0,color,some_text |
4717 | @ x0,y0 in xrange / yrange |
4718 | @ x0,y0 in xrange / yrange |
4718 | @ color will be used for the font color |
4719 | @ color will be used for the font color |
4719 | @ use command <a href="#fontfamily">fontfamily</a> to set font type and size |
4720 | @ use command <a href="#fontfamily">fontfamily</a> to set font type and size |
4720 | @ there is also a command <a href="#userdraw">userdraw textfill,color,some_text</a> |
4721 | @ there is also a command <a href="#userdraw">userdraw textfill,color,some_text</a> |
Line 4726... | Line 4727... | ||
4726 | js_function[DRAW_FILLTOBORDER] = 1; |
4727 | js_function[DRAW_FILLTOBORDER] = 1; |
4727 | add_js_filltoborder(canvas_type); |
4728 | add_js_filltoborder(canvas_type); |
4728 | } |
4729 | } |
4729 | decimals = find_number_of_digits(precision); |
4730 | decimals = find_number_of_digits(precision); |
4730 | for(i=0;i<4;i++){ |
4731 | for(i=0;i<4;i++){ |
4731 | switch(i){ |
4732 | switch(i){ |
4732 | case 0: double_data[0] = get_real(infile,0); break; /* x in px */ |
4733 | case 0: double_data[0] = get_real(infile,0); break; /* x in px */ |
4733 | case 1: double_data[1] = get_real(infile,0); break; /* y in py */ |
4734 | case 1: double_data[1] = get_real(infile,0); break; /* y in py */ |
4734 | case 2: font_color = get_color(infile,0); break; |
4735 | case 2: font_color = get_color(infile,0); break; |
4735 | case 3: temp = get_string(infile,1); |
4736 | case 3: temp = get_string(infile,1); |
4736 | tmp_buffer=my_newmem(MAX_BUFFER); |
4737 | tmp_buffer=my_newmem(MAX_BUFFER); |
Line 4765... | Line 4766... | ||
4765 | fly_font_size = (int)(font_size + 24); |
4766 | fly_font_size = (int)(font_size + 24); |
4766 | } |
4767 | } |
4767 | else { |
4768 | else { |
4768 | if(strcmp(fly_font,"huge") == 0){ |
4769 | if(strcmp(fly_font,"huge") == 0){ |
4769 | fly_font_size = (int)(font_size + 14); |
4770 | fly_font_size = (int)(font_size + 14); |
4770 | } |
4771 | } |
4771 | else { |
4772 | else { |
4772 | if(strcmp(fly_font,"large") == 0){ |
4773 | if(strcmp(fly_font,"large") == 0){ |
4773 | fly_font_size = (int)(font_size + 6); |
4774 | fly_font_size = (int)(font_size + 6); |
4774 | } |
4775 | } |
4775 | else { |
4776 | else { |
Line 4863... | Line 4864... | ||
4863 | case 3: double_data[3] = get_real(infile,0);break; /* y */ |
4864 | case 3: double_data[3] = get_real(infile,0);break; /* y */ |
4864 | case 4: double_data[4] = get_real(infile,0);break; /* x */ |
4865 | case 4: double_data[4] = get_real(infile,0);break; /* x */ |
4865 | case 5: double_data[5] = get_real(infile,0);break; /* y */ |
4866 | case 5: double_data[5] = get_real(infile,0);break; /* y */ |
4866 | case 6: stroke_color = get_color(infile,1);/* name or hex color */ |
4867 | case 6: stroke_color = get_color(infile,1);/* name or hex color */ |
4867 | decimals = find_number_of_digits(precision); |
4868 | decimals = find_number_of_digits(precision); |
- | 4869 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
|
4868 | if( use_rotate == TRUE ){ rotate(6,angle,rotationcenter,2);} |
4870 | if( use_rotate == TRUE ){ rotate(6,angle,rotationcenter,2);} |
4869 | if( use_affine == TRUE ){ transform(6,2);} |
4871 | if( use_affine == TRUE ){ transform(6,2);} |
4870 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
4872 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
4871 | tmp_buffer=my_newmem(MAX_BUFFER); |
4873 | tmp_buffer=my_newmem(MAX_BUFFER); |
4872 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,%s,[0],[0],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,double_xy2js_array(double_data,6,decimals),line_width,stroke_color,stroke_opacity, |
4874 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,%s,[0],[0],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,double_xy2js_array(double_data,6,decimals),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,my_sliders,rotation_center,use_offset)); |
4873 | add_to_buffer(tmp_buffer); |
4875 | add_to_buffer(tmp_buffer); |
4874 | if(onclick != 0){object_cnt++;} |
4876 | if(onclick != 0){object_cnt++;} |
4875 | /* object_cnt++;*/ |
4877 | /* object_cnt++;*/ |
4876 | reset(); |
4878 | reset(); |
4877 | break; |
4879 | break; |
Line 4887... | Line 4889... | ||
4887 | @ use ftriangles or keyword <a href='#filled'>filled</a> for solid triangles |
4889 | @ use ftriangles or keyword <a href='#filled'>filled</a> for solid triangles |
4888 | @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> individually (!) |
4890 | @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> individually (!) |
4889 | @%triangles%size 400,400%xrange -10,10%yrange -10,10%linewidth 3%onclick%triangles red,0,0,-4,4,6,8,0,0,-4,-4,6,-8,-6,6,8,6,5,1%# the same as 3 calls to command triangle |
4891 | @%triangles%size 400,400%xrange -10,10%yrange -10,10%linewidth 3%onclick%triangles red,0,0,-4,4,6,8,0,0,-4,-4,6,-8,-6,6,8,6,5,1%# the same as 3 calls to command triangle |
4890 | */ |
4892 | */ |
4891 | stroke_color = get_color(infile,0);/* name or hex color */ |
4893 | stroke_color = get_color(infile,0);/* name or hex color */ |
- | 4894 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
|
4892 | i = 0; |
4895 | i = 0; |
4893 | decimals = find_number_of_digits(precision); |
4896 | decimals = find_number_of_digits(precision); |
4894 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
4897 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
4895 | - | ||
4896 | while( ! done ){ |
4898 | while( ! done ){ |
4897 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
4899 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
4898 | double_data[0] = get_real(infile,0); /* x1 */ |
4900 | double_data[0] = get_real(infile,0); /* x1 */ |
4899 | double_data[1] = get_real(infile,0); /* y1 */ |
4901 | double_data[1] = get_real(infile,0); /* y1 */ |
4900 | double_data[2] = get_real(infile,0); /* x2 */ |
4902 | double_data[2] = get_real(infile,0); /* x2 */ |
4901 | double_data[3] = get_real(infile,0); /* y2 */ |
4903 | double_data[3] = get_real(infile,0); /* y2 */ |
4902 | double_data[4] = get_real(infile,0); /* x3 */ |
4904 | double_data[4] = get_real(infile,0); /* x3 */ |
4903 | double_data[5] = get_real(infile,1); /* y3 */ |
4905 | double_data[5] = get_real(infile,1); /* y3 */ |
4904 | tmp_buffer=my_newmem(MAX_BUFFER); |
4906 | tmp_buffer=my_newmem(MAX_BUFFER); |
4905 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,%s,[0],[0],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,double_xy2js_array(double_data,6,decimals),line_width,stroke_color,stroke_opacity, |
4907 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER, "dragstuff.addShape(new Shape(%d,%d,%d,%d,5,%s,[0],[0],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,double_xy2js_array(double_data,6,decimals),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,my_sliders,rotation_center,use_offset)); |
4906 | add_to_buffer(tmp_buffer); |
4908 | add_to_buffer(tmp_buffer); |
4907 | if(onclick != 0){object_cnt++;} |
4909 | if(onclick != 0){object_cnt++;} |
4908 | i = i + 6; |
4910 | i = i + 6; |
4909 | } |
4911 | } |
4910 | reset(); |
4912 | reset(); |
Line 5726... | Line 5728... | ||
5726 | i++; |
5728 | i++; |
5727 | } |
5729 | } |
5728 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
5730 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
5729 | if(use_affine == TRUE ){ transform(i-1,2);} |
5731 | if(use_affine == TRUE ){ transform(i-1,2);} |
5730 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
5732 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
- | 5733 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
|
5731 | decimals = find_number_of_digits(precision); |
5734 | decimals = find_number_of_digits(precision); |
5732 | for(c = 0 ; c < i-1 ; c = c+4){ |
5735 | for(c = 0 ; c < i-1 ; c = c+4){ |
5733 | tmp_buffer=my_newmem(MAX_BUFFER); |
5736 | tmp_buffer=my_newmem(MAX_BUFFER); |
5734 | if (hypgeodaux(double_data+c,res,1)){ |
5737 | if (hypgeodaux(double_data+c,res,1)){ |
5735 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],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,my_sliders,rotation_center,use_offset));} |
5738 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],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,my_sliders,rotation_center,use_offset));} |
5736 | else { |
5739 | else { |
5737 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[2],decimals,res[1],decimals,res[3],line_width,stroke_color,stroke_opacity, |
5740 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[2],decimals,res[1],decimals,res[3],line_width,stroke_color,stroke_opacity,fill_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset)); |
5738 | } |
5741 | } |
5739 | add_to_buffer(tmp_buffer); |
5742 | add_to_buffer(tmp_buffer); |
5740 | if(onclick != 0){object_cnt++;} |
5743 | if(onclick != 0){object_cnt++;} |
5741 | } |
5744 | } |
5742 | reset(); |
5745 | reset(); |
Line 5773... | Line 5776... | ||
5773 | tmp_buffer=my_newmem(MAX_BUFFER); |
5776 | tmp_buffer=my_newmem(MAX_BUFFER); |
5774 | if (hypgeodaux(double_data+c,res,0)){ |
5777 | if (hypgeodaux(double_data+c,res,0)){ |
5775 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset)); |
5778 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset)); |
5776 | } |
5779 | } |
5777 | else { |
5780 | else { |
5778 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,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, |
5781 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,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,fill_color,fill_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset)); |
5779 | } |
5782 | } |
5780 | add_to_buffer(tmp_buffer); |
5783 | add_to_buffer(tmp_buffer); |
5781 | if(onclick != 0){object_cnt++;} |
5784 | if(onclick != 0){object_cnt++;} |
5782 | } |
5785 | } |
5783 | if(use_filled){ |
5786 | if(use_filled){ |
Line 5801... | Line 5804... | ||
5801 | @%hyprays%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9 |
5804 | @%hyprays%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9 |
5802 | hyprays_onclick%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9 |
5805 | hyprays_onclick%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9 |
5803 | hyprays_drag_xy%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%drag xy%hyprays blue,0,0,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9 |
5806 | hyprays_drag_xy%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%drag xy%hyprays blue,0,0,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9 |
5804 | */ |
5807 | */ |
5805 | stroke_color=get_color(infile,0); |
5808 | stroke_color=get_color(infile,0); |
5806 | fill_color |
5809 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
5807 | double_data[0] = get_real(infile,0);/* xc */ |
5810 | double_data[0] = get_real(infile,0);/* xc */ |
5808 | double_data[1] = get_real(infile,0);/* yc */ |
5811 | double_data[1] = get_real(infile,0);/* yc */ |
5809 | i=2; |
5812 | i=2; |
5810 | while( ! done ){ /* get next item until EOL*/ |
5813 | while( ! done ){ /* get next item until EOL*/ |
5811 | if(i > MAX_INT - 1){canvas_error("in command rays too many points / rays in argument: repeat command multiple times to fit");} |
5814 | if(i > MAX_INT - 1){canvas_error("in command rays too many points / rays in argument: repeat command multiple times to fit");} |
5812 | if(i%2 == 0 ){ |
5815 | if(i%2 == 0 ){ |
5813 | double_data[i] = get_real(infile,0); /* x */ |
5816 | double_data[i] = get_real(infile,0); /* x */ |
5814 | } |
5817 | } |
5815 | else { |
5818 | else { |
5816 | double_data[i] = get_real(infile,1); /* y */ |
5819 | double_data[i] = get_real(infile,1); /* y */ |
5817 | } |
5820 | } |
5818 | fprintf(js_include_file,"/* double_data[%d] = %f */\n",i,double_data[i]); |
5821 | fprintf(js_include_file,"/* double_data[%d] = %f */\n",i,double_data[i]); |
5819 | i++; |
5822 | i++; |
5820 | } |
5823 | } |
5821 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
5824 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
5822 | if(use_affine == TRUE ){ transform(i-1,2);} |
5825 | if(use_affine == TRUE ){ transform(i-1,2);} |
Line 5828... | Line 5831... | ||
5828 | double_data[2]=double_data[c];double_data[3]=double_data[c+1]; |
5831 | double_data[2]=double_data[c];double_data[3]=double_data[c+1]; |
5829 | if (hypgeodaux(double_data,res,0)){ |
5832 | if (hypgeodaux(double_data,res,0)){ |
5830 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],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,my_sliders,rotation_center,use_offset)); |
5833 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],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,my_sliders,rotation_center,use_offset)); |
5831 | } |
5834 | } |
5832 | else { |
5835 | else { |
5833 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[c],decimals,double_data[1],decimals,double_data[c+1],line_width,stroke_color,stroke_opacity, |
5836 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%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\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[c],decimals,double_data[1],decimals,double_data[c+1],line_width,stroke_color,stroke_opacity,fill_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset)); |
5834 | } |
5837 | } |
5835 | add_to_buffer(tmp_buffer); |
5838 | add_to_buffer(tmp_buffer); |
5836 | /* object_cnt++; */ |
5839 | /* object_cnt++; */ |
5837 | if(onclick != 0){object_cnt++;} |
5840 | if(onclick != 0){object_cnt++;} |
5838 | } |
5841 | } |
Line 5851... | Line 5854... | ||
5851 | hypcircles_drag%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%drag xy%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red |
5854 | hypcircles_drag%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%drag xy%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red |
5852 | hypcircles_onclick%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%onclick%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red |
5855 | hypcircles_onclick%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%onclick%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red |
5853 | hypcircles_drag_slider%size 400,400%xrange -1,1%yrange -1,1%linewidth 2%drag xy%# Click circles(s) to activate%opacity 200,50%fillcolor orange%rotationcenter 2,3%slider 0,2*pi,300,30,angle degrees,Rotate%slider -5,5*pi,300,30,x display,move in x-direction%slider -10,10*pi,300,30,y display,move in y-direction%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5 |
5856 | hypcircles_drag_slider%size 400,400%xrange -1,1%yrange -1,1%linewidth 2%drag xy%# Click circles(s) to activate%opacity 200,50%fillcolor orange%rotationcenter 2,3%slider 0,2*pi,300,30,angle degrees,Rotate%slider -5,5*pi,300,30,x display,move in x-direction%slider -10,10*pi,300,30,y display,move in y-direction%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5 |
5854 | */ |
5857 | */ |
5855 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
5858 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
5856 | fill_color |
5859 | if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;} |
5857 | i=1; |
5860 | i=1; |
5858 | while( ! done ){ /* get next item until EOL*/ |
5861 | while( ! done ){ /* get next item until EOL*/ |
5859 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
5862 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
5860 | switch (i%3){ |
5863 | switch (i%3){ |
5861 | case 1:double_data[i-1] = get_real(infile,0);break; /* x */ |
5864 | case 1:double_data[i-1] = get_real(infile,0);break; /* x */ |
Line 5874... | Line 5877... | ||
5874 | double den=1-R2*Z2; double XY=(1-R2)/den; |
5877 | double den=1-R2*Z2; double XY=(1-R2)/den; |
5875 | double_data[c]=XY*double_data[c]; |
5878 | double_data[c]=XY*double_data[c]; |
5876 | double_data[c+1]=XY*double_data[c+1]; |
5879 | double_data[c+1]=XY*double_data[c+1]; |
5877 | double_data[c+2]=(1-Z2)/den*R; |
5880 | double_data[c+2]=(1-Z2)/den*R; |
5878 | tmp_buffer=my_newmem(MAX_BUFFER); |
5881 | tmp_buffer=my_newmem(MAX_BUFFER); |
5879 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+1],double_data[c+2],double_data[c+2],line_width,stroke_color,stroke_opacity, |
5882 | check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+1],double_data[c+2],double_data[c+2],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,my_sliders,rotation_center,use_offset)); |
5880 | add_to_buffer(tmp_buffer); |
5883 | add_to_buffer(tmp_buffer); |
5881 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
5884 | if(onclick != 0){object_cnt++;}/* object_cnt++; */ |
5882 | } |
5885 | } |
5883 | reset(); |
5886 | reset(); |
5884 | dragstuff[13] = 1; |
5887 | dragstuff[13] = 1; |
Line 6241... | Line 6244... | ||
6241 | use_filled = FALSE; |
6244 | use_filled = FALSE; |
6242 | use_dashed = FALSE; |
6245 | use_dashed = FALSE; |
6243 | if(onclick != 4 ){onclick = 0;} /* slider param 'active'... onclick=4 */ |
6246 | if(onclick != 4 ){onclick = 0;} /* slider param 'active'... onclick=4 */ |
6244 | drag_type = -1; |
6247 | drag_type = -1; |
6245 | use_offset = 0; |
6248 | use_offset = 0; |
- | 6249 | fillcolor = FALSE; |
|
6246 | } |
6250 | } |
6247 | } |
6251 | } |
6248 | char *getMML(char *tex){ |
6252 | char *getMML(char *tex){ |
6249 | int my_pipe[2];pid_t pid; |
6253 | int my_pipe[2];pid_t pid; |
6250 | if(pipe(my_pipe)){canvas_error("mathml(): pipe() failure.\n");} |
6254 | if(pipe(my_pipe)){canvas_error("mathml(): pipe() failure.\n");} |