Subversion Repositories wimsdev

Rev

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

Rev 8193 Rev 8222
Line 937... Line 937...
937
         @ in case of userdraw the drawn points will snap to ymajor grid
937
         @ in case of userdraw the drawn points will snap to ymajor grid
938
         @ if 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 />
938
         @ if 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 />
939
        */
939
        */
940
        fprintf(js_include_file,"\nx_use_snap_to_grid = 0;y_use_snap_to_grid = 1;");
940
        fprintf(js_include_file,"\nx_use_snap_to_grid = 0;y_use_snap_to_grid = 1;");
941
        break;
941
        break;
-
 
942
        case USERINPUT:
-
 
943
        /*
-
 
944
         @ userinput function | textarea | inputfield
-
 
945
         @ alternative command + argment to keywords "userinput_function","userinput_textarea" and "userinput_xy"
-
 
946
         @ textarea and inputfield are only usable in combination with some 'userdraw draw_ type'
-
 
947
         @ function may be used any time (e.g. without userdraw)
-
 
948
        */
-
 
949
            temp = get_string_argument(infile,1);
-
 
950
            if(strstr(temp,"function") != 0  || strstr(temp,"curve") != 0  || strstr(temp,"plot") != 0 ){
-
 
951
             if( js_function[DRAW_JSFUNCTION] != 1 ){
-
 
952
              js_function[DRAW_JSFUNCTION] = 1;
-
 
953
              if(reply_format == 0){reply_format = 24;}/* read canvas_input values */
-
 
954
              add_input_jsfunction(js_include_file,canvas_root_id,1,input_style,input_cnt,stroke_color,stroke_opacity,line_width,use_dashed,dashtype[0],dashtype[1]);
-
 
955
              input_cnt++;
-
 
956
             }
-
 
957
             if( use_js_math == FALSE){/* add this stuff only once...*/
-
 
958
              add_to_js_math(js_include_file);
-
 
959
              use_js_math = TRUE;
-
 
960
             }
-
 
961
             if( use_js_plot == FALSE){
-
 
962
              use_js_plot = TRUE;
-
 
963
              add_jsplot(js_include_file,canvas_root_id); /* this plots the function on JSPLOT_CANVAS */
-
 
964
             }
-
 
965
            }
-
 
966
            else
-
 
967
            {
-
 
968
             if(strstr(temp,"inputfield") != 0 ){
-
 
969
              if( use_input_xy != 0 ){canvas_error("userinput_xy can not be combined with usertextarea_xy command");}
-
 
970
              if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */
-
 
971
              use_input_xy = 1;
-
 
972
             }
-
 
973
             else
-
 
974
             {
-
 
975
              if(strstr(temp,"textarea") != 0 ){
-
 
976
               if( use_input_xy != 0 ){canvas_error("usertextarea_xy can not be combined with userinput_xy command");}
-
 
977
               if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */
-
 
978
               use_input_xy = 2;
-
 
979
              }
-
 
980
              else
-
 
981
              {
-
 
982
                canvas_error("userinput argument may be \"function,inputfield,textarea\"");
-
 
983
              }
-
 
984
             }
-
 
985
            }
-
 
986
            break;
942
        case USERTEXTAREA_XY:
987
        case USERTEXTAREA_XY:
943
        /*
988
        /*
944
        @ usertextarea_xy
989
        @ usertextarea_xy
945
        @ keyword
990
        @ keyword
946
        @ to be used in combination with command "userdraw object_type,color" wherein object_type is only segment / polyline for the time being...
991
        @ to be used in combination with command "userdraw object_type,color" wherein object_type is only segment / polyline for the time being...
Line 949... Line 994...
949
        @ user drawings will not zoom on zooming (or pan on panning)
994
        @ user drawings will not zoom on zooming (or pan on panning)
950
        */
995
        */
951
            if( use_input_xy != 0 ){canvas_error("usertextarea_xy can not be combined with userinput_xy command");}
996
            if( use_input_xy != 0 ){canvas_error("usertextarea_xy can not be combined with userinput_xy command");}
952
            if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */
997
            if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */
953
            use_input_xy = 2;
998
            use_input_xy = 2;
954
            break;
999
            break;
955
        case USERINPUT_XY:
1000
        case USERINPUT_XY:
956
        /*
1001
        /*
957
        @ userinput_xy
1002
        @ userinput_xy
958
        @ keyword
1003
        @ keyword
959
        @ to be used in combination with command "userdraw object_type,color"
1004
        @ to be used in combination with command "userdraw object_type,color"
Line 1036... Line 1081...
1036
                if(use_input_xy == 1){
1081
                if(use_input_xy == 1){
1037
                    add_input_circle(js_include_file,1,2);
1082
                    add_input_circle(js_include_file,1,2);
1038
                    add_input_xy(js_include_file,canvas_root_id);
1083
                    add_input_xy(js_include_file,canvas_root_id);
1039
                }
1084
                }
1040
                add_js_points(js_include_file,2,draw_type,line_width,line_width,stroke_color,stroke_opacity,1,stroke_color,stroke_opacity,0,1,1);
1085
                add_js_points(js_include_file,2,draw_type,line_width,line_width,stroke_color,stroke_opacity,1,stroke_color,stroke_opacity,0,1,1);
1041
            }
1086
            }
1042
            else
1087
            else
1043
            if( strcmp(draw_type,"segment") == 0 ){
1088
            if( strcmp(draw_type,"segment") == 0 ){
1044
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1089
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1045
                if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;}
1090
                if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;}
1046
                if(reply_format == 0){reply_format = 11;}
1091
                if(reply_format == 0){reply_format = 11;}
Line 1048... Line 1093...
1048
                if(use_input_xy == 1){
1093
                if(use_input_xy == 1){
1049
                    add_input_segment(js_include_file,1);
1094
                    add_input_segment(js_include_file,1);
1050
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1095
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1051
                }
1096
                }
1052
                add_js_segments(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1097
                add_js_segments(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1053
            }
1098
            }
1054
            else
1099
            else
1055
            if( strcmp(draw_type,"polyline") == 0 ){
1100
            if( strcmp(draw_type,"polyline") == 0 ){
1056
                if( js_function[DRAW_POLYLINE] != 1 ){ js_function[DRAW_POLYLINE] = 1;}
1101
                if( js_function[DRAW_POLYLINE] != 1 ){ js_function[DRAW_POLYLINE] = 1;}
1057
                if(reply_format == 0){reply_format = 23;}
1102
                if(reply_format == 0){reply_format = 23;}
1058
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1103
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1059
                if( use_input_xy == 1 ){
1104
                if( use_input_xy == 1 ){
1060
                    add_input_polyline(js_include_file);
1105
                    add_input_polyline(js_include_file);
1061
                    add_input_xy(js_include_file,canvas_root_id);
1106
                    add_input_xy(js_include_file,canvas_root_id);
1062
                }
1107
                }
1063
                add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1108
                add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1064
            }
1109
            }
1065
            else
1110
            else
1066
            if( strcmp(draw_type,"segments") == 0 ){
1111
            if( strcmp(draw_type,"segments") == 0 ){
1067
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1112
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1068
                if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;}
1113
                if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;}
1069
                if(reply_format == 0){reply_format = 11;}
1114
                if(reply_format == 0){reply_format = 11;}
1070
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1115
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1071
                if(use_input_xy == 1){
1116
                if(use_input_xy == 1){
1072
                    add_input_segment(js_include_file,2);
1117
                    add_input_segment(js_include_file,2);
1073
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1118
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1074
                }
1119
                }
1075
                add_js_segments(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1120
                add_js_segments(js_include_file,2,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1076
            }
1121
            }
1077
            else
1122
            else
1078
            if( strcmp(draw_type,"circle") == 0 ){
1123
            if( strcmp(draw_type,"circle") == 0 ){
1079
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1124
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1080
                if(reply_format == 0){reply_format = 10;}
1125
                if(reply_format == 0){reply_format = 10;}
1081
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1126
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1082
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1127
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1083
                if(use_input_xy == 1){
1128
                if(use_input_xy == 1){
1084
                    add_input_circle(js_include_file,2,1);
1129
                    add_input_circle(js_include_file,2,1);
1085
                    add_input_xyr(js_include_file,canvas_root_id);
1130
                    add_input_xyr(js_include_file,canvas_root_id);
1086
                }
1131
                }
1087
                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]);
1132
                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]);
1088
            }
1133
            }
1089
            else
1134
            else
1090
            if( strcmp(draw_type,"circles") == 0 ){
1135
            if( strcmp(draw_type,"circles") == 0 ){
1091
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1136
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1092
                if(reply_format == 0){reply_format = 10;}
1137
                if(reply_format == 0){reply_format = 10;}
1093
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1138
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1094
                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]);
1139
                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]);
1095
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1140
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1096
                if(use_input_xy == 1){
1141
                if(use_input_xy == 1){
1097
                    add_input_circle(js_include_file,2,2);
1142
                    add_input_circle(js_include_file,2,2);
1098
                    add_input_xyr(js_include_file,canvas_root_id);
1143
                    add_input_xyr(js_include_file,canvas_root_id);
1099
                }
1144
                }
1100
            }
1145
            }
1101
            else
1146
            else
1102
            if(strcmp(draw_type,"crosshair") == 0 ){
1147
            if(strcmp(draw_type,"crosshair") == 0 ){
1103
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1148
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1104
                if(reply_format == 0){reply_format = 8;}
1149
                if(reply_format == 0){reply_format = 8;}
1105
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1150
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1106
                add_js_crosshairs(js_include_file,1,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1151
                add_js_crosshairs(js_include_file,1,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1107
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1152
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1108
                if(use_input_xy == 1){
1153
                if(use_input_xy == 1){
1109
                    add_input_crosshair(js_include_file,1);
1154
                    add_input_crosshair(js_include_file,1);
1110
                    add_input_xy(js_include_file,canvas_root_id);
1155
                    add_input_xy(js_include_file,canvas_root_id);
1111
                }
1156
                }
1112
            }
1157
            }
1113
            else
1158
            else
1114
            if(strcmp(draw_type,"crosshairs") == 0 ){
1159
            if(strcmp(draw_type,"crosshairs") == 0 ){
1115
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1160
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1116
                if(reply_format == 0){reply_format = 8;}
1161
                if(reply_format == 0){reply_format = 8;}
1117
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1162
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1118
                add_js_crosshairs(js_include_file,2,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1163
                add_js_crosshairs(js_include_file,2,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1119
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1164
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1120
                if(use_input_xy == 1){
1165
                if(use_input_xy == 1){
1121
                    add_input_crosshair(js_include_file,2);
1166
                    add_input_crosshair(js_include_file,2);
1122
                    add_input_xy(js_include_file,canvas_root_id);
1167
                    add_input_xy(js_include_file,canvas_root_id);
1123
                }
1168
                }
1124
            }
1169
            }
1125
            else
1170
            else
1126
            if(strcmp(draw_type,"freehandline") == 0 ){
1171
            if(strcmp(draw_type,"freehandline") == 0 ){
1127
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1172
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1128
                if(reply_format == 0){reply_format = 6;}
1173
                if(reply_format == 0){reply_format = 6;}
1129
                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]);  
1174
                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]);  
1130
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1175
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1131
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1176
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1132
            }
1177
            }
1133
            else
1178
            else
1134
            if(strcmp(draw_type,"freehandlines") == 0 ){
1179
            if(strcmp(draw_type,"freehandlines") == 0 ){
1135
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1180
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1136
                if(reply_format == 0){reply_format = 6;}
1181
                if(reply_format == 0){reply_format = 6;}
1137
                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]);  
1182
                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]);  
1138
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1183
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1139
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1184
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1140
            }
1185
            }
1141
            else
1186
            else
1142
            if(strcmp(draw_type,"path") == 0 ){
1187
            if(strcmp(draw_type,"path") == 0 ){
Line 1333... Line 1378...
1333
            else
1378
            else
1334
            if( strcmp(draw_type,"text") == 0){
1379
            if( strcmp(draw_type,"text") == 0){
1335
                if( js_function[DRAW_TEXTS] != 1 ){ js_function[DRAW_TEXTS] = 1;}      
1380
                if( js_function[DRAW_TEXTS] != 1 ){ js_function[DRAW_TEXTS] = 1;}      
1336
                if(reply_format == 0){reply_format = 17;}
1381
                if(reply_format == 0){reply_format = 17;}
1337
                add_js_text(js_include_file,canvas_root_id,font_size,font_family,font_color,stroke_opacity);
1382
                add_js_text(js_include_file,canvas_root_id,font_size,font_family,font_color,stroke_opacity);
1338
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1383
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1339
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1384
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1340
            }
1385
            }
1341
            else
1386
            else
1342
            if( strcmp(draw_type,"inputs") == 0){
1387
            if( strcmp(draw_type,"inputs") == 0){
1343
                if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;}    
1388
                if( js_function[DRAW_INPUTS] != 1 ){ js_function[DRAW_INPUTS] = 1;}    
1344
                if(reply_format == 0){reply_format = 27;}
1389
                if(reply_format == 0){reply_format = 27;}
1345
                add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width);
1390
                add_js_inputs(js_include_file,canvas_root_id,2,input_cnt,input_style,line_width);
Line 1526... Line 1571...
1526
            for(i = 0; i < 5 ;i++){
1571
            for(i = 0; i < 5 ;i++){
1527
                switch(i){
1572
                switch(i){
1528
                    case 0: stroke_color = get_color(infile,0);break;/* font_color == stroke_color name or hex color */
