- Timestamp:
- 2020-01-07T23:57:15+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java
r15586 r15660 34 34 import javax.swing.JPopupMenu; 35 35 import javax.swing.JSlider; 36 import javax.swing.SwingUtilities; 36 37 import javax.swing.UIManager; 37 38 import javax.swing.border.Border; … … 63 64 */ 64 65 private static final int SLIDER_WHEEL_INCREMENT = 5; 66 private static final double DEFAULT_OPACITY = 1; 67 private static final double DEFAULT_GAMMA_VALUE = 0; 68 private static final double DEFAULT_SHARPNESS_FACTOR = 1; 65 69 private static final double MAX_SHARPNESS_FACTOR = 2; 70 private static final double DEFAULT_COLORFUL_FACTOR = 1; 66 71 private static final double MAX_COLORFUL_FACTOR = 2; 67 72 private final LayerListModel model; … … 231 236 * @param minValue The minimum value to map to the left side. 232 237 * @param maxValue The maximum value to map to the right side. 238 * @param defaultValue The default value for resetting. 233 239 * @param layerClassFilter The type of layer influenced by this filter. 234 240 */ 235 AbstractFilterSlider(double minValue, double maxValue, Class<T> layerClassFilter) {241 AbstractFilterSlider(double minValue, double maxValue, double defaultValue, Class<T> layerClassFilter) { 236 242 super(new GridBagLayout()); 237 243 this.minValue = minValue; … … 251 257 252 258 slider.addChangeListener(e -> onStateChanged()); 259 slider.addMouseListener(new MouseAdapter() { 260 @Override 261 public void mouseClicked(MouseEvent e) { 262 if (e != null && SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) { 263 setRealValue(defaultValue); 264 } 265 } 266 }); 253 267 254 268 //final NumberFormat format = DecimalFormat.getInstance(); … … 352 366 */ 353 367 OpacitySlider() { 354 super(0, 1, Layer.class);368 super(0, 1, DEFAULT_OPACITY, Layer.class); 355 369 setLabels("0%", "50%", "100%"); 356 slider.setToolTipText(tr("Adjust opacity of the layer.") );370 slider.setToolTipText(tr("Adjust opacity of the layer.") + " " + tr("Double click to reset.")); 357 371 } 358 372 … … 425 439 */ 426 440 GammaFilterSlider() { 427 super(-1, 1, ImageryLayer.class);441 super(-1, 1, DEFAULT_GAMMA_VALUE, ImageryLayer.class); 428 442 setLabels("0", "1", "∞"); 429 slider.setToolTipText(tr("Adjust gamma value of the layer.") );443 slider.setToolTipText(tr("Adjust gamma value of the layer.") + " " + tr("Double click to reset.")); 430 444 } 431 445 … … 485 499 */ 486 500 SharpnessSlider() { 487 super(0, MAX_SHARPNESS_FACTOR, ImageryLayer.class);501 super(0, MAX_SHARPNESS_FACTOR, DEFAULT_SHARPNESS_FACTOR, ImageryLayer.class); 488 502 setLabels(trc("image sharpness", "blurred"), trc("image sharpness", "normal"), trc("image sharpness", "sharp")); 489 slider.setToolTipText(tr("Adjust sharpness/blur value of the layer.") );503 slider.setToolTipText(tr("Adjust sharpness/blur value of the layer.") + " " + tr("Double click to reset.")); 490 504 } 491 505 … … 523 537 */ 524 538 ColorfulnessSlider() { 525 super(0, MAX_COLORFUL_FACTOR, ImageryLayer.class);539 super(0, MAX_COLORFUL_FACTOR, DEFAULT_COLORFUL_FACTOR, ImageryLayer.class); 526 540 setLabels(trc("image colorfulness", "less"), trc("image colorfulness", "normal"), trc("image colorfulness", "more")); 527 slider.setToolTipText(tr("Adjust colorfulness of the layer.") );541 slider.setToolTipText(tr("Adjust colorfulness of the layer.") + " " + tr("Double click to reset.")); 528 542 } 529 543
Note:
See TracChangeset
for help on using the changeset viewer.