1 | package org.openstreetmap.josm.gui.preferences;
|
---|
2 |
|
---|
3 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
4 |
|
---|
5 | import java.awt.event.ActionEvent;
|
---|
6 | import java.awt.event.ActionListener;
|
---|
7 |
|
---|
8 | import javax.swing.JCheckBox;
|
---|
9 |
|
---|
10 | import org.openstreetmap.josm.Main;
|
---|
11 | import org.openstreetmap.josm.tools.GBC;
|
---|
12 |
|
---|
13 | public class DrawingPreference implements PreferenceSetting {
|
---|
14 |
|
---|
15 | private JCheckBox drawRawGpsLines = new JCheckBox(tr("Draw lines between raw gps points."));
|
---|
16 | private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported."));
|
---|
17 | private JCheckBox largeGpsPoints = new JCheckBox(tr("Draw large GPS points."));
|
---|
18 | private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows"));
|
---|
19 | private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers"));
|
---|
20 | private JCheckBox sourceBounds = new JCheckBox(tr("Draw boundaries of downloaded data"));
|
---|
21 | private JCheckBox inactive = new JCheckBox(tr("Draw inactive layers in other color"));
|
---|
22 |
|
---|
23 | public void addGui(PreferenceDialog gui) {
|
---|
24 | // drawRawGpsLines
|
---|
25 | drawRawGpsLines.addActionListener(new ActionListener(){
|
---|
26 | public void actionPerformed(ActionEvent e) {
|
---|
27 | if (!drawRawGpsLines.isSelected())
|
---|
28 | forceRawGpsLines.setSelected(false);
|
---|
29 | forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected());
|
---|
30 | }
|
---|
31 | });
|
---|
32 | drawRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines"));
|
---|
33 | drawRawGpsLines.setToolTipText(tr("If your gps device draw too few lines, select this to draw lines along your way."));
|
---|
34 | gui.display.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0));
|
---|
35 |
|
---|
36 | // forceRawGpsLines
|
---|
37 | forceRawGpsLines.setToolTipText(tr("Force drawing of lines if the imported data contain no line information."));
|
---|
38 | forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force"));
|
---|
39 | forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected());
|
---|
40 | gui.display.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0));
|
---|
41 |
|
---|
42 | // largeGpsPoints
|
---|
43 | largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large"));
|
---|
44 | largeGpsPoints.setToolTipText(tr("Draw larger dots for the GPS points."));
|
---|
45 | gui.display.add(largeGpsPoints, GBC.eop().insets(20,0,0,0));
|
---|
46 |
|
---|
47 | // directionHint
|
---|
48 | directionHint.setToolTipText(tr("Draw direction hints for all segments."));
|
---|
49 | directionHint.setSelected(Main.pref.getBoolean("draw.segment.direction"));
|
---|
50 | gui.display.add(directionHint, GBC.eop().insets(20,0,0,0));
|
---|
51 |
|
---|
52 | // segment order number
|
---|
53 | segmentOrderNumber.setToolTipText(tr("Draw the order numbers of all segments within their way."));
|
---|
54 | segmentOrderNumber.setSelected(Main.pref.getBoolean("draw.segment.order_number"));
|
---|
55 | gui.display.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0));
|
---|
56 |
|
---|
57 | // downloaded area
|
---|
58 | sourceBounds.setToolTipText(tr("Draw the boundaries of data loaded from the server."));
|
---|
59 | sourceBounds.setSelected(Main.pref.getBoolean("draw.data.downloaded_area", true));
|
---|
60 | gui.display.add(sourceBounds, GBC.eop().insets(20,0,0,0));
|
---|
61 |
|
---|
62 | // background layers in inactive color
|
---|
63 | inactive.setToolTipText(tr("Draw the inactive data layers in a different color."));
|
---|
64 | inactive.setSelected(Main.pref.getBoolean("draw.data.inactive_color", true));
|
---|
65 | gui.display.add(inactive, GBC.eop().insets(20,0,0,0));
|
---|
66 | }
|
---|
67 |
|
---|
68 | public void ok() {
|
---|
69 | Main.pref.put("draw.rawgps.lines", drawRawGpsLines.isSelected());
|
---|
70 | Main.pref.put("draw.rawgps.lines.force", forceRawGpsLines.isSelected());
|
---|
71 | Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected());
|
---|
72 | Main.pref.put("draw.segment.direction", directionHint.isSelected());
|
---|
73 | Main.pref.put("draw.segment.order_number", segmentOrderNumber.isSelected());
|
---|
74 | Main.pref.put("draw.data.downloaded_area", sourceBounds.isSelected());
|
---|
75 | Main.pref.put("draw.data.inactive_color", inactive.isSelected());
|
---|
76 | }
|
---|
77 | }
|
---|