Ticket #2115: FixMOTD FixTabs Fix.patch

File FixMOTD FixTabs Fix.patch, 5.8 KB (added by xeen, 15 years ago)

If this isn't it, nothing will ever (this was probably a good indicator of sleep deprivation)

  • src/org/openstreetmap/josm/gui/GettingStarted.java

     
    3232public class GettingStarted extends JPanel {
    3333
    3434    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";
    3539
    3640    public class LinkGeneral extends JEditorPane implements HyperlinkListener {
    3741        public LinkGeneral(String text) {
     
    101105        try {
    102106            motdcontent = wr.read(baseurl + "/wiki/MessageOfTheDay?format=txt");
    103107        } catch (IOException ioe) {
    104             motdcontent = "<html><body>\n<h1>" +
     108            motdcontent = "<html>" + styles + "<body><h1>" +
    105109                "JOSM - " + tr("Java OpenStreetMap Editor") +
    106110                "</h1>\n<h2 align=\"center\">(" +
    107111                tr ("Message of the day not available") +
     
    178182        }
    179183       
    180184        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 +
    185186            "<h1>JOSM - " + tr("Java OpenStreetMap Editor") + "</h1>\n"+
    186187            content+"\n"+
    187188            "</html>";
     
    189190
    190191    public GettingStarted() {
    191192        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>");
    193202        JScrollPane scroller = new JScrollPane(lg);
    194         // panel.add(GBC.glue(0,1), GBC.eol());
    195         //panel.setMinimumSize(new Dimension(400, 600));
    196203        Component linkGeneral = new LinkGeneral(content);
    197204        scroller.setViewportBorder(new EmptyBorder(10,100,10,100));
    198205        add(scroller, BorderLayout.CENTER);
  • src/org/openstreetmap/josm/Main.java

     
    113113     * The main menu bar at top of screen.
    114114     */
    115115    public final MainMenu menu;
     116   
     117    /**
     118     * The MOTD Layer.
     119     */
     120    private GettingStarted gettingStarted=new GettingStarted();
    116121
    117122    /**
    118123     * Print a debug message if debugging is on.
     
    144149            map.fillPanel(panel);
    145150        else {
    146151            old.destroy();
    147             panel.add(new GettingStarted(), BorderLayout.CENTER);
     152            panel.add(gettingStarted, BorderLayout.CENTER);
    148153        }
    149154        panel.setVisible(true);
    150155        redoUndoListener.commandChanged(0,0);
     
    173178//        platform = determinePlatformHook();
    174179        platform.startupHook();
    175180        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);
    178182
    179183        if(splash != null) splash.setStatus(tr("Creating main GUI"));
    180184        menu = new MainMenu();
     
    273277        UIManager.put("OptionPane.noIcon", UIManager.get("OptionPane.cancelIcon"));
    274278
    275279        Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
    276         String geometry = Main.pref.get("gui.geometry");
     280        String geometry = Main.pref.get("gui.geometry");
    277281        if (args.containsKey("geometry")) {
    278282            geometry = args.get("geometry").iterator().next();
    279         }
    280         if (geometry.length() != 0) {
     283        }
     284        if (geometry.length() != 0) {
    281285            final Matcher m = Pattern.compile("(\\d+)x(\\d+)(([+-])(\\d+)([+-])(\\d+))?").matcher(geometry);
    282286            if (m.matches()) {
    283287                int w = Integer.valueOf(m.group(1));
     
    292296                        y = screenDimension.height - y - h;
    293297                }
    294298                bounds = new Rectangle(x,y,w,h);
    295                 if(!Main.pref.get("gui.geometry").equals(geometry)) {
    296                     // remember this geometry
    297                     Main.pref.put("gui.geometry", geometry);
    298                 }
     299                if(!Main.pref.get("gui.geometry").equals(geometry)) {
     300                    // remember this geometry
     301                    Main.pref.put("gui.geometry", geometry);
     302                }
    299303            } else
    300304                System.out.println("Ignoring malformed geometry: "+geometry);
    301305        }
     
    410414    }
    411415
    412416    static public void saveGuiGeometry() {
    413         // if the gui.geometry preference is already set,
    414         // save the current window geometry
    415         String curGeometryPref = pref.get("gui.geometry");
    416         if(curGeometryPref.length() != 0) {
    417             Rectangle bounds = parent.getBounds();
    418             pref.put("gui.geometry",
    419                      (int)bounds.getWidth() +
    420                      "x" + (int)bounds.getHeight() +
    421                      "+" + (int)bounds.getX() +
    422                      "+" + (int)bounds.getY());
    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        }
    424428    }
    425429}