PageRenderTime 60ms CodeModel.GetById 47ms app.highlight 11ms RepoModel.GetById 0ms app.codeStats 1ms

/jEdit/tags/jedit-4-0-pre3/org/gjt/sp/jedit/options/TextAreaOptionPane.java

#
Java | 157 lines | 98 code | 19 blank | 40 comment | 0 complexity | ca7c0a9083e2cf98a2d04fe7d29019e5 MD5 | raw file
  1/*
  2 * TextAreaOptionPane.java - Text area options panel
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 1998, 1999, 2000 Slava Pestov
  7 *
  8 * This program is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License
 10 * as published by the Free Software Foundation; either version 2
 11 * of the License, or any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 21 */
 22
 23package org.gjt.sp.jedit.options;
 24
 25//{{{ Imports
 26import javax.swing.*;
 27import java.awt.*;
 28import org.gjt.sp.jedit.gui.FontSelector;
 29import org.gjt.sp.jedit.*;
 30//}}}
 31
 32public class TextAreaOptionPane extends AbstractOptionPane
 33{
 34	//{{{ TextAreaOptionPane constructor
 35	public TextAreaOptionPane()
 36	{
 37		super("textarea");
 38	} //}}}
 39
 40	//{{{ _init() method
 41	public void _init()
 42	{
 43		/* Font */
 44		font = new FontSelector(jEdit.getFontProperty("view.font"));
 45
 46		addComponent(jEdit.getProperty("options.textarea.font"),font);
 47
 48		/* Line highlight */
 49		lineHighlight = new JCheckBox(jEdit.getProperty("options.textarea"
 50			+ ".lineHighlight"));
 51		lineHighlight.setSelected(jEdit.getBooleanProperty("view.lineHighlight"));
 52		addComponent(lineHighlight);
 53
 54		/* Bracket highlight */
 55		bracketHighlight = new JCheckBox(jEdit.getProperty("options.textarea"
 56			+ ".bracketHighlight"));
 57		bracketHighlight.setSelected(jEdit.getBooleanProperty(
 58			"view.bracketHighlight"));
 59		addComponent(bracketHighlight);
 60
 61		/* EOL markers */
 62		eolMarkers = new JCheckBox(jEdit.getProperty("options.textarea"
 63			+ ".eolMarkers"));
 64		eolMarkers.setSelected(jEdit.getBooleanProperty("view.eolMarkers"));
 65		addComponent(eolMarkers);
 66
 67		/* Wrap guide */
 68		wrapGuide = new JCheckBox(jEdit.getProperty("options.textarea"
 69			+ ".wrapGuide"));
 70		wrapGuide.setSelected(jEdit.getBooleanProperty("view.wrapGuide"));
 71		addComponent(wrapGuide);
 72
 73		/* Blinking caret */
 74		blinkCaret = new JCheckBox(jEdit.getProperty("options.textarea"
 75			+ ".blinkCaret"));
 76		blinkCaret.setSelected(jEdit.getBooleanProperty("view.caretBlink"));
 77		addComponent(blinkCaret);
 78
 79		/* Block caret */
 80		blockCaret = new JCheckBox(jEdit.getProperty("options.textarea"
 81			+ ".blockCaret"));
 82		blockCaret.setSelected(jEdit.getBooleanProperty("view.blockCaret"));
 83		addComponent(blockCaret);
 84
 85		/* Electric borders */
 86		electricBorders = new JCheckBox(jEdit.getProperty("options.textarea"
 87			+ ".electricBorders"));
 88		electricBorders.setSelected(!"0".equals(jEdit.getProperty(
 89			"view.electricBorders")));
 90		addComponent(electricBorders);
 91
 92		/* Smart home/end */
 93		homeEnd = new JCheckBox(jEdit.getProperty("options.textarea"
 94			+ ".homeEnd"));
 95		homeEnd.setSelected(jEdit.getBooleanProperty("view.homeEnd"));
 96		addComponent(homeEnd);
 97
 98		/* Middle mouse button click pastes % register */
 99		middleMousePaste = new JCheckBox(jEdit.getProperty("options.textarea"
100			+ ".middleMousePaste"));
101		middleMousePaste.setSelected(jEdit.getBooleanProperty(
102			"view.middleMousePaste"));
103		addComponent(middleMousePaste);
104
105		/* Anti-aliasing */
106		antiAlias = new JCheckBox(jEdit.getProperty("options.textarea"
107			+ ".antiAlias"));
108		antiAlias.setSelected(jEdit.getBooleanProperty("view.antiAlias"));
109		addComponent(antiAlias);
110
111		/* Fractional font metrics */
112		fracFontMetrics = new JCheckBox(jEdit.getProperty("options.textarea"
113			+ ".fracFontMetrics"));
114		fracFontMetrics.setSelected(jEdit.getBooleanProperty(
115			"view.fracFontMetrics"));
116		addComponent(fracFontMetrics);
117	} //}}}
118
119	//{{{ _save() method
120	public void _save()
121	{
122		jEdit.setFontProperty("view.font",font.getFont());
123
124		jEdit.setBooleanProperty("view.lineHighlight",lineHighlight
125			.isSelected());
126		jEdit.setBooleanProperty("view.bracketHighlight",bracketHighlight
127			.isSelected());
128		jEdit.setBooleanProperty("view.eolMarkers",eolMarkers
129			.isSelected());
130		jEdit.setBooleanProperty("view.wrapGuide",wrapGuide
131			.isSelected());
132		jEdit.setBooleanProperty("view.caretBlink",blinkCaret.isSelected());
133		jEdit.setBooleanProperty("view.blockCaret",blockCaret.isSelected());
134		jEdit.setIntegerProperty("view.electricBorders",electricBorders
135			.isSelected() ? 3 : 0);
136		jEdit.setBooleanProperty("view.homeEnd",homeEnd.isSelected());
137		jEdit.setBooleanProperty("view.middleMousePaste",
138			middleMousePaste.isSelected());
139		jEdit.setBooleanProperty("view.antiAlias",antiAlias.isSelected());
140		jEdit.setBooleanProperty("view.fracFontMetrics",fracFontMetrics.isSelected());
141	} //}}}
142
143	//{{{ Private members
144	private FontSelector font;
145	private JCheckBox lineHighlight;
146	private JCheckBox bracketHighlight;
147	private JCheckBox eolMarkers;
148	private JCheckBox wrapGuide;
149	private JCheckBox blinkCaret;
150	private JCheckBox blockCaret;
151	private JCheckBox electricBorders;
152	private JCheckBox homeEnd;
153	private JCheckBox middleMousePaste;
154	private JCheckBox antiAlias;
155	private JCheckBox fracFontMetrics;
156	//}}}
157}