OSDN Git Service

fix some mistakes (disability for function 'alert' and so on)
authormshio <mshio@54a90f34-5e62-402c-8eae-46c47f0b2e07>
Thu, 3 Jun 2010 11:14:40 +0000 (11:14 +0000)
committermshio <mshio@54a90f34-5e62-402c-8eae-46c47f0b2e07>
Thu, 3 Jun 2010 11:14:40 +0000 (11:14 +0000)
git-svn-id: svn+ssh://svn.osdn.net/svnroot/sawarabi-fonts/trunk@10 54a90f34-5e62-402c-8eae-46c47f0b2e07

chartool/src/jp/sourceforge/sawarabifonts/chartool/ConfigScript.java
chartool/src/jp/sourceforge/sawarabifonts/chartool/GlyphViewer.java
chartool/src/jp/sourceforge/sawarabifonts/chartool/JsScriptableObject.java

index 3064e83..0e092ab 100644 (file)
@@ -49,7 +49,9 @@ public class ConfigScript {
        public void load(File f) throws IOException {
                FileReader in = new FileReader(f);
                Context cx = Context.enter();
+               JFrame w = (scriptable == null) ? null : scriptable.getFrame();
                scriptable = new JsScriptableObject();
+               if (w != null) scriptable.setFrame(w);
                cx.initStandardObjects(scriptable);
                setupVariables();
                try {
@@ -122,19 +124,7 @@ public class ConfigScript {
        }
 
        private boolean checkModified(String path) {
-               boolean ret = false;
                File f = new File(path);
-               long m = f.lastModified();
-               if (lastModified < m) {
-                       JsScriptableObject p = scriptable;
-                       try {
-                               load(f);
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               Logger.getLogger(Main.LOGNAME).warning(e.getMessage());
-                               scriptable = p;
-                       }
-               }
-               return ret;
+               return lastModified >= f.lastModified();
        }
 }
index 306683a..c4ce28f 100644 (file)
@@ -86,7 +86,6 @@ public class GlyphViewer extends JTextField {
                                public void actionPerformed(ActionEvent e) { copyChar(); }
                        });
                        JMenu fontmenu = new JMenu("font");
-                       setFontMenu(fontmenu, "Dialog");
                        try {
                                addCustomFontMenu(fontmenu);
                        } catch (IOException e) {
@@ -98,6 +97,7 @@ public class GlyphViewer extends JTextField {
                }
 
                private void addCustomFontMenu(JMenu menu) throws IOException {
+                       setFontMenu(menu, "Dialog");
                        ConfigScript s = ConfigScript.getInstance();
                        if (! s.isLoaded()) { s.load(); }
                        String[] fnt = s.getFontNames();
index 3af9990..b06af16 100644 (file)
@@ -28,11 +28,20 @@ public class JsScriptableObject extends ScriptableObject {
 
        private JFrame frame = null;
 
+       public JsScriptableObject() {
+               super();
+               System.out.println("new");
+       }
+
        @Override
        public String getClassName() {
                return "JsScriptableObject";
        }
 
+       JFrame getFrame() {
+               return frame;
+       }
+
        public void setFrame(JFrame frame) {
                this.frame = frame;
        }