[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    D4947: [KTextEditor] Expose additional internal View's functionality to the public API
From:       Milian Wolff <noreply () phabricator ! kde ! org>
Date:       2017-03-05 22:24:53
Message-ID: 20170305222453.91809.39475.5A529BF0 () phabricator ! kde ! org
[Download RAW message or body]

mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


  now that this API becomes public, it must be improved to make it better \
understandable to the public  
  and note that you cannot add new virtual methods to this interface, as it would \
break the ABI: https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
  You will have to create a separate interface for this, similar to what we have done \
in the past, with a TODO note that this should be merged in time for KF6.  
  I'm very much interested in your app btw - will you support embedding it into e.g. \
KDevelop as a patch viewer? Kompare is pretty much unmaintained, and I like what I \
see in your screenshot!

INLINE COMMENTS

> view.h:464
> +     */
> +    virtual void scrollPos(KTextEditor::Cursor &c) = 0;
> +

should be scrollToPos, c -> cursor, and make the cursor const

> view.h:471
> +     */
> +    virtual void scrollColumns(int x) = 0;
> +

scrollToColumn, x -> column

> view.h:479
> +     */
> +    virtual KTextEditor::Cursor maxStartPos() const = 0;
> +

why is this not the document end pos? because of virtual cursors? if so, please \
rename this to `viewEndCursor()` or similar, I don't see why this should be called \
`startPos`

> view.h:487
> +     */
> +    virtual int startLine() const = 0;
> +

firstVisibleLine

> view.h:495
> +     */
> +    virtual int endLine() const = 0;
> +

lastVisibleLine

> view.h:502
> +     */
> +    virtual QRect textareaRect() const = 0;
> /*

textAreaRect

> kateview.cpp:2557
> +
> +void KTextEditor::ViewPrivate::scrollColumns(int x) {
> +    m_viewInternal->scrollColumns(x);

here and below: put the { on its own line, like you did above

> kateview.cpp:2575
> +QRect KTextEditor::ViewPrivate::textareaRect() const {
> +    QRect rect = QRect(m_viewInternal->mapTo(this, \
> m_viewInternal->rect().topLeft()), m_viewInternal->mapTo(this, \
> m_viewInternal->rect().bottomRight())); +

const auto sourceRect = m_viewInternal->rect();
  const auto topLeft = m_viewInternal->mapTo(this, sourceRect.topLeft());
  const auto bottomRight = m_viewInternal->mapTo(this, sourceRect.bottomRight());
  return {topLeft, bottomRight};

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D4947

To: jsalatas, #ktexteditor, #frameworks, mwolff
Cc: mwolff, kwrite-devel


[Attachment #3 (text/html)]

<table><tr><td style="">mwolff requested changes to this revision.<br />mwolff added \
a comment.<br />This revision now requires changes to proceed. </td><a \
style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; \
color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; \
background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; \
border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4947" \
rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>now that this API \
becomes public, it must be improved to make it better understandable to the \
public</p>

<p>and note that you cannot add new virtual methods to this interface, as it would \
break the ABI: <a href="https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B" \
class="remarkup-link" target="_blank" \
rel="noreferrer">https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B</a><br \
/> You will have to create a separate interface for this, similar to what we have \
done in the past, with a TODO note that this should be merged in time for KF6.</p>

<p>I&#039;m very much interested in your app btw - will you support embedding it into \
e.g. KDevelop as a patch viewer? Kompare is pretty much unmaintained, and I like what \
I see in your screenshot!</p></div></div><br /><div><strong>INLINE \
COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px \
solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; \
border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div \
style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a \
style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D4947#inline-20074" rel="noreferrer">View \
Inline</a><span style="color: #4b4d51; font-weight: bold;">view.h:464</span></div> \
<div style="font: 11px/15px &quot;Menlo&quot;, &quot;Consolas&quot;, \
&quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: both; padding: 4px 0; \
margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span \
style="color: #74777d">     */</span> </div><div style="padding: 0 8px; margin: 0 \
4px; background: #d0ffd0;">    <span class="n">virtual</span> <span style="color: \
#aa4000">void</span> <span style="color: #004012">scrollPos</span><span \
class="p">(</span><span class="n">KTextEditor</span><span style="color: \
#aa2211">::</span><span class="n">Cursor</span> <span style="color: \
#aa2211">&amp;</span><span class="n">c</span><span class="p">)</span> <span \
style="color: #aa2211">=</span> <span style="color: #601200">0</span><span \
class="p">;</span> </div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: \
8px;">should be scrollToPos, c -&gt; cursor, and make the cursor \
const</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: \
3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; \
border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; \
background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; \
text-decoration: none;" href="https://phabricator.kde.org/D4947#inline-20075" \
rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: \
bold;">view.h:471</span></div> <div style="font: 11px/15px &quot;Menlo&quot;, \
&quot;Consolas&quot;, &quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: \
both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; \
background: #d0ffd0;"><span style="color: #74777d">     */</span> </div><div \
style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;">    <span \
class="n">virtual</span> <span style="color: #aa4000">void</span> <span style="color: \
#004012">scrollColumns</span><span class="p">(</span><span style="color: \
#aa4000">int</span> <span class="n">x</span><span class="p">)</span> <span \
style="color: #aa2211">=</span> <span style="color: #601200">0</span><span \
class="p">;</span> </div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: \
8px;">scrollToColumn, x -&gt; column</p></div></div><br /><div style="border: 1px \
solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; \
border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div \
style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a \
style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D4947#inline-20076" rel="noreferrer">View \
Inline</a><span style="color: #4b4d51; font-weight: bold;">view.h:479</span></div> \
<div style="font: 11px/15px &quot;Menlo&quot;, &quot;Consolas&quot;, \
&quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: both; padding: 4px 0; \
margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span \
style="color: #74777d">     */</span> </div><div style="padding: 0 8px; margin: 0 \
4px; background: #d0ffd0;">    <span class="n">virtual</span> <span \
class="n">KTextEditor</span><span style="color: #aa2211">::</span><span \
class="n">Cursor</span> <span class="n">maxStartPos</span><span class="p">()</span> \
<span style="color: #aa4000">const</span> <span style="color: #aa2211">=</span> <span \
style="color: #601200">0</span><span class="p">;</span> </div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">why \
is this not the document end pos? because of virtual cursors? if so, please rename \
this to <tt style="background: #ebebeb; font-size: 13px;">viewEndCursor()</tt> or \
similar, I don&#039;t see why this should be called <tt style="background: #ebebeb; \
font-size: 13px;">startPos</tt></p></div></div><br /><div style="border: 1px solid \
#C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; \
border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div \
style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a \
style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D4947#inline-20077" rel="noreferrer">View \
Inline</a><span style="color: #4b4d51; font-weight: bold;">view.h:487</span></div> \
<div style="font: 11px/15px &quot;Menlo&quot;, &quot;Consolas&quot;, \
&quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: both; padding: 4px 0; \
margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span \
style="color: #74777d">     */</span> </div><div style="padding: 0 8px; margin: 0 \
4px; background: #d0ffd0;">    <span class="n">virtual</span> <span style="color: \
#aa4000">int</span> <span style="color: #004012">startLine</span><span \
class="p">()</span> <span style="color: #aa4000">const</span> <span style="color: \
#aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> \
</div></div></div> <div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; \
margin: 8px;">firstVisibleLine</p></div></div><br /><div style="border: 1px solid \
#C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; \
border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div \
style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a \
style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D4947#inline-20078" rel="noreferrer">View \
Inline</a><span style="color: #4b4d51; font-weight: bold;">view.h:495</span></div> \
<div style="font: 11px/15px &quot;Menlo&quot;, &quot;Consolas&quot;, \
&quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: both; padding: 4px 0; \
margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span \
style="color: #74777d">     */</span> </div><div style="padding: 0 8px; margin: 0 \
4px; background: #d0ffd0;">    <span class="n">virtual</span> <span style="color: \
#aa4000">int</span> <span style="color: #004012">endLine</span><span \
class="p">()</span> <span style="color: #aa4000">const</span> <span style="color: \
#aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> \
</div></div></div> <div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; \
margin: 8px;">lastVisibleLine</p></div></div><br /><div style="border: 1px solid \
#C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; \
border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div \
style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a \
style="float: right; text-decoration: none;" \
href="https://phabricator.kde.org/D4947#inline-20079" rel="noreferrer">View \
Inline</a><span style="color: #4b4d51; font-weight: bold;">view.h:502</span></div> \
<div style="font: 11px/15px &quot;Menlo&quot;, &quot;Consolas&quot;, \
&quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: both; padding: 4px 0; \
margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: #d0ffd0;"><span \
style="color: #74777d">     */</span> </div><div style="padding: 0 8px; margin: 0 \
4px; background: #d0ffd0;">    <span class="n">virtual</span> <span \
class="n">QRect</span> <span style="color: #004012">textareaRect</span><span \
class="p">()</span> <span style="color: #aa4000">const</span> <span style="color: \
#aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> \
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: \
#aa2211">/*</span> </div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: \
8px;">textAreaRect</p></div></div><br /><div style="border: 1px solid #C7CCD9; \
border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: \
#e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: \
#74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: \
right; text-decoration: none;" href="https://phabricator.kde.org/D4947#inline-20080" \
rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: \
bold;">kateview.cpp:2557</span></div> <div style="font: 11px/15px &quot;Menlo&quot;, \
&quot;Consolas&quot;, &quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: \
both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; \
background: #d0ffd0;"><span style="color: #aa4000">void</span> <span \
class="n">KTextEditor</span><span style="color: #aa2211">::</span><span \
class="n">ViewPrivate</span><span style="color: #aa2211">::</span><span \
class="n">scrollColumns</span><span class="p">(</span><span style="color: \
#aa4000">int</span> <span class="n">x</span><span class="p">)</span> <span \
class="p">{</span> </div><div style="padding: 0 8px; margin: 0 4px; background: \
#d0ffd0;">    <span class="n">m_viewInternal</span><span style="color: \
#aa2211">-&gt;</span><span class="n">scrollColumns</span><span \
class="p">(</span><span class="n">x</span><span class="p">);</span> \
</div></div></div> <div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; \
margin: 8px;">here and below: put the { on its own line, like you did \
above</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: \
3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; \
border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; \
background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; \
text-decoration: none;" href="https://phabricator.kde.org/D4947#inline-20081" \
rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: \
bold;">kateview.cpp:2575</span></div> <div style="font: 11px/15px &quot;Menlo&quot;, \
&quot;Consolas&quot;, &quot;Monaco&quot;, monospace; white-space: pre-wrap; clear: \
both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; \
background: #d0ffd0;"><span class="n">QRect</span> <span \
class="n">KTextEditor</span><span style="color: #aa2211">::</span><span \
class="n">ViewPrivate</span><span style="color: #aa2211">::</span><span \
class="n">textareaRect</span><span class="p">()</span> <span style="color: \
#aa4000">const</span> <span class="p">{</span> </div><div style="padding: 0 8px; \
margin: 0 4px; background: #d0ffd0;">    <span class="n">QRect</span> <span \
class="n">rect</span> <span style="color: #aa2211">=</span> <span \
class="n">QRect</span><span class="p">(</span><span \
class="n">m_viewInternal</span><span style="color: #aa2211">-&gt;</span><span \
class="n">mapTo</span><span class="p">(</span><span style="color: \
#aa4000">this</span><span class="p">,</span> <span \
class="n">m_viewInternal</span><span style="color: #aa2211">-&gt;</span><span \
class="n">rect</span><span class="p">().</span><span class="n">topLeft</span><span \
class="p">()),</span> <span class="n">m_viewInternal</span><span style="color: \
#aa2211">-&gt;</span><span class="n">mapTo</span><span class="p">(</span><span \
style="color: #aa4000">this</span><span class="p">,</span> <span \
class="n">m_viewInternal</span><span style="color: #aa2211">-&gt;</span><span \
class="n">rect</span><span class="p">().</span><span \
class="n">bottomRight</span><span class="p">()));</span> </div></div></div>
<div style="margin: 8px 0; padding: 0 12px;">

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" \
data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px \
&quot;Menlo&quot;, &quot;Consolas&quot;, &quot;Monaco&quot;, monospace; padding: \
12px; margin: 0; background: rgba(71, 87, 120, 0.08);">const auto sourceRect = \
m_viewInternal-&gt;rect(); const auto topLeft = m_viewInternal-&gt;mapTo(this, \
sourceRect.topLeft()); const auto bottomRight = m_viewInternal-&gt;mapTo(this, \
sourceRect.bottomRight()); return {topLeft, \
bottomRight};</pre></div></div></div></div></div></div><br \
/><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br \
/><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D4947" \
rel="noreferrer">https://phabricator.kde.org/D4947</a></div></div><br \
/><div><strong>To: </strong>jsalatas, KTextEditor, Frameworks, mwolff<br \
/><strong>Cc: </strong>mwolff, kwrite-devel<br /></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic