<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : [solved] Problem with the &quot;Prev Bookmark&quot;</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Syntax Edit : [solved] Problem with the &quot;Prev Bookmark&quot;]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 20:12:04 +0000</pubDate>
  <lastBuildDate>Sat, 04 Nov 2017 00:26:02 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=23149</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[[solved] Problem with the &quot;Prev Bookmark&quot; : Hello Matsu,I&amp;#039;m finally finish...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23149&amp;PID=76251&amp;title=solved-problem-with-the-prev-bookmark#76251</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=8730">olebed</a><br /><strong>Subject:</strong> 23149<br /><strong>Posted:</strong> 04 November 2017 at 12:26am<br /><br /><span style=": rgb248, 248, 252;">Hello Matsu,</span><br style=": rgb248, 248, 252;"><br>I'm finally finish this task!<br>Problem was in changing range of return values of method CXTPSyntaxEditCtrl::CalculateVisibleRow() some time ago. PrevBookmark() and NextBookmark() expected negative values for rows which are before visible rows. After changes there no difference between first visible row (relative number '1') and any row which higher than first visible row - CalculateVisibleRow() returns also '1'.<br><br>I have found out that only PrevBookmark() and NextBookmark()&nbsp; need these negative values, so we need to add new method.<table width="99%"><tr><td><pre class="BBcode">int <b>CXTPSyntaxEditCtrl::CalculateVisibleRow</b>(int nStartDocumentRow, int nDocumentRow)<div>{</div><div>&nbsp; &nbsp; <b><font color="#00cc00">return max(CalculateVisibleRow_(nStartDocumentRow, nDocumentRow), 1);</font></b></div><div><b><font color="#00cc00">}</font></b></div><div><b><font color="#00cc00"><br></font></b></div><div><b><font color="#00cc00">int CXTPSyntaxEditCtrl::CalculateVisibleRow_(int nStartDocumentRow, int nDocumentRow)</font></b></div><div><b><font color="#00cc00">{</font></b></div><div>&nbsp; &nbsp; int nVisRow = nDocumentRow - nStartDocumentRow + 1;</div><div>&nbsp; &nbsp; int nNextCollapsedRow = nStartDocumentRow - 1;</div><div>&nbsp; &nbsp; const int nRowCount = GetRowCount();</div><div><br></div><div>&nbsp; &nbsp; POSITION pos = GetLineMarksManager()-&gt;FindNextLineMark(nNextCollapsedRow, xtpEditLMT_Collapsed);</div><div>&nbsp; &nbsp; while (pos != NULL)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; XTP_EDIT_LMDATA* pData = GetLineMarksManager()-&gt;GetNextLineMark(pos, xtpEditLMT_Collapsed);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if (pData &amp;&amp; pData-&gt;m_nRow &gt;= nNextCollapsedRow) // mark should be not within previous collapsed block</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (pData-&gt;m_nRow &gt;= nDocumentRow) // finish if mark is greater then row to calculate for</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XTP_EDIT_COLLAPSEDBLOCK* pCoDBlk = (XTP_EDIT_COLLAPSEDBLOCK*)pData-&gt;m_Param.GetPtr();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!pCoDBlk)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;</div><div><br></div><div><b style=""><font color="#00cc00">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int nBlkEnd = min(nRowCount, pCoDBlk-&gt;collBlock.lcEnd.nLine);</font></b></div><div><b><font color="#00cc00">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (nBlkEnd &gt; nDocumentRow)</font></b></div><div><b><font color="#00cc00">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nBlkEnd = nDocumentRow;&nbsp; &nbsp; &nbsp; &nbsp; // DocumentRow in invisible(collapsed) block</font></b></div><div><b><font color="#00cc00">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></b></div><div><b style=""><font color="#00cc00">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int nHiddenRows = nBlkEnd - pCoDBlk-&gt;collBlock.lcStart.nLine;</font></b></div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nVisRow -= nHiddenRows;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nNextCollapsedRow = pData-&gt;m_nRow + nHiddenRows;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div>&nbsp;<font color="#00cc00"> &nbsp;<b> return nVisRow;</b></font></div><div>}</div><div><br></div><div>void <b>CXTPSyntaxEditCtrl::PrevBookmark</b>()</div><div>{</div><div>&nbsp; &nbsp; CXTPSyntaxEditLineMarksManager* pMgr = GetLineMarksManager();</div><div>&nbsp; &nbsp; if (!pMgr)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ASSERT(FALSE);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return;</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; int nRow = GetCurRow();</div><div>&nbsp; &nbsp; int nVisRow = <b><font color="#00cc00">CalculateVisibleRow_(m_nTopRow, GetCurrentDocumentRow());</font></b></div><div><br></div><div>&nbsp; &nbsp; // move up to the prev bookmark before the current collapsed block area</div><div>&nbsp; &nbsp; int nPrevRow = nRow;</div><div>&nbsp; &nbsp; do {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; pMgr-&gt;FindPrevLineMark(--nPrevRow, xtpEditLMT_Bookmark);</div><div>&nbsp; &nbsp; } while (nPrevRow &gt; 0 &amp;&amp; <b><font color="#00cc00">CalculateVisibleRow_(m_nTopRow, nPrevRow)</font></b> == nVisRow);</div><div><br></div><div>&nbsp; &nbsp; if (nPrevRow &lt; 0)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; POSITION posLast = pMgr-&gt;GetLastLineMark(xtpEditLMT_Bookmark);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; XTP_EDIT_LMDATA* pData = pMgr-&gt;GetLineMarkAt(posLast, xtpEditLMT_Bookmark);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; nPrevRow = pData ? pData-&gt;m_nRow : -1;</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; if (<b><font color="#00cc00">CalculateVisibleRow_(m_nTopRow, nPrevRow)</font></b> == nVisRow)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; nPrevRow = -1;</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; if (nPrevRow &gt;= 0)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; SetCurPos(nPrevRow, 1);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; Invalidate(FALSE);</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>void <b>CXTPSyntaxEditCtrl::NextBookmark</b>()</div><div>{</div><div>&nbsp; &nbsp; CXTPSyntaxEditLineMarksManager* pMgr = GetLineMarksManager();</div><div>&nbsp; &nbsp; if (!pMgr)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ASSERT(FALSE);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return;</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; int nRow = GetCurRow();</div><div>&nbsp; &nbsp; int nVisRow = <b><font color="#00cc00">CalculateVisibleRow_(m_nTopRow, GetCurrentDocumentRow())</font></b>;</div><div><br></div><div>&nbsp; &nbsp; // move down to the next bookmark after the current collapsed block area</div><div>&nbsp; &nbsp; int nNextRow = nRow;</div><div>&nbsp; &nbsp; do {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; pMgr-&gt;FindNextLineMark(++nNextRow, xtpEditLMT_Bookmark);</div><div>&nbsp; &nbsp; } while (nNextRow &gt; 0 &amp;&amp; <b><font color="#00cc00">CalculateVisibleRow_(m_nTopRow, nNextRow)</font></b> == nVisRow);</div><div><br></div><div>&nbsp; &nbsp; if (nNextRow &lt; 0)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; // find first line mark</div><div>&nbsp; &nbsp; &nbsp; &nbsp; POSITION posFirst = pMgr-&gt;GetFirstLineMark(xtpEditLMT_Bookmark);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; XTP_EDIT_LMDATA* pData = pMgr-&gt;GetNextLineMark(posFirst, xtpEditLMT_Bookmark);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; nNextRow = pData ? pData-&gt;m_nRow : -1;</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; if (<b><font color="#00cc00">CalculateVisibleRow_(m_nTopRow, nNextRow)</font></b> == nVisRow)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; nNextRow = -1;</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; if (nNextRow &gt;= 0)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; SetCurPos(nNextRow, 1);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; Invalidate(FALSE);</div><div>&nbsp; &nbsp; }</div>}</pre></td></tr></table><br>Also as you can see in new&nbsp;<b style="font-family: &quot;Courier New&quot;, Courier, mono; white-space: pre; : rgb244, 244, 251;"><font color="#00cc00">CalculateVisibleRow_() </font></b>I have&nbsp;fixed navigation by bookmarks when bookmark within collapsed block. Before this cursor was set under collapsed block, not on it's own line.<br><br>Unfortunately I'm not sure that this fix will be included in the nearest release.<br><br style=": rgb248, 248, 252;"><span style=": rgb248, 248, 252;">Regards,</span><br style=": rgb248, 248, 252;"><span style=": rgb248, 248, 252;">&nbsp;Oleksandr&nbsp;</span><span style=": rgb248, 248, 252; line-height: 16.8px;">Lebed</span>]]>
   </description>
   <pubDate>Sat, 04 Nov 2017 00:26:02 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23149&amp;PID=76251&amp;title=solved-problem-with-the-prev-bookmark#76251</guid>
  </item> 
  <item>
   <title><![CDATA[[solved] Problem with the &quot;Prev Bookmark&quot; : Hello Matsu,Thank you for information....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23149&amp;PID=75189&amp;title=solved-problem-with-the-prev-bookmark#75189</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=8730">olebed</a><br /><strong>Subject:</strong> 23149<br /><strong>Posted:</strong> 07 October 2016 at 10:37am<br /><br />Hello Matsu,<br><br>Thank you for information. Problem in method&nbsp;CXTPSyntaxEditCtrl::PrevBookmark().<br><br>I also found issue with CXTPSyntaxEditCtrl::NextBookmark() &nbsp;- if cursor is in some invisible top line (but with bottom lines works fine) &nbsp;then it start searching next bookmark from first visible line.<br><br>I have added this issue to our bugs base.<br><br>Regards,<br>&nbsp;Oleksandr&nbsp;<span style="line-height: 16.8px;">Lebed</span>]]>
   </description>
   <pubDate>Fri, 07 Oct 2016 10:37:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23149&amp;PID=75189&amp;title=solved-problem-with-the-prev-bookmark#75189</guid>
  </item> 
  <item>
   <title><![CDATA[[solved] Problem with the &quot;Prev Bookmark&quot; : I&amp;#039;m using ToolkitPro v 17.2...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23149&amp;PID=75173&amp;title=solved-problem-with-the-prev-bookmark#75173</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9082">Matsu</a><br /><strong>Subject:</strong> 23149<br /><strong>Posted:</strong> 04 October 2016 at 4:18am<br /><br />I'm using ToolkitPro v 17.2 with VisualStudio 2010.<br /><br />At MDITextEditor.exe in sample.<br />After open the 100 lines text file, set some book mark(1 line,10 line,20 line,50 line and 90 line),select the last line and click "Prev Bookmark " button then the carret can be moved 10 line, 20 line, 50line and 90 l ine but can't be moved 1 line.<br /><br />Thanks.]]>
   </description>
   <pubDate>Tue, 04 Oct 2016 04:18:03 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23149&amp;PID=75173&amp;title=solved-problem-with-the-prev-bookmark#75173</guid>
  </item> 
 </channel>
</rss>