Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable point and click #48

Closed
trevordixon opened this issue Jun 1, 2015 · 11 comments
Closed

Enable point and click #48

trevordixon opened this issue Jun 1, 2015 · 11 comments

Comments

@trevordixon
Copy link
Contributor

http://www.lilypond.org/doc/v2.18/Documentation/usage/configuring-the-system-for-point-and-click

If we use PDF.js to preview, we might be able to make this point and click feature work.

@trevordixon
Copy link
Contributor Author

If we do this, we'll have to fork PDF.js for now. See mozilla/pdf.js#6072 and http://logs.glob.uno/?c=mozilla%23pdfjs#c34556.

@TimothyGu
Copy link
Member

If we use PDF.js to preview, we might be able to make this point and click feature work.

I just spent a night trying to figure out how PDF.js works, and I feel that it could be made to work, but SVG would be a LOT easier to implement.

First, there are multiple ways of using PDF.js:

  1. You can directly use the PDFJS APIs to inject it into a canvas (the "cleanest" way)
  2. You can use the prewritten, very complicated, viewer.html with a special ?file= query string, in an iframe. (viewer.js is just about 7700 lines in addition to pdf.js itself)

1 is the most orthodox way, but it is basically a skeleton only and everything else like zooming, paging must be implemented by hand. Kind of complicated considering the pretty viewer took 7700 LoC.

2 seems to be the best looking option, but I am not yet familiar with cross-document messaging for textedit://'s so it'll be a good challenge for me.

We'll also need to add some relevant buttons like downloading MIDI to the viewer page, remove our existing controls as people don't really like multiple toolbars, and maybe use our own theme instead of the Mozilla-esque black background (the latter will come later of course).

Forking and modifying the giant code code base will also be fun.

On the CodeMirror side, we can use scrollIntoView to hook onto the message event listener.

I'll be moving short-distance AND traveling long-distance for the next few days/weeks so I can't guarantee how much (or even if) I can get done on this, but feel free to start if you'd like to. I have pushed some very rudimentary WIP to the pdf branch of this repo, including a hardcoded copy of PDF.js. That should get you started if you have time for this :)

@scottlinux
Copy link
Contributor

Something to also be aware of - though perhaps rare, I have noticed that the built-in web browser PDF viewer in Firefox (pdf.js?) many times does not render a lilypond score very well. Some missing elements, or things seeming a little off. In one case I was freaking out when it appeared that staccato articulations were missing.

When opening in a real viewer (okular, evince, etc) scores are as expected.

@trevordixon
Copy link
Contributor Author

Interestingly, SVG output has links too!

screen shot 2015-06-02 at 5 54 32 am

By the way, I'm finding that LilyPond can be quite a bit slower when using SVG as a backend instead of PostScript. http://www.mutopiaproject.org/ftp/BachJS/BWV230/bach_BWV_230_Lobet_den_Herrn_alle_Heiden/bach_BWV_230_Lobet_den_Herrn_alle_Heiden.ly takes 11–12 seconds to make a PDF, and 16–17 seconds to do SVG.

@trevordixon
Copy link
Contributor Author

@scottlinux The Firefox PDF viewer is PDF.js, so that's good to know of those issues. Do you have some small (1-page) example PDFs that don't render properly in Firefox? We should send them to the PDF.js people and let them know of issues.

@scottlinux
Copy link
Contributor

I can make a small preview. This score I believe had that issue (missing articulations viewed in Firefox):

http://scottmillercomposer.com/scores/carmen/carmen.pdf

@trevordixon
Copy link
Contributor Author

Use https://mozilla.github.io/pdf.js/web/viewer.html to test. (I don't notice anything missing right off the bat.)

@scottlinux
Copy link
Contributor

Ok looks good! Perhaps all is well now.

@TimothyGu
Copy link
Member

@trevordixon said:

Interestingly, SVG output has links too!

LOL, that's what I remembered, but seems like overlooked it yesterday while confirming my thoughts, thus trolling myself into looking at PDF.js :)

By the way, I'm finding that LilyPond can be quite a bit slower when using SVG as a backend instead of PostScript.

On my non-SSD machine, the difference is 44.954s vs 13.489s in favor of PS → PNG. This is a quite significant performance hit I'd say. I guess PDF might be worthy after all :)

@trevordixon
Copy link
Contributor Author

Nice job!

@TimothyGu
Copy link
Member

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants