PageRenderTime 26ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/org/gjt/sp/jedit/options/PrintOptionPane.java

#
Java | 115 lines | 65 code | 14 blank | 36 comment | 0 complexity | 654a8a4197c0eb9c5b85d3f5936dcbc5 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. * 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. package org.gjt.sp.jedit.options;
  23. //{{{ Imports
  24. import javax.swing.*;
  25. import org.gjt.sp.jedit.gui.FontSelector;
  26. import org.gjt.sp.jedit.*;
  27. //}}}
  28. public class PrintOptionPane extends AbstractOptionPane
  29. {
  30. //{{{ PrintOptionPane constructor
  31. public PrintOptionPane()
  32. {
  33. super("print");
  34. } //}}}
  35. //{{{ _init() method
  36. protected void _init()
  37. {
  38. /* Font */
  39. font = new FontSelector(jEdit.getFontProperty("print.font"));
  40. addComponent(jEdit.getProperty("options.print.font"),font);
  41. /* Header */
  42. printHeader = new JCheckBox(jEdit.getProperty("options.print"
  43. + ".header"));
  44. printHeader.setSelected(jEdit.getBooleanProperty("print.header"));
  45. addComponent(printHeader);
  46. /* Footer */
  47. printFooter = new JCheckBox(jEdit.getProperty("options.print"
  48. + ".footer"));
  49. printFooter.setSelected(jEdit.getBooleanProperty("print.footer"));
  50. addComponent(printFooter);
  51. /* Line numbering */
  52. printLineNumbers = new JCheckBox(jEdit.getProperty("options.print"
  53. + ".lineNumbers"));
  54. printLineNumbers.setSelected(jEdit.getBooleanProperty("print.lineNumbers"));
  55. addComponent(printLineNumbers);
  56. /* Color */
  57. color = new JCheckBox(jEdit.getProperty("options.print"
  58. + ".color"));
  59. color.setSelected(jEdit.getBooleanProperty("print.color"));
  60. addComponent(color);
  61. /* Tab size */
  62. String[] tabSizes = { "2", "4", "8" };
  63. tabSize = new JComboBox(tabSizes);
  64. tabSize.setEditable(true);
  65. tabSize.setSelectedItem(jEdit.getProperty("print.tabSize"));
  66. addComponent(jEdit.getProperty("options.print.tabSize"),tabSize);
  67. addSeparator("options.print.workarounds");
  68. /* Spacing workaround */
  69. glyphVector = new JCheckBox(jEdit.getProperty(
  70. "options.print.glyphVector"));
  71. glyphVector.setSelected(jEdit.getBooleanProperty("print.glyphVector"));
  72. addComponent(glyphVector);
  73. /* Force 1.3 print dialog */
  74. force13 = new JCheckBox(jEdit.getProperty(
  75. "options.print.force13"));
  76. force13.setSelected(jEdit.getBooleanProperty("print.force13"));
  77. addComponent(force13);
  78. } //}}}
  79. //{{{ _save() method
  80. protected void _save()
  81. {
  82. jEdit.setFontProperty("print.font",font.getFont());
  83. jEdit.setBooleanProperty("print.header",printHeader.isSelected());
  84. jEdit.setBooleanProperty("print.footer",printFooter.isSelected());
  85. jEdit.setBooleanProperty("print.lineNumbers",printLineNumbers.isSelected());
  86. jEdit.setBooleanProperty("print.color",color.isSelected());
  87. jEdit.setProperty("print.tabSize",(String)tabSize.getSelectedItem());
  88. jEdit.setBooleanProperty("print.glyphVector",glyphVector.isSelected());
  89. jEdit.setBooleanProperty("print.force13",force13.isSelected());
  90. } //}}}
  91. //{{{ Private members
  92. private FontSelector font;
  93. private JCheckBox printHeader;
  94. private JCheckBox printFooter;
  95. private JCheckBox printLineNumbers;
  96. private JCheckBox color;
  97. private JComboBox tabSize;
  98. private JCheckBox glyphVector;
  99. private JCheckBox force13;
  100. //}}}
  101. }