Subversion Repositories wimsdev

Rev

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

Rev 7797 Rev 7823
Line 137... Line 137...
137
    double angle = 0.0;
137
    double angle = 0.0;
138
    int translate_x = 0;
138
    int translate_x = 0;
139
    int translate_y = 0;
139
    int translate_y = 0;
140
    int clickfillmarge = 20;
140
    int clickfillmarge = 20;
141
    int animation_type = 9; /* == object type curve in drag library */
141
    int animation_type = 9; /* == object type curve in drag library */
142
    int use_input_xy = 0;
142
    int use_input_xy = 0; /* 1= input fields 2= textarea 3=calc y value*/
143
    size_t string_length = 0;
143
    size_t string_length = 0;
144
    double stroke_opacity = 0.8;
144
    double stroke_opacity = 0.8;
145
    double fill_opacity = 0.8;
145
    double fill_opacity = 0.8;
146
    char *URL = "http://localhost/images";
146
    char *URL = "http://localhost/images";
147
    memset(buffer,'\0',MAX_BUFFER);
147
    memset(buffer,'\0',MAX_BUFFER);
Line 1252... Line 1252...
1252
            for(c = 0 ; c < i; c++){
1252
            for(c = 0 ; c < i; c++){
1253
             fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,16,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s));\n",click_cnt,onclick,drag_type,eval_levelcurve(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,double_data[c]),line_width,line_width,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix);
1253
             fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,16,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s));\n",click_cnt,onclick,drag_type,eval_levelcurve(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,double_data[c]),line_width,line_width,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix);
1254
             click_cnt++;
1254
             click_cnt++;
1255
            }
1255
            }
1256
            reset();
1256
            reset();
-
 
1257
            break;
-
 
1258
        case TRACE_JSMATH:
-
 
1259
        /*
-
 
1260
         @trace_jsmath some_javascript_math_function
-
 
1261
         @will use a crosshair to trace the jsmath curve
-
 
1262
         @two inputfields will display the current x/y-values (approximated)
-
 
1263
         @use linewidth,strokecolor,crosshairsize to adjust the corsshair.
-
 
1264
         @example: trace_jsmath Math.pow(x,2)+4*x+16
-
 
1265
         @example: trace_jsmath Math.sin(Math.pow(x,Math.Pi))+Math.sqrt(x)
-
 
1266
         @no check is done on the validity of your function and/or syntax<br />use error console to debug any errors...
-
 
1267
        */
-
 
1268
            if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
-
 
1269
            add_trace_js_mouse(js_include_file,TRACE_CANVAS,canvas_root_id,stroke_color,get_string(infile,1),font_size,stroke_opacity,line_width,crosshair_size);
-
 
1270
            if(use_mouse_coordinates == TRUE){canvas_error("trace_jsmath can not be combined with command 'mouse'");}
-
 
1271
            use_mouse_coordinates = TRUE; /* will add & call function "use_mouse_coordinates(){}" in current_canvas /current_context */
-
 
1272
 
-
 
1273
            break;
-
 
1274
        case JSMATH:
-
 
1275
        /*
-
 
1276
            @jsmath some_javascript_math_function
-
 
1277
            @will calculate an y-value from a userinput x-value and draws a crosshairs on these coordinates.
-
 
1278
            @example: jsmath Math.pow(x,2)+4*x+16
-
 
1279
            @example: jsmath Math.sin(Math.pow(x,Math.Pi))+Math.sqrt(x)
-
 
1280
            @no check is done on the validity of your function and/or syntax<br />use error console to debug any errors...
-
 
1281
        */
-
 
1282
            if( js_function[DRAW_CROSSHAIRS] != 1 ){ js_function[DRAW_CROSSHAIRS] = 1;}
-
 
1283
            add_calc_y(js_include_file,canvas_root_id,get_string(infile,1));
1257
            break;
1284
            break;
1258
        case CURVE:
1285
        case CURVE:
1259
        /*
1286
        /*
1260
         @curve color,formula(x)
1287
         @curve color,formula(x)
1261
         @plot color,formula(x)
1288
         @plot color,formula(x)
Line 2036... Line 2063...
2036
        case MOUSE:
2063
        case MOUSE:
2037
        /*
2064
        /*
2038
         @ mouse color,fontsize
2065
         @ mouse color,fontsize
2039
         @ will display the cursor coordinates  in 'color' and 'font size'<br /> using default fontfamily Ariel
2066
         @ will display the cursor coordinates  in 'color' and 'font size'<br /> using default fontfamily Ariel
2040
        */
2067
        */
-
 
2068
            if(use_mouse_coordinates == TRUE){canvas_error("trace_jsmath can not be combined with command 'mouse'");}
2041
            use_mouse_coordinates = TRUE; /* will add & call function "use_mouse_coordinates(){}" in current_canvas /current_context */
2069
            use_mouse_coordinates = TRUE; /* will add & call function "use_mouse_coordinates(){}" in current_canvas /current_context */
2042
            stroke_color = get_color(infile,0);
2070
            stroke_color = get_color(infile,0);
2043
            font_size = (int) (get_real(infile,1));
2071
            font_size = (int) (get_real(infile,1));
2044
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity);
2072
            add_js_mouse(js_include_file,MOUSE_CANVAS,canvas_root_id,precision,stroke_color,font_size,stroke_opacity);
2045
            break;
2073
            break;
Line 2050... Line 2078...
2050
            @ link_text may also be an image URL http://some_server/images/my_image.png
2078
            @ link_text may also be an image URL http://some_server/images/my_image.png
2051
            @ link_text may contain HTML markup
2079
            @ link_text may contain HTML markup
2052
            @ the canvas will be displayed in a tooltip on 'link_text'
2080
            @ the canvas will be displayed in a tooltip on 'link_text'
2053
            @ the canvas is default transparent: use command 'bgcolor color' to adjust background-color<br />the link test will alos be shown with this bgcolor.
2081
            @ the canvas is default transparent: use command 'bgcolor color' to adjust background-color<br />the link test will alos be shown with this bgcolor.
2054
            */
2082
            */
2055
            if(use_input_xy == TRUE){canvas_error("intooltip can not be combined with userinput_xy command");}
2083
            if(use_input_xy != FALSE ){canvas_error("intooltip can not be combined with userinput_xy command");}
2056
            use_tooltip = TRUE;
2084
            use_tooltip = TRUE;
2057
            tooltip_text = get_string(infile,1);
2085
            tooltip_text = get_string(infile,1);
2058
            if(strstr(tooltip_text,"\"") != 0 ){ tooltip_text = str_replace(tooltip_text,"\"","'"); }
2086
            if(strstr(tooltip_text,"\"") != 0 ){ tooltip_text = str_replace(tooltip_text,"\"","'"); }
2059
            break;
2087
            break;
2060
        case AUDIO:
2088
        case AUDIO:
Line 2618... Line 2646...
2618
                    case 3: fill_color = get_color(infile,1);
2646
                    case 3: fill_color = get_color(infile,1);
2619
                        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);
2647
                        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);
2620
                        tmp_buffer = my_newmem(string_length+1);
2648
                        tmp_buffer = my_newmem(string_length+1);
2621
                        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);
2649
                        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);
2622
                        fprintf(js_include_file,"use_xlogscale=1;snap_y = %f;snap_x = xlogbase;",double_data[0]/int_data[0]);
2650
                        fprintf(js_include_file,"use_xlogscale=1;snap_y = %f;snap_x = xlogbase;",double_data[0]/int_data[0]);
2623
                        add_to_buffer(tmp_buffer);
2651
                        add_to_buffer(tmp_buffer);
2624
                        break;
2652
                        break;
2625
                    default:break;
2653
                    default:break;
2626
                }
2654
                }
2627
            }
2655
            }
2628
            break;
2656
            break;
2629
        case YLOGSCALE:
2657
        case YLOGSCALE:
2630
        /*
2658
        /*
2631
         @ ylogscale xmajor,xminor,majorcolor,minorcolor
2659
         @ ylogscale xmajor,xminor,majorcolor,minorcolor
Line 3047... Line 3075...
3047
    r in pixels
3075
    r in pixels
3048
 
3076
 
3049
4 = x1,x2,x3,x4....x_n
3077
4 = x1,x2,x3,x4....x_n
3050
    y1,y2,y3,y4....y_n
3078
    y1,y2,y3,y4....y_n
3051
    r1,r2,r3,r4....r_n
3079
    r1,r2,r3,r4....r_n
3052
 
3080
 
3053
    x/y in  xrange / yrange coordinate system
3081
    x/y in  xrange / yrange coordinate system
3054
    r in pixels
3082
    r in pixels
3055
 
3083
 
3056
5 = Ax1,Ax2,Ax3,Ax4....Ax_n
3084
5 = Ax1,Ax2,Ax3,Ax4....Ax_n
3057
    Ay1,Ay2,Ay3,Ay4....Ay_n
3085
    Ay1,Ay2,Ay3,Ay4....Ay_n
3058
    Bx1,Bx2,Bx3,Bx4....Bx_n
3086
    Bx1,Bx2,Bx3,Bx4....Bx_n
Line 3213... Line 3241...
3213
 }\
3241
 }\
3214
 else\
3242
 else\
3215
 {\
3243
 {\
3216
  if( typeof userdraw_text != 'undefined' ){\
3244
  if( typeof userdraw_text != 'undefined' ){\
3217
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
3245
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
3218
  }\
3246
  }\
3219
  else\
3247
  else\
3220
  {\
3248
  {\
3221
   return reply_x+\"\\n\"+reply_y;\
3249
   return reply_x+\"\\n\"+reply_y;\
3222
  };\
3250
  };\
3223
 };\
3251
 };\
3224
};\
3252
};\
3225
this.read_canvas = read_canvas;\n\
3253
this.read_canvas = read_canvas;\n\
3226
<!-- end function 2 read_canvas() -->");
3254
<!-- end function 2 read_canvas() -->");
3227
    break;
3255
    break;
3228
    case 3: fprintf(js_include_file,"\
3256
    case 3: fprintf(js_include_file,"\
3229
\n<!-- begin function 3 read_canvas() -->\n\
3257
\n<!-- begin function 3 read_canvas() -->\n\
3230
function read_canvas(){\
3258
function read_canvas(){\
3231
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3259
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3232
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3260
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3233
  var p = 0;var input_reply = new Array();\
3261
  var p = 0;var input_reply = new Array();\
3234
  if( document.getElementById(\"canvas_input0\")){\
3262
  if( document.getElementById(\"canvas_input0\")){\
3235
   var t = 0;\
3263
   var t = 0;\
3236
   while(document.getElementById(\"canvas_input\"+t)){\
3264
   while(document.getElementById(\"canvas_input\"+t)){\
3237
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3265
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3238
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3266
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3239
     p++;\
3267
     p++;\
3240
    };\
3268
    };\
3241
    t++;\
3269
    t++;\
3242
   };\
3270
   };\
3243
  };\
3271
  };\
3244
  if( typeof userdraw_text != 'undefined' ){\
3272
  if( typeof userdraw_text != 'undefined' ){\
3245
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3273
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3246
  }\
3274
  }\
3247
  else\
3275
  else\
3248
  {\
3276
  {\
3249
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply;\
3277
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+input_reply;\
3250
  }\
3278
  }\
3251
 }\
3279
 }\
3252
 else\
3280
 else\
3253
 {\
3281
 {\
3254
  if( typeof userdraw_text != 'undefined' ){\
3282
  if( typeof userdraw_text != 'undefined' ){\
3255
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+userdrawW_text;\
3283
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius+\"\\n\"+userdrawW_text;\
3256
  }\
3284
  }\
3257
  else\
3285
  else\
3258
  {\
3286
  {\
3259
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius;\
3287
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_radius;\
3260
  }\
3288
  }\
3261
 }\
3289
 }\
Line 3283... Line 3311...
3283
     p++;\
3311
     p++;\
3284
    };\
3312
    };\
3285
    t++;\
3313
    t++;\
3286
   };\
3314
   };\
3287
  };\
3315
  };\
3288
  if( typeof userdraw_text != 'undefined' ){\
3316
  if( typeof userdraw_text != 'undefined' ){\
3289
   return reply_x+\"\\n\"+reply_y +\"\\n\"+userdraw_radius+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3317
   return reply_x+\"\\n\"+reply_y +\"\\n\"+userdraw_radius+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3290
  }\
3318
  }\
3291
  else\
3319
  else\
3292
  {\
3320
  {\
3293
   return reply_x+\"\\n\"+reply_y +\"\\n\"+userdraw_radius+\"\\n\"+input_reply;\
3321
   return reply_x+\"\\n\"+reply_y +\"\\n\"+userdraw_radius+\"\\n\"+input_reply;\
Line 3304... Line 3332...
3304
  }\
3332
  }\
3305
 };\
3333
 };\
3306
};\
3334
};\
3307
this.read_canvas = read_canvas;\n\
3335
this.read_canvas = read_canvas;\n\
3308
<!-- end function 4 read_canvas() -->");
3336
<!-- end function 4 read_canvas() -->");
3309
    break;
3337
    break;
3310
    /*
3338
    /*
3311
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3339
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3312
        used for userdraw multiple paths
3340
        used for userdraw multiple paths
3313
    */
