Subversion Repositories wimsdev

Rev

Rev 8225 | Rev 8257 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8225 Rev 8244
Line 478... Line 478...
478
                    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);
478
                    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);
479
                    click_cnt++;reset();
479
                    click_cnt++;reset();
480
                    break;
480
                    break;
481
                }
481
                }
482
            }
482
            }
-
 
483
            break;
-
 
484
        case HALFLINE:
-
 
485
        /*
-
 
486
        @ demiline x1,y1,x2,y2,color
-
 
487
        @ alternative : halfline
-
 
488
        @ draws a halfline starting in (x1:y1) and through (x2:y2) in color 'color' (colorname or hex)
-
 
489
        @ may be set draggable / onclick
-
 
490
        */
-
 
491
            for(i=0;i<5;i++){
-
 
492
                switch(i){
-
 
493
                    case 0: double_data[0]= get_real(infile,0);break; /* x-values */
-
 
494
                    case 1: double_data[1]= get_real(infile,0);break; /* y-values */
-
 
495
                    case 2: double_data[10]= get_real(infile,0);break; /* x-values */
-
 
496
                    case 3: double_data[11]= get_real(infile,0);break; /* y-values */
-
 
497
                    case 4: stroke_color=get_color(infile,1);/* name or hex color */
-
 
498
                    if(double_data[0] == double_data[10]){ /* vertical halfline */
-
 
499
                        if(double_data[1] < double_data[11]){
-
 
500
                         double_data[3] = ymax + 1000;
-
 
501
                        }
-
 
502
                        else
-
 
503
                        {
-
 
504
                         double_data[3] = ymin - 1000;
-
 
505
                        }
-
 
506
                        double_data[2] = double_data[0];
-
 
507
                    }
-
 
508
                    else
-
 
509
                    { /* horizontal halfline*/
-
 
510
                     if( double_data[1] == double_data[11] ){
-
 
511
                      if( double_data[0] < double_data[10] ){
-
 
512
                        double_data[2] = xmax + 1000; /* halfline to the right */
-
 
513
                      }
-
 
514
                      else
-
 
515
                      {
-
 
516
                        double_data[2] = xmin - 1000; /* halfline to the left */
-
 
517
                      }
-
 
518
                      double_data[3] = double_data[1];
-
 
519
                     }
-
 
520
                     else
-
 
521
                     {
-
 
522
                      /* any other halfline */
-
 
523
                      /* slope */
-
 
524
                      double_data[12] = (double_data[11] - double_data[1])/(double_data[10] - double_data[0]);
-
 
525
                      /* const */
-
 
526
                      double_data[13] = double_data[1] - double_data[12]*double_data[0];
-
 
527
                      if( double_data[0] < double_data[10] ){
-
 
528
                       double_data[2] = double_data[2] + 1000;
-
 
529
                      }
-
 
530
                      else
-
 
531
                      {
-
 
532
                       double_data[2] = double_data[2] - 1000;
-
 
533
                      }
-
 
534
                      double_data[3] = double_data[12]*double_data[2] + double_data[13];
-
 
535
                     }
-
 
536
                    }    
-
 
537
                    decimals = find_number_of_digits(precision);
-
 
538
                    fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,18,[%.*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);
-
 
539
                    click_cnt++;reset();
-
 
540
                    break;
-
 
541
                }
-
 
542
            }
-
 
543
       
483
            break;
544
            break;
484
        case HLINE:
545
        case HLINE:
485
        /*
546
        /*
486
        @ hline x,y,color
547
        @ hline x,y,color
487
        @ draw a horizontal line through point (x:y) in color 'color'
548
        @ draw a horizontal line through point (x:y) in color 'color'
Line 506... Line 567...
506
        @ vline x,y,color
567
        @ vline x,y,color
507
        @ draw a vertical line through point (x:y) in color 'color'
568
        @ draw a vertical line through point (x:y) in color 'color'
508
        @ may be set draggable / onclick
569
        @ may be set draggable / onclick
509
        */
570
        */
510
            for(i=0;i<3;i++) {
571
            for(i=0;i<3;i++) {
511
                switch(i){
572
                switch(i){
512
                    case 0: double_data[0] = get_real(infile,0);break; /* x-values */
573
                    case 0: double_data[0] = get_real(infile,0);break; /* x-values */
513
                    case 1: double_data[1] = get_real(infile,0);break; /* y-values */
574
                    case 1: double_data[1] = get_real(infile,0);break; /* y-values */
514
                    case 2: stroke_color=get_color(infile,1);/* name or hex color */
575
                    case 2: stroke_color=get_color(infile,1);/* name or hex color */
515
                        double_data[2] = double_data[0];
576
                        double_data[2] = double_data[0];
516
                        decimals = find_number_of_digits(precision);
577
                        decimals = find_number_of_digits(precision);
Line 519... Line 580...
519
                    break;
580
                    break;
520
                }
581
                }
521
            }
582
            }
522
            break;
583
            break;
523
        case SQUARE:
584
        case SQUARE:
524
        /*
585
        /*
525
        @ square x,y,side (px) ,color
586
        @ square x,y,side (px) ,color
526
        @ draw a square with left top corner (x:y) with side 'side' in color 'color'
587
        @ draw a square with left top corner (x:y) with side 'side' in color 'color'
527
        @ use command 'fsquare x,y,side,color' for a filled square
588
        @ use command 'fsquare x,y,side,color' for a filled square
528
        @ use command/keyword  'filled' before command 'square x,y,side,color'
589
        @ use command/keyword  'filled' before command 'square x,y,side,color'
529
        @ use command 'fillcolor color' before 'fsquare' to set the fill colour.
590
        @ use command 'fillcolor color' before 'fsquare' to set the fill colour.
Line 586... Line 647...
586
                    case 2:double_data[2] = get_real(infile,0);break; /* x-values */
647
                    case 2:double_data[2] = get_real(infile,0);break; /* x-values */
587
                    case 3:double_data[3] = get_real(infile,0);break; /* y-values */
648
                    case 3:double_data[3] = get_real(infile,0);break; /* y-values */
588
                    case 4:stroke_color = get_color(infile,1);/* name or hex color */
649
                    case 4:stroke_color = get_color(infile,1);/* name or hex color */
589
                        decimals = find_number_of_digits(precision);
650
                        decimals = find_number_of_digits(precision);
590
                        fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,1,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[2],decimals,double_data[2],decimals,double_data[0],decimals,double_data[1],decimals,double_data[1],decimals,double_data[3],decimals,double_data[3],line_width,line_width,line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
651
                        fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,1,[%.*f,%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f,%.*f],[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[2],decimals,double_data[2],decimals,double_data[0],decimals,double_data[1],decimals,double_data[1],decimals,double_data[3],decimals,double_data[3],line_width,line_width,line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
591
                        click_cnt++;reset();
652
                        click_cnt++;reset();
592
                        break;
653
                        break;
593
                }
654
                }
594
            }
655
            }
595
            break;
656
            break;
596
        case POLYLINE:
657
        case POLYLINE:
597
        /*
658
        /*
Line 792... Line 853...
792
            break;
853
            break;
793
        case ARROW:
854
        case ARROW:
794
        /*
855
        /*
795
        @ arrow x1,y1,x2,y2,h,color
856
        @ arrow x1,y1,x2,y2,h,color
796
        @ draw a single headed arrow/vector from (x1:y1) to (x2:y2)<br />with arrowhead size h in px and in color 'color'
857
        @ draw a single headed arrow/vector from (x1:y1) to (x2:y2)<br />with arrowhead size h in px and in color 'color'
797
        @ use command 'linewidth int' to adjust thickness of the arrow
858
        @ use command 'linewidth int' to adjust thickness of the arrow
798
        @ may be set draggable / onclick
859
        @ may be set draggable / onclick
799
        */
860
        */
