001: /*
002: * StatusBarOptionPane.java - Status Bar options panel
003: * :tabSize=8:indentSize=8:noTabs=false:
004: * :folding=explicit:collapseFolds=1:
005: * Copyright (C) 2002 Kenrick Drew
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: */
021:
022: package org.gjt.sp.jedit.options;
023:
024: //{{{ Imports
025: import javax.swing.*;
026: import java.awt.event.*;
027: import java.awt.*;
028: import org.gjt.sp.jedit.gui.ColorWellButton;
029: import org.gjt.sp.jedit.*;
030:
031: //}}}
032:
033: public class StatusBarOptionPane extends AbstractOptionPane {
034: //{{{ StatusBarOptionPane constructor
035: public StatusBarOptionPane() {
036: super ("status");
037: } //}}}
038:
039: //{{{ _init() method
040: protected void _init() {
041: /* Status bar visible */
042: statusVisible = new JCheckBox(jEdit
043: .getProperty("options.status.visible"));
044: statusVisible.setSelected(jEdit
045: .getBooleanProperty("view.status.visible"));
046: statusVisible.addActionListener(new ActionHandler());
047: addComponent(statusVisible);
048:
049: /* Foreground color */
050: addComponent(jEdit.getProperty("options.status.foreground"),
051: foregroundColor = new ColorWellButton(jEdit
052: .getColorProperty("view.status.foreground")),
053: GridBagConstraints.VERTICAL);
054:
055: /* Background color */
056: addComponent(jEdit.getProperty("options.status.background"),
057: backgroundColor = new ColorWellButton(jEdit
058: .getColorProperty("view.status.background")),
059: GridBagConstraints.VERTICAL);
060:
061: /* Caret status */
062: showCaretStatus = new JCheckBox(jEdit
063: .getProperty("options.status.show-caret-status"));
064: showCaretStatus.setSelected(jEdit
065: .getBooleanProperty("view.status.show-caret-status"));
066: addComponent(showCaretStatus);
067:
068: /* Edit mode */
069: showEditMode = new JCheckBox(jEdit
070: .getProperty("options.status.show-edit-mode"));
071: showEditMode.setSelected(jEdit
072: .getBooleanProperty("view.status.show-edit-mode"));
073: addComponent(showEditMode);
074:
075: /* Fold mode */
076: showFoldMode = new JCheckBox(jEdit
077: .getProperty("options.status.show-fold-mode"));
078: showFoldMode.setSelected(jEdit
079: .getBooleanProperty("view.status.show-fold-mode"));
080: addComponent(showFoldMode);
081:
082: /* Encoding */
083: showEncoding = new JCheckBox(jEdit
084: .getProperty("options.status.show-encoding"));
085: showEncoding.setSelected(jEdit
086: .getBooleanProperty("view.status.show-encoding"));
087: addComponent(showEncoding);
088:
089: /* Wrap */
090: showWrap = new JCheckBox(jEdit
091: .getProperty("options.status.show-wrap"));
092: showWrap.setSelected(jEdit
093: .getBooleanProperty("view.status.show-wrap"));
094: addComponent(showWrap);
095:
096: /* Multi select */
097: showMultiSelect = new JCheckBox(jEdit
098: .getProperty("options.status.show-multi-select"));
099: showMultiSelect.setSelected(jEdit
100: .getBooleanProperty("view.status.show-multi-select"));
101: addComponent(showMultiSelect);
102:
103: /* Rect select */
104: showRectSelect = new JCheckBox(jEdit
105: .getProperty("options.status.show-rect-select"));
106: showRectSelect.setSelected(jEdit
107: .getBooleanProperty("view.status.show-rect-select"));
108: addComponent(showRectSelect);
109:
110: /* Overwrite */
111: showOverwrite = new JCheckBox(jEdit
112: .getProperty("options.status.show-overwrite"));
113: showOverwrite.setSelected(jEdit
114: .getBooleanProperty("view.status.show-overwrite"));
115: addComponent(showOverwrite);
116:
117: /* Line seperator */
118: showLineSeperator = new JCheckBox(jEdit
119: .getProperty("options.status.show-line-seperator"));
120: showLineSeperator.setSelected(jEdit
121: .getBooleanProperty("view.status.show-line-seperator"));
122: addComponent(showLineSeperator);
123:
124: /* Memory status */
125: showMemory = new JCheckBox(jEdit
126: .getProperty("options.status.show-memory"));
127: showMemory.setSelected(jEdit
128: .getBooleanProperty("view.status.show-memory"));
129: showMemory.addActionListener(new ActionHandler());
130: addComponent(showMemory);
131:
132: /* Memory foreground color */
133: addComponent(
134: jEdit.getProperty("options.status.memory.foreground"),
135: memForegroundColor = new ColorWellButton(
136: jEdit
137: .getColorProperty("view.status.memory.foreground")),
138: GridBagConstraints.VERTICAL);
139:
140: /* Memory background color */
141: addComponent(
142: jEdit.getProperty("options.status.memory.background"),
143: memBackgroundColor = new ColorWellButton(
144: jEdit
145: .getColorProperty("view.status.memory.background")),
146: GridBagConstraints.VERTICAL);
147:
148: /* Clock */
149: showClock = new JCheckBox(jEdit
150: .getProperty("options.status.show-clock"));
151: showClock.setSelected(jEdit
152: .getBooleanProperty("view.status.show-clock"));
153: showClock.addActionListener(new ActionHandler());
154: addComponent(showClock);
155:
156: updateEnabled();
157: } //}}}
158:
159: //{{{ _save() method
160: protected void _save() {
161: jEdit.setBooleanProperty("view.status.visible", statusVisible
162: .isSelected());
163: jEdit.setColorProperty("view.status.foreground",
164: foregroundColor.getSelectedColor());
165: jEdit.setColorProperty("view.status.background",
166: backgroundColor.getSelectedColor());
167: jEdit.setBooleanProperty("view.status.show-caret-status",
168: showCaretStatus.isSelected());
169: jEdit.setBooleanProperty("view.status.show-edit-mode",
170: showEditMode.isSelected());
171: jEdit.setBooleanProperty("view.status.show-fold-mode",
172: showFoldMode.isSelected());
173: jEdit.setBooleanProperty("view.status.show-encoding",
174: showEncoding.isSelected());
175: jEdit.setBooleanProperty("view.status.show-wrap", showWrap
176: .isSelected());
177: jEdit.setBooleanProperty("view.status.show-multi-select",
178: showMultiSelect.isSelected());
179: jEdit.setBooleanProperty("view.status.show-rect-select",
180: showRectSelect.isSelected());
181: jEdit.setBooleanProperty("view.status.show-overwrite",
182: showOverwrite.isSelected());
183: jEdit.setBooleanProperty("view.status.show-line-seperator",
184: showLineSeperator.isSelected());
185: jEdit.setBooleanProperty("view.status.show-memory", showMemory
186: .isSelected());
187: jEdit.setColorProperty("view.status.memory.foreground",
188: memForegroundColor.getSelectedColor());
189: jEdit.setColorProperty("view.status.memory.background",
190: memBackgroundColor.getSelectedColor());
191: jEdit.setBooleanProperty("view.status.show-clock", showClock
192: .isSelected());
193: } //}}}
194:
195: //{{{ Private members
196: private JCheckBox statusVisible;
197: private ColorWellButton foregroundColor;
198: private ColorWellButton backgroundColor;
199: private JCheckBox showCaretStatus;
200: private JCheckBox showEditMode;
201: private JCheckBox showFoldMode;
202: private JCheckBox showEncoding;
203: private JCheckBox showWrap;
204: private JCheckBox showMultiSelect;
205: private JCheckBox showRectSelect;
206: private JCheckBox showOverwrite;
207: private JCheckBox showLineSeperator;
208: private JCheckBox showMemory;
209: private ColorWellButton memForegroundColor;
210: private ColorWellButton memBackgroundColor;
211: private JCheckBox showClock;
212:
213: private void updateEnabled() {
214: boolean enabled = statusVisible.isSelected();
215: showCaretStatus.setEnabled(enabled);
216: showEditMode.setEnabled(enabled);
217: showFoldMode.setEnabled(enabled);
218: showEncoding.setEnabled(enabled);
219: showWrap.setEnabled(enabled);
220: showMultiSelect.setEnabled(enabled);
221: showRectSelect.setEnabled(enabled);
222: showOverwrite.setEnabled(enabled);
223: showLineSeperator.setEnabled(enabled);
224: showMemory.setEnabled(enabled);
225: memForegroundColor.setEnabled(enabled
226: && showMemory.isSelected());
227: memBackgroundColor.setEnabled(enabled
228: && showMemory.isSelected());
229: showClock.setEnabled(enabled);
230: }
231:
232: //}}}
233:
234: //{{{ ActionHandler class
235: class ActionHandler implements ActionListener {
236: public void actionPerformed(ActionEvent evt) {
237: updateEnabled();
238: }
239: } //}}}
240: }
|