Changeset 2749 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-01-07T07:58:44+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r2711 r2749 40 40 allDialogs = new ArrayList<ToggleDialog>(); 41 41 42 for ( Integer i=0; i <pAllDialogs.size(); ++i) {43 add( pAllDialogs.get(i), false);42 for (ToggleDialog dialog: pAllDialogs) { 43 add(dialog, false); 44 44 } 45 45 … … 106 106 /* INVISIBLE_TO_COLLAPSED, does not happen */ 107 107 ELEMENT_SHRINKS /* else. (Remaining elements have more space.) */ 108 } ;108 } 109 109 /** 110 110 * Reconstruct the view, if the configurations of dialogs has changed. … … 119 119 * reset the panels 120 120 */ 121 for (int i=0; i < N; ++i) { 122 final JPanel p = panels.get(i); 121 for (JPanel p: panels) { 123 122 p.removeAll(); 124 123 p.setVisible(false); … … 180 179 int sumC = 0; // sum of heights of all collapsed dialogs (triggering dialog is never collapsed) 181 180 182 for (int i=0; i<N; ++i) { 183 final ToggleDialog dlg = allDialogs.get(i); 181 for (ToggleDialog dlg: allDialogs) { 184 182 if (dlg.isDialogInDefaultView()) { 185 183 if (dlg != triggeredBy) { 186 184 final int ph = dlg.getPreferredHeight(); 187 final int ah = dlg.get Size().height;185 final int ah = dlg.getHeight(); 188 186 sumP += ph; 189 187 sumA += ah; 190 188 } 191 } 192 else if (dlg.isDialogInCollapsedView()) { 193 sumC += dlg.getSize().height; 189 } else if (dlg.isDialogInCollapsedView()) { 190 sumC += dlg.getHeight(); 194 191 } 195 192 } … … 234 231 final ToggleDialog dlg = allDialogs.get(i); 235 232 if (dlg.isDialogInDefaultView() && dlg != triggeredBy) { 236 final int ha = dlg.get Size().height;233 final int ha = dlg.getHeight(); 237 234 final int h0 = ha * R / sumA; 238 235 final int he = dlg.getPreferredHeight() * s2 / (sumP + hp_trig); … … 246 243 } catch (ArithmeticException e) { /* D_p may be zero - nothing wrong with that. */ 247 244 d = 0; 248 } ;245 } 249 246 dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, h0 - d)); 250 247 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r2733 r2749 10 10 11 11 import java.awt.AlphaComposite; 12 import java.awt.BorderLayout;13 12 import java.awt.Color; 14 13 import java.awt.Component; … … 31 30 import java.util.Collection; 32 31 import java.util.Collections; 33 import java.util.Date;34 32 import java.util.HashSet; 35 33 import java.util.LinkedHashSet; … … 40 38 import javax.swing.JMenuItem; 41 39 import javax.swing.JOptionPane; 42 import javax.swing.JPanel;43 40 import javax.swing.JSeparator; 44 41 import javax.swing.SwingConstants; 42 import javax.swing.SwingUtilities; 45 43 46 44 import org.openstreetmap.josm.Main; … … 48 46 import org.openstreetmap.josm.actions.mapmode.MapMode; 49 47 import org.openstreetmap.josm.data.Bounds; 50 import org.openstreetmap.josm.data.coor.CachedLatLon;51 48 import org.openstreetmap.josm.data.coor.LatLon; 52 49 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 53 50 import org.openstreetmap.josm.gui.ExtendedDialog; 54 51 import org.openstreetmap.josm.gui.MapFrame; 55 import org.openstreetmap.josm.gui.MapFrame.MapModeChangeListener;56 52 import org.openstreetmap.josm.gui.MapView; 57 53 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 54 import org.openstreetmap.josm.gui.MapFrame.MapModeChangeListener; 58 55 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 59 56 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 64 61 65 62 import com.drew.imaging.jpeg.JpegMetadataReader; 63 import com.drew.lang.CompoundException; 66 64 import com.drew.lang.Rational; 67 65 import com.drew.metadata.Directory; … … 239 237 Main.map.mapView.addPropertyChangeListener(layer); 240 238 if (!addedToggleDialog) { 241 Main.map.addToggleDialog(ImageViewerDialog.getInstance()); 239 // TODO Workaround for bug in DialogsPanel 240 // When GeoImageLayer is added as a first layer, division by zero exception is thrown 241 // This is caused by DialogsPanel.reconstruct method which use height of other dialogs 242 // to calculate height of newly added ImageViewerDialog. But height of other dialogs is 243 // zero because it's calculated by layout manager later 244 SwingUtilities.invokeLater(new Runnable() { 245 public void run() { 246 Main.map.addToggleDialog(ImageViewerDialog.getInstance()); 247 } 248 }); 242 249 addedToggleDialog = true; 243 250 } … … 515 522 e.exifCoor = e.getPos(); 516 523 517 } catch (Exception p) { 524 } catch (CompoundException p) { 518 525 e.exifCoor = null; 519 526 e.setPos(null); … … 531 538 currentPhoto = -1; 532 539 } 533 Main.ma in.map.repaint();540 Main.map.repaint(); 534 541 } 535 542 … … 544 551 currentPhoto = -1; 545 552 } 546 Main.ma in.map.repaint();553 Main.map.repaint(); 547 554 } 548 555 … … 565 572 } 566 573 updateOffscreenBuffer = true; 567 Main.ma in.map.repaint();574 Main.map.repaint(); 568 575 } 569 576 } … … 578 585 tr("Delete image file from disk"), 579 586 new String[] {tr("Cancel"), tr("Delete")}) 580 581 587 .setButtonIcons(new String[] {"cancel.png", "dialogs/delete.png"}) 588 .setContent(new JLabel(tr("<html><h3>Delete the file {0} from disk?<p>The image file will be permanently lost!</h3></html>" 582 589 ,toDelete.file.getName()), ImageProvider.get("dialogs/geoimage/deletefromdisk"),SwingConstants.LEFT)) 583 .toggleEnable("geoimage.deleteimagefromdisk") 584 .setCancelButton(1) 585 .setDefaultButton(2) 586 .showDialog() 587 .getValue(); 590 .toggleEnable("geoimage.deleteimagefromdisk") 591 .setCancelButton(1) 592 .setDefaultButton(2) 593 .showDialog() 594 .getValue(); 588 595 589 596 if(result == 2) … … 603 610 } else { 604 611 JOptionPane.showMessageDialog( 605 Main.parent, 606 tr("Image file could not be deleted."), 607 tr("Error"), 608 JOptionPane.ERROR_MESSAGE 612 Main.parent, 613 tr("Image file could not be deleted."), 614 tr("Error"), 615 JOptionPane.ERROR_MESSAGE 609 616 ); 610 617 } 611 618 612 619 updateOffscreenBuffer = true; 613 Main.ma in.map.repaint();620 Main.map.repaint(); 614 621 } 615 622 } … … 655 662 currentPhoto = i; 656 663 ImageViewerDialog.showImage(GeoImageLayer.this, e); 657 Main.ma in.map.repaint();664 Main.map.repaint(); 658 665 break; 659 666 } … … 672 679 }; 673 680 674 Ma in.map.addMapModeChangeListener(mapModeListener);681 MapFrame.addMapModeChangeListener(mapModeListener); 675 682 mapModeListener.mapModeChange(null, Main.map.mapMode); 676 683 … … 692 699 } 693 700 Main.map.mapView.removeMouseListener(mouseAdapter); 694 Ma in.map.removeMapModeChangeListener(mapModeListener);701 MapFrame.removeMapModeChangeListener(mapModeListener); 695 702 currentPhoto = -1; 696 703 data.clear();
Note:
See TracChangeset
for help on using the changeset viewer.