Subversion Repositories wimsdev

Rev

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

Rev 8299 Rev 8304
Line 204... Line 204...
204
fprintf(stdout,"\n<script type=\"text/javascript\">\
204
fprintf(stdout,"\n<script type=\"text/javascript\">\
205
if( typeof wims_status === 'undefined' ){ var wims_status = \"$status\";};\
205
if( typeof wims_status === 'undefined' ){ var wims_status = \"$status\";};\
206
if( typeof use_dragdrop_reply === 'undefined' ){ var use_dragdrop_reply = false;};\
206
if( typeof use_dragdrop_reply === 'undefined' ){ var use_dragdrop_reply = false;};\
207
if( typeof canvas_scripts === 'undefined' ){ var canvas_scripts = new Array();};\
207
if( typeof canvas_scripts === 'undefined' ){ var canvas_scripts = new Array();};\
208
canvas_scripts.push(\"%d\");</script>\n\
208
canvas_scripts.push(\"%d\");</script>\n\
209
<!-- canvasdraw div and tooltip placeholder, if needed -->\n<div tabindex=\"0\" id=\"canvas_div%d\" style=\"position:relative;width:%dpx;height:%dpx;margin-left:auto;margin-right:auto;\" ></div><div id=\"tooltip_placeholder_div%d\" style=\"display:block;margin-bottom:4px;\"><span id=\"tooltip_placeholder%d\" style=\"display:none;\"></span></div>\n",canvas_root_id,canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id);
209
<!-- canvasdraw div and tooltip placeholder, if needed -->\n\
-
 
210
<div tabindex=\"0\" id=\"canvas_div%d\" style=\"position:relative;width:%dpx;height:%dpx;margin-left:auto;margin-right:auto;\" ></div>\n\
-
 
211
<div id=\"tooltip_placeholder_div%d\" style=\"display:block;position:relative;margin-left:auto;margin-right:auto;margin-bottom:4px;\">\
-
 
212
<span id=\"tooltip_placeholder%d\" style=\"display:none;\">\n</span>\
-
 
213
</div>\n",canvas_root_id,canvas_root_id,xsize,ysize,canvas_root_id,canvas_root_id);
210
fprintf(stdout,"<!-- include actual object code via include file -->\n<script id=\"canvas_script%d\" type=\"text/javascript\" src=\"%s\"></script>\n",canvas_root_id,getfile_cmd);
214
fprintf(stdout,"<!-- include actual object code via include file -->\n<script id=\"canvas_script%d\" type=\"text/javascript\" src=\"%s\"></script>\n",canvas_root_id,getfile_cmd);
211
fprintf(js_include_file,"\n<!-- begin generated javascript include for canvasdraw -->\n\
215
fprintf(js_include_file,"\n<!-- begin generated javascript include for canvasdraw -->\n\
212
\"use strict\";\n\
216
\"use strict\";\n\
213
<!-- these variables and functions must be global -->\n\
217
<!-- these variables and functions must be global -->\n\
214
var read_dragdrop%d;\
218
var read_dragdrop%d;\
Line 848... Line 852...
848
                    case 2: double_data[2] = px2x((get_real(infile,0))/2) - px2x(0);break; /* for zoom in/out : radius in 'dx' xrange*/
852
                    case 2: double_data[2] = px2x((get_real(infile,0))/2) - px2x(0);break; /* for zoom in/out : radius in 'dx' xrange*/
849
                    case 3: stroke_color = get_color(infile,1);/* name or hex color */
853
                    case 3: stroke_color = get_color(infile,1);/* name or hex color */
850
                        decimals = find_number_of_digits(precision);
854
                        decimals = find_number_of_digits(precision);
851
                        fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[1],double_data[2],double_data[2],line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
855
                        fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[1],double_data[2],double_data[2],line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
852
                        click_cnt++;reset();
856
                        click_cnt++;reset();
-
 
857
                        break;
-
 
858
                    default : break;
-
 
859
                }
-
 
860
            }
853
                    break;
861
            break;
-
 
862
 
-
 
863
        case CIRCLES:
-
 
864
        /*
-
 
865
        @ circles color,xc1,yc1,r1,xc2,yc2,r2...xc_n,yc_n,r_n
-
 
866
        @ Attention r = radius in x-range (!)
-
 
867
        @ use command 'fillcolor color' to set the fillcolor
-
 
868
        @ may be set draggable / onclick (individually)
-
 
869
        @ will shrink / expand on zoom out / zoom in
-
 
870
        */
-
 
871
            stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
-
 
872
            fill_color = stroke_color;
-
 
873
            i=1;
-
 
874
            while( ! done ){     /* get next item until EOL*/
-
 
875
                if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");}
-
 
876
                switch (i%3){
-
 
877
                 case 1:double_data[i-1] = get_real(infile,0);break; /* x */
-
 
878
                 case 2:double_data[i-1] = get_real(infile,0);break; /* y */
-
 
879
                 case 0:double_data[i-1] = get_real(infile,1);break; /* r */
854
                }
880
                }
-
 
881
                i++;
-
 
882
            }
-
 
883
            decimals = find_number_of_digits(precision);
-
 
884
            for(c = 0 ; c < i-1 ; c = c+3){
-
 
885
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,13,[%.*f],[%.*f],[%.3f],[%.3f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[c],decimals,double_data[c+1],double_data[c+2],double_data[c+2],line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
-
 
886
                click_cnt++;
855
            }
887
            }
-
 
888
            reset();
856
            break;
889
            break;
857
        case RAYS:
890
        case RAYS:
858
        /*
891
        /*
859
         @ rays color,xc,yc,x1,y1,x2,y2,x3,y3...x_n,y_n
892
         @ rays color,xc,yc,x1,y1,x2,y2,x3,y3...x_n,y_n
860
         @ draw rays in color 'color' and center (xc:yc)
893
         @ draw rays in color 'color' and center (xc:yc)
Line 872... Line 905...
872
                }
905
                }
873
                else
906
                else
874
                {
907
                {
875
                    double_data[i] = get_real(infile,1); /* y */
908
                    double_data[i] = get_real(infile,1); /* y */
876
                }
909
                }
877
            fprintf(js_include_file,"/* double_data[%d] = %f */\n",i,double_data[i]);
910
            fprintf(js_include_file,"/* double_data[%d] = %f */\n",i,double_data[i]);
-
 
911
                i++;
-
 
912
            }
-
 
913
 
-
 
914
            if( i%2 != 0 ){canvas_error("in command rays: unpaired x or y value");}
-
 
915
            decimals = find_number_of_digits(precision);
-
 
916
            for(c=2; c<i;c = c+2){
-
 
917
                click_cnt++;
-
 
918
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[c],decimals,double_data[1],decimals,double_data[c+1],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
-
 
919
            }
-
 
920
            reset();
-
 
921
            break;
-
 
922
 
-
 
923
        case ARROWS:
-
 
924
        /*
-
 
925
        @ arrows color,head (px),x1,y1,x2,y2...x_n,y_n
-
 
926
        @ draw single headed arrows / vectors from (x1:y1) to (x2:y2) ... (x3:y3) to (x4:y4) etc ... in color 'color'
-
 
927
        @ use command 'linewidth int' to adjust thickness of the arrow
-
 
928
        @ may be set draggable / onclick individually
-
 
929
        */
-
 
930
        fprintf(js_include_file,"\n<!-- FOUND ARROWS --> \n");
-
 
931
            stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
-
 
932
            fill_color = stroke_color;
-
 
933
            arrow_head = (int) get_real(infile,0);/* h */
-
 
934
            i=0;
-
 
935
            while( ! done ){     /* get next item until EOL*/
-
 
936
                if(i > MAX_INT - 1){canvas_error("to many points in argument: repeat command multiple times to fit");}
-
 
937
                if(i%2 == 0 ){
-
 
938
                    double_data[i] = get_real(infile,0); /* x */
-
 
939
                }
-
 
940
                else
-
 
941
                {
-
 
942
                    double_data[i] = get_real(infile,1); /* y */
-
 
943
                }
878
                i++;
944
                i++;
879
            }
945
            }
