[Okular-devel] idea for activation of inverse search

Jochen Trumpf Jochen.Trumpf at anu.edu.au
Wed Nov 19 04:10:26 CET 2008


Hi Pino,

On Sun, 16 Nov 2008 06:26:16 Pino Toscano wrote:
> >   double bestdist = 1000.0; // effectively infinite
>
> std::numeric_limits<double>::max() ;)

Ah! Of course!

> For now we are maintaining a binary compability for the core library, and I
> don't see a real need for it. A problem of this implementation (well, not
> really a problem per-se, but of the way it should be used) is that it'd
> return the nearest object, that could also be "far" in the page.

Yes, I know what you mean. But wouldn't a "far" object always be better than 
none? The other alternatives (silent failure or a failure notification of some 
sort) are probably even worse from a user perspective.

> > Here is a small problem I ran into: this version of distTo does not use
> > x, but works well for dvi, since there the source links are always
> > centered at x=0.5 in the middle of the line (the DVI_SourceFileAnchors
> > only have vertical information -- why?).
>
> (at a really quick glance, it would look like some peculiarity of the DVI
> format.)

On second thoughts, this was probably a "quick and dirty" solution. Imagine 
the following situation: there are two lines of rendered text in your dvi 
document and by chance there is a source object close to the beginning of the 
first line and the next source object is close to the end of the second. The 
user now clicks into the first half of the second line. A (x,y)-based distance 
measure would return the object corresponding to the first line while a y-only 
distance measure would return the second. In terms of "source code distance", 
the second should be closer in this situation. 

This actually applies to any format (dvi, pdf, whatever) which gets generated 
line by line from source code and where source objects are sparse. If there 
are several source objects per line, a (x,y)-based measure might be more 
accurate. 

Ideally, it would be a hierarchical measure: first find the set of source 
objects that correspond to the current "line" in the dvi/pdf document (is 
there such a concept? can this be found from the y-coordinate only? Maybe 
there is some constant describing line spacing?), among those choose the 
closest in x-distance.

> All in all, I could use this -1 marker plus a custom proximity function in
> Page to find out... why not...

Well, a hierarchical measure as outlined above would eliminate the need for 
the special value.

Cheers,
Jochen

P.S.: I am now subscribed to this list, no need to cc me separately any more.



More information about the Okular-devel mailing list