- Timestamp:
- 2024-06-22T07:44:47+02:00 (10 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r19122 r19123 7 7 import static org.openstreetmap.josm.tools.I18n.trn; 8 8 9 import java.awt.GraphicsEnvironment; 9 10 import java.awt.event.ActionEvent; 10 11 import java.awt.event.KeyEvent; … … 43 44 import org.openstreetmap.josm.gui.io.importexport.FileImporter; 44 45 import org.openstreetmap.josm.gui.io.importexport.Options; 46 import org.openstreetmap.josm.gui.layer.Layer; 47 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer; 45 48 import org.openstreetmap.josm.gui.util.GuiHelper; 46 49 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; … … 274 277 protected void realRun() throws SAXException, IOException, OsmTransferException { 275 278 if (Utils.isEmpty(files)) return; 279 List<Layer> oldLayers = MainApplication.getLayerManager().getLayers(); 276 280 277 281 /* … … 378 382 PreferencesUtils.putListBounded(Config.getPref(), "file-open.history", maxsize, new ArrayList<>(fileHistory)); 379 383 } 384 if (!canceled && !GraphicsEnvironment.isHeadless()) { 385 checkNewLayers(oldLayers); 386 } 387 } 388 389 private static void checkNewLayers(List<Layer> oldLayers) { 390 // We do have to wrap the EDT call in a worker call, since layers may be created in the EDT. 391 // And the layer(s) must be added to the layer list in order for the dialog to work properly. 392 MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> { 393 List<Layer> newLayers = MainApplication.getLayerManager().getLayers(); 394 // see #23728: open first image of topmost new image layer 395 for (Layer l : newLayers) { 396 if (oldLayers.contains(l)) 397 return; 398 if (l instanceof GeoImageLayer) { 399 GeoImageLayer imageLayer = (GeoImageLayer) l; 400 imageLayer.jumpToNextMarker(); 401 return; 402 } 403 } 404 })); 380 405 } 381 406 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r19080 r19123 65 65 import org.openstreetmap.josm.gui.layer.Layer; 66 66 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 67 import org.openstreetmap.josm.gui.util.GuiHelper;68 67 import org.openstreetmap.josm.gui.util.imagery.Vector3D; 69 68 import org.openstreetmap.josm.tools.ImageProvider; … … 192 191 this.data.addImageDataUpdateListener(this); 193 192 this.data.setLayer(this); 194 if (!ImageViewerDialog.hasInstance()) {195 GuiHelper.runInEDTAndWait(() -> {196 if (!ImageViewerDialog.hasInstance()) {197 ImageViewerDialog.createInstance();198 }199 });200 }201 if (getInvalidGeoImages().size() == data.size()) {202 this.data.setSelectedImage(this.data.getFirstImage());203 // We do have to wrap the EDT call in a worker call, since layers may be created in the EDT.204 // And the layer must be added to the layer list in order for the dialog to work properly.205 MainApplication.worker.execute(() -> GuiHelper.runInEDT(() -> ImageViewerDialog.getInstance().displayImages(this.getSelection())));206 }207 193 } 208 194 … … 518 504 } 519 505 520 final IImageEntry<?> currentImage = ImageViewerDialog.getCurrentImage();521 506 for (ImageEntry e: data.getSelectedImages()) { 522 507 if (e != null && e.getPos() != null) { … … 533 518 g.setColor(new Color(128, 0, 0, 122)); 534 519 g.fillRect(p.x - imgDim.width / 2, p.y - imgDim.height / 2, imgDim.width, imgDim.height); 535 } else if (e.equals( currentImage)) {520 } else if (e.equals(ImageViewerDialog.getCurrentImage())) { 536 521 selectedIcon.paintIcon(mv, g, 537 522 p.x - imgDim.width / 2, … … 920 905 public void jumpToNextMarker() { 921 906 data.setSelectedImage(data.getNextImage()); 907 if (data.getSelectedImage() != null) 908 ImageViewerDialog.getInstance().displayImages(Collections.singletonList(data.getSelectedImage())); 909 922 910 } 923 911 … … 925 913 public void jumpToPreviousMarker() { 926 914 data.setSelectedImage(data.getPreviousImage()); 915 if (data.getSelectedImage() != null) 916 ImageViewerDialog.getInstance().displayImages(Collections.singletonList(data.getSelectedImage())); 927 917 } 928 918
Note:
See TracChangeset
for help on using the changeset viewer.