880
 
-
 
881
            if( i%2 != 0 ){canvas_error("in command rays: unpaired x or y value");}
-
 
882
            decimals = find_number_of_digits(precision);
946
            decimals = find_number_of_digits(precision);
-
 
947
            for(c = 0 ; c < i-1 ; c = c+4){
883
            for(c=2; c<i;c = c+2){
948
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,8,[%.*f,%.*f],[%.*f,%.*f],[%d,%d],[%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],arrow_head,arrow_head,arrow_head,arrow_head,line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
884
                click_cnt++;
949
                click_cnt++;
885
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%d,%s,%d,%d));\n",click_cnt,onclick,drag_type,decimals,double_data[0],decimals,double_data[c],decimals,double_data[1],decimals,double_data[c+1],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,use_affine,affine_matrix,slider,slider_cnt);
-
 
886
            }
950
            }
887
            reset();
951
            reset();
888
            break;
952
            break;
889
        case ARROW:
953
        case ARROW:
890
        /*
954
        /*
Line 2443... Line 2507...
2443
        break;
2507
        break;
2444
        case INPUTSTYLE:
2508
        case INPUTSTYLE:
2445
        /*
2509
        /*
2446
        @ inputstyle style_description
2510
        @ inputstyle style_description
2447
        @ example: inputstyle color:blue;font-weight:bold;font-style:italic;font-size:16pt
2511
        @ example: inputstyle color:blue;font-weight:bold;font-style:italic;font-size:16pt
2448
        */
2512
        */
2449
            input_style = get_string(infile,1);
2513
            input_style = get_string(infile,1);
2450
            break;
2514
            break;
2451
        case INPUT:
2515
        case INPUT:
2452
        /*
2516
        /*
2453
         @ input x,y,size,editable,value
2517
         @ input x,y,size,editable,value
Line 3522... Line 3586...
3522
/******************************************************************************/
3586
/******************************************************************************/
3523
 
3587
 
3524
char *get_color(FILE *infile , int last){
3588
char *get_color(FILE *infile , int last){
3525
    int c,i = 0,is_hex = 0;
3589
    int c,i = 0,is_hex = 0;
3526
    char temp[MAX_COLOR_STRING], *string;
3590
    char temp[MAX_COLOR_STRING], *string;
-
 
3591
    char not_allowed[10] = "0123456789";
3527
    while(( (c=getc(infile)) != EOF ) && ( c != '\n') && ( c != ',' ) && ( c != ';' ) ){
3592
    while(( (c=getc(infile)) != EOF ) && ( c != '\n') && ( c != ',' ) && ( c != ';' ) ){
3528
        if( i > MAX_COLOR_STRING ){ canvas_error("colour string is too big ... ? ");}
3593
        if( i > MAX_COLOR_STRING ){ canvas_error("colour string is too big ... ? ");}
3529
        if( c == '#' ){
3594
        if( c == '#' ){
3530
            is_hex = 1;
3595
            is_hex = 1;
3531
        }
3596
        }
3532
        if( c != ' '){
3597
        if( c != ' '){
-
 
3598
            if( is_hex == 0 ){if(strchr(not_allowed,c) != 0){canvas_error("found something like a number...but is should have been a colour or #hex color number...<br />Do not use R,G,B !!! ");}}
3533
            temp[i]=tolower(c);
3599
            temp[i]=tolower(c);
3534
            i++;
3600
            i++;
3535
        }
3601
        }
3536
    }
3602
    }
3537
    if( ( c == '\n' || c == EOF || c == ';' ) && last == 0){canvas_error("expecting more arguments in command");}
3603
    if( ( c == '\n' || c == EOF || c == ';' ) && last == 0){canvas_error("expecting more arguments in command");}
Line 3554... Line 3620...
3554
    }
3620
    }
3555
    else
3621
    else
3556
    {
3622
    {
3557
        string = (char *)my_newmem(sizeof(temp));
3623
        string = (char *)my_newmem(sizeof(temp));
3558
        snprintf(string,sizeof(temp),"%s",temp);
3624
        snprintf(string,sizeof(temp),"%s",temp);
3559
        for( i = 0; i <= NUMBER_OF_COLORNAMES ; i++ ){
3625
        for( i = 0; i < NUMBER_OF_COLORNAMES ; i++ ){
3560
            if( strcmp( colors[i].name , string ) == 0 ){
3626
            if( strcmp( colors[i].name , string ) == 0 ){
3561
                return colors[i].rgb;
3627
                return colors[i].rgb;
3562
            }
3628
            }
3563
        }
3629
        }
-
 
3630
        canvas_error("I was expecting a color name or hexnumber...but found nothing.");
3564
    }
3631
    }
3565
    /* not found...return error */
-
 
3566
    free(string);string = NULL;
-
 
3567
    canvas_error("I was expecting a color name or hexnumber...but found nothing.");
-
 
3568
    return NULL;
3632
    return "0,0,255";
3569
}
3633
}
3570
 
3634
 
