PageRenderTime 87ms CodeModel.GetById 82ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/textarea/TriangleFoldPainter.java

#
Java | 74 lines | 41 code | 6 blank | 27 comment | 1 complexity | 89d5168ec8be2df7550771724b346124 MD5 | raw file
 1/*
 2 * TriangleFoldPainter.java
 3 * :tabSize=8:indentSize=8:noTabs=false:
 4 * :folding=explicit:collapseFolds=0:
 5 *
 6 * Copyright (C) 1999, 2000 mike dillon
 7 * Portions copyright (C) 2001, 2002 Slava Pestov
 8 * Refactoring copyright (C) 2008 Shlomy Reinstein
 9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23 */
24
25package org.gjt.sp.jedit.textarea;
26
27import java.awt.Graphics2D;
28import org.gjt.sp.jedit.buffer.JEditBuffer;
29
30// {{{ class TriangleFoldHandler
31public class TriangleFoldPainter implements FoldPainter
32{
33	// {{{ paintFoldStart()
34	public void paintFoldStart(Gutter gutter, Graphics2D gfx, int screenLine,
35			int physicalLine, boolean nextLineVisible, int y, int lineHeight,
36			JEditBuffer buffer)
37	{
38		int _y = y + lineHeight / 2;
39		gfx.setColor(gutter.getFoldColor());
40		if (nextLineVisible)
41		{
42			gfx.drawLine(1,_y - 3,10,_y - 3);
43			gfx.drawLine(2,_y - 2,9,_y - 2);
44			gfx.drawLine(3,_y - 1,8,_y - 1);
45			gfx.drawLine(4,_y,7,_y);
46			gfx.drawLine(5,_y + 1,6,_y + 1);
47		}
48		else
49		{
50			gfx.drawLine(4,_y - 5,4,_y + 4);
51			gfx.drawLine(5,_y - 4,5,_y + 3);
52			gfx.drawLine(6,_y - 3,6,_y + 2);
53			gfx.drawLine(7,_y - 2,7,_y + 1);
54			gfx.drawLine(8,_y - 1,8,_y);
55		}
56	} // }}}
57
58	// {{{ paintFoldEnd()
59	public void paintFoldEnd(Gutter gutter, Graphics2D gfx, int screenLine,
60			int physicalLine, int y, int lineHeight, JEditBuffer buffer)
61	{
62		gfx.setColor(gutter.getFoldColor());
63		int _y = y + lineHeight / 2;
64		gfx.drawLine(4,_y,4,_y + 3);
65		gfx.drawLine(4,_y + 3,7,_y + 3);
66	} // }}}
67
68	// {{{ paintFoldMiddle()
69	public void paintFoldMiddle(Gutter gutter, Graphics2D gfx, int screenLine,
70			int physicalLine, int y, int lineHeight, JEditBuffer buffer)
71	{
72	} // }}}
73
74}// }}}