izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
106 stars 30 forks source link

Lilypond point and click #141

Open AljoschaMeyer opened 8 years ago

AljoschaMeyer commented 8 years ago

Hey there,

would it be possible to add support for point and click for lilypond? Lilypond is to traditional music notation software what latex is to WYSIWYG editors. It has a point and click feature which lets you click on the generated PDF and takes you to the correct line in the source file.

This is basically the same thing as the SyncTeX support which pdf-view already offers. To quote from the point and click documentation:

When this functionality is active, LilyPond adds hyperlinks to the PDF file. These hyperlinks are sent to a ‘URI helper’ or a web-browser, which opens a text-editor with the cursor in the right place.

To make this chain work, you should configure your PDF viewer to follow hyperlinks using the ‘lilypond-invoke-editor’ script supplied with LilyPond.

I currently see two options: Either add support directly to pdf-view (just as with SyncTeX), or add some general API to pdf-view which lets other packages subscribe for link-activations.

Best regards, Aljoscha

izuzak commented 8 years ago

Hey @AljoschaMeyer -- thanks for opening an issue! That sounds like it would be a neat and useful feature, and it seems like it should be possible to do. That said, I probably won't have time to look into that myself in the near future, so if someone else wants to try and add support for that -- I'd be happy to review the pull request.

AljoschaMeyer commented 8 years ago

I don't have the time to implement generalized uri click support either, but I could simply add some lilypond specific code analogous to synctex. Would you accept such a pull request?

izuzak commented 8 years ago

I don't have the time to implement generalized uri click support either, but I could simply add some lilypond specific code analogous to synctex. Would you accept such a pull request?

Yeah, I believe I would if it doesn't cause problems for any of the existing stuff.

AljoschaMeyer commented 8 years ago

Ok, I took a look at the synctex implementation and there's a slight problem. I assumed that synctex was based on links, but it is actually a program which takes raw coordinates as input. This makes the implementation for lilypond support quite different from the synctex support.

What lilypond support would need to do is intercept clicks on links, and exec the correct script if the link is a special lilypond link.

Do you have any experience with interacting with links in pdf-js, or will I have to look into this myself?

aiomaster commented 6 years ago

@AljoschaMeyer Did you work at this feature somewhere? I would also be interested in this feature cause it would make atom more usefull for lilypond editing. Or do you have an idea where to start implementing it?

AljoschaMeyer commented 6 years ago

I spent some time trying to write a pdf-viewer plugin for atom with support for annotations (e.g. links). But working with pdf.js was pretty horrible, since it predates javescript modules and e.g. uses a custom, make-file based module system. I did not manage to successfully display pdfs in atom with annotation support. At some point I embedded the default pdfjs viewer in an iframe. That gives you support for links (and e.g. the ability to select text). But integrating that with atom (keyboard shortcuts via the atom options, theming etc.) might be more effort than using the pdf-js api for building a suitable viewer plugin. Still, for quick-and-dirty point-and-click support, this might be the way to go.