Subversion Repositories wimsdev

Rev

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

Rev 7786 Rev 7788
Line 1226... Line 1226...
1226
         @will animate a point on the next plot/curve command
1226
         @will animate a point on the next plot/curve command
1227
         @the curve will not be draw
1227
         @the curve will not be draw
1228
         @moves repeatedly from xmin to xmax
1228
         @moves repeatedly from xmin to xmax
1229
        */
1229
        */
1230
            if( strstr(get_string(infile,1),"point") != 0 ){animation_type = 15;}else{canvas_error("the only animation type (for now) is \"point\"...");}
1230
            if( strstr(get_string(infile,1),"point") != 0 ){animation_type = 15;}else{canvas_error("the only animation type (for now) is \"point\"...");}
-
 
1231
            break;
-
 
1232
        case LEVELCURVE:
-
 
1233
        /*
-
 
1234
        @levelcurve color,expression in x/y,l1,l2,...
-
 
1235
        @Draws (pixel) level curves for expression, with levels l1, l2,...
-
 
1236
        @Take care : the arrays for holding the javascript data are limited in size !!
-
 
1237
        */
-
 
1238
            stroke_color = get_color(infile,0);
-
 
1239
            char *fun1 = get_string_argument(infile,0);
-
 
1240
            if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");}
-
 
1241
            i = 0;
-
 
1242
            done = FALSE;
-
 
1243
            while( !done ){
-
 
1244
             double_data[i] = get_real(infile,1);
-
 
1245
             i++;
-
 
1246
            }
-
 
1247
            for(c = 0 ; c < i; c++){
-
 
1248
             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);
-
 
1249
             click_cnt++;
-
 
1250
            }
-
 
1251
            reset();
1231
            break;
1252
            break;
1232
        case CURVE:
1253
        case CURVE:
1233
        /*
1254
        /*
1234
         @curve color,formula(x)
1255
         @curve color,formula(x)
1235
         @plot color,formula(x)
1256
         @plot color,formula(x)
Line 1242... Line 1263...
1242
                use_parametric = FALSE;
1263
                use_parametric = FALSE;
1243
                stroke_color = get_color(infile,0);
1264
                stroke_color = get_color(infile,0);
1244
                char *fun1 = get_string_argument(infile,0);
1265
                char *fun1 = get_string_argument(infile,0);
1245
                char *fun2 = get_string_argument(infile,1);
1266
                char *fun2 = get_string_argument(infile,1);
1246
                if( strlen(fun1) == 0 || strlen(fun2) == 0 ){canvas_error("parametric functions are NOT OK !");}
1267
                if( strlen(fun1) == 0 || strlen(fun2) == 0 ){canvas_error("parametric functions are NOT OK !");}
1247
                use_parametric = FALSE;
-
 
1248
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,%d,%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,animation_type,eval_parametric(xsize,ysize,fun1,fun2,xmin,xmax,ymin,ymax,tmin,tmax,plot_steps,precision),2*line_width,2*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);
1268
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,%d,%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,animation_type,eval_parametric(xsize,ysize,fun1,fun2,xmin,xmax,ymin,ymax,tmin,tmax,plot_steps,precision),2*line_width,2*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);
1249
                click_cnt++;
1269
                click_cnt++;
1250
            }
1270
            }
1251
            else
1271
            else
1252
            {
1272
            {
Line 1254... Line 1274...
1254
                char *fun1 = get_string_argument(infile,1);
1274
                char *fun1 = get_string_argument(infile,1);
1255
                if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");} 
1275
                if( strlen(fun1) == 0 ){canvas_error("function is NOT OK !");} 
1256
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,%d,%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,animation_type,eval(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision),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);
1276
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,%d,%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,animation_type,eval(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision),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);
1257
                click_cnt++;
1277
                click_cnt++;
1258
            }
1278
            }
1259
            animation_type = 9;/* rest to curve plotting without animation */
1279
            animation_type = 9;/* reset to curve plotting without animation */
1260
            reset();
1280
            reset();
1261
            break;
1281
            break;
1262
        case FLY_TEXT:
1282
        case FLY_TEXT:
1263
        /*
1283
        /*
1264
        @ text fontcolor,x,y,font,text_string
1284
        @ text fontcolor,x,y,font,text_string
Line 3106... Line 3126...
3106
answers may have:
3126
answers may have:
3107
x-values,y-values,r-values,input-fields,mathml-inputfields,text-typed answers
3127
x-values,y-values,r-values,input-fields,mathml-inputfields,text-typed answers
3108
*/
3128
*/
3109
    case 1: fprintf(js_include_file,"\
3129
    case 1: fprintf(js_include_file,"\
3110
\n<!-- begin function 1 read_canvas() -->\n\
3130
\n<!-- begin function 1 read_canvas() -->\n\
3111
function read_canvas(){\
3131
function read_canvas(){\
3112
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3132
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3113
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3133
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3114
  var p = 0;var input_reply = new Array();\
3134
  var p = 0;var input_reply = new Array();\
3115
  if( document.getElementById(\"canvas_input0\")){\
3135
  if( document.getElementById(\"canvas_input0\")){\
3116
   var t = 0;\
3136
   var t = 0;\
3117
   while(document.getElementById(\"canvas_input\"+t)){\
3137
   while(document.getElementById(\"canvas_input\"+t)){\
3118
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3138
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3119
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3139
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3120
     p++;\
3140
     p++;\
3121
    };\
3141
    };\
3122
    t++;\
3142
    t++;\
3123
   };\
3143
   };\
3124
  };\
3144
  };\
3125
  if( typeof userdraw_text != 'undefined' ){\
3145
  if( typeof userdraw_text != 'undefined' ){\
3126
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply + \"\\n\"+userdraw_text;\
3146
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply + \"\\n\"+userdraw_text;\
3127
  }\
3147
  }\
3128
  else\
3148
  else\
3129
  {\
3149
  {\
3130
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply;\
3150
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply;\
3131
  }\
3151
  }\
3132
 }\
3152
 }\
3133
 else\
3153
 else\
3134
 {\
3154
 {\
3135
  if( typeof userdraw_text != 'undefined' ){\
3155
  if( typeof userdraw_text != 'undefined' ){\
3136
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_text;\
3156
   return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_text;\
3137
  }\
3157
  }\
3138
  else\
3158
  else\
3139
  {\
3159
  {\
3140
   return userdraw_x+\"\\n\"+userdraw_y;\
3160
   return userdraw_x+\"\\n\"+userdraw_y;\
3141
  }\
3161
  }\
3142
 };\
3162
 };\
3143
};\
3163
};\
3144
this.read_canvas = read_canvas;\n\
3164
this.read_canvas = read_canvas;\n\
3145
<!-- end function 1 read_canvas() -->");
3165
<!-- end function 1 read_canvas() -->");
3146
    break;
3166
    break;
3147
    case 2: fprintf(js_include_file,"\
3167
    case 2: fprintf(js_include_file,"\
3148
\n<!-- begin function 2 read_canvas() -->\n\
3168
\n<!-- begin function 2 read_canvas() -->\n\
3149
function read_canvas(){\
3169
function read_canvas(){\
Line 3167... Line 3187...
3167
    t++;\
3187
    t++;\
3168
   };\
3188
   };\
3169
  };\
3189
  };\
3170
  if( typeof userdraw_text != 'undefined' ){\
3190
  if( typeof userdraw_text != 'undefined' ){\
3171
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3191
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3172
  }\
3192
  }\
3173
  else\
3193
  else\
3174
  {\
3194
  {\
3175
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\
3195
   return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\
3176
  }\
3196
  }\
3177
 }\
3197
 }\
3178
 else\
3198
 else\
