unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* {PATCH] continuous scroll for doc-view (FOR REVIEW))
@ 2022-01-13 10:53 dalanicolai
  2022-01-13 10:58 ` dalanicolai
  2022-01-14  8:03 ` Juri Linkov
  0 siblings, 2 replies; 9+ messages in thread
From: dalanicolai @ 2022-01-13 10:53 UTC (permalink / raw)
  To: Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 4145 bytes --]

I am not sure how to best handle this, but I figured I'll better keep you
involved (get feedback better sooner than later).

So I have got the code for a first 'working' example for the continuous
scroll.

Let me comment a little first:
So I've started from the Proof of Concept here
<https://github.com/dalanicolai/bookroll.el>, on which I commented
on more already in the thread here
<https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00663.html>
(original thread is here
<https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00938.html>).


A very short, but 'noteworthy' digression ...

I'd really like to mention that I get no hits when searching for that thread
<https://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=Multi+image+PDF&submit=Search%21&idxname=emacs-devel&max=20&result=normal&sort=score>
(actually searching
for 'the original thread') when searching on `multi image PDF` in the Emacs
devel archive.
(This time) it is not due to too many results. Would be great if you could
inform me why that
does not work.


Back to the main subject...

So I will attach two files here, the first is an 'adapted' bookroll.el
file, and the second is a
a modified doc-view file that implements the first 'rudimentary' continuous
scroll for PDF
documents(despite the subject title of this message, I am simply attaching
the file,
as you can then more simply load and try it, while I guess you must be
capable of diffing it with
the latest doc-view.el file yourself ;).
For, now it only works on PDF documents (I hope all of them), because I
have to find good 'splitting points' for the various overlays (this was the
original approach
that I'd used in pdf-view, I prefer to keep the document it's contents in
the buffer and drawing
the overlays over it). For other types of documents I've tried to
'determine' split points using `forward-line`, but that did not give
satisfactory results.

I am not sure if the bookroll-mode should be a separate package (like
image-mode),
or that it could just get merged into doc-view. But it is as it is for the
development process.

So now some comments on the files/approach:

To understand the approach of bookmark.el, it is probably most useful to
look at the Proof
of Concept file to which I have linked already above. It simply draws a
triplet of images (pages)
for each page (and a doublet for the first and last pages), and then it
uses a 'currently-displayed-images' list, and refreshes pages when
necessary by comparing with that list. The current page is the page that
takes more than half of the window height.

In the single page doc-view there is a single overlay, that informs via its
properties many doc-view functions about which step to take next (it
controls the doc-view 'process'). In the bookroll
doc-view version, This overlay is kept as a 'control' overlay, which is not
used for containing images. The overlays for 'holding' the images are in
the `overlay-list`. (Although this solution
for the control overlay looks simple, it took me quite some investigation
and error and trial to
come up with it, which is also to say that I think it is a nice solution).

For now, the scrolling is too continuous (i.e. now separation indicator
between the pages), but I
am planning to embed the files in svg images (as I have done in djvu3.el
<https://github.com/dalanicolai/djvu3>), so that it will be easy
to draw a line between the pages

So, anyone who is interested can have a look at the code, and of course any
feedback and suggestions are welcome I am no experienced programmer, and I
am also fairly new to Emacs
(actually Spacemacs which I think is (also) a really great project). I am
only able to do this because of your great (documentation) work :) If you
find things that looks like 'bad developing
process practice', then I am very happy with good/better suggestions.

As I have to take care of 'fixing' the 'resizing/scaling/zoom'
functionality now, any comments
ideas on that part would be welcome in particular...

Quite obviously, to test it, load the bookmark.el file, then load the
doc-view.el file, open some PDF document and start scrolling using `j`/`k`.

[-- Attachment #2: Type: text/html, Size: 5037 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-16 22:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 10:53 {PATCH] continuous scroll for doc-view (FOR REVIEW)) dalanicolai
2022-01-13 10:58 ` dalanicolai
2022-01-13 11:08   ` dalanicolai
2022-01-14  8:03 ` Juri Linkov
2022-01-14 10:44   ` dalanicolai
2022-01-14 11:03     ` dalanicolai
2022-01-15 18:09       ` dalanicolai
2022-01-15 18:13     ` Juri Linkov
2022-01-16 22:07       ` dalanicolai

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).