Subversion Repositories wimsdev

Rev

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

Rev 7783 Rev 7784
Line 238... Line 238...
238
var use_xlogscale = 0;\
238
var use_xlogscale = 0;\
239
var use_ylogscale = 0;\
239
var use_ylogscale = 0;\
240
var x_strings = null;\
240
var x_strings = null;\
241
var y_strings = null;\
241
var y_strings = null;\
242
var use_pan_and_zoom = 0;\
242
var use_pan_and_zoom = 0;\
-
 
243
var x_use_snap_to_grid = 0;\
243
var use_snap_to_grid = 0;\
244
var y_use_snap_to_grid = 0;\
244
var xstart = 0;\
245
var xstart = 0;\
245
var ystart = 0",canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
246
var ystart = 0",canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
246
/* default add the drag code : nearly always used ...*/
247
/* default add the drag code : nearly always used ...*/
247
add_drag_code(js_include_file,DRAG_CANVAS,canvas_root_id);
248
add_drag_code(js_include_file,DRAG_CANVAS,canvas_root_id);
248
            break;
249
            break;
Line 875... Line 876...
875
        case SNAPTOGRID:
876
        case SNAPTOGRID:
876
        /*
877
        /*
877
         @ snaptogrid
878
         @ snaptogrid
878
         @ keyword (no arguments rewquired) needs to be defined before command 'userdraw' and after command 'grid'
879
         @ keyword (no arguments rewquired) needs to be defined before command 'userdraw' and after command 'grid'
879
         @ in case of userdraw the drawn points will snap to xmajor / ymajor grid
880
         @ in case of userdraw the drawn points will snap to xmajor / ymajor grid
880
         @ if xminor / yminor is defined, the drawing will snap to xminor/yminor <br />use only even dividers in x/y-minor...for example<br />snaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red<br /> will snap on x=0, x=0.5, x=1, x=1.5 ....<br /> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br />
881
         @ if xminor / yminor is defined, the drawing will snap to xminor and yminor<br />use only even dividers in x/y-minor...for example<br />snaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red<br /> will snap on x=0, x=0.5, x=1, x=1.5 ....<br /> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br />
881
        */
882
        */
882
        fprintf(js_include_file,"\nuse_snap_to_grid = 1;var snap_x = 1;var snap_y = 1;\nfunction snap_to_x(x){return x2px(snap_x*(Math.round((px2x(x))/snap_x)));};function snap_to_y(y){return y2px(snap_y*(Math.round((px2y(y))/snap_y)));;};\n");
883
        fprintf(js_include_file,"\nx_use_snap_to_grid = 1;y_use_snap_to_grid = 1;var snap_x = 1;var snap_y = 1;function snap_to_x(x){return x2px(snap_x*(Math.round((px2x(x))/snap_x)));};function snap_to_y(y){return y2px(snap_y*(Math.round((px2y(y))/snap_y)));};\n");
-
 
884
        break;
-
 
885
        case XSNAPTOGRID:
-
 
886
        /*
-
 
887
         @ xsnaptogrid
-
 
888
         @ keyword (no arguments rewquired) needs to be defined before command 'userdraw' and after command 'grid'
-
 
889
         @ in case of userdraw the drawn points will snap to xmajor grid
-
 
890
         @ if xminor / yminor is defined, the drawing will snap to xminor <br />use only even dividers in x-minor...for example<br />xsnaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red<br /> will snap on x=0, x=0.5, x=1, x=1.5 ....<br /> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br />
-
 
891
        */
-
 
892
        fprintf(js_include_file,"\nx_use_snap_to_grid = 1;var snap_x = 1;if (typeof snap_y === 'undefined') { var snap_y = 1;};var snap_y = 1;function snap_to_x(x){return x2px(snap_x*(Math.round((px2x(x))/snap_x)));};\n");
-
 
893
        break;
-
 
894
        case YSNAPTOGRID:
-
 
895
        /*
-
 
896
         @ ysnaptogrid
-
 
897
         @ keyword (no arguments rewquired) needs to be defined before command 'userdraw' and after command 'grid'
-
 
898
         @ in case of userdraw the drawn points will snap to ymajor grid
-
 
899
         @ if xminor / yminor is defined, the drawing will snap to yminor <br />use only even dividers in y-minor...for example<br />ysnaptogrid<br />axis<br />grid 2,1,grey,4,4,7,red<br /> will snap on x=0, x=0.5, x=1, x=1.5 ....<br /> will snap on y=0, y=0.25 y=0.5 y=0.75 ...<br />
-
 
900
        */
-
 
901
        fprintf(js_include_file,"\ny_use_snap_to_grid = 1;if (typeof snap_x === 'undefined') { var snap_x = 1;};var snap_y = 1;\nfunction snap_to_y(y){return y2px(snap_y*(Math.round((px2y(y))/snap_y)));};\n");
883
        break;
902
        break;
884
        case USERTEXTAREA_XY:
903
        case USERTEXTAREA_XY:
885
        /*
904
        /*
886
        @ usertextarea_xy
905
        @ usertextarea_xy
887
        @ keyword
906
        @ keyword
Line 935... Line 954...
935
            draw_type = get_string_argument(infile,0);
954
            draw_type = get_string_argument(infile,0);
936
            stroke_color = get_color(infile,1);
955
            stroke_color = get_color(infile,1);
937
            if( strcmp(draw_type,"point") == 0 ){
956
            if( strcmp(draw_type,"point") == 0 ){
938
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
957
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
939
                if(reply_format < 1 ){reply_format = 8;}
958
                if(reply_format < 1 ){reply_format = 8;}
940
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
959
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
941
                if(use_input_xy == 1){
960
                if(use_input_xy == 1){
942
                    add_input_circle(js_include_file,1,1);
961
                    add_input_circle(js_include_file,1,1);
943
                    add_input_xy(js_include_file,canvas_root_id);
962
                    add_input_xy(js_include_file,canvas_root_id);
944
                }
963
                }
945
                add_js_points(js_include_file,1,draw_type,line_width,line_width,stroke_color,stroke_opacity,1,stroke_color,stroke_opacity,0,1,1);
964
                add_js_points(js_include_file,1,draw_type,line_width,line_width,stroke_color,stroke_opacity,1,stroke_color,stroke_opacity,0,1,1);
Line 968... Line 987...
968
            }
987
            }
969
            else
988
            else
970
            if( strcmp(draw_type,"polyline") == 0 ){
989
            if( strcmp(draw_type,"polyline") == 0 ){
971
                if( js_function[DRAW_POLYLINE] != 1 ){ js_function[DRAW_POLYLINE] = 1;}
990
                if( js_function[DRAW_POLYLINE] != 1 ){ js_function[DRAW_POLYLINE] = 1;}
972
                if(reply_format < 1){reply_format = 23;}
991
                if(reply_format < 1){reply_format = 23;}
973
                if( use_input_xy == 1 ){
992
                if( use_input_xy == 1 ){
974
                    add_input_polyline(js_include_file);
993
                    add_input_polyline(js_include_file);
975
                    add_input_xy(js_include_file,canvas_root_id);
994
                    add_input_xy(js_include_file,canvas_root_id);
976
                }
995
                }
977
                add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
996
                add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
978
            }
997
            }
Line 1326... Line 1345...
1326
                    decimals = find_number_of_digits(precision);
1345
                    decimals = find_number_of_digits(precision);
1327
                    temp = get_string_argument(infile,1);
1346
                    temp = get_string_argument(infile,1);
1328
                    string_length = snprintf(NULL,0,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,[%d,%d]);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_translate,translate_x,translate_y);
1347
                    string_length = snprintf(NULL,0,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,[%d,%d]);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_translate,translate_x,translate_y);
1329
                    check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
1348
                    check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
1330
                    snprintf(tmp_buffer,string_length,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,[%d,%d]);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_translate,translate_x,translate_y);
1349
                    snprintf(tmp_buffer,string_length,"draw_text(%d,%d,%d,%d,\"%s\",\"%s\",%.2f,90,\"%s\",%d,%.2f,%d,[%d,%d]);\n",STATIC_CANVAS,int_data[0],int_data[1],font_size,font_family,font_color,stroke_opacity,temp,use_rotate,angle,use_translate,translate_x,translate_y);
1331
                    add_to_buffer(tmp_buffer);
1350
                    add_to_buffer(tmp_buffer);
1332
                    break;
1351
                    break;
1333
                    default:break;
1352
                    default:break;
1334
                }
1353
                }
1335
            }
1354
            }
1336
            reset();
1355
            reset();
1337
            break;
1356
            break;
1338
        case FONTFAMILY:
1357
        case FONTFAMILY:
Line 1508... Line 1527...
1508
            break;
1527
            break;
1509
        case AXIS:
1528
        case AXIS:
1510
        /*
1529
        /*
1511
            @ axis
1530
            @ axis
1512
            @ keyword, no aguments required
1531
            @ keyword, no aguments required
1513
 
1532
 
1514
        */
1533
        */
1515
            use_axis = TRUE;
1534
            use_axis = TRUE;
1516
            break;
1535
            break;
1517
        case SGRAPH:
1536
        case SGRAPH:
1518
        /*
1537
        /*
1519
         @ sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color
1538
         @ sgraph xstart,ystart,xmajor,ymajor,xminor,yminor,majorgrid_color,minorgrid_color
1520
         @ primitive implementation of a 'broken scale' graph...
1539
         @ primitive implementation of a 'broken scale' graph...
1521
         @ not very versatile.
1540
         @ not very versatile.
1522
         @ example:<br />size 400,400<br />xrange 0,10000<br />yrange 0,100<br />sgraph 9000,50,100,10,4,4,grey,blue<br />userinput_xy<br />linewidth 2<br />userdraw segments,red
1541
         @ example:<br />size 400,400<br />xrange 0,10000<br />yrange 0,100<br />sgraph 9000,50,100,10,4,4,grey,blue<br />userinput_xy<br />linewidth 2<br />userdraw segments,red
1523
        */
1542
        */
1524
            if( js_function[DRAW_SGRAPH] != 1 ){ js_function[DRAW_SGRAPH] = 1;}
1543
            if( js_function[DRAW_SGRAPH] != 1 ){ js_function[DRAW_SGRAPH] = 1;}
1525
            for(i = 0 ; i < 8 ;i++){
1544
            for(i = 0 ; i < 8 ;i++){
1526
                switch(i){
1545
                switch(i){
1527
                    case 0:double_data[0] = get_real(infile,0);break;
1546
                    case 0:double_data[0] = get_real(infile,0);break;
1528
                    case 1:double_data[1] = get_real(infile,0);break;
1547
                    case 1:double_data[1] = get_real(infile,0);break;
Line 1583... Line 1602...
1583
                    string_length = snprintf(NULL,0,  "draw_grid%d(%d,%d,%.2f,%.*f,%.*f,%d,%d,%d,%d,\"%s\",\"%s\",%d,\"%s\",%d,%d,%d,%.2f,%d,[%d,%d],%d,%d,%d,\"%s\",%.2f);\n",canvas_root_id,GRID_CANVAS,precision,stroke_opacity,decimals,double_data[0],decimals,double_data[1],int_data[0],int_data[1],int_data[2],line_width,stroke_color,fill_color,font_size,font_family,use_axis,use_axis_numbering,use_rotate,angle,use_translate,translate_x,translate_y,use_dashed,dashtype[0],dashtype[1],font_color,fill_opacity);
1602
                    string_length = snprintf(NULL,0,  "draw_grid%d(%d,%d,%.2f,%.*f,%.*f,%d,%d,%d,%d,\"%s\",\"%s\",%d,\"%s\",%d,%d,%d,%.2f,%d,[%d,%d],%d,%d,%d,\"%s\",%.2f);\n",canvas_root_id,GRID_CANVAS,precision,stroke_opacity,decimals,double_data[0],decimals,double_data[1],int_data[0],int_data[1],int_data[2],line_width,stroke_color,fill_color,font_size,font_family,use_axis,use_axis_numbering,use_rotate,angle,use_translate,translate_x,translate_y,use_dashed,dashtype[0],dashtype[1],font_color,fill_opacity);
1584
                    check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
1603
                    check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
1585
                    snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,%.2f,%.*f,%.*f,%d,%d,%d,%d,\"%s\",\"%s\",%d,\"%s\",%d,%d,%d,%.2f,%d,[%d,%d],%d,%d,%d,\"%s\",%.2f);\n",canvas_root_id,GRID_CANVAS,precision,stroke_opacity,decimals,double_data[0],decimals,double_data[1],int_data[0],int_data[1],int_data[2],line_width,stroke_color,fill_color,font_size,font_family,use_axis,use_axis_numbering,use_rotate,angle,use_translate,translate_x,translate_y,use_dashed,dashtype[0],dashtype[1],font_color,fill_opacity);
1604
                    snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,%.2f,%.*f,%.*f,%d,%d,%d,%d,\"%s\",\"%s\",%d,\"%s\",%d,%d,%d,%.2f,%d,[%d,%d],%d,%d,%d,\"%s\",%.2f);\n",canvas_root_id,GRID_CANVAS,precision,stroke_opacity,decimals,double_data[0],decimals,double_data[1],int_data[0],int_data[1],int_data[2],line_width,stroke_color,fill_color,font_size,font_family,use_axis,use_axis_numbering,use_rotate,angle,use_translate,translate_x,translate_y,use_dashed,dashtype[0],dashtype[1],font_color,fill_opacity);
1586
                    add_to_buffer(tmp_buffer);
1605
                    add_to_buffer(tmp_buffer);
1587
                    break;
1606
                    break;
1588
                }
1607
                }
