Subversion Repositories wimsdev

Rev

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

Rev 7782 Rev 7783
Line 99... Line 99...
99
    int use_parametric = FALSE;/* will be reset after parametric plotting */
99
    int use_parametric = FALSE;/* will be reset after parametric plotting */
100
    int use_axis = FALSE;
100
    int use_axis = FALSE;
101
    int use_axis_numbering = FALSE;
101
    int use_axis_numbering = FALSE;
102
    int line_width = 1;
102
    int line_width = 1;
103
    int decimals = 2;
103
    int decimals = 2;
104
    int debug = 0;
-
 
105
    int precision = 100; /* 10 = 1;100=2;1000=3 decimal display for mouse coordinates or grid coordinate */
104
    int precision = 100; /* 10 = 1;100=2;1000=3 decimal display for mouse coordinates or grid coordinate */
106
    int use_userdraw = FALSE; /* flag to indicate user interaction: incompatible with "drag & drop" code !! */
105
    int use_userdraw = FALSE; /* flag to indicate user interaction: incompatible with "drag & drop" code !! */
107
    int drag_type = -1;/* 0,1,2 : xy,x,y */
106
    int drag_type = -1;/* 0,1,2 : xy,x,y */
108
    int use_tooltip = FALSE;
107
    int use_tooltip = FALSE;
109
    char *tooltip_text = "Click here";
108
    char *tooltip_text = "Click here";
Line 921... Line 920...
921
        @ note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.<br />while typing the background of every typed char will be lightblue..."backspace / delete / esc" will remove typed text.<br />You will need to hit "enter" to add the text to the array "userdraw_txt()" : lightblue background will disappear<br />Placing the cursor somewhere on a typed text and hitting "delete/backspace/esc" , a confirm will popup asking to delete the selected text.This text will be removed from the "userdraw_txt()" answer array.<br />Use commands 'fontsize' and 'fontfamily' to control the text appearance
920
        @ note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.<br />while typing the background of every typed char will be lightblue..."backspace / delete / esc" will remove typed text.<br />You will need to hit "enter" to add the text to the array "userdraw_txt()" : lightblue background will disappear<br />Placing the cursor somewhere on a typed text and hitting "delete/backspace/esc" , a confirm will popup asking to delete the selected text.This text will be removed from the "userdraw_txt()" answer array.<br />Use commands 'fontsize' and 'fontfamily' to control the text appearance
922
        @ note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
921
        @ note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
923
        @ note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse butten (e.g. event.which != 1 : all buttons but left)
922
        @ note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse butten (e.g. event.which != 1 : all buttons but left)
924
        @ use command "filled", "opacity int,int"  and "fillcolor color" to trigger coloured filling of fillable objects
923
        @ use command "filled", "opacity int,int"  and "fillcolor color" to trigger coloured filling of fillable objects
925
        @ use command "dashed" and/or "dashtype int,int" to trigger dashing
924
        @ use command "dashed" and/or "dashtype int,int" to trigger dashing
926
        @ use command "debug" to view the output of javascript funcion read_canvas();
-
 
927
        @ use command "replyformat int" to control / adjust output formatting of javascript function read_canvas();
925
        @ use command "replyformat int" to control / adjust output formatting of javascript function read_canvas();
928
        @ may be combined with onclick or drag xy  of other components of flyscript objects (although not very usefull...)
926
        @ may be combined with onclick or drag xy  of other components of flyscript objects (although not very usefull...)
929
        @ may be combined with keyword 'userinput_xy' or
927
        @ may be combined with keyword 'userinput_xy' or
930
        @ note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature <br />To avoid trouble do not use zooming / panning together width userdraw.!
928
        @ note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature <br />To avoid trouble do not use zooming / panning together width userdraw.!
931
        */
929
        */
Line 2298... Line 2296...
2298
            string_length = snprintf(NULL,0,  "draw_setpixel(%s,\"%s\",%.2f,%d);\n",double_xy2js_array(double_data,i,decimals),stroke_color,stroke_opacity,pixelsize);
2296
            string_length = snprintf(NULL,0,  "draw_setpixel(%s,\"%s\",%.2f,%d);\n",double_xy2js_array(double_data,i,decimals),stroke_color,stroke_opacity,pixelsize);
2299
            check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2297
            check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2300
            snprintf(tmp_buffer,string_length,"draw_setpixel(%s,\"%s\",%.2f,%d);\n",double_xy2js_array(double_data,i,decimals),stroke_color,stroke_opacity,pixelsize);
2298
            snprintf(tmp_buffer,string_length,"draw_setpixel(%s,\"%s\",%.2f,%d);\n",double_xy2js_array(double_data,i,decimals),stroke_color,stroke_opacity,pixelsize);
2301
            add_to_buffer(tmp_buffer);
2299
            add_to_buffer(tmp_buffer);
2302
            break;
2300
            break;
2303
        case DEBUG:
-
 
2304
        /*
-
 
2305
        @ debug
-
 
2306
        @ keyword, no arguments
-
 
2307
        @ use as first command (before 'size')
-
 
2308
        @ will show a few buttons to read_canvas(); read_mathml(); and read_dragdrop();
-
 
2309
        @ only to be used in a single canvasdraw instance <br />or in case of multiple canvasdraw images , only the last image
-
 
2310
        */
-
 
2311
        debug = 1;
-
 
2312
        fprintf(stdout,"\n\
-
 
2313
<!-- THIS IS JUST FOR DEBUGGING ANSWER TYPES IN A SINGLE CANVASDRAW INSTANCE -->\n\
-
 
2314
<input type=\"button\" onclick=\"javascript:alert(read_canvas());\" value=\"read_canvas()\" />\n\
-
 
2315
<input type=\"button\" onclick=\"javascript:alert(read_mathml());\" value=\"read_mathml()\" />\n\
-
 
2316
<input type=\"button\" onclick=\"javascript:alert(read_dragdrop());\" value=\"read_dragdrop()\" />\n");
-
 
2317
        done = TRUE;
-
 
2318
 
-
 
2319
        case REPLYFORMAT:
2301
        case REPLYFORMAT:
2320
        /*
2302
        /*
2321
        @ replyformat number
2303
        @ replyformat number
2322
        @ default values should be fine !
2304
        @ default values should be fine !
2323
        @ use command "debug" to check return values of javascript function read_canvas();
-
 
2324
        @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in pixels <br />  r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in xrange / yrange coordinate system<br />  r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />   Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br />  x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br />  x/y in pixels</li><li>15 = reply from inputfields,textareas<br />  reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br />  x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li></ul>
2305
        @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in pixels <br />  r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br />  y1,y2,y3,y4....y_n<br />  r1,r2,r3,r4....r_n<br />  x/y in xrange / yrange coordinate system<br />  r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br />  Ay1,Ay2,Ay3,Ay4....Ay_n<br />  Bx1,Bx2,Bx3,Bx4....Bx_n<br />  By1,By2,By3,By4....By_n<br />  Cx1,Cx2,Cx3,Cx4....Cx_n<br />  Cy1,Cy2,Cy3,Cy4....Cy_n<br />  ....<br />  Zx1,Zx2,Zx3,Zx4....Zx_n<br />  Zy1,Zy2,Zy3,Zy4....Zy_n<br />  x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br />  x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br />  x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />   Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br />   Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br />   Dx1,Dy1,Dx2,Dy2<br />   ......<br />   Zx1,Zy1,Zx2,Zy2<br />  x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br />  x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br />  x/y in pixels</li><li>15 = reply from inputfields,textareas<br />  reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br />  x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li></ul>
2325
        @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...)
2306
        @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...)
2326
        */
2307
        */
2327
         reply_format = (int) get_real(infile,1);
2308
         reply_format = (int) get_real(infile,1);
2328
        break;
2309
        break;
Line 2336... Line 2317...
2336
            temp = get_string(infile,1);
2317
            temp = get_string(infile,1);
2337
            if( strstr( temp,":") != 0 ){ temp = str_replace(temp,":","\",\""); }
2318
            if( strstr( temp,":") != 0 ){ temp = str_replace(temp,":","\",\""); }
2338
            fprintf(js_include_file,"var legendcolors%d = [\"%s\"];",canvas_root_id,temp);
2319
            fprintf(js_include_file,"var legendcolors%d = [\"%s\"];",canvas_root_id,temp);
2339
            break;
2320
            break;
2340
        case LEGEND:
2321
        case LEGEND:
2341
        /*
2322
        /*
2342
        @ legend string1:string2:string3....string_n
2323
        @ legend string1:string2:string3....string_n
2343
        @ will be used to create a legend for a graph
2324
        @ will be used to create a legend for a graph
2344
        @ also see command 'piechart'  
2325
        @ also see command 'piechart'  
2345
        */
2326
        */
2346
            temp = get_string(infile,1);
2327
            temp = get_string(infile,1);
Line 2349... Line 2330...
2349
            break;
2330
            break;
2350
        case XLABEL:
2331
        case XLABEL:
2351
        /*
2332
        /*
2352
        @ xlabel some_string
2333
        @ xlabel some_string
2353
        @ will be used to create a label for the x-axis (label is in quadrant I)
2334
        @ will be used to create a label for the x-axis (label is in quadrant I)
2354
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2335
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2355
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2336
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2356
        */
2337
        */
2357
            temp = get_string(infile,1);
2338
            temp = get_string(infile,1);
2358
            fprintf(js_include_file,"var xaxislabel = \"%s\";",temp);
2339
            fprintf(js_include_file,"var xaxislabel = \"%s\";",temp);
2359
            break;
2340
            break;
Line 2361... Line 2342...
2361
        /*
2342
        /*
2362
        @ ylabel some_string
2343
        @ ylabel some_string
2363
        @ will be used to create a (vertical) label for the y-axis (label is in quadrant I)
2344
        @ will be used to create a (vertical) label for the y-axis (label is in quadrant I)
2364
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2345
        @ can only be used together with command 'grid'<br />not depending on keywords 'axis' and 'axisnumbering'
2365
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2346
        @ font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
2366
        */
2347
        */
2367
            temp = get_string(infile,1);
2348
            temp = get_string(infile,1);
2368
            fprintf(js_include_file,"var yaxislabel = \"%s\";",temp);
2349
            fprintf(js_include_file,"var yaxislabel = \"%s\";",temp);
2369
            break;
2350
            break;
2370
        case LINEGRAPH: /* scheme: var linegraph_0 = [ 'stroke_color','line_width','use_dashed' ,'dashtype0','dashtype1','x1','y1',...,'x_n','y_n'];*/
2351
        case LINEGRAPH: /* scheme: var linegraph_0 = [ 'stroke_color','line_width','use_dashed' ,'dashtype0','dashtype1','x1','y1',...,'x_n','y_n'];*/
2371
        /*
2352
        /*
Line 2390... Line 2371...
2390
        @ type hourglass:<br />type = 0 : only segments<br />type = 1 : only numbers<br />type = 2 : numbers and segments
2371
        @ type hourglass:<br />type = 0 : only segments<br />type = 1 : only numbers<br />type = 2 : numbers and segments
2391
        @ colors are optional: if not defined, default values will be used<br />default colours: clock 0,0,60,4,35,45,1,2,[space]<br />default colours: clock 0,0,60,4,35,45,1,2,,,,,<br />custom colours: clock 0,0,60,4,35,45,1,2,,,,yellow,red<br />custom colours: clock 0,0,60,4,35,45,1,2,white,white,white,black,yellow
2372
        @ colors are optional: if not defined, default values will be used<br />default colours: clock 0,0,60,4,35,45,1,2,[space]<br />default colours: clock 0,0,60,4,35,45,1,2,,,,,<br />custom colours: clock 0,0,60,4,35,45,1,2,,,,yellow,red<br />custom colours: clock 0,0,60,4,35,45,1,2,white,white,white,black,yellow
2392
        @ interactive <ul><li>0 : not interactive, just clock(s)</li><li>1 : function read_canvas() will read all active clocks in H:M:S format<br />The active clock(s) can be adjusted by pupils</li><li>2 : function read_canvas() will return the clicked clock <br />(like multiplechoice; first clock in script in nr. 0 )</li></ul>
2373
        @ interactive <ul><li>0 : not interactive, just clock(s)</li><li>1 : function read_canvas() will read all active clocks in H:M:S format<br />The active clock(s) can be adjusted by pupils</li><li>2 : function read_canvas() will return the clicked clock <br />(like multiplechoice; first clock in script in nr. 0 )</li></ul>
2393
        @ canvasdraw will not check validity of colornames...the javascript console is your best friend
2374
        @ canvasdraw will not check validity of colornames...the javascript console is your best friend
2394
        @ no combinations with other reply_types allowed, for now
2375
        @ no combinations with other reply_types allowed, for now
2395
        @ if command 'debug' is set, 6 buttons per clock will be displayed for adjusting a clock (H+ M+ S+ H- M- S-)<br /> set_clock(clock_id,type,incr) <br />first clock has clock_id=0 ; type : H=1,M=2,S=3 ; incr : increment integer
2376
        @ if interactive, 6 buttons per clock will be displayed for adjusting a clock (H+ M+ S+ H- M- S-)<br /> set_clock(clock_id,type,incr) <br />first clock has clock_id=0 ; type : H=1,M=2,S=3 ; incr : increment integer
2396
        */
2377
        */
2397
            if( js_function[DRAW_CLOCK] != 1 ){ js_function[DRAW_CLOCK] = 1;}
2378
            if( js_function[DRAW_CLOCK] != 1 ){ js_function[DRAW_CLOCK] = 1;}
2398
 
2379
 
2399
        /*    var clock = function(xc,yc,radius,H,M,S,h_color,m_color,s_color,bg_color,fg_color) */
2380
        /*    var clock = function(xc,yc,radius,H,M,S,h_color,m_color,s_color,bg_color,fg_color) */