800
            for(i=0;i<6;i++){
861
            for(i=0;i<6;i++){
801
                switch(i){
862
                switch(i){
802
                    case 0: double_data[0] = get_real(infile,0);break; /* x */
863
                    case 0: double_data[0] = get_real(infile,0);break; /* x */
803
                    case 1: double_data[1] = get_real(infile,0);break; /* y */
864
                    case 1: double_data[1] = get_real(infile,0);break; /* y */
804
                    case 2: double_data[2] = get_real(infile,0);break; /* x */
865
                    case 2: double_data[2] = get_real(infile,0);break; /* x */
805
                    case 3: double_data[3] = get_real(infile,0);break; /* y */
866
                    case 3: double_data[3] = get_real(infile,0);break; /* y */
806
                    case 4: arrow_head = (int) get_real(infile,0);break;/* h */
867
                    case 4: arrow_head = (int) get_real(infile,0);break;/* h */
807
                    case 5: stroke_color = get_color(infile,1);/* name or hex color */
868
                    case 5: stroke_color = get_color(infile,1);/* name or hex color */
808
                        decimals = find_number_of_digits(precision);
869
                        decimals = find_number_of_digits(precision);
809
                        fprintf(js_include_file,"dragstuff.addShape(new Shape(%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\",%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],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,use_affine,affine_matrix,slider,slider_cnt);
870
                        fprintf(js_include_file,"dragstuff.addShape(new Shape(%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\",%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],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,use_affine,affine_matrix,slider,slider_cnt);
810
                        click_cnt++;
871
                        click_cnt++;
811
                        reset();
872
                        reset();
812
                        break;
873
                        break;
813
                }
874
                }
Line 1036... Line 1097...
1036
            }
1097
            }
1037
            break;
1098
            break;
1038
        case USERDRAW:
1099
        case USERDRAW:
1039
        /*
1100
        /*
1040
        @ userdraw object_type,color
1101
        @ userdraw object_type,color
1041
        @ implemented object_type: <ul><li>point</li><li>points</li><li>crosshair</li><li>crosshairs</li><li>line</li><li>lines</li><li>vline</li><li>vlines</li><li>hline</li><li>hlines</li><li>segment</li><li>segments</li><li>polyline</li><li>circle</li><li>circles</li><li>arrow</li><li>arrow2 (double arrow)</li><li>arrows</li><li>arrows2 (double arrows)</li><li>triangle</li><li>polygon</li><li>poly[3-9]</li><li>rect</li><li>roundrect</li><li>rects</li><li>roundrects</li><li>freehandline</li><li>freehandlines</li><li>path</li><li>paths</li><li>text</li><li>arc</li><li>arcs</li><li>input<br/>place a single inputfield on 'canvas'<br />use commands 'inputstyle' for css styling: use command 'linewidth' for adjusting the input field size (default 1)</li><li>inputs<br/>place multiple inputfield : placing inputfields on top of each other is not possible</li></ul>
1102
        @ implemented object_type: <ul><li>point</li><li>points</li><li>crosshair</li><li>crosshairs</li><li>line</li><li>lines</li><li>vline</li><li>vlines</li><li>hline</li><li>hlines</li><li>demiline</li><li>demilines</li><li>segment</li><li>segments</li><li>polyline</li><li>circle</li><li>circles</li><li>arrow</li><li>arrow2 (double arrow)</li><li>arrows</li><li>arrows2 (double arrows)</li><li>triangle</li><li>polygon</li><li>poly[3-9]</li><li>rect</li><li>roundrect</li><li>rects</li><li>roundrects</li><li>freehandline</li><li>freehandlines</li><li>path</li><li>paths</li><li>text</li><li>arc</li><li>arcs</li><li>input<br/>place a single inputfield on 'canvas'<br />use commands 'inputstyle' for css styling: use command 'linewidth' for adjusting the input field size (default 1)</li><li>inputs<br/>place multiple inputfield : placing inputfields on top of each other is not possible</li></ul>
1042
        @ note: mouselisteners are only active if "$status != done " (eg only drawing in an active/non-finished exercise) <br /> to overrule use command/keyword "status" (no arguments required)
1103
        @ note: mouselisteners are only active if "$status != done " (eg only drawing in an active/non-finished exercise) <br /> to overrule use command/keyword "status" (no arguments required)
1043
        @ note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.<br />while typing the background of every typed char will be lightblue..."backspace / delete / esc" will remove typed text.<br />You will need to hit "enter" to add the text to the array "userdraw_txt()" : lightblue background will disappear<br />Placing the cursor somewhere on a typed text and hitting "delete/backspace/esc" , a confirm will popup asking to delete the selected text.This text will be removed from the "userdraw_txt()" answer array.<br />Use commands 'fontsize' and 'fontfamily' to control the text appearance
1104
        @ note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.<br />while typing the background of every typed char will be lightblue..."backspace / delete / esc" will remove typed text.<br />You will need to hit "enter" to add the text to the array "userdraw_txt()" : lightblue background will disappear<br />Placing the cursor somewhere on a typed text and hitting "delete/backspace/esc" , a confirm will popup asking to delete the selected text.This text will be removed from the "userdraw_txt()" answer array.<br />Use commands 'fontsize' and 'fontfamily' to control the text appearance
1044
        @ note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
1105
        @ note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
1045
        @ note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse butten (e.g. event.which != 1 : all buttons but left)
1106
        @ note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse butten (e.g. event.which != 1 : all buttons but left)
1046
        @ use command "filled", "opacity int,int"  and "fillcolor color" to trigger coloured filling of fillable objects
1107
        @ use command "filled", "opacity int,int"  and "fillcolor color" to trigger coloured filling of fillable objects
Line 1128... Line 1189...
1128
                }
1189
                }
1129
                add_js_circles(js_include_file,1,draw_type,line_width,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);
1190
                add_js_circles(js_include_file,1,draw_type,line_width,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);
1130
            }
1191
            }
1131
            else
1192
            else
1132
            if( strcmp(draw_type,"circles") == 0 ){
1193
            if( strcmp(draw_type,"circles") == 0 ){
1133
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1194
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1134
                if(reply_format == 0){reply_format = 10;}
1195
                if(reply_format == 0){reply_format = 10;}
1135
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1196
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1136
                add_js_circles(js_include_file,2,draw_type,line_width,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);
1197
                add_js_circles(js_include_file,2,draw_type,line_width,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);
1137
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1198
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1138
                if(use_input_xy == 1){
1199
                if(use_input_xy == 1){
Line 1140... Line 1201...
1140
                    add_input_xyr(js_include_file,canvas_root_id);
1201
                    add_input_xyr(js_include_file,canvas_root_id);
1141
                }
1202
                }
1142
            }
1203
            }
1143
            else
1204
            else
1144
            if(strcmp(draw_type,"crosshair") == 0 ){
1205
            if(strcmp(draw_type,"crosshair") == 0 ){
1145
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1206
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1146
                if(reply_format == 0){reply_format = 8;}
1207
                if(reply_format == 0){reply_format = 8;}
1147
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1208
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1148
                add_js_crosshairs(js_include_file,1,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1209
                add_js_crosshairs(js_include_file,1,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1149
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1210
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1150
                if(use_input_xy == 1){
1211
                if(use_input_xy == 1){
1151
                    add_input_crosshair(js_include_file,1);
1212
                    add_input_crosshair(js_include_file,1);
Line 1167... Line 1228...
1167
            else
1228
            else
1168
            if(strcmp(draw_type,"freehandline") == 0 ){
1229
            if(strcmp(draw_type,"freehandline") == 0 ){
1169
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1230
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1170
                if(reply_format == 0){reply_format = 6;}
1231
                if(reply_format == 0){reply_format = 6;}
1171
                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]);
1232
                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]);
1172
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1233
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1173
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1234
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1174
            }
1235
            }
1175
            else
1236
            else
1176
            if(strcmp(draw_type,"freehandlines") == 0 ){
1237
            if(strcmp(draw_type,"freehandlines") == 0 ){
1177
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1238
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1178
                if(reply_format == 0){reply_format = 6;}
1239
                if(reply_format == 0){reply_format = 6;}
1179
                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]);
1240
                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]);
1180
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1241
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1181
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1242
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1182
            }
1243
            }
1183
            else
1244
            else
1184
            if(strcmp(draw_type,"path") == 0 ){
1245
            if(strcmp(draw_type,"path") == 0 ){
1185
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1246
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1186
                if(reply_format == 0){reply_format = 6;}
1247
                if(reply_format == 0){reply_format = 6;}
1187
                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]);
1248
                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]);
1188
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1249
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1189
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1250
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1190
            }
1251
            }
1191
            else
1252
            else
1192
            if(strcmp(draw_type,"paths") == 0 ){
1253
            if(strcmp(draw_type,"paths") == 0 ){
1193
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1254
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1194
                if(reply_format == 0){reply_format = 6;}
1255
                if(reply_format == 0){reply_format = 6;}
1195
                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]);
1256
                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]);
1196
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1257
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1197
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1258
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1198
            }
1259
            }
1199
            else
1260
            else
1200
            if(strcmp(draw_type,"arrows") == 0 ){
1261
            if(strcmp(draw_type,"arrows") == 0 ){
1201
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1262
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1202
                if(reply_format == 0){reply_format = 11;}
1263
                if(reply_format == 0){reply_format = 11;}
1203
                add_js_arrows(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1264
                add_js_arrows(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1204
                if(use_input_xy == 1){
1265
                if(use_input_xy == 1){
Line 1207... Line 1268...
1207
                }
1268
                }
1208
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1269
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1209
            }
1270
            }
1210
            else
1271
            else
1211
            if(strcmp(draw_type,"arrows2") == 0 ){
1272
            if(strcmp(draw_type,"arrows2") == 0 ){
1212
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1273
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1213
                if(reply_format == 0){reply_format = 11;}
1274
                if(reply_format == 0){reply_format = 11;}
1214
                add_js_arrows(js_include_file,2,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1275
                add_js_arrows(js_include_file,2,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1215
                if(use_input_xy == 1){
1276
                if(use_input_xy == 1){
1216
                    add_input_arrow(js_include_file,1);
1277
                    add_input_arrow(js_include_file,1);
1217
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1278
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
Line 1234... Line 1295...
1234
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1295
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1235
                if(reply_format == 0){reply_format = 11;}
1296
                if(reply_format == 0){reply_format = 11;}
1236
                add_js_arrows(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1297
                add_js_arrows(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1237
                if(use_input_xy == 1){
1298
                if(use_input_xy == 1){
1238
                    add_input_arrow(js_include_file,1);
1299
                    add_input_arrow(js_include_file,1);
1239
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1300
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1240
                }
1301
                }
1241
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1302
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1242
            }
1303
            }
1243
            else
1304
            else
1244
            if(strcmp(draw_type,"polygon") == 0){
1305
            if(strcmp(draw_type,"polygon") == 0){
1245
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1306
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1246
                if(reply_format == 0){reply_format = 2;}
1307
                if(reply_format == 0){reply_format = 2;}
Line 1263... Line 1324...
1263
            else
1324
            else
1264
            if(strcmp(draw_type,"triangle") == 0){
1325
            if(strcmp(draw_type,"triangle") == 0){
1265
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1326
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1266
                if(reply_format == 0){reply_format = 2;}
1327
                if(reply_format == 0){reply_format = 2;}
1267
                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]);
1328
                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]);
1268
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1329
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1269
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1330
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1270
            }
1331
            }
1271
            else
1332
            else
1272
            if( strcmp(draw_type,"hline") == 0 ){
1333
            if( strcmp(draw_type,"hline") == 0 ){
1273
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1334
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1274
                if(reply_format == 0){reply_format = 11;}
1335
                if(reply_format == 0){reply_format = 11;}
1275
                add_js_hlines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1336
                add_js_hlines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1276
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1337
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1277
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1338
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1278
            }
1339
            }
1279
            else
1340
            else
1280
            if( strcmp(draw_type,"hlines") == 0 ){
1341
            if( strcmp(draw_type,"hlines") == 0 ){
1281
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1342
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1282
                if(reply_format == 0){reply_format = 11;}
1343
                if(reply_format == 0){reply_format = 11;}
1283
                add_js_hlines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1344
                add_js_hlines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1284
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1345
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1285
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1346
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1286
            }
1347
            }
1287
            else
1348
            else
1288
            if( strcmp(draw_type,"vline") == 0 ){
1349
            if( strcmp(draw_type,"vline") == 0 ){
1289
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1350
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1290
                if(reply_format == 0){reply_format = 11;}
1351
                if(reply_format == 0){reply_format = 11;}
1291
                add_js_hlines(js_include_file,3,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1352
                add_js_hlines(js_include_file,3,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1292
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1353
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1293
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1354
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1294
            }
1355
            }
1295
            else
1356
            else
1296
            if( strcmp(draw_type,"vlines") == 0 ){
1357
            if( strcmp(draw_type,"vlines") == 0 ){
1297
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1358
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1298
                if(reply_format == 0){reply_format = 11;}
1359
                if(reply_format == 0){reply_format = 11;}
1299
                add_js_hlines(js_include_file,4,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1360
                add_js_hlines(js_include_file,4,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1300
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1361
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1301
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1362
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1302
            }
1363
            }
Line 1304... Line 1365...
1304
            if( strcmp(draw_type,"line") == 0 ){
1365
            if( strcmp(draw_type,"line") == 0 ){
1305
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1366
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1306
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1367
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1307
                if(reply_format == 0){reply_format = 11;}
1368
                if(reply_format == 0){reply_format = 11;}
1308
                add_js_lines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1369
                add_js_lines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1309
                if( use_input_xy == 1 ){
1370
                if( use_input_xy == 1 ){
1310
                    add_input_line(js_include_file,1);
1371
                    add_input_line(js_include_file,1);
1311
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1372
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1312
                }
1373
                }
1313
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1374
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1314
            }
1375
            }
Line 1318... Line 1379...
1318
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1379
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1319
                if(reply_format == 0){reply_format = 11;}
1380
                if(reply_format == 0){reply_format = 11;}
1320
                add_js_lines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1381
                add_js_lines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1321
                if( use_input_xy == 1 ){
1382
                if( use_input_xy == 1 ){
1322
                    add_input_line(js_include_file,2);
1383
                    add_input_line(js_include_file,2);
-
 
1384
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
-
 
1385
                }
-
 
1386
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
-
 
1387
            }
-
 
1388
            else
-
 
1389
            if( strcmp(draw_type,"demilines") == 0 || strcmp(draw_type,"demilines") == 0 ){
-
 
1390
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
-
 
1391
                if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;}
-
 
1392
                if(reply_format == 0){reply_format = 11;}
-
 
1393
                add_js_demilines(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
-
 
1394
                if( use_input_xy == 1 ){
-
 
1395
                    add_input_demiline(js_include_file,2);
-
 
1396
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
-
 
1397
                }
-
 
1398
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
-
 
1399
            }
-
 
1400
            else
-
 
1401
            if( strcmp(draw_type,"demiline") == 0 || strcmp(draw_type,"demilines") == 0 ){
-
 
1402
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
-
 
1403
                if( js_function[DRAW_DEMILINES] != 1 ){ js_function[DRAW_DEMILINES] = 1;}
-
 
1404
                if(reply_format == 0){reply_format = 11;}
-
 
1405
                add_js_demilines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
-
 
1406
                if( use_input_xy == 1 ){
-
 
1407
                    add_input_demiline(js_include_file,1);
1323
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1408
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1324
                }
1409
                }
1325
                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 !");}
1326
            }
1411
            }
1327
            else
1412
            else
Line 1343... Line 1428...
1343
            else
1428
            else
1344
            if( strcmp(draw_type,"rect") == 0){
1429
            if( strcmp(draw_type,"rect") == 0){
1345
                if( js_function[DRAW_RECTS] != 1 ){ js_function[DRAW_RECTS] = 1;}
1430
                if( js_function[DRAW_RECTS] != 1 ){ js_function[DRAW_RECTS] = 1;}
1346
                if(reply_format == 0){reply_format = 2;}
1431
                if(reply_format == 0){reply_format = 2;}
1347
                add_js_rect(js_include_file,1,0,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);
1432
                add_js_rect(js_include_file,1,0,draw_type,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);
1348
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1433
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1349
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1434
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1350
            }
1435
            }
1351
            else
1436
            else
1352
            if( strcmp(draw_type,"roundrect") == 0){
1437
            if( strcmp(draw_type,"roundrect") == 0){
1353
                if( js_function[DRAW_ROUNDRECTS] != 1 ){ js_function[DRAW_ROUNDRECTS] = 1;}
1438
                if( js_function[DRAW_ROUNDRECTS] != 1 ){ js_function[DRAW_ROUNDRECTS] = 1;}
1354
                if(reply_format == 0){reply_format = 2;}
1439
                if(reply_format == 0){reply_format = 2;}
Line 1383... Line 1468...
1383
            else
1468
            else
1384
            if( strcmp(draw_type,"inputs") == 0){
1469
            if( strcmp(draw_type,"inputs") == 0){
1385
                if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;}
1470
                if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;}
1386
                if(reply_format == 0){reply_format = 27;}
1471
                if(reply_format == 0){reply_format = 27;}
1387
                add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width);
1472
                add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width);
1388
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1473
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1389
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1474
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1390
            }
1475
            }
1391
            else
1476
            else
1392
            if( strcmp(draw_type,"input") == 0){
1477
            if( strcmp(draw_type,"input") == 0){
1393
                if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;}
1478
                if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;}
1394
                if(reply_format == 0){reply_format = 27;}
1479
                if(reply_format == 0){reply_format = 27;}
1395
                add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width);
1480
                add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width);
Line 1453... Line 1538...
1453
            i = 0;
1538
            i = 0;
1454
            done = FALSE;
1539
            done = FALSE;
1455
            while( !done ){
1540
            while( !done ){
1456
             double_data[i] = get_real(infile,1);
1541
             double_data[i] = get_real(infile,1);
1457
             i++;
1542
             i++;
1458
            }
1543
            }
1459
            for(c = 0 ; c < i; c++){
1544
            for(c = 0 ; c < i; c++){
1460
             fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,16,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,eval_levelcurve(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,double_data[c]),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,use_affine,affine_matrix,slider,slider_cnt);
1545
             fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,16,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,eval_levelcurve(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,double_data[c]),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,use_affine,affine_matrix,slider,slider_cnt);
1461
             click_cnt++;
1546
             click_cnt++;
1462
            }
1547
            }
1463
            reset();
1548
            reset();
Line 1774... Line 1859...
1774
                            if(strstr(temp,"mathml0") != NULL){
1859
                            if(strstr(temp,"mathml0") != NULL){
1775
                             if(reply_format == 0 ){reply_format = 16;} /* no other reply type is defined */
1860
                             if(reply_format == 0 ){reply_format = 16;} /* no other reply type is defined */
1776
                            }
1861
                            }
