Code formatting and comment adding.

This commit is contained in:
skylarmt 2014-12-27 02:09:38 -07:00
parent f8a2e0de7e
commit ab34728dbe

View File

@ -53,12 +53,16 @@ public class MainGUI extends javax.swing.JFrame {
public static boolean skipEditor = false; // Skip editor init on start? public static boolean skipEditor = false; // Skip editor init on start?
/** /**
* Creates new form MainGUI * Creates the main app window and does some quick things that aren't
* threaded in SplashScreen.
*/ */
public MainGUI() { public MainGUI() {
initComponents(); initComponents();
setIconImage((new ImageIcon(getClass().getResource("icon.png"))).getImage()); setIconImage((new ImageIcon(
getClass().getResource("icon.png"))).getImage());
setLocationRelativeTo(null); setLocationRelativeTo(null);
// Check for updates.
try { try {
URL url = new URL("http://symatapp.com/version.txt"); URL url = new URL("http://symatapp.com/version.txt");
InputStream is = url.openStream(); InputStream is = url.openStream();
@ -69,8 +73,10 @@ 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(VERSION_NAME + "|" + line.split("\\|")[1])) { if (PrefStorage.getSetting("update-ignore")
System.out.println("An update was found, but has been ignored by the user."); .equals(VERSION_NAME + "|" + line.split("\\|")[1])) {
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]));
} }
@ -83,7 +89,7 @@ public class MainGUI extends javax.swing.JFrame {
setButtonShortcuts(); setButtonShortcuts();
// Open shell unless prog was run with argument // Open shell unless launched with file as argument
if (argfile.equals("")) { if (argfile.equals("")) {
Interpreter sh = new Interpreter(); Interpreter sh = new Interpreter();
loadFrame(sh); loadFrame(sh);
@ -113,14 +119,20 @@ public class MainGUI extends javax.swing.JFrame {
* (Re)load display settings. * (Re)load display settings.
*/ */
public static void updateDisplay() { public static void updateDisplay() {
mainPane.paintImmediately(0, 0, mainPane.getWidth(), mainPane.getHeight()); mainPane.paintImmediately(0, 0,
mainPane.getWidth(), mainPane.getHeight());
if (PrefStorage.getSetting("theme").equals("dark")) { if (PrefStorage.getSetting("theme").equals("dark")) {
tabs.setBackground(Color.BLACK); tabs.setBackground(new Color(41, 49, 52));
} else { } else {
tabs.setBackground(new Color(240, 240, 240)); tabs.setBackground(new Color(240, 240, 240));
} }
} }
/**
* Get the markup for the watermark thing on the Ribbon.
*
* @return HTML for a JLabel.
*/
private static String namemark() { private static String namemark() {
String nbsp = ""; String nbsp = "";
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
@ -406,6 +418,10 @@ public class MainGUI extends javax.swing.JFrame {
pack(); pack();
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
/*
This section has all the buttons!
*/
private void shellBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shellBtnActionPerformed private void shellBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shellBtnActionPerformed
loadFrame(new Interpreter()); loadFrame(new Interpreter());
}//GEN-LAST:event_shellBtnActionPerformed }//GEN-LAST:event_shellBtnActionPerformed
@ -455,6 +471,9 @@ public class MainGUI extends javax.swing.JFrame {
} }
}//GEN-LAST:event_tabsStateChanged }//GEN-LAST:event_tabsStateChanged
/*
End the button handlers.
*/
/** /**
* Adds the given JInternalFrame to the mainPane. Automatically does layout * Adds the given JInternalFrame to the mainPane. Automatically does layout
* and sets visible (if show==true). * and sets visible (if show==true).
@ -486,7 +505,6 @@ public class MainGUI extends javax.swing.JFrame {
if (show) { if (show) {
frame.setVisible(true); frame.setVisible(true);
} }
//updateDisplay();
} }
/** /**
@ -499,6 +517,10 @@ public class MainGUI extends javax.swing.JFrame {
loadFrame(frame, true); loadFrame(frame, true);
} }
/**
* Cascade all the frames in a stack. Somehow reverses the order each time
* around, I have no idea why but it's a "feature" now!
*/
public static void cascade() { public static void cascade() {
JInternalFrame[] frames = mainPane.getAllFrames(); JInternalFrame[] frames = mainPane.getAllFrames();
int x = 12; int x = 12;
@ -506,8 +528,15 @@ public class MainGUI extends javax.swing.JFrame {
Debug.println("Cascading " + frames.length + " frames..."); Debug.println("Cascading " + frames.length + " frames...");
for (int i = 0; i < frames.length; i++) { for (int i = 0; i < frames.length; i++) {
if (frames[i].isVisible()) { if (frames[i].isVisible()) {
Debug.println("Frame: " + frames[i].getTitle() + ", Times: " + i + ", Xpos: " + x * i + ", Ypos: " + y * i); Debug.println("Frame: "
frames[i].setBounds(x * i, y * i, frames[i].getWidth(), frames[i].getHeight()); + frames[i].getTitle()
+ ", Times: " + i
+ ", Xpos: " + x * i
+ ", Ypos: " + y * i);
frames[i].setBounds(x * i,
y * i,
frames[i].getWidth(),
frames[i].getHeight());
frames[i].toFront(); frames[i].toFront();
} }
} }
@ -537,15 +566,20 @@ public class MainGUI extends javax.swing.JFrame {
//</editor-fold> //</editor-fold>
// Command line args // Command line args
for (String arg : args) { for (String arg : args) {
if (arg.equals("skippython")) { switch (arg) {
skipPython = true; case "skippython":
} else if (arg.equals("skipeditor")) { skipPython = true;
skipEditor = true; break;
} else if (arg.equals("quickstart")) { case "skipeditor":
skipPython = true; skipEditor = true;
skipEditor = true; break;
} else { case "quickstart":
argfile = args[0]; skipPython = true;
skipEditor = true;
break;
default:
argfile = args[0];
break;
} }
} }