Ticket #2115: FixMOTD FixTabs Fix.patch
File FixMOTD FixTabs Fix.patch, 5.8 KB (added by , 15 years ago) |
---|
-
src/org/openstreetmap/josm/gui/GettingStarted.java
32 32 public class GettingStarted extends JPanel { 33 33 34 34 static private String content = ""; 35 static private String styles = "<style type=\"text/css\">\n"+ 36 "body { font-family: sans-serif; font-weight: bold; }\n"+ 37 "h1 {text-align: center;}\n"+ 38 "</style>\n"; 35 39 36 40 public class LinkGeneral extends JEditorPane implements HyperlinkListener { 37 41 public LinkGeneral(String text) { … … 101 105 try { 102 106 motdcontent = wr.read(baseurl + "/wiki/MessageOfTheDay?format=txt"); 103 107 } catch (IOException ioe) { 104 motdcontent = "<html> <body>\n<h1>" +108 motdcontent = "<html>" + styles + "<body><h1>" + 105 109 "JOSM - " + tr("Java OpenStreetMap Editor") + 106 110 "</h1>\n<h2 align=\"center\">(" + 107 111 tr ("Message of the day not available") + … … 178 182 } 179 183 180 184 content = "<html>\n"+ 181 "<style type=\"text/css\">\n"+ 182 "body { font-family: sans-serif; font-weight: bold; }\n"+ 183 "h1 {text-align: center;}\n"+ 184 "</style>\n"+ 185 styles + 185 186 "<h1>JOSM - " + tr("Java OpenStreetMap Editor") + "</h1>\n"+ 186 187 content+"\n"+ 187 188 "</html>"; … … 189 190 190 191 public GettingStarted() { 191 192 super(new BorderLayout()); 192 final LinkGeneral lg = new LinkGeneral(tr("Download \"Message of the day\"")); 193 final LinkGeneral lg = new LinkGeneral( 194 "<html>" + 195 styles + 196 "<h1>" + 197 "JOSM - " + 198 tr("Java OpenStreetMap Editor") + 199 "</h1><h2 align=\"center\">" + 200 tr("Downloading \"Message of the day\"") + 201 "</h2>"); 193 202 JScrollPane scroller = new JScrollPane(lg); 194 // panel.add(GBC.glue(0,1), GBC.eol());195 //panel.setMinimumSize(new Dimension(400, 600));196 203 Component linkGeneral = new LinkGeneral(content); 197 204 scroller.setViewportBorder(new EmptyBorder(10,100,10,100)); 198 205 add(scroller, BorderLayout.CENTER); -
src/org/openstreetmap/josm/Main.java
113 113 * The main menu bar at top of screen. 114 114 */ 115 115 public final MainMenu menu; 116 117 /** 118 * The MOTD Layer. 119 */ 120 private GettingStarted gettingStarted=new GettingStarted(); 116 121 117 122 /** 118 123 * Print a debug message if debugging is on. … … 144 149 map.fillPanel(panel); 145 150 else { 146 151 old.destroy(); 147 panel.add( new GettingStarted(), BorderLayout.CENTER);152 panel.add(gettingStarted, BorderLayout.CENTER); 148 153 } 149 154 panel.setVisible(true); 150 155 redoUndoListener.commandChanged(0,0); … … 173 178 // platform = determinePlatformHook(); 174 179 platform.startupHook(); 175 180 contentPane.add(panel, BorderLayout.CENTER); 176 if(splash != null) splash.setStatus(tr("Download \"Message of the day\"")); 177 panel.add(new GettingStarted(), BorderLayout.CENTER); 181 panel.add(gettingStarted, BorderLayout.CENTER); 178 182 179 183 if(splash != null) splash.setStatus(tr("Creating main GUI")); 180 184 menu = new MainMenu(); … … 273 277 UIManager.put("OptionPane.noIcon", UIManager.get("OptionPane.cancelIcon")); 274 278 275 279 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); 276 280 String geometry = Main.pref.get("gui.geometry"); 277 281 if (args.containsKey("geometry")) { 278 282 geometry = args.get("geometry").iterator().next(); 279 280 283 } 284 if (geometry.length() != 0) { 281 285 final Matcher m = Pattern.compile("(\\d+)x(\\d+)(([+-])(\\d+)([+-])(\\d+))?").matcher(geometry); 282 286 if (m.matches()) { 283 287 int w = Integer.valueOf(m.group(1)); … … 292 296 y = screenDimension.height - y - h; 293 297 } 294 298 bounds = new Rectangle(x,y,w,h); 295 296 297 298 299 if(!Main.pref.get("gui.geometry").equals(geometry)) { 300 // remember this geometry 301 Main.pref.put("gui.geometry", geometry); 302 } 299 303 } else 300 304 System.out.println("Ignoring malformed geometry: "+geometry); 301 305 } … … 410 414 } 411 415 412 416 static public void saveGuiGeometry() { 413 414 415 416 417 418 419 420 421 422 423 417 // if the gui.geometry preference is already set, 418 // save the current window geometry 419 String curGeometryPref = pref.get("gui.geometry"); 420 if(curGeometryPref.length() != 0) { 421 Rectangle bounds = parent.getBounds(); 422 pref.put("gui.geometry", 423 (int)bounds.getWidth() + 424 "x" + (int)bounds.getHeight() + 425 "+" + (int)bounds.getX() + 426 "+" + (int)bounds.getY()); 427 } 424 428 } 425 429 }