Re: Need help regarding heading into the Okular Feature: 388450

2018-02-17 Thread Dileep Sankhla
Thank you so much. The information made me understand okular much better
and its internals too. I will try my best to form a solution and if any
problem, will contact the developers here or IRC.
Thank you once again.

Dileep





‌

On Sat, Feb 17, 2018 at 4:13 PM, Tobias Deiminger 
wrote:

> Hi Dileep!
>
> @all: Please check if the following is correct
>
> But now the problem is I'm confused inside the large codebase
>>
>
> Don't worry! I guess this has happened to almost everybody here a few
> times :)
>
> I'm trying to get an idea from the annotations that remains glued to
>> the pageview and do scroll with the scrollbar
>>
>
> There's an critical difference between your popup annotation windows and
> the "glued annotations": The popup windows are real, independent widgets
> (AnnotWindow<-QFrame<-QWidget). But the glued ones are just "dumb"
> pixmaps mostly rendered by the poppler generator, while all logic & drawing
> is done by the (too-)mighty PageView (a QAbstractScrollArea widget). Imho,
> this disqualifies them a bit as "similar code example".
>
> Most "glued annotations" are rendered by the poppler library along with
> text and other PDF objects into, simplest case, one big QImage per page
> (see PDFGenerator::image [0], rendering thread). The page QImage is
> converted to a QPixmap and gets painted at once in
> PagePainter::paintCroppedPageOnPainter [1]. Okular just knows the
> annotations position rectangles, so that the PageView widget can overlay
> some basic UI functionality like tooltips and selection rectangles.
>
> There are interesting exceptions, e.g. stamp annotations. Poppler can't
> render them, so as kind of workaround [2] Okular does that on its own.
> Stamps are drawn in the seciton "5 -- MIXED FLOW. Draw ANNOTATIONS [OPAQUE
> ONES] on ACTIVE PAINTER" - "draw StampAnnotation" [3]. So, rendered by
> okular, scrolling with the page - that's a bit closer to what you want. But
> otoh, those stamps are still only dumb QPixmaps, handled by the PageView
> widget.
>
> Your popup note input dialog is a real independent widget (good so!) with
> user input logic + state. See class AnnotWindow, and
> PageView::openAnnotationWindow. This widget implements the "open state"
> of annotations, which is a term from PDF standard ISO 32000 [4]. Chapter
> 12.5.1, "Annotations - General" describes the open and closed state in
> detail, I think that's a good reading for you.
>
> Btw., I found README.internals.png [5] to be a brief and good overview of
> Okulars design when I first touched Okular.
>
> Sorry for not providing concrete solution hints. Hopefully it helped to at
> least gain more insight into the problem.
>
> Cheers
> Tobias
>
> [0] https://cgit.kde.org/okular.git/tree/generators/poppler/gene
> rator_pdf.cpp?h=v17.12.2#n950
> [1] https://cgit.kde.org/okular.git/tree/ui/pagepainter.cpp?h=v1
> 7.12.2#n265
> [2] https://bugs.kde.org/show_bug.cgi?id=383651
> [3] https://cgit.kde.org/okular.git/tree/ui/pagepainter.cpp?h=v1
> 7.12.2#n741
> [4] https://wwwimages2.adobe.com/content/dam/acom/en/devnet/pdf/
> PDF32000_2008.pdf
> [5] https://cgit.kde.org/okular.git/tree/README.internals.png?h=v17.12.2
>
>


Re: Need help regarding heading into the Okular Feature: 388450

2018-02-17 Thread Tobias Deiminger

Hi Dileep!

@all: Please check if the following is correct


But now the problem is I'm confused inside the large codebase


Don't worry! I guess this has happened to almost everybody here a few 
times :)



I'm trying to get an idea from the annotations that remains glued to
the pageview and do scroll with the scrollbar


There's an critical difference between your popup annotation windows and 
the "glued annotations": The popup windows are real, independent widgets 
(AnnotWindow<-QFrame<-QWidget). But the glued ones are just "dumb" 
pixmaps mostly rendered by the poppler generator, while all logic & 
drawing is done by the (too-)mighty PageView (a QAbstractScrollArea 
widget). Imho, this disqualifies them a bit as "similar code example".


Most "glued annotations" are rendered by the poppler library along with 
text and other PDF objects into, simplest case, one big QImage per page 
(see PDFGenerator::image [0], rendering thread). The page QImage is 
converted to a QPixmap and gets painted at once in 
PagePainter::paintCroppedPageOnPainter [1]. Okular just knows the 
annotations position rectangles, so that the PageView widget can overlay 
some basic UI functionality like tooltips and selection rectangles.


There are interesting exceptions, e.g. stamp annotations. Poppler can't 
render them, so as kind of workaround [2] Okular does that on its own. 
Stamps are drawn in the seciton "5 -- MIXED FLOW. Draw ANNOTATIONS 
[OPAQUE ONES] on ACTIVE PAINTER" - "draw StampAnnotation" [3]. So, 
rendered by okular, scrolling with the page - that's a bit closer to 
what you want. But otoh, those stamps are still only dumb QPixmaps, 
handled by the PageView widget.


Your popup note input dialog is a real independent widget (good so!) 
with user input logic + state. See class AnnotWindow, and 
PageView::openAnnotationWindow. This widget implements the "open state" 
of annotations, which is a term from PDF standard ISO 32000 [4]. Chapter 
12.5.1, "Annotations - General" describes the open and closed state in 
detail, I think that's a good reading for you.


Btw., I found README.internals.png [5] to be a brief and good overview 
of Okulars design when I first touched Okular.


Sorry for not providing concrete solution hints. Hopefully it helped to 
at least gain more insight into the problem.


Cheers
Tobias

[0] 
https://cgit.kde.org/okular.git/tree/generators/poppler/generator_pdf.cpp?h=v17.12.2#n950
[1] 
https://cgit.kde.org/okular.git/tree/ui/pagepainter.cpp?h=v17.12.2#n265

[2] https://bugs.kde.org/show_bug.cgi?id=383651
[3] 
https://cgit.kde.org/okular.git/tree/ui/pagepainter.cpp?h=v17.12.2#n741
[4] 
https://wwwimages2.adobe.com/content/dam/acom/en/devnet/pdf/PDF32000_2008.pdf

[5] https://cgit.kde.org/okular.git/tree/README.internals.png?h=v17.12.2



Need help regarding heading into the Okular Feature: 388450

2018-02-16 Thread Dileep Sankhla
Hello devs,

I have spent the past three days in heading into this feature request [1]
regarding scrolling the annotations along with the scrollbar and I have
been finding out how to unfix the position of the annotation window that
remains fixed to its position while scrolling the pageview.
I'm trying to get an idea from the annotations that remains glued to the
pageview and do scroll with the scrollbar and hence applying the same
approach ( and a bit of the similar code too) in order to achieve this on
the annotation window.
But now the problem is I'm confused inside the large codebase and I tried
to search for the keywords like "mouseMove", "scroll", "fixed"  but without
any success in finding the relevant section.
I also did minor tweaks and changes in order to understand the behavior but
until now, I'm nowhere.

I'm still searching but now I doubt my way of fixing a bug. Can you please
suggest me how to proceed to fix/implement the bug/feature and how to
search the code, inspect the Qt elements and all? What to do now?
I have read 'get started' guide but it doesn't emphasis on my own dilemma.

‌[1] https://bugs.kde.org/show_bug.cgi?id=388450

Thanks and Regards
Dileep