PageRenderTime 44ms CodeModel.GetById 15ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. package org.gjt.sp.jedit.textarea;
  25. import java.awt.Graphics2D;
  26. import org.gjt.sp.jedit.buffer.JEditBuffer;
  27. // {{{ class TriangleFoldHandler
  28. public class TriangleFoldPainter implements FoldPainter
  29. {
  30. // {{{ paintFoldStart()
  31. public void paintFoldStart(Gutter gutter, Graphics2D gfx, int screenLine,
  32. int physicalLine, boolean nextLineVisible, int y, int lineHeight,
  33. JEditBuffer buffer)
  34. {
  35. int _y = y + lineHeight / 2;
  36. gfx.setColor(gutter.getFoldColor());
  37. if (nextLineVisible)
  38. {
  39. gfx.drawLine(1,_y - 3,10,_y - 3);
  40. gfx.drawLine(2,_y - 2,9,_y - 2);
  41. gfx.drawLine(3,_y - 1,8,_y - 1);
  42. gfx.drawLine(4,_y,7,_y);
  43. gfx.drawLine(5,_y + 1,6,_y + 1);
  44. }
  45. else
  46. {
  47. gfx.drawLine(4,_y - 5,4,_y + 4);
  48. gfx.drawLine(5,_y - 4,5,_y + 3);
  49. gfx.drawLine(6,_y - 3,6,_y + 2);
  50. gfx.drawLine(7,_y - 2,7,_y + 1);
  51. gfx.drawLine(8,_y - 1,8,_y);
  52. }
  53. } // }}}
  54. // {{{ paintFoldEnd()
  55. public void paintFoldEnd(Gutter gutter, Graphics2D gfx, int screenLine,
  56. int physicalLine, int y, int lineHeight, JEditBuffer buffer)
  57. {
  58. gfx.setColor(gutter.getFoldColor());
  59. int _y = y + lineHeight / 2;
  60. gfx.drawLine(4,_y,4,_y + 3);
  61. gfx.drawLine(4,_y + 3,7,_y + 3);
  62. } // }}}
  63. // {{{ paintFoldMiddle()
  64. public void paintFoldMiddle(Gutter gutter, Graphics2D gfx, int screenLine,
  65. int physicalLine, int y, int lineHeight, JEditBuffer buffer)
  66. {
  67. } // }}}
  68. }// }}}