Changeset 36121 in osm for applications


Ignore:
Timestamp:
2023-08-16T11:11:49+02:00 (11 months ago)
Author:
stoecker
Message:

extend prefs

Location:
applications/editors/josm/plugins/livegps/src/livegps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGPSPreferences.java

    r36117 r36121  
    6060    private final JTextField serialDevice = new JTextField(30);
    6161    private final JCheckBox disableGPSD = new JCheckBox(tr("Disable GPSD"));
     62    private final JCheckBox showOffset = new JCheckBox(tr("Show Distance to nearest way"));
    6263
    6364    public LiveGPSPreferences() {
     
    7980        panel.add(gpsdPort, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(5, 0, 0, 5));
    8081
     82        disableGPSD.setSelected(Config.getPref().getBoolean(C_DISABLED, false));
     83        panel.add(disableGPSD, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(0, 0, 0, 5));
     84
    8185        serialDevice.setText(Config.getPref().get(C_SERIAL));
    82         serialDevice.setToolTipText(tr("Serial device for direct NMEA input, does not exist by default"));
     86        serialDevice.setToolTipText(tr(".Serial device for direct NMEA input, does not exist by default.</html>"));
    8387        panel.add(new JLabel(tr("Serial device")), GBC.std());
    8488        panel.add(serialDevice, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(5, 0, 0, 5));
     89        /* I18n : {0} to {3} is like /dev/ttyACM<b>x</b>, {4} and {5} are COM1 and COM9 */
     90        panel.add(new JLabel(tr("<html>For Linux {0}, {1}, {2} or {3} (<b>x</b> means any number beginning with 0).<br>For Windows {4} to {5} (COM ports bigger than 9 wont work).</html>", "/dev/ttyS<b>x</b>", "/dev/ttyACM<b>x</b>", "/dev/ttyUSB<b>x</b>", "/dev/rfcomm<b>x</b>", "COM1", "COM9")), GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(10, 0, 0, 5));
    8591
    86         disableGPSD.setSelected(Config.getPref().getBoolean(C_DISABLED));
    87         panel.add(disableGPSD, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(5, 0, 0, 5));
     92        showOffset.setSelected(Config.getPref().getBoolean(C_WAYOFFSET, false));
     93        panel.add(showOffset, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(0, 0, 0, 5));
    8894
    8995        panel.add(Box.createVerticalGlue(), GBC.eol().fill(GridBagConstraints.VERTICAL));
     
    97103        Config.getPref().put(C_SERIAL, serialDevice.getText());
    98104        Config.getPref().putBoolean(C_DISABLED, disableGPSD.isSelected());
     105        Config.getPref().putBoolean(C_WAYOFFSET, showOffset.isSelected());
    99106        return false;
    100107    }
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsData.java

    r36120 r36121  
    176176        if (wayString == null) {
    177177            Node n = new Node(latLon);
     178            Way way = null;
    178179            DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
    179             Way way = Geometry.getClosestPrimitive(n, ds.getWays());
     180            if (ds != null)
     181                Geometry.getClosestPrimitive(n, ds.getWays());
    180182            if (way != null) {
    181183                wayString = way.getDisplayName(new DefaultNameFormatter() {
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsDialog.java

    r36120 r36121  
    4141    private JLabel courseLabel;
    4242    private JLabel speedLabel;
     43    private JLabel wayText;
    4344    private JPanel panel;
    4445    private LiveGpsStatus status = new LiveGpsStatus(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
     
    5657        panel.add(nmeaStatusText = new JLabel(tr("Status NMEA")));
    5758        panel.add(nmeaStatusLabel = new JLabel());
    58         panel.add(new JLabel(tr("Way Info")));
     59        panel.add(wayText = new JLabel(tr("Way Info")));
    5960        panel.add(wayLabel = new JLabel());
    6061        panel.add(latText = new JLabel(tr("Latitude")));
     
    6768        panel.add(courseLabel = new JLabel());
    6869        setStatusVisibility(true);
     70        if (Config.getPref().getBoolean(LiveGPSPreferences.C_WAYOFFSET, false)) {
     71            /* I18N: way information with offset (in m) enabled */
     72            wayText.setText(tr("Way Info [m]"));
     73        } else {
     74            wayText.setText(tr("Way Info"));
     75        }
    6976        createLayout(panel, true, null);
    7077    }
     
    110117                        longText.setText(tr("Longitude"));
    111118                    }
     119
    112120                    latLabel.setText(mCord.latToString(data.getLatLon()));
    113121                    longLabel.setText(mCord.lonToString(data.getLatLon()));
     
    121129                    } else {
    122130                        wayLabel.setText(tr("unknown"));
     131                    }
     132                    if (Config.getPref().getBoolean(LiveGPSPreferences.C_WAYOFFSET, false)) {
     133                        /* I18N: way information with offset (in m) enabled */
     134                        wayText.setText(tr("Way Info [m]"));
     135                    } else {
     136                        wayText.setText(tr("Way Info"));
    123137                    }
    124138                } else {
Note: See TracChangeset for help on using the changeset viewer.