3341
    */
3314
    case 5: fprintf(js_include_file,"\
3342
    case 5: fprintf(js_include_file,"\
3315
\n<!-- begin function 5 read_canvas() -->\n\
3343
\n<!-- begin function 5 read_canvas() -->\n\
3316
function read_canvas(){\
3344
function read_canvas(){\
3317
 var p = 0;\
3345
 var p = 0;\
3318
 var reply = \"\";\
3346
 var reply = \"\";\
3319
 for(p = 0; p < userdraw_x.length;p++){\
3347
 for(p = 0; p < userdraw_x.length;p++){\
3320
  if(userdraw_x[p] != null ){\
3348
  if(userdraw_x[p] != null ){\
3321
   reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\
3349
   reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\
3322
  };\
3350
  };\
3323
 };\
3351
 };\
3324
 if(p == 0){alert(\"nothing drawn...\");return;};\
3352
 if(p == 0){alert(\"nothing drawn...\");return;};\
3325
 userdraw_x = [];userdraw_y = [];\
3353
 userdraw_x = [];userdraw_y = [];\
3326
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3354
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3327
  var p = 0;var input_reply = new Array();\
3355
  var p = 0;var input_reply = new Array();\
3328
  if( document.getElementById(\"canvas_input0\")){\
3356
  if( document.getElementById(\"canvas_input0\")){\
3329
   var t = 0;\
3357
   var t = 0;\
3330
   while(document.getElementById(\"canvas_input\"+t)){\
3358
   while(document.getElementById(\"canvas_input\"+t)){\
3331
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3359
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3332
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3360
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3333
     p++;\
3361
     p++;\
3334
    };\
3362
    };\
3335
    t++;\
3363
    t++;\
3336
   };\
3364
   };\
3337
  };\
3365
  };\
3338
  if( typeof userdraw_text != 'undefined' ){\
3366
  if( typeof userdraw_text != 'undefined' ){\
3339
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3367
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3340
  }\
3368
  }\
3341
  else\
3369
  else\
3342
  {\
3370
  {\
Line 3350... Line 3378...
3350
  }\
3378
  }\
3351
  else\
3379
  else\
3352
  {\
3380
  {\
3353
   return reply;\
3381
   return reply;\
3354
  }\
3382
  }\
3355
 };\
3383
 };\
3356
};\
3384
};\
3357
this.read_canvas = rdad_canvas;\n\
3385
this.read_canvas = rdad_canvas;\n\
3358
<!-- end function 5 read_canvas() -->");
3386
<!-- end function 5 read_canvas() -->");
3359
    break;
3387
    break;
3360
    /*
3388
    /*
Line 3379... Line 3407...
3379
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3407
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3380
  };\
3408
  };\
3381
 };\
3409
 };\
3382
 if(p == 0){alert(\"nothing drawn...\");return;};\
3410
 if(p == 0){alert(\"nothing drawn...\");return;};\
3383
 userdraw_x = [];userdraw_y = [];\
3411
 userdraw_x = [];userdraw_y = [];\
3384
 if( document.getElementById(\"canvas_input0\") ){\
3412
 if( document.getElementById(\"canvas_input0\") ){\
3385
  var p = 0;var input_reply = new Array();\
3413
  var p = 0;var input_reply = new Array();\
3386
  if( document.getElementById(\"canvas_input0\")){\
3414
  if( document.getElementById(\"canvas_input0\")){\
3387
   var t = 0;\
3415
   var t = 0;\
3388
   while(document.getElementById(\"canvas_input\"+t)){\
3416
   while(document.getElementById(\"canvas_input\"+t)){\
3389
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3417
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3390
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3418
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3391
     p++;\
3419
     p++;\
3392
    };\
3420
    };\
3393
    t++;\
3421
    t++;\
3394
   };\
3422
   };\
3395
  };\
3423
  };\
3396
  if( typeof userdraw_text != 'undefined' ){\
3424
  if( typeof userdraw_text != 'undefined' ){\
3397
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3425
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3398
  }\
3426
  }\
3399
  else\
3427
  else\
3400
  {\
3428
  {\
3401
   return reply +\"\\n\"+input_reply;\
3429
   return reply +\"\\n\"+input_reply;\
3402
  }\
3430
  }\
3403
 }\
3431
 }\
3404
 else\
3432
 else\
3405
 {\
3433
 {\
3406
  if( typeof userdraw_text != 'undefined' ){\
3434
  if( typeof userdraw_text != 'undefined' ){\
3407
   return reply +\"\\n\"+userdraw_text;\
3435
   return reply +\"\\n\"+userdraw_text;\
3408
  }\
3436
  }\
3409
  else\
3437
  else\
3410
  {\
3438
  {\
3411
   return reply;\
3439
   return reply;\
3412
  }\
3440
  }\
3413
 };\
3441
 };\
3414
};\
3442
};\
3415
this.read_canvas = read_canvas;\n\
3443
this.read_canvas = read_canvas;\n\
3416
<!-- end function 6 read_canvas() -->");
3444
<!-- end function 6 read_canvas() -->");
3417
    break;
3445
    break;
3418
    case 7: fprintf(js_include_file,"\
3446
    case 7: fprintf(js_include_file,"\
3419
\n<!-- begin function 7 read_canvas() -->\n\
3447
\n<!-- begin function 7 read_canvas() -->\n\
3420
function read_canvas(){\
3448
function read_canvas(){\
3421
 var reply = new Array();\
3449
 var reply = new Array();\
3422
 var p = 0;\
3450
 var p = 0;\
Line 3464... Line 3492...
3464
function read_canvas(){\
3492
function read_canvas(){\
3465
 var reply = new Array();\
3493
 var reply = new Array();\
3466
 var p = 0;\
3494
 var p = 0;\
3467
 while(userdraw_x[p]){\
3495
 while(userdraw_x[p]){\
3468
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]);\
3496
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]);\
3469
  p++;\
3497
  p++;\
3470
 };\
3498
 };\
3471
 if(p == 0){alert(\"nothing drawn...\");return;};\
3499
 if(p == 0){alert(\"nothing drawn...\");return;};\
3472
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3500
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3473
  var p = 0;var input_reply = new Array();\
3501
  var p = 0;var input_reply = new Array();\
3474
  if( document.getElementById(\"canvas_input0\")){\
3502
  if( document.getElementById(\"canvas_input0\")){\
3475
   var t = 0;\
3503
   var t = 0;\
3476
   while(document.getElementById(\"canvas_input\"+t)){\
3504
   while(document.getElementById(\"canvas_input\"+t)){\
3477
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3505
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3478
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3506
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3479
     p++;\
3507
     p++;\
3480
    };\
3508
    };\
3481
    t++;\
3509
    t++;\
3482
   };\
3510
   };\
3483
  };\
3511
  };\
3484
  if( typeof userdraw_text != 'undefined' ){\
3512
  if( typeof userdraw_text != 'undefined' ){\
3485
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3513
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3486
  }\
3514
  }\
3487
  else\
3515
  else\
3488
  {\
3516
  {\
3489
   return reply +\"\\n\"+input_reply;\
3517
   return reply +\"\\n\"+input_reply;\
3490
  }\
3518
  }\
3491
 }\
3519
 }\
3492
 else\
3520
 else\
3493
 {\
3521
 {\
3494
  if( typeof userdraw_text != 'undefined' ){\
3522
  if( typeof userdraw_text != 'undefined' ){\
3495
   return reply +\"\\n\"+userdraw_text;\
3523
   return reply +\"\\n\"+userdraw_text;\
3496
  }\
3524
  }\
3497
  else\
3525
  else\
3498
  {\
3526
  {\
3499
   return reply;\
3527
   return reply;\
3500
  }\
3528
  }\
3501
 };\
3529
 };\
3502
};\
3530
};\
3503
this.read_canvas = read_canvas;\n\
3531
this.read_canvas = read_canvas;\n\
3504
<!-- end function 8 read_canvas() -->");
3532
<!-- end function 8 read_canvas() -->");
3505
    break;
3533
    break;
3506
    case 9: fprintf(js_include_file,"\
3534
    case 9: fprintf(js_include_file,"\
3507
\n<!-- begin function 9 read_canvas() -->\n\
3535
\n<!-- begin function 9 read_canvas() -->\n\
3508
function read_canvas(){\
3536
function read_canvas(){\
3509
 var reply = new Array();\
3537
 var reply = new Array();\
3510
 var p = 0;\
3538
 var p = 0;\
3511
 while(userdraw_x[p]){\
3539
 while(userdraw_x[p]){\
3512
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\
3540
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p] + \":\" + userdraw_radius[p];\
3513
  p++;\
3541
  p++;\
3514
 };\
3542
 };\
3515
 if(p == 0){alert(\"nothing drawn...\");return;};\
3543
 if(p == 0){alert(\"nothing drawn...\");return;};\
3516
 if( document.getElementById(\"canvas_input0\") ){\
3544
 if( document.getElementById(\"canvas_input0\") ){\
3517
  var p = 0;var input_reply = new Array();\
3545
  var p = 0;var input_reply = new Array();\
3518
  if( document.getElementById(\"canvas_input0\")){\
3546
  if( document.getElementById(\"canvas_input0\")){\
Line 3529... Line 3557...
3529
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3557
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3530
  }\
3558
  }\
3531
  else\
3559
  else\
3532
  {\
3560
  {\
3533
   return reply +\"\\n\"+input_reply;\
3561
   return reply +\"\\n\"+input_reply;\
3534
  }\
3562
  }\
3535
 }\
3563
 }\
3536
 else\
3564
 else\
3537
 {\
3565
 {\
3538
  if( typeof userdraw_text != 'undefined' ){\
3566
  if( typeof userdraw_text != 'undefined' ){\
3539
   return reply +\"\\n\"+userdraw_text;\
3567
   return reply +\"\\n\"+userdraw_text;\
Line 3552... Line 3580...
3552
function read_canvas(){\
3580
function read_canvas(){\
3553
 var reply = new Array();\
3581
 var reply = new Array();\
3554
 var p = 0;\
3582
 var p = 0;\
3555
 while(userdraw_x[p]){\
3583
 while(userdraw_x[p]){\
3556
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + userdraw_radius[p];\
3584
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + userdraw_radius[p];\
3557
  p++;\
3585
  p++;\
3558
 };\
3586
 };\
3559
 if(p == 0){alert(\"nothing drawn...\");return;};\
3587
 if(p == 0){alert(\"nothing drawn...\");return;};\
3560
 if( document.getElementById(\"canvas_input0\") ){\
3588
 if( document.getElementById(\"canvas_input0\") ){\
3561
  var p = 0;var input_reply = new Array();\
3589
  var p = 0;var input_reply = new Array();\
3562
  if( document.getElementById(\"canvas_input0\")){\
3590
  if( document.getElementById(\"canvas_input0\")){\
3563
   var t = 0;\
3591
   var t = 0;\
3564
   while(document.getElementById(\"canvas_input\"+t)){\
3592
   while(document.getElementById(\"canvas_input\"+t)){\
3565
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3593
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3566
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3594
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3567
     p++;\
3595
     p++;\
3568
    };\
3596
    };\
3569
    t++;\
3597
    t++;\
3570
   };\
3598
   };\
3571
  };\
3599
  };\
3572
  if( typeof userdraw_text != 'undefined' ){\
3600
  if( typeof userdraw_text != 'undefined' ){\
3573
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3601
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3574
  }\
3602
  }\
3575
  else\
3603
  else\
3576
  {\
3604
  {\
3577
   return reply +\"\\n\"+input_reply;\
3605
   return reply +\"\\n\"+input_reply;\
3578
  }\
3606
  }\
3579
 }\
3607
 }\
3580
 else\
3608
 else\
3581
 {\
3609
 {\
3582
  if( typeof userdraw_text != 'undefined' ){\
3610
  if( typeof userdraw_text != 'undefined' ){\
3583
   return reply +\"\\n\"+userdraw_text;\
3611
   return reply +\"\\n\"+userdraw_text;\
3584
  }\
3612
  }\
3585
  else\
3613
  else\
3586
  {\
3614
  {\
3587
   return reply;\
3615
   return reply;\
3588
  }\
3616
  }\
3589
 };\
3617
 };\
3590
};\
3618
};\
3591
this.read_canvas = read_canvas;\n\
3619
this.read_canvas = read_canvas;\n\
3592
<!-- end function 10 read_canvas() -->");
3620
<!-- end function 10 read_canvas() -->");
3593
    break;
3621
    break;
3594
    case 11: fprintf(js_include_file,"\
3622
    case 11: fprintf(js_include_file,"\
3595
\n<!-- begin function 11 read_canvas() -->\n\
3623
\n<!-- begin function 11 read_canvas() -->\n\
3596
function read_canvas(){\
3624
function read_canvas(){\
3597
 var reply = \"\";\
3625
 var reply = \"\";\
3598
 var p = 0;\
3626
 var p = 0;\
3599
 while(userdraw_x[p]){\
3627
 while(userdraw_x[p]){\
3600
  reply = reply + px2x(userdraw_x[p]) +\",\" + px2y(userdraw_y[p]) +\",\" + px2x(userdraw_x[p+1]) +\",\" + px2y(userdraw_y[p+1]) +\"\\n\" ;\
3628
  reply = reply + px2x(userdraw_x[p]) +\",\" + px2y(userdraw_y[p]) +\",\" + px2x(userdraw_x[p+1]) +\",\" + px2y(userdraw_y[p+1]) +\"\\n\" ;\
3601
  p = p+2;\
3629
  p = p+2;\
3602
 };\
3630
 };\
3603
 if(p == 0){alert(\"nothing drawn...\");return;};\
3631
 if(p == 0){alert(\"nothing drawn...\");return;};\
Line 3613... Line 3641...
3613
    t++;\
3641
    t++;\
3614
   };\
3642
   };\
3615
  };\
3643
  };\
3616
  if( typeof userdraw_text != 'undefined' ){\
3644
  if( typeof userdraw_text != 'undefined' ){\
3617
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3645
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3618
  }\
3646
  }\
3619
  else\
3647
  else\
3620
  {\
3648
  {\
3621
   return reply +\"\\n\"+input_reply;\
3649
   return reply +\"\\n\"+input_reply;\
3622
  }\
3650
  }\
3623
 }\
3651
 }\
3624
 else\
3652
 else\
3625
 {\
3653
 {\
Line 3641... Line 3669...
3641
 var reply = \"\";\
3669
 var reply = \"\";\
3642
 var p = 0;\
3670
 var p = 0;\
3643
 for(p = 0; p< userdraw_x.lenght;p = p+2){\
3671
 for(p = 0; p< userdraw_x.lenght;p = p+2){\
3644
  if(userdraw_x[p] != null){\
3672
  if(userdraw_x[p] != null){\
3645
    reply = reply + userdraw_x[p] +\",\" + userdraw_y[p] +\",\" + userdraw_x[p+1] +\",\" + userdraw_y[p+1] +\"\\n\" ;\
3673
    reply = reply + userdraw_x[p] +\",\" + userdraw_y[p] +\",\" + userdraw_x[p+1] +\",\" + userdraw_y[p+1] +\"\\n\" ;\
3646
  };\
3674
  };\
3647
 };\
3675
 };\
3648
 if(p == 0){alert(\"nothing drawn...\");return;};\
3676
 if(p == 0){alert(\"nothing drawn...\");return;};\
3649
 if( document.getElementById(\"canvas_input0\") ){\
3677
 if( document.getElementById(\"canvas_input0\") ){\
3650
  var p = 0;var input_reply = new Array();\
3678
  var p = 0;var input_reply = new Array();\
3651
  if( document.getElementById(\"canvas_input0\")){\
3679
  if( document.getElementById(\"canvas_input0\")){\
3652
   var t = 0;\
3680
   var t = 0;\
3653
   while(document.getElementById(\"canvas_input\"+t)){\
3681
   while(document.getElementById(\"canvas_input\"+t)){\
3654
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3682
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3655
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3683
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3656
     p++;\
3684
     p++;\
3657
    };\
3685
    };\
3658
    t++;\
3686
    t++;\
3659
   };\
3687
   };\
3660
  };\
3688
  };\
3661
  if( typeof userdraw_text != 'undefined' ){\
3689
  if( typeof userdraw_text != 'undefined' ){\
3662
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3690
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3663
  }\
3691
  }\
3664
  else\
3692
  else\
3665
  {\
3693
  {\
3666
   return reply +\"\\n\"+input_reply;\
3694
   return reply +\"\\n\"+input_reply;\
3667
  }\
3695
  }\
3668
 }\
3696
 }\
3669
 else\
3697
 else\
3670
 {\
3698
 {\
3671
  if( typeof userdraw_text != 'undefined' ){\
3699
  if( typeof userdraw_text != 'undefined' ){\
3672
   return reply +\"\\n\"+userdraw_text\
3700
   return reply +\"\\n\"+userdraw_text\
3673
  }\
3701
  }\
3674
  else\
3702
  else\
3675
  {\
3703
  {\
3676
   return reply;\
3704
   return reply;\
3677
  }\
3705
  }\
3678
 };\
3706
 };\
Line 3700... Line 3728...
3700
     p++;\
3728
     p++;\
3701
    };\
3729
    };\
3702
    t++;\
3730
    t++;\
3703
   };\
3731
   };\
3704
  };\
3732
  };\
3705
  if( typeof userdraw_text != 'undefined' ){\
3733
  if( typeof userdraw_text != 'undefined' ){\
3706
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3734
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3707
  }\
3735
  }\
3708
  else\
3736
  else\
3709
  {\
3737
  {\
3710
   return reply +\"\\n\"+input_reply;\
3738
   return reply +\"\\n\"+input_reply;\
Line 3730... Line 3758...
3730
 var reply = new Array();\
3758
 var reply = new Array();\
3731
 var p = 0;var i = 0;\
3759
 var p = 0;var i = 0;\
3732
 while(userdraw_x[p]){\
3760
 while(userdraw_x[p]){\
3733
  reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\
3761
  reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\
3734
  p = p+2;i++;\
3762
  p = p+2;i++;\
3735
 };\
3763
 };\
3736
 if(p == 0){alert(\"nothing drawn...\");return;};\
3764
 if(p == 0){alert(\"nothing drawn...\");return;};\
3737
 if( document.getElementById(\"canvas_input0\") ){\
3765
 if( document.getElementById(\"canvas_input0\") ){\
3738
  var p = 0;var input_reply = new Array();\
3766
  var p = 0;var input_reply = new Array();\
3739
  if( document.getElementById(\"canvas_input0\")){\
3767
  if( document.getElementById(\"canvas_input0\")){\
3740
   var t = 0;\
3768
   var t = 0;\
3741
   while(document.getElementById(\"canvas_input\"+t)){\
3769
   while(document.getElementById(\"canvas_input\"+t)){\
3742
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3770
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
Line 3988... Line 4016...
3988
 }\
4016
 }\
3989
 else\
4017
 else\
3990
 {\
4018
 {\
3991
  if( typeof userdraw_text != 'undefined' ){\
4019
  if( typeof userdraw_text != 'undefined' ){\
3992
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
4020
   return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\
3993
  }\
4021
  }\
3994
  else\
4022
  else\
3995
  {\
4023
  {\
3996
   return reply_x+\"\\n\"+reply_y;\
4024
   return reply_x+\"\\n\"+reply_y;\
3997
  };\
4025
  };\
3998
 };\
4026
 };\
Line 6091... Line 6119...
6091
        *snaptogrid="snaptogrid",
6119
        *snaptogrid="snaptogrid",
6092
        *xsnaptogrid="xsnaptogrid",
6120
        *xsnaptogrid="xsnaptogrid",
6093
        *ysnaptogrid="ysnaptogrid",
6121
        *ysnaptogrid="ysnaptogrid",
6094
        *userinput_xy="userinput_xy",
6122
        *userinput_xy="userinput_xy",
6095
        *usertextarea_xy="usertextarea_xy",
6123
        *usertextarea_xy="usertextarea_xy",
-
 
6124
        *jsmath="jsmath",
-
 
6125
        *trace_jsmath="trace_jsmath",
6096
        *sgraph="sgraph";
6126
        *sgraph="sgraph";
6097
 
6127
 
6098
        while(((c = getc(infile)) != EOF)&&(c!='\n')&&(c!=',')&&(c!='=')&&(c!='\r')){
6128
        while(((c = getc(infile)) != EOF)&&(c!='\n')&&(c!=',')&&(c!='=')&&(c!='\r')){
6099
            if( i == 0 && (c == ' ' || c == '\t') ){
6129
            if( i == 0 && (c == ' ' || c == '\t') ){
6100
        continue; /* white spaces or tabs allowed before first command identifier */
6130
        continue; /* white spaces or tabs allowed before first command identifier */
Line 6723... Line 6753...
6723
        return USERTEXTAREA_XY;
6753
        return USERTEXTAREA_XY;
6724
        }
6754
        }
6725
        if( strcmp(input_type, sgraph) == 0 ){
6755
        if( strcmp(input_type, sgraph) == 0 ){
6726
        free(input_type);
6756
        free(input_type);
6727
        return SGRAPH;
6757
        return SGRAPH;
-
 
6758
        }
-
 
6759
        if( strcmp(input_type, jsmath) == 0 ){
-
 
6760
        free(input_type);
-
 
6761
        return JSMATH;
-
 
6762
        }
-
 
6763
        if( strcmp(input_type, trace_jsmath) == 0 ){
-
 
6764
        free(input_type);
-
 
6765
        return TRACE_JSMATH;
6728
        }
6766
        }
6729
        free(input_type);
6767
        free(input_type);
6730
        ungetc(c,infile);
6768
        ungetc(c,infile);
6731
        return 0;
6769
        return 0;
6732
}
6770
}