PageRenderTime 109ms CodeModel.GetById 100ms app.highlight 6ms RepoModel.GetById 0ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/42docs/news42/textarea-api.html

#
HTML | 53 lines | 53 code | 0 blank | 0 comment | 0 complexity | 1d4357a4910c693080392e1a059b0fb4 MD5 | raw file
 1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Text Area and Folding</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="What's New in jEdit 4.2"><link rel="up" href="api-changes.html" title="Chapter 2. API Changes"><link rel="previous" href="syntax-api.html" title="Syntax Highlighting"><link rel="next" href="misc-api-changes.html" title="Miscellaneous API Changes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Text Area and Folding</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="syntax-api.html">Prev</a> </td><th width="60%" align="center">Chapter 2. API Changes</th><td width="20%" align="right"> <a accesskey="n" href="misc-api-changes.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="textarea-api"></a>Text Area and Folding</h2></div></div><div></div></div><p>The
 2		<a href="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html" target="_top">JEditTextArea</a>
 3		class has a new <tt class="function">addToLeftOfScrollBar()</tt> method that
 4		adds a component to the left of the scroll bar. Previously plugins like
 5		JDiff had to resort to undocumented hacks to do this.
 6	</p><p>
 7		The code that displays lines of text on screen has been overhauled for
 8		improved performance and correctness. As a result, two methods in
 9		<a href="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html" target="_top">JEditTextArea</a>
10		that have been deprecated since jEdit 4.0 were removed:
11	</p><div class="itemizedlist"><ul type="disc"><li><p><tt class="function">xToOffset()</tt></p></li><li><p><tt class="function">offsetToX()</tt></p></li></ul></div><p>
12		As in jEdit 4.0 and 4.1, the <tt class="function">xyToOffset()</tt> and
13		<tt class="function">offseToXY()</tt> methods replace these two.
14	</p><p>
15		Also, the way folds are handled has changed. The
16		<tt class="classname">FoldVisibilityManager</tt> class has been removed,
17		and a number of methods in the <a href="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html" target="_top">JEditTextArea</a>
18		class have been removed also:
19	</p><div class="itemizedlist"><ul type="disc"><li><p><tt class="function">virtualToPhysical()</tt></p></li><li><p><tt class="function">physicalToVirtual()</tt></p></li><li><p><tt class="function">getVirtualLineCount()</tt></p></li></ul></div><p>
20		The replacement for the <tt class="classname">FoldVisibilityManager</tt>
21		class is a class named <a href="../api/org/gjt/sp/jedit/io/DisplayManager.html" target="_top">DisplayManager</a>,
22		with a similar but not identical API.
23	</p><p>
24		Previously, a &#8220;<span class="quote">virtual line number</span>&#8221; was a line number such
25		that each physical line (delimited by <tt class="literal">\n</tt>) counted
26		as 1 if it was visible, and 0 if it was not. They did not take into
27		account lines that were split on screen as a result of soft wrap, and
28		this made the soft wrap scrolling code rather complicated.
29	</p><p>
30		In jEdit 4.2, virtual line numbers are no longer used internally; now,
31		similar &#8220;<span class="quote">scroll line numbers</span>&#8221; are used. Scroll line numbers
32		take both hidden lines and soft wrap into account. The
33		<tt class="function">getFirstLine()</tt> and
34		<tt class="function">setFirstLine()</tt> methods of the
35		<a href="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html" target="_top">JEditTextArea</a>
36		class now work with
37		scroll line numbers.
38	</p><p>
39		An internal API for converting between scroll line numbers and physical
40		line numbers exists, but it is rather complicated and it will not be
41		made public. Instead, if you want the text area to scroll to a given
42		physical line number, use the new
43		<tt class="function">setFirstPhysicalLine()</tt> method in the
44		<a href="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html" target="_top">JEditTextArea</a>
45		class.
46	</p><p>
47		Instead of calling <tt class="function">FoldHandler.registerFoldHandler()</tt>
48		in your
49		plugin's <tt class="function">start()</tt> method, add entries in the
50		<tt class="filename">services.xml</tt> file that look like so:
51	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">&lt;SERVICE CLASS="org.gjt.sp.jedit.buffer.FoldHandler" NAME="sidekick"&gt;
52    new sidekick.SideKickFoldHandler()
53&lt;/SERVICE&gt;</pre></td></tr></table></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="syntax-api.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="api-changes.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="misc-api-changes.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Syntax Highlighting </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Miscellaneous API Changes</td></tr></table></div></body></html>