Changeset 32167 in osm for applications/editors
- Timestamp:
- 2016-05-11T23:57:23+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/print
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/print/.project
r29529 r32167 11 11 </arguments> 12 12 </buildCommand> 13 <buildCommand> 14 <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> 15 <arguments> 16 </arguments> 17 </buildCommand> 13 18 </buildSpec> 14 19 <natures> -
applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintPreview.java
r29848 r32167 40 40 import javax.swing.JPanel; 41 41 import javax.swing.RepaintManager; 42 43 import org.openstreetmap.josm.Main; 42 44 43 45 /** … … 58 60 * The PageFormat chosen for printing (and preview) 59 61 */ 60 protected PageFormat format = null;62 protected transient PageFormat format = null; 61 63 62 64 /** … … 79 81 * the printable object for rendering preview contents 80 82 */ 81 protected Printable printable = null;83 protected transient Printable printable = null; 82 84 83 85 /** … … 134 136 */ 135 137 public void zoomIn() { 136 double z oom= getZoom();137 if (z oom< 5.0) {138 setZoom(2.0 * z oom);138 double z = getZoom(); 139 if (z < 5.0) { 140 setZoom(2.0 * z); 139 141 } 140 142 } … … 146 148 */ 147 149 public void zoomOut() { 148 double z oom= getZoom();149 if (z oom> 0.1) {150 setZoom(0.5 * z oom);150 double z = getZoom(); 151 if (z > 0.1) { 152 setZoom(0.5 * z); 151 153 } 152 154 } … … 216 218 */ 217 219 public double getZoom() { 218 if ( zoomToPage || zoom < 0.01) {220 if (format != null && (zoomToPage || zoom < 0.01)) { 219 221 // actually this is zoom-to-page 220 222 Dimension dim = getParent().getSize(); … … 234 236 public Dimension getZoomedPageDimension() { 235 237 int resolution = Toolkit.getDefaultToolkit().getScreenResolution(); 236 double z oom= getZoom();237 int width = (int)(z oom* resolution * format.getWidth() / 72.0);238 int height = (int)(z oom* resolution * format.getHeight() / 72.0);238 double z = getZoom(); 239 int width = (int)(z * resolution * format.getWidth() / 72.0); 240 int height = (int)(z * resolution * format.getHeight() / 72.0); 239 241 return new Dimension(width, height); 240 242 } … … 248 250 @Override 249 251 public Dimension getPreferredSize() { 250 if (format == null || zoomToPage == true|| zoom < 0.01) {252 if (format == null || zoomToPage || zoom < 0.01) { 251 253 return new Dimension(0,0); 252 254 } … … 295 297 catch (PrinterException e) { 296 298 // should never happen since we are not printing 299 Main.error(e); 297 300 } 298 301 } … … 304 307 g2d.setTransform(at); 305 308 } 306 307 309 }
Note:
See TracChangeset
for help on using the changeset viewer.