001: /*
002: * PrintOptionPane.java - Printing options panel
003: * :tabSize=8:indentSize=8:noTabs=false:
004: * :folding=explicit:collapseFolds=1:
005: *
006: * Copyright (C) 2000, 2002 Slava Pestov
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License
010: * as published by the Free Software Foundation; either version 2
011: * of the License, or any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021: */
022:
023: package org.gjt.sp.jedit.options;
024:
025: //{{{ Imports
026: import javax.swing.*;
027: import org.gjt.sp.jedit.gui.FontSelector;
028: import org.gjt.sp.jedit.*;
029:
030: //}}}
031:
032: public class PrintOptionPane extends AbstractOptionPane {
033: //{{{ PrintOptionPane constructor
034: public PrintOptionPane() {
035: super ("print");
036: } //}}}
037:
038: //{{{ _init() method
039: protected void _init() {
040: /* Font */
041: font = new FontSelector(jEdit.getFontProperty("print.font"));
042: addComponent(jEdit.getProperty("options.print.font"), font);
043:
044: /* Header */
045: printHeader = new JCheckBox(jEdit.getProperty("options.print"
046: + ".header"));
047: printHeader.setSelected(jEdit
048: .getBooleanProperty("print.header"));
049: addComponent(printHeader);
050:
051: /* Footer */
052: printFooter = new JCheckBox(jEdit.getProperty("options.print"
053: + ".footer"));
054: printFooter.setSelected(jEdit
055: .getBooleanProperty("print.footer"));
056: addComponent(printFooter);
057:
058: /* Line numbering */
059: printLineNumbers = new JCheckBox(jEdit
060: .getProperty("options.print" + ".lineNumbers"));
061: printLineNumbers.setSelected(jEdit
062: .getBooleanProperty("print.lineNumbers"));
063: addComponent(printLineNumbers);
064:
065: /* Color */
066: color = new JCheckBox(jEdit.getProperty("options.print"
067: + ".color"));
068: color.setSelected(jEdit.getBooleanProperty("print.color"));
069: addComponent(color);
070:
071: /* Tab size */
072: String[] tabSizes = { "2", "4", "8" };
073: tabSize = new JComboBox(tabSizes);
074: tabSize.setEditable(true);
075: tabSize.setSelectedItem(jEdit.getProperty("print.tabSize"));
076: addComponent(jEdit.getProperty("options.print.tabSize"),
077: tabSize);
078:
079: /* Print Folds */
080: printFolds = new JCheckBox(jEdit.getProperty("options.print"
081: + ".folds"));
082: printFolds.setSelected(jEdit.getBooleanProperty("print.folds",
083: true));
084: addComponent(printFolds);
085:
086: addSeparator("options.print.workarounds");
087:
088: /* Spacing workaround */
089: glyphVector = new JCheckBox(jEdit
090: .getProperty("options.print.glyphVector"));
091: glyphVector.setSelected(jEdit
092: .getBooleanProperty("print.glyphVector"));
093: addComponent(glyphVector);
094:
095: /* Force 1.3 print dialog */
096: force13 = new JCheckBox(jEdit
097: .getProperty("options.print.force13"));
098: force13.setSelected(jEdit.getBooleanProperty("print.force13"));
099: addComponent(force13);
100: } //}}}
101:
102: //{{{ _save() method
103: protected void _save() {
104: jEdit.setFontProperty("print.font", font.getFont());
105: jEdit.setBooleanProperty("print.header", printHeader
106: .isSelected());
107: jEdit.setBooleanProperty("print.footer", printFooter
108: .isSelected());
109: jEdit.setBooleanProperty("print.lineNumbers", printLineNumbers
110: .isSelected());
111: jEdit.setBooleanProperty("print.color", color.isSelected());
112: jEdit.setProperty("print.tabSize", (String) tabSize
113: .getSelectedItem());
114: jEdit.setBooleanProperty("print.glyphVector", glyphVector
115: .isSelected());
116: jEdit.setBooleanProperty("print.force13", force13.isSelected());
117: jEdit
118: .setBooleanProperty("print.folds", printFolds
119: .isSelected());
120: } //}}}
121:
122: //{{{ Private members
123: private FontSelector font;
124: private JCheckBox printHeader;
125: private JCheckBox printFooter;
126: private JCheckBox printLineNumbers;
127: private JCheckBox printFolds;
128: private JCheckBox color;
129: private JComboBox tabSize;
130: private JCheckBox glyphVector;
131: private JCheckBox force13;
132: //}}}
133: }
|