Changeset 32169 in osm for applications/editors/josm/plugins/print/src
- Timestamp:
- 2016-05-12T00:08:52+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintPreview.java
r32167 r32169 60 60 * The PageFormat chosen for printing (and preview) 61 61 */ 62 protected transient PageFormat format = null;62 protected transient PageFormat format; 63 63 64 64 /** … … 76 76 * When this flag is true, no painting operations will be performed. 77 77 */ 78 protected boolean paintingDisabled = false;78 protected boolean paintingDisabled; 79 79 80 80 /** 81 81 * the printable object for rendering preview contents 82 82 */ 83 protected transient Printable printable = null;83 protected transient Printable printable; 84 84 85 85 /** … … 157 157 * Zoom to fit the page size 158 158 * 159 * Set the zoom factor such that the whole page fits into the 160 * preview area. 159 * Set the zoom factor such that the whole page fits into the preview area. 161 160 */ 162 161 public void zoomToPage() { 162 if (format == null) 163 return; 163 164 Container parent = getParent(); 164 165 Dimension dim; 165 166 if (parent instanceof JViewport) { 166 167 dim = getParent().getSize(); // could get rid of scrollbars 167 } 168 else { 168 } else { 169 169 dim = getVisibleRect().getSize(); 170 170 } … … 290 290 291 291 g2d.scale(scale, scale); 292 g2d.clip(new Rectangle2D.Double(format.getImageableX(), format.getImageableY(), format.getImageableWidth(), format.getImageableHeight())); 292 g2d.clip(new Rectangle2D.Double( 293 format.getImageableX(), 294 format.getImageableY(), 295 format.getImageableWidth(), 296 format.getImageableHeight())); 293 297 if (printable != null) { 294 298 try { 295 299 printable.print(g2d, format, 0); 296 } 297 catch (PrinterException e) { 300 } catch (PrinterException e) { 298 301 // should never happen since we are not printing 299 302 Main.error(e); 300 303 } 301 } 302 else { 304 } else { 303 305 g2d.setColor(Color.gray); 304 306 g2d.fillRect(0, 0, (int)format.getWidth(), (int)format.getHeight());
Note:
See TracChangeset
for help on using the changeset viewer.