3571
char *get_string(FILE *infile,int last){ /* last = 0 : more arguments ; last=1 final argument */
3635
char *get_string(FILE *infile,int last){ /* last = 0 : more arguments ; last=1 final argument */
3572
    int c,i=0;
3636
    int c,i=0;
3573
    char  temp[MAX_BUFFER], *string;
3637
    char  temp[MAX_BUFFER], *string;
Line 3611... Line 3675...
3611
 
3675
 
3612
double get_real(FILE *infile, int last){ /* accept anything that looks like an number ?  last = 0 : more arguments ; last=1 final argument */
3676
double get_real(FILE *infile, int last){ /* accept anything that looks like an number ?  last = 0 : more arguments ; last=1 final argument */
3613
    int c,i=0,found_calc = 0;
3677
    int c,i=0,found_calc = 0;
3614
    double y;
3678
    double y;
3615
    char tmp[MAX_INT];
3679
    char tmp[MAX_INT];
-
 
3680
    /* these things are 'allowed functions' : *,^,+,-,/,(,),e,arc,cos,tan,pi,log,ln */
-
 
3681
    char allowed[21] = "earcostanpilog+-/^()";/* assuming these are allowed stuff in a 'number'*/
-
 
3682
    char not_allowed[17] = "#bdfghjkmquvwxyz";/* avoid segmentation faults in a "atof()" and "wims eval" */
3616
    while(( (c=getc(infile)) != EOF ) && ( c != ',') && (c != '\n') && ( c != ';')){
3683
    while(( (c=getc(infile)) != EOF ) && ( c != ',') && (c != '\n') && ( c != ';')){
3617
     if( c != ' ' ){
3684
     if( c != ' ' ){
3618
     /*
-
 
3619
     libmatheval will segfault when for example: "xrange -10,+10" or "xrange -10,10+" is used
-
 
3620
     We will check after assert() if it's a NULL pointer...and exit program via :
-
 
3621
     canvas_error("I'm having trouble parsing your \"expression\" ");
-
 
3622
     */
-
 
3623
      if( i == 0 &&  c == '+' ){
3685
      if( i == 0 &&  c == '+' ){
3624
       continue;
3686
       continue;
3625
      }
3687
      }
3626
      else
3688
      else
3627
      {
3689
      {
3628
       if(canvas_iscalculation(c) != 0){
-
 
3629
        found_calc = 1;
-
 
3630
        c = tolower(c);
3690
       c = tolower(c);
3631
       }
-
 
-
 
3691
       if( strchr(not_allowed,c) != 0 ){canvas_error("found a character not associated with a number...");}
-
 
3692
       if( strchr(allowed,c) != 0 ){found_calc = 1;}/* hand the string over to wims eval() */
3632
       tmp[i] = c;
3693
       tmp[i] = c;
3633
       i++;
3694
       i++;
3634
      }
3695
      }
3635
     }
3696
     }
3636
     if( i > MAX_INT - 1){canvas_error("number too large");}
3697
     if( i > MAX_INT - 1){canvas_error("number too large");}
Line 3638... Line 3699...
3638
    if( ( c == '\n' || c == EOF || c == ';' ) && last == 0){canvas_error("expecting more arguments in command");}
3699
    if( ( c == '\n' || c == EOF || c == ';' ) && last == 0){canvas_error("expecting more arguments in command");}
3639
    if( c == '\n' || c == ';' ){ done = TRUE; line_number++; }
3700
    if( c == '\n' || c == ';' ){ done = TRUE; line_number++; }
3640
    if( c == EOF ){done = TRUE ; finished = 1;}
3701
    if( c == EOF ){done = TRUE ; finished = 1;}
3641
    tmp[i]='\0';
3702
    tmp[i]='\0';
3642
    if( strlen(tmp) == 0 ){canvas_error("expected a number , but found nothing !!");}
3703
    if( strlen(tmp) == 0 ){canvas_error("expected a number , but found nothing !!");}
3643
    if( found_calc == 1 ){ /* use libmatheval to calculate 2*pi/3 */
3704
    if( found_calc == 1 ){ /* use wims eval to calculate 2*pi/3 */
3644
     void *f = eval_create(tmp);
3705
     void *f = eval_create(tmp);
3645
     assert(f);if( f == NULL ){canvas_error("I'm having trouble parsing your \"expression\" ") ;}
3706
     assert(f);if( f == NULL ){canvas_error("I'm having trouble parsing your \"expression\" ") ;}
3646
     y = eval_x(f, 1);
3707
     y = eval_x(f, 1);
3647
     /* if function is bogus; y = 1 : so no core dumps */
3708
     /* if function is bogus; y = 1 : so no core dumps */
3648
     eval_destroy(f);
3709
     eval_destroy(f);
Line 3651... Line 3712...
3651
    {
3712
    {
3652
     y = atof(tmp);
3713
     y = atof(tmp);
3653
    }
3714
    }
3654
    return y;
3715
    return y;
3655
}
3716
}
-
 
3717
 
-
 
3718
 
3656
void canvas_error(char *msg){
3719
void canvas_error(char *msg){
3657
    fprintf(stdout,"\n</script><hr /><span style=\"color:red\">FATAL syntax error:line %d : %s</span><hr />",line_number-1,msg);
3720
    fprintf(stdout,"\n</script><hr /><span style=\"color:red\">FATAL syntax error:line %d : %s</span><hr />",line_number-1,msg);
3658
    finished = 1;
3721
    finished = 1;
3659
    exit(EXIT_SUCCESS);
3722
    exit(EXIT_SUCCESS);
3660
}
3723
}
Line 5650... Line 5713...
5650
   ctx.fillStyle = \'#000000\';\
5713
   ctx.fillStyle = \'#000000\';\
5651
   var txt_size = ctx.measureText(xaxislabel).width + 4 ;\
5714
   var txt_size = ctx.measureText(xaxislabel).width + 4 ;\
5652
   ctx.fillText(xaxislabel,xsize - txt_size, zero_y - 7);\
5715
   ctx.fillText(xaxislabel,xsize - txt_size, zero_y - 7);\
5653
 };\
5716
 };\
5654
 if( typeof yaxislabel !== 'undefined'){\
5717
 if( typeof yaxislabel !== 'undefined'){\
5655
   ctx.save();\
5718
   ctx.save();\
5656
   ctx.fillStyle = \'#000000\';\
5719
   ctx.fillStyle = \'#000000\';\
5657
   var txt_size = ctx.measureText(yaxislabel).width;\
5720
   var txt_size = ctx.measureText(yaxislabel).width;\
5658
   ctx.translate(zero_x+8 + font_size,txt_size+font_size);\
5721
   ctx.translate(zero_x+8 + font_size,txt_size+font_size);\
5659
   ctx.rotate(-0.5*Math.PI);\
5722
   ctx.rotate(-0.5*Math.PI);\
5660
   ctx.fillText(yaxislabel,0,0);\
5723
   ctx.fillText(yaxislabel,0,0);\
Line 6434... Line 6497...
6434
   x_e = x2px(i*num);\
6497
   x_e = x2px(i*num);\
6435
   if( i == 1 ){\
6498
   if( i == 1 ){\
6436
    ctx.lineWidth = line_width;\
6499
    ctx.lineWidth = line_width;\
6437
    ctx.strokeStyle=\"rgba(\"+major_color+\",\"+major_opacity+\")\";\
6500
    ctx.strokeStyle=\"rgba(\"+major_color+\",\"+major_opacity+\")\";\
6438
    if( use_axis_numbering == 1 && p > x_min){\
6501
    if( use_axis_numbering == 1 && p > x_min){\
6439
      xtxt = xlogbase+'^'+p.toFixed(0);\
6502
      xtxt = xlogbase+'^'+p.toFixed(0);\
6440
      corr = 0.5*(ctx.measureText(xtxt).width);\
6503
      corr = 0.5*(ctx.measureText(xtxt).width);\
6441
      ctx.fillText(xtxt,x_e - corr,ysize - 4);\
6504
      ctx.fillText(xtxt,x_e - corr,ysize - 4);\
6442
    };\
6505
    };\
6443
   }else{\
6506
   }else{\
6444
    ctx.lineWidth = 0.2*line_width;\
6507
    ctx.lineWidth = 0.2*line_width;\
6445
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6508
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6446
   };\
6509
   };\
6447
   if( x_e >= xmarge ){\
6510
   if( x_e >= xmarge ){\
6448
    ctx.beginPath();\
6511
    ctx.beginPath();\
6449
    ctx.moveTo(x_e,0);\
6512
    ctx.moveTo(x_e,0);\
6450
    ctx.lineTo(x_e,ysize - ymarge);\
6513
    ctx.lineTo(x_e,ysize - ymarge);\
6451
    ctx.stroke();\
6514
    ctx.stroke();\
6452
    ctx.closePath();\
6515
    ctx.closePath();\
6453
   };\
6516
   };\
6454
  };\
6517
  };\
6455
 };\
6518
 };\
6456
 for(var p = y_min; p <= y_max ; p++){\
6519
 for(var p = y_min; p <= y_max ; p++){\
6457
  num = Math.pow(ylogbase,p);\
6520
  num = Math.pow(ylogbase,p);\
6458
  for(var i = 1 ; i < ylogbase ; i++){\
6521
  for(var i = 1 ; i < ylogbase ; i++){\
Line 6460... Line 6523...
6460
   if( i == 1 ){\
6523
   if( i == 1 ){\
6461
    ctx.lineWidth = line_width;\
6524
    ctx.lineWidth = line_width;\
6462
    ctx.strokeStyle=\"rgba(\"+major_color+\",\"+major_opacity+\")\";\
6525
    ctx.strokeStyle=\"rgba(\"+major_color+\",\"+major_opacity+\")\";\
6463
    if( use_axis_numbering == 1 && p > y_min){\
6526
    if( use_axis_numbering == 1 && p > y_min){\
6464
     ctx.fillText(ylogbase+'^'+p.toFixed(0),0,y_e);\
6527
     ctx.fillText(ylogbase+'^'+p.toFixed(0),0,y_e);\
6465
    };\
6528
    };\
6466
   }else{\
6529
   }else{\
6467
    ctx.lineWidth = 0.2*line_width;\
6530
    ctx.lineWidth = 0.2*line_width;\
6468
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6531
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6469
   };\
6532
   };\
6470
   ctx.beginPath();\
6533
   ctx.beginPath();\
6471
   ctx.moveTo(xmarge,y_e);\
6534
   ctx.moveTo(xmarge,y_e);\
Line 6486... Line 6549...
6486
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
6549
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\
6487
 }\
6550
 }\
6488
 else\
6551
 else\
6489
 {\
6552
 {\
6490
  obj = create_canvas%d(canvas_type,xsize,ysize);\
6553
  obj = create_canvas%d(canvas_type,xsize,ysize);\
6491
 };\
6554
 };\
6492
 var ctx = obj.getContext(\"2d\");\
6555
 var ctx = obj.getContext(\"2d\");\
6493
 ctx.clearRect(0,0,xsize,ysize);\
6556
 ctx.clearRect(0,0,xsize,ysize);\
6494
 ctx.save();\
6557
 ctx.save();\
6495
 ctx.lineWidth = line_width;\
6558
 ctx.lineWidth = line_width;\
6496
 var prec = Math.log(precision)/Math.log(10);\
6559
 var prec = Math.log(precision)/Math.log(10);\
Line 6548... Line 6611...
6548
   if( x_e >= xmarge ){\
6611
   if( x_e >= xmarge ){\
6549
    ctx.beginPath();\
6612
    ctx.beginPath();\
6550
    ctx.moveTo(x_e,0);\
6613
    ctx.moveTo(x_e,0);\
6551
    ctx.lineTo(x_e,ysize - ymarge);\
6614
    ctx.lineTo(x_e,ysize - ymarge);\
6552
    ctx.stroke();\
6615
    ctx.stroke();\
6553
    ctx.closePath();\
6616
    ctx.closePath();\
6554
   };\
6617
   };\
6555
  };\
6618
  };\
6556
 };\
6619
 };\
6557
 var stepy = Math.abs(y2px(ymajor) - y2px(0));\
6620
 var stepy = Math.abs(y2px(ymajor) - y2px(0));\
6558
 var minor_step = stepy / yminor;\
6621
 var minor_step = stepy / yminor;\
Line 6572... Line 6635...
6572
   ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6635
   ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6573
   ctx.lineWidth = 0.2*line_width;\
6636
   ctx.lineWidth = 0.2*line_width;\
6574
   ctx.beginPath();\
6637
   ctx.beginPath();\
6575
   ctx.moveTo(xmarge,y+dy*minor_step);\
6638
   ctx.moveTo(xmarge,y+dy*minor_step);\
6576
   ctx.lineTo(xsize,y+dy*minor_step);\
6639
   ctx.lineTo(xsize,y+dy*minor_step);\
6577
   ctx.stroke();\
6640
   ctx.stroke();\
6578
   ctx.closePath();\
6641
   ctx.closePath();\
6579
  };\
6642
  };\
