Changeset 32581 in osm for applications/editors/josm


Ignore:
Timestamp:
2016-07-05T14:49:10+02:00 (8 years ago)
Author:
floscher
Message:

[mapillary] Remove preference mapillary.reverse-buttons

The buttons for the MapillaryMainDialog are now always displayed at the bottom.
Having the buttons at the top didn't bring additional value, but instead made the class MapillaryMainDialog more complicated and added inconsistency with the rest of JOSM.

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java

    r32396 r32581  
    88import java.awt.Color;
    99import java.awt.Component;
    10 import java.awt.FlowLayout;
    11 import java.awt.GridLayout;
    1210import java.awt.event.ActionEvent;
    1311import java.awt.event.KeyEvent;
     
    2119import javax.swing.AbstractAction;
    2220import javax.swing.JComponent;
    23 import javax.swing.JPanel;
    2421import javax.swing.KeyStroke;
    2522import javax.swing.SwingUtilities;
     
    6057
    6158  private final SideButton nextButton = new SideButton(new NextPictureAction());
    62   private final SideButton previousButton = new SideButton(
    63           new PreviousPictureAction());
     59  private final SideButton previousButton = new SideButton(new PreviousPictureAction());
    6460  /**
    6561   * Button used to jump to the image following the red line
     
    9086    WALK;
    9187  }
    92 
    93   private JPanel buttonsPanel;
    9488
    9589  /**
     
    112106    this.redButton.setForeground(Color.RED);
    113107
    114     createLayout(
    115             this.mapillaryImageDisplay,
    116             Arrays.asList(new SideButton[]{this.blueButton, this.previousButton, this.nextButton, this.redButton}),
    117             Main.pref.getBoolean("mapillary.reverse-buttons"));
    118     disableAllButtons();
    119 
     108    setMode(MODE.NORMAL);
    120109  }
    121110
     
    153142   * Sets a new mode for the dialog.
    154143   *
    155    * @param mode The mode to be set.
     144   * @param mode The mode to be set. Must not be {@code null}.
    156145   */
    157146  public void setMode(MODE mode) {
     
    159148      case WALK:
    160149        createLayout(
    161                 this.mapillaryImageDisplay,
    162                 Arrays.asList(new SideButton[]{playButton, pauseButton, stopButton}),
    163                 Main.pref.getBoolean("mapillary.reverse-buttons"));
     150          this.mapillaryImageDisplay,
     151          Arrays.asList(new SideButton[]{playButton, pauseButton, stopButton})
     152        );
    164153        break;
    165154      case NORMAL:
    166155      default:
    167156        createLayout(
    168                 this.mapillaryImageDisplay,
    169                 Arrays.asList(new SideButton[]{blueButton, previousButton, nextButton, redButton}),
    170                 Main.pref.getBoolean("mapillary.reverse-buttons"));
     157          this.mapillaryImageDisplay,
     158          Arrays.asList(new SideButton[]{blueButton, previousButton, nextButton, redButton})
     159        );
    171160        break;
    172161    }
    173162    disableAllButtons();
    174     if (mode.equals(MODE.NORMAL))
     163    if (MODE.NORMAL.equals(mode)) {
    175164      updateImage();
    176 
     165    }
    177166  }
    178167
     
    379368    public PreviousPictureAction() {
    380369      putValue(NAME, tr("Previous picture"));
    381       putValue(SHORT_DESCRIPTION,
    382               tr("Shows the previous picture in the sequence"));
     370      putValue(SHORT_DESCRIPTION, tr("Shows the previous picture in the sequence"));
    383371    }
    384372
     
    563551   * @param data    The content of the dialog
    564552   * @param buttons The buttons where you can click
    565    * @param reverse {@code true} if the buttons should go at the top; {@code false}
    566    *                otherwise.
    567    */
    568   public void createLayout(Component data, List<SideButton> buttons,
    569                            boolean reverse) {
    570     this.removeAll();
    571     JPanel panel = new JPanel();
    572     panel.setLayout(new BorderLayout());
    573     panel.add(data, BorderLayout.CENTER);
    574     if (reverse) {
    575       this.buttonsPanel = new JPanel(new GridLayout(1, 1));
    576       if (!buttons.isEmpty() && buttons.get(0) != null) {
    577         final JPanel buttonRowPanel = new JPanel(
    578             Main.pref.getBoolean("dialog.align.left", false)
    579             ? new FlowLayout(FlowLayout.LEFT)
    580             : new GridLayout(1, buttons.size())
    581         );
    582         this.buttonsPanel.add(buttonRowPanel);
    583         for (SideButton button : buttons) {
    584           buttonRowPanel.add(button);
    585         }
    586       }
    587       panel.add(this.buttonsPanel, BorderLayout.NORTH);
    588       createLayout(panel, true, null);
    589     } else {
    590       createLayout(panel, true, buttons);
    591     }
    592     this.add(this.titleBar, BorderLayout.NORTH);
     553   */
     554  public void createLayout(Component data, List<SideButton> buttons) {
     555    removeAll();
     556    createLayout(data, true, buttons);
     557    add(titleBar, BorderLayout.NORTH);
    593558  }
    594559
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java

    r32579 r32581  
    4747 */
    4848public class MapillaryPreferenceSetting implements SubPreferenceSetting, MapillaryLoginListener {
    49 
    50   private final JCheckBox reverseButtons = new JCheckBox(I18n.tr("Reverse buttons position when displaying images."));
    5149  private final JComboBox<String> downloadModeComboBox = new JComboBox<>(new String[]{
    5250      MapillaryDownloader.MODES.Automatic.toString(),
     
    9694
    9795    JPanel mainPanel = new JPanel();
    98     reverseButtons.setSelected(Main.pref.getBoolean("mapillary.reverse-buttons"));
    9996    displayHour.setSelected(Main.pref.getBoolean("mapillary.display-hour", true));
    10097    format24.setSelected(Main.pref.getBoolean("mapillary.format-24"));
     
    117114    mainPanel.add(downloadModePanel, GBC.eol());
    118115
    119     mainPanel.add(reverseButtons, GBC.eol());
    120116    mainPanel.add(displayHour, GBC.eol());
    121117    mainPanel.add(format24, GBC.eol());
     
    123119    mainPanel.add(hoverEnabled, GBC.eol());
    124120    MapillaryColorScheme.styleAsDefaultPanel(
    125       mainPanel, downloadModePanel, reverseButtons, displayHour, format24, moveTo
     121      mainPanel, downloadModePanel, displayHour, format24, moveTo, hoverEnabled
    126122    );
    127123    mainPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GridBagConstraints.BOTH));
     
    172168  public boolean ok() {
    173169    boolean mod = false;
    174     Main.pref.put("mapillary.reverse-buttons", this.reverseButtons.isSelected());
    175170
    176171    MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getDownloadViewMenu(), false);
Note: See TracChangeset for help on using the changeset viewer.