Changeset 9840 in josm


Ignore:
Timestamp:
2016-02-19T23:41:45+01:00 (9 years ago)
Author:
wiktorn
Message:

ZoomPreferences.patch and NativeScaleLayerChange.patch by kolesar.

See: #12350

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r9818 r9840  
    16561656                    break;
    16571657                case 1:
    1658                     if (Main.map.mapView.getNativeScaleLayer() == l) {
     1658                    NativeScaleLayer oldLayer = Main.map.mapView.getNativeScaleLayer();
     1659                    if (oldLayer == l) {
    16591660                        Main.map.mapView.setNativeScaleLayer(null);
    16601661                    } else if (l instanceof NativeScaleLayer) {
    16611662                        Main.map.mapView.setNativeScaleLayer((NativeScaleLayer) l);
     1663                        if (oldLayer != null) {
     1664                            int idx = getLayers().indexOf(oldLayer);
     1665                            if (idx >= 0) {
     1666                                fireTableCellUpdated(idx, col);
     1667                            }
     1668                        }
    16621669                    }
    16631670                    break;
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r9824 r9840  
    1313import javax.swing.DefaultListCellRenderer;
    1414import javax.swing.JCheckBox;
     15import javax.swing.JFormattedTextField;
    1516import javax.swing.JLabel;
    1617import javax.swing.JList;
    1718import javax.swing.JScrollPane;
     19import javax.swing.JSpinner;
    1820import javax.swing.ListCellRenderer;
    1921import javax.swing.LookAndFeel;
     22import javax.swing.SpinnerNumberModel;
    2023import javax.swing.UIManager;
    2124import javax.swing.UIManager.LookAndFeelInfo;
     
    2427import org.openstreetmap.josm.actions.ExpertToggleAction;
    2528import org.openstreetmap.josm.gui.MapMover;
     29import org.openstreetmap.josm.gui.NavigatableComponent;
    2630import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    2731import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     
    6468    private final JCheckBox nativeFileChoosers = new JCheckBox(tr("Use native file choosers (nicer, but do not support file filters)"));
    6569    private final JCheckBox zoomReverseWheel = new JCheckBox(tr("Reverse zoom with mouse wheel"));
     70    private final JCheckBox zoomIntermediateSteps = new JCheckBox(tr("Intermediate steps between native resolutions"));
     71    private JSpinner spinZoomRatio;
    6672
    6773    @Override
     
    148154        panel.add(zoomReverseWheel, GBC.eop().insets(20, 0, 0, 0));
    149155
    150         panel.add(Box.createVerticalGlue(), GBC.eol().insets(0, 20, 0, 0));
     156        zoomIntermediateSteps.setToolTipText(
     157                tr("Divide intervals between native resolution levels to smaller steps if they are much larger than zoom ratio"));
     158        zoomIntermediateSteps.setSelected(NavigatableComponent.PROP_ZOOM_INTERMEDIATE_STEPS.get());
     159        ExpertToggleAction.addVisibilitySwitcher(zoomIntermediateSteps);
     160        panel.add(zoomIntermediateSteps, GBC.eop().insets(20, 0, 0, 0));
     161
     162        panel.add(Box.createVerticalGlue(), GBC.eol().insets(0, 10, 0, 0));
     163
     164        double logZoomLevel = Math.log(2) / Math.log(NavigatableComponent.PROP_ZOOM_RATIO.get());
     165        logZoomLevel = Math.max(1, logZoomLevel);
     166        logZoomLevel = Math.min(5, logZoomLevel);
     167        JLabel labelZoomRatio = new JLabel(tr("Zoom steps to get double scale"));
     168        spinZoomRatio = new JSpinner(new SpinnerNumberModel(logZoomLevel, 1, 5, 1));
     169        Component spinZoomRatioEditor = spinZoomRatio.getEditor();
     170        JFormattedTextField jftf = ((JSpinner.DefaultEditor) spinZoomRatioEditor).getTextField();
     171        jftf.setColumns(2);
     172        String zoomRatioToolTipText = tr("Higher value means more steps needed, therefore zoom steps will be smaller");
     173        spinZoomRatio.setToolTipText(zoomRatioToolTipText);
     174        labelZoomRatio.setToolTipText(zoomRatioToolTipText);
     175        labelZoomRatio.setLabelFor(spinZoomRatio);
     176        panel.add(labelZoomRatio, GBC.std().insets(20, 0, 0, 0));
     177        panel.add(GBC.glue(5, 0), GBC.std().fill(GBC.HORIZONTAL));
     178        panel.add(spinZoomRatio, GBC.eol());
    151179
    152180        panel.add(new JLabel(tr("Look and Feel")), GBC.std().insets(20, 0, 0, 0));
     
    169197        Main.pref.put(DateUtils.PROP_ISO_DATES.getKey(), isoDates.isSelected());
    170198        Main.pref.put(FileChooserManager.PROP_USE_NATIVE_FILE_DIALOG.getKey(), nativeFileChoosers.isSelected());
    171         Main.pref.put(MapMover.PROP_ZOOM_REVERSE_WHEEL.getKey(), zoomReverseWheel.isSelected());
     199        MapMover.PROP_ZOOM_REVERSE_WHEEL.put(zoomReverseWheel.isSelected());
     200        NavigatableComponent.PROP_ZOOM_INTERMEDIATE_STEPS.put(zoomIntermediateSteps.isSelected());
     201        NavigatableComponent.PROP_ZOOM_RATIO.put(Math.pow(2, 1/(double) spinZoomRatio.getModel().getValue()));
    172202        mod |= Main.pref.put("laf", ((LookAndFeelInfo) lafCombo.getSelectedItem()).getClassName());
    173203        return mod;
Note: See TracChangeset for help on using the changeset viewer.