IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 1 | 1 | // License: GPL. For details, see LICENSE file. |
| 2 | 2 | package org.openstreetmap.josm.plugins.print; |
| 3 | 3 | |
| 4 | | import java.util.ArrayList; |
| 5 | | import java.util.Collections; |
| 6 | | import java.util.Comparator; |
| 7 | | import java.util.List; |
| 8 | | |
| 9 | 4 | import org.openstreetmap.josm.data.osm.DataSet; |
| 10 | | import org.openstreetmap.josm.gui.MainApplication; |
| 11 | 5 | import org.openstreetmap.josm.gui.layer.Layer; |
| 12 | 6 | import org.openstreetmap.josm.gui.layer.MainLayerManager; |
| 13 | 7 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 14 | 8 | |
| | 9 | import java.util.Comparator; |
| | 10 | import java.util.List; |
| | 11 | import java.util.stream.Collectors; |
| | 12 | |
| 15 | 13 | public class PrintableLayerManager extends MainLayerManager { |
| 16 | 14 | |
| 17 | | private static final MainLayerManager layerManager = MainApplication.getLayerManager(); |
| | 15 | private final MainLayerManager layerManager; |
| | 16 | |
| | 17 | PrintableLayerManager(MainLayerManager delegate) { |
| | 18 | this.layerManager = delegate; |
| | 19 | } |
| 18 | 20 | |
| 19 | 21 | @Override |
| 20 | 22 | public synchronized void removeActiveLayerChangeListener(ActiveLayerChangeListener listener) { |
| … |
… |
|
| 43 | 45 | |
| 44 | 46 | @Override |
| 45 | 47 | public synchronized List<Layer> getVisibleLayersInZOrder() { |
| 46 | | ArrayList<Layer> layers = new ArrayList<>(); |
| 47 | | for (Layer l: layerManager.getLayers()) { |
| 48 | | if (l.isVisible()) { |
| 49 | | layers.add(l); |
| 50 | | } |
| 51 | | } |
| 52 | | Collections.sort( |
| 53 | | layers, |
| 54 | | new Comparator<Layer>() { |
| 55 | | @Override |
| 56 | | public int compare(Layer l2, Layer l1) { // l1 and l2 swapped! |
| 57 | | if (l1 instanceof OsmDataLayer && l2 instanceof OsmDataLayer) { |
| 58 | | if (l1 == layerManager.getActiveLayer()) return -1; |
| 59 | | if (l2 == layerManager.getActiveLayer()) return 1; |
| 60 | | return Integer.valueOf(layerManager.getLayers().indexOf(l1)). |
| 61 | | compareTo(layerManager.getLayers().indexOf(l2)); |
| 62 | | } else |
| 63 | | return Integer.valueOf(layerManager.getLayers().indexOf(l1)). |
| 64 | | compareTo(layerManager.getLayers().indexOf(l2)); |
| 65 | | } |
| | 48 | final Comparator<Layer> layerComparator = (l2, l1) -> { // l1 and l2 swapped! |
| | 49 | if (l1 instanceof OsmDataLayer && l2 instanceof OsmDataLayer) { |
| | 50 | if (l1 == layerManager.getActiveLayer()) return -1; |
| | 51 | if (l2 == layerManager.getActiveLayer()) return 1; |
| 66 | 52 | } |
| 67 | | ); |
| 68 | | return layers; |
| | 53 | return Integer.compare(layerManager.getLayers().indexOf(l1), layerManager.getLayers().indexOf(l2)); |
| | 54 | }; |
| | 55 | |
| | 56 | return layerManager.getLayers().stream() |
| | 57 | .filter(Layer::isVisible) |
| | 58 | .sorted(layerComparator) |
| | 59 | .collect(Collectors.toList()); |
| 69 | 60 | } |
| 70 | 61 | |
| 71 | 62 | @Override |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 11 | 11 | import java.awt.Graphics; |
| 12 | 12 | import java.awt.Graphics2D; |
| 13 | 13 | import java.awt.Shape; |
| 14 | | import java.awt.event.ComponentListener; |
| 15 | 14 | import java.awt.font.FontRenderContext; |
| 16 | 15 | import java.awt.font.GlyphVector; |
| 17 | 16 | import java.awt.geom.AffineTransform; |
| 18 | 17 | import java.awt.geom.Rectangle2D; |
| 19 | 18 | import java.awt.print.PageFormat; |
| 20 | 19 | import java.awt.print.Printable; |
| 21 | | import java.awt.print.PrinterException; |
| | 20 | import java.util.Arrays; |
| 22 | 21 | |
| 23 | 22 | import org.openstreetmap.gui.jmapviewer.tilesources.AbstractOsmTileSource; |
| 24 | 23 | import org.openstreetmap.josm.data.Bounds; |
| … |
… |
|
| 34 | 33 | /** |
| 35 | 34 | * The PrintableMapView class implements a "Printable" perspective on |
| 36 | 35 | * the main MapView. |
| | 36 | * |
| 37 | 37 | * @author Kai Pastor |
| 38 | 38 | */ |
| 39 | 39 | public class PrintableMapView extends MapView implements Printable { |
| … |
… |
|
| 58 | 58 | */ |
| 59 | 59 | public PrintableMapView() { |
| 60 | 60 | /* Initialize MapView with a dummy parent */ |
| 61 | | super(new PrintableLayerManager(), null); |
| | 61 | super(new PrintableLayerManager(MainApplication.getLayerManager()), null); |
| 62 | 62 | |
| 63 | 63 | /* Disable MapView's ComponentLister, |
| 64 | 64 | * as it will interfere with the main MapView. */ |
| 65 | | ComponentListener[] listeners = getComponentListeners(); |
| 66 | | for (int i = 0; i < listeners.length; i++) { |
| 67 | | removeComponentListener(listeners[i]); |
| 68 | | } |
| | 65 | Arrays.stream(getComponentListeners()) |
| | 66 | .forEach(this::removeComponentListener); |
| 69 | 67 | } |
| 70 | 68 | |
| 71 | 69 | /** |
| … |
… |
|
| 80 | 78 | |
| 81 | 79 | /** |
| 82 | 80 | * Unset the fixed map scale |
| 83 | | * |
| | 81 | * <p> |
| 84 | 82 | * The map scaling will be chosen automatically such that the |
| 85 | 83 | * main windows map view fits on the page format. |
| 86 | 84 | */ |
| … |
… |
|
| 93 | 91 | * Get the map scale that will be used for rendering |
| 94 | 92 | * @return the map scale that will be used for rendering |
| 95 | 93 | */ |
| 96 | | public int getMapScale() { |
| | 94 | public double getMapScale() { |
| 97 | 95 | if (fixedMapScale > 0 || g2dFactor == 0.0) { |
| 98 | 96 | return fixedMapScale; |
| 99 | 97 | } |
| 100 | 98 | |
| 101 | 99 | double dist100px = getDist100Pixel() / g2dFactor; |
| 102 | | int mapScale = (int) (dist100px * 72.0 / 2.54); |
| | 100 | double mapScale = (dist100px * 72.0 / 2.54); |
| 103 | 101 | return mapScale; |
| 104 | 102 | } |
| 105 | 103 | |
| … |
… |
|
| 111 | 109 | */ |
| 112 | 110 | public void initialize(PageFormat pageFormat) { |
| 113 | 111 | int resolution = Config.getPref().getInt("print.resolution.dpi", PrintPlugin.DEF_RESOLUTION_DPI); |
| 114 | | g2dFactor = 72.0/resolution; |
| 115 | | setSize((int) (pageFormat.getImageableWidth()/g2dFactor), (int) (pageFormat.getImageableHeight()/g2dFactor)); |
| | 112 | g2dFactor = 72.0 / resolution; |
| | 113 | setSize((int) (pageFormat.getImageableWidth() / g2dFactor), (int) (pageFormat.getImageableHeight() / g2dFactor)); |
| 116 | 114 | } |
| 117 | 115 | |
| 118 | 116 | /** |
| … |
… |
|
| 123 | 121 | Dimension dim = getSize(); |
| 124 | 122 | if (dim.width != width || dim.height != height) { |
| 125 | 123 | super.setSize(width, height); |
| 126 | | zoomTo(MainApplication.getMap().mapView.getRealBounds()); |
| | 124 | zoomTo(MainApplication.getMap().mapView.getCenter()); |
| 127 | 125 | rezoomToFixedScale(); |
| 128 | 126 | } |
| 129 | 127 | } |
| … |
… |
|
| 136 | 134 | Dimension dim = getSize(); |
| 137 | 135 | if (dim.width != newSize.width || dim.height != newSize.height) { |
| 138 | 136 | super.setSize(newSize); |
| 139 | | zoomTo(MainApplication.getMap().mapView.getRealBounds()); |
| | 137 | zoomTo(MainApplication.getMap().mapView.getCenter()); |
| 140 | 138 | rezoomToFixedScale(); |
| 141 | 139 | } |
| 142 | 140 | } |
| … |
… |
|
| 155 | 153 | |
| 156 | 154 | /** |
| 157 | 155 | * Render a page for the printer |
| 158 | | * |
| | 156 | * <p> |
| 159 | 157 | * Implements java.awt.print.Printable. |
| 160 | 158 | * |
| 161 | | * @param g the context into which the page is drawn |
| | 159 | * @param g the context into which the page is drawn |
| 162 | 160 | * @param pageFormat the size and orientation of the page being drawn |
| 163 | | * @param page the zero based index of the page to be drawn |
| 164 | | * |
| | 161 | * @param page the zero based index of the page to be drawn |
| 165 | 162 | * @return {@code PAGE_EXISTS} for {@code page=0} or {@code NO_SUCH_PAGE} for {@code page>0} |
| 166 | | * |
| 167 | | * @throws PrinterException thrown when the print job is terminated |
| 168 | | * |
| 169 | 163 | */ |
| 170 | 164 | @Override |
| 171 | | public int print(Graphics g, PageFormat pageFormat, int page) throws |
| 172 | | PrinterException { |
| | 165 | public int print(Graphics g, PageFormat pageFormat, int page) { |
| 173 | 166 | if (page > 0) { /* stop after first page */ |
| 174 | 167 | return NO_SUCH_PAGE; |
| 175 | 168 | } |
| … |
… |
|
| 178 | 171 | |
| 179 | 172 | Graphics2D g2d = (Graphics2D) g; |
| 180 | 173 | g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); |
| 181 | | paintMap(g2d, pageFormat); |
| 182 | | paintMapScale(g2d, pageFormat); |
| | 174 | paintMap(g2d); |
| | 175 | paintMapScale(g2d); |
| 183 | 176 | paintMapAttribution(g2d, pageFormat); |
| 184 | 177 | return PAGE_EXISTS; |
| 185 | 178 | } |
| 186 | 179 | |
| 187 | 180 | /** |
| 188 | 181 | * Paint the map |
| 189 | | * |
| | 182 | * <p> |
| 190 | 183 | * This implementation is derived from MapView's paint and |
| 191 | 184 | * from other JOSM core components. |
| 192 | 185 | * |
| 193 | 186 | * @param g2d the graphics context to use for painting |
| 194 | | * @param pageFormat the size and orientation of the page being drawn |
| 195 | 187 | */ |
| 196 | | public void paintMap(Graphics2D g2d, PageFormat pageFormat) { |
| 197 | | AffineTransform at = g2d.getTransform(); |
| | 188 | public void paintMap(Graphics2D g2d) { |
| | 189 | AffineTransform originalTransform = g2d.getTransform(); |
| 198 | 190 | g2d.scale(g2dFactor, g2dFactor); |
| | 191 | g2d.translate(getWidth() / 2, getHeight() / 2); |
| 199 | 192 | |
| 200 | | Bounds box = getRealBounds(); |
| | 193 | Bounds box = MainApplication.getMap().mapView.getRealBounds(); |
| 201 | 194 | for (Layer l : getLayerManager().getVisibleLayersInZOrder()) { |
| 202 | 195 | if (l.getOpacity() < 1) { |
| 203 | 196 | g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) l.getOpacity())); |
| … |
… |
|
| 206 | 199 | g2d.setPaintMode(); |
| 207 | 200 | } |
| 208 | 201 | |
| 209 | | g2d.setTransform(at); |
| | 202 | g2d.setTransform(originalTransform); |
| 210 | 203 | } |
| 211 | 204 | |
| 212 | 205 | /** |
| 213 | 206 | * Paint a linear scale and a lexical scale |
| 214 | | * |
| | 207 | * <p> |
| 215 | 208 | * This implementation is derived from JOSM's MapScaler, |
| 216 | 209 | * NavigatableComponent and SystemOfMeasurement. |
| 217 | 210 | * |
| 218 | 211 | * @param g2d the graphics context to use for painting |
| 219 | | * @param pageFormat the size and orientation of the page being drawn |
| 220 | 212 | */ |
| 221 | | public void paintMapScale(Graphics2D g2d, PageFormat pageFormat) { |
| | 213 | public void paintMapScale(Graphics2D g2d) { |
| 222 | 214 | SystemOfMeasurement som = SystemOfMeasurement.getSystemOfMeasurement(); |
| 223 | 215 | double dist100px = getDist100Pixel() / g2dFactor; |
| 224 | 216 | double dist = dist100px / som.aValue; |
| … |
… |
|
| 244 | 236 | |
| 245 | 237 | /* offset from the left paper border to the left end of the bar */ |
| 246 | 238 | Rectangle2D bound = g2d.getFontMetrics().getStringBounds("0", g2d); |
| 247 | | int xLeft = (int) (bound.getWidth()/2); |
| | 239 | int xLeft = (int) (bound.getWidth() / 2); |
| 248 | 240 | |
| 249 | 241 | /* offset from the left paper border to the right label */ |
| 250 | 242 | String rightLabel = som.getDistText(dist100px * distScale); |
| 251 | 243 | bound = g2d.getFontMetrics().getStringBounds(rightLabel, g2d); |
| 252 | | int xRight = xLeft+(int) Math.max(0.95*x, x-bound.getWidth()/2); |
| | 244 | int xRight = xLeft + (int) Math.max(0.95 * x, x - bound.getWidth() / 2); |
| 253 | 245 | |
| 254 | 246 | // CHECKSTYLE.OFF: SingleSpaceSeparator |
| 255 | | int h = FONT_SIZE / 2; // raster, height of the bar |
| 256 | | int yLexical = 3 * h; // baseline of the lexical scale |
| 257 | | int yBar = 4 * h; // top of the bar |
| 258 | | int yLabel = 8 * h; // baseline of the labels |
| 259 | | int w = (int) (distScale * 100.0); // length of the bar |
| 260 | | int ws = (int) (distScale * 20.0); // length of a segment |
| | 247 | int h = FONT_SIZE / 2; // raster, height of the bar |
| | 248 | int yLexical = 3 * h; // baseline of the lexical scale |
| | 249 | int yBar = 4 * h; // top of the bar |
| | 250 | int yLabel = 8 * h; // baseline of the labels |
| | 251 | int w = (int) (distScale * 100.0); // length of the bar |
| | 252 | int ws = (int) (distScale * 20.0); // length of a segment |
| 261 | 253 | // CHECKSTYLE.ON: SingleSpaceSeparator |
| 262 | 254 | |
| 263 | 255 | /* white background */ |
| 264 | 256 | g2d.setColor(Color.WHITE); |
| 265 | | g2d.fillRect(xLeft-1, yBar-1, w+2, h+2); |
| | 257 | g2d.fillRect(xLeft - 1, yBar - 1, w + 2, h + 2); |
| 266 | 258 | |
| 267 | 259 | /* black foreground */ |
| 268 | 260 | g2d.setColor(Color.BLACK); |
| 269 | 261 | g2d.drawRect(xLeft, yBar, w, h); |
| 270 | 262 | g2d.fillRect(xLeft, yBar, ws, h); |
| 271 | | g2d.fillRect(xLeft+(int) (distScale * 40.0), yBar, ws, h); |
| 272 | | g2d.fillRect(xLeft+w-ws, yBar, ws, h); |
| | 263 | g2d.fillRect(xLeft + (int) (distScale * 40.0), yBar, ws, h); |
| | 264 | g2d.fillRect(xLeft + w - ws, yBar, ws, h); |
| 273 | 265 | g2d.setFont(labelFont); |
| 274 | 266 | paintText(g2d, "0", 0, yLabel); |
| 275 | 267 | paintText(g2d, rightLabel, xRight, yLabel); |
| 276 | 268 | |
| 277 | 269 | /* lexical scale */ |
| 278 | | int mapScale = getMapScale(); |
| | 270 | int mapScale = (int) getMapScale(); |
| 279 | 271 | String lexicalScale = tr("Scale") + " 1 : " + mapScale; |
| 280 | 272 | |
| 281 | 273 | Font scaleFront = new Font("Arial", Font.BOLD, FONT_SIZE); |
| … |
… |
|
| 288 | 280 | /** |
| 289 | 281 | * Paint an attribution text |
| 290 | 282 | * |
| 291 | | * @param g2d the graphics context to use for painting |
| | 283 | * @param g2d the graphics context to use for painting |
| 292 | 284 | * @param pageFormat the size and orientation of the page being drawn |
| 293 | 285 | */ |
| 294 | 286 | public void paintMapAttribution(Graphics2D g2d, PageFormat pageFormat) { |
| … |
… |
|
| 309 | 301 | String line = text.substring(from, to); |
| 310 | 302 | |
| 311 | 303 | Rectangle2D bound = g2d.getFontMetrics().getStringBounds(line, g2d); |
| 312 | | int x = (int) ((pageFormat.getImageableWidth() - bound.getWidth()) - FONT_SIZE/2); |
| | 304 | int x = (int) ((pageFormat.getImageableWidth() - bound.getWidth()) - FONT_SIZE / 2); |
| 313 | 305 | |
| 314 | 306 | paintText(g2d, line, x, y); |
| 315 | 307 | |
| … |
… |
|
| 321 | 313 | |
| 322 | 314 | /** |
| 323 | 315 | * Paint a text. |
| 324 | | * |
| 325 | | * This method will not only draw the letters but also a background which improves redability. |
| | 316 | * <p> |
| | 317 | * This method will not only draw the letters but also a background which improves readability. |
| 326 | 318 | * |
| 327 | | * @param g2d the graphics context to use for painting |
| | 319 | * @param g2d the graphics context to use for painting |
| 328 | 320 | * @param text the text to be drawn |
| 329 | | * @param x the x coordinate |
| 330 | | * @param y the y coordinate |
| | 321 | * @param x the x coordinate |
| | 322 | * @param y the y coordinate |
| 331 | 323 | */ |
| 332 | 324 | public void paintText(Graphics2D g2d, String text, int x, int y) { |
| 333 | 325 | AffineTransform ax = g2d.getTransform(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 223 | 223 | mapView.setFixedMapScale(mapScale); |
| 224 | 224 | scaleModel = new SpinnerNumberModel(mapScale, 250, 5000000, 250); |
| 225 | 225 | final JSpinner scaleField = new JSpinner(scaleModel); |
| 226 | | scaleField.addChangeListener(new ChangeListener() { |
| 227 | | @Override |
| 228 | | public void stateChanged(ChangeEvent evt) { |
| 229 | | SwingUtilities.invokeLater(new Runnable() { |
| 230 | | @Override |
| 231 | | public void run() { |
| 232 | | try { |
| 233 | | scaleField.commitEdit(); |
| 234 | | Config.getPref().put("print.map-scale", scaleModel.getNumber().toString()); |
| 235 | | mapView.setFixedMapScale(scaleModel.getNumber().intValue()); |
| 236 | | printPreview.repaint(); |
| 237 | | } catch (ParseException e) { |
| 238 | | Logging.error(e); |
| 239 | | } |
| 240 | | } |
| 241 | | }); |
| | 226 | scaleField.addChangeListener(evt -> SwingUtilities.invokeLater(() -> { |
| | 227 | try { |
| | 228 | scaleField.commitEdit(); |
| | 229 | Config.getPref().put("print.map-scale", scaleModel.getNumber().toString()); |
| | 230 | mapView.setFixedMapScale(scaleModel.getNumber().intValue()); |
| | 231 | printPreview.repaint(); |
| | 232 | } catch (ParseException e) { |
| | 233 | Logging.error(e); |
| 242 | 234 | } |
| 243 | | }); |
| | 235 | })); |
| 244 | 236 | add(scaleField, std.grid(GBC.RELATIVE, row)); |
| 245 | 237 | |
| 246 | 238 | row++; |
| … |
… |
|
| 252 | 244 | Config.getPref().getInt("print.resolution.dpi", PrintPlugin.DEF_RESOLUTION_DPI), |
| 253 | 245 | 30, 1200, 10); |
| 254 | 246 | final JSpinner resolutionField = new JSpinner(resolutionModel); |
| 255 | | resolutionField.addChangeListener(new ChangeListener() { |
| 256 | | @Override |
| 257 | | public void stateChanged(ChangeEvent evt) { |
| 258 | | SwingUtilities.invokeLater(new Runnable() { |
| 259 | | @Override |
| 260 | | public void run() { |
| 261 | | try { |
| 262 | | resolutionField.commitEdit(); |
| 263 | | Config.getPref().put("print.resolution.dpi", resolutionModel.getNumber().toString()); |
| 264 | | printPreview.repaint(); |
| 265 | | } catch (ParseException e) { |
| 266 | | Logging.error(e); |
| 267 | | } |
| 268 | | } |
| 269 | | }); |
| | 247 | resolutionField.addChangeListener(evt -> SwingUtilities.invokeLater(() -> { |
| | 248 | try { |
| | 249 | resolutionField.commitEdit(); |
| | 250 | Config.getPref().put("print.resolution.dpi", resolutionModel.getNumber().toString()); |
| | 251 | printPreview.repaint(); |
| | 252 | } catch (ParseException e) { |
| | 253 | Logging.error(e); |
| 270 | 254 | } |
| 271 | | }); |
| | 255 | })); |
| 272 | 256 | add(resolutionField, std.grid(GBC.RELATIVE, row)); |
| 273 | 257 | |
| 274 | 258 | row++; |
| … |
… |
|
| 283 | 267 | attributionText.getDocument().addDocumentListener(new DocumentListener() { |
| 284 | 268 | @Override |
| 285 | 269 | public void insertUpdate(DocumentEvent evt) { |
| 286 | | SwingUtilities.invokeLater(new Runnable() { |
| 287 | | @Override |
| 288 | | public void run() { |
| 289 | | Config.getPref().put("print.attribution", attributionText.getText()); |
| 290 | | printPreview.repaint(); |
| 291 | | } |
| | 270 | SwingUtilities.invokeLater(() -> { |
| | 271 | Config.getPref().put("print.attribution", attributionText.getText()); |
| | 272 | printPreview.repaint(); |
| 292 | 273 | }); |
| 293 | 274 | } |
| 294 | 275 | |
| … |
… |
|
| 455 | 436 | } |
| 456 | 437 | } |
| 457 | 438 | |
| | 439 | // @Override |
| | 440 | // public void dispose() { |
| | 441 | // mapView.destroy(); |
| | 442 | // super.dispose(); |
| | 443 | // } |
| | 444 | |
| 458 | 445 | protected void savePrintSettings() { |
| 459 | 446 | // Save only one printer service attribute: printer name |
| 460 | 447 | PrintService service = job.getPrintService(); |
| … |
… |
|
| 469 | 456 | } |
| 470 | 457 | |
| 471 | 458 | // Save all request attributes |
| 472 | | List<String> ignoredAttributes = Arrays.asList("media-printable-area"); |
| | 459 | List<String> ignoredAttributes = Collections.singletonList("media-printable-area"); |
| 473 | 460 | List<List<String>> requestAttributes = new ArrayList<>(); |
| 474 | 461 | for (Attribute a : attrs.toArray()) { |
| 475 | 462 | List<String> setting = null; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 45 | 45 | int pos = fileMenu.getItemCount(); |
| 46 | 46 | do { |
| 47 | 47 | pos--; |
| 48 | | } while (fileMenu != null && pos > 2 && fileMenu.getItem(pos) != null); |
| | 48 | } while (pos > 2 && fileMenu.getItem(pos) != null); |
| 49 | 49 | |
| 50 | 50 | if (pos > 0) { |
| 51 | 51 | PrintAction printAction = new PrintAction(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 258 | 258 | AffineTransform at = g2d.getTransform(); |
| 259 | 259 | |
| 260 | 260 | Dimension out = getZoomedPageDimension(); |
| 261 | | double scale = Math.min( |
| 262 | | out.getHeight()/format.getHeight(), out.getWidth()/format.getWidth()); |
| | 261 | double scale = Math.min(out.getHeight()/format.getHeight(), out.getWidth()/format.getWidth()); |
| 263 | 262 | double left = 0.5 * (getWidth() - scale * format.getWidth()); |
| 264 | 263 | double top = 0.5 * (getHeight() - scale * format.getHeight()); |
| 265 | 264 | |