1573
                    case 0: stroke_color = get_color(infile,0);break;/* font_color == stroke_color name or hex color */
1529
                    case 1: double_data[0] = get_real(infile,0);break; /* x */
1574
                    case 1: double_data[0] = get_real(infile,0);break; /* x */
1530
                    case 2: double_data[1] = get_real(infile,0);break; /* y */
1575
                    case 2: double_data[1] = get_real(infile,0);break; /* y */
1531
                    case 3: fly_font = get_string_argument(infile,0);
1576
                    case 3: fly_font = get_string_argument(infile,0);
1532
                            if(strcmp(fly_font,"giant") == 0){
1577
                            if(strcmp(fly_font,"giant") == 0){
1533
                                font_size = (int)(font_size + 24);
1578
                                font_size = (int)(font_size + 24);
1534
                            }
1579
                            }
1535
                            else
1580
                            else
1536
                            {
1581
                            {
1537
                                if(strcmp(fly_font,"huge") == 0){
1582
                                if(strcmp(fly_font,"huge") == 0){
1538
                                    font_size = (int)(font_size + 14);
1583
                                    font_size = (int)(font_size + 14);
1539
                                }
1584
                                }
1540
                                else
1585
                                else
1541
                                {
1586
                                {
1542
                                    if(strcmp(fly_font,"large") == 0){
1587
                                    if(strcmp(fly_font,"large") == 0){
1543
                                        font_size = (int)(font_size + 6);
1588
                                        font_size = (int)(font_size + 6);
1544
                                        }
1589
                                        }
1545
                                        else
1590
                                        else
Line 1729... Line 1774...
1729
                             if no other reply_format is defined
1774
                             if no other reply_format is defined
1730
                             note: all other reply types will include a reading of elements with id='mathml'+p)
1775
                             note: all other reply types will include a reading of elements with id='mathml'+p)
1731
                             */
1776
                             */
1732
                            if(strstr(temp,"mathml0") != NULL){
1777
                            if(strstr(temp,"mathml0") != NULL){
1733
                             if(reply_format == 0 ){reply_format = 16;} /* no other reply type is defined */
1778
                             if(reply_format == 0 ){reply_format = 16;} /* no other reply type is defined */
1734
                            }
1779
                            }
1735
                            break;
1780
                            break;
1736
                    default:break;
1781
                    default:break;
1737
                }
1782
                }
1738
            }
1783
            }
1739
            reset();
1784
            reset();
1740
            break;
1785
            break;
1741
        case HTTP:
1786
        case HTTP:
1742
        /*
1787
        /*
1743
         @http x1,y1,x2,y2,http://some_adress.com
1788
         @http x1,y1,x2,y2,http://some_adress.com
1744
         @an active html-page will be displayed in an "iframe" rectangle left top (x1:y1) , right bottom (x2:y2)
1789
         @an active html-page will be displayed in an "iframe" rectangle left top (x1:y1) , right bottom (x2:y2)
Line 2432... Line 2477...
2432
        /*
2477
        /*
2433
         @display x|y|xy|degree|radius,color,fontsize
2478
         @display x|y|xy|degree|radius,color,fontsize
2434
         @will display the mouse cursor coordinates as x-only,y-only,(x:y),<br />the radius of a circle (this only in case 'userdraw circle(s),color' !!<br />or the angle in degrees ( rhe angle between x-axis;(0:0);(x:y)
2479
         @will display the mouse cursor coordinates as x-only,y-only,(x:y),<br />the radius of a circle (this only in case 'userdraw circle(s),color' !!<br />or the angle in degrees ( rhe angle between x-axis;(0:0);(x:y)
2435
         @use commands 'xunit' and / or 'yunit' to add the units to the mouse values
2480
         @use commands 'xunit' and / or 'yunit' to add the units to the mouse values
2436
         @just like commands 'mouse','mousex','mousey','mouse_degree'...only other name)
2481
         @just like commands 'mouse','mousex','mousey','mouse_degree'...only other name)
2437
        */
2482
        */
2438
        temp = get_string_argument(infile,0);
2483
        temp = get_string_argument(infile,0);
2439
        if( strstr(temp,"xy") != NULL ){
2484
        if( strstr(temp,"xy") != NULL ){
2440
            int_data[0] = 2;
2485
            int_data[0] = 2;
2441
        }else{
2486
        }else{
2442
            if( strstr(temp,"y") != NULL ){
2487
            if( strstr(temp,"y") != NULL ){
Line 2466... Line 2511...
2466
        case MOUSE_DEGREE:
2511
        case MOUSE_DEGREE:
2467
        /*
2512
        /*
2468
         @ mouse_degree color,fontsize
2513
         @ mouse_degree color,fontsize
2469
         @ will display the angle in degrees between x-axis, (0:0) and the cursor (x:y) in 'color' and 'font size'<br /> using default fontfamily Ariel
2514
         @ will display the angle in degrees between x-axis, (0:0) and the cursor (x:y) in 'color' and 'font size'<br /> using default fontfamily Ariel
2470
         @ The angle is positive in QI and QIII and the angle value is negative in QII and QIV
2515
         @ The angle is positive in QI and QIII and the angle value is negative in QII and QIV
2471
         @ NOTE: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
2516
         @ NOTE: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
2472
 
2517
 
2473
        */
2518
        */
2474
            stroke_color = get_color(infile,0);
2519
            stroke_color = get_color(infile,0);
2475
            font_size = (int) (get_real(infile,1));
2520
            font_size = (int) (get_real(infile,1));
2476
            tmp_buffer = my_newmem(26);
2521
            tmp_buffer = my_newmem(26);
2477
            snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);
2522
            snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);
2478
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity,3);
2523
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity,3);
2479
            break;
2524
            break;
2480
        case MOUSEX:
2525
        case MOUSEX:
2481
        /*
2526
        /*
2482
         @ mousex color,fontsize
2527
         @ mousex color,fontsize
2483
         @ will display the cursor x-coordinate in 'color' and 'font size'<br /> using default fontfamily Ariel
2528
         @ will display the cursor x-coordinate in 'color' and 'font size'<br /> using default fontfamily Ariel
2484
         @ NOTE: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
2529
         @ NOTE: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
2485
 
2530
 
2486
        */
2531
        */
2487
            stroke_color = get_color(infile,0);
2532
            stroke_color = get_color(infile,0);
2488
            font_size = (int) (get_real(infile,1));
2533
            font_size = (int) (get_real(infile,1));
2489
            tmp_buffer = my_newmem(26);
2534
            tmp_buffer = my_newmem(26);
2490
            snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);
2535
            snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);
2491
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity,0);
2536
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity,0);
2492
            break;
2537
            break;
2493
        case MOUSEY:
2538
        case MOUSEY:
2494
        /*
2539
        /*
2495
         @ mousey color,fontsize
2540
         @ mousey color,fontsize
2496
         @ will display the cursor y-coordinate in 'color' and 'font size'<br /> using default fontfamily Ariel
2541
         @ will display the cursor y-coordinate in 'color' and 'font size'<br /> using default fontfamily Ariel
2497
         @ NOTE: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
2542
         @ NOTE: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
2498
 
2543
 
2499
        */
2544
        */
2500
            stroke_color = get_color(infile,0);
2545
            stroke_color = get_color(infile,0);
2501
            font_size = (int) (get_real(infile,1));
2546
            font_size = (int) (get_real(infile,1));
2502
            tmp_buffer = my_newmem(26);
2547
            tmp_buffer = my_newmem(26);
2503
            snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);
2548
            snprintf(tmp_buffer,25,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer);
2504
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity,1);
2549
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity,1);
Line 2531... Line 2576...
2531
            if(strstr(tooltip_text,"\"") != 0 ){ tooltip_text = str_replace(tooltip_text,"\"","'"); }
2576
            if(strstr(tooltip_text,"\"") != 0 ){ tooltip_text = str_replace(tooltip_text,"\"","'"); }
2532
            break;
2577
            break;
2533
        case AUDIO:
2578
        case AUDIO:
2534
        /*
2579
        /*
2535
        @ audio x,y,w,h,loop,visible,audiofile location
2580
        @ audio x,y,w,h,loop,visible,audiofile location
2536
        @ x,y : left top corner of audio element (in xrange / yrange)
2581
        @ x,y : left top corner of audio element (in xrange / yrange)
2537
        @ w,y : width and height in pixels
2582
        @ w,y : width and height in pixels
2538
        @ loop : 0 or 1 ( 1 = loop audio fragment)
2583
        @ loop : 0 or 1 ( 1 = loop audio fragment)
2539
        @ visible : 0 or 1 (1 = show controls)
2584
        @ visible : 0 or 1 (1 = show controls)
2540
        @ audio format may be in *.mp3 or *.ogg
2585
        @ audio format may be in *.mp3 or *.ogg
2541
        @ If you are using *.mp3 : be aware that FireFox will not (never) play this ! (Pattented format)
2586
        @ If you are using *.mp3 : be aware that FireFox will not (never) play this ! (Pattented format)
Line 2824... Line 2869...
2824
                    case 2: stroke_color = get_color(infile,1);
2869
                    case 2: stroke_color = get_color(infile,1);
2825
                           string_length = snprintf(NULL,0,"draw_setpixel([%f],[%f],\"%s\",%.2f,%d);\n",double_data[0],double_data[1],stroke_color,stroke_opacity,pixelsize);
2870
                           string_length = snprintf(NULL,0,"draw_setpixel([%f],[%f],\"%s\",%.2f,%d);\n",double_data[0],double_data[1],stroke_color,stroke_opacity,pixelsize);
2826
                           check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2871
                           check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2827
                           snprintf(tmp_buffer,string_length,"draw_setpixel([%f],[%f],\"%s\",%.2f,%d);\n",double_data[0],double_data[1],stroke_color,stroke_opacity,pixelsize);
2872
                           snprintf(tmp_buffer,string_length,"draw_setpixel([%f],[%f],\"%s\",%.2f,%d);\n",double_data[0],double_data[1],stroke_color,stroke_opacity,pixelsize);
2828
                           add_to_buffer(tmp_buffer);
2873
                           add_to_buffer(tmp_buffer);
2829
                           break;
2874
                           break;
2830
                    default:break;
2875
                    default:break;
2831
                }
2876
                }
2832
            }
2877
            }
2833
            reset();
2878
            reset();
2834
        break;
2879
        break;
2835
        case PIXELSIZE:
2880
        case PIXELSIZE:
2836
        /*
2881
        /*
2837
        @ pixelsize int
2882
        @ pixelsize int
2838
        @ in case you want to deviate from default pixelsize = 1...
2883
        @ in case you want to deviate from default pixelsize = 1...
2839
        */
2884
        */
Line 2853... Line 2898...
2853
            while( ! done ){     /* get next item until EOL*/
2898
            while( ! done ){     /* get next item until EOL*/
2854
                if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");}
2899
                if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");}
2855
                for( c = 0 ; c < 2; c++){
2900
                for( c = 0 ; c < 2; c++){
2856
                    if(c == 0 ){
2901
                    if(c == 0 ){
2857
                        double_data[i] = get_real(infile,0);
2902
                        double_data[i] = get_real(infile,0);
2858
                        i++;
2903
                        i++;
2859
                    }
2904
                    }
2860
                    else
2905
                    else
2861
                    {
2906
                    {
2862
                        double_data[i] = get_real(infile,1);
2907
                        double_data[i] = get_real(infile,1);
2863
                        i++;
2908
                        i++;
2864
                    }
2909
                    }
Line 2879... Line 2924...
2879
        @ default values should be fine !
2924
        @ default values should be fine !
2880
        @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing
2925
        @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing
2881
        @ the last value for 'precision int' will be used to calculate  the reply coordinates, if needed (read_canvas();)
2926
        @ the last value for 'precision int' will be used to calculate  the reply coordinates, if needed (read_canvas();)
2882
        @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in pixels <br />  r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in xrange / yrange coordinate system<br />  r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />   Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br />  x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br />  x/y in pixels</li><li>15 = reply from inputfields,textareas<br />  reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br />  x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li></ul>
2927
        @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in pixels <br />  r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in xrange / yrange coordinate system<br />  r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />   Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br />  x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br />  x/y in pixels</li><li>15 = reply from inputfields,textareas<br />  reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br />  x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li></ul>
2883
        @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...)
2928
        @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...)
2884
        */
2929
        */
2885
         reply_format = (int) get_real(infile,1);
2930
         reply_format = (int) get_real(infile,1);
2886
         reply_precision = precision;
2931
         reply_precision = precision;
2887
        break;
2932
        break;
2888
        case LEGENDCOLORS:
2933
        case LEGENDCOLORS:
2889
        /*
2934
        /*
Line 2891... Line 2936...
2891
        @ will be used to colour a legend: use this command after the legend command ! e.g.<br />legend test1:test2:test3<br />legendcolors blue:red:orange<br />
2936
        @ will be used to colour a legend: use this command after the legend command ! e.g.<br />legend test1:test2:test3<br />legendcolors blue:red:orange<br />
2892
        @ make sure the number of colours match the number of legend items
2937
        @ make sure the number of colours match the number of legend items
2893
        @ command 'legend' in case of 'piechart' and 'barchart' will use these colours per default (no need to specify 'legendcolors'
2938
        @ command 'legend' in case of 'piechart' and 'barchart' will use these colours per default (no need to specify 'legendcolors'
2894
        */
2939
        */
2895
            if(legend_cnt == -1){canvas_error("use command \"legend\" before command \"legendcolors\" ! ");}
2940
            if(legend_cnt == -1){canvas_error("use command \"legend\" before command \"legendcolors\" ! ");}
2896
            temp = get_string(infile,1);
2941
            temp = get_string(infile,1);
2897
            if( strstr( temp,":") != 0 ){ temp = str_replace(temp,":","\",\""); }
2942
            if( strstr( temp,":") != 0 ){ temp = str_replace(temp,":","\",\""); }
2898
            fprintf(js_include_file,"var legendcolors%d = [\"%s\"];",legend_cnt,temp);
2943
            fprintf(js_include_file,"var legendcolors%d = [\"%s\"];",legend_cnt,temp);
2899
            break;
2944
            break;
2900
        case LEGEND:
2945
        case LEGEND:
2901
        /*
2946
        /*
Line 2916... Line 2961...
2916
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2961
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2917
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2962
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2918
        */
2963
        */
2919
            temp = get_string(infile,1);
2964
            temp = get_string(infile,1);
2920
            fprintf(js_include_file,"var xaxislabel = \"%s\";",temp);
2965
            fprintf(js_include_file,"var xaxislabel = \"%s\";",temp);
2921
            break;
2966
            break;
2922
        case YLABEL:
2967
        case YLABEL:
2923
        /*
2968
        /*
2924
        @ ylabel some_string
2969
        @ ylabel some_string
2925
        @ will be used to create a (vertical) label for the y-axis (label is in quadrant I)
2970
        @ will be used to create a (vertical) label for the y-axis (label is in quadrant I)
2926
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2971
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2927
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2972
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2928
        */
2973
        */
2929
            temp = get_string(infile,1);
2974
            temp = get_string(infile,1);
2930
            fprintf(js_include_file,"var yaxislabel = \"%s\";",temp);
2975
            fprintf(js_include_file,"var yaxislabel = \"%s\";",temp);
2931
            break;
2976
            break;
2932
        case LINEGRAPH: /* scheme: var linegraph_0 = [ 'stroke_color','line_width','use_dashed' ,'dashtype0','dashtype1','x1','y1',...,'x_n','y_n'];*/
2977
        case LINEGRAPH: /* scheme: var linegraph_0 = [ 'stroke_color','line_width','use_dashed' ,'dashtype0','dashtype1','x1','y1',...,'x_n','y_n'];*/
2933
        /*
2978
        /*
2934
        @ linegraph x1:y1;x2:y2...x_n:y_n
2979
        @ linegraph x1:y1;x2:y2...x_n:y_n
2935
        @ will plot your data in a graph
2980
        @ will plot your data in a graph
2936
        @ may only to be used together with command 'grid'
2981
        @ may only to be used together with command 'grid'
2937
        @ can be used together with freestyle x-axis/y-axis texts : see commands 'xaxis' and 'yaxis'
2982
        @ can be used together with freestyle x-axis/y-axis texts : see commands 'xaxis' and 'yaxis'
2938
        @ use command 'legend' to provide an optional legend in right-top-corner
2983
        @ use command 'legend' to provide an optional legend in right-top-corner
Line 3123... Line 3168...
3123
                    case 3: fill_color = get_color(infile,1);
3168
                    case 3: fill_color = get_color(infile,1);
3124
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
3169
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
3125
                        tmp_buffer = my_newmem(string_length+1);
3170
                        tmp_buffer = my_newmem(string_length+1);
3126
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
3171
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
3127
                        fprintf(js_include_file,"use_xlogscale=1;snap_y = %f;snap_x = xlogbase;",double_data[0]/int_data[0]);
3172
                        fprintf(js_include_file,"use_xlogscale=1;snap_y = %f;snap_x = xlogbase;",double_data[0]/int_data[0]);
3128
                        add_to_buffer(tmp_buffer);
3173
                        add_to_buffer(tmp_buffer);
3129
                        break;
3174
                        break;
3130
                    default:break;
3175
                    default:break;
3131
                }
3176
                }
3132
            }
3177
            }
3133
            break;
3178
            break;
3134
        case YLOGSCALE:
3179
        case YLOGSCALE:
3135
        /*
3180
        /*
3136
         @ ylogscale xmajor,xminor,majorcolor,minorcolor
3181
         @ ylogscale xmajor,xminor,majorcolor,minorcolor
3137
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
3182
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
Line 3206... Line 3251...
3206
    fprintf(js_include_file,"var xmin = 0;var xmax = %d;var ymin = 0;var ymax = %d",xsize,ysize);
3251
    fprintf(js_include_file,"var xmin = 0;var xmax = %d;var ymin = 0;var ymax = %d",xsize,ysize);
3207
  }
3252
  }
3208
  else
3253
  else
3209
  {
3254
  {
3210
    if( found_size_command != 3 ){
3255
    if( found_size_command != 3 ){
3211
     canvas_error("Please specify bothe xrange and yrange ...");
3256
     canvas_error("Please specify both xrange and yrange ...");
3212
    }
3257
    }
3213
  }
3258
  }
3214
  /* if needed, add generic draw functions (grid / xml etc) to buffer : these are no draggable shapes / objects  ! */
3259
  /* if needed, add generic draw functions (grid / xml etc) to buffer : these are no draggable/clickable shapes / objects  ! */
3215
  add_javascript_functions(js_function,canvas_root_id);
3260
  add_javascript_functions(js_function,canvas_root_id);
3216
   /* add read_canvas() etc functions if needed */
3261
   /* add read_canvas() etc functions if needed */
3217
  if( reply_format > 0 ){ add_read_canvas(reply_format,reply_precision);}
3262
  if( reply_format > 0 ){ add_read_canvas(reply_format,reply_precision);}
3218
  if( use_pan_and_zoom == TRUE ){
3263
  if( use_pan_and_zoom == TRUE ){
3219
  /* in case of zooming ... */
3264
  /* in case of zooming ... */
Line 3329... Line 3374...
3329
            r += newlen;
3374
            r += newlen;
3330
        }
3375
        }
3331
        strcpy(r, p);
3376
        strcpy(r, p);
3332
    }
3377
    }
3333
    return ret;
3378
    return ret;
3334
}
3379
}
3335
 
3380
 
3336
/******************************************************************************/
3381
/******************************************************************************/
3337
 
3382
 
3338
char *get_color(FILE *infile , int last){
3383
char *get_color(FILE *infile , int last){
3339
    int c,i = 0,is_hex = 0;
3384
    int c,i = 0,is_hex = 0;
3340
    char temp[MAX_COLOR_STRING], *string;
3385
    char temp[MAX_COLOR_STRING], *string;
Line 3621... Line 3666...
3621
23 = answertype for a polyline : remove multiple occurences  due to reclick on a point to create next polyline segment
3666
23 = answertype for a polyline : remove multiple occurences  due to reclick on a point to create next polyline segment
3622
24 = read all inputfield values: even those set 'readonly'
3667
24 = read all inputfield values: even those set 'readonly'
3623
25 = return all userdrawn arcs in degrees:
3668
25 = return all userdrawn arcs in degrees:
3624
26 = return all userdrawn arcs in radians:
3669
26 = return all userdrawn arcs in radians:
3625
27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...
3670
27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...
3626
*/
3671
*/
3627
 
3672
 
3628
 
3673
 
3629
void add_read_canvas(int type_reply,int reply_precision){
3674
void add_read_canvas(int type_reply,int reply_precision){
3630
/* just 1 reply type allowed */
3675
/* just 1 reply type allowed */
3631
fprintf(js_include_file,"\
3676
fprintf(js_include_file,"\
Line 3654... Line 3699...
3654
\n<!-- begin function 1 read_canvas() -->\n\
3699
\n<!-- begin function 1 read_canvas() -->\n\
3655
read_canvas = function(){\
3700
read_canvas = function(){\
3656
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3701
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3657
 set_reply_precision();\
3702
 set_reply_precision();\
3658
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3703
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3659
  var p = 0;var input_reply = new Array();\
3704
  var p = 0;var input_reply = new Array();\
3660
  if( document.getElementById(\"canvas_input0\")){\
3705
  if( document.getElementById(\"canvas_input0\")){\
3661
   var t = 0;\
3706
   var t = 0;\
3662
   while(document.getElementById(\"canvas_input\"+t)){\
3707
   while(document.getElementById(\"canvas_input\"+t)){\
3663
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3708
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3664
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3709
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3665
     p++;\
3710
     p++;\
3666
    };\
3711
    };\
3667
    t++;\
3712
    t++;\
3668
   };\
3713
   };\
3669
  };\
3714
  };\
3670
  if( typeof userdraw_text != 'undefined' ){\
3715
  if( typeof userdraw_text != 'undefined' ){\
3671
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply + \"\\n\"+userdraw_text;\
3716
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply + \"\\n\"+userdraw_text;\
3672
  }\
3717
  }\
3673
  else\
3718
  else\
3674
  {\
3719
  {\
3675
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply;\
3720
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply;\
3676
  }\
3721
  }\
3677
 }\
3722
 }\
3678
 else\
3723
 else\
Line 3717... Line 3762...
3717
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3762
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3718
  }\
3763
  }\
3719
  else\
3764
  else\
3720
  {\
3765
  {\
3721
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\
3766
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\
3722
  }\
3767
  }\
3723
 }\
3768
 }\
3724
 else\
3769
 else\
3725
 {\
3770
 {\
3726
  if( typeof userdraw_text != 'undefined' ){\
3771
  if( typeof userdraw_text != 'undefined' ){\
3727
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
3772
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
3728
  }\
3773
  }\
3729
  else\
3774
  else\
3730
  {\
3775
  {\
3731
   return reply_x+\"\\n\"+reply_y;\
3776
   return reply_x+\"\\n\"+reply_y;\
3732
  };\
3777
  };\
3733
 };\
3778
 };\
3734
};\n\
3779
};\n\
3735
<!-- end function 2 read_canvas() -->",reply_precision);
3780
<!-- end function 2 read_canvas() -->",reply_precision);
3736
    break;
3781
    break;
3737
    case 3: fprintf(js_include_file,"\
3782
    case 3: fprintf(js_include_file,"\
3738
\n<!-- begin function 3 read_canvas() -->\n\
3783
\n<!-- begin function 3 read_canvas() -->\n\
3739
read_canvas = function(){\
3784
read_canvas = function(){\
3740
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3785
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3741
 set_reply_precision();\
3786
 set_reply_precision();\
3742
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3787
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3743
  var p = 0;var input_reply = new Array();\
3788
  var p = 0;var input_reply = new Array();\
3744
  if( document.getElementById(\"canvas_input0\")){\
3789
  if( document.getElementById(\"canvas_input0\")){\
3745
   var t = 0;\
3790
   var t = 0;\
3746
   while(document.getElementById(\"canvas_input\"+t)){\
3791
   while(document.getElementById(\"canvas_input\"+t)){\
3747
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3792
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3748
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3793
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3749
     p++;\
3794
     p++;\
3750
    };\
3795
    };\
3751
    t++;\
3796
    t++;\
3752
   };\
3797
   };\
3753
  };\
3798
  };\
3754
  if( typeof userdraw_text != 'undefined' ){\
3799
  if( typeof userdraw_text != 'undefined' ){\
3755
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3800
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3756
  }\
3801
  }\
3757
  else\
3802
  else\
3758
  {\
3803
  {\
3759
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply;\
3804
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply;\
3760
  }\
3805
  }\
3761
 }\
3806
 }\
3762
 else\
3807
 else\
Line 3813... Line 3858...
3813
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_radius;\
3858
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_radius;\
3814
  }\
3859
  }\
3815
 };\
3860
 };\
3816
};\n\
3861
};\n\
3817
<!-- end function 4 read_canvas() -->",reply_precision);
3862
<!-- end function 4 read_canvas() -->",reply_precision);
3818
    break;