2400
            for(i=0;i<9;i++){
2381
            for(i=0;i<9;i++){
Line 2403... Line 2384...
2403
              case 1: int_data[1] = y2px(get_real(infile,0)); break; /* yc */
2384
              case 1: int_data[1] = y2px(get_real(infile,0)); break; /* yc */
2404
              case 2: int_data[2] = get_real(infile,0);break;/* radius in px */
2385
              case 2: int_data[2] = get_real(infile,0);break;/* radius in px */
2405
              case 3: int_data[3] = get_real(infile,0);break;/* hours */
2386
              case 3: int_data[3] = get_real(infile,0);break;/* hours */
2406
              case 4: int_data[4] = get_real(infile,0);break;/* minutes */
2387
              case 4: int_data[4] = get_real(infile,0);break;/* minutes */
2407
              case 5: int_data[5] = get_real(infile,0);break;/* seconds */
2388
              case 5: int_data[5] = get_real(infile,0);break;/* seconds */
2408
              case 6:
-
 
2409
              int_data[6] = get_real(infile,0);if(int_data[6] < 0 || int_data[6] > 2){canvas_error("hourglass can be 0,1 or 2");}break;/* type hourglass */
2389
              case 6: int_data[6] = get_real(infile,0);if(int_data[6] < 0 || int_data[6] > 2){canvas_error("hourglass can be 0,1 or 2");}break;/* type hourglass */
2410
              case 7: int_data[7] = (int)(get_real(infile,0));/* interactive 0,1,2*/
2390
              case 7: int_data[7] = (int)(get_real(infile,0));/* interactive 0,1,2*/
2411
                        switch(int_data[7]){
2391
                switch(int_data[7]){
2412
                         default:break;
2392
                    case 0:break;
2413
                         case 1 :if(clock_cnt == 0){
2393
                    case 1:if(clock_cnt == 0){
2414
                                    if( reply_format == 0 ){
2394
                                if( reply_format == 0 ){
2415
                                     reply_format = 18; /* user sets clock */
2395
                                     reply_format = 18; /* user sets clock */
2416
                                     string_length = snprintf(NULL,0,"set_clock = function(num,type,diff){var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
2396
                                    /* string_length = snprintf(NULL,0,"set_clock = function(num,type,diff){var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
2417
                                     check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2397
                                     check_string_length(string_length);tmp_buffer = my_newmem(string_length+1);
2418
                                     snprintf(tmp_buffer,string_length,"set_clock = function(num,type,diff){var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
2398
                                     snprintf(tmp_buffer,string_length,"set_clock = function(num,type,diff){var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
2419
                                     add_to_buffer(tmp_buffer);
2399
                                     add_to_buffer(tmp_buffer);
-
 
2400
                                    */
2420
                                    }
2401
                                     fprintf(js_include_file,"set_clock = function(num,type,diff){var name = eval(\"clocks\"+num);switch(type){case 1:name.H = parseInt(name.H+diff);break;case 2:name.M = parseInt(name.M+diff);break;case 3:name.S = parseInt(name.S+diff);break;default: break;};name = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);};\n");
-
 
2402
                                }
2421
                                    else
2403
                                else
2422
                                    {
2404
                                {
2423
                                     canvas_error("interactive clock may not be used together with other reply_types...");
2405
                                    canvas_error("interactive clock may not be used together with other reply_types...");
2424
                                    }
2406
                                }
2425
                                  }
2407
                                fprintf(stdout,"<br /><input type=\"button\" onclick=\"javascript:set_clock(%d,1,1)\" value=\"H+\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,1,-1)\" value=\"H-\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,2,1)\" value=\"M+\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,2,-1)\" value=\"M-\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,3,1)\" value=\"S+\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,3,-1)\" value=\"S-\" /><br />",clock_cnt,clock_cnt,clock_cnt,clock_cnt,clock_cnt,clock_cnt);
2426
                                  if(debug == 1 ){
-
 
2427
                                    fprintf(stdout,"<br /><input type=\"button\" onclick=\"javascript:set_clock(%d,1,1)\" value=\"H+\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,1,-1)\" value=\"H-\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,2,1)\" value=\"M+\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,2,-1)\" value=\"M-\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,3,1)\" value=\"S+\" /><input type=\"button\" onclick=\"javascript:set_clock(%d,3,-1)\" value=\"S-\" /><br />",clock_cnt,clock_cnt,clock_cnt,clock_cnt,clock_cnt,clock_cnt);
2408
                             }
2428
                                  }
-
 
2429
                                  break;
2409
                    break;
2430
                         case 2 :if( reply_format == 0 ){
2410
                    case 2:if( reply_format == 0 ){
2431
                                    reply_format = 19; /* "onclick */
2411
                                reply_format = 19; /* "onclick */
2432
                                    fprintf(js_include_file,"\n<!-- begin onclick handler for clocks -->\nvar reply = new Array();\n\ncanvas_div.addEventListener( 'mousedown', user_click,false);\n\nfunction user_click(evt){if(evt.which == 1){var canvas_rect = clock_canvas.getBoundingClientRect();\nvar x = evt.clientX - canvas_rect.left;\nvar y = evt.clientY - canvas_rect.top;\nvar p = 0;\nvar name;\nvar t = true;\nwhile(t){try{name = eval('clocks'+p);\nif( x < name.xc + name.radius && x > name.xc - name.radius ){if( y < name.yc + name.radius && y > name.yc - name.radius ){reply[0] = p;\nname = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,\"lightblue\",name.fg_color);\n};\n}else{clock_ctx.clearRect(name.xc-name.radius,name.yc-name.radius,name.xc+name.radius,name.yc+name.radius);\nname = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);\n};\np++;\n}catch(e){t=false;\n};\n};\n};\n};\n\n<!-- end onclick handler for clocks -->\n ");
2412
                                fprintf(js_include_file,"\n<!-- begin onclick handler for clocks -->\nvar reply = new Array();\n\ncanvas_div.addEventListener( 'mousedown', user_click,false);\n\nfunction user_click(evt){if(evt.which == 1){var canvas_rect = clock_canvas.getBoundingClientRect();\nvar x = evt.clientX - canvas_rect.left;\nvar y = evt.clientY - canvas_rect.top;\nvar p = 0;\nvar name;\nvar t = true;\nwhile(t){try{name = eval('clocks'+p);\nif( x < name.xc + name.radius && x > name.xc - name.radius ){if( y < name.yc + name.radius && y > name.yc - name.radius ){reply[0] = p;\nname = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,\"lightblue\",name.fg_color);\n};\n}else{clock_ctx.clearRect(name.xc-name.radius,name.yc-name.radius,name.xc+name.radius,name.yc+name.radius);\nname = clock(name.xc,name.yc,name.radius,name.H,name.M,name.S,name.type,name.interaction,name.H_color,name.M_color,name.S_color,name.bg_color,name.fg_color);\n};\np++;\n}catch(e){t=false;\n};\n};\n};\n};\n\n<!-- end onclick handler for clocks -->\n ");
2433
                                 }
2413
                            }
2434
                                 else
2414
                            else
2435
                                 {
2415
                            {
2436
                                  if( reply_format != 19){
2416
                                if( reply_format != 19){
2437
                                   canvas_error("clickable clock(s) may not be used together with other reply_types...");
2417
                                   canvas_error("clickable clock(s) may not be used together with other reply_types...");
2438
                                  }
-
 
2439
                                 }
2418
                                 }
-
 
2419
                            }
2440
                                 break;
2420
                     break;
-
 
2421
                     default: canvas_error("interactive must be set 0,1 or 2");break;
2441
                        }
2422
                }
2442
                        break;
2423
                break;
2443
                case 8:
2424
                case 8:
2444
                        temp = get_string(infile,1);
2425
                        temp = get_string(infile,1);
2445
                        if( strstr( temp,",") != 0 ){ temp = str_replace(temp,",","\",\""); }
2426
                        if( strstr( temp,",") != 0 ){ temp = str_replace(temp,",","\",\""); }
2446
                        if( strlen(temp) < 1 ){temp = ",\"\",\"\",\"\",\"\",\"\"";}
2427
                        if( strlen(temp) < 1 ){temp = ",\"\",\"\",\"\",\"\",\"\"";}
2447
                        string_length = snprintf(NULL,0,"clocks%d = new clock(%d,%d,%d,%d,%d,%d,%d,%d,\"%s\");\n",clock_cnt,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],int_data[5],int_data[6],int_data[7],temp);
2428
                        string_length = snprintf(NULL,0,"clocks%d = new clock(%d,%d,%d,%d,%d,%d,%d,%d,\"%s\");\n",clock_cnt,int_data[0],int_data[1],int_data[2],int_data[3],int_data[4],int_data[5],int_data[6],int_data[7],temp);
Line 3397... Line 3378...
3397
this.read_canvas = read_canvas;\n\
3378
this.read_canvas = read_canvas;\n\
3398
<!-- end function 6 read_canvas() -->");
3379
<!-- end function 6 read_canvas() -->");
3399
    break;
3380
    break;
3400
    case 7: fprintf(js_include_file,"\
3381
    case 7: fprintf(js_include_file,"\
3401
\n<!-- begin function 7 read_canvas() -->\n\
3382
\n<!-- begin function 7 read_canvas() -->\n\
3402
function read_canvas(){\
3383
function read_canvas(){\
3403
 var reply = new Array();\
3384
 var reply = new Array();\
3404
 var p = 0;\
3385
 var p = 0;\
3405
 while(userdraw_x[p]){\
3386
 while(userdraw_x[p]){\
3406
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\
3387
  reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\
3407
  p++;\
3388
  p++;\
3408
 };\
3389
 };\
3409
 if(p == 0){alert(\"nothing drawn...\");return;};\
3390
 if(p == 0){alert(\"nothing drawn...\");return;};\
3410
 if( document.getElementById(\"canvas_input0\") ){\
3391
 if( document.getElementById(\"canvas_input0\") ){\
3411
  var p = 0;var input_reply = new Array();\
3392
  var p = 0;var input_reply = new Array();\
3412
  if( document.getElementById(\"canvas_input0\")){\
3393
  if( document.getElementById(\"canvas_input0\")){\
3413
   var t = 0;\
3394
   var t = 0;\
3414
   while(document.getElementById(\"canvas_input\"+t)){\
3395
   while(document.getElementById(\"canvas_input\"+t)){\
3415
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3396
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3416
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3397
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3417
     p++;\
3398
     p++;\
3418
    };\
3399
    };\
3419
    t++;\
3400
    t++;\
3420
   };\
3401
   };\
3421
  };\
3402
  };\
3422
  if( typeof userdraw_text != 'undefined' ){\
3403
  if( typeof userdraw_text != 'undefined' ){\
3423
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3404
   return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3424
  }\
3405
  }\
3425
  else\
3406
  else\
3426
  {\
3407
  {\
3427
   return reply+\"\\n\"+input_reply;\
3408
   return reply+\"\\n\"+input_reply;\
3428
  }\
3409
  }\
3429
 };\
3410
 };\
3430
 else\
3411
 else\
3431
 {\
3412
 {\
Line 3446... Line 3427...
3446
function read_canvas(){\
3427
function read_canvas(){\
3447
 var reply = new Array();\
3428
 var reply = new Array();\
3448
 var p = 0;\
3429
 var p = 0;\
3449
 while(userdraw_x[p]){\
3430
 while(userdraw_x[p]){\
3450
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]);\
3431
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]);\
3451
  p++;\
3432
  p++;\
3452
 };\
3433
 };\
3453
 if(p == 0){alert(\"nothing drawn...\");return;};\
3434
 if(p == 0){alert(\"nothing drawn...\");return;};\
3454
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3435
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3455
  var p = 0;var input_reply = new Array();\
3436
  var p = 0;var input_reply = new Array();\
3456
  if( document.getElementById(\"canvas_input0\")){\
3437
  if( document.getElementById(\"canvas_input0\")){\
3457
   var t = 0;\
3438
   var t = 0;\
3458
   while(document.getElementById(\"canvas_input\"+t)){\
3439
   while(document.getElementById(\"canvas_input\"+t)){\
3459
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3440
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3460
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3441
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3461
     p++;\
3442
     p++;\
3462
    };\
3443
    };\
3463
    t++;\
3444
    t++;\
3464
   };\
3445
   };\
3465
  };\
3446
  };\
3466
  if( typeof userdraw_text != 'undefined' ){\
3447
  if( typeof userdraw_text != 'undefined' ){\
3467
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3448
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3468
  }\
3449
  }\
3469
  else\
3450
  else\
3470
  {\
3451
  {\
3471
   return reply +\"\\n\"+input_reply;\
3452
   return reply +\"\\n\"+input_reply;\
3472
  }\
3453
  }\
3473
 }\
3454
 }\
3474
 else\
3455
 else\
3475
 {\
3456
 {\
3476
  if( typeof userdraw_text != 'undefined' ){\
3457
  if( typeof userdraw_text != 'undefined' ){\
3477
   return reply +\"\\n\"+userdraw_text;\
3458
   return reply +\"\\n\"+userdraw_text;\
3478
  }\
3459
  }\
3479
  else\
3460
  else\
3480
  {\
3461
  {\
3481
   return reply;\
3462
   return reply;\
3482
  }\
3463
  }\
3483
 };\
3464
 };\
3484
};\
3465
};\
3485
this.read_canvas = read_canvas;\n\
3466
this.read_canvas = read_canvas;\n\
3486
<!-- end function 8 read_canvas() -->");
3467
<!-- end function 8 read_canvas() -->");
3487
    break;
3468
    break;
3488
    case 9: fprintf(js_include_file,"\
3469
    case 9: fprintf(js_include_file,"\
3489
\n<!-- begin function 9 read_canvas() -->\n\
3470
\n<!-- begin function 9 read_canvas() -->\n\
3490
function read_canvas(){\
3471
function read_canvas(){\
Line 3505... Line 3486...
3505
     p++;\
3486
     p++;\
3506
    };\
3487
    };\
3507
    t++;\
3488
    t++;\
3508
   };\
3489
   };\
3509
  };\
3490
  };\
3510
  if( typeof userdraw_text != 'undefined' ){\
3491
  if( typeof userdraw_text != 'undefined' ){\
3511
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3492
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3512
  }\
3493
  }\
3513
  else\
3494
  else\
3514
  {\
3495
  {\
3515
   return reply +\"\\n\"+input_reply;\
3496
   return reply +\"\\n\"+input_reply;\
Line 3529... Line 3510...
3529
this.read_canvas = read_canvas;\n\
3510
this.read_canvas = read_canvas;\n\
3530
<!-- end function 9 read_canvas() -->");
3511
<!-- end function 9 read_canvas() -->");
3531
    break;
3512
    break;
3532
    case 10: fprintf(js_include_file,"\
3513
    case 10: fprintf(js_include_file,"\
3533
\n<!-- begin function 10 read_canvas() -->\n\
3514
\n<!-- begin function 10 read_canvas() -->\n\
3534
function read_canvas(){\
3515
function read_canvas(){\
3535
 var reply = new Array();\
3516
 var reply = new Array();\
3536
 var p = 0;\
3517
 var p = 0;\
3537
 while(userdraw_x[p]){\
3518
 while(userdraw_x[p]){\
3538
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + userdraw_radius[p];\
3519
  reply[p] = px2x(userdraw_x[p]) +\":\" + px2y(userdraw_y[p]) +\":\" + userdraw_radius[p];\
3539
  p++;\
3520
  p++;\
3540
 };\
3521
 };\
3541
 if(p == 0){alert(\"nothing drawn...\");return;};\
3522
 if(p == 0){alert(\"nothing drawn...\");return;};\
3542
 if( document.getElementById(\"canvas_input0\") ){\
3523
 if( document.getElementById(\"canvas_input0\") ){\
3543
  var p = 0;var input_reply = new Array();\
3524
  var p = 0;var input_reply = new Array();\
3544
  if( document.getElementById(\"canvas_input0\")){\
3525
  if( document.getElementById(\"canvas_input0\")){\
3545
   var t = 0;\
3526
   var t = 0;\
3546
   while(document.getElementById(\"canvas_input\"+t)){\
3527
   while(document.getElementById(\"canvas_input\"+t)){\
3547
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3528
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3548
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3529
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3549
     p++;\
3530
     p++;\
3550
    };\
3531
    };\
3551
    t++;\
3532
    t++;\
3552
   };\
3533
   };\
3553
  };\
3534
  };\
3554
  if( typeof userdraw_text != 'undefined' ){\
3535
  if( typeof userdraw_text != 'undefined' ){\
3555
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3536
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3556
  }\
3537
  }\
3557
  else\
3538
  else\
3558
  {\
3539
  {\
3559
   return reply +\"\\n\"+input_reply;\
3540
   return reply +\"\\n\"+input_reply;\
3560
  }\
3541
  }\
3561
 }\
3542
 }\
3562
 else\
3543
 else\
3563
 {\
3544
 {\
3564
  if( typeof userdraw_text != 'undefined' ){\
3545
  if( typeof userdraw_text != 'undefined' ){\
3565
   return reply +\"\\n\"+userdraw_text;\
3546
   return reply +\"\\n\"+userdraw_text;\
Line 3582... Line 3563...
3582
  reply = reply + px2x(userdraw_x[p]) +\",\" + px2y(userdraw_y[p]) +\",\" + px2x(userdraw_x[p+1]) +\",\" + px2y(userdraw_y[p+1]) +\"\\n\" ;\
3563
  reply = reply + px2x(userdraw_x[p]) +\",\" + px2y(userdraw_y[p]) +\",\" + px2x(userdraw_x[p+1]) +\",\" + px2y(userdraw_y[p+1]) +\"\\n\" ;\
3583
  p = p+2;\
3564
  p = p+2;\
3584
 };\
3565
 };\
3585
 if(p == 0){alert(\"nothing drawn...\");return;};\
3566
 if(p == 0){alert(\"nothing drawn...\");return;};\
3586
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3567
 if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\
3587
  var p = 0;var input_reply = new Array();\
3568
  var p = 0;var input_reply = new Array();\
3588
  if( document.getElementById(\"canvas_input0\")){\
3569
  if( document.getElementById(\"canvas_input0\")){\
3589
   var t = 0;\
3570
   var t = 0;\
3590
   while(document.getElementById(\"canvas_input\"+t)){\
3571
   while(document.getElementById(\"canvas_input\"+t)){\
3591
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3572
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3592
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3573
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3593
     p++;\
3574
     p++;\
3594
    };\
3575
    };\
3595
    t++;\
3576
    t++;\
3596
   };\
3577
   };\
3597
  };\
3578
  };\
3598
  if( typeof userdraw_text != 'undefined' ){\
3579
  if( typeof userdraw_text != 'undefined' ){\
3599
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3580
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3600
  }\
3581
  }\
3601
  else\
3582
  else\
3602
  {\
3583
  {\
3603
   return reply +\"\\n\"+input_reply;\
3584
   return reply +\"\\n\"+input_reply;\
3604
  }\
3585
  }\
3605
 }\
3586
 }\
Line 3711... Line 3692...
3711
function read_canvas(){\
3692
function read_canvas(){\
3712
 var reply = new Array();\
3693
 var reply = new Array();\
3713
 var p = 0;var i = 0;\
3694
 var p = 0;var i = 0;\
3714
 while(userdraw_x[p]){\
3695
 while(userdraw_x[p]){\
3715
  reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\
3696
  reply[i] = userdraw_x[p] +\":\" + userdraw_y[p] +\":\" + userdraw_x[p+1] +\":\" + userdraw_y[p+1];\
3716
  p = p+2;i++;\
3697
  p = p+2;i++;\
3717
 };\
3698
 };\
3718
 if(p == 0){alert(\"nothing drawn...\");return;};\
3699
 if(p == 0){alert(\"nothing drawn...\");return;};\
3719
 if( document.getElementById(\"canvas_input0\") ){\
3700
 if( document.getElementById(\"canvas_input0\") ){\
3720
  var p = 0;var input_reply = new Array();\
3701
  var p = 0;var input_reply = new Array();\
3721
  if( document.getElementById(\"canvas_input0\")){\
3702
  if( document.getElementById(\"canvas_input0\")){\
3722
   var t = 0;\
3703
   var t = 0;\
3723
   while(document.getElementById(\"canvas_input\"+t)){\
3704
   while(document.getElementById(\"canvas_input\"+t)){\
3724
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3705
    if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3725
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3706
     input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3726
     p++;\
3707
     p++;\
3727
    };\
3708
    };\
3728
    t++;\
3709
    t++;\
3729
   };\
3710
   };\
3730
  };\
3711
  };\
3731
  if( typeof userdraw_text != 'undefined' ){\
3712
  if( typeof userdraw_text != 'undefined' ){\
3732
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3713
   return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\
3733
  }\
3714
  }\
3734
  else\
3715
  else\
3735
  {\
3716
  {\
3736
   return reply +\"\\n\"+input_reply;\
3717
   return reply +\"\\n\"+input_reply;\
3737
  }\
3718
  }\
3738
 }\
3719
 }\
Line 3743... Line 3724...
3743
  }\
3724
  }\
3744
  else\
3725
  else\
3745
  {\
3726
  {\
3746
   return reply;\
3727
   return reply;\
3747
  }\
3728
  }\
3748
 };\
3729
 };\
3749
};\
3730
};\
3750
 this.read_canvas = read_canvas;\n\
3731
 this.read_canvas = read_canvas;\n\
3751
<!-- end function 14 read_canvas() -->");
3732
<!-- end function 14 read_canvas() -->");
3752
    break;
3733
    break;
3753
    case 15: fprintf(js_include_file,"\
3734
    case 15: fprintf(js_include_file,"\
3754
\n<!-- begin function 15  read_canvas() -->\n\
3735
\n<!-- begin function 15  read_canvas() -->\n\
3755
function read_canvas(){\
3736
function read_canvas(){\
Line 3761... Line 3742...
3761
   if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3742
   if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\
3762
    input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3743
    input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\
3763
    p++;\
3744
    p++;\
3764
   };\
3745
   };\
3765
   t++;\
3746
   t++;\
3766
  };\
3747
  };\
3767
 };\
3748
 };\
3768
 if( typeof userdraw_text != 'undefined' ){\
3749
 if( typeof userdraw_text != 'undefined' ){\
3769
   return input_reply +\"\\n\"+userdraw_text;\
3750
   return input_reply +\"\\n\"+userdraw_text;\
3770
 }\
3751
 }\
3771
 else\
3752
 else\
3772
 {\
3753
 {\
3773
  return input_reply;\
3754
  return input_reply;\
3774
 };\
3755
 };\
3775
};\
3756
};\
3776
 this.read_canvas = read_canvas;\n\
3757
 this.read_canvas = read_canvas;\n\
3777
<!-- end function 15 read_canvas() -->");
3758
<!-- end function 15 read_canvas() -->");
3778
    break;
3759
    break;
3779
    case 16: fprintf(js_include_file,"\
3760
    case 16: fprintf(js_include_file,"\
3780
\n<!-- begin function 16 read_mathml() -->\n\
3761
\n<!-- begin function 16 read_mathml() -->\n\
Line 3794... Line 3775...
3794
    break;
3775
    break;
3795
    case 17:  fprintf(js_include_file,"\
3776
    case 17:  fprintf(js_include_file,"\
3796
\n<!-- begin function 17 read_canvas() -->\n\
3777
\n<!-- begin function 17 read_canvas() -->\n\
3797
function read_canvas(){\
3778
function read_canvas(){\
3798
 if( userdraw_text.length == 0){alert(\"no text typed...\");return;}\
3779
 if( userdraw_text.length == 0){alert(\"no text typed...\");return;}\
3799
 return userdraw_text;\
3780
 return userdraw_text;\
3800
};\
3781
};\
3801
this.read_canvas = read_canvas;\n\
3782
this.read_canvas = read_canvas;\n\
3802
<!-- end function 17 read_canvas() -->");
3783
<!-- end function 17 read_canvas() -->");
3803
    break;
3784
    break;
3804
    case 18: fprintf(js_include_file,"\
3785
    case 18: fprintf(js_include_file,"\
Line 3927... Line 3908...
3927
  }\
3908
  }\
3928
 };\
3909
 };\
3929
};\
3910
};\
3930
this.read_canvas = read_canvas;\n\
3911
this.read_canvas = read_canvas;\n\
3931
<!-- end function 22 read_canvas() -->");
3912
<!-- end function 22 read_canvas() -->");
3932
    break;
3913
    break;
3933
    case 23: fprintf(js_include_file,"\
3914
    case 23: fprintf(js_include_file,"\
3934
\n<!-- begin function 23 read_canvas() default 5 px marge -->\n\
3915
\n<!-- begin function 23 read_canvas() default 5 px marge -->\n\
3935
function read_canvas(){\
3916
function read_canvas(){\
3936
 if( userdraw_x.length < 2){alert(\"nothing drawn...\");return;}\
3917
 if( userdraw_x.length < 2){alert(\"nothing drawn...\");return;}\
3937
 var reply_x = new Array();var reply_y = new Array();var p = 0;\
3918
 var reply_x = new Array();var reply_y = new Array();var p = 0;\
Line 4124... Line 4105...
4124
 ctx.fillText(\"\\u2192\",xsize - 30,ysize-2);\
4105
 ctx.fillText(\"\\u2192\",xsize - 30,ysize-2);\
4125
 ctx.fillText(\"\\u2190\",xsize - 45,ysize-2);\
4106
 ctx.fillText(\"\\u2190\",xsize - 45,ysize-2);\
4126
 ctx.fillText(\"\\u2191\",xsize - 60,ysize-2);\
4107
 ctx.fillText(\"\\u2191\",xsize - 60,ysize-2);\
4127
 ctx.fillText(\"\\u2193\",xsize - 75,ysize-2);\
4108
 ctx.fillText(\"\\u2193\",xsize - 75,ysize-2);\
4128
 ctx.fillText(\"\\u00D7\",xsize - 90,ysize-2);\
4109
 ctx.fillText(\"\\u00D7\",xsize - 90,ysize-2);\
4129
 ctx.stroke();\
4110
 ctx.stroke();\
4130
};",canvas_root_id,canvas_root_id,canvas_root_id);
4111
};",canvas_root_id,canvas_root_id,canvas_root_id);
4131
   
4112
   
4132
    break;
4113
    break;
4133
    case DRAW_GRIDFILL:/* not used for userdraw */
4114
    case DRAW_GRIDFILL:/* not used for userdraw */
4134
fprintf(js_include_file,"\n<!-- draw gridfill -->\n\
4115
fprintf(js_include_file,"\n<!-- draw gridfill -->\n\
Line 4322... Line 4303...
4322
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4303
  ctx.arc(x_points[p],y_points[p],radius[p],0,2*Math.PI,false);\
4323
  ctx.closePath();\
4304
  ctx.closePath();\
4324
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4305
  if(use_dashed == 1){if(ctx.setLineDash){ctx.setLineDash([dashtype0,dashtype1]);}else{ctx.mozDash = [dashtype0,dashtype1];};};\
4325
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4306
  if(use_filled == 1){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4326
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4307
  ctx.strokeStyle=\"rgba(\"+stroke_color+\",\"+stroke_opacity+\")\";\
4327
  ctx.stroke();\
4308
  ctx.stroke();\
4328
 }\
4309
 }\
4329
 ctx.restore();\
4310
 ctx.restore();\
4330
 return;\
4311
 return;\
4331
};");
4312
};");
4332
    break;
4313
    break;
Line 4455... Line 4436...
4455
 for(var p = 0 ; p < x_points.length ; p = p + 2){\
4436
 for(var p = 0 ; p < x_points.length ; p = p + 2){\
4456
  ctx.beginPath();\
4437
  ctx.beginPath();\
4457
  ctx.rect(x_points[p],y_points[p],x_points[p+1]-x_points[p],y_points[p+1]-y_points[p]);\
4438
  ctx.rect(x_points[p],y_points[p],x_points[p+1]-x_points[p],y_points[p+1]-y_points[p]);\
4458
  ctx.closePath();\
4439
  ctx.closePath();\
4459
  if(use_filled == 1 ){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4440
  if(use_filled == 1 ){ctx.fillStyle = \"rgba(\"+fill_color+\",\"+fill_opacity+\")\";ctx.fill();}\
4460
  ctx.stroke();\
4441
  ctx.stroke();\
4461
 };\
4442
 };\
4462
 ctx.restore();\
4443
 ctx.restore();\
4463
 return;\
4444
 return;\
4464
};");
4445
};");
4465
    break;
4446
    break;
4466
 
4447
 
4467
    case DRAW_ROUNDRECTS:/*  used for userdraw */
4448
    case DRAW_ROUNDRECTS:/*  used for userdraw */
4468
fprintf(js_include_file,"\n<!-- draw round rects -->\n\
4449
fprintf(js_include_file,"\n<!-- draw round rects -->\n\
Line 6044... Line 6025...
6044
        *intooltip="intooltip",
6025
        *intooltip="intooltip",
6045
        *replyformat="replyformat",
6026
        *replyformat="replyformat",
6046
        *floodfill="floodfill",
6027
        *floodfill="floodfill",
6047
        *filltoborder="filltoborder",
6028
        *filltoborder="filltoborder",
6048
        *clickfill="clickfill",
6029
        *clickfill="clickfill",
6049
        *debug="debug",
-
 
6050
        *setpixel="setpixel",
6030
        *setpixel="setpixel",
6051
        *pixels="pixels",
6031
        *pixels="pixels",
6052
        *pixelsize="pixelsize",
6032
        *pixelsize="pixelsize",
6053
        *clickfillmarge="clickfillmarge",
6033
        *clickfillmarge="clickfillmarge",
6054
        *xaxis="xaxis",
6034
        *xaxis="xaxis",
Line 6582... Line 6562...
6582
        return CLICKFILL;
6562
        return CLICKFILL;
6583
        }      
6563
        }      
6584
        if( strcmp(input_type, replyformat) == 0 ){
6564
        if( strcmp(input_type, replyformat) == 0 ){
6585
        free(input_type);
6565
        free(input_type);
6586
        return REPLYFORMAT;
6566
        return REPLYFORMAT;
6587
        }
-
 
6588
        if( strcmp(input_type, debug) == 0 ){
-
 
6589
        free(input_type);
-
 
6590
        return DEBUG;
-
 
6591
        }
6567
        }
6592
        if( strcmp(input_type, pixelsize) == 0 ){
6568
        if( strcmp(input_type, pixelsize) == 0 ){
6593
        free(input_type);
6569
        free(input_type);
6594
        return PIXELSIZE;
6570
        return PIXELSIZE;
6595
        }
6571
        }