6580
 };\
6643
 };\
6581
 ctx.restore();\
6644
 ctx.restore();\
6582
};",canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
6645
};",canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
Line 6645... Line 6708...
6645
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6708
    ctx.strokeStyle=\"rgba(\"+minor_color+\",\"+minor_opacity+\")\";\
6646
   };\
6709
   };\
6647
   ctx.beginPath();\
6710
   ctx.beginPath();\
6648
   ctx.moveTo(xmarge,y_e);\
6711
   ctx.moveTo(xmarge,y_e);\
6649
   ctx.lineTo(xsize,y_e);\
6712
   ctx.lineTo(xsize,y_e);\
6650
   ctx.stroke();\
6713
   ctx.stroke();\
6651
   ctx.closePath();\
6714
   ctx.closePath();\
6652
  };\
6715
  };\
6653
 };\
6716
 };\
6654
 var stepx = Math.abs(x2px(xmajor) - x2px(0));\
6717
 var stepx = Math.abs(x2px(xmajor) - x2px(0));\
6655
 var minor_step = stepx / xminor;\
6718
 var minor_step = stepx / xminor;\
6656
 var prec = Math.log(precision)/Math.log(10);\
6719
 var prec = Math.log(precision)/Math.log(10);\
6657
 var xtxt;var corr;var flip = 0;\
6720
 var xtxt;var corr;var flip = 0;\
6658
 for(var x = stepx ; x < xsize ; x = x + stepx){\
6721
 for(var x = stepx ; x < xsize ; x = x + stepx){\
Line 6750... Line 6813...
6750
        *axisnumbers="axisnumbers",
6813
        *axisnumbers="axisnumbers",
6751
        *arrow="arrow",
6814
        *arrow="arrow",
6752
        *darrow="darrow",
6815
        *darrow="darrow",
6753
        *arrow2="arrow2",
6816
        *arrow2="arrow2",
6754
        *darrow2="darrow2",
6817
        *darrow2="darrow2",
-
 
6818
        *arrows="arrows",
6755
        *zoom="zoom",
6819
        *zoom="zoom",
6756
        *grid="grid",
6820
        *grid="grid",
6757
        *hline="hline",
6821
        *hline="hline",
6758
        *dhline="dhline",
6822
        *dhline="dhline",
6759
        *drag="drag",
6823
        *drag="drag",
Line 6802... Line 6866...
6802
        *fill="fill",
6866
        *fill="fill",
6803
        *point="point",
6867
        *point="point",
6804
        *points="points",
6868
        *points="points",
6805
        *linewidth="linewidth",
6869
        *linewidth="linewidth",
6806
        *circle="circle",
6870
        *circle="circle",
-
 
6871
        *circles="circles",
6807
        *fcircle="fcircle",
6872
        *fcircle="fcircle",
6808
        *disk="disk",
6873
        *disk="disk",
6809
        *comment="#",
6874
        *comment="#",
6810
        *end="end",
6875
        *end="end",
6811
        *ellipse="ellipse",
6876
        *ellipse="ellipse",
Line 7145... Line 7210...
7145
        return FONTSIZE;
7210
        return FONTSIZE;
7146
        }
7211
        }
7147
        if( strcmp(input_type, fontcolor) == 0 ){
7212
        if( strcmp(input_type, fontcolor) == 0 ){
7148
        free(input_type);
7213
        free(input_type);
7149
        return FONTCOLOR;
7214
        return FONTCOLOR;
7150
        }
-
 
7151
        if( strcmp(input_type, arrow) == 0 ){
-
 
7152
        free(input_type);
-
 
7153
        return ARROW;
-
 
7154
        }
7215
        }
7155
        if( strcmp(input_type, arrow2) == 0 ){
7216
        if( strcmp(input_type, arrow2) == 0 ){
7156
        free(input_type);
7217
        free(input_type);
7157
        return ARROW2;
7218
        return ARROW2;
7158
        }
7219
        }
Line 7163... Line 7224...
7163
        }
7224
        }
7164
        if( strcmp(input_type, darrow2) == 0 ){
7225
        if( strcmp(input_type, darrow2) == 0 ){
7165
        free(input_type);
7226
        free(input_type);
7166
        use_dashed = TRUE;
7227
        use_dashed = TRUE;
7167
        return ARROW2;
7228
        return ARROW2;
-
 
7229
        }
-
 
7230
        if( strcmp(input_type, arrows) == 0 ){
-
 
7231
        free(input_type);
-
 
7232
        return ARROWS;
-
 
7233
        }
-
 
7234
        if( strcmp(input_type, arrow) == 0 ){
-
 
7235
        free(input_type);
-
 
7236
        return ARROW;
7168
        }
7237
        }
7169
        if( strcmp(input_type, zoom) == 0 ){
7238
        if( strcmp(input_type, zoom) == 0 ){
7170
        free(input_type);
7239
        free(input_type);
7171
        return ZOOM;
7240
        return ZOOM;
7172
        }
7241
        }
7173
        if( strcmp(input_type, triangle) == 0 ){
7242
        if( strcmp(input_type, triangle) == 0 ){
7174
        free(input_type);
7243
        free(input_type);
7175
        return TRIANGLE;
7244
        return TRIANGLE;
7176
        }
7245
        }
7177
        if( strcmp(input_type, ftriangle) == 0 ){
7246
        if( strcmp(input_type, ftriangle) == 0 ){
7178
        free(input_type);
7247
        free(input_type);
7179
        use_filled = TRUE;
7248
        use_filled = TRUE;
7180
        return TRIANGLE;
7249
        return TRIANGLE;
7181
        }
7250
        }
7182
        if( strcmp(input_type, input) == 0 ){
7251
        if( strcmp(input_type, input) == 0 ){
7183
        free(input_type);
7252
        free(input_type);
7184
        return INPUT;
7253
        return INPUT;
7185
        }
7254
        }
7186
        if( strcmp(input_type, inputstyle) == 0 ){
7255
        if( strcmp(input_type, inputstyle) == 0 ){
7187
        free(input_type);
7256
        free(input_type);
7188
        return INPUTSTYLE;
7257
        return INPUTSTYLE;
7189
        }
7258
        }
7190
        if( strcmp(input_type, textarea) == 0 ){
7259
        if( strcmp(input_type, textarea) == 0 ){
7191
        free(input_type);
7260
        free(input_type);
7192
        return TEXTAREA;
7261
        return TEXTAREA;
7193
        }
7262
        }
7194
        if( strcmp(input_type, mathml) == 0 ){
7263
        if( strcmp(input_type, mathml) == 0 ){
7195
        free(input_type);
7264
        free(input_type);
7196
        return MATHML;
7265
        return MATHML;
7197
        }
7266
        }
