Changeset 2969 in josm
- Timestamp:
- 2010-02-12T20:01:55+01:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r2869 r2969 122 122 * in the last panel anyway. 123 123 */ 124 int k = N-1; // index of the current Panel (start with last one) 125 JPanel p = panels.get(k); // current Panel 126 k = -1; // indicates that the current Panel index is N-1, but no default-view-Dialog was added to this Panel yet. 124 JPanel p = panels.get(N-1); // current Panel (start with last one) 125 int k = -1; // indicates that the current Panel index is N-1, but no default-view-Dialog has been added to this Panel yet. 127 126 for (int i=N-1; i >= 0 ; --i) { 128 127 final ToggleDialog dlg = allDialogs.get(i); … … 171 170 if (dlg.isDialogInDefaultView()) { 172 171 if (dlg != triggeredBy) { 173 final int ph = dlg.getPreferredHeight(); 174 final int ah = dlg.getHeight(); 175 sumP += ph; 176 sumA += ah; 172 sumP += dlg.getPreferredHeight(); 173 sumA += dlg.getHeight(); 177 174 } 178 175 } else if (dlg.isDialogInCollapsedView()) { 179 176 sumC += dlg.getHeight(); 180 177 } 178 } 179 180 /** 181 * If we add additional dialogs on startup (e.g. geoimage), they may 182 * not have an actual height yet. 183 * In this case we simply reset everything to it's preferred size. 184 */ 185 if (sumA == 0) { 186 reconstruct(Action.ELEMENT_SHRINKS, null); 187 return; 181 188 } 182 189 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r2887 r2969 50 50 protected ToggleDialogAction toggleAction; 51 51 protected String preferencePrefix; 52 final protected String name; 52 53 53 54 /** DialogsPanel that manages all ToggleDialogs */ … … 100 101 super(new BorderLayout()); 101 102 this.preferencePrefix = iconName; 103 this.name = name; 102 104 103 105 /** Use the full width of the parent element */ … … 516 518 return "Dialog/"+help; 517 519 } 520 521 @Override 522 public String toString() { 523 return name; 524 } 525 518 526 /** 519 527 * Replies true if this dialog is showing either as docked or as detached dialog -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r2931 r2969 236 236 Main.main.addLayer(layer); 237 237 layer.hook_up_mouse_events(); // Main.map.mapView should exist 238 // now. Can add mouse listener238 // now. Can add mouse listener 239 239 Main.map.mapView.addPropertyChangeListener(layer); 240 if (!addedToggleDialog) { 241 // TODO Workaround for bug in DialogsPanel 242 // When GeoImageLayer is added as a first layer, division by zero exception is thrown 243 // This is caused by DialogsPanel.reconstruct method which use height of other dialogs 244 // to calculate height of newly added ImageViewerDialog. But height of other dialogs is 245 // zero because it's calculated by layout manager later 246 SwingUtilities.invokeLater(new Runnable() { 247 public void run() { 248 Main.map.addToggleDialog(ImageViewerDialog.getInstance()); 249 } 250 }); 251 addedToggleDialog = true; 240 if (Main.map.getToggleDialog(ImageViewerDialog.class) == null) { 241 System.err.println("JO"); 242 ImageViewerDialog.newInstance();// = new ImageViewerDialog(); 243 Main.map.addToggleDialog(ImageViewerDialog.getInstance()); 252 244 } 253 245 … … 271 263 } 272 264 273 private static boolean addedToggleDialog = false;274 275 265 public static void create(Collection<File> files, GpxLayer gpxLayer) { 276 266 Loader loader = new Loader(files, gpxLayer); … … 291 281 return ImageProvider.get("dialogs/geoimage"); 292 282 } 293 283 294 284 public static interface LayerMenuAddition { 295 285 public Component getComponent(Layer layer); … … 306 296 JMenuItem correlateItem = new JMenuItem(tr("Correlate to GPX"), ImageProvider.get("dialogs/geoimage/gpx2img")); 307 297 correlateItem.addActionListener(new CorrelateGpxWithImages(this)); 308 298 309 299 List<Component> entries = new ArrayList<Component>(); 310 300 entries.add(new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this))); … … 323 313 324 314 return entries.toArray(new Component[0]); 325 315 326 316 } 327 317 … … 335 325 + " " + trn("{0} was found to be GPS tagged.", "{0} were found to be GPS tagged.", i, i); 336 326 } 337 327 338 328 @Override public Object getInfoComponent() { 339 329 return infoText(); … … 752 742 Main.map.mapView.repaint(); 753 743 } 754 744 755 745 public List<ImageEntry> getImages() { 756 746 List<ImageEntry> copy = new ArrayList<ImageEntry>(); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r2931 r2969 44 44 private boolean centerView = false; 45 45 46 // Only one instance of that class 47 static private ImageViewerDialog INSTANCE = null;46 // Only one instance of that class is present at one time 47 private static ImageViewerDialog dialog; 48 48 49 49 private boolean collapseButtonClicked = false; 50 50 51 static void newInstance() { 52 dialog = new ImageViewerDialog(); 53 } 54 51 55 public static ImageViewerDialog getInstance() { 52 if ( INSTANCE== null) {53 INSTANCE = new ImageViewerDialog();54 } 55 return INSTANCE;56 if (dialog == null) { 57 throw new AssertionError(); // a new instance needs to be created first 58 } 59 return dialog; 56 60 } 57 61 … … 63 67 super(tr("Geotagged Images"), "geoimage", tr("Display geotagged images"), Shortcut.registerShortcut("tools:geotagged", tr("Tool: {0}", tr("Display geotagged images")), KeyEvent.VK_Y, Shortcut.GROUP_EDIT), 200); 64 68 65 if (INSTANCE != null) {66 throw new IllegalStateException("Image viewer dialog should not be instanciated twice !");67 }68 69 69 /* Don't show a detached dialog right from the start. */ 70 70 if (isShowing && !isDocked) { 71 71 setIsShowing(false); 72 72 } 73 74 INSTANCE = this;75 73 76 74 JPanel content = new JPanel(); … … 254 252 // osd.append(tr("\nImage gps time: {0}", Long.toString(entry.getGpsTime().getTime()))); 255 253 //} 256 254 257 255 imgDisplay.setOsdText(osd.toString()); 258 256 } else { -
trunk/styles/standard/elemstyles.xml
r2966 r2969 4237 4237 <rule> 4238 4238 <condition k="tiger:reviewed" v="no"/> 4239 <linemod mode="under" width="10" colour="tiger_data#808000 "/>4239 <linemod mode="under" width="10" colour="tiger_data#80800090"/> 4240 4240 </rule> 4241 4241
Note:
See TracChangeset
for help on using the changeset viewer.