Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#406 A couple of feature requests relating to pdf preview

open
nobody
None
1
2013-11-07
2013-02-23
Anonymous
No

First, I would like to thank the team. I started trying TeXStudio today, and it's been amazing. There are a couple of features that I think would make TeXStudio even more awesome.

1. "Flashing" pdf preview panel: Every time I compile the tex file, the preview panel flashes as it updates the pdf view due to a repainting process. The same thing used to happen with Sumatra pdf, which was fixed after around 30 minutes after I told them. I don't know the details of the fix, but it is probably something like freezing the update until the painting is complete. I looked at their code when they fixed it, and it looked like it only added 30 lines of codes, so this should be a quick fix.

2. Controlling the position of the pdf preview panel from the editor: it would be nice to add some shortcuts to make it possible to control the scrolling of the pdf preview panel from the editor. For example, Alt-up, Alt-down, alt-left, Alt-right, Alt-pageup, Alt-pagedown for up, down, left, right etc. of the pdf previewing panel.

3. Double click to go from preview windows to the source: at the moment, to get to the source (inverse-search), one need to right click, and then choose Go to source. It would be nice and quick to just double click.

Thanks a lot!

Discussion

  • Tim Hoffmann
    Tim Hoffmann
    2013-02-24

    1. What exactly do you mean by "flashing"? Does it disappear and reappear more than once? The one time flash might be more difficult to solve in our case because the compile - view currently discards the old viewer and opens a new one. One would have to look more closely into this.

    2. Maybe. However I would not assign any shortcuts to the actions by default because there simply aren't enough (or in other words, we have too many features :)). E.g. Alt+Left/Right is the default for Forward/Backward, which is bound to the cursor history in our case.

    3. The usual action for double-clicking in an editor is to select the word under the cursor. Therefore we won't use it for linking. However, there is Ctrl+Click.

     
  • Lang
    Lang
    2013-02-25

    Thanks for your reply!

    1. I meant flickering. It's possible. For more information about how to do it, you can check the code here http://code.google.com/p/sumatrapdf/issues/detail?id=1065 .

    2. I agree that there are already a lot of features! I'm actually VERY impressed. It looks like currently, TeXStudio already allows user to change shortcuts. So if you make it possible, the user can just change to anything he/she likes (Alt-left, right etc. in my case).

    3. The double click is for inverse search (pdf to source), and I didn't realized that that Ctrl-click would also work for that. But on the same note, it would be nice to make it possible to assign shortcut key for forward search (source to pdf). I would suggest smth like Alt-Enter to do forward search. Usually, it's faster without having to use the mouse.

     
    Last edit: Lang 2013-02-25
  • Tim Hoffmann
    Tim Hoffmann
    2013-02-25

    1. I know, updating without flickering is possible in principle. You just have to bring the delete and the load together. However it depends on the structure of the code how easy this is.

    3. Ctrl+Click also works for forward search (of course, you have to click in the editor then;))

    If you really need a keyboard shortcut for this, I suggest, you create the following User Macro.

    %SCRIPT
    app.syncPDFViewer(cursor)
    

    Then you can assign whatever shortcut you like.

     
    Last edit: Tim Hoffmann 2013-02-25
  • Lang
    Lang
    2013-02-25

    1. It would be great if flickering can be fixed easily :).

    2. Do you think that the controlling pdf from editor would be made possible at some point in the near future?

    3. Whoa, this works awesomely well!!!

    Thanks!

     
  • Lang
    Lang
    2013-02-25

    After seeing how awesome script works, I think that it would be great if you can make the pdf viewer object available through scripting as well (for things like scrolling, zoom, etc.)

    I also realized that app.syncPDFViewer is not documented in the user manual included with the installation TeXstudio/help/usermanual_en.html.

    Thanks!

     
    Last edit: Lang 2013-02-25
  • Tim Hoffmann
    Tim Hoffmann
    2013-02-28

    2. rather not there's just too many other ideas what I want to do.

    The pdf viewer is already available via pdfs[0]. Only the documentation is a little behind. However you can use introspection to list the available properties by the following script:

    %SCRIPT
    var pn = Object.getOwnPropertyNames(pdfs[0])
    editor.write(pn.join("\n"))
    

    Make sure that the viewer ist open, otherwise pdfs is empty.

    More useful script examples can be found in the wiki.

     
    Last edit: Tim Hoffmann 2013-02-28
  • Lang
    Lang
    2013-03-01

    Thanks for your reply. I found the method raise() and lower() in pdfs[0], but when I do pdfs[0].raise(), nothing seems to happen. I thought that it would allow me to scroll. What are these for?

     
  • Tim Hoffmann
    Tim Hoffmann
    2013-03-04

    The scripting interface exposes all functions of the object. raise() and lower() are methods inherited from QWidget (http://qt-project.org/doc/qt-4.8/qwidget.html#raise). You'll likely have no use for these.

     
  • Lang
    Lang
    2013-03-05

    I see. So, is there any reason why scrolling is not exposed?

    Thanks!

     
  • Tim Hoffmann
    Tim Hoffmann
    2013-03-05

    That's because of the internal structure. The scrolling is applied to the area on which the page is displayed. You may try

    pdfs[0].widget().downOrNext()
    

    However, in a quick test, this only worked properly if the viewer is windowed. Note, that you are diving deep into the internal structure of the program here. You'd have to look at the source code to fully understand what's going on. Also you might create inconsistent internal states when calling low level functions.

     
  • Lang
    Lang
    2013-03-08

    Thanks! I hope one day it's possible to do this without having to call low level stuff.

     
  • siccis
    siccis
    2013-11-07

    Hi,
    I'd like to have the possibility of controlling the pdf viewer when the focus is on the editor, too. Up to now I've worked with LEd (also with embedded viewer) which has keyboard shortcuts for zooming or scrolling pdf file from within the editor. This is what I miss most while working with txs.
    I searched all the feature requests and there is one more similar post (#323). So, there are at least 3 people who want that. Maybe this would raise the priority of the request :-)
    Regards!