Subversion Repositories wimsdev

Rev

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

Rev 8146 Rev 8193
Line 965... Line 965...
965
        */
965
        */
966
            /* add simple eval check to avoid code injection with unprotected eval(string) */
966
            /* add simple eval check to avoid code injection with unprotected eval(string) */
967
            if( use_input_xy != 0 ){canvas_error("userinput_xy can not be combined with usertextarea_xy command");}
967
            if( use_input_xy != 0 ){canvas_error("userinput_xy can not be combined with usertextarea_xy command");}
968
            if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */
968
            if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */
969
            use_input_xy = 1;
969
            use_input_xy = 1;
-
 
970
            break;
-
 
971
        case USERINPUT_FUNCTION:
-
 
972
        /*
-
 
973
        @ userinput_function
-
 
974
        @ keyword
-
 
975
        @ if set , a inputfield will be added to the page
-
 
976
        @ the userinput value will be plotted in the canvas
-
 
977
        @ this value may be read with 'read_canvas()'. <br />for do it yourself js-scripters : If this is the first inputfield in the script, it's id is canvas_input0
-
 
978
        @ use before this command 'userinput_function',<br />commands like 'inputstyle some_css' , 'xlabel some_description' , 'opacity int,int' , 'linewidth int' , 'dashed' and 'dashtype int,int' to modify
-
 
979
        @ incompatible with command 'intooltip link_text_or_image' : it uses the tooltip div for adding the inputfield
-
 
980
        */
-
 
981
            if( js_function[DRAW_JSFUNCTION] != 1 ){
-
 
982
             js_function[DRAW_JSFUNCTION] = 1;
-
 
983
             if(reply_format == 0){reply_format = 24;}/* read canvas_input values */
-
 
984
             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]);
-
 
985
             input_cnt++;
-
 
986
            }
-
 
987
            if( use_js_math == FALSE){/* add this stuff only once...*/
-
 
988
             add_to_js_math(js_include_file);
-
 
989
             use_js_math = TRUE;
-
 
990
            }
-
 
991
            if( use_js_plot == FALSE){
-
 
992
             use_js_plot = TRUE;
-
 
993
             add_jsplot(js_include_file,canvas_root_id); /* this plots the function on JSPLOT_CANVAS */
-
 
994
            }
970
            break;
995
            break;
971
        case USERDRAW:
996
        case USERDRAW:
972
        /*
997
        /*
973
        @ userdraw object_type,color
998
        @ userdraw object_type,color
974
        @ implemented object_type: <ul><li>point</li><li>points</li><li>crosshair</li><li>crosshairs</li><li>line</li><li>lines</li><li>vline</li><li>vlines</li><li>hline</li><li>hlines</li><li>segment</li><li>segments</li><li>polyline</li><li>circle</li><li>circles</li><li>arrow</li><li>arrow2 (double arrow)</li><li>arrows</li><li>arrows2 (double arrows)</li><li>triangle</li><li>polygon</li><li>poly[3-9]</li><li>rect</li><li>roundrect</li><li>rects</li><li>roundrects</li><li>freehandline</li><li>freehandlines</li><li>path</li><li>paths</li><li>text</li><li>arc</li><li>arcs</li><li>input<br/>place a single inputfield on 'canvas'<br />use commands 'inputstyle' for css styling: use command 'linewidth' for adjusting the input field size (default 1)</li><li>inputs<br/>place multiple inputfield : placing inputfields on top of each other is not possible</li></ul>
999
        @ implemented object_type: <ul><li>point</li><li>points</li><li>crosshair</li><li>crosshairs</li><li>line</li><li>lines</li><li>vline</li><li>vlines</li><li>hline</li><li>hlines</li><li>segment</li><li>segments</li><li>polyline</li><li>circle</li><li>circles</li><li>arrow</li><li>arrow2 (double arrow)</li><li>arrows</li><li>arrows2 (double arrows)</li><li>triangle</li><li>polygon</li><li>poly[3-9]</li><li>rect</li><li>roundrect</li><li>rects</li><li>roundrects</li><li>freehandline</li><li>freehandlines</li><li>path</li><li>paths</li><li>text</li><li>arc</li><li>arcs</li><li>input<br/>place a single inputfield on 'canvas'<br />use commands 'inputstyle' for css styling: use command 'linewidth' for adjusting the input field size (default 1)</li><li>inputs<br/>place multiple inputfield : placing inputfields on top of each other is not possible</li></ul>
Line 983... Line 1008...
983
        @ may be combined with keyword 'userinput_xy' or
1008
        @ may be combined with keyword 'userinput_xy' or
984
        @ note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature <br />To avoid trouble do not use zooming / panning together width userdraw.!
1009
        @ note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature <br />To avoid trouble do not use zooming / panning together width userdraw.!
985
        */
1010
        */
986
            if( use_userdraw == TRUE ){ /* only one object type may be drawn*/
1011
            if( use_userdraw == TRUE ){ /* only one object type may be drawn*/
987
                canvas_error("Only one userdraw primitive may be used: read documentation !!");
1012
                canvas_error("Only one userdraw primitive may be used: read documentation !!");
988
            }
1013
            }
989
            reply_precision = precision;
1014
            reply_precision = precision;
990
            use_userdraw = TRUE;
1015
            use_userdraw = TRUE;
991
            fprintf(js_include_file,"\n<!-- begin userdraw mouse events -->\nuserdraw_x = new Array();userdraw_y = new Array();userdraw_radius = new Array();var xy_cnt=0;var canvas_userdraw = create_canvas%d(%d,xsize,ysize);var context_userdraw = canvas_userdraw.getContext(\"2d\");var use_dashed = %d;if(use_dashed == 1){if( context_userdraw.setLineDash ){context_userdraw.setLineDash([%d,%d]);}else{if(context_userdraw.mozDash){context_userdraw.mozDash = [%d,%d];};};};if(wims_status != \"done\"){canvas_div.addEventListener(\"mousedown\",user_draw,false);canvas_div.addEventListener(\"mousemove\",user_drag,false);canvas_div.addEventListener(\"touchstart\",user_draw,false);canvas_div.addEventListener(\"touchmove\",user_drag,false);}\n<!-- end userdraw mouse events -->",canvas_root_id,DRAW_CANVAS,use_dashed,dashtype[0],dashtype[1],dashtype[0],dashtype[1]);
1016
            fprintf(js_include_file,"\n<!-- begin userdraw mouse events -->\nuserdraw_x = new Array();userdraw_y = new Array();userdraw_radius = new Array();var xy_cnt=0;var canvas_userdraw = create_canvas%d(%d,xsize,ysize);var context_userdraw = canvas_userdraw.getContext(\"2d\");var use_dashed = %d;if(use_dashed == 1){if( context_userdraw.setLineDash ){context_userdraw.setLineDash([%d,%d]);}else{if(context_userdraw.mozDash){context_userdraw.mozDash = [%d,%d];};};};if(wims_status != \"done\"){canvas_div.addEventListener(\"mousedown\",user_draw,false);canvas_div.addEventListener(\"mousemove\",user_drag,false);canvas_div.addEventListener(\"touchstart\",user_draw,false);canvas_div.addEventListener(\"touchmove\",user_drag,false);}\n<!-- end userdraw mouse events -->",canvas_root_id,DRAW_CANVAS,use_dashed,dashtype[0],dashtype[1],dashtype[0],dashtype[1]);
992
            draw_type = get_string_argument(infile,0);
1017
            draw_type = get_string_argument(infile,0);
993
            stroke_color = get_color(infile,1);
1018
            stroke_color = get_color(infile,1);
994
            if( strcmp(draw_type,"point") == 0 ){
1019
            if( strcmp(draw_type,"point") == 0 ){
995
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1020
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
996
                if(reply_format == 0 ){reply_format = 8;}
1021
                if(reply_format == 0 ){reply_format = 8;}
997
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1022
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
998
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1023
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
999
                if(use_input_xy == 1){
1024
                if(use_input_xy == 1){
1000
                    add_input_circle(js_include_file,1,1);
1025
                    add_input_circle(js_include_file,1,1);
1001
                    add_input_xy(js_include_file,canvas_root_id);
1026
                    add_input_xy(js_include_file,canvas_root_id);
1002
                }
1027
                }
1003
                add_js_points(js_include_file,1,draw_type,line_width,line_width,stroke_color,stroke_opacity,1,stroke_color,stroke_opacity,0,1,1);
1028
                add_js_points(js_include_file,1,draw_type,line_width,line_width,stroke_color,stroke_opacity,1,stroke_color,stroke_opacity,0,1,1);
1004
            }
1029
            }
Line 1011... Line 1036...
1011
                if(use_input_xy == 1){
1036
                if(use_input_xy == 1){
1012
                    add_input_circle(js_include_file,1,2);
1037
                    add_input_circle(js_include_file,1,2);
1013
                    add_input_xy(js_include_file,canvas_root_id);
1038
                    add_input_xy(js_include_file,canvas_root_id);
1014
                }
1039
                }
1015
                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);
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);
1016
            }
1041
            }
1017
            else
1042
            else
1018
            if( strcmp(draw_type,"segment") == 0 ){
1043
            if( strcmp(draw_type,"segment") == 0 ){
1019
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1044
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1020
                if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;}
1045
                if( js_function[DRAW_SEGMENTS] != 1 ){ js_function[DRAW_SEGMENTS] = 1;}
1021
                if(reply_format == 0){reply_format = 11;}
1046
                if(reply_format == 0){reply_format = 11;}
1022
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1047
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1023
                if(use_input_xy == 1){
1048
                if(use_input_xy == 1){
1024
                    add_input_segment(js_include_file,1);
1049
                    add_input_segment(js_include_file,1);
1025
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1050
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1026
                }
1051
                }
1027
                add_js_segments(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1052
                add_js_segments(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1028
            }
1053
            }
1029
            else
1054
            else
1030
            if( strcmp(draw_type,"polyline") == 0 ){
1055
            if( strcmp(draw_type,"polyline") == 0 ){
1031
                if( js_function[DRAW_POLYLINE] != 1 ){ js_function[DRAW_POLYLINE] = 1;}
1056
                if( js_function[DRAW_POLYLINE] != 1 ){ js_function[DRAW_POLYLINE] = 1;}
1032
                if(reply_format == 0){reply_format = 23;}
1057
                if(reply_format == 0){reply_format = 23;}
1033
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1058
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1034
                if( use_input_xy == 1 ){
1059
                if( use_input_xy == 1 ){
1035
                    add_input_polyline(js_include_file);
1060
                    add_input_polyline(js_include_file);
1036
                    add_input_xy(js_include_file,canvas_root_id);
1061
                    add_input_xy(js_include_file,canvas_root_id);
1037
                }
1062
                }
1038
                add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1063
                add_js_polyline(js_include_file,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1039
            }
1064
            }
1040
            else
1065
            else
1041
            if( strcmp(draw_type,"segments") == 0 ){
1066
            if( strcmp(draw_type,"segments") == 0 ){
1042
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1067
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
Line 1055... Line 1080...
1055
                if(reply_format == 0){reply_format = 10;}
1080
                if(reply_format == 0){reply_format = 10;}
1056
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1081
                /* 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n in x/y-range */
1057
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1082
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1058
                if(use_input_xy == 1){
1083
                if(use_input_xy == 1){
1059
                    add_input_circle(js_include_file,2,1);
1084
                    add_input_circle(js_include_file,2,1);
1060
                    add_input_xyr(js_include_file,canvas_root_id);
1085
                    add_input_xyr(js_include_file,canvas_root_id);
1061
                }
1086
                }
1062
                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]);
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]);
1063
            }
1088
            }
1064
            else
1089
            else
1065
            if( strcmp(draw_type,"circles") == 0 ){
1090
            if( strcmp(draw_type,"circles") == 0 ){
1066
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1091
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
Line 1073... Line 1098...
1073
                    add_input_xyr(js_include_file,canvas_root_id);
1098
                    add_input_xyr(js_include_file,canvas_root_id);
1074
                }
1099
                }
1075
            }
1100
            }
1076
            else
1101
            else
1077
            if(strcmp(draw_type,"crosshair") == 0 ){
1102
            if(strcmp(draw_type,"crosshair") == 0 ){
1078
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1103
                if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
1079
                if(reply_format == 0){reply_format = 8;}
1104
                if(reply_format == 0){reply_format = 8;}
1080
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1105
                /* 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n in x/y-range */
1081
                add_js_crosshairs(js_include_file,1,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1106
                add_js_crosshairs(js_include_file,1,draw_type,line_width,crosshair_size ,stroke_color,stroke_opacity);
1082
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1107
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1083
                if(use_input_xy == 1){
1108
                if(use_input_xy == 1){
Line 1100... Line 1125...
1100
            else
1125
            else
1101
            if(strcmp(draw_type,"freehandline") == 0 ){
1126
            if(strcmp(draw_type,"freehandline") == 0 ){
1102
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1127
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1103
                if(reply_format == 0){reply_format = 6;}
1128
                if(reply_format == 0){reply_format = 6;}
1104
                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]);  
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]);  
1105
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1130
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1106
                if(use_input_xy == 2){ canvas_error("usertextarea_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 !");}
1107
            }
1132
            }
1108
            else
1133
            else
1109
            if(strcmp(draw_type,"freehandlines") == 0 ){
1134
            if(strcmp(draw_type,"freehandlines") == 0 ){
1110
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1135
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1111
                if(reply_format == 0){reply_format = 6;}
1136
                if(reply_format == 0){reply_format = 6;}
1112
                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]);  
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]);  
1113
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1138
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1114
                if(use_input_xy == 2){ canvas_error("usertextarea_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 !");}
1115
            }
1140
            }
1116
            else
1141
            else
1117
            if(strcmp(draw_type,"path") == 0 ){
1142
            if(strcmp(draw_type,"path") == 0 ){
1118
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1143
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1119
                if(reply_format == 0){reply_format = 6;}
1144
                if(reply_format == 0){reply_format = 6;}
1120
                add_js_paths(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);  
1145
                add_js_paths(js_include_file,1,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);  
1121
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1146
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1122
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1147
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1123
            }
1148
            }
1124
            else
1149
            else
1125
            if(strcmp(draw_type,"paths") == 0 ){
1150
            if(strcmp(draw_type,"paths") == 0 ){
1126
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1151
                if( js_function[DRAW_PATHS] != 1 ){ js_function[DRAW_PATHS] = 1;}
1127
                if(reply_format == 0){reply_format = 6;}
1152
                if(reply_format == 0){reply_format = 6;}
1128
                add_js_paths(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);  
1153
                add_js_paths(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_filled,fill_color,fill_opacity,use_dashed,dashtype[0],dashtype[1]);  
1129
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1154
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1130
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1155
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1131
            }
1156
            }
1132
            else
1157
            else
1133
            if(strcmp(draw_type,"arrows") == 0 ){
1158
            if(strcmp(draw_type,"arrows") == 0 ){
1134
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1159
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1135
                if(reply_format == 0){reply_format = 11;}
1160
                if(reply_format == 0){reply_format = 11;}
1136
                add_js_arrows(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1161
                add_js_arrows(js_include_file,2,draw_type,line_width,1,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1137
                if(use_input_xy == 1){
1162
                if(use_input_xy == 1){
1138
                    add_input_arrow(js_include_file,2);
1163
                    add_input_arrow(js_include_file,2);
1139
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1164
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1140
                }
1165
                }
1141
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1166
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1142
            }
1167
            }
1143
            else
1168
            else
1144
            if(strcmp(draw_type,"arrows2") == 0 ){
1169
            if(strcmp(draw_type,"arrows2") == 0 ){
1145
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1170
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1146
                if(reply_format == 0){reply_format = 11;}
1171
                if(reply_format == 0){reply_format = 11;}
1147
                add_js_arrows(js_include_file,2,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1172
                add_js_arrows(js_include_file,2,draw_type,line_width,2,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1],arrow_head);
1148
                if(use_input_xy == 1){
1173
                if(use_input_xy == 1){
1149
                    add_input_arrow(js_include_file,1);
1174
                    add_input_arrow(js_include_file,1);
1150
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1175
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1151
                }
1176
                }
1152
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1177
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1153
            }
1178
            }
1154
            else
1179
            else
1155
            if(strcmp(draw_type,"arrow2") == 0 ){
1180
            if(strcmp(draw_type,"arrow2") == 0 ){
1156
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
1181
                if( js_function[DRAW_ARROWS] != 1 ){ js_function[DRAW_ARROWS] = 1;}
Line 1237... Line 1262...
1237
            if( strcmp(draw_type,"line") == 0 ){
1262
            if( strcmp(draw_type,"line") == 0 ){
1238
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1263
                if( js_function[DRAW_CIRCLES] != 1 ){ js_function[DRAW_CIRCLES] = 1;}
1239
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1264
                if( js_function[DRAW_LINES] != 1 ){ js_function[DRAW_LINES] = 1;}
1240
                if(reply_format == 0){reply_format = 11;}
1265
                if(reply_format == 0){reply_format = 11;}
1241
                add_js_lines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1266
                add_js_lines(js_include_file,1,draw_type,line_width,stroke_color,stroke_opacity,use_dashed,dashtype[0],dashtype[1]);
1242
                if( use_input_xy == 1 ){
1267
                if( use_input_xy == 1 ){
1243
                    add_input_line(js_include_file,1);
1268
                    add_input_line(js_include_file,1);
1244
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1269
                    add_input_x1y1x2y2(js_include_file,canvas_root_id);
1245
                }
1270
                }
1246
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1271
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1247
            }
1272
            }
Line 1327... Line 1352...
1327
                if(reply_format == 0){reply_format = 27;}
1352
                if(reply_format == 0){reply_format = 27;}
1328
                add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width);
1353
                add_js_inputs(js_include_file,canvas_root_id,1,input_cnt,input_style,line_width);
1329
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1354
                if(use_input_xy == 1){ canvas_error("userinput_xy not yet implemented for this userdraw type !");}
1330
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1355
                if(use_input_xy == 2){ canvas_error("usertextarea_xy not yet implemented for this userdraw type !");}
1331
            }
1356
            }
1332
            else
1357
            else
1333
            {
1358
            {
1334
                canvas_error("unknown drawtype or typo? ");
1359
                canvas_error("unknown drawtype or typo? ");
1335
            }
1360
            }
1336
            reset();
1361
            reset();
1337
        break;
1362
        break;
Line 2225... Line 2250...
2225
            break;
2250
            break;
2226
        case CLEARBUTTON:
2251
        case CLEARBUTTON:
2227
        /*
2252
        /*
2228
         @clearbutton value
2253
         @clearbutton value
2229
         @adds a button to clear the userdraw canvas with text 'value'
2254
         @adds a button to clear the userdraw canvas with text 'value'
-
 
2255
         @normally userdraw primitives have the option to use middle/right mouse button on<br /> a point of the object to remove this specific object...this clear button will remove all drawings
2230
         @uses the tooltip placeholder div element: may not be used with command 'intooltip'
2256
         @uses the tooltip placeholder div element: may not be used with command 'intooltip'
2231
         @use command 'inputstyle' to style the button...  
2257
         @use command 'inputstyle' to style the button...  
2232
        */
2258
        */
2233
            add_clear_button(js_include_file,canvas_root_id,input_style,get_string(infile,1));
2259
            add_clear_button(js_include_file,canvas_root_id,input_style,get_string(infile,1));
2234
        break;
2260
        break;
Line 6623... Line 6649...
6623
        *nostatus="nostatus",
6649
        *nostatus="nostatus",
6624
        *snaptogrid="snaptogrid",
6650
        *snaptogrid="snaptogrid",
6625
        *xsnaptogrid="xsnaptogrid",
6651
        *xsnaptogrid="xsnaptogrid",
6626
        *ysnaptogrid="ysnaptogrid",
6652
        *ysnaptogrid="ysnaptogrid",
6627
        *userinput_xy="userinput_xy",
6653
        *userinput_xy="userinput_xy",
-
 
6654
        *userinput_function="userinput_function",
6628
        *usertextarea_xy="usertextarea_xy",
6655
        *usertextarea_xy="usertextarea_xy",
6629
        *jsmath="jsmath",
6656
        *jsmath="jsmath",
6630
        *trace_jscurve="trace_jscurve",
6657
        *trace_jscurve="trace_jscurve",
6631
        *setlimits="setlimits",
6658
        *setlimits="setlimits",
6632
        *jscurve="jscurve",
6659
        *jscurve="jscurve",
Line 7281... Line 7308...
7281
        return YSNAPTOGRID;
7308
        return YSNAPTOGRID;
7282
        }
7309
        }
7283
        if( strcmp(input_type, userinput_xy) == 0 ){
7310
        if( strcmp(input_type, userinput_xy) == 0 ){
7284
        free(input_type);
7311
        free(input_type);
7285
        return USERINPUT_XY;
7312
        return USERINPUT_XY;
-
 
7313
        }
-
 
7314
        if( strcmp(input_type, userinput_function) == 0 ){
-
 
7315
        free(input_type);
-
 
7316
        return USERINPUT_FUNCTION;
7286
        }
7317
        }
7287
        if( strcmp(input_type, usertextarea_xy) == 0 ){
7318
        if( strcmp(input_type, usertextarea_xy) == 0 ){
7288
        free(input_type);
7319
        free(input_type);
7289
        return USERTEXTAREA_XY;
7320
        return USERTEXTAREA_XY;
7290
        }
7321
        }