7198
        if( strcmp(input_type, html) == 0 ){
7267
        if( strcmp(input_type, html) == 0 ){
7199
        free(input_type);
7268
        free(input_type);
7200
        return MATHML;
7269
        return MATHML;
7201
        }
7270
        }
7202
        if( strcmp(input_type, fontfamily) == 0 ){
7271
        if( strcmp(input_type, fontfamily) == 0 ){
7203
        free(input_type);
7272
        free(input_type);
7204
        return FONTFAMILY;
7273
        return FONTFAMILY;
7205
        }
7274
        }
7206
        if( strcmp(input_type, lines) == 0  ||  strcmp(input_type, polyline) == 0 ){
7275
        if( strcmp(input_type, lines) == 0  ||  strcmp(input_type, polyline) == 0 ){
7207
        free(input_type);
7276
        free(input_type);
7208
        return POLYLINE;
7277
        return POLYLINE;
7209
        }
7278
        }
7210
        if( strcmp(input_type, rect) == 0  ||  strcmp(input_type, rectangle) == 0 ){
7279
        if( strcmp(input_type, rect) == 0  ||  strcmp(input_type, rectangle) == 0 ){
7211
        free(input_type);
7280
        free(input_type);
7212
        return RECT;
7281
        return RECT;
7213
        }
7282
        }
7214
        if( strcmp(input_type, roundrect) == 0  ||  strcmp(input_type, roundrectangle) == 0 ){
7283
        if( strcmp(input_type, roundrect) == 0  ||  strcmp(input_type, roundrectangle) == 0 ){
7215
        free(input_type);
7284
        free(input_type);
7216
        return ROUNDRECT;
7285
        return ROUNDRECT;
7217
        }
7286
        }
7218
        if( strcmp(input_type, froundrect) == 0 ){
7287
        if( strcmp(input_type, froundrect) == 0 ){
7219
        free(input_type);
7288
        free(input_type);
7220
        use_filled = TRUE;
7289
        use_filled = TRUE;
7221
        return ROUNDRECT;
7290
        return ROUNDRECT;
7222
        }
7291
        }
7223
        if( strcmp(input_type, square) == 0 ){
7292
        if( strcmp(input_type, square) == 0 ){
7224
        free(input_type);
7293
        free(input_type);
7225
        return SQUARE;
7294
        return SQUARE;
7226
        }
7295
        }
7227
        if( strcmp(input_type, fsquare) == 0 ){
7296
        if( strcmp(input_type, fsquare) == 0 ){
7228
        free(input_type);
7297
        free(input_type);
7229
        use_filled = TRUE;
7298
        use_filled = TRUE;
7230
        return SQUARE;
7299
        return SQUARE;
7231
        }
7300
        }
7232
        if( strcmp(input_type, dline) == 0 ){
7301
        if( strcmp(input_type, dline) == 0 ){
7233
        use_dashed = TRUE;
7302
        use_dashed = TRUE;
7234
        free(input_type);
7303
        free(input_type);
7235
        return LINE;
7304
        return LINE;
7236
        }
7305
        }
7237
        if( strcmp(input_type, dvline) == 0 ){
7306
        if( strcmp(input_type, dvline) == 0 ){
7238
        use_dashed = TRUE;
7307
        use_dashed = TRUE;
7239
        free(input_type);
7308
        free(input_type);
7240
        return VLINE;
7309
        return VLINE;
7241
        }
7310
        }
7242
        if( strcmp(input_type, dhline) == 0 ){
7311
        if( strcmp(input_type, dhline) == 0 ){
7243
        use_dashed = TRUE;
7312
        use_dashed = TRUE;
7244
        free(input_type);
7313
        free(input_type);
7245
        return HLINE;
7314
        return HLINE;
7246
        }
7315
        }
7247
        if( strcmp(input_type, frect) == 0 || strcmp(input_type, frectangle) == 0 ){
7316
        if( strcmp(input_type, frect) == 0 || strcmp(input_type, frectangle) == 0 ){
7248
        use_filled = TRUE;
7317
        use_filled = TRUE;
7249
        free(input_type);
7318
        free(input_type);
7250
        return RECT;
7319
        return RECT;
-
 
7320
        }
-
 
7321
        if( strcmp(input_type, circles) == 0 ){
-
 
7322
        free(input_type);
-
 
7323
        return CIRCLES;
7251
        }
7324
        }
7252
        if( strcmp(input_type, fcircle) == 0  ||  strcmp(input_type, disk) == 0 ){
7325
        if( strcmp(input_type, fcircle) == 0  ||  strcmp(input_type, disk) == 0 ){
7253
        use_filled = TRUE;
7326
        use_filled = TRUE;
7254
        free(input_type);
7327
        free(input_type);
7255
        return CIRCLE;
7328
        return CIRCLE;