PageRenderTime 43ms CodeModel.GetById 29ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/options/PrintOptionPane.java

#
Java | 124 lines | 71 code | 16 blank | 37 comment | 0 complexity | 6189280717f8624f87f757f155586faf MD5 | raw file
  1/*
  2 * PrintOptionPane.java - Printing options panel
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2000, 2002 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 org.gjt.sp.jedit.gui.FontSelector;
 28import org.gjt.sp.jedit.*;
 29//}}}
 30
 31public class PrintOptionPane extends AbstractOptionPane
 32{
 33	//{{{ PrintOptionPane constructor
 34	public PrintOptionPane()
 35	{
 36		super("print");
 37	} //}}}
 38
 39	//{{{ _init() method
 40	protected void _init()
 41	{
 42		/* Font */
 43		font = new FontSelector(jEdit.getFontProperty("print.font"));
 44		addComponent(jEdit.getProperty("options.print.font"),font);
 45
 46		/* Header */
 47		printHeader = new JCheckBox(jEdit.getProperty("options.print"
 48			+ ".header"));
 49		printHeader.setSelected(jEdit.getBooleanProperty("print.header"));
 50		addComponent(printHeader);
 51
 52		/* Footer */
 53		printFooter = new JCheckBox(jEdit.getProperty("options.print"
 54			+ ".footer"));
 55		printFooter.setSelected(jEdit.getBooleanProperty("print.footer"));
 56		addComponent(printFooter);
 57
 58		/* Line numbering */
 59		printLineNumbers = new JCheckBox(jEdit.getProperty("options.print"
 60			+ ".lineNumbers"));
 61		printLineNumbers.setSelected(jEdit.getBooleanProperty("print.lineNumbers"));
 62		addComponent(printLineNumbers);
 63
 64		/* Color */
 65		color = new JCheckBox(jEdit.getProperty("options.print"
 66			+ ".color"));
 67		color.setSelected(jEdit.getBooleanProperty("print.color"));
 68		addComponent(color);
 69
 70		/* Tab size */
 71		String[] tabSizes = { "2", "4", "8" };
 72		tabSize = new JComboBox(tabSizes);
 73		tabSize.setEditable(true);
 74		tabSize.setSelectedItem(jEdit.getProperty("print.tabSize"));
 75		addComponent(jEdit.getProperty("options.print.tabSize"),tabSize);
 76
 77
 78		/* Print Folds */
 79		printFolds = new JCheckBox(jEdit.getProperty("options.print"
 80			+ ".folds"));
 81		printFolds.setSelected(jEdit.getBooleanProperty("print.folds",true));
 82		addComponent(printFolds);
 83		
 84		addSeparator("options.print.workarounds");
 85
 86		/* Spacing workaround */
 87		glyphVector = new JCheckBox(jEdit.getProperty(
 88			"options.print.glyphVector"));
 89		glyphVector.setSelected(jEdit.getBooleanProperty("print.glyphVector"));
 90		addComponent(glyphVector);
 91
 92		/* Force 1.3 print dialog */
 93		force13 = new JCheckBox(jEdit.getProperty(
 94			"options.print.force13"));
 95		force13.setSelected(jEdit.getBooleanProperty("print.force13"));
 96		addComponent(force13);
 97	} //}}}
 98
 99	//{{{ _save() method
100	protected void _save()
101	{
102		jEdit.setFontProperty("print.font",font.getFont());
103		jEdit.setBooleanProperty("print.header",printHeader.isSelected());
104		jEdit.setBooleanProperty("print.footer",printFooter.isSelected());
105		jEdit.setBooleanProperty("print.lineNumbers",printLineNumbers.isSelected());
106		jEdit.setBooleanProperty("print.color",color.isSelected());
107		jEdit.setProperty("print.tabSize",(String)tabSize.getSelectedItem());
108		jEdit.setBooleanProperty("print.glyphVector",glyphVector.isSelected());
109		jEdit.setBooleanProperty("print.force13",force13.isSelected());
110		jEdit.setBooleanProperty("print.folds",printFolds.isSelected());
111	} //}}}
112
113	//{{{ Private members
114	private FontSelector font;
115	private JCheckBox printHeader;
116	private JCheckBox printFooter;
117	private JCheckBox printLineNumbers;
118	private JCheckBox printFolds;
119	private JCheckBox color;
120	private JComboBox tabSize;
121	private JCheckBox glyphVector;
122	private JCheckBox force13;
123	//}}}
124}