1589
            }
1608
            }
1590
            reset();
1609
            reset();
1591
            break;
1610
            break;
1592
        case OPACITY:
1611
        case OPACITY:
1593
        /*
1612
        /*
1594
        @ opacity 0-255,0-255
1613
        @ opacity 0-255,0-255
Line 1596... Line 1615...
1596
        */
1615
        */
1597
            for(i = 0 ; i<2;i++){
1616
            for(i = 0 ; i<2;i++){
1598
                switch(i){
1617
                switch(i){
1599
                    case 0: double_data[0]=(int)(get_real(infile,0));break;
1618
                    case 0: double_data[0]=(int)(get_real(infile,0));break;
1600
                    case 1: double_data[1]=(int)(get_real(infile,1));break;
1619
                    case 1: double_data[1]=(int)(get_real(infile,1));break;
1601
                    default: break;
1620
                    default: break;
1602
                }
1621
                }
1603
            }
1622
            }
1604
            if( double_data[0] < 0 || double_data[0] > 255 || double_data[1] < 0 || double_data[1] > 255  ){ canvas_error("opacity [0 - 255] , [0 - 255]");}/* typo or non-RGB ? */
1623
            if( double_data[0] < 0 || double_data[0] > 255 || double_data[1] < 0 || double_data[1] > 255  ){ canvas_error("opacity [0 - 255] , [0 - 255]");}/* typo or non-RGB ? */
1605
            stroke_opacity = (double) (0.0039215*double_data[0]);/* 0.0 - 1.0 */
1624
            stroke_opacity = (double) (0.0039215*double_data[0]);/* 0.0 - 1.0 */
1606
            fill_opacity = (double) (0.0039215*double_data[1]);/* 0.0 - 1.0 */
1625
            fill_opacity = (double) (0.0039215*double_data[1]);/* 0.0 - 1.0 */
1607
            break;
1626
            break;
1608
        case ROTATE:
1627
        case ROTATE:
Line 1868... Line 1887...
1868
            }
1887
            }
1869
            if(reply_format < 1 ){reply_format = 15;}
1888
            if(reply_format < 1 ){reply_format = 15;}
1870
            reset();
1889
            reset();
1871
            break;
1890
            break;
1872
        case MOUSE_PRECISION:
1891
        case MOUSE_PRECISION:
1873
        /*
1892
        /*
1874
            @ precision int
1893
            @ precision int
1875
            @ 10 = 1 decimal ; 100 = 2 decimals etc
1894
            @ 10 = 1 decimal ; 100 = 2 decimals etc
1876
            @ may be used / changed before every object
1895
            @ may be used / changed before every object
1877
        */
1896
        */
1878
            precision = (int) (get_real(infile,1));
1897
            precision = (int) (get_real(infile,1));
Line 2042... Line 2061...
2042
                    case 4: stroke_color = get_color(infile,1);
2061
                    case 4: stroke_color = get_color(infile,1);
2043
                    /* draw_hatchfill(ctx,x0,y0,dx,dy,linewidth,color,opacity,xsize,ysize) */
2062
                    /* draw_hatchfill(ctx,x0,y0,dx,dy,linewidth,color,opacity,xsize,ysize) */
2044
                    string_length = snprintf(NULL,0,  "draw_hatchfill(%d,%d,%d,%d,%d,%d,\"%s\",%.2f,%d,%d);\n",STATIC_CANVAS,int_data[0],int_data[1],int_data[2],int_data[3],line_width,stroke_color,stroke_opacity,xsize,ysize);
2063
                    string_length = snprintf(NULL,0,  "draw_hatchfill(%d,%d,%d,%d,%d,%d,\"%s\",%.2f,%d,%d);\n",STATIC_CANVAS,int_data[0],int_data[1],int_data[2],int_data[3],line_width,stroke_color,stroke_opacity,xsize,ysize);
2045
                    check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2064
                    check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2046
                    snprintf(tmp_buffer,string_length,"draw_hatchfill(%d,%d,%d,%d,%d,%d,\"%s\",%.2f,%d,%d);\n",STATIC_CANVAS,int_data[0],int_data[1],int_data[2],int_data[3],line_width,stroke_color,stroke_opacity,xsize,ysize);
2065
                    snprintf(tmp_buffer,string_length,"draw_hatchfill(%d,%d,%d,%d,%d,%d,\"%s\",%.2f,%d,%d);\n",STATIC_CANVAS,int_data[0],int_data[1],int_data[2],int_data[3],line_width,stroke_color,stroke_opacity,xsize,ysize);
2047
                    add_to_buffer(tmp_buffer);
2066
                    add_to_buffer(tmp_buffer);
2048
                    break;
2067
                    break;
2049
                    default:break;
2068
                    default:break;
2050
                }
2069
                }
2051
            }
2070
            }
2052
            reset();
2071
            reset();
2053
        break;
2072
        break;
2054
        case DIAMONDFILL:
2073
        case DIAMONDFILL:
2055
        /*
2074
        /*
2056
        @ diamondfill x0,y0,dx,dy,color
2075
        @ diamondfill x0,y0,dx,dy,color
2057
        @ x0,y0 in xrange / yrange
2076
        @ x0,y0 in xrange / yrange
2058
        @ distances dx,dy in pixels
2077
        @ distances dx,dy in pixels
Line 2317... Line 2336...
2317
            temp = get_string(infile,1);
2336
            temp = get_string(infile,1);
2318
            if( strstr( temp,":") != 0 ){ temp = str_replace(temp,":","\",\""); }
2337
            if( strstr( temp,":") != 0 ){ temp = str_replace(temp,":","\",\""); }
2319
            fprintf(js_include_file,"var legendcolors%d = [\"%s\"];",canvas_root_id,temp);
2338
            fprintf(js_include_file,"var legendcolors%d = [\"%s\"];",canvas_root_id,temp);
2320
            break;
2339
            break;
2321
        case LEGEND:
2340
        case LEGEND:
2322
        /*
2341
        /*
2323
        @ legend string1:string2:string3....string_n
2342
        @ legend string1:string2:string3....string_n
2324
        @ will be used to create a legend for a graph
2343
        @ will be used to create a legend for a graph
2325
        @ also see command 'piechart'  
2344
        @ also see command 'piechart'  
2326
        */
2345
        */
2327
            temp = get_string(infile,1);
2346
            temp = get_string(infile,1);
Line 2496... Line 2515...
2496
        @ sets the logbase number for the y-axis
2515
        @ sets the logbase number for the y-axis
2497
        @ default value 10
2516
        @ default value 10
2498
        @ use together with commands ylogscale / xylogscale
2517
        @ use together with commands ylogscale / xylogscale
2499
        */
2518
        */
2500
            fprintf(js_include_file,"ylogbase=%d;",(int)(get_real(infile,1)));
2519
            fprintf(js_include_file,"ylogbase=%d;",(int)(get_real(infile,1)));
2501
            break;
2520
            break;
2502
        case XLOGSCALE:
2521
        case XLOGSCALE:
2503
        /*
2522
        /*
2504
         @ xlogscale ymajor,yminor,majorcolor,minorcolor
2523
         @ xlogscale ymajor,yminor,majorcolor,minorcolor
2505
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
2524
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
2506
         @ ymajor is the major step on the y-axis; yminor is the divisor for the y-step
2525
         @ ymajor is the major step on the y-axis; yminor is the divisor for the y-step
Line 2944... Line 2963...
2944
}
2963
}
2945
void canvas_error(char *msg){
2964
void canvas_error(char *msg){
2946
    fprintf(stdout,"\n</script><hr /><span style=\"color:red\">FATAL syntax error:line %d : %s</span><hr />",line_number-1,msg);
2965
    fprintf(stdout,"\n</script><hr /><span style=\"color:red\">FATAL syntax error:line %d : %s</span><hr />",line_number-1,msg);
2947
    finished = 1;
2966
    finished = 1;
2948
    exit(EXIT_SUCCESS);
2967
    exit(EXIT_SUCCESS);
2949
}
2968
}
2950
 
2969
 
2951
 
2970
 
2952
/* convert x/y coordinates to pixel */
2971
/* convert x/y coordinates to pixel */
2953
int x2px(double x){
2972
int x2px(double x){
2954
 return x*xsize/(xmax - xmin) -  xsize*xmin/(xmax - xmin);
2973
 return x*xsize/(xmax - xmin) -  xsize*xmin/(xmax - xmin);
Line 2985... Line 3004...
2985
 if(use_dashed == TRUE){use_dashed = FALSE;}
3004
 if(use_dashed == TRUE){use_dashed = FALSE;}
2986
 if(use_translate == TRUE){use_translate = FALSE;}
3005
 if(use_translate == TRUE){use_translate = FALSE;}
2987
 if(use_rotate == TRUE){use_rotate = FALSE;}
3006
 if(use_rotate == TRUE){use_rotate = FALSE;}
2988
 onclick = 0;
3007
 onclick = 0;
2989
}
3008
}
2990
 
3009
 
2991
 
3010
 
2992
 
3011
 
2993
/* What reply format in read_canvas();
3012
/* What reply format in read_canvas();
2994
 
3013
 
2995
note:if userdraw is combined with inputfields...every "userdraw" based answer will append "\n" and  inputfield.value()
3014
note:if userdraw is combined with inputfields...every "userdraw" based answer will append "\n" and  inputfield.value()
2996
1 = x1,x2,x3,x4....x_n
3015
1 = x1,x2,x3,x4....x_n
2997
    y1,y2,y3,y4....y_n
3016
    y1,y2,y3,y4....y_n
2998
 
3017
 
2999
    x/y in pixels
3018
    x/y in pixels
Line 3010... Line 3029...
3010
    r in pixels
3029
    r in pixels
3011
 
3030
 
3012
4 = x1,x2,x3,x4....x_n
3031
4 = x1,x2,x3,x4....x_n
3013
    y1,y2,y3,y4....y_n
3032
    y1,y2,y3,y4....y_n
3014
    r1,r2,r3,r4....r_n
3033
    r1,r2,r3,r4....r_n
3015
 
3034
 
3016
    x/y in  xrange / yrange coordinate system
3035
    x/y in  xrange / yrange coordinate system
3017
    r in pixels
3036
    r in pixels
3018
 
3037
 
3019
5 = Ax1,Ax2,Ax3,Ax4....Ax_n
3038
5 = Ax1,Ax2,Ax3,Ax4....Ax_n
3020
    Ay1,Ay2,Ay3,Ay4....Ay_n
3039
    Ay1,Ay2,Ay3,Ay4....Ay_n
3021
    Bx1,Bx2,Bx3,Bx4....Bx_n
3040
    Bx1,Bx2,Bx3,Bx4....Bx_n
3022
    By1,By2,By3,By4....By_n
3041
    By1,By2,By3,By4....By_n
3023
    Cx1,Cx2,Cx3,Cx4....Cx_n
3042
    Cx1,Cx2,Cx3,Cx4....Cx_n
3024
    Cy1,Cy2,Cy3,Cy4....Cy_n
3043
    Cy1,Cy2,Cy3,Cy4....Cy_n
3025
    ....
3044
    ....
3026
    Zx1,Zx2,Zx3,Zx4....Zx_n
3045
    Zx1,Zx2,Zx3,Zx4....Zx_n
3027
    Zy1,Zy2,Zy3,Zy4....Zy_n
3046
    Zy1,Zy2,Zy3,Zy4....Zy_n
3028
   
3047
   
3029
    x/y in pixels
3048
    x/y in pixels
3030
 
3049
 
3031
6 = Ax1,Ax2,Ax3,Ax4....Ax_n
3050
6 = Ax1,Ax2,Ax3,Ax4....Ax_n
3032
    Ay1,Ay2,Ay3,Ay4....Ay_n
3051
    Ay1,Ay2,Ay3,Ay4....Ay_n
3033
    Bx1,Bx2,Bx3,Bx4....Bx_n
3052
    Bx1,Bx2,Bx3,Bx4....Bx_n
3034
    By1,By2,By3,By4....By_n
3053
    By1,By2,By3,By4....By_n
3035
    Cx1,Cx2,Cx3,Cx4....Cx_n
3054
    Cx1,Cx2,Cx3,Cx4....Cx_n
3036
    Cy1,Cy2,Cy3,Cy4....Cy_n
3055
    Cy1,Cy2,Cy3,Cy4....Cy_n
3037
    ....
3056
    ....
3038
    Zx1,Zx2,Zx3,Zx4....Zx_n
3057
    Zx1,Zx2,Zx3,Zx4....Zx_n
3039
    Zy1,Zy2,Zy3,Zy4....Zy_n
3058
    Zy1,Zy2,Zy3,Zy4....Zy_n
3040
 
3059
 
3041
    x/y in  xrange / yrange coordinate system
3060
    x/y in  xrange / yrange coordinate system
3042
   
3061
   
3043
7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n
3062
7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n
3044
   
3063
   
3045
    x/y in pixels
3064
    x/y in pixels
3046
 
3065
 
3047
8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n
3066
8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n
Line 4474... Line 4493...
4474
    break;
4493
    break;
4475
 
4494
 
4476
    case DRAW_ELLIPSES:/* not  used for userdraw */
4495
    case DRAW_ELLIPSES:/* not  used for userdraw */
4477
fprintf(js_include_file,"\n<!-- draw ellipses -->\n\
4496
fprintf(js_include_file,"\n<!-- draw ellipses -->\n\
4478
draw_ellipses = function(canvas_type,x_points,y_points,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype0,use_rotate,angle,use_translate,vector){\
4497
draw_ellipses = function(canvas_type,x_points,y_points,line_width,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype0,use_rotate,angle,use_translate,vector){\
4479
 var obj;\
4498
 var obj;\
4480
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4499
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4481
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4500
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4482
 }\
4501
 }\
4483
 else\
4502
 else\
4484
 {\
4503
 {\
4485
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4504
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4486
 };\
4505
 };\
Line 6045... Line 6064...
6045
        *clock="clock",
6064
        *clock="clock",
6046
        *animate="animate",
6065
        *animate="animate",
6047
        *video="video",
6066
        *video="video",
6048
        *status="status",
6067
        *status="status",
6049
        *snaptogrid="snaptogrid",
6068
        *snaptogrid="snaptogrid",
-
 
6069
        *xsnaptogrid="xsnaptogrid",
-
 
6070
        *ysnaptogrid="ysnaptogrid",
6050
        *userinput_xy="userinput_xy",
6071
        *userinput_xy="userinput_xy",
6051
        *usertextarea_xy="usertextarea_xy",
6072
        *usertextarea_xy="usertextarea_xy",
6052
        *sgraph="sgraph";
6073
        *sgraph="sgraph";
6053
 
6074
 
6054
        while(((c = getc(infile)) != EOF)&&(c!='\n')&&(c!=',')&&(c!='=')&&(c!='\r')){
6075
        while(((c = getc(infile)) != EOF)&&(c!='\n')&&(c!=',')&&(c!='=')&&(c!='\r')){
Line 6635... Line 6656...
6635
        return STATUS;
6656
        return STATUS;
6636
        }
6657
        }
6637
        if( strcmp(input_type, snaptogrid) == 0 ){
6658
        if( strcmp(input_type, snaptogrid) == 0 ){
6638
        free(input_type);
6659
        free(input_type);
6639
        return SNAPTOGRID;
6660
        return SNAPTOGRID;
-
 
6661
        }
-
 
6662
        if( strcmp(input_type, xsnaptogrid) == 0 ){
-
 
6663
        free(input_type);
-
 
6664
        return XSNAPTOGRID;
-
 
6665
        }
-
 
6666
        if( strcmp(input_type, ysnaptogrid) == 0 ){
-
 
6667
        free(input_type);
-
 
6668
        return YSNAPTOGRID;
6640
        }
6669
        }
6641
        if( strcmp(input_type, userinput_xy) == 0 ){
6670
        if( strcmp(input_type, userinput_xy) == 0 ){
6642
        free(input_type);
6671
        free(input_type);
6643
        return USERINPUT_XY;
6672
        return USERINPUT_XY;
6644
        }
6673
        }