Changeset 18755 in josm


Ignore:
Timestamp:
2023-06-14T14:10:09+02:00 (19 months ago)
Author:
taylor.smock
Message:

Fix #22751: Improve fullscreen mode (patch by kolesar, modified)

  • Remove 1 pixel border drawn around map
  • Remove 1 pixel border drawn when in ImproveWayAccuracy mode and in the SELECTING state when there is a way under the mouse
  • Add advanced preference (navigation.always-visible, default true) which hides zoom and scale controls

Modifications are cleaning up some SonarLint issues.

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DialogsToggleAction.java

    r17188 r18755  
    6666                MapFrame.SIDE_TOOLBAR_VISIBLE.put(selected);
    6767            }
     68            map.mapView.setMapNavigationComponentVisibility(selected || Config.getPref().getBoolean("navigation.always-visible", true));
    6869            map.mapView.rememberLastPositionOnScreen();
    6970        }
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r16987 r18755  
    3939import javax.swing.KeyStroke;
    4040import javax.swing.SwingConstants;
    41 import javax.swing.border.Border;
    4241import javax.swing.event.PopupMenuEvent;
    4342import javax.swing.event.PopupMenuListener;
    4443import javax.swing.plaf.basic.BasicArrowButton;
    45 import javax.swing.plaf.basic.BasicSplitPaneDivider;
    46 import javax.swing.plaf.basic.BasicSplitPaneUI;
    4744
    4845import org.openstreetmap.josm.actions.ExpertToggleAction;
     
    227224        splitPane.setDividerSize(5);
    228225        splitPane.setBorder(null);
    229         splitPane.setUI(new NoBorderSplitPaneUI());
    230226
    231227        // JSplitPane supports F6, F8, Home and End shortcuts by default, but we need them for Audio and Image Mapping actions
     
    313309     */
    314310    public boolean selectSelectTool(boolean onlyIfModeless) {
    315         if (onlyIfModeless && !MODELESS.get())
     311        if (onlyIfModeless && Boolean.FALSE.equals(MODELESS.get()))
    316312            return false;
    317313
     
    325321     */
    326322    public boolean selectDrawTool(boolean onlyIfModeless) {
    327         if (onlyIfModeless && !MODELESS.get())
     323        if (onlyIfModeless && Boolean.FALSE.equals(MODELESS.get()))
    328324            return false;
    329325
     
    337333     */
    338334    public boolean selectZoomTool(boolean onlyIfModeless) {
    339         if (onlyIfModeless && !MODELESS.get())
     335        if (onlyIfModeless && Boolean.FALSE.equals(MODELESS.get()))
    340336            return false;
    341337
     
    568564        if (statusLine != null && Config.getPref().getBoolean("statusline.visible", true)) {
    569565            panel.add(statusLine, BorderLayout.SOUTH);
    570         }
    571     }
    572 
    573     static final class NoBorderSplitPaneUI extends BasicSplitPaneUI {
    574         static final class NoBorderBasicSplitPaneDivider extends BasicSplitPaneDivider {
    575             NoBorderBasicSplitPaneDivider(BasicSplitPaneUI ui) {
    576                 super(ui);
    577             }
    578 
    579             @Override
    580             public void setBorder(Border b) {
    581                 // Do nothing
    582             }
    583         }
    584 
    585         @Override
    586         public BasicSplitPaneDivider createDefaultDivider() {
    587             return new NoBorderBasicSplitPaneDivider(this);
    588566        }
    589567    }
     
    685663                        @Override
    686664                        public void actionPerformed(ActionEvent e) {
    687                             if ((Boolean) getValue(SELECTED_KEY)) {
     665                            if (Boolean.TRUE.equals(getValue(SELECTED_KEY))) {
    688666                                t.showButton();
    689667                            } else {
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r18211 r18755  
    33
    44import java.awt.AlphaComposite;
     5import java.awt.BasicStroke;
    56import java.awt.Color;
    67import java.awt.Dimension;
     
    1011import java.awt.Rectangle;
    1112import java.awt.Shape;
     13import java.awt.Stroke;
    1214import java.awt.event.ComponentAdapter;
    1315import java.awt.event.ComponentEvent;
     
    103105                    MainApplication.getLayerManager().getLayers()
    104106                        .stream()
    105                         .filter(layer -> layer instanceof OsmDataLayer)
     107                        .filter(OsmDataLayer.class::isInstance)
    106108                        .forEach(Layer::invalidate)
    107109                );
     
    237239    private transient MapMover mapMover;
    238240
     241    private final List<? extends JComponent> mapNavigationComponents;
     242    private final Stroke worldBorderStroke = new BasicStroke(1.0f);
     243
    239244    /**
    240245     * The listener that listens to invalidations of all layers.
     
    294299        setFocusTraversalKeysEnabled(!Shortcut.findShortcut(KeyEvent.VK_TAB, 0).isPresent());
    295300
    296         for (JComponent c : getMapNavigationComponents(this)) {
     301        mapNavigationComponents = getMapNavigationComponents(this);
     302        for (JComponent c : mapNavigationComponents) {
    297303            add(c);
    298304        }
    299         if (AutoFilterManager.PROP_AUTO_FILTER_ENABLED.get()) {
     305        if (Boolean.TRUE.equals(AutoFilterManager.PROP_AUTO_FILTER_ENABLED.get())) {
    300306            AutoFilterManager.getInstance().enableAutoFilterRule(AutoFilterManager.PROP_AUTO_FILTER_RULE.get());
    301307        }
     
    659665    private void drawWorldBorders(Graphics2D tempG) {
    660666        tempG.setColor(Color.WHITE);
     667        tempG.setStroke(worldBorderStroke);
    661668        Bounds b = getProjection().getWorldBoundsLatLon();
    662669
     
    912919        return mapMover;
    913920    }
     921
     922    /**
     923     * Set the visibility of the navigation component
     924     * @param visible {@code true} to make the navigation component visible
     925     * @since 18755
     926     */
     927    public void setMapNavigationComponentVisibility(boolean visible) {
     928        for (JComponent c : mapNavigationComponents) {
     929            c.setVisible(visible);
     930        }
     931    }
    914932}
Note: See TracChangeset for help on using the changeset viewer.