Changeset 33826 in osm for applications/editors/josm/plugins/print/src/org/openstreetmap
- Timestamp:
- 2017-11-17T21:12:46+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintDialog.java
r33579 r33826 25 25 import java.util.Collection; 26 26 import java.util.Iterator; 27 import java.util.List; 27 28 import java.util.Locale; 28 29 … … 165 166 } else if (isShowing()) { // Avoid IllegalComponentStateException like in #8775 166 167 new WindowGeometry(this).remember(getClass().getName() + ".geometry"); 167 Main.pref.put("print.preview.enabled", previewCheckBox.isSelected()); 168 Main.pref.putBoolean("print.preview.enabled", previewCheckBox.isSelected()); 168 169 } 169 170 super.setVisible(visible); … … 219 220 caption = new JLabel(" 1 :"); 220 221 add(caption, std.grid(GBC.RELATIVE, row)); 221 int mapScale = Main.pref.getInt eger("print.map-scale", PrintPlugin.DEF_MAP_SCALE);222 int mapScale = Main.pref.getInt("print.map-scale", PrintPlugin.DEF_MAP_SCALE); 222 223 mapView.setFixedMapScale(mapScale); 223 224 scaleModel = new SpinnerNumberModel(mapScale, 250, 5000000, 250); … … 249 250 add(caption, std.grid(GBC.RELATIVE, row)); 250 251 resolutionModel = new SpinnerNumberModel( 251 Main.pref.getInt eger("print.resolution.dpi", PrintPlugin.DEF_RESOLUTION_DPI),252 Main.pref.getInt("print.resolution.dpi", PrintPlugin.DEF_RESOLUTION_DPI), 252 253 30, 1200, 10); 253 254 final JSpinner resolutionField = new JSpinner(resolutionModel); … … 415 416 } 416 417 } else if ("toggle-preview".equals(cmd)) { 417 Main.pref.put("print.preview.enabled", previewCheckBox.isSelected()); 418 Main.pref.putBoolean("print.preview.enabled", previewCheckBox.isSelected()); 418 419 if (previewCheckBox.isSelected()) { 419 420 printPreview.setPrintable(mapView); … … 459 460 PrintService service = job.getPrintService(); 460 461 if (service != null) { 461 Collection<Collection<String>> serviceAttributes = new ArrayList<>();462 List<List<String>> serviceAttributes = new ArrayList<>(); 462 463 for (Attribute a : service.getAttributes().toArray()) { 463 464 if ("printer-name".equals(a.getName()) && a instanceof TextSyntax) { … … 465 466 } 466 467 } 467 Main.pref.put Array("print.settings.service-attributes", serviceAttributes);468 Main.pref.putListOfLists("print.settings.service-attributes", serviceAttributes); 468 469 } 469 470 470 471 // Save all request attributes 471 Collection<String> ignoredAttributes = Arrays.asList("media-printable-area");472 Collection<Collection<String>> requestAttributes = new ArrayList<>();472 List<String> ignoredAttributes = Arrays.asList("media-printable-area"); 473 List<List<String>> requestAttributes = new ArrayList<>(); 473 474 for (Attribute a : attrs.toArray()) { 474 Collection<String> setting = null;475 List<String> setting = null; 475 476 if (a instanceof TextSyntax) { 476 477 setting = marshallPrintSetting(a, TextSyntax.class, ((TextSyntax) a).getValue()); … … 487 488 } 488 489 } 489 Main.pref.put Array("print.settings.request-attributes", requestAttributes);490 } 491 492 protected Collection<String> marshallPrintSetting(Attribute a, Class<?> syntaxClass, String value) {490 Main.pref.putListOfLists("print.settings.request-attributes", requestAttributes); 491 } 492 493 protected List<String> marshallPrintSetting(Attribute a, Class<?> syntaxClass, String value) { 493 494 return new ArrayList<>(Arrays.asList(a.getCategory().getName(), a.getClass().getName(), syntaxClass.getName(), value)); 494 495 } … … 539 540 540 541 protected void loadPrintSettings() { 541 for ( Collection<String> setting : Main.pref.getArray("print.settings.service-attributes")) {542 for (List<String> setting : Main.pref.getListOfLists("print.settings.service-attributes")) { 542 543 try { 543 544 PrintServiceAttribute a = (PrintServiceAttribute) unmarshallPrintSetting(setting); … … 549 550 } 550 551 } 551 for ( Collection<String> setting : Main.pref.getArray("print.settings.request-attributes")) {552 for (List<String> setting : Main.pref.getListOfLists("print.settings.request-attributes")) { 552 553 try { 553 554 attrs.add(unmarshallPrintSetting(setting)); -
applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintPlugin.java
r33579 r33826 92 92 public static void adjustPrefs() { 93 93 if (!Main.pref.getBoolean("print.saved-prefs", false)) { 94 Main.pref.put("print.saved-prefs", true); 94 Main.pref.putBoolean("print.saved-prefs", true); 95 95 adjustPref("draw.data.downloaded_area", false); 96 96 adjustPref("mappaint.node.connection-size", 0); … … 114 114 Main.pref.put("print.saved-prefs."+key, Main.pref.get(key)); 115 115 } 116 Main.pref.putInt eger(key, value);116 Main.pref.putInt(key, value); 117 117 } 118 118 … … 129 129 Main.pref.put("print.saved-prefs."+key, Main.pref.get(key)); 130 130 } 131 Main.pref.put(key, value); 131 Main.pref.putBoolean(key, value); 132 132 } 133 133 … … 158 158 restorePref("mappaint.node.unselected-size"); 159 159 restorePref("mappaint.node.virtual-size"); 160 Main.pref.put("print.saved-prefs", false); 160 Main.pref.putBoolean("print.saved-prefs", false); 161 161 //Main.main.map.mapView.repaint(); 162 162 } -
applications/editors/josm/plugins/print/src/org/openstreetmap/josm/plugins/print/PrintableMapView.java
r33579 r33826 110 110 */ 111 111 public void initialize(PageFormat pageFormat) { 112 int resolution = Main.pref.getInt eger("print.resolution.dpi", PrintPlugin.DEF_RESOLUTION_DPI);112 int resolution = Main.pref.getInt("print.resolution.dpi", PrintPlugin.DEF_RESOLUTION_DPI); 113 113 g2dFactor = 72.0/resolution; 114 114 setSize((int) (pageFormat.getImageableWidth()/g2dFactor), (int) (pageFormat.getImageableHeight()/g2dFactor));
Note:
See TracChangeset
for help on using the changeset viewer.