3863
    break;
3819
    /*
3864
    /*
3820
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3865
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3821
        used for userdraw multiple paths
3866
        used for userdraw multiple paths
3822
    */
3867
    */
3823
    case 5: fprintf(js_include_file,"\
3868
    case 5: fprintf(js_include_file,"\
3824
\n<!-- begin function 5 read_canvas() -->\n\
3869
\n<!-- begin function 5 read_canvas() -->\n\
3825
read_canvas = function(){\
3870
read_canvas = function(){\
3826
 set_reply_precision();\
3871
 set_reply_precision();\
3827
 var p = 0;\
3872
 var p = 0;\
3828
 var reply = \"\";\
3873
 var reply = \"\";\
3829
 for(p = 0; p < userdraw_x.length;p++){\
3874
 for(p = 0; p < userdraw_x.length;p++){\
3830
  if(userdraw_x[p] != null ){\
3875
  if(userdraw_x[p] != null ){\
3831
   reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\
3876
   reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\
3832
  };\
3877
  };\
3833
 };\
3878
 };\
3834
 if(p == 0){alert(\"nothing drawn...\");return;};\
3879
 if(p == 0){alert(\"nothing drawn...\");return;};\
3835
 userdraw_x = [];userdraw_y = [];\
3880
 userdraw_x = [];userdraw_y = [];\
3836
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3881
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3837
  var p = 0;var input_reply = new Array();\
3882
  var p = 0;var input_reply = new Array();\
3838
  if( document.getElementById(\"canvas_input0\")){\
3883
  if( document.getElementById(\"canvas_input0\")){\
3839
   var t = 0;\
3884
   var t = 0;\
3840
   while(document.getElementById(\"canvas_input\"+t)){\
3885
   while(document.getElementById(\"canvas_input\"+t)){\
3841
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3886
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3842
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3887
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3843
     p++;\
3888
     p++;\
3844
    };\
3889
    };\
3845
    t++;\
3890
    t++;\
3846
   };\
3891
   };\
3847
  };\
3892
  };\
3848
  if( typeof userdraw_text != 'undefined' ){\
3893
  if( typeof userdraw_text != 'undefined' ){\
3849
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3894
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3850
  }\
3895
  }\
3851
  else\
3896
  else\
3852
  {\
3897
  {\
3853
   return reply +\"\\n\"+input_reply;\
3898
   return reply +\"\\n\"+input_reply;\
3854
  }\
3899
  }\
3855
 }\
3900
 }\
3856
 else\
3901
 else\
3857
 {\
3902
 {\
3858
  if( typeof userdraw_text != 'undefined' ){\
3903
  if( typeof userdraw_text != 'undefined' ){\
3859
   return reply+\"\\n\"+userdraw_text;\
3904
   return reply+\"\\n\"+userdraw_text;\
3860
  }\
3905
  }\
3861
  else\
3906
  else\
3862
  {\
3907
  {\
3863
   return reply;\
3908
   return reply;\
3864
  }\
3909
  }\
3865
 };\
3910
 };\
3866
};\n\
3911
};\n\
3867
<!-- end function 5 read_canvas() -->");
3912
<!-- end function 5 read_canvas() -->");
3868
    break;
3913
    break;
3869
    /*
3914
    /*
3870
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3915
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
Line 3889... Line 3934...
3889
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3934
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3890
  };\
3935
  };\
3891
 };\
3936
 };\
3892
 if(p == 0){alert(\"nothing drawn...\");return;};\
3937
 if(p == 0){alert(\"nothing drawn...\");return;};\
3893
 userdraw_x = [];userdraw_y = [];\
3938
 userdraw_x = [];userdraw_y = [];\
3894
 if( document.getElementById(\"canvas_input0\") ){\
3939
 if( document.getElementById(\"canvas_input0\") ){\
3895
  var p = 0;var input_reply = new Array();\
3940
  var p = 0;var input_reply = new Array();\
3896
  if( document.getElementById(\"canvas_input0\")){\
3941
  if( document.getElementById(\"canvas_input0\")){\
3897
   var t = 0;\
3942
   var t = 0;\
3898
   while(document.getElementById(\"canvas_input\"+t)){\
3943
   while(document.getElementById(\"canvas_input\"+t)){\
3899
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3944
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3900
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3945
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3901
     p++;\
3946
     p++;\
3902
    };\
3947
    };\
3903
    t++;\
3948
    t++;\
3904
   };\
3949
   };\
3905
  };\
3950
  };\
3906
  if( typeof userdraw_text != 'undefined' ){\
3951
  if( typeof userdraw_text != 'undefined' ){\
3907
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3952
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3908
  }\
3953
  }\
3909
  else\
3954
  else\
3910
  {\
3955
  {\
3911
   return reply +\"\\n\"+input_reply;\
3956
   return reply +\"\\n\"+input_reply;\
3912
  }\
3957
  }\
3913
 }\
3958
 }\
3914
 else\
3959
 else\
3915
 {\
3960
 {\
3916
  if( typeof userdraw_text != 'undefined' ){\
3961
  if( typeof userdraw_text != 'undefined' ){\
3917
   return reply +\"\\n\"+userdraw_text;\
3962
   return reply +\"\\n\"+userdraw_text;\
3918
  }\
3963
  }\
3919
  else\
3964
  else\
3920
  {\
3965
  {\
3921
   return reply;\
3966
   return reply;\
3922
  }\
3967
  }\
3923
 };\
3968
 };\
3924
};\n\
3969
};\n\
Line 3926... Line 3971...
3926
    break;
3971
    break;
3927
    case 7: fprintf(js_include_file,"\
3972
    case 7: fprintf(js_include_file,"\
3928
\n<!-- begin function 7 read_canvas() -->\n\
3973
\n<!-- begin function 7 read_canvas() -->\n\
3929
read_canvas = function(){\
3974
read_canvas = function(){\
3930
 set_reply_precision();\
3975
 set_reply_precision();\
3931
 var reply = new Array();\
3976
 var reply = new Array();\
3932
 var p = 0;\
3977
 var p = 0;\
3933
 while(userdraw_x[p]){\
3978
 while(userdraw_x[p]){\
3934
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\
3979
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\
3935
  p++;\
3980
  p++;\
3936
 };\
3981
 };\
3937
 if(p == 0){alert(\"nothing drawn...\");return;};\
3982
 if(p == 0){alert(\"nothing drawn...\");return;};\
3938
 if( document.getElementById(\"canvas_input0\") ){\
3983
 if( document.getElementById(\"canvas_input0\") ){\
3939
  var p = 0;var input_reply = new Array();\
3984
  var p = 0;var input_reply = new Array();\
3940
  if( document.getElementById(\"canvas_input0\")){\
3985
  if( document.getElementById(\"canvas_input0\")){\
3941
   var t = 0;\
3986
   var t = 0;\
3942
   while(document.getElementById(\"canvas_input\"+t)){\
3987
   while(document.getElementById(\"canvas_input\"+t)){\
3943
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3988
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3944
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3989
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3945
     p++;\
3990
     p++;\
3946
    };\
3991
    };\
3947
    t++;\
3992
    t++;\
3948
   };\
3993
   };\
3949
  };\
3994
  };\
Line 3951... Line 3996...
3951
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3996
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3952
  }\
3997
  }\
3953
  else\
3998
  else\
3954
  {\
3999
  {\
3955
   return reply+\"\\n\"+input_reply;\
4000
   return reply+\"\\n\"+input_reply;\
3956
  }\
4001
  }\
3957
 }\
4002
 }\
3958
 else\
4003
 else\
3959
 {\
4004
 {\
3960
  if( typeof userdraw_text != 'undefined' ){\
4005
  if( typeof userdraw_text != 'undefined' ){\
3961
   return reply+\"\\n\"+userdraw_text;\
4006
   return reply+\"\\n\"+userdraw_text;\
3962
  }\
4007
  }\
3963
  else\
4008
  else\
3964
  {\
4009
  {\
3965
   return reply;\
4010
   return reply;\
3966
  }\
4011
  }\
3967
 };\
4012
 };\
3968
};\n\
4013
};\n\
3969
<!-- end function 7 read_canvas() -->");
4014
<!-- end function 7 read_canvas() -->");
3970
    break;
4015
    break;
3971
    case 8: fprintf(js_include_file,"\
4016
    case 8: fprintf(js_include_file,"\
3972
\n<!-- begin function 8 read_canvas() -->\n\
4017
\n<!-- begin function 8 read_canvas() -->\n\
3973
read_canvas = function(){\
4018
read_canvas = function(){\
Line 4012... Line 4057...
4012
};\n\
4057
};\n\
4013
<!-- end function 8 read_canvas() -->",reply_precision);
4058
<!-- end function 8 read_canvas() -->",reply_precision);
4014
    break;
4059
    break;
4015
    case 9: fprintf(js_include_file,"\
4060
    case 9: fprintf(js_include_file,"\
4016
\n<!-- begin function 9 read_canvas() -->\n\
4061
\n<!-- begin function 9 read_canvas() -->\n\
4017
read_canvas = function(){\
4062
read_canvas = function(){\
4018
 set_reply_precision();\
4063
 set_reply_precision();\
4019
 var reply = new Array();\
4064
 var reply = new Array();\
4020
 var p = 0;\
4065
 var p = 0;\
4021
 while(userdraw_x[p]){\
4066
 while(userdraw_x[p]){\
4022
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\
4067
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\
4023
  p++;\
-
 
4024
 };\
-
 
4025
 if(p == 0){alert(\"nothing drawn...\");return;};\
-
 
4026
 if( document.getElementById(\"canvas_input0\") ){\
-
 
4027
  var p = 0;var input_reply = new Array();\
-
 
4028
  if( document.getElementById(\"canvas_input0\")){\
-
 
4029
   var t = 0;\
-
 
4030
   while(document.getElementById(\"canvas_input\"+t)){\
-
 
4031
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
-
 
4032
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
-
 
4033
     p++;\
-
 
4034
    };\
-
 
4035
    t++;\
-
 
4036
   };\
-
 
4037
  };\
-
 
4038
  if( typeof userdraw_text != 'undefined' ){\
-
 
4039
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
-
 
4040
  }\
-
 
4041
  else\
-
 
4042
  {\
-
 
4043
   return reply +\"\\n\"+input_reply;\
-
 
4044
  }\
-
 
4045
 }\
-
 
4046
 else\
-
 
4047
 {\
-
 
4048
  if( typeof userdraw_text != 'undefined' ){\
-
 
4049
   return reply +\"\\n\"+userdraw_text;\
-
 
4050
  }\
-
 
4051
  else\
-
 
4052
  {\
-
 
4053
   return reply;\
-
 
4054
  }\
-
 
4055
 };\
-
 
4056
};\n\
-
 
4057
<!-- end function 9 read_canvas() -->");
-
 
4058
    break;
-
 
4059
    case 10: fprintf(js_include_file,"\
-
 
4060
\n<!-- begin function 10 read_canvas() -->\n\
-
 
4061
read_canvas = function(){\
-
 
4062
 var reply = new Array();\
-
 
4063
 var p = 0;\
-
 
4064
 var prec = %d;\
-
 
4065
 while(userdraw_x[p]){\
-
 
4066
  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;\
-
 
4067
  p++;\
4068
  p++;\
4068
 };\
4069
 };\
4069
 if(p == 0){alert(\"nothing drawn...\");return;};\
4070
 if(p == 0){alert(\"nothing drawn...\");return;};\
4070
 if( document.getElementById(\"canvas_input0\") ){\
4071
 if( document.getElementById(\"canvas_input0\") ){\
4071
  var p = 0;var input_reply = new Array();\
4072
  var p = 0;var input_reply = new Array();\
4072
  if( document.getElementById(\"canvas_input0\")){\
4073
  if( document.getElementById(\"canvas_input0\")){\
4073
   var t = 0;\
4074
   var t = 0;\
4074
   while(document.getElementById(\"canvas_input\"+t)){\
4075
   while(document.getElementById(\"canvas_input\"+t)){\
4075
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4076
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4076
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4077
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4077
     p++;\
4078
     p++;\
4078
    };\
4079
    };\
4079
    t++;\
4080
    t++;\
4080
   };\
4081
   };\
4081
  };\
4082
  };\
4082
  if( typeof userdraw_text != 'undefined' ){\
4083
  if( typeof userdraw_text != 'undefined' ){\
4083
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4084
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4084
  }\
4085
  }\
4085
  else\
4086
  else\
4086
  {\
4087
  {\
4087
   return reply +\"\\n\"+input_reply;\
4088
   return reply +\"\\n\"+input_reply;\
4088
  }\
4089
  }\
4089
 }\
4090
 }\
4090
 else\
4091
 else\
4091
 {\
4092
 {\
4092
  if( typeof userdraw_text != 'undefined' ){\
4093
  if( typeof userdraw_text != 'undefined' ){\
4093
   return reply +\"\\n\"+userdraw_text;\
4094
   return reply +\"\\n\"+userdraw_text;\
4094
  }\
4095
  }\
4095
  else\
4096
  else\
4096
  {\
4097
  {\
4097
   return reply;\
4098
   return reply;\
4098
  }\
4099
  }\
4099
 };\
4100
 };\
4100
};\n\
4101
};\n\
4101
<!-- end function 10 read_canvas() -->",reply_precision);
4102
<!-- end function 9 read_canvas() -->");
4102
    break;
4103
    break;
4103
    case 11: fprintf(js_include_file,"\
4104
    case 10: fprintf(js_include_file,"\
4104
\n<!-- begin function 11 read_canvas() -->\n\
4105
\n<!-- begin function 10 read_canvas() -->\n\
4105
read_canvas = function(){\
4106
read_canvas = function(){\
4106
 var reply = \"\";\
4107
 var reply = new Array();\
4107
 var p = 0;\
4108
 var p = 0;\
4108
 var prec = %d;\
4109
 var prec = %d;\
4109
 while(userdraw_x[p]){\
4110
 while(userdraw_x[p]){\
4110
  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\" ;\
4111
  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;\
4111
  p = p+2;\
4112
  p++;\
4112
 };\
4113
 };\
4113
 if(p == 0){alert(\"nothing drawn...\");return;};\
4114
 if(p == 0){alert(\"nothing drawn...\");return;};\
4114
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
4115
 if( document.getElementById(\"canvas_input0\") ){\
4115
  var p = 0;var input_reply = new Array();\
4116
  var p = 0;var input_reply = new Array();\
4116
  if( document.getElementById(\"canvas_input0\")){\
4117
  if( document.getElementById(\"canvas_input0\")){\
4117
   var t = 0;\
4118
   var t = 0;\
4118
   while(document.getElementById(\"canvas_input\"+t)){\
4119
   while(document.getElementById(\"canvas_input\"+t)){\
4119
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4120
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
Line 4123... Line 4124...
4123
    t++;\
4124
    t++;\
4124
   };\
4125
   };\
4125
  };\
4126
  };\
4126
  if( typeof userdraw_text != 'undefined' ){\
4127
  if( typeof userdraw_text != 'undefined' ){\
4127
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4128
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4128
  }\
4129
  }\
-
 
4130
  else\
-
 
4131
  {\
-
 
4132
   return reply +\"\\n\"+input_reply;\
-
 
4133
  }\
-
 
4134
 }\
-
 
4135
 else\
-
 
4136
 {\
-
 
4137
  if( typeof userdraw_text != 'undefined' ){\
-
 
4138
   return reply +\"\\n\"+userdraw_text;\
-
 
4139
  }\
4129
  else\
4140
  else\
4130
  {\
4141
  {\
4131
   return reply +\"\\n\"+input_reply;\
4142
   return reply;\
4132
  }\
4143
  }\
-
 
4144
 };\
-
 
4145
};\n\
-
 
4146
<!-- end function 10 read_canvas() -->",reply_precision);
-
 
4147
    break;
-
 
4148
    case 11: fprintf(js_include_file,"\
-
 
4149
\n<!-- begin function 11 read_canvas() -->\n\
-
 
4150
read_canvas = function(){\
-
 
4151
 var reply = \"\";\
-
 
4152
 var p = 0;\
-
 
4153
 var prec = %d;\
-
 
4154
 while(userdraw_x[p]){\
-
 
4155
  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\" ;\
-
 
4156
  p = p+2;\
-
 
4157
 };\
-
 
4158
 if(p == 0){alert(\"nothing drawn...\");return;};\
-
 
4159
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
-
 
4160
  var p = 0;var input_reply = new Array();\
-
 
4161
  if( document.getElementById(\"canvas_input0\")){\
-
 
4162
   var t = 0;\
-
 
4163
   while(document.getElementById(\"canvas_input\"+t)){\
-
 
4164
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
-
 
4165
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
-
 
4166
     p++;\
-
 
4167
    };\
-
 
4168
    t++;\
-
 
4169
   };\
-
 
4170
  };\
-
 
4171
  if( typeof userdraw_text != 'undefined' ){\
-
 
4172
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
-
 
4173
  }\
-
 
4174
  else\
-
 
4175
  {\
-
 
4176
   return reply +\"\\n\"+input_reply;\
-
 
4177
  }\
4133
 }\
4178
 }\
4134
 else\
4179
 else\
4135
 {\
4180
 {\
4136
  if( typeof userdraw_text != 'undefined' ){\
4181
  if( typeof userdraw_text != 'undefined' ){\
4137
   return reply +\"\\n\"+userdraw_text;\
4182
   return reply +\"\\n\"+userdraw_text;\
4138
  }\
4183
  }\
4139
  else\
4184
  else\
4140
  {\
4185
  {\
4141
   return reply;\
4186
   return reply;\
4142
  }\
4187
  }\
4143
 };\
4188
 };\
4144
};\n\
4189
};\n\
4145
<!-- end function 11 read_canvas() -->",reply_precision);
4190
<!-- end function 11 read_canvas() -->",reply_precision);
4146
    break;
4191
    break;
4147
    case 12: fprintf(js_include_file,"\
4192
    case 12: fprintf(js_include_file,"\
4148
\n<!-- begin function 12 read_canvas() -->\n\
4193
\n<!-- begin function 12 read_canvas() -->\n\
4149
read_canvas = function(){\
4194
read_canvas = function(){\
4150
 set_reply_precision();\
4195
 set_reply_precision();\
4151
 var reply = \"\";\
4196
 var reply = \"\";\
4152
 var p = 0;\
4197
 var p = 0;\
4153
 for(p = 0; p< userdraw_x.lenght;p = p+2){\
4198
 for(p = 0; p< userdraw_x.lenght;p = p+2){\
4154
  if(userdraw_x[p] != null){\
4199
  if(userdraw_x[p] != null){\
Line 4184... Line 4229...
4184
  else\
4229
  else\
4185
  {\
4230
  {\
4186
   return reply;\
4231
   return reply;\
4187
  }\
4232
  }\
4188
 };\
4233
 };\
4189
};\n\
4234
};\n\
4190
<!-- end function 12 read_canvas() -->");
4235
<!-- end function 12 read_canvas() -->");
4191
    break;
4236
    break;
4192
    case 13: fprintf(js_include_file,"\
4237
    case 13: fprintf(js_include_file,"\
4193
\n<!-- begin function 13 read_canvas() -->\n\
4238
\n<!-- begin function 13 read_canvas() -->\n\
4194
read_canvas = function(){\
4239
read_canvas = function(){\
4195
 var reply = new Array();\
4240
 var reply = new Array();\
4196
 var p = 0;var i = 0;\
4241
 var p = 0;var i = 0;\
4197
 var prec = %d;\
4242
 var prec = %d;\
4198
 while(userdraw_x[p]){\
4243
 while(userdraw_x[p]){\
4199
  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;\
4244
  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;\
4200
  p = p+2;i++;\
4245
  p = p+2;i++;\
4201
 };\
4246
 };\
4202
 if(p == 0){alert(\"nothing drawn...\");return;};\
4247
 if(p == 0){alert(\"nothing drawn...\");return;};\
4203
 if( document.getElementById(\"canvas_input0\") ){\
4248
 if( document.getElementById(\"canvas_input0\") ){\
4204
  var p = 0;var input_reply = new Array();\
4249
  var p = 0;var input_reply = new Array();\
4205
  if( document.getElementById(\"canvas_input0\")){\
4250
  if( document.getElementById(\"canvas_input0\")){\
4206
   var t = 0;\
4251
   var t = 0;\
4207
   while(document.getElementById(\"canvas_input\"+t)){\
4252
   while(document.getElementById(\"canvas_input\"+t)){\
4208
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4253
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4209
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4254
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4210
     p++;\
4255
     p++;\
4211
    };\
4256
    };\
4212
    t++;\
4257
    t++;\
4213
   };\
4258
   };\
4214
  };\
4259
  };\
4215
  if( typeof userdraw_text != 'undefined' ){\
4260
  if( typeof userdraw_text != 'undefined' ){\
4216
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4261
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4217
  }\
4262
  }\
4218
  else\
4263
  else\
4219
  {\
4264
  {\
4220
   return reply +\"\\n\"+input_reply;\
4265
   return reply +\"\\n\"+input_reply;\
4221
  }\
4266
  }\
4222
 }\
4267
 }\
4223
 else\
4268
 else\
4224
 {\
4269
 {\
4225
  if( typeof userdraw_text != 'undefined' ){\
4270
  if( typeof userdraw_text != 'undefined' ){\
4226
   return reply +\"\\n\"+userdraw_text\
4271
   return reply +\"\\n\"+userdraw_text\
4227
  }\
4272
  }\
4228
  else\
4273
  else\
4229
  {\
4274
  {\
4230
   return reply;\
4275
   return reply;\
4231
  }\
4276
  }\
4232
 };\
4277
 };\
4233
};\n\
4278
};\n\
4234
<!-- end function 13 read_canvas() -->",reply_precision);
4279
<!-- end function 13 read_canvas() -->",reply_precision);
4235
    break;
4280
    break;
4236
    case 14: fprintf(js_include_file,"\
4281
    case 14: fprintf(js_include_file,"\
4237
\n<!-- begin function 14 read_canvas() -->\n\
4282
\n<!-- begin function 14 read_canvas() -->\n\
Line 4240... Line 4285...
4240
 var reply = new Array();\
4285
 var reply = new Array();\
4241
 var p = 0;var i = 0;\
4286
 var p = 0;var i = 0;\
4242
 while(userdraw_x[p]){\
4287
 while(userdraw_x[p]){\
4243
  reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\
4288
  reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\
4244
  p = p+2;i++;\
4289
  p = p+2;i++;\
4245
 };\
4290
 };\
4246
 if(p == 0){alert(\"nothing drawn...\");return;};\
4291
 if(p == 0){alert(\"nothing drawn...\");return;};\
4247
 if( document.getElementById(\"canvas_input0\") ){\
4292
 if( document.getElementById(\"canvas_input0\") ){\
4248
  var p = 0;var input_reply = new Array();\
4293
  var p = 0;var input_reply = new Array();\
4249
  if( document.getElementById(\"canvas_input0\")){\
4294
  if( document.getElementById(\"canvas_input0\")){\
4250
   var t = 0;\
4295
   var t = 0;\
Line 4252... Line 4297...
4252
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4297
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
4253
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4298
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
4254
     p++;\
4299
     p++;\
4255
    };\
4300
    };\
4256
    t++;\
4301
    t++;\
4257
   };\
4302
   };\
4258
  };\
4303
  };\
4259
  if( typeof userdraw_text != 'undefined' ){\
4304
  if( typeof userdraw_text != 'undefined' ){\
4260
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4305
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
4261
  }\
4306
  }\
4262
  else\
4307
  else\
Line 4277... Line 4322...
4277
};\n\
4322
};\n\
4278
<!-- end function 14 read_canvas() -->");
4323
<!-- end function 14 read_canvas() -->");
4279
    break;
4324
    break;
4280
    case 15: fprintf(js_include_file,"\
4325
    case 15: fprintf(js_include_file,"\
4281
\n<!-- begin function 15  read_canvas() -->\n\
4326
\n<!-- begin function 15  read_canvas() -->\n\
4282
read_canvas = function(){\
4327
read_canvas = function(){\
4283
 var input_reply = new Array();\
4328
 var input_reply = new Array();\
4284
 var p = 0;\
4329
 var p = 0;\
4285
 if( document.getElementById(\"canvas_input0\")){\
4330
 if( document.getElementById(\"canvas_input0\")){\
4286
  var t = 0;\
4331
  var t = 0;\
4287
  while(document.getElementById(\"canvas_input\"+t)){\
4332
  while(document.getElementById(\"canvas_input\"+t)){\
Line 4315... Line 4360...
4315
 };\
4360
 };\
4316
return reply;\
4361
return reply;\
4317
};\
4362
};\
4318
this.read_mathml = read_mathml;\n\
4363
this.read_mathml = read_mathml;\n\
4319
<!-- end function 16 read_mathml() -->");
4364
<!-- end function 16 read_mathml() -->");
4320
    break;
4365
    break;
4321
    case 17:  fprintf(js_include_file,"\
4366
    case 17:  fprintf(js_include_file,"\
4322
\n<!-- begin function 17 read_canvas() -->\n\
4367
\n<!-- begin function 17 read_canvas() -->\n\
4323
read_canvas = function(){\
4368
read_canvas = function(){\
4324
 if( userdraw_text.length == 0){alert(\"no text typed...\");return;}\
4369
 if( userdraw_text.length == 0){alert(\"no text typed...\");return;}\
4325
 return userdraw_text;\
4370
 return userdraw_text;\
4326
};\n\
4371
};\n\
4327
<!-- end function 17 read_canvas() -->");
4372
<!-- end function 17 read_canvas() -->");
4328
    break;
4373
    break;
4329
    case 18: fprintf(js_include_file,"\
4374
    case 18: fprintf(js_include_file,"\
4330
\n<!-- begin function 18 read_canvas() -->\n\
4375
\n<!-- begin function 18 read_canvas() -->\n\
4331
read_canvas = function(){\
4376
read_canvas = function(){\
4332
 var p = 0;\
4377
 var p = 0;\
4333
 var reply = new Array();\
4378
 var reply = new Array();\
4334
 var name;\
4379
 var name;\
4335
 var t = true;\
4380
 var t = true;\
4336
 var h;var m;var s;\
4381
 var h;var m;var s;\
4337
 while(t){\
4382
 while(t){\
Line 4526... Line 4571...
4526
};\n\
4571
};\n\
4527
<!-- end function 24 read_canvas() -->");
4572
<!-- end function 24 read_canvas() -->");
4528
    break;
4573
    break;
4529
    case 25:
4574
    case 25:
4530
    fprintf(js_include_file,"\n<!-- begin function 25 read_canvas() : angle(s) in degrees-->\n\
4575
    fprintf(js_include_file,"\n<!-- begin function 25 read_canvas() : angle(s) in degrees-->\n\
4531
read_canvas = function(){\
4576
read_canvas = function(){\
4532
 if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\
4577
 if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\
4533
 var lu = userdraw_radius.length;\
4578
 var lu = userdraw_radius.length;\
4534
 var prec = %d;\
4579
 var prec = %d;\
4535
 var angle_reply = new Array(lu);\
4580
 var angle_reply = new Array(lu);\
4536
 for(var p = 0 ; p < lu ; p++){\
4581
 for(var p = 0 ; p < lu ; p++){\
Line 4718... Line 4763...
4718
    break;
4763
    break;
4719
   
4764
   
4720
    case DRAW_IMAGEFILL:/* not  used for userdraw */
4765
    case DRAW_IMAGEFILL:/* not  used for userdraw */
4721
fprintf(js_include_file,"\n<!-- draw imagefill -->\n\
4766
fprintf(js_include_file,"\n<!-- draw imagefill -->\n\
4722
var draw_imagefill = function(canvas_type,x0,y0,URL,xsize,ysize){\
4767
var draw_imagefill = function(canvas_type,x0,y0,URL,xsize,ysize){\
4723
 var obj;\
4768
 var obj;\
4724
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4769
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4725
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4770
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4726
 }\
4771
 }\
4727
 else\
4772
 else\
4728
 {\
4773
 {\
4729
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4774
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4730
 };\
4775
 };\
4731
 var ctx = obj.getContext(\"2d\");\
4776
 var ctx = obj.getContext(\"2d\");\
4732
 ctx.save();\
4777
 ctx.save();\
4733
 var img = new Image();\
4778
 var img = new Image();\
4734
 img.src = URL;\
4779
 img.src = URL;\
4735
 img.onload = function(){\
4780
 img.onload = function(){\
Line 4761... Line 4806...
4761
   
4806
   
4762
    case DRAW_DOTFILL:/* not  used for userdraw */
4807
    case DRAW_DOTFILL:/* not  used for userdraw */
4763
fprintf(js_include_file,"\n<!-- draw dotfill -->\n\
4808
fprintf(js_include_file,"\n<!-- draw dotfill -->\n\
4764
var draw_dotfill = function(canvas_type,x0,y0,dx,dy,radius,color,opacity,xsize,ysize){\
4809
var draw_dotfill = function(canvas_type,x0,y0,dx,dy,radius,color,opacity,xsize,ysize){\
4765
 var obj;\
4810
 var obj;\
4766
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4811
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4767
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4812
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4768
 }\
4813
 }\
4769
 else\
4814
 else\
4770
 {\
4815
 {\
4771
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4816
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4772
 };\
4817
 };\
4773
 var ctx = obj.getContext(\"2d\");\
4818
 var ctx = obj.getContext(\"2d\");\
Line 4813... Line 4858...
4813
 y = y0;\
4858
 y = y0;\
4814
 for( x = xsize ; x > 0 ; x = x - dx){\
4859
 for( x = xsize ; x > 0 ; x = x - dx){\
4815
  ctx.moveTo(x,ysize);\
4860
  ctx.moveTo(x,ysize);\
4816
  ctx.lineTo(x0,y);\
4861
  ctx.lineTo(x0,y);\
4817
  y = y + dy;\
4862
  y = y + dy;\
4818
 };\
4863
 };\
4819
 x = x0;\
4864
 x = x0;\
4820
 for( y = y0 ; y < ysize ; y = y + dy ){\
4865
 for( y = y0 ; y < ysize ; y = y + dy ){\
4821
  ctx.moveTo(xsize,y);\
4866
  ctx.moveTo(xsize,y);\
4822
  ctx.lineTo(x,ysize);\
4867
  ctx.lineTo(x,ysize);\
4823
  x = x + dx;\
4868
  x = x + dx;\
Line 4825... Line 4870...
4825
 x = xsize;\
4870
 x = xsize;\
4826
 for( y = ysize ; y > y0 ; y = y - dy ){\
4871
 for( y = ysize ; y > y0 ; y = y - dy ){\
4827
  ctx.moveTo(x,y0);\
4872
  ctx.moveTo(x,y0);\
4828
  ctx.lineTo(x0,y);\
4873
  ctx.lineTo(x0,y);\
4829
  x = x - dx;\
4874
  x = x - dx;\
4830
 };\
4875
 };\
4831
 ctx.stroke();\
4876
 ctx.stroke();\
4832
 ctx.restore();\
4877
 ctx.restore();\
4833
 return;\
4878
 return;\
4834
 }",canvas_root_id,canvas_root_id,canvas_root_id);
4879
 }",canvas_root_id,canvas_root_id,canvas_root_id);
4835
    break;
4880
    break;
Line 4869... Line 4914...
4869
 };",canvas_root_id,canvas_root_id,canvas_root_id);
4914
 };",canvas_root_id,canvas_root_id,canvas_root_id);
4870
    break;
4915
    break;
4871
    case DRAW_CIRCLES:/*  used for userdraw */
4916
    case DRAW_CIRCLES:/*  used for userdraw */
4872
fprintf(js_include_file,"\n<!-- draw circles -->\n\
4917
fprintf(js_include_file,"\n<!-- draw circles -->\n\
4873
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){\
4918
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){\
4874
 ctx.save();\
4919
 ctx.save();\
4875
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4920
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4876
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4921
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4877
 ctx.lineWidth = line_width;\
4922
 ctx.lineWidth = line_width;\
4878
 for(var p = 0 ; p < x_points.length ; p++ ){\
4923
 for(var p = 0 ; p < x_points.length ; p++ ){\
4879
  ctx.beginPath();\
4924
  ctx.beginPath();\
4880
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4925
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4881
  ctx.closePath();\
4926
  ctx.closePath();\
4882
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4927
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4883
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4928
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4884
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4929
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4885
  ctx.stroke();\
4930
  ctx.stroke();\
4886
 }\
4931
 }\
4887
 ctx.restore();\
4932
 ctx.restore();\
4888
 return;\
4933
 return;\
4889
};");
4934
};");
4890
    break;
4935
    break;
4891
    case DRAW_POLYLINE:/* user for userdraw : draw lines through points */
4936
    case DRAW_POLYLINE:/* user for userdraw : draw lines through points */
4892
fprintf(js_include_file,"\n<!-- draw polyline -->\n\
4937
fprintf(js_include_file,"\n<!-- draw polyline -->\n\
4893
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){\
4938
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){\
4894
 ctx.save();\
4939
 ctx.save();\
4895
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4940
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4896
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4941
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4897
 ctx.lineWidth = line_width;\
4942
 ctx.lineWidth = line_width;\
4898
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4943
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4899
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4944
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4900
 ctx.clearRect(0,0,xsize,ysize);\
4945
 ctx.clearRect(0,0,xsize,ysize);\
4901
 ctx.beginPath();\
4946
 ctx.beginPath();\
4902
 for(var p = 0 ; p < x_points.length-1 ; p++ ){\
4947
 for(var p = 0 ; p < x_points.length-1 ; p++ ){\
4903
  ctx.moveTo(x_points[p],y_points[p]);\
4948
  ctx.moveTo(x_points[p],y_points[p]);\
Line 4905... Line 4950...
4905
 }\
4950
 }\
4906
 ctx.closePath();\
4951
 ctx.closePath();\
4907
 ctx.stroke();\
4952
 ctx.stroke();\
4908
 ctx.fillStyle =\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4953
 ctx.fillStyle =\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4909
 for(var p = 0 ; p < x_points.length ; p++ ){\
4954
 for(var p = 0 ; p < x_points.length ; p++ ){\
4910
  ctx.beginPath();\
4955
  ctx.beginPath();\
4911
  ctx.arc(x_points[p],y_points[p],line_width,0,2*Math.PI,false);\
4956
  ctx.arc(x_points[p],y_points[p],line_width,0,2*Math.PI,false);\
4912
  ctx.closePath();ctx.fill();ctx.stroke();\
4957
  ctx.closePath();ctx.fill();ctx.stroke();\
4913
 };\
4958
 };\
4914
 ctx.restore();\
4959
 ctx.restore();\
4915
 return;\
4960
 return;\
Line 4917... Line 4962...
4917
    break;
4962
    break;
4918
   
4963
   
4919
    case DRAW_SEGMENTS:/*  used for userdraw */
4964
    case DRAW_SEGMENTS:/*  used for userdraw */
4920
fprintf(js_include_file,"\n<!-- draw segments -->\n\
4965
fprintf(js_include_file,"\n<!-- draw segments -->\n\
4921
var draw_segments = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
4966
var draw_segments = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_affine,affine_matrix){\
4922
 ctx.save();\
4967
 ctx.save();\
4923
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4968
 if(use_affine == 1 ){ctx.translate(affine_matrix[4],affine_matrix[5]);}\
4924
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4969
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4925
 ctx.lineWidth = line_width;\
4970
 ctx.lineWidth = line_width;\
4926
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4971
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4927
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4972
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4928
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
4973
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
4929
  ctx.beginPath();\
4974
  ctx.beginPath();\
4930
  ctx.moveTo(x_points[p],y_points[p]);\
4975
  ctx.moveTo(x_points[p],y_points[p]);\
4931
  ctx.lineTo(x_points[p+1],y_points[p+1]);\
4976
  ctx.lineTo(x_points[p+1],y_points[p+1]);\
4932
  ctx.closePath();\
4977
  ctx.closePath();\
4933
  ctx.stroke();\
4978
  ctx.stroke();\
4934
  }\
4979
  }\
Line 6651... Line 6696...
6651
        *xsnaptogrid="xsnaptogrid",
6696
        *xsnaptogrid="xsnaptogrid",
6652
        *ysnaptogrid="ysnaptogrid",
6697
        *ysnaptogrid="ysnaptogrid",
6653
        *userinput_xy="userinput_xy",
6698
        *userinput_xy="userinput_xy",
6654
        *userinput_function="userinput_function",
6699
        *userinput_function="userinput_function",
6655
        *usertextarea_xy="usertextarea_xy",
6700
        *usertextarea_xy="usertextarea_xy",
-
 
6701
        *userinput="userinput",
6656
        *jsmath="jsmath",
6702
        *jsmath="jsmath",
6657
        *trace_jscurve="trace_jscurve",
6703
        *trace_jscurve="trace_jscurve",
6658
        *setlimits="setlimits",
6704
        *setlimits="setlimits",
6659
        *jscurve="jscurve",
6705
        *jscurve="jscurve",
6660
        *jsplot="jsplot",
6706
        *jsplot="jsplot",
Line 7316... Line 7362...
7316
        return USERINPUT_FUNCTION;
7362
        return USERINPUT_FUNCTION;
7317
        }
7363
        }
7318
        if( strcmp(input_type, usertextarea_xy) == 0 ){
7364
        if( strcmp(input_type, usertextarea_xy) == 0 ){
7319
        free(input_type);
7365
        free(input_type);
7320
        return USERTEXTAREA_XY;
7366
        return USERTEXTAREA_XY;
-
 
7367
        }
-
 
7368
        if( strcmp(input_type, userinput) == 0 ){
-
 
7369
        free(input_type);
-
 
7370
        return USERINPUT;
7321
        }
7371
        }
7322
        if( strcmp(input_type, sgraph) == 0 ){
7372
        if( strcmp(input_type, sgraph) == 0 ){
7323
        free(input_type);
7373
        free(input_type);
7324
        return SGRAPH;
7374
        return SGRAPH;
7325
        }
7375
        }