3179
 {\
3199
 {\
Line 3191... Line 3211...
3191
    break;
3211
    break;
3192
    case 3: fprintf(js_include_file,"\
3212
    case 3: fprintf(js_include_file,"\
3193
\n<!-- begin function 3 read_canvas() -->\n\
3213
\n<!-- begin function 3 read_canvas() -->\n\
3194
function read_canvas(){\
3214
function read_canvas(){\
3195
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3215
 if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\
3196
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3216
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3197
  var p = 0;var input_reply = new Array();\
3217
  var p = 0;var input_reply = new Array();\
3198
  if( document.getElementById(\"canvas_input0\")){\
3218
  if( document.getElementById(\"canvas_input0\")){\
3199
   var t = 0;\
3219
   var t = 0;\
3200
   while(document.getElementById(\"canvas_input\"+t)){\
3220
   while(document.getElementById(\"canvas_input\"+t)){\
3201
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3221
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3202
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3222
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3203
     p++;\
3223
     p++;\
3204
    };\
3224
    };\
3205
    t++;\
3225
    t++;\
3206
   };\
3226
   };\
3207
  };\
3227
  };\
3208
  if( typeof userdraw_text != 'undefined' ){\
3228
  if( typeof userdraw_text != 'undefined' ){\
Line 3275... Line 3295...
3275
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3295
        attention: we reset userdraw_x / userdraw_y  : because  userdraw_x = [][] userdraw_y = [][]
3276
        used for userdraw multiple paths
3296
        used for userdraw multiple paths
3277
    */
3297
    */
3278
    case 5: fprintf(js_include_file,"\
3298
    case 5: fprintf(js_include_file,"\
3279
\n<!-- begin function 5 read_canvas() -->\n\
3299
\n<!-- begin function 5 read_canvas() -->\n\
3280
function read_canvas(){\
3300
function read_canvas(){\
3281
 var p = 0;\
3301
 var p = 0;\
3282
 var reply = \"\";\
3302
 var reply = \"\";\
3283
 for(p = 0; p < userdraw_x.length;p++){\
3303
 for(p = 0; p < userdraw_x.length;p++){\
3284
  if(userdraw_x[p] != null ){\
3304
  if(userdraw_x[p] != null ){\
3285
   reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\
3305
   reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\
3286
  };\
3306
  };\
3287
 };\
3307
 };\
3288
 if(p == 0){alert(\"nothing drawn...\");return;};\
3308
 if(p == 0){alert(\"nothing drawn...\");return;};\
3289
 userdraw_x = [];userdraw_y = [];\
3309
 userdraw_x = [];userdraw_y = [];\
3290
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3310
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3291
  var p = 0;var input_reply = new Array();\
3311
  var p = 0;var input_reply = new Array();\
3292
  if( document.getElementById(\"canvas_input0\")){\
3312
  if( document.getElementById(\"canvas_input0\")){\
3293
   var t = 0;\
3313
   var t = 0;\
3294
   while(document.getElementById(\"canvas_input\"+t)){\
3314
   while(document.getElementById(\"canvas_input\"+t)){\
3295
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3315
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3296
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3316
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3297
     p++;\
3317
     p++;\
3298
    };\
3318
    };\
3299
    t++;\
3319
    t++;\
3300
   };\
3320
   };\
3301
  };\
3321
  };\
3302
  if( typeof userdraw_text != 'undefined' ){\
3322
  if( typeof userdraw_text != 'undefined' ){\
3303
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3323
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3304
  }\
3324
  }\
3305
  else\
3325
  else\
3306
  {\
3326
  {\
3307
   return reply +\"\\n\"+input_reply;\
3327
   return reply +\"\\n\"+input_reply;\
3308
  }\
3328
  }\
3309
 }\
3329
 }\
3310
 else\
3330
 else\
Line 3343... Line 3363...
3343
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3363
   reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\
3344
  };\
3364
  };\
3345
 };\
3365
 };\
3346
 if(p == 0){alert(\"nothing drawn...\");return;};\
3366
 if(p == 0){alert(\"nothing drawn...\");return;};\
3347
 userdraw_x = [];userdraw_y = [];\
3367
 userdraw_x = [];userdraw_y = [];\
3348
 if( document.getElementById(\"canvas_input0\") ){\
3368
 if( document.getElementById(\"canvas_input0\") ){\
3349
  var p = 0;var input_reply = new Array();\
3369
  var p = 0;var input_reply = new Array();\
3350
  if( document.getElementById(\"canvas_input0\")){\
3370
  if( document.getElementById(\"canvas_input0\")){\
3351
   var t = 0;\
3371
   var t = 0;\
3352
   while(document.getElementById(\"canvas_input\"+t)){\
3372
   while(document.getElementById(\"canvas_input\"+t)){\
3353
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3373
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3354
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3374
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3355
     p++;\
3375
     p++;\
3356
    };\
3376
    };\
3357
    t++;\
3377
    t++;\
3358
   };\
3378
   };\
3359
  };\
3379
  };\
3360
  if( typeof userdraw_text != 'undefined' ){\
3380
  if( typeof userdraw_text != 'undefined' ){\
3361
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3381
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3362
  }\
3382
  }\
3363
  else\
3383
  else\
3364
  {\
3384
  {\
3365
   return reply +\"\\n\"+input_reply;\
3385
   return reply +\"\\n\"+input_reply;\
3366
  }\
3386
  }\
Line 3376... Line 3396...
3376
  }\
3396
  }\
3377
 };\
3397
 };\
3378
};\
3398
};\
3379
this.read_canvas = read_canvas;\n\
3399
this.read_canvas = read_canvas;\n\
3380
<!-- end function 6 read_canvas() -->");
3400
<!-- end function 6 read_canvas() -->");
3381
    break;
3401
    break;
3382
    case 7: fprintf(js_include_file,"\
3402
    case 7: fprintf(js_include_file,"\
3383
\n<!-- begin function 7 read_canvas() -->\n\
3403
\n<!-- begin function 7 read_canvas() -->\n\
3384
function read_canvas(){\
3404
function read_canvas(){\
3385
 var reply = new Array();\
3405
 var reply = new Array();\
3386
 var p = 0;\
3406
 var p = 0;\
Line 3405... Line 3425...
3405
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3425
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3406
  }\
3426
  }\
3407
  else\
3427
  else\
3408
  {\
3428
  {\
3409
   return reply+\"\\n\"+input_reply;\
3429
   return reply+\"\\n\"+input_reply;\
3410
  }\
3430
  }\
3411
 };\
3431
 };\
3412
 else\
3432
 else\
3413
 {\
3433
 {\
3414
  if( typeof userdraw_text != 'undefined' ){\
3434
  if( typeof userdraw_text != 'undefined' ){\
3415
   return reply+\"\\n\"+userdraw_text;\
3435
   return reply+\"\\n\"+userdraw_text;\
Line 3428... Line 3448...
3428
function read_canvas(){\
3448
function read_canvas(){\
3429
 var reply = new Array();\
3449
 var reply = new Array();\
3430
 var p = 0;\
3450
 var p = 0;\
3431
 while(userdraw_x[p]){\
3451
 while(userdraw_x[p]){\
3432
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]);\
3452
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]);\
3433
  p++;\
3453
  p++;\
3434
 };\
3454
 };\
3435
 if(p == 0){alert(\"nothing drawn...\");return;};\
3455
 if(p == 0){alert(\"nothing drawn...\");return;};\
3436
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3456
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3437
  var p = 0;var input_reply = new Array();\
3457
  var p = 0;var input_reply = new Array();\
3438
  if( document.getElementById(\"canvas_input0\")){\
3458
  if( document.getElementById(\"canvas_input0\")){\
3439
   var t = 0;\
3459
   var t = 0;\
3440
   while(document.getElementById(\"canvas_input\"+t)){\
3460
   while(document.getElementById(\"canvas_input\"+t)){\
3441
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3461
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3442
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3462
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3443
     p++;\
3463
     p++;\
3444
    };\
3464
    };\
3445
    t++;\
3465
    t++;\
3446
   };\
3466
   };\
3447
  };\
3467
  };\
3448
  if( typeof userdraw_text != 'undefined' ){\
3468
  if( typeof userdraw_text != 'undefined' ){\
3449
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3469
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3450
  }\
3470
  }\
3451
  else\
3471
  else\
3452
  {\
3472
  {\
3453
   return reply +\"\\n\"+input_reply;\
3473
   return reply +\"\\n\"+input_reply;\
3454
  }\
3474
  }\
3455
 }\
3475
 }\
3456
 else\
3476
 else\
3457
 {\
3477
 {\
3458
  if( typeof userdraw_text != 'undefined' ){\
3478
  if( typeof userdraw_text != 'undefined' ){\
3459
   return reply +\"\\n\"+userdraw_text;\
3479
   return reply +\"\\n\"+userdraw_text;\
3460
  }\
3480
  }\
3461
  else\
3481
  else\
3462
  {\
3482
  {\
3463
   return reply;\
3483
   return reply;\
3464
  }\
3484
  }\
3465
 };\
3485
 };\
3466
};\
3486
};\
3467
this.read_canvas = read_canvas;\n\
3487
this.read_canvas = read_canvas;\n\
3468
<!-- end function 8 read_canvas() -->");
3488
<!-- end function 8 read_canvas() -->");
3469
    break;
3489
    break;
3470
    case 9: fprintf(js_include_file,"\
3490
    case 9: fprintf(js_include_file,"\
3471
\n<!-- begin function 9 read_canvas() -->\n\
3491
\n<!-- begin function 9 read_canvas() -->\n\
3472
function read_canvas(){\
3492
function read_canvas(){\
3473
 var reply = new Array();\
3493
 var reply = new Array();\
3474
 var p = 0;\
3494
 var p = 0;\
Line 3511... Line 3531...
3511
this.read_canvas = read_canvas;\n\
3531
this.read_canvas = read_canvas;\n\
3512
<!-- end function 9 read_canvas() -->");
3532
<!-- end function 9 read_canvas() -->");
3513
    break;
3533
    break;
3514
    case 10: fprintf(js_include_file,"\
3534
    case 10: fprintf(js_include_file,"\
3515
\n<!-- begin function 10 read_canvas() -->\n\
3535
\n<!-- begin function 10 read_canvas() -->\n\
3516
function read_canvas(){\
3536
function read_canvas(){\
3517
 var reply = new Array();\
3537
 var reply = new Array();\
3518
 var p = 0;\
3538
 var p = 0;\
3519
 while(userdraw_x[p]){\
3539
 while(userdraw_x[p]){\
3520
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + userdraw_radius[p];\
3540
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + userdraw_radius[p];\
3521
  p++;\
3541
  p++;\
3522
 };\
3542
 };\
3523
 if(p == 0){alert(\"nothing drawn...\");return;};\
3543
 if(p == 0){alert(\"nothing drawn...\");return;};\
3524
 if( document.getElementById(\"canvas_input0\") ){\
3544
 if( document.getElementById(\"canvas_input0\") ){\
3525
  var p = 0;var input_reply = new Array();\
-
 
3526
  if( document.getElementById(\"canvas_input0\")){\
-
 
3527
   var t = 0;\
-
 
3528
   while(document.getElementById(\"canvas_input\"+t)){\
-
 
3529
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
-
 
3530
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
-
 
3531
     p++;\
-
 
3532
    };\
-
 
3533
    t++;\
-
 
3534
   };\
-
 
3535
  };\
-
 
3536
  if( typeof userdraw_text != 'undefined' ){\
-
 
3537
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
-
 
3538
  }\
-
 
3539
  else\
-
 
3540
  {\
-
 
3541
   return reply +\"\\n\"+input_reply;\
-
 
3542
  }\
-
 
3543
 }\
-
 
3544
 else\
-
 
3545
 {\
-
 
3546
  if( typeof userdraw_text != 'undefined' ){\
-
 
3547
   return reply +\"\\n\"+userdraw_text;\
-
 
3548
  }\
-
 
3549
  else\
-
 
3550
  {\
-
 
3551
   return reply;\
-
 
3552
  }\
-
 
3553
 };\
-
 
3554
};\
-
 
3555
this.read_canvas = read_canvas;\n\
-
 
3556
<!-- end function 10 read_canvas() -->");
-
 
3557
    break;
-
 
3558
    case 11: fprintf(js_include_file,"\
-
 
3559
\n<!-- begin function 11 read_canvas() -->\n\
-
 
3560
function read_canvas(){\
-
 
3561
 var reply = \"\";\
-
 
3562
 var p = 0;\
-
 
3563
 while(userdraw_x[p]){\
-
 
3564
  reply = reply + px2x(userdraw_x[p]) +\",\" + px2y(userdraw_y[p]) +\",\" + px2x(userdraw_x[p+1]) +\",\" + px2y(userdraw_y[p+1]) +\"\\n\" ;\
-
 
3565
  p = p+2;\
-
 
3566
 };\
-
 
3567
 if(p == 0){alert(\"nothing drawn...\");return;};\
-
 
3568
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
-
 
3569
  var p = 0;var input_reply = new Array();\
3545
  var p = 0;var input_reply = new Array();\
3570
  if( document.getElementById(\"canvas_input0\")){\
3546
  if( document.getElementById(\"canvas_input0\")){\
3571
   var t = 0;\
3547
   var t = 0;\
3572
   while(document.getElementById(\"canvas_input\"+t)){\
3548
   while(document.getElementById(\"canvas_input\"+t)){\
3573
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3549
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
Line 3581... Line 3557...
3581
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3557
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3582
  }\
3558
  }\
3583
  else\
3559
  else\
3584
  {\
3560
  {\
3585
   return reply +\"\\n\"+input_reply;\
3561
   return reply +\"\\n\"+input_reply;\
-
 
3562
  }\
-
 
3563
 }\
-
 
3564
 else\
-
 
3565
 {\
-
 
3566
  if( typeof userdraw_text != 'undefined' ){\
-
 
3567
   return reply +\"\\n\"+userdraw_text;\
-
 
3568
  }\
-
 
3569
  else\
-
 
3570
  {\
-
 
3571
   return reply;\
-
 
3572
  }\
-
 
3573
 };\
-
 
3574
};\
-
 
3575
this.read_canvas = read_canvas;\n\
-
 
3576
<!-- end function 10 read_canvas() -->");
-
 
3577
    break;
-
 
3578
    case 11: fprintf(js_include_file,"\
-
 
3579
\n<!-- begin function 11 read_canvas() -->\n\
-
 
3580
function read_canvas(){\
-
 
3581
 var reply = \"\";\
-
 
3582
 var p = 0;\
-
 
3583
 while(userdraw_x[p]){\
-
 
3584
  reply = reply + px2x(userdraw_x[p]) +\",\" + px2y(userdraw_y[p]) +\",\" + px2x(userdraw_x[p+1]) +\",\" + px2y(userdraw_y[p+1]) +\"\\n\" ;\
-
 
3585
  p = p+2;\
-
 
3586
 };\
-
 
3587
 if(p == 0){alert(\"nothing drawn...\");return;};\
-
 
3588
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
-
 
3589
  var p = 0;var input_reply = new Array();\
-
 
3590
  if( document.getElementById(\"canvas_input0\")){\
-
 
3591
   var t = 0;\
-
 
3592
   while(document.getElementById(\"canvas_input\"+t)){\
-
 
3593
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
-
 
3594
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
-
 
3595
     p++;\
-
 
3596
    };\
-
 
3597
    t++;\
-
 
3598
   };\
-
 
3599
  };\
-
 
3600
  if( typeof userdraw_text != 'undefined' ){\
-
 
3601
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
-
 
3602
  }\
-
 
3603
  else\
-
 
3604
  {\
-
 
3605
   return reply +\"\\n\"+input_reply;\
3586
  }\
3606
  }\
3587
 }\
3607
 }\
3588
 else\
3608
 else\
3589
 {\
3609
 {\
3590
  if( typeof userdraw_text != 'undefined' ){\
3610
  if( typeof userdraw_text != 'undefined' ){\
3591
   return reply +\"\\n\"+userdraw_text;\
3611
   return reply +\"\\n\"+userdraw_text;\
Line 3622... Line 3642...
3622
    t++;\
3642
    t++;\
3623
   };\
3643
   };\
3624
  };\
3644
  };\
3625
  if( typeof userdraw_text != 'undefined' ){\
3645
  if( typeof userdraw_text != 'undefined' ){\
3626
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3646
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3627
  }\
3647
  }\
3628
  else\
3648
  else\
3629
  {\
3649
  {\
3630
   return reply +\"\\n\"+input_reply;\
3650
   return reply +\"\\n\"+input_reply;\
3631
  }\
3651
  }\
3632
 }\
3652
 }\
3633
 else\
3653
 else\
3634
 {\
3654
 {\
3635
  if( typeof userdraw_text != 'undefined' ){\
3655
  if( typeof userdraw_text != 'undefined' ){\
3636
   return reply +\"\\n\"+userdraw_text\
3656
   return reply +\"\\n\"+userdraw_text\
3637
  }\
3657
  }\
3638
  else\
3658
  else\
3639
  {\
3659
  {\
3640
   return reply;\
3660
   return reply;\
3641
  }\
3661
  }\
3642
 };\
3662
 };\
Line 3649... Line 3669...
3649
function read_canvas(){\
3669
function read_canvas(){\
3650
 var reply = new Array();\
3670
 var reply = new Array();\
3651
 var p = 0;var i = 0;\
3671
 var p = 0;var i = 0;\
3652
 while(userdraw_x[p]){\
3672
 while(userdraw_x[p]){\
3653
  reply[i] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + px2x(userdraw_x[p+1]) +\":\" + px2y(userdraw_y[p+1]);\
3673
  reply[i] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + px2x(userdraw_x[p+1]) +\":\" + px2y(userdraw_y[p+1]);\
3654
  p = p+2;i++;\
3674
  p = p+2;i++;\
3655
 };\
3675
 };\
3656
 if(p == 0){alert(\"nothing drawn...\");return;};\
3676
 if(p == 0){alert(\"nothing drawn...\");return;};\
3657
 if( document.getElementById(\"canvas_input0\") ){\
3677
 if( document.getElementById(\"canvas_input0\") ){\
3658
  var p = 0;var input_reply = new Array();\
3678
  var p = 0;var input_reply = new Array();\
3659
  if( document.getElementById(\"canvas_input0\")){\
3679
  if( document.getElementById(\"canvas_input0\")){\
3660
   var t = 0;\
3680
   var t = 0;\
3661
   while(document.getElementById(\"canvas_input\"+t)){\
3681
   while(document.getElementById(\"canvas_input\"+t)){\
3662
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3682
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3663
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3683
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3664
     p++;\
3684
     p++;\
3665
    };\
3685
    };\
3666
    t++;\
3686
    t++;\
3667
   };\
3687
   };\
3668
  };\
3688
  };\
3669
  if( typeof userdraw_text != 'undefined' ){\
3689
  if( typeof userdraw_text != 'undefined' ){\
3670
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3690
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3671
  }\
3691
  }\
3672
  else\
3692
  else\
3673
  {\
3693
  {\
3674
   return reply +\"\\n\"+input_reply;\
3694
   return reply +\"\\n\"+input_reply;\
3675
  }\
3695
  }\
3676
 }\
3696
 }\
3677
 else\
3697
 else\
3678
 {\
3698
 {\
3679
  if( typeof userdraw_text != 'undefined' ){\
3699
  if( typeof userdraw_text != 'undefined' ){\
3680
   return reply +\"\\n\"+userdraw_text\
3700
   return reply +\"\\n\"+userdraw_text\
3681
  }\
3701
  }\
3682
  else\
3702
  else\
3683
  {\
3703
  {\
3684
   return reply;\
3704
   return reply;\
3685
  }\
3705
  }\
3686
 };\
3706
 };\
3687
};\
3707
};\
3688
this.read_canvas = read_canvas;\n\
3708
this.read_canvas = read_canvas;\n\
3689
<!-- end function 13 read_canvas() -->");
3709
<!-- end function 13 read_canvas() -->");
3690
    break;
3710
    break;
3691
    case 14: fprintf(js_include_file,"\
3711
    case 14: fprintf(js_include_file,"\
Line 3710... Line 3730...
3710
    t++;\
3730
    t++;\
3711
   };\
3731
   };\
3712
  };\
3732
  };\
3713
  if( typeof userdraw_text != 'undefined' ){\
3733
  if( typeof userdraw_text != 'undefined' ){\
3714
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3734
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3715
  }\
3735
  }\
3716
  else\
3736
  else\
3717
  {\
3737
  {\
3718
   return reply +\"\\n\"+input_reply;\
3738
   return reply +\"\\n\"+input_reply;\
3719
  }\
3739
  }\
3720
 }\
3740
 }\
3721
 else\
3741
 else\
3722
 {\
3742
 {\
3723
  if( typeof userdraw_text != 'undefined' ){\
3743
  if( typeof userdraw_text != 'undefined' ){\
3724
   return reply +\"\\n\"+userdraw_text;\
3744
   return reply +\"\\n\"+userdraw_text;\
3725
  }\
3745
  }\
3726
  else\
3746
  else\
3727
  {\
3747
  {\
3728
   return reply;\
3748
   return reply;\
3729
  }\
3749
  }\
3730
 };\
3750
 };\
Line 3747... Line 3767...
3747
   t++;\
3767
   t++;\
3748
  };\
3768
  };\
3749
 };\
3769
 };\
3750
 if( typeof userdraw_text != 'undefined' ){\
3770
 if( typeof userdraw_text != 'undefined' ){\
3751
   return input_reply +\"\\n\"+userdraw_text;\
3771
   return input_reply +\"\\n\"+userdraw_text;\
3752
 }\
3772
 }\
3753
 else\
3773
 else\
3754
 {\
3774
 {\
3755
  return input_reply;\
3775
  return input_reply;\
3756
 };\
3776
 };\
3757
};\
3777
};\
3758
 this.read_canvas = read_canvas;\n\
3778
 this.read_canvas = read_canvas;\n\
3759
<!-- end function 15 read_canvas() -->");
3779
<!-- end function 15 read_canvas() -->");
Line 3900... Line 3920...
3900
 }\
3920
 }\
3901
 else\
3921
 else\
3902
 {\
3922
 {\
3903
  if( typeof userdraw_text != 'undefined' ){\
3923
  if( typeof userdraw_text != 'undefined' ){\
3904
   return reply +\"\\n\"+userdraw_text;\
3924
   return reply +\"\\n\"+userdraw_text;\
3905
  }\
3925
  }\
3906
  else\
3926
  else\
3907
  {\
3927
  {\
3908
   return reply;\
3928
   return reply;\
3909
  }\
3929
  }\
3910
 };\
3930
 };\
3911
};\
3931
};\
3912
this.read_canvas = read_canvas;\n\
3932
this.read_canvas = read_canvas;\n\
3913
<!-- end function 22 read_canvas() -->");
3933
<!-- end function 22 read_canvas() -->");
3914
    break;
3934
    break;
Line 4212... Line 4232...
4212
    break;
4232
    break;
4213
 
4233
 
4214
    case DRAW_DIAMONDFILL:/* not used for userdraw */
4234
    case DRAW_DIAMONDFILL:/* not used for userdraw */
4215
fprintf(js_include_file,"\n<!-- draw hatch fill -->\n\
4235
fprintf(js_include_file,"\n<!-- draw hatch fill -->\n\
4216
draw_diamondfill = function(canvas_type,x0,y0,dx,dy,linewidth,stroke_color,stroke_opacity,xsize,ysize){\
4236
draw_diamondfill = function(canvas_type,x0,y0,dx,dy,linewidth,stroke_color,stroke_opacity,xsize,ysize){\
4217
  var obj;\
4237
  var obj;\
4218
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4238
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\
4219
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4239
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
4220
 }\
4240
 }\
4221
 else\
4241
 else\
4222
 {\
4242
 {\
4223
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4243
  obj = create_canvas%d(canvas_type,xsize,ysize);\
4224
 };\
4244
 };\
4225
 var ctx = obj.getContext(\"2d\");\
4245
 var ctx = obj.getContext(\"2d\");\
4226
 var x;\
4246
 var x;\
4227
 var y;\
4247
 var y;\
4228
 ctx.save();\
4248
 ctx.save();\
4229
 ctx.lineWidth = linewidth;\
4249
 ctx.lineWidth = linewidth;\
4230
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4250
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4231
 y = ysize;\
4251
 y = ysize;\
4232
 for( x = x0 ; x < xsize ; x = x + dx ){\
4252
 for( x = x0 ; x < xsize ; x = x + dx ){\
4233
  ctx.moveTo(x,y0);\
4253
  ctx.moveTo(x,y0);\
4234
  ctx.lineTo(xsize,y);\
4254
  ctx.lineTo(xsize,y);\
4235
  y = y - dy;\
4255
  y = y - dy;\
4236
 };\
4256
 };\
4237
 y = y0;\
4257
 y = y0;\
4238
 for( x = xsize ; x > 0 ; x = x - dx){\
4258
 for( x = xsize ; x > 0 ; x = x - dx){\
Line 4278... Line 4298...
4278
 y = ysize;\
4298
 y = ysize;\
4279
 for( x = x0 ; x < xsize ; x = x + dx ){\
4299
 for( x = x0 ; x < xsize ; x = x + dx ){\
4280
  ctx.moveTo(x,y0);\
4300
  ctx.moveTo(x,y0);\
4281
  ctx.lineTo(xsize,y);\
4301
  ctx.lineTo(xsize,y);\
4282
  y = y - dy;\
4302
  y = y - dy;\
4283
 };\
4303
 };\
4284
 y = y0;\
4304
 y = y0;\
4285
 for( x = xsize ; x >= dx ; x = x - dx){\
4305
 for( x = xsize ; x >= dx ; x = x - dx){\
4286
  ctx.moveTo(x,ysize);\
4306
  ctx.moveTo(x,ysize);\
4287
  ctx.lineTo(x0,y);\
4307
  ctx.lineTo(x0,y);\
4288
  y = y + dy;\
4308
  y = y + dy;\
Line 4293... Line 4313...
4293
 };",canvas_root_id,canvas_root_id,canvas_root_id);
4313
 };",canvas_root_id,canvas_root_id,canvas_root_id);
4294
    break;
4314
    break;
4295
    case DRAW_CIRCLES:/*  used for userdraw */
4315
    case DRAW_CIRCLES:/*  used for userdraw */
4296
fprintf(js_include_file,"\n<!-- draw circles -->\n\
4316
fprintf(js_include_file,"\n<!-- draw circles -->\n\
4297
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_translate,vector){\
4317
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_translate,vector){\
4298
 ctx.save();\
4318
 ctx.save();\
4299
 if(use_translate == 1 ){ctx.translate(vector[0],vector[1]);}\
4319
 if(use_translate == 1 ){ctx.translate(vector[0],vector[1]);}\
4300
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4320
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4301
 ctx.lineWidth = line_width;\
4321
 ctx.lineWidth = line_width;\
4302
 for(var p = 0 ; p < x_points.length ; p++ ){\
4322
 for(var p = 0 ; p < x_points.length ; p++ ){\
4303
  ctx.beginPath();\
4323
  ctx.beginPath();\
4304
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4324
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4305
  ctx.closePath();\
4325
  ctx.closePath();\
4306
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4326
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4307
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4327
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4308
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4328
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4309
  ctx.stroke();\
4329
  ctx.stroke();\
4310
 }\
4330
 }\
4311
 ctx.restore();\
4331
 ctx.restore();\
4312
 return;\
4332
 return;\
4313
};");
4333
};");
4314
    break;
4334
    break;
4315
    case DRAW_POLYLINE:/* user for userdraw : draw lines through points */
4335
    case DRAW_POLYLINE:/* user for userdraw : draw lines through points */
4316
fprintf(js_include_file,"\n<!-- draw polyline -->\n\
4336
fprintf(js_include_file,"\n<!-- draw polyline -->\n\
4317
draw_polyline = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_translate,vector){\
4337
draw_polyline = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_translate,vector){\
4318
 ctx.save();\
4338
 ctx.save();\
4319
 if(use_translate == 1 ){ctx.translate(vector[0],vector[1]);}\
4339
 if(use_translate == 1 ){ctx.translate(vector[0],vector[1]);}\
4320
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4340
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4321
 ctx.lineWidth = line_width;\
4341
 ctx.lineWidth = line_width;\
4322
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4342
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4323
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4343
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4324
 ctx.clearRect(0,0,xsize,ysize);\
4344
 ctx.clearRect(0,0,xsize,ysize);\
4325
 ctx.beginPath();\
4345
 ctx.beginPath();\
4326
 for(var p = 0 ; p < x_points.length-1 ; p++ ){\
4346
 for(var p = 0 ; p < x_points.length-1 ; p++ ){\
4327
  ctx.moveTo(x_points[p],y_points[p]);\
4347
  ctx.moveTo(x_points[p],y_points[p]);\
Line 4336... Line 4356...
4336
  ctx.closePath();ctx.fill();ctx.stroke();\
4356
  ctx.closePath();ctx.fill();ctx.stroke();\
4337
 };\
4357
 };\
4338
 ctx.restore();\
4358
 ctx.restore();\
4339
 return;\
4359
 return;\
4340
};");
4360
};");
4341
    break;
4361
    break;
4342
   
4362
   
4343
    case DRAW_SEGMENTS:/*  used for userdraw */
4363
    case DRAW_SEGMENTS:/*  used for userdraw */
4344
fprintf(js_include_file,"\n<!-- draw segments -->\n\
4364
fprintf(js_include_file,"\n<!-- draw segments -->\n\
4345
draw_segments = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_translate,vector){\
4365
draw_segments = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_translate,vector){\
4346
 ctx.save();\
4366
 ctx.save();\
Line 4376... Line 4396...
4376
 return [0,Y1,xsize,Y2];\
4396
 return [0,Y1,xsize,Y2];\
4377
};\
4397
};\
4378
draw_lines = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_translate,vector){\
4398
draw_lines = function(ctx,x_points,y_points,line_width,stroke_color,stroke_opacity,use_dashed,dashtype0,dashtype1,use_rotate,angle,use_translate,vector){\
4379
 ctx.save();\
4399
 ctx.save();\
4380
 var line = new Array(4);\
4400
 var line = new Array(4);\
4381
 if(use_translate == 1 ){ctx.translate(vector[0],vector[1]);}\
4401
 if(use_translate == 1 ){ctx.translate(vector[0],vector[1]);}\
4382
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4402
 if(use_rotate == 1 ){ctx.rotate(angle*Math.PI/180);}\
4383
 ctx.lineWidth = line_width;\
4403
 ctx.lineWidth = line_width;\
4384
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4404
 ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4385
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4405
 if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4386
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
4406
 for(var p = 0 ; p < x_points.length ; p = p+2 ){\
4387
  line = calc_line(x_points[p],x_points[p+1],y_points[p],y_points[p+1]);\
4407
  line = calc_line(x_points[p],x_points[p+1],y_points[p],y_points[p+1]);\
4388
  ctx.beginPath();\
4408
  ctx.beginPath();\
4389
  ctx.moveTo(line[0],line[1]);\
4409
  ctx.moveTo(line[0],line[1]);\
Line 5632... Line 5652...
5632
      corr = 0.5*(ctx.measureText(xtxt).width);\n\
5652
      corr = 0.5*(ctx.measureText(xtxt).width);\n\
5633
      ctx.fillText(xtxt,x_e - corr,ysize - 4);\n\
5653
      ctx.fillText(xtxt,x_e - corr,ysize - 4);\n\
5634
    };\n\
5654
    };\n\
5635
   }else{\
5655
   }else{\
5636
    ctx.lineWidth = 0.2*line_width;\n\n\
5656
    ctx.lineWidth = 0.2*line_width;\n\n\
5637
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\n\
5657
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\n\
5638
   };\n\
5658
   };\n\
5639
   if( x_e >= xmarge ){\
5659
   if( x_e >= xmarge ){\
5640
    ctx.beginPath();\n\
5660
    ctx.beginPath();\n\
5641
    ctx.moveTo(x_e,0);\n\
5661
    ctx.moveTo(x_e,0);\n\
5642
    ctx.lineTo(x_e,ysize - ymarge);\n\n\
5662
    ctx.lineTo(x_e,ysize - ymarge);\n\n\
5643
    ctx.stroke();\n\
5663
    ctx.stroke();\n\
5644
    ctx.closePath();\n\
5664
    ctx.closePath();\n\
5645
   };\
5665
   };\
5646
  };\n\
5666
  };\n\
5647
 };\n\
5667
 };\n\
5648
 for(var p = y_min; p <= y_max ; p++){\n\
5668
 for(var p = y_min; p <= y_max ; p++){\n\
5649
  num = Math.pow(ylogbase,p);\n\
5669
  num = Math.pow(ylogbase,p);\n\
5650
  for(var i = 1 ; i < ylogbase ; i++){\n\
5670
  for(var i = 1 ; i < ylogbase ; i++){\n\
Line 5798... Line 5818...
5798
  ctx.save();\n\
5818
  ctx.save();\n\
5799
  ctx.fillStyle=\"rgba(255,215,0,0.2)\";\n\
5819
  ctx.fillStyle=\"rgba(255,215,0,0.2)\";\n\
5800
  ctx.rect(0,0,xmarge,ysize);\n\
5820
  ctx.rect(0,0,xmarge,ysize);\n\
5801
  ctx.rect(0,ysize-ymarge,xsize,ysize);\n\
5821
  ctx.rect(0,ysize-ymarge,xsize,ysize);\n\
5802
  ctx.fill();\n\
5822
  ctx.fill();\n\
5803
  ctx.restore();\n\
5823
  ctx.restore();\n\
5804
 }else{xmarge = 0;ymarge = 0;};\n\
5824
 }else{xmarge = 0;ymarge = 0;};\n\
5805
 if( typeof xaxislabel !== 'undefined' ){\
5825
 if( typeof xaxislabel !== 'undefined' ){\
5806
  ctx.save();\n\
5826
  ctx.save();\n\
5807
  ctx.font = \"italic \"+font_size+\"px Ariel\";\n\
5827
  ctx.font = \"italic \"+font_size+\"px Ariel\";\n\
5808
  ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\n\
5828
  ctx.fillStyle = \"rgba(\"+font_color+\",\"+major_opacity+\")\";\n\
Line 5930... Line 5950...
5930
        *tsteps="tsteps",
5950
        *tsteps="tsteps",
5931
        *curve="curve",
5951
        *curve="curve",
5932
        *dcurve="dcurve",
5952
        *dcurve="dcurve",
5933
        *plot="plot",
5953
        *plot="plot",
5934
        *dplot="dplot",
5954
        *dplot="dplot",
-
 
5955
        *levelcurve="levelcurve",
5935
        *fontsize="fontsize",
5956
        *fontsize="fontsize",
5936
        *fontcolor="fontcolor",
5957
        *fontcolor="fontcolor",
5937
        *axis="axis",
5958
        *axis="axis",
5938
        *axisnumbering="axisnumbering",
5959
        *axisnumbering="axisnumbering",
5939
        *axisnumbers="axisnumbers",
5960
        *axisnumbers="axisnumbers",
Line 6261... Line 6282...
6261
        if( strcmp(input_type, curve) == 0 ){
6282
        if( strcmp(input_type, curve) == 0 ){
6262
        free(input_type);
6283
        free(input_type);
6263
        return CURVE;
6284
        return CURVE;
6264
        }
6285
        }
6265
        if( strcmp(input_type, dcurve) == 0 ){
6286
        if( strcmp(input_type, dcurve) == 0 ){
-
 
6287
        use_dashed = TRUE;
6266
        free(input_type);
6288
        free(input_type);
6267
        return CURVE;
6289
        return CURVE;
6268
        }
6290
        }
6269
        if( strcmp(input_type, plot) == 0 ){
6291
        if( strcmp(input_type, plot) == 0 ){
6270
        free(input_type);
6292
        free(input_type);
-
 
6293
        return CURVE;
-
 
6294
        }
-
 
6295
        if( strcmp(input_type, dplot) == 0 ){
-
 
6296
        use_dashed = TRUE;
-
 
6297
        free(input_type);
6271
        return CURVE;
6298
        return CURVE;
6272
        }
6299
        }
6273
        if( strcmp(input_type, dplot) == 0 ){
6300
        if( strcmp(input_type, levelcurve) == 0 ){
6274
        free(input_type);
6301
        free(input_type);
6275
        return CURVE;
6302
        return LEVELCURVE;
6276
        }
6303
        }
6277
        if( strcmp(input_type, plotsteps) == 0 ){
6304
        if( strcmp(input_type, plotsteps) == 0 ){
6278
        free(input_type);
6305
        free(input_type);
6279
        return PLOTSTEPS;
6306
        return PLOTSTEPS;
6280
        }
6307
        }