Ticket #1607: DrawingPreference.diff
File DrawingPreference.diff, 9.5 KB (added by , 16 years ago) |
---|
-
src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
5 5 6 6 import java.awt.event.ActionEvent; 7 7 import java.awt.event.ActionListener; 8 import java.awt.GridBagLayout; 8 9 10 import javax.swing.BorderFactory; 9 11 import javax.swing.JCheckBox; 10 12 import javax.swing.JLabel; 11 13 import javax.swing.JTextField; 14 import javax.swing.JScrollPane; 15 import javax.swing.JPanel; 16 import javax.swing.Box; 12 17 13 18 import org.openstreetmap.josm.Main; 14 19 import org.openstreetmap.josm.tools.GBC; … … 23 28 private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows")); 24 29 private JCheckBox drawGpsArrows = new JCheckBox(tr("Draw Direction Arrows")); 25 30 private JCheckBox drawGpsArrowsFast = new JCheckBox(tr("Fast drawing (looks uglier)")); 31 private JTextField drawGpsArrowsMinDist = new JTextField(8); 26 32 private JCheckBox interestingDirections = new JCheckBox(tr("Only interesting direction hints (e.g. with oneway tag).")); 27 33 private JCheckBox segmentOrderNumber = new JCheckBox(tr("Draw segment order numbers")); 28 34 private JCheckBox sourceBounds = new JCheckBox(tr("Draw boundaries of downloaded data")); … … 31 37 private JCheckBox useAntialiasing = new JCheckBox(tr("Smooth map graphics (antialiasing)")); 32 38 33 39 public void addGui(PreferenceDialog gui) { 40 JPanel panel = new JPanel(new GridBagLayout()); 41 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 42 34 43 // drawRawGpsLines 35 44 drawRawGpsLines.addActionListener(new ActionListener(){ 36 45 public void actionPerformed(ActionEvent e) { … … 38 47 drawRawGpsMaxLineLength.setEnabled(drawRawGpsLines.isSelected()); 39 48 drawGpsArrows.setEnabled(drawRawGpsLines.isSelected()); 40 49 drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 50 drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 41 51 colorTracks.setEnabled(drawRawGpsLines.isSelected()); 42 52 } 43 53 }); 44 54 drawRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines")); 45 55 drawRawGpsLines.setToolTipText(tr("If your gps device draw too few lines, select this to draw lines along your way.")); 46 gui.display.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0));56 panel.add(drawRawGpsLines, GBC.eol().insets(20,0,0,0)); 47 57 48 58 // drawRawGpsMaxLineLength 49 59 drawRawGpsMaxLineLength.setText(Main.pref.get("draw.rawgps.max-line-length", "-1")); 50 60 drawRawGpsMaxLineLength.setToolTipText(tr("Maximum length (in meters) to draw lines. Set to '-1' to draw all lines.")); 51 61 drawRawGpsMaxLineLength.setEnabled(drawRawGpsLines.isSelected()); 52 gui.display.add(new JLabel(tr("Maximum length (meters)")), GBC.std().insets(40,0,0,0));53 gui.display.add(drawRawGpsMaxLineLength, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));62 panel.add(new JLabel(tr("Maximum length (meters)")), GBC.std().insets(40,0,0,0)); 63 panel.add(drawRawGpsMaxLineLength, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 54 64 55 65 // forceRawGpsLines 56 66 forceRawGpsLines.setToolTipText(tr("Force drawing of lines if the imported data contain no line information.")); 57 67 forceRawGpsLines.setSelected(Main.pref.getBoolean("draw.rawgps.lines.force")); 58 68 forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected()); 59 gui.display.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0));69 panel.add(forceRawGpsLines, GBC.eop().insets(40,0,0,0)); 60 70 61 71 // drawGpsArrows 62 72 drawGpsArrows.addActionListener(new ActionListener(){ 63 73 public void actionPerformed(ActionEvent e) { 64 74 drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 75 drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 65 76 } 66 77 }); 67 78 drawGpsArrows.setToolTipText(tr("Draw direction arrows for lines, connecting GPS points.")); 68 79 drawGpsArrows.setSelected(Main.pref.getBoolean("draw.rawgps.direction")); 69 80 drawGpsArrows.setEnabled(drawRawGpsLines.isSelected()); 70 gui.display.add(drawGpsArrows, GBC.eop().insets(40,0,0,0));81 panel.add(drawGpsArrows, GBC.eop().insets(40,0,0,0)); 71 82 72 83 // drawGpsArrowsFast 73 84 drawGpsArrowsFast.setToolTipText(tr("Draw the direction arrows using table lookups instead of complex math.")); 74 85 drawGpsArrowsFast.setSelected(Main.pref.getBoolean("draw.rawgps.alternatedirection")); 75 86 drawGpsArrowsFast.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 76 gui.display.add(drawGpsArrowsFast, GBC.eop().insets(60,0,0,0));87 panel.add(drawGpsArrowsFast, GBC.eop().insets(60,0,0,0)); 77 88 89 // drawGpsArrowsMinDist 90 drawGpsArrowsMinDist.setToolTipText(tr("Don't draw arrows if they are not at least this distance away from the last one.")); 91 drawGpsArrowsMinDist.setText(Main.pref.get("draw.rawgps.min-arrow-distance", "0")); 92 drawGpsArrowsMinDist.setEnabled(drawGpsArrows.isSelected() && drawGpsArrows.isEnabled()); 93 panel.add(new JLabel(tr("Minimum distance (pixels)")), GBC.std().insets(60,0,0,0)); 94 panel.add(drawGpsArrowsMinDist, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); 95 78 96 // colorTracks 79 97 colorTracks.setSelected(Main.pref.getBoolean("draw.rawgps.colors")); 80 98 colorTracks.setToolTipText(tr("Choose the hue for the track color by the velocity at that point.")); 81 99 colorTracks.setEnabled(drawRawGpsLines.isSelected()); 82 gui.display.add(colorTracks, GBC.eop().insets(40,0,0,0));100 panel.add(colorTracks, GBC.eop().insets(40,0,0,0)); 83 101 84 102 // largeGpsPoints 85 103 largeGpsPoints.setSelected(Main.pref.getBoolean("draw.rawgps.large")); 86 104 largeGpsPoints.setToolTipText(tr("Draw larger dots for the GPS points.")); 87 gui.display.add(largeGpsPoints, GBC.eop().insets(20,0,0,0));105 panel.add(largeGpsPoints, GBC.eop().insets(20,0,0,0)); 88 106 107 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 108 JScrollPane scrollpane = new JScrollPane(panel); 109 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 110 gui.displaycontent.addTab(tr("GPS Points"), scrollpane); 111 panel = new JPanel(new GridBagLayout()); 112 panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 113 89 114 // directionHint 90 115 directionHint.addActionListener(new ActionListener(){ 91 116 public void actionPerformed(ActionEvent e) { … … 99 124 }); 100 125 directionHint.setToolTipText(tr("Draw direction hints for way segments.")); 101 126 directionHint.setSelected(Main.pref.getBoolean("draw.segment.direction")); 102 gui.display.add(directionHint, GBC.eop().insets(20,0,0,0));127 panel.add(directionHint, GBC.eop().insets(20,0,0,0)); 103 128 104 129 // only interesting directions 105 130 interestingDirections.setToolTipText(tr("Only interesting direction hints (e.g. with oneway tag).")); 106 131 interestingDirections.setSelected(Main.pref.getBoolean("draw.segment.relevant_directions_only")); 107 132 interestingDirections.setEnabled(directionHint.isSelected()); 108 gui.display.add(interestingDirections, GBC.eop().insets(40,0,0,0));133 panel.add(interestingDirections, GBC.eop().insets(40,0,0,0)); 109 134 110 135 // segment order number 111 136 segmentOrderNumber.setToolTipText(tr("Draw the order numbers of all segments within their way.")); 112 137 segmentOrderNumber.setSelected(Main.pref.getBoolean("draw.segment.order_number")); 113 gui.display.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0));138 panel.add(segmentOrderNumber, GBC.eop().insets(20,0,0,0)); 114 139 115 140 // antialiasing 116 141 useAntialiasing.setToolTipText(tr("Apply antialiasing to the map view resulting in a smoother appearance.")); 117 142 useAntialiasing.setSelected(Main.pref.getBoolean("mappaint.use-antialiasing")); 118 gui.display.add(useAntialiasing, GBC.eop().insets(20,0,0,0));143 panel.add(useAntialiasing, GBC.eop().insets(20,0,0,0)); 119 144 120 145 // downloaded area 121 146 sourceBounds.setToolTipText(tr("Draw the boundaries of data loaded from the server.")); 122 147 sourceBounds.setSelected(Main.pref.getBoolean("draw.data.downloaded_area", true)); 123 gui.display.add(sourceBounds, GBC.eop().insets(20,0,0,0));148 panel.add(sourceBounds, GBC.eop().insets(20,0,0,0)); 124 149 125 150 // virtual nodes 126 151 virtualNodes.setToolTipText(tr("Draw virtual nodes in select mode for easy way modification.")); 127 152 virtualNodes.setSelected(Main.pref.getInteger("mappaint.node.virtual-size", 8) != 0); 128 gui.display.add(virtualNodes, GBC.eop().insets(20,0,0,0));153 panel.add(virtualNodes, GBC.eop().insets(20,0,0,0)); 129 154 130 155 // background layers in inactive color 131 156 inactive.setToolTipText(tr("Draw the inactive data layers in a different color.")); 132 157 inactive.setSelected(Main.pref.getBoolean("draw.data.inactive_color", true)); 133 gui.display.add(inactive, GBC.eop().insets(20,0,0,0)); 158 panel.add(inactive, GBC.eop().insets(20,0,0,0)); 159 160 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.BOTH)); 161 scrollpane = new JScrollPane(panel); 162 scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); 163 gui.displaycontent.addTab(tr("OSM Data"), scrollpane); 134 164 } 135 165 136 166 public void ok() { … … 139 169 Main.pref.put("draw.rawgps.lines.force", forceRawGpsLines.isSelected()); 140 170 Main.pref.put("draw.rawgps.direction", drawGpsArrows.isSelected()); 141 171 Main.pref.put("draw.rawgps.alternatedirection", drawGpsArrowsFast.isSelected()); 172 Main.pref.put("draw.rawgps.min-arrow-distance", drawGpsArrowsFast.getText()); 142 173 Main.pref.put("draw.rawgps.colors", colorTracks.isSelected()); 143 174 Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected()); 144 175 Main.pref.put("draw.segment.direction", directionHint.isSelected());