Make editor "fancy", color tweaking, updater bugfix
This commit is contained in:
parent
f2313f8923
commit
ed0ff1d51a
@ -109,6 +109,9 @@
|
|||||||
<Property name="selected" type="boolean" value="true"/>
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
<Property name="text" type="java.lang.String" value="Javascript"/>
|
<Property name="text" type="java.lang.String" value="Javascript"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javascriptOptionActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="pythonOption">
|
<MenuItem class="javax.swing.JRadioButtonMenuItem" name="pythonOption">
|
||||||
<Properties>
|
<Properties>
|
||||||
@ -117,6 +120,9 @@
|
|||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="Python"/>
|
<Property name="text" type="java.lang.String" value="Python"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pythonOptionActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Menu>
|
</Menu>
|
||||||
@ -126,9 +132,6 @@
|
|||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Run"/>
|
<Property name="text" type="java.lang.String" value="Run"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="runMenuActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="runCodeBtn">
|
<MenuItem class="javax.swing.JMenuItem" name="runCodeBtn">
|
||||||
<Properties>
|
<Properties>
|
||||||
@ -158,6 +161,9 @@
|
|||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
<Dimension value="[125, 50]"/>
|
<Dimension value="[125, 50]"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
|
<Dimension value="[550, 375]"/>
|
||||||
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<SyntheticProperties>
|
<SyntheticProperties>
|
||||||
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
|
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
|
||||||
@ -198,37 +204,21 @@
|
|||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jSplitPane1" alignment="0" pref="319" max="32767" attributes="0"/>
|
<Component id="jSplitPane1" alignment="0" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="dividerLocation" type="int" value="220"/>
|
<Property name="dividerLocation" type="int" value="200"/>
|
||||||
<Property name="orientation" type="int" value="0"/>
|
<Property name="orientation" type="int" value="0"/>
|
||||||
<Property name="resizeWeight" type="double" value="0.7"/>
|
<Property name="resizeWeight" type="double" value="0.7"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JScrollPane" name="scrollPane">
|
<Container class="javax.swing.JPanel" name="outputPanel">
|
||||||
<Properties>
|
|
||||||
<Property name="opaque" type="boolean" value="false"/>
|
|
||||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JScrollPane(codeBox)"/>
|
|
||||||
</AuxValues>
|
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
|
||||||
<JSplitPaneConstraints position="top"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||||
<JSplitPaneConstraints position="right"/>
|
<JSplitPaneConstraints position="right"/>
|
||||||
@ -242,7 +232,7 @@
|
|||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="jScrollPane1" pref="524" max="32767" attributes="0"/>
|
<Component id="jScrollPane1" pref="532" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
@ -250,7 +240,7 @@
|
|||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jScrollPane1" pref="73" max="32767" attributes="0"/>
|
<Component id="jScrollPane1" pref="98" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -281,6 +271,15 @@
|
|||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
<Container class="javax.swing.JPanel" name="editPanel">
|
||||||
|
<Constraints>
|
||||||
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||||
|
<JSplitPaneConstraints position="left"/>
|
||||||
|
</Constraint>
|
||||||
|
</Constraints>
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -39,17 +39,12 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JTextPane;
|
|
||||||
import javax.swing.UIDefaults;
|
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||||
import javax.swing.text.AttributeSet;
|
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||||
import javax.swing.text.SimpleAttributeSet;
|
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
||||||
import javax.swing.text.StyleConstants;
|
import org.fife.ui.rsyntaxtextarea.Theme;
|
||||||
import javax.swing.text.StyleContext;
|
import org.fife.ui.rtextarea.RTextScrollPane;
|
||||||
import javax.swing.text.TabSet;
|
|
||||||
import javax.swing.text.TabStop;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -59,8 +54,8 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
|
|
||||||
private final JFileChooser fc = new JFileChooser();
|
private final JFileChooser fc = new JFileChooser();
|
||||||
private boolean isSaved = false;
|
private boolean isSaved = false;
|
||||||
private final JTextPane codeBox = new JTextPane();
|
private RSyntaxTextArea codeBox = new RSyntaxTextArea();
|
||||||
private final TextLineNumber tln;
|
private RTextScrollPane sp;
|
||||||
private String lastSaved = "";
|
private String lastSaved = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,10 +64,6 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
public CodeEditor() {
|
public CodeEditor() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
if (!PrefStorage.isset("advancedcontrols")) {
|
|
||||||
runMenu.remove(codeLangMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileFilter filter = new FileNameExtensionFilter("SyMAT JavaScript (.syjs)", "syjs");
|
FileFilter filter = new FileNameExtensionFilter("SyMAT JavaScript (.syjs)", "syjs");
|
||||||
fc.setFileFilter(filter);
|
fc.setFileFilter(filter);
|
||||||
fc.addChoosableFileFilter(filter);
|
fc.addChoosableFileFilter(filter);
|
||||||
@ -82,6 +73,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
fc.addChoosableFileFilter(filter);
|
fc.addChoosableFileFilter(filter);
|
||||||
filter = new FileNameExtensionFilter("Python script (.py)", "py");
|
filter = new FileNameExtensionFilter("Python script (.py)", "py");
|
||||||
fc.addChoosableFileFilter(filter);
|
fc.addChoosableFileFilter(filter);
|
||||||
|
|
||||||
int font_size = 12;
|
int font_size = 12;
|
||||||
try {
|
try {
|
||||||
font_size = Integer.valueOf(PrefStorage.getSetting("editfont"));
|
font_size = Integer.valueOf(PrefStorage.getSetting("editfont"));
|
||||||
@ -89,41 +81,37 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
}
|
}
|
||||||
codeBox.setFont(new Font(Font.MONOSPACED, Font.PLAIN, font_size));
|
codeBox.setFont(new Font(Font.MONOSPACED, Font.PLAIN, font_size));
|
||||||
outputBox.setFont(new Font(Font.MONOSPACED, Font.PLAIN, font_size));
|
outputBox.setFont(new Font(Font.MONOSPACED, Font.PLAIN, font_size));
|
||||||
|
|
||||||
if (PrefStorage.getSetting("theme").equals("dark")) {
|
if (PrefStorage.getSetting("theme").equals("dark")) {
|
||||||
setBackgroundOfEditor(Color.BLACK);
|
outputBox.setBackground(new Color(41,49,52));
|
||||||
codeBox.setForeground(Color.WHITE);
|
|
||||||
outputBox.setBackground(Color.BLACK);
|
|
||||||
outputBox.setForeground(Color.WHITE);
|
outputBox.setForeground(Color.WHITE);
|
||||||
setBackground(Color.DARK_GRAY);
|
setBackground(Color.DARK_GRAY);
|
||||||
|
setEditorTheme("dark");
|
||||||
} else {
|
} else {
|
||||||
setBackgroundOfEditor(Color.WHITE);
|
|
||||||
codeBox.setForeground(Color.BLACK);
|
|
||||||
outputBox.setBackground(Color.WHITE);
|
outputBox.setBackground(Color.WHITE);
|
||||||
outputBox.setForeground(Color.BLACK);
|
outputBox.setForeground(Color.BLACK);
|
||||||
setBackground(Color.LIGHT_GRAY);
|
setBackground(Color.LIGHT_GRAY);
|
||||||
|
setEditorTheme("default");
|
||||||
}
|
}
|
||||||
TabStop[] tabs = new TabStop[30];
|
|
||||||
for (int i = 0; i < tabs.length; i++) {
|
codeBox.setCodeFoldingEnabled(true);
|
||||||
tabs[i] = new TabStop(15 * i, TabStop.ALIGN_RIGHT, TabStop.LEAD_NONE);
|
codeBox.setAntiAliasingEnabled(true);
|
||||||
}
|
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
|
||||||
TabSet tabset = new TabSet(tabs);
|
sp = new RTextScrollPane(codeBox);
|
||||||
StyleContext sc = StyleContext.getDefaultStyleContext();
|
sp.setFoldIndicatorEnabled(true);
|
||||||
AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY,
|
editPanel.add(sp);
|
||||||
StyleConstants.TabSet, tabset);
|
sp.setVisible(true);
|
||||||
codeBox.setParagraphAttributes(aset, false);
|
|
||||||
tln = new TextLineNumber(codeBox);
|
|
||||||
scrollPane.setRowHeaderView(tln);
|
|
||||||
codeBox.setVisible(true);
|
codeBox.setVisible(true);
|
||||||
tln.setVisible(true);
|
|
||||||
codeBox.requestFocus();
|
codeBox.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBackgroundOfEditor(Color c) {
|
private void setEditorTheme(String themeName) {
|
||||||
UIDefaults defaults = new UIDefaults();
|
try {
|
||||||
defaults.put("TextPane[Enabled].backgroundPainter", c);
|
Theme theme = Theme.load(CodeEditor.class
|
||||||
codeBox.putClientProperty("Nimbus.Overrides", defaults);
|
.getResourceAsStream("resources/" + themeName + ".xml"));
|
||||||
codeBox.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
|
theme.apply(codeBox);
|
||||||
codeBox.setBackground(c);
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,11 +130,11 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
langBtnGroup = new javax.swing.ButtonGroup();
|
langBtnGroup = new javax.swing.ButtonGroup();
|
||||||
jPanel1 = new javax.swing.JPanel();
|
jPanel1 = new javax.swing.JPanel();
|
||||||
jSplitPane1 = new javax.swing.JSplitPane();
|
jSplitPane1 = new javax.swing.JSplitPane();
|
||||||
scrollPane = new JScrollPane(codeBox);
|
outputPanel = new javax.swing.JPanel();
|
||||||
jPanel2 = new javax.swing.JPanel();
|
|
||||||
jLabel1 = new javax.swing.JLabel();
|
jLabel1 = new javax.swing.JLabel();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
outputBox = new javax.swing.JTextArea();
|
outputBox = new javax.swing.JTextArea();
|
||||||
|
editPanel = new javax.swing.JPanel();
|
||||||
jMenuBar1 = new javax.swing.JMenuBar();
|
jMenuBar1 = new javax.swing.JMenuBar();
|
||||||
fileMenu = new javax.swing.JMenu();
|
fileMenu = new javax.swing.JMenu();
|
||||||
openMenu = new javax.swing.JMenuItem();
|
openMenu = new javax.swing.JMenuItem();
|
||||||
@ -176,15 +164,12 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
setTitle("Editor");
|
setTitle("Editor");
|
||||||
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/editor.png"))); // NOI18N
|
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/editor.png"))); // NOI18N
|
||||||
setMinimumSize(new java.awt.Dimension(125, 50));
|
setMinimumSize(new java.awt.Dimension(125, 50));
|
||||||
|
setPreferredSize(new java.awt.Dimension(550, 375));
|
||||||
|
|
||||||
jSplitPane1.setDividerLocation(220);
|
jSplitPane1.setDividerLocation(200);
|
||||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||||
jSplitPane1.setResizeWeight(0.7);
|
jSplitPane1.setResizeWeight(0.7);
|
||||||
|
|
||||||
scrollPane.setOpaque(false);
|
|
||||||
scrollPane.setRequestFocusEnabled(false);
|
|
||||||
jSplitPane1.setTopComponent(scrollPane);
|
|
||||||
|
|
||||||
jLabel1.setText("Output:");
|
jLabel1.setText("Output:");
|
||||||
|
|
||||||
outputBox.setEditable(false);
|
outputBox.setEditable(false);
|
||||||
@ -194,24 +179,27 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
outputBox.setWrapStyleWord(true);
|
outputBox.setWrapStyleWord(true);
|
||||||
jScrollPane1.setViewportView(outputBox);
|
jScrollPane1.setViewportView(outputBox);
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
javax.swing.GroupLayout outputPanelLayout = new javax.swing.GroupLayout(outputPanel);
|
||||||
jPanel2.setLayout(jPanel2Layout);
|
outputPanel.setLayout(outputPanelLayout);
|
||||||
jPanel2Layout.setHorizontalGroup(
|
outputPanelLayout.setHorizontalGroup(
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
outputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
.addGroup(outputPanelLayout.createSequentialGroup()
|
||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addGap(0, 0, Short.MAX_VALUE))
|
.addGap(0, 0, Short.MAX_VALUE))
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
jPanel2Layout.setVerticalGroup(
|
outputPanelLayout.setVerticalGroup(
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
outputPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
.addGroup(outputPanelLayout.createSequentialGroup()
|
||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE))
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
jSplitPane1.setRightComponent(jPanel2);
|
jSplitPane1.setRightComponent(outputPanel);
|
||||||
|
|
||||||
|
editPanel.setLayout(new java.awt.BorderLayout());
|
||||||
|
jSplitPane1.setLeftComponent(editPanel);
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
jPanel1.setLayout(jPanel1Layout);
|
||||||
@ -221,7 +209,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
);
|
);
|
||||||
jPanel1Layout.setVerticalGroup(
|
jPanel1Layout.setVerticalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
|
.addComponent(jSplitPane1)
|
||||||
);
|
);
|
||||||
|
|
||||||
fileMenu.setText("File");
|
fileMenu.setText("File");
|
||||||
@ -280,10 +268,20 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
langBtnGroup.add(javascriptOption);
|
langBtnGroup.add(javascriptOption);
|
||||||
javascriptOption.setSelected(true);
|
javascriptOption.setSelected(true);
|
||||||
javascriptOption.setText("Javascript");
|
javascriptOption.setText("Javascript");
|
||||||
|
javascriptOption.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
javascriptOptionActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
codeLangMenu.add(javascriptOption);
|
codeLangMenu.add(javascriptOption);
|
||||||
|
|
||||||
langBtnGroup.add(pythonOption);
|
langBtnGroup.add(pythonOption);
|
||||||
pythonOption.setText("Python");
|
pythonOption.setText("Python");
|
||||||
|
pythonOption.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
pythonOptionActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
codeLangMenu.add(pythonOption);
|
codeLangMenu.add(pythonOption);
|
||||||
|
|
||||||
editMenu.add(codeLangMenu);
|
editMenu.add(codeLangMenu);
|
||||||
@ -291,11 +289,6 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
jMenuBar1.add(editMenu);
|
jMenuBar1.add(editMenu);
|
||||||
|
|
||||||
runMenu.setText("Run");
|
runMenu.setText("Run");
|
||||||
runMenu.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
runMenuActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
runCodeBtn.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
|
runCodeBtn.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
|
||||||
runCodeBtn.setText("Run code");
|
runCodeBtn.setText("Run code");
|
||||||
@ -351,9 +344,11 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
if (file.matches(".*\\.(js|mls|symt|syjs)")) {
|
if (file.matches(".*\\.(js|mls|symt|syjs)")) {
|
||||||
javascriptOption.setSelected(true);
|
javascriptOption.setSelected(true);
|
||||||
pythonOption.setSelected(false);
|
pythonOption.setSelected(false);
|
||||||
|
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
|
||||||
} else if (file.matches(".*\\.(sypy|py)")) {
|
} else if (file.matches(".*\\.(sypy|py)")) {
|
||||||
javascriptOption.setSelected(false);
|
javascriptOption.setSelected(false);
|
||||||
pythonOption.setSelected(true);
|
pythonOption.setSelected(true);
|
||||||
|
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
JOptionPane.showInternalMessageDialog(this,
|
JOptionPane.showInternalMessageDialog(this,
|
||||||
@ -395,10 +390,6 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
saveMenuActionPerformed(evt);
|
saveMenuActionPerformed(evt);
|
||||||
}//GEN-LAST:event_saveAsMenuActionPerformed
|
}//GEN-LAST:event_saveAsMenuActionPerformed
|
||||||
|
|
||||||
private void runMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runMenuActionPerformed
|
|
||||||
|
|
||||||
}//GEN-LAST:event_runMenuActionPerformed
|
|
||||||
|
|
||||||
private void runCodeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runCodeBtnActionPerformed
|
private void runCodeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runCodeBtnActionPerformed
|
||||||
if (javascriptOption.isSelected()) {
|
if (javascriptOption.isSelected()) {
|
||||||
new RunThread("javascript").start();
|
new RunThread("javascript").start();
|
||||||
@ -445,6 +436,14 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
MainGUI.loadFrame(ce);
|
MainGUI.loadFrame(ce);
|
||||||
}//GEN-LAST:event_exportMenuActionPerformed
|
}//GEN-LAST:event_exportMenuActionPerformed
|
||||||
|
|
||||||
|
private void javascriptOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javascriptOptionActionPerformed
|
||||||
|
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
|
||||||
|
}//GEN-LAST:event_javascriptOptionActionPerformed
|
||||||
|
|
||||||
|
private void pythonOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pythonOptionActionPerformed
|
||||||
|
codeBox.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
|
||||||
|
}//GEN-LAST:event_pythonOptionActionPerformed
|
||||||
|
|
||||||
private void saveFile(String content, String path)
|
private void saveFile(String content, String path)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
try (PrintStream out = new PrintStream(new FileOutputStream(path))) {
|
try (PrintStream out = new PrintStream(new FileOutputStream(path))) {
|
||||||
@ -483,6 +482,7 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
private javax.swing.JMenuItem clrOutputMenu;
|
private javax.swing.JMenuItem clrOutputMenu;
|
||||||
private javax.swing.JMenu codeLangMenu;
|
private javax.swing.JMenu codeLangMenu;
|
||||||
private javax.swing.JMenu editMenu;
|
private javax.swing.JMenu editMenu;
|
||||||
|
private javax.swing.JPanel editPanel;
|
||||||
private javax.swing.JMenuItem exportMenu;
|
private javax.swing.JMenuItem exportMenu;
|
||||||
private javax.swing.JMenu fileMenu;
|
private javax.swing.JMenu fileMenu;
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
@ -492,18 +492,17 @@ public class CodeEditor extends javax.swing.JInternalFrame {
|
|||||||
private javax.swing.JMenuBar jMenuBar2;
|
private javax.swing.JMenuBar jMenuBar2;
|
||||||
private javax.swing.JMenuItem jMenuItem4;
|
private javax.swing.JMenuItem jMenuItem4;
|
||||||
private javax.swing.JPanel jPanel1;
|
private javax.swing.JPanel jPanel1;
|
||||||
private javax.swing.JPanel jPanel2;
|
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
private javax.swing.JSplitPane jSplitPane1;
|
private javax.swing.JSplitPane jSplitPane1;
|
||||||
private javax.swing.JRadioButtonMenuItem javascriptOption;
|
private javax.swing.JRadioButtonMenuItem javascriptOption;
|
||||||
private javax.swing.ButtonGroup langBtnGroup;
|
private javax.swing.ButtonGroup langBtnGroup;
|
||||||
private javax.swing.JMenuItem openMenu;
|
private javax.swing.JMenuItem openMenu;
|
||||||
private javax.swing.JTextArea outputBox;
|
private javax.swing.JTextArea outputBox;
|
||||||
|
private javax.swing.JPanel outputPanel;
|
||||||
private javax.swing.JRadioButtonMenuItem pythonOption;
|
private javax.swing.JRadioButtonMenuItem pythonOption;
|
||||||
private javax.swing.JMenuItem runCodeBtn;
|
private javax.swing.JMenuItem runCodeBtn;
|
||||||
private javax.swing.JMenu runMenu;
|
private javax.swing.JMenu runMenu;
|
||||||
private javax.swing.JMenuItem saveAsMenu;
|
private javax.swing.JMenuItem saveAsMenu;
|
||||||
private javax.swing.JMenuItem saveMenu;
|
private javax.swing.JMenuItem saveMenu;
|
||||||
private javax.swing.JScrollPane scrollPane;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,9 @@ public class Interpreter extends javax.swing.JInternalFrame {
|
|||||||
|
|
||||||
// Set theme
|
// Set theme
|
||||||
if (PrefStorage.getSetting("theme").equals("dark")) {
|
if (PrefStorage.getSetting("theme").equals("dark")) {
|
||||||
mainBox.setBackground(Color.BLACK);
|
mainBox.setBackground(new Color(41,49,52));
|
||||||
mainBox.setForeground(Color.WHITE);
|
mainBox.setForeground(Color.WHITE);
|
||||||
inputBox.setBackground(Color.BLACK);
|
inputBox.setBackground(new Color(41,49,52));
|
||||||
inputBox.setForeground(Color.WHITE);
|
inputBox.setForeground(Color.WHITE);
|
||||||
setBackground(Color.DARK_GRAY);
|
setBackground(Color.DARK_GRAY);
|
||||||
} else {
|
} else {
|
||||||
|
@ -67,7 +67,7 @@ public class MainGUI extends javax.swing.JFrame {
|
|||||||
is.close();
|
is.close();
|
||||||
double version = Double.parseDouble(line.split("\\|")[0]);
|
double version = Double.parseDouble(line.split("\\|")[0]);
|
||||||
if (version > APP_CODE) {
|
if (version > APP_CODE) {
|
||||||
if (PrefStorage.getSetting("update-ignore").equals(APP_CODE + "|" + version)) {
|
if (PrefStorage.getSetting("update-ignore").equals(VERSION_NAME + "|" + line.split("\\|")[1])) {
|
||||||
System.out.println("An update was found, but has been ignored by the user.");
|
System.out.println("An update was found, but has been ignored by the user.");
|
||||||
} else {
|
} else {
|
||||||
loadFrame(new Update(line.split("\\|")[1]));
|
loadFrame(new Update(line.split("\\|")[1]));
|
||||||
|
@ -156,7 +156,7 @@ public class Update extends javax.swing.JInternalFrame {
|
|||||||
}//GEN-LAST:event_jButton1ActionPerformed
|
}//GEN-LAST:event_jButton1ActionPerformed
|
||||||
|
|
||||||
private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked
|
private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked
|
||||||
PrefStorage.saveSetting("update-ignore", MainGUI.APP_CODE + "|" + latestVersion);
|
PrefStorage.saveSetting("update-ignore", MainGUI.VERSION_NAME + "|" + latestVersion);
|
||||||
dispose();
|
dispose();
|
||||||
}//GEN-LAST:event_jLabel5MouseClicked
|
}//GEN-LAST:event_jLabel5MouseClicked
|
||||||
|
|
||||||
|
78
src/net/apocalypselabs/symat/resources/dark.xml
Normal file
78
src/net/apocalypselabs/symat/resources/dark.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE RSyntaxTheme SYSTEM "theme.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Dark theme based off of Notepad++'s Obsidian theme.
|
||||||
|
See theme.dtd and org.fife.ui.rsyntaxtextarea.Theme for more information.
|
||||||
|
-->
|
||||||
|
<RSyntaxTheme version="1.0">
|
||||||
|
|
||||||
|
<!-- Omitting baseFont will use a system-appropriate monospaced. -->
|
||||||
|
<!--<baseFont family="..." size="13"/>-->
|
||||||
|
|
||||||
|
<!-- General editor colors. -->
|
||||||
|
<background color="293134"/>
|
||||||
|
<caret color="c1cbc2"/>
|
||||||
|
<selection useFG="false" bg="404E51" roundedEdges="false"/>
|
||||||
|
<currentLineHighlight color="2F393C" fade="false"/>
|
||||||
|
<marginLine fg="394448"/>
|
||||||
|
<markAllHighlight color="6b8189"/> <!-- TODO: Fix me -->
|
||||||
|
<markOccurrencesHighlight color="5b7179" border="false"/>
|
||||||
|
<matchedBracket fg="6A8088" bg="6b8189" highlightBoth="false" animate="true"/>
|
||||||
|
<hyperlinks fg="a082bd"/>
|
||||||
|
<secondaryLanguages>
|
||||||
|
<language index="1" bg="334455"/>
|
||||||
|
<language index="2" bg="223322"/>
|
||||||
|
<language index="3" bg="ffe0f0"/>
|
||||||
|
</secondaryLanguages>
|
||||||
|
|
||||||
|
<!-- Gutter styling. -->
|
||||||
|
<gutterBorder color="81969A"/>
|
||||||
|
<lineNumbers fg="81969A"/>
|
||||||
|
<foldIndicator fg="6A8088" iconBg="2f383c"/>
|
||||||
|
<iconRowHeader activeLineRange="3399ff"/>
|
||||||
|
|
||||||
|
<!-- Syntax tokens. -->
|
||||||
|
<tokenStyles>
|
||||||
|
<style token="IDENTIFIER" fg="E0E2E4"/>
|
||||||
|
<style token="RESERVED_WORD" fg="93C763" bold="true"/>
|
||||||
|
<style token="RESERVED_WORD_2" fg="93C763" bold="true"/>
|
||||||
|
<style token="ANNOTATION" fg="E8E2B7"/>
|
||||||
|
<style token="COMMENT_DOCUMENTATION" fg="6C788C"/>
|
||||||
|
<style token="COMMENT_EOL" fg="66747B"/>
|
||||||
|
<style token="COMMENT_MULTILINE" fg="66747B"/>
|
||||||
|
<style token="COMMENT_KEYWORD" fg="ae9fbf"/>
|
||||||
|
<style token="COMMENT_MARKUP" fg="ae9fbf"/>
|
||||||
|
<style token="FUNCTION" fg="E0E2E4"/>
|
||||||
|
<style token="DATA_TYPE" fg="678CB1" bold="true"/>
|
||||||
|
<style token="LITERAL_BOOLEAN" fg="93C763" bold="true"/>
|
||||||
|
<style token="LITERAL_NUMBER_DECIMAL_INT" fg="FFCD22"/>
|
||||||
|
<style token="LITERAL_NUMBER_FLOAT" fg="FFCD22"/>
|
||||||
|
<style token="LITERAL_NUMBER_HEXADECIMAL" fg="FFCD22"/>
|
||||||
|
<style token="LITERAL_STRING_DOUBLE_QUOTE" fg="EC7600"/>
|
||||||
|
<style token="LITERAL_CHAR" fg="EC7600"/>
|
||||||
|
<style token="LITERAL_BACKQUOTE" fg="EC7600"/>
|
||||||
|
<style token="MARKUP_TAG_DELIMITER" fg="678CB1"/>
|
||||||
|
<style token="MARKUP_TAG_NAME" fg="ABBFD3" bold="true"/>
|
||||||
|
<style token="MARKUP_TAG_ATTRIBUTE" fg="B3B689"/>
|
||||||
|
<style token="MARKUP_TAG_ATTRIBUTE_VALUE" fg="e1e2cf"/>
|
||||||
|
<style token="MARKUP_COMMENT" fg="66747B"/>
|
||||||
|
<style token="MARKUP_DTD" fg="A082BD"/>
|
||||||
|
<style token="MARKUP_PROCESSING_INSTRUCTION" fg="A082BD"/>
|
||||||
|
<style token="MARKUP_CDATA" fg="d5e6f0"/>
|
||||||
|
<style token="MARKUP_CDATA_DELIMITER" fg="ae9fbf"/>
|
||||||
|
<style token="MARKUP_ENTITY_REFERENCE" fg="678CB1"/>
|
||||||
|
<style token="OPERATOR" fg="E8E2B7"/>
|
||||||
|
<style token="PREPROCESSOR" fg="A082BD"/>
|
||||||
|
<style token="REGEX" fg="d39745"/>
|
||||||
|
<style token="SEPARATOR" fg="E8E2B7"/>
|
||||||
|
<style token="VARIABLE" fg="ae9fbf" bold="true"/>
|
||||||
|
<style token="WHITESPACE" fg="E0E2E4"/>
|
||||||
|
|
||||||
|
<style token="ERROR_IDENTIFIER" fg="E0E2E4" bg="04790e"/>
|
||||||
|
<style token="ERROR_NUMBER_FORMAT" fg="E0E2E4" bg="04790e"/>
|
||||||
|
<style token="ERROR_STRING_DOUBLE" fg="E0E2E4" bg="04790e"/>
|
||||||
|
<style token="ERROR_CHAR" fg="E0E2E4" bg="04790e"/>
|
||||||
|
</tokenStyles>
|
||||||
|
|
||||||
|
</RSyntaxTheme>
|
78
src/net/apocalypselabs/symat/resources/default.xml
Normal file
78
src/net/apocalypselabs/symat/resources/default.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE RSyntaxTheme SYSTEM "theme.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
RSyntaxTextArea's default theme.
|
||||||
|
See theme.dtd and org.fife.ui.rsyntaxtextarea.Theme for more information.
|
||||||
|
-->
|
||||||
|
<RSyntaxTheme version="1.0">
|
||||||
|
|
||||||
|
<!-- Omitting baseFont will use a system-appropriate monospaced. -->
|
||||||
|
<!--<baseFont family="..." size="13"/>-->
|
||||||
|
|
||||||
|
<!-- General editor colors. -->
|
||||||
|
<background color="ffffff"/>
|
||||||
|
<caret color="ff0000"/>
|
||||||
|
<selection fg="default" useFG="false" bg="c8c8ff"/>
|
||||||
|
<currentLineHighlight color="ffffaa" fade="false"/>
|
||||||
|
<marginLine fg="b0b4b9"/>
|
||||||
|
<markAllHighlight color="6b8189"/> <!-- TODO: Fix me -->
|
||||||
|
<markOccurrencesHighlight color="d4d4d4" border="false"/>
|
||||||
|
<matchedBracket fg="000080" bg="eaeaff" highlightBoth="false" animate="true"/>
|
||||||
|
<hyperlinks fg="0000ff"/>
|
||||||
|
<secondaryLanguages>
|
||||||
|
<language index="1" bg="fff0cc"/>
|
||||||
|
<language index="2" bg="dafeda"/>
|
||||||
|
<language index="3" bg="ffe0f0"/>
|
||||||
|
</secondaryLanguages>
|
||||||
|
|
||||||
|
<!-- Gutter styling. -->
|
||||||
|
<gutterBorder color="dddddd"/>
|
||||||
|
<lineNumbers fg="787878"/>
|
||||||
|
<foldIndicator fg="808080" iconBg="ffffff"/>
|
||||||
|
<iconRowHeader activeLineRange="3399ff"/>
|
||||||
|
|
||||||
|
<!-- Syntax tokens. -->
|
||||||
|
<tokenStyles>
|
||||||
|
<style token="IDENTIFIER" fg="000000"/>
|
||||||
|
<style token="RESERVED_WORD" fg="0000ff" bold="true"/>
|
||||||
|
<style token="RESERVED_WORD_2" fg="0000ff" bold="true"/>
|
||||||
|
<style token="ANNOTATION" fg="808080"/>
|
||||||
|
<style token="COMMENT_DOCUMENTATION" fg="a40000" italic="true"/>
|
||||||
|
<style token="COMMENT_EOL" fg="008000" italic="true"/>
|
||||||
|
<style token="COMMENT_MULTILINE" fg="008000" italic="true"/>
|
||||||
|
<style token="COMMENT_KEYWORD" fg="ff9900" bold="true"/>
|
||||||
|
<style token="COMMENT_MARKUP" fg="808080"/>
|
||||||
|
<style token="DATA_TYPE" fg="008080" bold="true"/>
|
||||||
|
<style token="FUNCTION" fg="ad8000"/>
|
||||||
|
<style token="LITERAL_BOOLEAN" fg="0000ff" bold="true"/>
|
||||||
|
<style token="LITERAL_NUMBER_DECIMAL_INT" fg="6400C8"/>
|
||||||
|
<style token="LITERAL_NUMBER_FLOAT" fg="6400C8"/>
|
||||||
|
<style token="LITERAL_NUMBER_HEXADECIMAL" fg="6400C8"/>
|
||||||
|
<style token="LITERAL_STRING_DOUBLE_QUOTE" fg="DC009C"/>
|
||||||
|
<style token="LITERAL_CHAR" fg="DC009C"/>
|
||||||
|
<style token="LITERAL_BACKQUOTE" fg="DC009C"/>
|
||||||
|
<style token="MARKUP_TAG_DELIMITER" fg="ff0000"/>
|
||||||
|
<style token="MARKUP_TAG_NAME" fg="0000ff"/>
|
||||||
|
<style token="MARKUP_TAG_ATTRIBUTE" fg="3f7f7f"/>
|
||||||
|
<style token="MARKUP_TAG_ATTRIBUTE_VALUE" fg="DC009C"/>
|
||||||
|
<style token="MARKUP_COMMENT" fg="006000" italic="true"/>
|
||||||
|
<style token="MARKUP_DTD" fg="ad8000"/>
|
||||||
|
<style token="MARKUP_PROCESSING_INSTRUCTION" fg="808080"/>
|
||||||
|
<style token="MARKUP_CDATA" fg="cc6600"/>
|
||||||
|
<style token="MARKUP_CDATA_DELIMITER" fg="008080"/>
|
||||||
|
<style token="MARKUP_ENTITY_REFERENCE" fg="008000"/>
|
||||||
|
<style token="OPERATOR" fg="804040"/>
|
||||||
|
<style token="PREPROCESSOR" fg="808080"/>
|
||||||
|
<style token="REGEX" fg="008040"/>
|
||||||
|
<style token="SEPARATOR" fg="ff0000"/>
|
||||||
|
<style token="VARIABLE" fg="ee8800" bold="true"/>
|
||||||
|
<style token="WHITESPACE" fg="000000"/>
|
||||||
|
|
||||||
|
<style token="ERROR_IDENTIFIER" fg="000000" bg="ffcccc"/>
|
||||||
|
<style token="ERROR_NUMBER_FORMAT" fg="000000" bg="ffcccc"/>
|
||||||
|
<style token="ERROR_STRING_DOUBLE" fg="000000" bg="ffcccc"/>
|
||||||
|
<style token="ERROR_CHAR" fg="000000" bg="ffcccc"/>
|
||||||
|
</tokenStyles>
|
||||||
|
|
||||||
|
</RSyntaxTheme>
|
Loading…
x
Reference in New Issue
Block a user