[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Review Request: Added Vast Scrolling ability to KoCanvasController
From: "Dmitry Kazakov" <dimula73 () gmail ! com>
Date: 2010-09-07 17:43:48
Message-ID: 20100907174348.3059.95315 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On 2010-09-06 18:31:18, Thomas Zander wrote:
> > /trunk/koffice/libs/flake/KoCanvasControllerWidget.h, line 300
> > <http://svn.reviewboard.kde.org/r/5257/diff/3/?file=35237#file35237line300>
> >
> > Passing a widgetPoint of tyep QPoint should use a const reference type to avoid \
> > copying the data unneeded. So; const QPoint &widgetPoint;
> >
> > I also see a big likeness to zoomBy() on the KoCanvasController. Can that one be \
> > used instead?
>
> Dmitry Kazakov wrote:
> QPoint. Good point! =)
>
> zoomBy() -- zooms document and scrolls it in such a way, that given point appears \
> in the center of the screen. zoomRelativeToPoint() -- is a convenience function, it \
> zooms relative to given point, so this point doesn't change it's place on the \
> screen.
> A special function is introduced, because it has to be overridden in \
> KisCanvasController to support canvas rotation.
> Thomas Zander wrote:
> Hmm, that probably is not the most readable API to have, though. Having two similar \
> methods doing something similar but the point you pass has a different \
> interpretation.
> zoomBy is also virtual so I'm thinking we can combine the two by just adding a \
> descriptive enum. Think of an enum here as just like a boolean, but readable (since \
> zoomBy(10, myPoint, false) is just not clear what it does). Something like;
> enum ZoomStyle { ZoomToCenter, ZoomRelativePoint };
> virtual void zoomBy(const QPointF &point, qreal zoom, ZoomStyle zoomStyle) = 0;
>
> Would that work?
This approach has several major issues:
1) zoomRelativeToPoint() is a wrapper above more general zoomBy() function. It is \
just a convenience function. 2) (in a consequence of 1) When someone decides to \
override zoomRelativeToPoint() in a child class (e.g. KisCanvasController), he will \
have to copy-paste entire zoomBy() function. This will lead to many \
code-duplications. 3) (the worst thing) zoomBy() uses d-pointer of the \
KoCanvasControllerWidget class, while zoomRelativeToPoint() doesn't. It means that \
child classes will have to access private members of a base class. I personally don't \
like this idea ;)
If you think it is not readable, maybe, we can rename this function somehow? Like \
.*Callback?
- Dmitry
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/5257/#review7433
-----------------------------------------------------------
On 2010-09-05 12:44:21, Dmitry Kazakov wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/5257/
> -----------------------------------------------------------
>
> (Updated 2010-09-05 12:44:21)
>
>
> Review request for KOffice.
>
>
> Summary
> -------
>
> BUG:189541
> This is a bugfix for a one of the most reported bugs.
> Now you can scroll the document in such a way, that the corners of the document are \
> placed in the middle of the screen.
> To achieve this i've removed some checks in KoCanvasController because all of them \
> are guaranteed by QScrollBar range limits and extracted one method to allow \
> KisCanvasController to override coordinates transformation.
> The patch needs some more testing with other KOffice applications.
>
>
> This addresses bug 189541.
> https://bugs.kde.org/show_bug.cgi?id=189541
>
>
> Diffs
> -----
>
> /trunk/koffice/krita/ui/canvas/kis_canvas2.cpp 1171532
> /trunk/koffice/krita/ui/canvas/kis_canvas_controller.h 1171532
> /trunk/koffice/krita/ui/canvas/kis_canvas_controller.cpp 1171532
> /trunk/koffice/krita/ui/canvas/kis_prescaled_projection.cpp 1171532
> /trunk/koffice/krita/ui/kis_config.h 1171532
> /trunk/koffice/krita/ui/kis_config.cc 1171532
> /trunk/koffice/krita/ui/kis_view2.cpp 1171532
> /trunk/koffice/libs/flake/KoCanvasControllerWidget.h 1171532
> /trunk/koffice/libs/flake/KoCanvasControllerWidget.cpp 1171551
>
> Diff: http://svn.reviewboard.kde.org/r/5257/diff
>
>
> Testing
> -------
>
>
> Thanks,
>
> Dmitry
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://svn.reviewboard.kde.org/r/5257/">http://svn.reviewboard.kde.org/r/5257/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On September 6th, 2010, 6:31 p.m., <b>Thomas \
Zander</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="/r/5257/diff/3/?file=35237#file35237line300" style="color: black; font-weight: \
bold; text-decoration: \
underline;">/trunk/koffice/libs/flake/KoCanvasControllerWidget.h</a> <span \
style="font-weight: normal;">
(Diff revision 3)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">protected:</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">300</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">virtual</span> <span class="kt">void</span> <span \
class="n">zoomRelativeToPoint</span><span class="p">(</span><span \
class="n">QPoint</span> <span class="n">widgetPoint</span><span class="p">,</span> \
<span class="n">qreal</span> <span class="n">zoomLevel</span><span \
class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Passing a widgetPoint of \
tyep QPoint should use a const reference type to avoid copying the data unneeded. So; \
const QPoint &widgetPoint;
I also see a big likeness to zoomBy() on the KoCanvasController. Can that one be \
used instead?</pre> </blockquote>
<p>On September 6th, 2010, 6:50 p.m., <b>Dmitry Kazakov</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">QPoint. Good point! =)
zoomBy() -- zooms document and scrolls it in such a way, that given point appears in \
the center of the screen. zoomRelativeToPoint() -- is a convenience function, it \
zooms relative to given point, so this point doesn't change it's place on the \
screen.
A special function is introduced, because it has to be overridden in \
KisCanvasController to support canvas rotation.</pre> </blockquote>
<p>On September 7th, 2010, 7:14 a.m., <b>Thomas Zander</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Hmm, that probably is \
not the most readable API to have, though. Having two similar methods doing something \
similar but the point you pass has a different interpretation.
zoomBy is also virtual so I'm thinking we can combine the two by just adding a \
descriptive enum. Think of an enum here as just like a boolean, but readable (since \
zoomBy(10, myPoint, false) is just not clear what it does). Something like;
enum ZoomStyle { ZoomToCenter, ZoomRelativePoint };
virtual void zoomBy(const QPointF &point, qreal zoom, ZoomStyle zoomStyle) = 0;
Would that work?</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This \
approach has several major issues: 1) zoomRelativeToPoint() is a wrapper above more \
general zoomBy() function. It is just a convenience function. 2) (in a consequence of \
1) When someone decides to override zoomRelativeToPoint() in a child class (e.g. \
KisCanvasController), he will have to copy-paste entire zoomBy() function. This will \
lead to many code-duplications. 3) (the worst thing) zoomBy() uses d-pointer of the \
KoCanvasControllerWidget class, while zoomRelativeToPoint() doesn't. It means \
that child classes will have to access private members of a base class. I personally \
don't like this idea ;)
If you think it is not readable, maybe, we can rename this function somehow? Like \
.*Callback? </pre> <br />
<p>- Dmitry</p>
<br />
<p>On September 5th, 2010, 12:44 p.m., Dmitry Kazakov wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for KOffice.</div>
<div>By Dmitry Kazakov.</div>
<p style="color: grey;"><i>Updated 2010-09-05 12:44:21</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">BUG:189541 This is a bugfix for a one of the most reported bugs.
Now you can scroll the document in such a way, that the corners of the document are \
placed in the middle of the screen.
To achieve this i've removed some checks in KoCanvasController because all of \
them are guaranteed by QScrollBar range limits and extracted one method to allow \
KisCanvasController to override coordinates transformation.
The patch needs some more testing with other KOffice applications.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://bugs.kde.org/show_bug.cgi?id=189541">189541</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/koffice/krita/ui/canvas/kis_canvas2.cpp <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/krita/ui/canvas/kis_canvas_controller.h <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/krita/ui/canvas/kis_canvas_controller.cpp <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/krita/ui/canvas/kis_prescaled_projection.cpp <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/krita/ui/kis_config.h <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/krita/ui/kis_config.cc <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/krita/ui/kis_view2.cpp <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/libs/flake/KoCanvasControllerWidget.h <span style="color: \
grey">(1171532)</span></li>
<li>/trunk/koffice/libs/flake/KoCanvasControllerWidget.cpp <span style="color: \
grey">(1171551)</span></li>
</ul>
<p><a href="http://svn.reviewboard.kde.org/r/5257/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic