|
From: <pl...@pi...> - 2011-11-21 15:38:44
|
Hi, I would like to have the possibility to make the active mouse features be included in svg file rather than as an external reference. This is not always desirable but has significant advantages when sending svg output to collaborators where it adds a whole load of complex explanations if I have two separate files. AFAIR this was the format when I originally submitted a patch with this kind of interactive behaviour for svg. It would seem the best way to hook this into the existing structure would be a special value of the jsdir dir option to svg terminal. eg. set term svg jsdir="internal" Before I dive in and start coding I would like to do something that fits in with current philosophy and that could be submitted as a patch for consideration. Any comments or suggestions on how to go about this? TIA, Peter. |
|
From: sfeam (E. Merritt) <eam...@gm...> - 2011-11-22 04:46:22
|
On Monday, 21 November 2011, pl...@pi... wrote: > Hi, > > I would like to have the possibility to make the active mouse features > be included in svg file rather than as an external reference. > > This is not always desirable but has significant advantages when sending > svg output to collaborators where it adds a whole load of complex > explanations if I have two separate files. > > AFAIR this was the format when I originally submitted a patch with this > kind of interactive behaviour for svg. So you're "forgery69"? I don't think I ever knew who submitted the original patch other than that pseudonym. You should get some kudos in the source file. > It would seem the best way to hook this into the existing structure > would be a special value of the jsdir dir option to svg terminal. > > eg. > set term svg jsdir="internal" My first thought is that this is more parallel to the "standalone" option in the various tex drivers and in the canvas terminal. > Before I dive in and start coding I would like to do something that fits > in with current philosophy and that could be submitted as a patch for > consideration. > Any comments or suggestions on how to go about this? My suggestion is to have it work like the postscript terminal does with its prologue files. If the user specifies "set term svg standalone", the instead of writing out <script type="text/javascript" xlink:href="JSDIR/gnuplot_svg.js"/> you would write out <script type="text/javascript"><![CDATA[" and then copy the contents of JSDIR:gnuplot_svg.js line by line into the output stream. Under this model the jsder="foo" option might still be useful in order to tell the program where to copy from, in the case that you want to include a locally customized version. Ethan > TIA, Peter. |
|
From: <pl...@pi...> - 2011-11-22 05:56:06
|
On 11/22/11 05:46, sfeam (Ethan Merritt) wrote:
> On Monday, 21 November 2011, pl...@pi... wrote:
>> Hi,
>>
>> I would like to have the possibility to make the active mouse features
>> be included in svg file rather than as an external reference.
>>
>> This is not always desirable but has significant advantages when sending
>> svg output to collaborators where it adds a whole load of complex
>> explanations if I have two separate files.
>>
>> AFAIR this was the format when I originally submitted a patch with this
>> kind of interactive behaviour for svg.
>
> So you're "forgery69"? I don't think I ever knew who submitted the
> original patch other than that pseudonym. You should get some kudos
> in the source file.
>
>> It would seem the best way to hook this into the existing structure
>> would be a special value of the jsdir dir option to svg terminal.
>>
>> eg.
>> set term svg jsdir="internal"
>
> My first thought is that this is more parallel to the "standalone"
> option in the various tex drivers and in the canvas terminal.
>
>> Before I dive in and start coding I would like to do something that fits
>> in with current philosophy and that could be submitted as a patch for
>> consideration.
>> Any comments or suggestions on how to go about this?
>
> My suggestion is to have it work like the postscript terminal does with
> its prologue files. If the user specifies "set term svg standalone",
> the instead of writing out
> <script type="text/javascript" xlink:href="JSDIR/gnuplot_svg.js"/>
> you would write out
> <script type="text/javascript"><![CDATA["
> and then copy the contents of JSDIR:gnuplot_svg.js line by line into the
> output stream.
>
> Under this model the jsder="foo" option might still be useful in order
> to tell the program where to copy from, in the case that you want to
> include a locally customized version.
>
> Ethan
>
>
>> TIA, Peter.
>
Hmm , I'm confused , I added the following but it fails to recognise the
new option. Does that need to be added somewhere else as well?
gnuplot> set terminal svg mouse standalone name basename font
"verdana,9" size 800,600;
^
"monthly.gnu", line 19697: unrecognized terminal option
[ The caret is indicating "standalone" ]
static TBOOLEAN SVG_mouseable = FALSE;
static TBOOLEAN SVG_standalone = FALSE;
....
if (equals(c_token, "mouse") || almost_equals(c_token, "mous$ing")) {
c_token++;
SVG_mouseable = TRUE;
continue;
}
if (equals(c_token, "standalone") || almost_equals(c_token,
"stan$dalone")) {
c_token++;
SVG_standalone = TRUE;
continue;
}
....
if (SVG_mouseable) {
/* This is sufficient to support toggling plots on/off */
if (!SVG_standalone) {
fprintf(gpoutfile,"<script type=\"text/javascript\"
xlink:href=\"%sgnuplot_svg.js\"/>\n",
SVG_scriptdir);
} else {
char *fullname = NULL;
char *name ="gnuplot_svg.js";
char buf[256];
FILE *svg_js_fd;
fullname = gp_alloc(strlen(SVG_scriptdir) + strlen(name) +
4,"javascript name");
strcpy(fullname, SVG_scriptdir);
PATH_CONCAT(fullname, name);
svg_js_fd=NULL;
svg_js_fd=fopen(fullname, "r");
free(fullname);
if (svg_js_fd){
fprintf(gpoutfile,"<script type=\"text/javascript\" >\n");
while (fgets(buf, sizeof(buf), svg_js_fd)) {
fputs(buf, gpoutfile);
fprintf(gpoutfile,"</script>\n");
}
fclose(svg_js_fd);
} else {
// *** warn non fatal: failed to insert javascript
fprintf(stderr,"Failed to insert SVG javaScript file %s\n",
name);
}
|
|
From: <pl...@pi...> - 2011-11-22 06:26:05
|
On 11/22/11 05:46, sfeam (Ethan Merritt) wrote: > On Monday, 21 November 2011, pl...@pi... wrote: >> Hi, >> >> I would like to have the possibility to make the active mouse features >> be included in svg file rather than as an external reference. >> >> This is not always desirable but has significant advantages when sending >> svg output to collaborators where it adds a whole load of complex >> explanations if I have two separate files. >> >> AFAIR this was the format when I originally submitted a patch with this >> kind of interactive behaviour for svg. > > So you're "forgery69"? I don't think I ever knew who submitted the > original patch other than that pseudonym. You should get some kudos > in the source file. > Yeah, I only just noticed the credit you put in there when I started digging earlier. I'd forgotten it went in via that route rather than this ML. IIRC I suggested it here and you asked me to post a comment on SF so that it didn't get forgotten. Oh, well. I'll worry about the kudos later. >> It would seem the best way to hook this into the existing structure >> would be a special value of the jsdir dir option to svg terminal. >> >> eg. >> set term svg jsdir="internal" > > My first thought is that this is more parallel to the "standalone" > option in the various tex drivers and in the canvas terminal. > >> Before I dive in and start coding I would like to do something that fits >> in with current philosophy and that could be submitted as a patch for >> consideration. >> Any comments or suggestions on how to go about this? > > My suggestion is to have it work like the postscript terminal does with > its prologue files. If the user specifies "set term svg standalone", > the instead of writing out > <script type="text/javascript" xlink:href="JSDIR/gnuplot_svg.js"/> > you would write out > <script type="text/javascript"><![CDATA[" > and then copy the contents of JSDIR:gnuplot_svg.js line by line into the > output stream. > > Under this model the jsder="foo" option might still be useful in order > to tell the program where to copy from, in the case that you want to > include a locally customized version. > > Ethan > > >> TIA, Peter. > Ok , I have some code roughed out to do it already , what variable should I be testing for to catch the "standalone" option? Thx. Peter. |