1777
                            break;
1862
                            break;
1778
                    default:break;
1863
                    default:break;
1779
                }
1864
                }
1780
            }
1865
            }
1781
            reset();
1866
            reset();
1782
            break;
1867
            break;
1783
        case HTTP:
1868
        case HTTP:
1784
        /*
1869
        /*
1785
         @http x1,y1,x2,y2,http://some_adress.com
1870
         @http x1,y1,x2,y2,http://some_adress.com
1786
         @an active html-page will be displayed in an "iframe" rectangle left top (x1:y1) , right bottom (x2:y2)
1871
         @an active html-page will be displayed in an "iframe" rectangle left top (x1:y1) , right bottom (x2:y2)
1787
         @do not use interactivity (or mouse) if the mouse needs to be active in the iframe
1872
         @do not use interactivity (or mouse) if the mouse needs to be active in the iframe
Line 2208... Line 2293...
2208
                    case 4: int_data[4]=(int)(get_real(infile,0));break;/* x2 --> width  */
2293
                    case 4: int_data[4]=(int)(get_real(infile,0));break;/* x2 --> width  */
2209
                    case 5: int_data[5]=(int)(get_real(infile,0)) ;break;/* y2 --> height */
2294
                    case 5: int_data[5]=(int)(get_real(infile,0)) ;break;/* y2 --> height */
2210
                    case 6: URL = get_string(infile,1);
2295
                    case 6: URL = get_string(infile,1);
2211
                            int_data[6] = int_data[4] - int_data[2];/* swidth & width (if not scaling )*/
2296
                            int_data[6] = int_data[4] - int_data[2];/* swidth & width (if not scaling )*/
2212
                            int_data[7] = int_data[5] - int_data[3];/* sheight & height (if not scaling )*/
2297
                            int_data[7] = int_data[5] - int_data[3];/* sheight & height (if not scaling )*/
2213
                            if( drag_type > -1 ){
2298
                            if( drag_type > -1 ){
2214
                                if( js_function[DRAG_EXTERNAL_IMAGE] != 1 ){ js_function[DRAG_EXTERNAL_IMAGE] = 1;}
2299
                                if( js_function[DRAG_EXTERNAL_IMAGE] != 1 ){ js_function[DRAG_EXTERNAL_IMAGE] = 1;}
2215
                                if(reply_format == 0 ){reply_format = 20;}
2300
                                if(reply_format == 0 ){reply_format = 20;}
2216
                                string_length = snprintf(NULL,0,"drag_external_image(\"%s\",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d);\n",URL,int_data[2],int_data[3],int_data[6],int_data[7],int_data[0],int_data[1],int_data[6],int_data[7],ext_img_cnt,1);
2301
                                string_length = snprintf(NULL,0,"drag_external_image(\"%s\",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d);\n",URL,int_data[2],int_data[3],int_data[6],int_data[7],int_data[0],int_data[1],int_data[6],int_data[7],ext_img_cnt,1);
2217
                                check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2302
                                check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2218
                                snprintf(tmp_buffer,string_length,"drag_external_image(\"%s\",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d);\n",URL,int_data[2],int_data[3],int_data[6],int_data[7],int_data[0],int_data[1],int_data[6],int_data[7],ext_img_cnt,1);
2303
                                snprintf(tmp_buffer,string_length,"drag_external_image(\"%s\",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d);\n",URL,int_data[2],int_data[3],int_data[6],int_data[7],int_data[0],int_data[1],int_data[6],int_data[7],ext_img_cnt,1);
2219
                                drag_type = -1;
2304
                                drag_type = -1;
Line 3931... Line 4016...
3931
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
4016
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3932
  };\
4017
  };\
3933
 };\
4018
 };\
3934
 if(p == 0){alert(\"nothing drawn...\");return;};\
4019
 if(p == 0){alert(\"nothing drawn...\");return;};\
3935
 userdraw_x = [];userdraw_y = [];\
4020
 userdraw_x = [];userdraw_y = [];\
3936
 if( document.getElementById(\"canvas_input0\") ){\
4021
 if( document.getElementById(\"canvas_input0\") ){\
3937
  var p = 0;var input_reply = new Array();\
4022
  var p = 0;var input_reply = new Array();\
3938
  if( document.getElementById(\"canvas_input0\")){\
4023
  if( document.getElementById(\"canvas_input0\")){\
3939
   var t = 0;\
4024
   var t = 0;\
3940
   while(document.getElementById(\"canvas_input\"+t)){\
4025
   while(document.getElementById(\"canvas_input\"+t)){\
3941
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4026
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3942
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4027
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3943
     p++;\
4028
     p++;\
3944
    };\
4029
    };\
3945
    t++;\
4030
    t++;\
3946
   };\
4031
   };\
3947
  };\
4032
  };\
3948
  if( typeof userdraw_text != 'undefined' ){\
4033
  if( typeof userdraw_text != 'undefined' ){\
3949
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4034
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3950
  }\
4035
  }\
3951
  else\
4036
  else\
3952
  {\
4037
  {\
3953
   return reply +\"\\n\"+input_reply;\
4038
   return reply +\"\\n\"+input_reply;\
3954
  }\
4039
  }\
3955
 }\
4040
 }\
3956
 else\
4041
 else\
3957
 {\
4042
 {\
3958
  if( typeof userdraw_text != 'undefined' ){\
4043
  if( typeof userdraw_text != 'undefined' ){\
3959
   return reply +\"\\n\"+userdraw_text;\
4044
   return reply +\"\\n\"+userdraw_text;\
3960
  }\
4045
  }\
3961
  else\
4046
  else\
3962
  {\
4047
  {\
Line 3975... Line 4060...
3975
 while(userdraw_x[p]){\
4060
 while(userdraw_x[p]){\
3976
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\
4061
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\
3977
  p++;\
4062
  p++;\
3978
 };\
4063
 };\
3979
 if(p == 0){alert(\"nothing drawn...\");return;};\
4064
 if(p == 0){alert(\"nothing drawn...\");return;};\
3980
 if( document.getElementById(\"canvas_input0\") ){\
4065
 if( document.getElementById(\"canvas_input0\") ){\
3981
  var p = 0;var input_reply = new Array();\
-
 
3982
  if( document.getElementById(\"canvas_input0\")){\
-
 
3983
   var t = 0;\
-
 
3984
   while(document.getElementById(\"canvas_input\"+t)){\
-
 
3985
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
-
 
3986
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
-
 
3987
     p++;\
-
 
3988
    };\
-
 
3989
    t++;\
-
 
3990
   };\
-
 
3991
  };\
-
 
3992
  if( typeof userdraw_text != 'undefined' ){\
-
 
3993
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
-
 
3994
  }\
-
 
3995
  else\
-
 
3996
  {\
-
 
3997
   return reply+\"\\n\"+input_reply;\
-
 
3998
  }\
-
 
3999
 }\
-
 
4000
 else\
-
 
4001
 {\
-
 
4002
  if( typeof userdraw_text != 'undefined' ){\
-
 
4003
   return reply+\"\\n\"+userdraw_text;\
-
 
4004
  }\
-
 
4005
  else\
-
 
4006
  {\
-
 
4007
   return reply;\
-
 
4008
  }\
-
 
4009
 };\
-
 
4010
};\n\
-
 
4011
<!-- end function 7 read_canvas() -->");
-
 
4012
    break;
-
 
4013
    case 8: fprintf(js_include_file,"\
-
 
4014
\n<!-- begin function 8 read_canvas() -->\n\
-
 
4015
read_canvas = function(){\
-
 
4016
 var reply = new Array();\
-
 
4017
 var p = 0;\
-
 
4018
 var prec = %d;\
-
 
4019
 while(userdraw_x[p]){\
-
 
4020
  reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\
-
 
4021
  p++;\
-
 
4022
 };\
-
 
4023
 if(p == 0){alert(\"nothing drawn...\");return;};\
-
 
4024
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
-
 
4025
  var p = 0;var input_reply = new Array();\
4066
  var p = 0;var input_reply = new Array();\
4026
  if( document.getElementById(\"canvas_input0\")){\
4067
  if( document.getElementById(\"canvas_input0\")){\
4027
   var t = 0;\
4068
   var t = 0;\
4028
   while(document.getElementById(\"canvas_input\"+t)){\
4069
   while(document.getElementById(\"canvas_input\"+t)){\
4029
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4070
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
Line 4032... Line 4073...
4032
    };\
4073
    };\
4033
    t++;\
4074
    t++;\
4034
   };\
4075
   };\
4035
  };\
4076
  };\
4036
  if( typeof userdraw_text != 'undefined' ){\
4077
  if( typeof userdraw_text != 'undefined' ){\
4037
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4078
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4038
  }\
4079
  }\
4039
  else\
4080
  else\
4040
  {\
4081
  {\
4041
   return reply +\"\\n\"+input_reply;\
4082
   return reply+\"\\n\"+input_reply;\
4042
  }\
4083
  }\
4043
 }\
4084
 }\
4044
 else\
4085
 else\
4045
 {\
4086
 {\
4046
  if( typeof userdraw_text != 'undefined' ){\
4087
  if( typeof userdraw_text != 'undefined' ){\
-
 
4088
   return reply+\"\\n\"+userdraw_text;\
-
 
4089
  }\
-
 
4090
  else\
-
 
4091
  {\
-
 
4092
   return reply;\
-
 
4093
  }\
-
 
4094
 };\
-
 
4095
};\n\
-
 
4096
<!-- end function 7 read_canvas() -->");
-
 
4097
    break;
-
 
4098
    case 8: fprintf(js_include_file,"\
-
 
4099
\n<!-- begin function 8 read_canvas() -->\n\
-
 
4100
read_canvas = function(){\
-
 
4101
 var reply = new Array();\
-
 
4102
 var p = 0;\
-
 
4103
 var prec = %d;\
-
 
4104
 while(userdraw_x[p]){\
-
 
4105
  reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\
-
 
4106
  p++;\
-
 
4107
 };\
-
 
4108
 if(p == 0){alert(\"nothing drawn...\");return;};\
-
 
4109
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
-
 
4110
  var p = 0;var input_reply = new Array();\
-
 
4111
  if( document.getElementById(\"canvas_input0\")){\
-
 
4112
   var t = 0;\
-
 
4113
   while(document.getElementById(\"canvas_input\"+t)){\
-
 
4114
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
-
 
4115
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
-
 
4116
     p++;\
-
 
4117
    };\
-
 
4118
    t++;\
-
 
4119
   };\
-
 
4120
  };\
-
 
4121
  if( typeof userdraw_text != 'undefined' ){\
-
 
4122
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
-
 
4123
  }\
-
 
4124
  else\
-
 
4125
  {\
-
 
4126
   return reply +\"\\n\"+input_reply;\
-
 
4127
  }\
-
 
4128
 }\
-
 
4129
 else\
-
 
4130
 {\
-
 
4131
  if( typeof userdraw_text != 'undefined' ){\
4047
   return reply +\"\\n\"+userdraw_text;\
4132
   return reply +\"\\n\"+userdraw_text;\
4048
  }\
4133
  }\
4049
  else\
4134
  else\
4050
  {\
4135
  {\
4051
   return reply;\
4136
   return reply;\
4052
  }\
4137
  }\
4053
 };\
4138
 };\
Line 4060... Line 4145...
4060
 set_reply_precision();\
4145
 set_reply_precision();\
4061
 var reply = new Array();\
4146
 var reply = new Array();\
4062
 var p = 0;\
4147
 var p = 0;\
4063
 while(userdraw_x[p]){\
4148
 while(userdraw_x[p]){\
4064
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\
4149
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\
4065
  p++;\
4150
  p++;\
4066
 };\
4151
 };\
4067
 if(p == 0){alert(\"nothing drawn...\");return;};\
4152
 if(p == 0){alert(\"nothing drawn...\");return;};\
4068
 if( document.getElementById(\"canvas_input0\") ){\
4153
 if( document.getElementById(\"canvas_input0\") ){\
4069
  var p = 0;var input_reply = new Array();\
4154
  var p = 0;var input_reply = new Array();\
4070
  if( document.getElementById(\"canvas_input0\")){\
4155
  if( document.getElementById(\"canvas_input0\")){\
4071
   var t = 0;\
4156
   var t = 0;\
4072
   while(document.getElementById(\"canvas_input\"+t)){\
4157
   while(document.getElementById(\"canvas_input\"+t)){\
4073
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4158
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4074
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4159
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4075
     p++;\
4160
     p++;\
4076
    };\
4161
    };\
4077
    t++;\
4162
    t++;\
4078
   };\
4163
   };\
4079
  };\
4164
  };\
4080
  if( typeof userdraw_text != 'undefined' ){\
4165
  if( typeof userdraw_text != 'undefined' ){\
4081
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4166
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4082
  }\
4167
  }\
4083
  else\
4168
  else\
4084
  {\
4169
  {\
4085
   return reply +\"\\n\"+input_reply;\
4170
   return reply +\"\\n\"+input_reply;\
4086
  }\
4171
  }\
4087
 }\
4172
 }\
4088
 else\
4173
 else\
4089
 {\
4174
 {\
4090
  if( typeof userdraw_text != 'undefined' ){\
4175
  if( typeof userdraw_text != 'undefined' ){\
4091
   return reply +\"\\n\"+userdraw_text;\
4176
   return reply +\"\\n\"+userdraw_text;\
4092
  }\
4177
  }\
4093
  else\
4178
  else\
4094
  {\
4179
  {\
4095
   return reply;\
4180
   return reply;\
4096
  }\
4181
  }\
4097
 };\
4182
 };\
4098
};\n\
4183
};\n\
Line 4100... Line 4185...
4100
    break;
4185
    break;
4101
    case 10: fprintf(js_include_file,"\
4186
    case 10: fprintf(js_include_file,"\
4102
\n<!-- begin function 10 read_canvas() -->\n\
4187
\n<!-- begin function 10 read_canvas() -->\n\
4103
read_canvas = function(){\
4188
read_canvas = function(){\
4104
 var reply = new Array();\
4189
 var reply = new Array();\
4105
 var p = 0;\
4190
 var p = 0;\
4106
 var prec = %d;\
4191
 var prec = %d;\
4107
 while(userdraw_x[p]){\
4192
 while(userdraw_x[p]){\
4108
  reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*userdraw_radius[p]))/prec;\
4193
  reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*userdraw_radius[p]))/prec;\
4109
  p++;\
4194
  p++;\
4110
 };\
4195
 };\
4111
 if(p == 0){alert(\"nothing drawn...\");return;};\
4196
 if(p == 0){alert(\"nothing drawn...\");return;};\
Line 4152... Line 4237...
4152
  reply = reply + (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\",\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec +\"\\n\" ;\
4237
  reply = reply + (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\",\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec +\"\\n\" ;\
4153
  p = p+2;\
4238
  p = p+2;\
4154
 };\
4239
 };\
4155
 if(p == 0){alert(\"nothing drawn...\");return;};\
4240
 if(p == 0){alert(\"nothing drawn...\");return;};\
4156
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
4241
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
4157
  var p = 0;var input_reply = new Array();\
4242
  var p = 0;var input_reply = new Array();\
4158
  if( document.getElementById(\"canvas_input0\")){\
4243
  if( document.getElementById(\"canvas_input0\")){\
4159
   var t = 0;\
4244
   var t = 0;\
4160
   while(document.getElementById(\"canvas_input\"+t)){\
4245
   while(document.getElementById(\"canvas_input\"+t)){\
4161
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4246
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4162
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4247
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4163
     p++;\
4248
     p++;\
4164
    };\
4249
    };\
4165
    t++;\
4250
    t++;\
4166
   };\
4251
   };\
4167
  };\
4252
  };\
4168
  if( typeof userdraw_text != 'undefined' ){\
4253
  if( typeof userdraw_text != 'undefined' ){\
4169
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4254
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4170
  }\
4255
  }\
4171
  else\
4256
  else\
4172
  {\
4257
  {\
4173
   return reply +\"\\n\"+input_reply;\
4258
   return reply +\"\\n\"+input_reply;\
4174
  }\
4259
  }\
4175
 }\
4260
 }\
4176
 else\
4261
 else\
4177
 {\
4262
 {\
4178
  if( typeof userdraw_text != 'undefined' ){\
4263
  if( typeof userdraw_text != 'undefined' ){\
4179
   return reply +\"\\n\"+userdraw_text;\
4264
   return reply +\"\\n\"+userdraw_text;\
4180
  }\
4265
  }\
4181
  else\
4266
  else\
4182
  {\
4267
  {\
4183
   return reply;\
4268
   return reply;\
4184
  }\
4269
  }\
4185
 };\
4270
 };\
4186
};\n\
4271
};\n\
4187
<!-- end function 11 read_canvas() -->",reply_precision);
4272
<!-- end function 11 read_canvas() -->",reply_precision);
4188
    break;
4273
    break;
4189
    case 12: fprintf(js_include_file,"\
4274
    case 12: fprintf(js_include_file,"\
4190
\n<!-- begin function 12 read_canvas() -->\n\
4275
\n<!-- begin function 12 read_canvas() -->\n\
4191
read_canvas = function(){\
4276
read_canvas = function(){\
4192
 set_reply_precision();\
4277
 set_reply_precision();\
4193
 var reply = \"\";\
4278
 var reply = \"\";\
4194
 var p = 0;\
4279
 var p = 0;\
4195
 for(p = 0; p< userdraw_x.lenght;p = p+2){\
4280
 for(p = 0; p< userdraw_x.lenght;p = p+2){\
4196
  if(userdraw_x[p] != null){\
4281
  if(userdraw_x[p] != null){\
Line 4220... Line 4305...
4220
 }\
4305
 }\
4221
 else\
4306
 else\
4222
 {\
4307
 {\
4223
  if( typeof userdraw_text != 'undefined' ){\
4308
  if( typeof userdraw_text != 'undefined' ){\
4224
   return reply +\"\\n\"+userdraw_text\
4309
   return reply +\"\\n\"+userdraw_text\
4225
  }\
4310
  }\
4226
  else\
4311
  else\
4227
  {\
4312
  {\
4228
   return reply;\
4313
   return reply;\
4229
  }\
4314
  }\
4230
 };\
4315
 };\
4231
};\n\
4316
};\n\
4232
<!-- end function 12 read_canvas() -->");
4317
<!-- end function 12 read_canvas() -->");
4233
    break;
4318
    break;
4234
    case 13: fprintf(js_include_file,"\
4319
    case 13: fprintf(js_include_file,"\
4235
\n<!-- begin function 13 read_canvas() -->\n\
4320
\n<!-- begin function 13 read_canvas() -->\n\
4236
read_canvas = function(){\
4321
read_canvas = function(){\
4237
 var reply = new Array();\
4322
 var reply = new Array();\
4238
 var p = 0;var i = 0;\
4323
 var p = 0;var i = 0;\
4239
 var prec = %d;\
4324
 var prec = %d;\
4240
 while(userdraw_x[p]){\
4325
 while(userdraw_x[p]){\
4241
  reply[i] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec;\
4326
  reply[i] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\":\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec;\
4242
  p = p+2;i++;\
4327
  p = p+2;i++;\
4243
 };\
4328
 };\
4244
 if(p == 0){alert(\"nothing drawn...\");return;};\
4329
 if(p == 0){alert(\"nothing drawn...\");return;};\
4245
 if( document.getElementById(\"canvas_input0\") ){\
4330
 if( document.getElementById(\"canvas_input0\") ){\
4246
  var p = 0;var input_reply = new Array();\
4331
  var p = 0;var input_reply = new Array();\
4247
  if( document.getElementById(\"canvas_input0\")){\
4332
  if( document.getElementById(\"canvas_input0\")){\
4248
   var t = 0;\
4333
   var t = 0;\
4249
   while(document.getElementById(\"canvas_input\"+t)){\
4334
   while(document.getElementById(\"canvas_input\"+t)){\
4250
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4335
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4251
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4336
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4252
     p++;\
4337
     p++;\
4253
    };\
4338
    };\
4254
    t++;\
4339
    t++;\
4255
   };\
4340
   };\
4256
  };\
4341
  };\
4257
  if( typeof userdraw_text != 'undefined' ){\
4342
  if( typeof userdraw_text != 'undefined' ){\
4258
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4343
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4259
  }\
4344
  }\
4260
  else\
4345
  else\
4261
  {\
4346
  {\
4262
   return reply +\"\\n\"+input_reply;\
4347
   return reply +\"\\n\"+input_reply;\
4263
  }\
4348
  }\
4264
 }\
4349
 }\
4265
 else\
4350
 else\
4266
 {\
4351
 {\
4267
  if( typeof userdraw_text != 'undefined' ){\
4352
  if( typeof userdraw_text != 'undefined' ){\
4268
   return reply +\"\\n\"+userdraw_text\
4353
   return reply +\"\\n\"+userdraw_text\
4269
  }\
4354
  }\
4270
  else\
4355
  else\
4271
  {\
4356
  {\
4272
   return reply;\
4357
   return reply;\
4273
  }\
4358
  }\
Line 4469... Line 4554...
4469
 for(var p = 0 ; p < lu ; p++){\
4554
 for(var p = 0 ; p < lu ; p++){\
4470
  reply[idx] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec;idx++;\
4555
  reply[idx] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec;idx++;\
4471
  reply[idx] = (Math.round(prec*(px2y(userdraw_y[p]))))/prec;idx++;\
4556
  reply[idx] = (Math.round(prec*(px2y(userdraw_y[p]))))/prec;idx++;\
4472
 };\
4557
 };\
4473
 if( document.getElementById(\"canvas_input0\") ){\
4558
 if( document.getElementById(\"canvas_input0\") ){\
4474
  var p = 0;var input_reply = new Array();\
4559
  var p = 0;var input_reply = new Array();\
4475
  if( document.getElementById(\"canvas_input0\")){\
4560
  if( document.getElementById(\"canvas_input0\")){\
4476
   var t = 0;\
4561
   var t = 0;\
4477
   while(document.getElementById(\"canvas_input\"+t)){\
4562
   while(document.getElementById(\"canvas_input\"+t)){\
4478
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4563
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4479
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4564
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4480
     p++;\
4565
     p++;\
4481
    };\
4566
    };\
4482
    t++;\
4567
    t++;\
4483
   };\
4568
   };\
4484
  };\
4569
  };\
4485
  if( typeof userdraw_text != 'undefined' ){\
4570
  if( typeof userdraw_text != 'undefined' ){\
4486
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4571
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4487
  }\
4572
  }\
4488
  else\
4573
  else\
4489
  {\
4574
  {\
Line 4492... Line 4577...
4492
 }\
4577
 }\
4493
 else\
4578
 else\
4494
 {\
4579
 {\
4495
  if( typeof userdraw_text != 'undefined' ){\
4580
  if( typeof userdraw_text != 'undefined' ){\
4496
   return reply +\"\\n\"+userdraw_text;\
4581
   return reply +\"\\n\"+userdraw_text;\
4497
  }\
4582
  }\
4498
  else\
4583
  else\
4499
  {\
4584
  {\
4500
   return reply;\
4585
   return reply;\
4501
  }\
4586
  }\
4502
 };\
4587
 };\
4503
};\n\
4588
};\n\
Line 4532... Line 4617...
4532
    t++;\
4617
    t++;\
4533
   };\
4618
   };\
4534
  };\
4619
  };\
4535
  if( typeof userdraw_text != 'undefined' ){\
4620
  if( typeof userdraw_text != 'undefined' ){\
4536
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4621
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4537
  }\
4622
  }\
4538
  else\
4623
  else\
4539
  {\
4624
  {\
4540
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\
4625
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\
4541
  }\
4626
  }\
4542
 }\
4627
 }\
4543
 else\
4628
 else\
Line 4546... Line 4631...
4546
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
4631
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
4547
  }\
4632
  }\
4548
  else\
4633
  else\
4549
  {\
4634
  {\
4550
   return reply_x+\"\\n\"+reply_y;\
4635
   return reply_x+\"\\n\"+reply_y;\
4551
  };\
4636
  };\
4552
 };\
4637
 };\
4553
};\n\
4638
};\n\
4554
<!-- end function 23 read_canvas() -->",reply_precision);
4639
<!-- end function 23 read_canvas() -->",reply_precision);
4555
    break;
4640
    break;
4556
    case 24: fprintf(js_include_file,"\n\
4641
    case 24: fprintf(js_include_file,"\n\
4557
<!-- begin function 24  read_canvas() -->\n\
4642
<!-- begin function 24  read_canvas() -->\n\
Line 4587... Line 4672...
4587
read_canvas = function(){\
4672
read_canvas = function(){\
4588
 if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\
4673
 if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\
4589
 var lu = userdraw_radius.length;\
4674
 var lu = userdraw_radius.length;\
4590
 var prec = %d;\
4675
 var prec = %d;\
4591
 var angle_reply = new Array(lu);\
4676
 var angle_reply = new Array(lu);\
4592
 for(var p = 0 ; p < lu ; p++){\
4677
 for(var p = 0 ; p < lu ; p++){\
4593
  angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\
4678
  angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\
4594
 };\
4679
 };\
4595
 return angle_reply;\
4680
 return angle_reply;\
4596
};\n\
4681
};\n\
4597
<!-- end function 26 read_canvas() -->",reply_precision);
4682
<!-- end function 26 read_canvas() -->",reply_precision);
Line 4695... Line 4780...
4695
      dragxy(evt);\
4780
      dragxy(evt);\
4696
     };\
4781
     };\
4697
    };\
4782
    };\
4698
   };\
4783
   };\
4699
  };\
4784
  };\
4700
 }\
4785
 }\
4701
 else\
4786
 else\
4702
 {\
4787
 {\
4703
  selected_image = null;\
4788
  selected_image = null;\
4704
 };\
4789
 };\
4705
};",canvas_root_id);
4790
};",canvas_root_id);
Line 4731... Line 4816...
4731
};",canvas_root_id);
4816
};",canvas_root_id);
4732
    break;
4817
    break;
4733
    case DRAW_GRIDFILL:/* not used for userdraw */
4818
    case DRAW_GRIDFILL:/* not used for userdraw */
4734
fprintf(js_include_file,"\n<!-- draw gridfill -->\n\
4819
fprintf(js_include_file,"\n<!-- draw gridfill -->\n\
4735
var draw_gridfill = function(canvas_type,x0,y0,dx,dy,linewidth,color,opacity,xsize,ysize){\
4820
var draw_gridfill = function(canvas_type,x0,y0,dx,dy,linewidth,color,opacity,xsize,ysize){\
4736
 var obj;\
4821
 var obj;\
4737
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4822
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4738
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4823
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4739
 }\
4824
 }\
4740
 else\
4825
 else\
4741
 {\
4826
 {\
4742
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4827
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4743
 };\
4828
 };\
4744
 var ctx = obj.getContext(\"2d\");\
4829
 var ctx = obj.getContext(\"2d\");\
4745
 var x,y;\
4830
 var x,y;\
Line 4760... Line 4845...
4760
    break;
4845
    break;
4761
 
4846
 
4762
    case DRAW_IMAGEFILL:/* not  used for userdraw */
4847
    case DRAW_IMAGEFILL:/* not  used for userdraw */
4763
fprintf(js_include_file,"\n<!-- draw imagefill -->\n\
4848
fprintf(js_include_file,"\n<!-- draw imagefill -->\n\
4764
var draw_imagefill = function(canvas_type,x0,y0,URL,xsize,ysize){\
4849
var draw_imagefill = function(canvas_type,x0,y0,URL,xsize,ysize){\
4765
 var obj;\
4850
 var obj;\
4766
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4851
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4767
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4852
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4768
 }\
4853
 }\
4769
 else\
4854
 else\
4770
 {\
4855
 {\
4771
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4856
  obj = create_canvas%d(canvas_type,xsize,ysize);\
Line 4775... Line 4860...
4775
 var img = new Image();\
4860
 var img = new Image();\
4776
 img.src = URL;\
4861
 img.src = URL;\
4777
 img.onload = function(){\
4862
 img.onload = function(){\
4778
  if( (img.width > xsize-x0) && (img.height > ysize-y0) ){\
4863
  if( (img.width > xsize-x0) && (img.height > ysize-y0) ){\
4779
    ctx.drawImage(img,x0,y0,xsize,ysize);\
4864
    ctx.drawImage(img,x0,y0,xsize,ysize);\
4780
  }\
4865
  }\
4781
  else\
4866
  else\
4782
  {\
4867
  {\
4783
    var repeat = \"repeat\";\
4868
    var repeat = \"repeat\";\
4784
    if(img.width > xsize - x0){\
4869
    if(img.width > xsize - x0){\
4785
        repeat = \"repeat-y\";\
4870
        repeat = \"repeat-y\";\
Line 4802... Line 4887...
4802
    break;
4887
    break;
4803
 
4888
 
4804
    case DRAW_DOTFILL:/* not  used for userdraw */
4889
    case DRAW_DOTFILL:/* not  used for userdraw */
4805
fprintf(js_include_file,"\n<!-- draw dotfill -->\n\
4890
fprintf(js_include_file,"\n<!-- draw dotfill -->\n\
4806
var draw_dotfill = function(canvas_type,x0,y0,dx,dy,radius,color,opacity,xsize,ysize){\
4891
var draw_dotfill = function(canvas_type,x0,y0,dx,dy,radius,color,opacity,xsize,ysize){\
4807
 var obj;\
4892
 var obj;\
4808
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4893
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4809
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4894
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4810
 }\
4895
 }\
4811
 else\
4896
 else\
4812
 {\
4897
 {\
4813
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4898
  obj = create_canvas%d(canvas_type,xsize,ysize);\
Line 4830... Line 4915...
4830
    break;
4915
    break;
4831
 
4916
 
4832
    case DRAW_DIAMONDFILL:/* not used for userdraw */
4917
    case DRAW_DIAMONDFILL:/* not used for userdraw */
4833
fprintf(js_include_file,"\n<!-- draw hatch fill -->\n\
4918
fprintf(js_include_file,"\n<!-- draw hatch fill -->\n\
4834
var draw_diamondfill = function(canvas_type,x0,y0,dx,dy,linewidth,stroke_color,stroke_opacity,xsize,ysize){\
4919
var draw_diamondfill = function(canvas_type,x0,y0,dx,dy,linewidth,stroke_color,stroke_opacity,xsize,ysize){\
4835
  var obj;\
4920
  var obj;\
4836
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4921
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4837
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4922
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4838
 }\
4923
 }\
4839
 else\
4924
 else\
4840
 {\
4925
 {\
4841
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4926
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4842
 };\
4927
 };\
4843
 var ctx = obj.getContext(\"2d\");\
4928
 var ctx = obj.getContext(\"2d\");\
4844
 var x;\
4929
 var x;\
4845
 var y;\
4930
 var y;\
4846
 ctx.save();\
4931
 ctx.save();\
4847
 ctx.lineWidth = linewidth;\
4932
 ctx.lineWidth = linewidth;\
4848
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4933
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4849
 y = ysize;\
4934
 y = ysize;\
4850
 for( x = x0 ; x < xsize ; x = x + dx ){\
4935
 for( x = x0 ; x < xsize ; x = x + dx ){\
4851
  ctx.moveTo(x,y0);\
4936
  ctx.moveTo(x,y0);\
4852
  ctx.lineTo(xsize,y);\
4937
  ctx.lineTo(xsize,y);\
4853
  y = y - dy;\
4938
  y = y - dy;\
4854
 };\
4939
 };\
Line 4872... Line 4957...
4872
 };\
4957
 };\
4873
 ctx.stroke();\
4958
 ctx.stroke();\
4874
 ctx.restore();\
4959
 ctx.restore();\
4875
 return;\
4960
 return;\
4876
 }",canvas_root_id,canvas_root_id,canvas_root_id);
4961
 }",canvas_root_id,canvas_root_id,canvas_root_id);
4877
    break;
4962
    break;
4878
 
4963
 
4879
    case DRAW_HATCHFILL:/* not used for userdraw */
4964
    case DRAW_HATCHFILL:/* not used for userdraw */
4880
fprintf(js_include_file,"\n<!-- draw hatch fill -->\n\
4965
fprintf(js_include_file,"\n<!-- draw hatch fill -->\n\
4881
var draw_hatchfill = function(canvas_type,x0,y0,dx,dy,linewidth,stroke_color,stroke_opacity,xsize,ysize){\
4966
var draw_hatchfill = function(canvas_type,x0,y0,dx,dy,linewidth,stroke_color,stroke_opacity,xsize,ysize){\
4882
  var obj;\
4967
  var obj;\
Line 4911... Line 4996...
4911
 };",canvas_root_id,canvas_root_id,canvas_root_id);
4996
 };",canvas_root_id,canvas_root_id,canvas_root_id);
4912
    break;
4997
    break;
4913
    case DRAW_CIRCLES:/*  used for userdraw */
4998
    case DRAW_CIRCLES:/*  used for userdraw */
4914
fprintf(js_include_file,"\n<!-- draw circles -->\n\
4999
fprintf(js_include_file,"\n<!-- draw circles -->\n\
4915
var draw_circles = function(ctx,x_points,y_points,radius,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
5000
var draw_circles = function(ctx,x_points,y_points,radius,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
4916
 ctx.save();\
5001
 ctx.save();\
4917
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
5002
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4918
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
5003
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4919
 ctx.lineWidth = line_width;\
5004
 ctx.lineWidth = line_width;\
4920
 for(var p = 0 ; p < x_points.length ; p++ ){\
5005
 for(var p = 0 ; p < x_points.length ; p++ ){\
4921
  ctx.beginPath();\
5006
  ctx.beginPath();\
4922
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
5007
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4923
  ctx.closePath();\
5008
  ctx.closePath();\
4924
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
5009
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4925
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
5010
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4926
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5011
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4927
  ctx.stroke();\
5012
  ctx.stroke();\
4928
 }\
5013
 }\
4929
 ctx.restore();\
5014
 ctx.restore();\
4930
 return;\
5015
 return;\
4931
};");
5016
};");
4932
    break;
5017
    break;
4933
    case DRAW_POLYLINE:/* user for userdraw : draw lines through points */
5018
    case DRAW_POLYLINE:/* user for userdraw : draw lines through points */
4934
fprintf(js_include_file,"\n<!-- draw polyline -->\n\
5019
fprintf(js_include_file,"\n<!-- draw polyline -->\n\
4935
var draw_polyline = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
5020
var draw_polyline = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
4936
 ctx.save();\
5021
 ctx.save();\
4937
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
5022
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4938
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
5023
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4939
 ctx.lineWidth = line_width;\
5024
 ctx.lineWidth = line_width;\
4940
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5025
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4941
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
5026
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4942
 ctx.clearRect(0,0,xsize,ysize);\
5027
 ctx.clearRect(0,0,xsize,ysize);\
4943
 ctx.beginPath();\
5028
 ctx.beginPath();\
4944
 for(var p = 0 ; p < x_points.length-1 ; p++ ){\
5029
 for(var p = 0 ; p < x_points.length-1 ; p++ ){\
4945
  ctx.moveTo(x_points[p],y_points[p]);\
5030
  ctx.moveTo(x_points[p],y_points[p]);\
Line 4947... Line 5032...
4947
 }\
5032
 }\
4948
 ctx.closePath();\
5033
 ctx.closePath();\
4949
 ctx.stroke();\
5034
 ctx.stroke();\
4950
 ctx.fillStyle =\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5035
 ctx.fillStyle =\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4951
 for(var p = 0 ; p < x_points.length ; p++ ){\
5036
 for(var p = 0 ; p < x_points.length ; p++ ){\
4952
  ctx.beginPath();\
5037
  ctx.beginPath();\
4953
  ctx.arc(x_points[p],y_points[p],line_width,0,2*Math.PI,false);\
5038
  ctx.arc(x_points[p],y_points[p],line_width,0,2*Math.PI,false);\
4954
  ctx.closePath();ctx.fill();ctx.stroke();\
5039
  ctx.closePath();ctx.fill();ctx.stroke();\
4955
 };\
5040
 };\
4956
 ctx.restore();\
5041
 ctx.restore();\
4957
 return;\
5042
 return;\
Line 4969... Line 5054...
4969
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
5054
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4970
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
5055
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
4971
  ctx.beginPath();\
5056
  ctx.beginPath();\
4972
  ctx.moveTo(x_points[p],y_points[p]);\
5057
  ctx.moveTo(x_points[p],y_points[p]);\
4973
  ctx.lineTo(x_points[p+1],y_points[p+1]);\
5058
  ctx.lineTo(x_points[p+1],y_points[p+1]);\
4974
  ctx.closePath();\
5059
  ctx.closePath();\
4975
  ctx.stroke();\
5060
  ctx.stroke();\
4976
  }\
5061
  }\
4977
  ctx.restore();\
5062
  ctx.restore();\
4978
  return;\
5063
  return;\
4979
 };");
5064
 };");
Line 4992... Line 5077...
4992
 var Y1 = y1 - (x1)*(y2 - y1)/(x2 - x1);\
5077
 var Y1 = y1 - (x1)*(y2 - y1)/(x2 - x1);\
4993
 var Y2 = y1 + (xsize - x1)*(y2 - y1)/(x2 - x1);\
5078
 var Y2 = y1 + (xsize - x1)*(y2 - y1)/(x2 - x1);\
4994
 return [0,Y1,xsize,Y2];\
5079
 return [0,Y1,xsize,Y2];\
4995
};\
5080
};\
4996
var draw_lines = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
5081
var draw_lines = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
4997
 ctx.save();\
5082
 ctx.save();\
4998
 var line = new Array(4);\
5083
 var line = new Array(4);\
4999
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
5084
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
5000
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
5085
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
5001
 ctx.lineWidth = line_width;\
5086
 ctx.lineWidth = line_width;\
5002
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5087
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5003
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
5088
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
5004
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
5089
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
5005
  line = calc_line(x_points[p],x_points[p+1],y_points[p],y_points[p+1]);\
5090
  line = calc_line(x_points[p],x_points[p+1],y_points[p],y_points[p+1]);\
-
 
5091
  ctx.beginPath();\
-
 
5092
  ctx.moveTo(line[0],line[1]);\
-
 
5093
  ctx.lineTo(line[2],line[3]);\
-
 
5094
  ctx.closePath();\
-
 
5095
  ctx.stroke();\
-
 
5096
  }\
-
 
5097
  ctx.restore();\
-
 
5098
  return;\
-
 
5099
 };");
-
 
5100
    break;
-
 
5101
 
-
 
5102
    case DRAW_DEMILINES:/*  used for userdraw */
-
 
5103
fprintf(js_include_file,"\n<!-- draw demilines -->\n\
-
 
5104
function find_inf_point(x1,y1,x2,y2){\
-
 
5105
 if(x1<x2+2 && x1>x2-2){if(y1<y2){return [x1,y1,x1,ysize];}else{return [x1,0,x1,y1];};};\
-
 
5106
 var rc = (y2 - y1)/(x2 - x1);var q = y1 - (x1)*rc;\
-
 
5107
 if( x1 < x2 ){ return [x1,y1,xsize,rc*xsize+q];}else{return [x1,y1,0,q];};\
-
 
5108
};\
-
 
5109
var draw_demilines = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
-
 
5110
 ctx.save();\
-
 
5111
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
-
 
5112
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
-
 
5113
 ctx.lineWidth = line_width;\
-
 
5114
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
-
 
5115
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
-
 
5116
 var pair = new Array(4);\
-
 
5117
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
-
 
5118
  pair = find_inf_point(x_points[p],y_points[p],x_points[p+1],y_points[p+1]);\
5006
  ctx.beginPath();\
5119
  ctx.beginPath();\
5007
  ctx.moveTo(line[0],line[1]);\
5120
  ctx.moveTo(pair[0],pair[1]);\
5008
  ctx.lineTo(line[2],line[3]);\
5121
  ctx.lineTo(pair[2],pair[3]);\
5009
  ctx.closePath();\
5122
  ctx.closePath();\
5010
  ctx.stroke();\
5123
  ctx.stroke();\
5011
  }\
5124
  }\
5012
  ctx.restore();\
5125
  ctx.restore();\
5013
  return;\
5126
  return;\
Line 5126... Line 5239...
5126
    break;
5239
    break;
5127
 
5240
 
5128
    case DRAW_PATHS: /*  used for userdraw */
5241
    case DRAW_PATHS: /*  used for userdraw */
5129
fprintf(js_include_file,"\n<!-- draw paths -->\n\
5242
fprintf(js_include_file,"\n<!-- draw paths -->\n\
5130
var draw_paths = function(ctx,x_points,y_points,line_width,closed_path,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype0,use_rotate,angle,use_affine,affine_matrix){\
5243
var draw_paths = function(ctx,x_points,y_points,line_width,closed_path,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype0,use_rotate,angle,use_affine,affine_matrix){\
5131
 ctx.save();\
5244
 ctx.save();\
5132
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
5245
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
5133
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
5246
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
5134
 ctx.lineWidth = line_width;\
5247
 ctx.lineWidth = line_width;\
5135
 ctx.lineJoin = \"round\";\
5248
 ctx.lineJoin = \"round\";\
5136
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5249
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
5137
 ctx.beginPath();\
5250
 ctx.beginPath();\
5138
 ctx.moveTo(x_points[0],y_points[0]);\
5251
 ctx.moveTo(x_points[0],y_points[0]);\
Line 5343... Line 5456...
5343
  else\
5456
  else\
5344
  {\
5457
  {\
5345
   ctx.fillText(num,x - 0.5*txtsize,zero_y+2*font_size);\
5458
   ctx.fillText(num,x - 0.5*txtsize,zero_y+2*font_size);\
5346
  }\
5459
  }\
5347
  num = num + xmajor;\
5460
  num = num + xmajor;\
5348
 };\
5461
 };\
5349
 ctx.stroke();\
5462
 ctx.stroke();\
5350
 ctx.closePath();\
5463
 ctx.closePath();\
5351
 ctx.lineWidth = 1;\
5464
 ctx.lineWidth = 1;\
5352
 ctx.beginPath();\
5465
 ctx.beginPath();\
5353
 for(var x = zero_x+snor_x ; x < xsize;x = x + step_x){\
5466
 for(var x = zero_x+snor_x ; x < xsize;x = x + step_x){\
5354
   ctx.moveTo(x,zero_y);\
5467
   ctx.moveTo(x,zero_y);\
Line 5559... Line 5672...
5559
  ctx.lineTo(p,ysize);\
5672
  ctx.lineTo(p,ysize);\
5560
 };\
5673
 };\
5561
 for(var p = zero_x ; p > 0; p = p - x2step){\
5674
 for(var p = zero_x ; p > 0; p = p - x2step){\
5562
  ctx.moveTo(p,0);\
5675
  ctx.moveTo(p,0);\
5563
  ctx.lineTo(p,ysize);\
5676
  ctx.lineTo(p,ysize);\
5564
 };\
5677
 };\
5565
 for(var p = zero_y ; p < ysize; p = p + y2step){\
5678
 for(var p = zero_y ; p < ysize; p = p + y2step){\
5566
  ctx.moveTo(0,p);\
5679
  ctx.moveTo(0,p);\
5567
  ctx.lineTo(xsize,p);\
5680
  ctx.lineTo(xsize,p);\
5568
 };\
5681
 };\
5569
 for(var p = zero_y ; p > 0; p = p - y2step){\
5682
 for(var p = zero_y ; p > 0; p = p - y2step){\
5570
  ctx.moveTo(0,p);\
5683
  ctx.moveTo(0,p);\
5571
  ctx.lineTo(xsize,p);\
5684
  ctx.lineTo(xsize,p);\
5572
 };\
5685
 };\
5573
 ctx.stroke();\
5686
 ctx.stroke();\
5574
 ctx.closePath();\
5687
 ctx.closePath();\
5575
 ctx.beginPath();\
5688
 ctx.beginPath();\
5576
 ctx.lineWidth = 2*line_width;\
5689
 ctx.lineWidth = 2*line_width;\
5577
 ctx.strokeStyle = axis_color;\
5690
 ctx.strokeStyle = axis_color;\
5578
 ctx.moveTo(0,zero_y);\
5691
 ctx.moveTo(0,zero_y);\
5579
 ctx.lineTo(xsize,zero_y);\
5692
 ctx.lineTo(xsize,zero_y);\
5580
 ctx.moveTo(zero_x,0);\
5693
 ctx.moveTo(zero_x,0);\
5581
 ctx.lineTo(zero_x,ysize);\
5694
 ctx.lineTo(zero_x,ysize);\
5582
 ctx.stroke();\
5695
 ctx.stroke();\
Line 5598... Line 5711...
5598
 for(var p = zero_y ; p > 0; p = p - ystep){\
5711
 for(var p = zero_y ; p > 0; p = p - ystep){\
5599
  ctx.moveTo(zero_x-tics_length,p);\
5712
  ctx.moveTo(zero_x-tics_length,p);\
5600
  ctx.lineTo(zero_x+tics_length,p);\
5713
  ctx.lineTo(zero_x+tics_length,p);\
5601
 };\
5714
 };\
5602
 for(var p = zero_x ; p < xsize; p = p + x2step){\
5715
 for(var p = zero_x ; p < xsize; p = p + x2step){\
5603
  ctx.moveTo(p,zero_y-0.5*tics_length);\
5716
  ctx.moveTo(p,zero_y-0.5*tics_length);\
5604
  ctx.lineTo(p,zero_y+0.5*tics_length);\
5717
  ctx.lineTo(p,zero_y+0.5*tics_length);\
5605
 };\
5718
 };\
5606
 for(var p = zero_x ; p > 0; p = p - x2step){\
5719
 for(var p = zero_x ; p > 0; p = p - x2step){\
5607
  ctx.moveTo(p,zero_y-0.5*tics_length);\
5720
  ctx.moveTo(p,zero_y-0.5*tics_length);\
5608
  ctx.lineTo(p,zero_y+0.5*tics_length);\
5721
  ctx.lineTo(p,zero_y+0.5*tics_length);\
Line 5646... Line 5759...
5646
 {\
5759
 {\
5647
  skip = 1;cnt = px2x(zero_x);\
5760
  skip = 1;cnt = px2x(zero_x);\
5648
  prec = Math.log(precision)/(Math.log(10));\
5761
  prec = Math.log(precision)/(Math.log(10));\
5649
  var y_basis;if(f_y == 1){ y_basis = ysize }else{ y_basis = zero_y + 1.4*font_size;};\
5762
  var y_basis;if(f_y == 1){ y_basis = ysize }else{ y_basis = zero_y + 1.4*font_size;};\
5650
  for( var p = zero_x ; p < xsize ; p = p+xstep){\
5763
  for( var p = zero_x ; p < xsize ; p = p+xstep){\
5651
   if(skip == 0 ){\
5764
   if(skip == 0 ){\
5652
    disp_cnt = cnt.toFixed(prec);\
5765
    disp_cnt = cnt.toFixed(prec);\
5653
    corr = ctx.measureText(disp_cnt).width;\
5766
    corr = ctx.measureText(disp_cnt).width;\
5654
    skip = parseInt(1.2*corr/xstep);\
5767
    skip = parseInt(1.2*corr/xstep);\
5655
    ctx.fillText(disp_cnt,p-0.5*corr,y_basis);\
5768
    ctx.fillText(disp_cnt,p-0.5*corr,y_basis);\
5656
   }\
5769
   }\
5657
   else\
5770
   else\
5658
   {\
5771
   {\
5659
    skip--;\
5772
    skip--;\
5660
   };\
5773
   };\
5661
   cnt = cnt + xmajor;\
5774
   cnt = cnt + xmajor;\
5662
  };\
5775
  };\
5663
  cnt = px2x(zero_x);skip = 1;\
5776
  cnt = px2x(zero_x);skip = 1;\
Line 5665... Line 5778...
5665
   if(skip == 0 ){\
5778
   if(skip == 0 ){\
5666
    disp_cnt = cnt.toFixed(prec);\
5779
    disp_cnt = cnt.toFixed(prec);\
5667
    corr = ctx.measureText(disp_cnt).width;\
5780
    corr = ctx.measureText(disp_cnt).width;\
5668
    skip = parseInt(1.2*corr/xstep);\
5781
    skip = parseInt(1.2*corr/xstep);\
5669
    ctx.fillText(disp_cnt,p-0.5*corr,y_basis);\
5782
    ctx.fillText(disp_cnt,p-0.5*corr,y_basis);\
5670
   }\
5783
   }\
5671
   else\
5784
   else\
5672
   {\
5785
   {\
5673
    skip--;\
5786
    skip--;\
5674
   };\
5787
   };\
5675
   cnt = cnt - xmajor;\
5788
   cnt = cnt - xmajor;\
5676
  };\
5789
  };\
5677
 };\
5790
 };\
5678
 if( y_strings != null ){\
5791
 if( y_strings != null ){\
Line 6706... Line 6819...
6706
        *centerstring="centerstring",
6819
        *centerstring="centerstring",
6707
        *xunit="xunit",
6820
        *xunit="xunit",
6708
        *yunit="yunit",
6821
        *yunit="yunit",
6709
        *slider="slider",
6822
        *slider="slider",
6710
        *killslider="killslider",
6823
        *killslider="killslider",
6711
        *angle="angle";
6824
        *angle="angle",
-
 
6825
        *halfline="halfline",
-
 
6826
        *demiline="demiline";
6712
 
6827
 
6713
        while(((c = getc(infile)) != EOF)&&(c!='\n')&&(c!=',')&&(c!='=')&&(c!='\r')){
6828
        while(((c = getc(infile)) != EOF)&&(c!='\n')&&(c!=',')&&(c!='=')&&(c!='\r')){
6714
            if( i == 0 && (c == ' ' || c == '\t') ){
6829
            if( i == 0 && (c == ' ' || c == '\t') ){
6715
        continue; /* white spaces or tabs allowed before first command identifier */
6830
        continue; /* white spaces or tabs allowed before first command identifier */
6716
            }
6831
            }
Line 7399... Line 7514...
7399
        return YUNIT;
7514
        return YUNIT;
7400
        }
7515
        }
7401
        if( strcmp(input_type, angle) == 0 ){
7516
        if( strcmp(input_type, angle) == 0 ){
7402
        free(input_type);
7517
        free(input_type);
7403
        return ANGLE;
7518
        return ANGLE;
-
 
7519
        }
-
 
7520
        if( strcmp(input_type, halfline) == 0 || strcmp(input_type, demiline) == 0  ){
-
 
7521
        free(input_type);
-
 
7522
        return HALFLINE;
7404
        }
7523
        }
7405
        free(input_type);
7524
        free(input_type);
7406
        ungetc(c,infile);
7525
        ungetc(c,infile);
7407
        return 0;
7526
        return 0;
7408
}
7527
}