diff --git a/pom.xml b/pom.xml index c28e1fb..3563ecf 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ info.istlab.IoTP IoTP jar - 0.35 + 0.36 IoTP http://maven.apache.org diff --git a/src/main/java/info/istlab/IoTP/Launcher.java b/src/main/java/info/istlab/IoTP/Launcher.java index 12cfaf5..26d0005 100644 --- a/src/main/java/info/istlab/IoTP/Launcher.java +++ b/src/main/java/info/istlab/IoTP/Launcher.java @@ -28,7 +28,7 @@ public class Launcher extends JFrame implements MouseInputListener, KeyListener, Runnable { public static Launcher theapp; - public static String version = "0.35"; + public static String version = "0.36"; static int reboot_msec = 2000; // JPanel mainP; File root; @@ -188,6 +188,7 @@ serialMenu.add(jcbmi); if (s.equals(App.serialName)){ jcbmi.setSelected(true); + jcbmi.addActionListener(e -> dummychooseSerial(e)); // jcbmi.setEnabled(false); } else { jcbmi.addActionListener(e -> chooseSerial(e)); @@ -202,6 +203,10 @@ serialMenu.add(mi); } + void dummychooseSerial(ActionEvent e){ + JCheckBoxMenuItem mi = (JCheckBoxMenuItem) e.getSource(); + mi.setSelected(true); + } void chooseSerial(ActionEvent e){ App.serialName = e.getActionCommand(); updateSerialMenu(serialChecker.validSerialNames); diff --git a/src/main/java/info/istlab/IoTP/MyRSJTextArea.java b/src/main/java/info/istlab/IoTP/MyRSJTextArea.java index 9aa6e97..2f1ad17 100644 --- a/src/main/java/info/istlab/IoTP/MyRSJTextArea.java +++ b/src/main/java/info/istlab/IoTP/MyRSJTextArea.java @@ -1,6 +1,5 @@ package info.istlab.IoTP; -import java.awt.Color; import java.awt.Font; import javax.swing.JPopupMenu; @@ -8,54 +7,50 @@ import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.Style; -import org.fife.ui.rsyntaxtextarea.SyntaxScheme; -import org.fife.ui.rsyntaxtextarea.Token; -import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; public class MyRSJTextArea extends RSyntaxTextArea { AbstractTokenMakerFactory atmf; public MyRSJTextArea() { - String syn = "TokenMaker4MyRSJTextArea"; - atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance(); - atmf.putMapping(syn, "info.istlab.IoTP." + syn); //独自のTokenMakerを登録 - setSyntaxEditingStyle(syn); + // String syn = "TokenMaker4MyRSJTextArea"; + // atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance(); + // atmf.putMapping(syn, "info.istlab.IoTP." + syn); //独自のTokenMakerを登録 + // setSyntaxEditingStyle(syn); setFont(new FontUIResource("sansserif", Font.PLAIN, 14)); - SyntaxScheme scheme = getSyntaxScheme(); - // SyntaxScheme scheme = new SyntaxScheme(false); - // for(Style s : scheme.getStyles()){ - // System.out.println(s); + // SyntaxScheme scheme = getSyntaxScheme(); + // // SyntaxScheme scheme = new SyntaxScheme(false); + // // for(Style s : scheme.getStyles()){ + // // System.out.println(s); - Style baseStyle = new Style(Color.black); - for (int i = 0; i < 39; i++) - scheme.setStyle(i, baseStyle); - Style commentStyle = new Style(new Color(0, 128, 0), new Color(255, 255, 0x66), //緑文字、黄色背景 - new Font("SansSerif", Font.ITALIC, 14)); - Style commentStyle2 = new Style(new Color(0, 128, 0), new Color(0xcc, 255, 255),// 緑文字、水色背景 - new Font("SansSerif", Font.ITALIC, 14)); - Style commentStyle3 = new Style(new Color(0xcc, 0x00, 0xcc), new Color(0xff, 0xcc, 0xff),//マゼンタむらさき文字、ピンク背景 - new Font("SansSerif", Font.ITALIC, 14)); - Style commentStyle4 = new Style(new Color(0x33, 0x88, 0xcc), new Color(0xee, 0xee, 0xee), - new Font("SansSerif", Font.PLAIN, 14)); - int[] comlist = new int[] { Token.COMMENT_EOL, Token.COMMENT_KEYWORD, Token.COMMENT_MARKUP }; - for (int c : comlist) { - scheme.setStyle(c, commentStyle); - } - int[] comlist2 = new int[] { Token.COMMENT_MULTILINE }; - for (int c : comlist2) { - scheme.setStyle(c, commentStyle2); - } - int[] comlist3 = new int[] { Token.COMMENT_DOCUMENTATION }; - for (int c : comlist3) { - scheme.setStyle(c, commentStyle3); - } - int[] comlist4 = new int[] { Token.ANNOTATION }; - for (int c : comlist4) { - scheme.setStyle(c, commentStyle4); - } - setSyntaxScheme(scheme); + // Style baseStyle = new Style(Color.black); + // for (int i = 0; i < 39; i++) + // scheme.setStyle(i, baseStyle); + // Style commentStyle = new Style(new Color(0, 128, 0), new Color(255, 255, 0x66), //緑文字、黄色背景 + // new Font("SansSerif", Font.ITALIC, 14)); + // Style commentStyle2 = new Style(new Color(0, 128, 0), new Color(0xcc, 255, 255),// 緑文字、水色背景 + // new Font("SansSerif", Font.ITALIC, 14)); + // Style commentStyle3 = new Style(new Color(0xcc, 0x00, 0xcc), new Color(0xff, 0xcc, 0xff),//マゼンタむらさき文字、ピンク背景 + // new Font("SansSerif", Font.ITALIC, 14)); + // Style commentStyle4 = new Style(new Color(0x33, 0x88, 0xcc), new Color(0xee, 0xee, 0xee), + // new Font("SansSerif", Font.PLAIN, 14)); + // int[] comlist = new int[] { Token.COMMENT_EOL, Token.COMMENT_KEYWORD, Token.COMMENT_MARKUP }; + // for (int c : comlist) { + // scheme.setStyle(c, commentStyle); + // } + // int[] comlist2 = new int[] { Token.COMMENT_MULTILINE }; + // for (int c : comlist2) { + // scheme.setStyle(c, commentStyle2); + // } + // int[] comlist3 = new int[] { Token.COMMENT_DOCUMENTATION }; + // for (int c : comlist3) { + // scheme.setStyle(c, commentStyle3); + // } + // int[] comlist4 = new int[] { Token.ANNOTATION }; + // for (int c : comlist4) { + // scheme.setStyle(c, commentStyle4); + // } + // setSyntaxScheme(scheme); // scheme.getStyle(Token.COMMENT_EOL).background = Color.cyan; // scheme.getStyle(Token.COMMENT_DOCUMENTATION).background = diff --git a/src/main/java/info/istlab/IoTP/ScriptRunner.java b/src/main/java/info/istlab/IoTP/ScriptRunner.java index 8b0e684..1d0c0c1 100644 --- a/src/main/java/info/istlab/IoTP/ScriptRunner.java +++ b/src/main/java/info/istlab/IoTP/ScriptRunner.java @@ -52,24 +52,27 @@ comlist.add(srcfile); if (App.serialName != null) comlist.add(App.serialName); - } else { + } else { //MacOS, Linux comlist.add("bash"); // comlist.add("-l"); comlist.add(scriptfile); if (srcfile != null && srcfile.length() > 0) comlist.add(srcfile); + if (App.serialName != null) + comlist.add(App.serialName); } // 現在選択しているシリアルコンソールを閉じる - for(String key : SerialWindow.hash.keySet()){ - if (!key.equals(App.serialName)) continue; // 選択していないものだったら閉じない。 + for (String key : SerialWindow.hash.keySet()) { + if (!key.equals(App.serialName)) + continue; // 選択していないものだったら閉じない。 SerialWindow swin = SerialWindow.hash.get(key); if (swin != null) { swin.closeSerialPort(null); } } // 既存のコンパイルコンソールをすべて閉じる - while (!JTAConsole.winStack.isEmpty()){ + while (!JTAConsole.winStack.isEmpty()) { JTAConsole jcon = JTAConsole.winStack.pop(); jcon.closeWin(); } @@ -117,7 +120,7 @@ con.Systemoutprintln("=== 終了 === (ALT+Wで閉じる)"); thread = null; // runB.setText("Run"); - if (scriptfile_base.startsWith("Upload")){ + if (scriptfile_base.startsWith("Upload")) { SerialWindow.disposeByName(App.serialName); SerialWindow.invoke(false); // no serial connectionsのとき、メッセージ表示しない }