1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
42 |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseAdapter; |
43 |
import java.awt.event.MouseEvent; |
import java.awt.event.MouseEvent; |
44 |
|
|
45 |
|
import java.io.File; |
46 |
|
|
47 |
import java.util.Locale; |
import java.util.Locale; |
48 |
import java.util.Vector; |
import java.util.Vector; |
49 |
|
|
55 |
import javax.swing.JCheckBox; |
import javax.swing.JCheckBox; |
56 |
import javax.swing.JColorChooser; |
import javax.swing.JColorChooser; |
57 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
58 |
|
import javax.swing.JFileChooser; |
59 |
import javax.swing.JLabel; |
import javax.swing.JLabel; |
60 |
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
61 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
356 |
private final JCheckBox checkShowLSConsoleWhenRunScript = |
private final JCheckBox checkShowLSConsoleWhenRunScript = |
357 |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript")); |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript")); |
358 |
|
|
359 |
|
private final JTextField tfJSamplerHome = new JTextField(); |
360 |
|
private final JButton btnChange = new JButton(i18n.getLabel("GeneralPane.btnChange")); |
361 |
|
|
362 |
private final JLabel lRecentScriptsSize = |
private final JLabel lRecentScriptsSize = |
363 |
new JLabel(i18n.getLabel("GeneralPane.lRecentScriptsSize")); |
new JLabel(i18n.getLabel("GeneralPane.lRecentScriptsSize")); |
364 |
private final JSpinner spRecentScriptsSize; |
private final JSpinner spRecentScriptsSize; |
396 |
|
|
397 |
add(Box.createRigidArea(new Dimension(0, 6))); |
add(Box.createRigidArea(new Dimension(0, 6))); |
398 |
|
|
399 |
|
JPanel jhp = new JPanel(); |
400 |
|
jhp.setLayout(new BoxLayout(jhp, BoxLayout.Y_AXIS)); |
401 |
|
|
402 |
|
JPanel p = new JPanel(); |
403 |
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
404 |
|
if(CC.getJSamplerHome() != null) tfJSamplerHome.setText(CC.getJSamplerHome()); |
405 |
|
Dimension d; |
406 |
|
d = new Dimension(Short.MAX_VALUE, tfJSamplerHome.getPreferredSize().height); |
407 |
|
tfJSamplerHome.setMaximumSize(d); |
408 |
|
p.add(tfJSamplerHome); |
409 |
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
410 |
|
p.add(btnChange); |
411 |
|
p.setBorder(BorderFactory.createEmptyBorder(2, 6, 6, 6)); |
412 |
|
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
413 |
|
jhp.add(p); |
414 |
|
|
415 |
|
String s = i18n.getLabel("GeneralPane.jSamplerHome"); |
416 |
|
jhp.setBorder(BorderFactory.createTitledBorder(s)); |
417 |
|
jhp.setMaximumSize(new Dimension(Short.MAX_VALUE, jhp.getPreferredSize().height)); |
418 |
|
jhp.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
419 |
|
add(jhp); |
420 |
|
|
421 |
|
add(Box.createRigidArea(new Dimension(0, 6))); |
422 |
|
|
423 |
JPanel rsp = new JPanel(); |
JPanel rsp = new JPanel(); |
424 |
rsp.setLayout(new BoxLayout(rsp, BoxLayout.Y_AXIS)); |
rsp.setLayout(new BoxLayout(rsp, BoxLayout.Y_AXIS)); |
425 |
|
|
427 |
spRecentScriptsSize = new JSpinner(new SpinnerNumberModel(i, 0, 100, 1)); |
spRecentScriptsSize = new JSpinner(new SpinnerNumberModel(i, 0, 100, 1)); |
428 |
spRecentScriptsSize.setMaximumSize(spRecentScriptsSize.getPreferredSize()); |
spRecentScriptsSize.setMaximumSize(spRecentScriptsSize.getPreferredSize()); |
429 |
|
|
430 |
JPanel p = new JPanel(); |
p = new JPanel(); |
431 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
432 |
p.add(lRecentScriptsSize); |
p.add(lRecentScriptsSize); |
433 |
p.add(Box.createRigidArea(new Dimension(5, 0))); |
p.add(Box.createRigidArea(new Dimension(5, 0))); |
452 |
|
|
453 |
rsp.setMaximumSize(new Dimension(Short.MAX_VALUE, rsp.getPreferredSize().height)); |
rsp.setMaximumSize(new Dimension(Short.MAX_VALUE, rsp.getPreferredSize().height)); |
454 |
rsp.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
rsp.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
455 |
rsp.setBorder ( |
s = i18n.getLabel("GeneralPane.recentScripts"); |
456 |
BorderFactory.createTitledBorder(i18n.getLabel("GeneralPane.recentScripts")) |
rsp.setBorder(BorderFactory.createTitledBorder(s)); |
|
); |
|
457 |
|
|
458 |
add(rsp); |
add(rsp); |
459 |
add(Box.createGlue()); |
add(Box.createGlue()); |
460 |
|
|
461 |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
462 |
|
|
463 |
|
btnChange.addActionListener(new ActionListener() { |
464 |
|
public void |
465 |
|
actionPerformed(ActionEvent e) { onChange(); } |
466 |
|
}); |
467 |
|
} |
468 |
|
|
469 |
|
private void |
470 |
|
onChange() { |
471 |
|
JFileChooser fc = new JFileChooser(); |
472 |
|
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
473 |
|
int result = fc.showOpenDialog(this); |
474 |
|
if(result != JFileChooser.APPROVE_OPTION) return; |
475 |
|
|
476 |
|
String s = CC.getJSamplerHome(); |
477 |
|
String suf = File.separator + ".jsampler"; |
478 |
|
if(s != null) suf = File.separator + new File(s).getName(); |
479 |
|
|
480 |
|
tfJSamplerHome.setText(fc.getSelectedFile().getPath() + suf); |
481 |
} |
} |
482 |
|
|
483 |
protected void |
protected void |
491 |
int size = Integer.parseInt(spRecentScriptsSize.getValue().toString()); |
int size = Integer.parseInt(spRecentScriptsSize.getValue().toString()); |
492 |
ClassicPrefs.setRecentScriptstSize(size); |
ClassicPrefs.setRecentScriptstSize(size); |
493 |
((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu(); |
((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu(); |
494 |
|
|
495 |
|
String s = tfJSamplerHome.getText(); |
496 |
|
if(s.length() > 0 && !s.equals(CC.getJSamplerHome())) { |
497 |
|
CC.changeJSamplerHome(s); |
498 |
|
} |
499 |
} |
} |
500 |
} |
} |
501 |
|
|
513 |
private final PrefsDlg.ColorButton btnBorderColor = |
private final PrefsDlg.ColorButton btnBorderColor = |
514 |
new PrefsDlg.ColorButton(Color.WHITE); |
new PrefsDlg.ColorButton(Color.WHITE); |
515 |
|
|
516 |
|
private final JCheckBox checkHlChnBorderColor = |
517 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBorderColor")); |
518 |
|
private final PrefsDlg.ColorButton btnHlChnBorderColor = |
519 |
|
new PrefsDlg.ColorButton(Color.WHITE); |
520 |
|
|
521 |
|
private final JCheckBox checkSelChnBgColor = |
522 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkSelChnBgColor")); |
523 |
|
private final PrefsDlg.ColorButton btnSelChnBgColor = |
524 |
|
new PrefsDlg.ColorButton(Color.WHITE); |
525 |
|
|
526 |
|
private final JCheckBox checkHlChnBgColor = |
527 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBgColor")); |
528 |
|
private final PrefsDlg.ColorButton btnHlChnBgColor = |
529 |
|
new PrefsDlg.ColorButton(Color.WHITE); |
530 |
|
|
531 |
public |
public |
532 |
ViewPane() { initViewPane(); } |
ViewPane() { initViewPane(); } |
533 |
|
|
586 |
|
|
587 |
private JPanel |
private JPanel |
588 |
createCustomColorsPane() { |
createCustomColorsPane() { |
|
JPanel ccp = new JPanel(); |
|
|
ccp.setAlignmentX(CENTER_ALIGNMENT); |
|
|
ccp.setLayout(new BoxLayout(ccp, BoxLayout.Y_AXIS)); |
|
|
|
|
|
JPanel p = new JPanel(); |
|
|
p.setAlignmentX(LEFT_ALIGNMENT); |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
|
|
p.add(checkBorderColor); |
|
|
|
|
|
p.add(Box.createRigidArea(new Dimension(6, 0))); |
|
|
|
|
589 |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
590 |
btnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderColor()); |
btnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderColor()); |
|
p.add(btnBorderColor); |
|
591 |
|
|
592 |
checkBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderColor()); |
checkBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderColor()); |
593 |
|
|
599 |
} |
} |
600 |
}); |
}); |
601 |
|
|
602 |
ccp.add(p); |
btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor()); |
603 |
|
btnHlChnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderHlColor()); |
604 |
|
|
605 |
|
checkHlChnBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderHlColor()); |
606 |
|
|
607 |
|
checkHlChnBorderColor.addItemListener(new ItemListener() { |
608 |
|
public void |
609 |
|
itemStateChanged(ItemEvent e) { |
610 |
|
boolean b = e.getStateChange() == e.SELECTED; |
611 |
|
btnHlChnBorderColor.setEnabled(b); |
612 |
|
} |
613 |
|
}); |
614 |
|
|
615 |
|
Color color = ClassicPrefs.getSelectedChannelBgColor(); |
616 |
|
if(color == null) color = new Color(getBackground().getRGB()); |
617 |
|
btnSelChnBgColor.setColor(color); |
618 |
|
btnSelChnBgColor.setEnabled(ClassicPrefs.getCustomSelectedChannelBgColor()); |
619 |
|
|
620 |
|
checkSelChnBgColor.setSelected(ClassicPrefs.getCustomSelectedChannelBgColor()); |
621 |
|
|
622 |
|
checkSelChnBgColor.addItemListener(new ItemListener() { |
623 |
|
public void |
624 |
|
itemStateChanged(ItemEvent e) { |
625 |
|
boolean b = e.getStateChange() == e.SELECTED; |
626 |
|
btnSelChnBgColor.setEnabled(b); |
627 |
|
} |
628 |
|
}); |
629 |
|
|
630 |
|
color = ClassicPrefs.getHighlightedChannelBgColor(); |
631 |
|
if(color == null) color = new Color(getBackground().getRGB()); |
632 |
|
btnHlChnBgColor.setColor(color); |
633 |
|
btnHlChnBgColor.setEnabled(ClassicPrefs.getCustomHighlightedChannelBgColor()); |
634 |
|
|
635 |
|
checkHlChnBgColor.setSelected(ClassicPrefs.getCustomHighlightedChannelBgColor()); |
636 |
|
|
637 |
|
checkHlChnBgColor.addItemListener(new ItemListener() { |
638 |
|
public void |
639 |
|
itemStateChanged(ItemEvent e) { |
640 |
|
boolean b = e.getStateChange() == e.SELECTED; |
641 |
|
btnHlChnBgColor.setEnabled(b); |
642 |
|
} |
643 |
|
}); |
644 |
|
|
645 |
JButton btnDefaults = new JButton("Reset to defaults"); |
JButton btnDefaults = new JButton("Reset to defaults"); |
646 |
btnDefaults.addActionListener(new ActionListener() { |
btnDefaults.addActionListener(new ActionListener() { |
648 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
649 |
ClassicPrefs.setChannelBorderColor(null); |
ClassicPrefs.setChannelBorderColor(null); |
650 |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
651 |
|
|
652 |
|
ClassicPrefs.setChannelBorderHlColor(null); |
653 |
|
btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor()); |
654 |
|
|
655 |
|
ClassicPrefs.setSelectedChannelBgColor(null); |
656 |
|
btnSelChnBgColor.setColor(ClassicPrefs.getSelectedChannelBgColor()); |
657 |
|
|
658 |
|
ClassicPrefs.setHighlightedChannelBgColor(null); |
659 |
|
btnHlChnBgColor.setColor(ClassicPrefs.getHighlightedChannelBgColor()); |
660 |
} |
} |
661 |
}); |
}); |
662 |
|
|
663 |
p = new JPanel(); |
GridBagLayout gridbag = new GridBagLayout(); |
664 |
|
GridBagConstraints c = new GridBagConstraints(); |
665 |
|
|
666 |
|
JPanel ccp = new JPanel(); |
667 |
|
ccp.setLayout(gridbag); |
668 |
|
|
669 |
|
c.fill = GridBagConstraints.NONE; |
670 |
|
|
671 |
|
c.gridx = 0; |
672 |
|
c.gridy = 0; |
673 |
|
c.anchor = GridBagConstraints.WEST; |
674 |
|
c.insets = new Insets(0, 3, 3, 3); |
675 |
|
gridbag.setConstraints(checkBorderColor, c); |
676 |
|
ccp.add(checkBorderColor); |
677 |
|
|
678 |
|
|
679 |
|
c.gridx = 1; |
680 |
|
c.gridy = 0; |
681 |
|
gridbag.setConstraints(btnBorderColor, c); |
682 |
|
ccp.add(btnBorderColor); |
683 |
|
|
684 |
|
c.gridx = 0; |
685 |
|
c.gridy = 1; |
686 |
|
gridbag.setConstraints(checkHlChnBorderColor, c); |
687 |
|
ccp.add(checkHlChnBorderColor); |
688 |
|
|
689 |
|
c.gridx = 1; |
690 |
|
c.gridy = 1; |
691 |
|
gridbag.setConstraints(btnHlChnBorderColor, c); |
692 |
|
ccp.add(btnHlChnBorderColor); |
693 |
|
|
694 |
|
c.gridx = 0; |
695 |
|
c.gridy = 2; |
696 |
|
gridbag.setConstraints(checkSelChnBgColor, c); |
697 |
|
ccp.add(checkSelChnBgColor); |
698 |
|
|
699 |
|
c.gridx = 1; |
700 |
|
c.gridy = 2; |
701 |
|
gridbag.setConstraints(btnSelChnBgColor, c); |
702 |
|
ccp.add(btnSelChnBgColor); |
703 |
|
|
704 |
|
c.gridx = 0; |
705 |
|
c.gridy = 3; |
706 |
|
gridbag.setConstraints(checkHlChnBgColor, c); |
707 |
|
ccp.add(checkHlChnBgColor); |
708 |
|
|
709 |
|
c.gridx = 1; |
710 |
|
c.gridy = 3; |
711 |
|
gridbag.setConstraints(btnHlChnBgColor, c); |
712 |
|
ccp.add(btnHlChnBgColor); |
713 |
|
|
714 |
|
JPanel p = new JPanel(); |
715 |
p.setAlignmentX(LEFT_ALIGNMENT); |
p.setAlignmentX(LEFT_ALIGNMENT); |
716 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
717 |
p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6)); |
p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6)); |
721 |
p.add(btnDefaults); |
p.add(btnDefaults); |
722 |
p.add(Box.createGlue()); |
p.add(Box.createGlue()); |
723 |
|
|
724 |
|
c.fill = GridBagConstraints.HORIZONTAL; |
725 |
|
c.gridx = 0; |
726 |
|
c.gridy = 4; |
727 |
|
c.gridwidth = 2; |
728 |
|
c.weightx = 1.0; |
729 |
|
c.anchor = GridBagConstraints.CENTER; |
730 |
|
gridbag.setConstraints(p, c); |
731 |
ccp.add(p); |
ccp.add(p); |
732 |
|
|
733 |
ccp.setBorder ( |
ccp.setBorder ( |
734 |
BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane")) |
BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane")) |
735 |
); |
); |
793 |
if(b) c = ClassicPrefs.getChannelBorderColor(); |
if(b) c = ClassicPrefs.getChannelBorderColor(); |
794 |
else c = ClassicPrefs.getDefaultChannelBorderColor(); |
else c = ClassicPrefs.getDefaultChannelBorderColor(); |
795 |
Channel.setBorderColor(c); |
Channel.setBorderColor(c); |
796 |
|
|
797 |
|
b = checkHlChnBorderColor.isSelected(); |
798 |
|
ClassicPrefs.setCustomChannelBorderHlColor(b); |
799 |
|
if(b) ClassicPrefs.setChannelBorderHlColor(btnHlChnBorderColor.getColor()); |
800 |
|
|
801 |
|
if(b) c = ClassicPrefs.getChannelBorderHlColor(); |
802 |
|
else c = ClassicPrefs.getDefaultChannelBorderHlColor(); |
803 |
|
Channel.setBorderHighlightedColor(c); |
804 |
|
|
805 |
|
b = checkSelChnBgColor.isSelected(); |
806 |
|
ClassicPrefs.setCustomSelectedChannelBgColor(b); |
807 |
|
if(b) ClassicPrefs.setSelectedChannelBgColor(btnSelChnBgColor.getColor()); |
808 |
|
|
809 |
|
if(b) c = ClassicPrefs.getSelectedChannelBgColor(); |
810 |
|
else c = new Color(getBackground().getRGB()); |
811 |
|
if(c == null) c = new Color(getBackground().getRGB()); |
812 |
|
Channel.setSelectedChannelBgColor(c); |
813 |
|
|
814 |
|
b = checkHlChnBgColor.isSelected(); |
815 |
|
ClassicPrefs.setCustomHighlightedChannelBgColor(b); |
816 |
|
if(b) ClassicPrefs.setHighlightedChannelBgColor(btnHlChnBgColor.getColor()); |
817 |
|
|
818 |
|
if(b) c = ClassicPrefs.getHighlightedChannelBgColor(); |
819 |
|
else c = new Color(getBackground().getRGB()); |
820 |
|
if(c == null) c = new Color(getBackground().getRGB()); |
821 |
|
Channel.setHighlightedChannelBgColor(c); |
822 |
} |
} |
823 |
|
|
824 |
class LocaleBox { |
class LocaleBox { |
835 |
} |
} |
836 |
|
|
837 |
class ConsolePane extends JPanel { |
class ConsolePane extends JPanel { |
838 |
|
private final JCheckBox checkSaveCmdHist = |
839 |
|
new JCheckBox(i18n.getLabel("ConsolePane.checkSaveCmdHist")); |
840 |
|
|
841 |
private final JLabel lCmdHistorySize = |
private final JLabel lCmdHistorySize = |
842 |
new JLabel(i18n.getLabel("ConsolePane.lCmdHistorySize")); |
new JLabel(i18n.getLabel("ConsolePane.lCmdHistorySize")); |
843 |
private final JSpinner spCmdHistorySize; |
private JSpinner spCmdHistorySize; |
844 |
private final JLabel lLines = new JLabel(i18n.getLabel("ConsolePane.lLines")); |
private final JLabel lLines = new JLabel(i18n.getLabel("ConsolePane.lLines")); |
845 |
private final JButton btnClearCmdHistory = |
private final JButton btnClearCmdHistory = |
846 |
new JButton(i18n.getButtonLabel("ConsolePane.btnClearCmdHistory")); |
new JButton(i18n.getButtonLabel("ConsolePane.btnClearCmdHistory")); |
865 |
ConsolePane() { |
ConsolePane() { |
866 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
867 |
|
|
868 |
int i = ClassicPrefs.getLSConsoleHistSize(); |
add(checkSaveCmdHist); |
|
spCmdHistorySize = new JSpinner(new SpinnerNumberModel(i, 0, 20000, 1)); |
|
|
spCmdHistorySize.setMaximumSize(spCmdHistorySize.getPreferredSize()); |
|
869 |
|
|
870 |
JPanel p = new JPanel(); |
add(createCommandHistoryPane()); |
871 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
add(Box.createRigidArea(new Dimension(0, 6))); |
872 |
p.add(lCmdHistorySize); |
add(createConsoleColorsPane()); |
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
|
|
p.add(spCmdHistorySize); |
|
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
|
|
p.add(lLines); |
|
873 |
|
|
874 |
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
875 |
add(p); |
} |
876 |
|
|
877 |
|
private JPanel |
878 |
|
createCommandHistoryPane() { |
879 |
|
JPanel chp = new JPanel(); |
880 |
|
chp.setAlignmentX(CENTER_ALIGNMENT); |
881 |
|
|
882 |
add(Box.createRigidArea(new Dimension(0, 6))); |
GridBagLayout gridbag = new GridBagLayout(); |
883 |
|
GridBagConstraints c = new GridBagConstraints(); |
884 |
|
|
885 |
|
chp.setLayout(gridbag); |
886 |
|
|
887 |
|
int i = ClassicPrefs.getLSConsoleHistSize(); |
888 |
|
spCmdHistorySize = new JSpinner(new SpinnerNumberModel(i, 0, 20000, 1)); |
889 |
|
spCmdHistorySize.setMaximumSize(spCmdHistorySize.getPreferredSize()); |
890 |
|
|
891 |
btnClearCmdHistory.addActionListener(new ActionListener() { |
btnClearCmdHistory.addActionListener(new ActionListener() { |
892 |
public void |
public void |
893 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
894 |
ClassicPrefs.setLSConsoleHistory(null); |
LSConsolePane.clearConsoleHistory(); |
895 |
MainFrame mainFrame = (MainFrame)CC.getMainFrame(); |
MainFrame mainFrame = (MainFrame)CC.getMainFrame(); |
896 |
mainFrame.getLSConsoleModel().clearCommandHistory(); |
mainFrame.getLSConsoleModel().clearCommandHistory(); |
897 |
} |
} |
900 |
btnClearCmdHistory.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
btnClearCmdHistory.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
901 |
add(btnClearCmdHistory); |
add(btnClearCmdHistory); |
902 |
|
|
903 |
add(Box.createRigidArea(new Dimension(0, 6))); |
c.fill = GridBagConstraints.NONE; |
904 |
|
|
905 |
p = createConsoleColorsPane(); |
c.gridx = 0; |
906 |
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
c.gridy = 0; |
907 |
add(p); |
c.anchor = GridBagConstraints.EAST; |
908 |
|
c.insets = new Insets(0, 6, 3, 0); |
909 |
|
gridbag.setConstraints(lCmdHistorySize, c); |
910 |
|
chp.add(lCmdHistorySize); |
911 |
|
|
912 |
|
c.gridx = 1; |
913 |
|
c.gridy = 0; |
914 |
|
gridbag.setConstraints(spCmdHistorySize, c); |
915 |
|
chp.add(spCmdHistorySize); |
916 |
|
|
917 |
|
c.gridx = 2; |
918 |
|
c.gridy = 0; |
919 |
|
gridbag.setConstraints(lLines, c); |
920 |
|
chp.add(lLines); |
921 |
|
|
922 |
|
c.gridx = 3; |
923 |
|
c.gridy = 0; |
924 |
|
c.insets = new Insets(0, 12, 3, 6); |
925 |
|
gridbag.setConstraints(btnClearCmdHistory, c); |
926 |
|
chp.add(btnClearCmdHistory); |
927 |
|
|
928 |
|
checkSaveCmdHist.setSelected(ClassicPrefs.getSaveConsoleHistory()); |
929 |
|
checkSaveCmdHist.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
930 |
|
|
931 |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
c.gridx = 0; |
932 |
|
c.gridy = 1; |
933 |
|
c.gridwidth = 4; |
934 |
|
c.insets = new Insets(3, 6, 3, 6); |
935 |
|
c.anchor = GridBagConstraints.CENTER; |
936 |
|
gridbag.setConstraints(checkSaveCmdHist, c); |
937 |
|
chp.add(checkSaveCmdHist); |
938 |
|
|
939 |
|
String s = i18n.getLabel("ConsolePane.commandHistory"); |
940 |
|
chp.setBorder(BorderFactory.createTitledBorder(s)); |
941 |
|
|
942 |
|
chp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
943 |
|
|
944 |
|
return chp; |
945 |
} |
} |
946 |
|
|
947 |
private JPanel |
private JPanel |
1055 |
gridbag.setConstraints(p, c); |
gridbag.setConstraints(p, c); |
1056 |
ccp.add(p); |
ccp.add(p); |
1057 |
|
|
1058 |
ccp.setBorder ( |
String s = i18n.getLabel("ConsolePane.consoleColors"); |
1059 |
BorderFactory.createTitledBorder(i18n.getLabel("ConsolePane.consoleColors")) |
ccp.setBorder(BorderFactory.createTitledBorder(s)); |
|
); |
|
1060 |
|
|
1061 |
ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
1062 |
|
|
1065 |
|
|
1066 |
protected void |
protected void |
1067 |
apply() { |
apply() { |
1068 |
|
ClassicPrefs.setSaveConsoleHistory(checkSaveCmdHist.isSelected()); |
1069 |
|
|
1070 |
int size = Integer.parseInt(spCmdHistorySize.getValue().toString()); |
int size = Integer.parseInt(spCmdHistorySize.getValue().toString()); |
1071 |
ClassicPrefs.setLSConsoleHistSize(size); |
ClassicPrefs.setLSConsoleHistSize(size); |
1072 |
LSConsoleModel model = ((MainFrame)CC.getMainFrame()).getLSConsoleModel(); |
LSConsoleModel model = ((MainFrame)CC.getMainFrame()).getLSConsoleModel(); |