From e9edd7aada723ea4366f69419653c5d6e13d8826 Mon Sep 17 00:00:00 2001 From: benfry Date: Thu, 6 Nov 2003 03:55:44 +0000 Subject: [PATCH] making more mess --- app/PdeBase.java | 256 +++++++++------------------- app/PdeEditor.java | 130 ++++++-------- app/PdeEditorButtons.java | 8 +- app/PdeEditorConsole.java | 49 ++---- app/PdeEditorHeader.java | 16 +- app/PdeEditorStatus.java | 34 ++-- app/PdePreferences.java | 290 ++++++++++++++++++++++++++------ app/PdePreprocessor.java | 15 +- app/PdePreprocessorOro.java | 13 +- app/PdeRuntime.java | 37 +--- build/shared/lib/pde.properties | 43 ++--- 11 files changed, 459 insertions(+), 432 deletions(-) diff --git a/app/PdeBase.java b/app/PdeBase.java index 93ae440ae..a506a85dd 100644 --- a/app/PdeBase.java +++ b/app/PdeBase.java @@ -40,6 +40,11 @@ import com.apple.mrj.*; #endif +/** + * Primary role of this class is for platform identification and + * general interaction with the system (launching URLs, loading + * files and images, etc) that comes from that. + */ #ifndef SWINGSUCKS public class PdeBase extends JFrame #else @@ -71,7 +76,7 @@ public class PdeBase extends Frame boolean errorState; PdeEditor editor; - WindowAdapter windowListener; + //WindowAdapter windowListener; Menu sketchbookMenu; File sketchbookFolder; @@ -94,10 +99,9 @@ public class PdeBase extends Frame //CheckboxMenuItem externalEditorItem; //Menu renderMenu; - CheckboxMenuItem normalItem, openglItem; + //CheckboxMenuItem normalItem, openglItem; //MenuItem illustratorItem; - static final String WINDOW_TITLE = "Processing"; @@ -116,58 +120,7 @@ public class PdeBase extends Frame static public void main(String args[]) { //System.getProperties().list(System.out); - //System.out.println(System.getProperty("java.class.path")); - - // should be static though the mac is acting sketchy - if (System.getProperty("mrj.version") != null) { // running on a mac - //System.out.println(UIManager.getSystemLookAndFeelClassName()); - //System.out.println(System.getProperty("mrj.version")); - //System.out.println(System.getProperty("os.name")); - platform = (System.getProperty("os.name").equals("Mac OS X")) ? - MACOSX : MACOS9; - - } else { - //System.out.println("unknown OS"); - //System.out.println(System.getProperty("os.name")); - String osname = System.getProperty("os.name"); - //System.out.println("osname is " + osname); - if (osname.indexOf("Windows") != -1) { - platform = WINDOWS; - - } else if (osname.equals("Linux")) { // true for the ibm vm - platform = LINUX; - - } else if (osname.equals("Irix")) { - platform = IRIX; - - } else { - platform = WINDOWS; // probably safest - System.out.println("unhandled osname: " + osname); - } - } - - try { - //if (platform == LINUX) { - // linux is by default (motif?) even uglier than metal - // actually, i'm using native menus, so they're ugly and - // motif-looking. ick. need to fix this. - //System.out.println("setting to metal"); - //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - //} else { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - //} - } catch (Exception e) { - e.printStackTrace(); - } - - //try { PdeBase app = new PdeBase(); - // people attempting to use p5 in headless mode are - // already setting themselves up for disappointment - //} catch (HeadlessException e) { - //e.printStackTrace(); - //System.exit(1); - //} } @@ -180,21 +133,72 @@ public class PdeBase extends Frame public PdeBase() { super(WINDOW_TITLE); + + // figure out which operating system + + if (System.getProperty("mrj.version") != null) { // running on a mac + platform = (System.getProperty("os.name").equals("Mac OS X")) ? + MACOSX : MACOS9; + + } else { + String osname = System.getProperty("os.name"); + + if (osname.indexOf("Windows") != -1) { + platform = WINDOWS; + + } else if (osname.equals("Linux")) { // true for the ibm vm + platform = LINUX; + + } else if (osname.equals("Irix")) { + platform = IRIX; + + } else { + platform = WINDOWS; // probably safest + System.out.println("unhandled osname: \"" + osname + "\""); + } + } + + + // set the look and feel before opening the window + + try { + if (platform == LINUX) { + // linux is by default (motif?) even uglier than metal + // actually, i'm using native menus, so they're ugly and + // motif-looking. ick. need to fix this. + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + } else { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + } catch (Exception e) { + e.printStackTrace(); + } + + + // set the window icon + try { icon = Toolkit.getDefaultToolkit().getImage("lib/icon.gif"); this.setIconImage(icon); } catch (Exception e) { } // fail silently, no big whup - windowListener = new WindowAdapter() { - public void windowClosing(WindowEvent e) { - handleQuit(); - } - }; + + // add listener to handle window close box hit event + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + handleQuit(); + } + }); //frame.addWindowListener(windowListener); - this.addWindowListener(windowListener); + //this.addWindowListener(windowListener); + + + // load in preferences (last sketch used, window placement, etc) prefs = new PdePreferences(); + // read in the keywords for the reference final String KEYWORDS = "pde_keywords.properties"; @@ -228,18 +232,19 @@ public class PdeBase extends Frame // build the editor object editor = new PdeEditor(this); -#ifdef SWINGSUCKS - this.setLayout(new BorderLayout()); - this.add("Center", editor); -#else getContentPane().setLayout(new BorderLayout()); getContentPane().add("Center", editor); -#endif + + + // setup menu bar MenuBar menubar = new MenuBar(); Menu menu; MenuItem item; + + // file menu + menu = new Menu("File"); menu.add(new MenuItem("New", new MenuShortcut('N'))); sketchbookMenu = new Menu("Open"); @@ -387,32 +392,19 @@ public class PdeBase extends Frame menu.add(new MenuItem("Show sketch folder")); } - recordingHistory = getBoolean("history.recording", true); + recordingHistory = PdePreferences.getBoolean("history.recording", true); if (recordingHistory) { historyMenu = new Menu("History"); menu.add(historyMenu); - - /* - item = new MenuItem("Clear History"); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (!editor.historyFile.delete()) { - System.err.println("couldn't erase history"); - } - rebuildHistoryMenu(historyMenu, editor.historyFile.getPath()); - } - }); - menu.add(item); - menu.addSeparator(); - */ } - menu.addSeparator(); + //menu.addSeparator(); //menu.addSeparator(); //serialMenu = new Menu("Serial Port"); //menu.add(serialMenu); + /* Menu rendererMenu = new Menu("Renderer"); #ifdef OPENGL // opengl support has started, but remains as yet unfinished @@ -437,6 +429,7 @@ public class PdeBase extends Frame normalItem.setState(false); } }); + */ /* externalEditorItem = new CheckboxMenuItem("Use External Editor"); @@ -602,8 +595,8 @@ public class PdeBase extends Frame //menu.add(newSkechItem); //menu.addSeparator(); - //sketchbookFolder = new File("sketchbook"); - sketchbookFolder = new File(get("sketchbook.path", "sketchbook")); + sketchbookFolder = + new File(PdePreferences.get("sketchbook.path", "sketchbook")); sketchbookPath = sketchbookFolder.getCanonicalPath(); if (!sketchbookFolder.exists()) { System.err.println("sketchbook folder doesn't exist, " + @@ -1057,103 +1050,6 @@ public class PdeBase extends Frame } - // all the information from pde.properties - - static public String get(String attribute) { - return get(attribute, null); - } - - static public String get(String attribute, String defaultValue) { - //String value = (properties != null) ? - //properties.getProperty(attribute) : applet.getParameter(attribute); - String value = properties.getProperty(attribute); - - return (value == null) ? - defaultValue : value; - } - - static public boolean getBoolean(String attribute, boolean defaultValue) { - String value = get(attribute, null); - return (value == null) ? defaultValue : - (new Boolean(value)).booleanValue(); - - /* - supposedly not needed, because anything besides 'true' - (ignoring case) will just be false.. so if malformed -> false - if (value == null) return defaultValue; - - try { - return (new Boolean(value)).booleanValue(); - } catch (NumberFormatException e) { - System.err.println("expecting an integer: " + attribute + " = " + value); - } - return defaultValue; - */ - } - - static public int getInteger(String attribute, int defaultValue) { - String value = get(attribute, null); - if (value == null) return defaultValue; - - try { - return Integer.parseInt(value); - } catch (NumberFormatException e) { - // ignored will just fall through to returning the default - System.err.println("expecting an integer: " + attribute + " = " + value); - } - return defaultValue; - //if (value == null) return defaultValue; - //return (value == null) ? defaultValue : - //Integer.parseInt(value); - } - - static public Color getColor(String name, Color otherwise) { - Color parsed = null; - String s = get(name, null); - if ((s != null) && (s.indexOf("#") == 0)) { - try { - int v = Integer.parseInt(s.substring(1), 16); - parsed = new Color(v); - } catch (Exception e) { - } - } - if (parsed == null) return otherwise; - return parsed; - } - - - static public Font getFont(String which, Font otherwise) { - //System.out.println("getting font '" + which + "'"); - String str = get(which); - if (str == null) return otherwise; // ENABLE LATER - StringTokenizer st = new StringTokenizer(str, ","); - String fontname = st.nextToken(); - String fontstyle = st.nextToken(); - return new Font(fontname, - ((fontstyle.indexOf("bold") != -1) ? Font.BOLD : 0) | - ((fontstyle.indexOf("italic") != -1) ? Font.ITALIC : 0), - Integer.parseInt(st.nextToken())); - } - - - static public SyntaxStyle getStyle(String what, String dflt) { - String str = get("editor.program." + what + ".style", dflt); - - StringTokenizer st = new StringTokenizer(str, ","); - - String s = st.nextToken(); - if (s.indexOf("#") == 0) s = s.substring(1); - Color color = new Color(Integer.parseInt(s, 16)); - - s = st.nextToken(); - boolean bold = (s.indexOf("bold") != -1); - boolean italic = (s.indexOf("italic") != -1); - //System.out.println(str + " " + bold + " " + italic); - - return new SyntaxStyle(color, italic, bold); - } - - // used by PdeEditorButtons, but probably more later static public Image getImage(String name, Component who) { Image image = null; diff --git a/app/PdeEditor.java b/app/PdeEditor.java index 79d436a0b..7ed4d057e 100644 --- a/app/PdeEditor.java +++ b/app/PdeEditor.java @@ -76,7 +76,7 @@ public class PdeEditor extends JPanel { boolean externalEditor; // currently opened program - String userName; // user currently logged in + //String userName; // user currently logged in String sketchName; // name of the file (w/o pde if a sketch) File sketchFile; // the .pde file itself File sketchDir; // if a sketchbook project, the parent dir @@ -131,8 +131,7 @@ public class PdeEditor extends JPanel { // set bgcolor of buttons here, b/c also used for empty component buttons = new PdeEditorButtons(this); - Color buttonBgColor = - PdeBase.getColor("editor.buttons.bgcolor", new Color(0x99, 0x99, 0x99)); + Color buttonBgColor = PdePreferences.getColor("editor.buttons.bgcolor"); buttons.setBackground(buttonBgColor); leftPanel.add("North", buttons); Label dummy = new Label(); @@ -176,7 +175,7 @@ public class PdeEditor extends JPanel { } // the default size on windows is too small and kinda ugly - int dividerSize = PdeBase.getInteger("editor.divider.size", 0); + int dividerSize = PdePreferences.getInteger("editor.divider.size"); if (dividerSize != 0) { splitPane.setDividerSize(dividerSize); } @@ -235,7 +234,7 @@ public class PdeEditor extends JPanel { labelSize.width, labelSize.height); Color presentationBgColor = - PdeBase.getColor("run.present.bgcolor", new Color(102, 102, 102)); + PdePreferences.getColor("run.present.bgcolor"); presentationWindow.setBackground(presentationBgColor); textarea.addFocusListener(new FocusAdapter() { @@ -454,7 +453,7 @@ public class PdeEditor extends JPanel { throws PdeException, Exception { // true if this should extend BApplet instead of BAppletGL - boolean extendsNormal = base.normalItem.getState(); + //boolean extendsNormal = base.normalItem.getState(); externalRuntime = false; externalPaths = null; @@ -489,69 +488,47 @@ public class PdeEditor extends JPanel { //System.out.println("imports is " + imports); PdePreprocessor preprocessor = null; - if (PdeBase.getBoolean("preprocessor.antlr", true)) { - preprocessor = new PdePreprocessor(program, buildPath); - try { - className = - preprocessor.writeJava(className, imports, - extendsNormal, false); - - } catch (antlr.RecognitionException re) { - // this even returns a column - throw new PdeException(re.getMessage(), - re.getLine() - 1, re.getColumn()); - - } catch (antlr.TokenStreamRecognitionException tsre) { - // while this seems to store line and column internally, - // there doesn't seem to be a method to grab it.. - // so instead it's done using a regexp - - //try { - PatternMatcher matcher = new Perl5Matcher(); - PatternCompiler compiler = new Perl5Compiler(); - // line 3:1: unexpected char: 0xA0 - String mess = "^line (\\d+):(\\d+):\\s"; - Pattern pattern = compiler.compile(mess); - - PatternMatcherInput input = - new PatternMatcherInput(tsre.toString()); - if (matcher.contains(input, pattern)) { - MatchResult result = matcher.getMatch(); - //try { - int line = Integer.parseInt(result.group(1).toString()); - int column = Integer.parseInt(result.group(2).toString()); - throw new PdeException(tsre.getMessage(), line-1, column); - - //} catch (NumberFormatException e) { - //} - } else { - //System.out.println("didn't match input"); - throw new PdeException(tsre.toString()); - } - - /* - } catch (MalformedPatternException mpe){ - mpe.printStackTrace(); - - } catch (Exception e) { // not understood - e.printStackTrace(); - throw new PdeException(tsre.toString()); - } - */ - - } catch (PdeException pe) { - throw pe; - - } catch (Exception ex) { - System.err.println("Uncaught exception type:" + ex.getClass()); - ex.printStackTrace(); - throw new PdeException(ex.toString()); - } - } else { // use the old oro processor (yech) - preprocessor = new PdePreprocessorOro(program, buildPath); + preprocessor = new PdePreprocessor(program, buildPath); + try { className = - preprocessor.writeJava(className, imports, - extendsNormal, false); + preprocessor.writeJava(className, imports, false); + + } catch (antlr.RecognitionException re) { + // this even returns a column + throw new PdeException(re.getMessage(), + re.getLine() - 1, re.getColumn()); + + } catch (antlr.TokenStreamRecognitionException tsre) { + // while this seems to store line and column internally, + // there doesn't seem to be a method to grab it.. + // so instead it's done using a regexp + + PatternMatcher matcher = new Perl5Matcher(); + PatternCompiler compiler = new Perl5Compiler(); + // line 3:1: unexpected char: 0xA0 + String mess = "^line (\\d+):(\\d+):\\s"; + Pattern pattern = compiler.compile(mess); + + PatternMatcherInput input = + new PatternMatcherInput(tsre.toString()); + if (matcher.contains(input, pattern)) { + MatchResult result = matcher.getMatch(); + + int line = Integer.parseInt(result.group(1).toString()); + int column = Integer.parseInt(result.group(2).toString()); + throw new PdeException(tsre.getMessage(), line-1, column); + + } else { + throw new PdeException(tsre.toString()); + } + + } catch (PdeException pe) { + throw pe; + + } catch (Exception ex) { + System.err.println("Uncaught exception type:" + ex.getClass()); + ex.printStackTrace(); + throw new PdeException(ex.toString()); } if (PdePreprocessor.programType == PdePreprocessor.ADVANCED) { @@ -954,7 +931,8 @@ public class PdeEditor extends JPanel { // does all the plumbing to create a new project // then calls handleOpen to load it up - File sketchbookDir = new File("sketchbook", userName); //header.user); + //File sketchbookDir = new File("sketchbook", userName); + File sketchbookDir = PdePreferences.get("sketchbook.path"); File sketchDir = null; String sketchName = null; @@ -973,7 +951,6 @@ public class PdeEditor extends JPanel { // mkdir for new project name sketchDir.mkdirs(); new File(sketchDir, "data").mkdirs(); - //new File(sketchDir, "build").mkdirs(); // make empty pde file File sketchFile = new File(sketchDir, sketchName + ".pde"); @@ -1584,7 +1561,7 @@ public class PdeEditor extends JPanel { //doStop(); // clear out projects that are empty - if (PdeBase.getBoolean("sketchbook.auto_clean", true)) { + if (PdePreferences.getBoolean("sketchbook.auto_clean", true)) { String userPath = base.sketchbookPath + File.separator + userName; File userFolder = new File(userPath); @@ -1631,6 +1608,7 @@ public class PdeEditor extends JPanel { } } + PdePreferences.save(); // write sketch.properties try { FileOutputStream output = null; @@ -1680,7 +1658,7 @@ public class PdeEditor extends JPanel { skprops.put("editor.divider.location", String.valueOf(splitPane.getDividerLocation())); - skprops.put("serial.port", PdeBase.get("serial.port", "unspecified")); + //skprops.put("serial.port", PdePreferences.get("serial.port", "unspecified")); skprops.save(output, "auto-generated by pde, please don't touch"); @@ -1809,13 +1787,13 @@ public class PdeEditor extends JPanel { // disable line highlight and turn off the caret when disabling TextAreaPainter painter = textarea.getPainter(); if (external) { - painter.setBackground(PdeBase.getColor("editor.program.bgcolor.external", new Color(204, 204, 204))); + painter.setBackground(PdePreferences.getColor("editor.program.bgcolor.external", new Color(204, 204, 204))); painter.lineHighlight = false; textarea.setCaretVisible(false); } else { - painter.setBackground(PdeBase.getColor("editor.program.bgcolor", Color.white)); - painter.lineHighlight = PdeBase.getBoolean("editor.program.linehighlight.enabled", true); + painter.setBackground(PdePreferences.getColor("editor.program.bgcolor", Color.white)); + painter.lineHighlight = PdePreferences.getBoolean("editor.program.linehighlight.enabled", true); textarea.setCaretVisible(true); } } @@ -2033,7 +2011,7 @@ public class PdeEditor extends JPanel { if (files[i].equals(".") || files[i].equals("..")) continue; File dead = new File(dir, files[i]); if (!dead.isDirectory()) { - if (!PdeBase.getBoolean("editor.save_build_files", false)) { + if (!PdePreferences.getBoolean("editor.save_build_files", false)) { if (!dead.delete()) { // temporarily disabled //System.err.println("couldn't delete " + dead); diff --git a/app/PdeEditorButtons.java b/app/PdeEditorButtons.java index 89dd8eb93..7d002fb81 100644 --- a/app/PdeEditorButtons.java +++ b/app/PdeEditorButtons.java @@ -111,10 +111,10 @@ public class PdeEditorButtons extends JPanel implements MouseInputListener { setLayout(null); status = new Label(); - status.setFont(PdeBase.getFont("editor.buttons.status.font", - new Font("SansSerif", Font.PLAIN, 10))); - status.setForeground(PdeBase.getColor("editor.buttons.status.color", - Color.black)); + status.setFont(PdePreferences.getFont("editor.buttons.status.font", + new Font("SansSerif", Font.PLAIN, 10))); + status.setForeground(PdePreferences.getColor("editor.buttons.status.color", + Color.black)); add(status); status.setBounds(-5, BUTTON_COUNT*BUTTON_HEIGHT, diff --git a/app/PdeEditorConsole.java b/app/PdeEditorConsole.java index b9f2d20ec..c85241efc 100644 --- a/app/PdeEditorConsole.java +++ b/app/PdeEditorConsole.java @@ -59,26 +59,7 @@ public class PdeEditorConsole extends JScrollPane { public PdeEditorConsole(PdeEditor editor) { this.editor = editor; - consoleTextPane = new JTextPane(); /* { - // this does nothing for macosx - public void paintComponent(Graphics g) { - //System.out.println("paiting"); -#ifdef JDK13 - if (PdeBase.platform == PdeBase.MACOSX) { - if (PdeBase.getBoolean("editor.console.antialias", - false) == false) { - Graphics2D g2 = (Graphics2D) g; - //System.out.println("disabling"); - g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_OFF); - } - } -#endif - super.paintComponent(g); - } - };*/ + consoleTextPane = new JTextPane(); consoleTextPane.setEditable(false); consoleDoc = consoleTextPane.getStyledDocument(); @@ -88,14 +69,14 @@ public class PdeEditorConsole extends JScrollPane { consoleDoc.setParagraphAttributes(0, 0, standard, true); // build styles for different types of console output - Color bgColor = PdeBase.getColor("editor.console.bgcolor", - new Color(0x1A, 0x1A, 0x00)); - Color fgColorOut = PdeBase.getColor("editor.console.fgcolor.output", - new Color(0xcc, 0xcc, 0xbb)); - Color fgColorErr = PdeBase.getColor("editor.console.fgcolor.error", - new Color(0xff, 0x30, 0x00)); - Font font = PdeBase.getFont("editor.console.font", - new Font("Monospaced", Font.PLAIN, 11)); + Color bgColor = PdePreferences.getColor("editor.console.bgcolor", + new Color(0x1A, 0x1A, 0x00)); + Color fgColorOut = PdePreferences.getColor("editor.console.fgcolor.output", + new Color(0xcc, 0xcc, 0xbb)); + Color fgColorErr = PdePreferences.getColor("editor.console.fgcolor.error", + new Color(0xff, 0x30, 0x00)); + Font font = PdePreferences.getFont("editor.console.font", + new Font("Monospaced", Font.PLAIN, 11)); stdStyle = new SimpleAttributeSet(); StyleConstants.setForeground(stdStyle, fgColorOut); @@ -122,7 +103,7 @@ public class PdeEditorConsole extends JScrollPane { // and size window accordingly FontMetrics metrics = this.getFontMetrics(font); int height = metrics.getAscent() + metrics.getDescent(); - int lines = PdeBase.getInteger("editor.console.lines", 4); + int lines = PdePreferences.getInteger("editor.console.lines", 4); int sizeFudge = 6; //10; // unclear why this is necessary, but it is setPreferredSize(new Dimension(1024, (height * lines) + sizeFudge)); setMinimumSize(new Dimension(1024, (height * 4) + sizeFudge)); @@ -135,9 +116,9 @@ public class PdeEditorConsole extends JScrollPane { boolean tod = ((PdeBase.platform != PdeBase.MACOSX) && (PdeBase.platform != PdeBase.MACOS9)); - if (PdeBase.getBoolean("editor.console.out.enabled", tod)) { + if (PdePreferences.getBoolean("editor.console.out.enabled", tod)) { String outFileName = - PdeBase.get("editor.console.out.file", "lib/stdout.txt"); + PdePreferences.get("editor.console.out.file", "lib/stdout.txt"); try { stdoutFile = new FileOutputStream(outFileName); } catch (IOException e) { @@ -145,9 +126,9 @@ public class PdeEditorConsole extends JScrollPane { } } - if (PdeBase.getBoolean("editor.console.err.enabled", tod)) { + if (PdePreferences.getBoolean("editor.console.err.enabled", tod)) { String errFileName = - PdeBase.get("editor.console.err.file", "lib/stderr.txt"); + PdePreferences.get("editor.console.err.file", "lib/stderr.txt"); try { stderrFile = new FileOutputStream(errFileName); } catch (IOException e) { @@ -160,7 +141,7 @@ public class PdeEditorConsole extends JScrollPane { consoleErr = new PrintStream(new PdeEditorConsoleStream(this, true, stderrFile)); - if (PdeBase.getBoolean("editor.console.enabled", true)) { + if (PdePreferences.getBoolean("editor.console.enabled", true)) { System.setOut(consoleOut); System.setErr(consoleErr); } diff --git a/app/PdeEditorHeader.java b/app/PdeEditorHeader.java index 5bee1b81e..cd9bbf1cd 100644 --- a/app/PdeEditorHeader.java +++ b/app/PdeEditorHeader.java @@ -67,12 +67,12 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ { this.editor = eddie; // weird name for listener if (primaryColor == null) { - backgroundColor = PdeBase.getColor("editor.header.bgcolor", - new Color(51, 51, 51)); - primaryColor = PdeBase.getColor("editor.header.fgcolor.primary", - new Color(255, 255, 255)); - secondaryColor = PdeBase.getColor("editor.header.fgcolor.secondary", - new Color(153, 153, 153)); + backgroundColor = PdePreferences.getColor("editor.header.bgcolor", + new Color(51, 51, 51)); + primaryColor = PdePreferences.getColor("editor.header.fgcolor.primary", + new Color(255, 255, 255)); + secondaryColor = PdePreferences.getColor("editor.header.fgcolor.secondary", + new Color(153, 153, 153)); } addMouseListener(new MouseAdapter() { @@ -147,8 +147,8 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ { Graphics g = offscreen.getGraphics(); if (font == null) { - font = PdeBase.getFont("editor.header.font", - new Font("SansSerif", Font.PLAIN, 12)); + font = PdePreferences.getFont("editor.header.font", + new Font("SansSerif", Font.PLAIN, 12)); g.setFont(font); metrics = g.getFontMetrics(); fontAscent = metrics.getAscent(); diff --git a/app/PdeEditorStatus.java b/app/PdeEditorStatus.java index 583f23709..76418e117 100644 --- a/app/PdeEditorStatus.java +++ b/app/PdeEditorStatus.java @@ -97,23 +97,23 @@ public class PdeEditorStatus extends Panel if (bgcolor == null) { bgcolor = new Color[4]; - bgcolor[0] = PdeBase.getColor("editor.status.notice.bgcolor", - new Color(102, 102, 102)); - bgcolor[1] = PdeBase.getColor("editor.status.error.bgcolor", - new Color(102, 26, 0)); - bgcolor[2] = PdeBase.getColor("editor.status.prompt.bgcolor", - new Color(204, 153, 0)); - bgcolor[3] = PdeBase.getColor("editor.status.prompt.bgcolor", - new Color(204, 153, 0)); + bgcolor[0] = PdePreferences.getColor("editor.status.notice.bgcolor", + new Color(102, 102, 102)); + bgcolor[1] = PdePreferences.getColor("editor.status.error.bgcolor", + new Color(102, 26, 0)); + bgcolor[2] = PdePreferences.getColor("editor.status.prompt.bgcolor", + new Color(204, 153, 0)); + bgcolor[3] = PdePreferences.getColor("editor.status.prompt.bgcolor", + new Color(204, 153, 0)); fgcolor = new Color[4]; - fgcolor[0] = PdeBase.getColor("editor.status.notice.fgcolor", - new Color(255, 255, 255)); - fgcolor[1] = PdeBase.getColor("editor.status.error.fgcolor", - new Color(255, 255, 255)); - fgcolor[2] = PdeBase.getColor("editor.status.prompt.fgcolor", - new Color(0, 0, 0)); - fgcolor[3] = PdeBase.getColor("editor.status.prompt.fgcolor", - new Color(0, 0, 0)); + fgcolor[0] = PdePreferences.getColor("editor.status.notice.fgcolor", + new Color(255, 255, 255)); + fgcolor[1] = PdePreferences.getColor("editor.status.error.fgcolor", + new Color(255, 255, 255)); + fgcolor[2] = PdePreferences.getColor("editor.status.prompt.fgcolor", + new Color(0, 0, 0)); + fgcolor[3] = PdePreferences.getColor("editor.status.prompt.fgcolor", + new Color(0, 0, 0)); } } @@ -428,7 +428,7 @@ public class PdeEditorStatus extends Panel Graphics g = offscreen.getGraphics(); if (font == null) { - font = PdeBase.getFont("editor.status.font", + font = PdePreferences.getFont("editor.status.font", new Font("SansSerif", Font.PLAIN, 12)); g.setFont(font); metrics = g.getFontMetrics(); diff --git a/app/PdePreferences.java b/app/PdePreferences.java index e3bb2085f..9ea06f0dd 100644 --- a/app/PdePreferences.java +++ b/app/PdePreferences.java @@ -1,7 +1,7 @@ /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* - PdePreferences - controls user preferences + PdePreferences - controls user preferences and environment settings Part of the Processing project - http://Proce55ing.net Copyright (c) 2001-03 @@ -67,51 +67,78 @@ public class PdePreferences extends JComponent { JFrame frame; int wide, high; - JCheckBox newSketchPrompt; - JTextField sketchbookLocation; + JCheckBox newSketchPromptBox; + JTextField sketchbookLocationField; + JCheckbox externalEditorBox; // data model - Properties properties; + static Properties properties; // needs to be accessible everywhere + static Hashtable defaults; + + File preferencesFile; + boolean firstTime; // first time this feller has been run public PdePreferences() { - // load preferences + /* + switch (PdeBase.platform) { + case PdeBase.WINDOWS: + // the larger divider on windows is ugly with the little arrows + // this makes it large enough to see (mouse changes) and use, + // but keeps it from being annoyingly obtrusive + defaults.put("editor.divider.size", "2"); + break; + + case PdeBase.MACOSX: + // the usual 12 point from other platforms is too big on osx + // monospaced on java 1.3 was monaco, but on 1.4 it has changed + // to courier, which actually matches other platforms better. + // (and removes the 12 point being too large issue) + // and monaco is nicer on macosx, so use that explicitly + defaults.put("editor.program.font", "Monaco,plain,10"); + defaults.put("editor.console.font", "Monaco,plain,10"); + break; + } + */ + + + // getting started properties = new Properties(); - try { - //properties.load(new FileInputStream("lib/pde.properties")); - //#URL where = getClass().getResource("PdeBase.class"); - //System.err.println(where); - //System.getProperties().list(System.err); - //System.err.println("userdir = " + System.getProperty("user.dir")); - if (PdeBase.platform == PdeBase.MACOSX) { - //String pkg = "Proce55ing.app/Contents/Resources/Java/"; - //properties.load(new FileInputStream(pkg + "pde.properties")); - //properties.load(new FileInputStream(pkg + "pde.properties_macosx")); - properties.load(new FileInputStream("lib/pde.properties")); - properties.load(new FileInputStream("lib/pde_macosx.properties")); - } else if (PdeBase.platform == PdeBase.MACOS9) { - properties.load(new FileInputStream("lib/pde.properties")); - properties.load(new FileInputStream("lib/pde_macos9.properties")); + // load user preferences file - } else { - // under win95, current dir not set properly - // so using a relative url like "lib/" won't work - properties.load(getClass().getResource("pde.properties").openStream()); - String platformProps = "pde_" + platforms[platform] + ".properties"; - properties.load(getClass().getResource(platformProps).openStream()); + String home = System.getProperty("user.home"); + preferencesFile = new File(home, ".processing"); + + + if (!preferencesFile.exists()) { + // create a new preferences file if none exists + + String platformFilename = + "pde_" + PdeBase.platforms[PdeBase.platform] + ".properties"; + + try { + if ((PdeBase.platform == PdeBase.MACOSX) || + (PdeBase.platform == PdeBase.MACOS9)) { + properties.load(new FileInputStream("lib/pde.properties")); + properties.load(new FileInputStream("lib/" + platformFilename)); + + } else { + // under win95, current dir not set properly + // so using a relative url like "lib/" won't work + properties.load(getClass().getResource("pde.properties").openStream()); + properties.load(getClass().getResource(platformFilename).openStream()); + } + + } catch (Exception e) { + System.err.println("Error reading pde.properties"); + e.printStackTrace(); } - //properties.list(System.out); - - } catch (Exception e) { - System.err.println("Error reading pde.properties"); - e.printStackTrace(); - //System.exit(1); } @@ -137,11 +164,11 @@ public class PdePreferences extends JComponent { // [ ] Prompt for name and folder when creating new sketch - newSketchPrompt = + newSketchPromptBox = new JCheckBox("Prompt for name when creating a new sketch"); - pain.add(newSketchPrompt); - d = newSketchPrompt.getPreferredSize(); - newSketchPrompt.setBounds(left, top, d.width, d.height); + pain.add(newSketchPromptBox); + d = newSketchPromptBox.getPreferredSize(); + newSketchPromptBox.setBounds(left, top, d.width, d.height); right = Math.max(right, left + d.width); top += d.height + BETWEEN; @@ -152,9 +179,9 @@ public class PdePreferences extends JComponent { pain.add(label); d = label.getPreferredSize(); - sketchbookLocation = new JTextField(18); - pain.add(sketchbookLocation); - d2 = sketchbookLocation.getPreferredSize(); + sketchbookLocationField = new JTextField(18); + pain.add(sketchbookLocationField); + d2 = sketchbookLocationField.getPreferredSize(); button = new JButton("Browse"); pain.add(button); @@ -192,7 +219,7 @@ public class PdePreferences extends JComponent { combo.setEnabled(false); } else { - String defaultName = PdeBase.get("serial.port", "unspecified"); + String defaultName = PdePreferences.get("serial.port", "unspecified"); combo.setSelectedItem(defaultName); } @@ -209,6 +236,13 @@ public class PdePreferences extends JComponent { // [ ] Use external editor + externalEditorBox = new JCheckBox("Use external editor"); + pain.add(externalEditorBox); + d = newSketchPromptBox.getPreferredSize(); + newSketchPromptBox.setBounds(left, top, d.width, d.height); + right = Math.max(right, left + d.width); + top += d.height + BETWEEN; + // @@ -247,10 +281,9 @@ public class PdePreferences extends JComponent { frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - handleQuit(); + frame.hide(); } }); - //frame.show(); } @@ -259,11 +292,17 @@ public class PdePreferences extends JComponent { } - // open the last-used sketch, etc + // change settings based on what was chosen in the prefs + public void apply() { + //if (external editor checked) { + editor.setExternalEditor(true); + //} } + // open the last-used sketch, etc + public void init() { // load the last program that was in use @@ -324,7 +363,7 @@ public class PdePreferences extends JComponent { String serialPort = skprops.getProperty("serial.port"); if (serialPort != null) { - PdeBase.properties.put("serial.port", serialPort); + properties.put("serial.port", serialPort); } boolean ee = new Boolean(skprops.getProperty("editor.external", "false")).booleanValue(); @@ -336,7 +375,7 @@ public class PdePreferences extends JComponent { //e.printStackTrace(); // indicator that this is the first time this feller has used p5 - PdeBase.firstTime = true; + firstTime = true; // even if folder for 'default' user doesn't exist, or // sketchbook itself is missing, mkdirs() will make it happy @@ -348,8 +387,8 @@ public class PdePreferences extends JComponent { if (windowX == -1) { //System.out.println("using defaults for window size"); - windowW = PdeBase.getInteger("window.width", 500); - windowH = PdeBase.getInteger("window.height", 500); + windowW = PdePreferences.getInteger("window.width", 500); + windowH = PdePreferences.getInteger("window.height", 500); windowX = (screen.width - windowW) / 2; windowY = (screen.height - windowH) / 2; } @@ -379,6 +418,163 @@ public class PdePreferences extends JComponent { } + public void save() { + try { + FileOutputStream output = null; + + if (PdeBase.platform == PdeBase.MACOSX) { + //String pkg = "Proce55ing.app/Contents/Resources/Java/"; + //output = new FileOutputStream(pkg + "sketch.properties"); + output = new FileOutputStream("lib/sketch.properties"); + + } else if (PdeBase.platform == PdeBase.MACOS9) { + output = new FileOutputStream("lib/sketch.properties"); + + } else { // win95/98/ME doesn't set cwd properly + URL url = getClass().getResource("buttons.gif"); + String urlstr = url.getFile(); + urlstr = urlstr.substring(0, urlstr.lastIndexOf("/") + 1) + + "sketch.properties"; +#ifdef JDK13 + // the ifdef is weird, but it's set for everything but + // macos9, and this will never get hit + output = new FileOutputStream(URLDecoder.decode(urlstr)); +#else + System.err.println("bad error while writing sketch.properties"); + System.err.println("you should never see this message"); +#endif + } + + Properties skprops = new Properties(); + + //Rectangle window = PdeBase.frame.getBounds(); + Rectangle window = base.getBounds(); + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + + skprops.put("window.x", String.valueOf(window.x)); + skprops.put("window.y", String.valueOf(window.y)); + skprops.put("window.w", String.valueOf(window.width)); + skprops.put("window.h", String.valueOf(window.height)); + + skprops.put("screen.w", String.valueOf(screen.width)); + skprops.put("screen.h", String.valueOf(screen.height)); + + skprops.put("sketch.name", sketchName); + skprops.put("sketch.directory", sketchDir.getCanonicalPath()); + skprops.put("user.name", userName); + + skprops.put("editor.external", externalEditor ? "true" : "false"); + skprops.put("editor.divider.location", + String.valueOf(splitPane.getDividerLocation())); + + //skprops.put("serial.port", PdePreferences.get("serial.port", "unspecified")); + + skprops.save(output, "auto-generated by pde, please don't touch"); + + } catch (IOException e) { + System.err.println("doQuit: error saving properties"); + e.printStackTrace(); + } +} + + // all the information from pde.properties + + //static public String get(String attribute) { + //return get(attribute, null); + //} + + static public String get(String attribute /*, String defaultValue */) { + //String value = (properties != null) ? + //properties.getProperty(attribute) : applet.getParameter(attribute); + String value = properties.getProperty(attribute); + + return (value == null) ? + defaultValue : value; + } + + static public boolean getBoolean(String attribute /*, boolean defaultValue*/) { + String value = get(attribute, null); + return (value == null) ? defaultValue : + (new Boolean(value)).booleanValue(); + + /* + supposedly not needed, because anything besides 'true' + (ignoring case) will just be false.. so if malformed -> false + if (value == null) return defaultValue; + + try { + return (new Boolean(value)).booleanValue(); + } catch (NumberFormatException e) { + System.err.println("expecting an integer: " + attribute + " = " + value); + } + return defaultValue; + */ + } + + static public int getInteger(String attribute /*, int defaultValue*/) { + String value = get(attribute, null); + if (value == null) return defaultValue; + + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + // ignored will just fall through to returning the default + System.err.println("expecting an integer: " + attribute + " = " + value); + } + return defaultValue; + //if (value == null) return defaultValue; + //return (value == null) ? defaultValue : + //Integer.parseInt(value); + } + + + static public Color getColor(String name /*, Color otherwise*/) { + Color parsed = null; + String s = get(name, null); + if ((s != null) && (s.indexOf("#") == 0)) { + try { + int v = Integer.parseInt(s.substring(1), 16); + parsed = new Color(v); + } catch (Exception e) { + } + } + if (parsed == null) return otherwise; + return parsed; + } + + + static public Font getFont(String which /*, Font otherwise*/) { + //System.out.println("getting font '" + which + "'"); + String str = get(which); + if (str == null) return otherwise; // ENABLE LATER + StringTokenizer st = new StringTokenizer(str, ","); + String fontname = st.nextToken(); + String fontstyle = st.nextToken(); + return new Font(fontname, + ((fontstyle.indexOf("bold") != -1) ? Font.BOLD : 0) | + ((fontstyle.indexOf("italic") != -1) ? Font.ITALIC : 0), + Integer.parseInt(st.nextToken())); + } + + + static public SyntaxStyle getStyle(String what /*, String dflt*/) { + String str = get("editor.program." + what + ".style", dflt); + + StringTokenizer st = new StringTokenizer(str, ","); + + String s = st.nextToken(); + if (s.indexOf("#") == 0) s = s.substring(1); + Color color = new Color(Integer.parseInt(s, 16)); + + s = st.nextToken(); + boolean bold = (s.indexOf("bold") != -1); + boolean italic = (s.indexOf("italic") != -1); + //System.out.println(str + " " + bold + " " + italic); + + return new SyntaxStyle(color, italic, bold); + } + + /* class SerialMenuListener implements ItemListener { //public SerialMenuListener() { } diff --git a/app/PdePreprocessor.java b/app/PdePreprocessor.java index 0173feb29..3d5d2d596 100644 --- a/app/PdePreprocessor.java +++ b/app/PdePreprocessor.java @@ -81,7 +81,7 @@ public class PdePreprocessor { this.programReader = new StringReader(program); this.buildPath = buildPath; - usingExternal = PdeBase.getBoolean("play.external", false); + usingExternal = PdePreferences.getBoolean("play.external", false); } /** @@ -95,7 +95,7 @@ public class PdePreprocessor { * @return the classname of the exported Java */ public String writeJava(String name, String imports[], - boolean extendsNormal, + /*boolean extendsNormal,*/ boolean exporting) throws java.lang.Exception { // create a lexer with the stream reader, and tell it to handle @@ -159,7 +159,7 @@ public class PdePreprocessor { PrintStream stream = new PrintStream( new FileOutputStream(buildPath + File.separator + name + ".java")); - writeHeader(stream, imports, extendsNormal, exporting, name); + writeHeader(stream, imports, /*extendsNormal,*/ exporting, name); emitter.setOut(stream); emitter.print(rootNode); @@ -170,7 +170,7 @@ public class PdePreprocessor { // if desired, serialize the parse tree to an XML file. can // be viewed usefully with Mozilla or IE - if (PdeBase.getBoolean("compiler.output_parse_tree", false)) { + if (PdePreferences.getBoolean("compiler.output_parse_tree", false)) { stream = new PrintStream(new FileOutputStream("parseTree.xml")); stream.println(""); @@ -196,8 +196,8 @@ public class PdePreprocessor { * @param name Name of the class being created. */ void writeHeader(PrintStream out, String imports[], - boolean extendsNormal, boolean exporting, - String name) { + /*boolean extendsNormal,*/ + boolean exporting, String name) { if (imports != null) { //System.out.println("imports not null"); @@ -220,7 +220,8 @@ public class PdePreprocessor { } } - String extendsWhat = extendsNormal ? "BApplet" : "BAppletGL"; + //String extendsWhat = extendsNormal ? "BApplet" : "BAppletGL"; + String extendsWhat = "BApplet"; out.print("public class " + name + " extends " + extendsWhat + " {"); diff --git a/app/PdePreprocessorOro.java b/app/PdePreprocessorOro.java index 5baae4873..2d8a487ca 100644 --- a/app/PdePreprocessorOro.java +++ b/app/PdePreprocessorOro.java @@ -37,9 +37,10 @@ public class PdePreprocessorOro extends PdePreprocessor { } // writes .java file into buildPath - public String writeJava(String name, boolean extendsNormal, + public String writeJava(String name, /*boolean extendsNormal,*/ boolean exporting) { - String extendsWhat = extendsNormal ? "BApplet" : "BAppletGL"; + //String extendsWhat = extendsNormal ? "BApplet" : "BAppletGL"; + String extendsWhat = "BApplet"; try { /*int*/ programType = BEGINNER; @@ -49,7 +50,7 @@ public class PdePreprocessorOro extends PdePreprocessor { // insert 'f' for all floats // shouldn't substitute f's for: "Univers76.vlw.gz"; - if (PdeBase.getBoolean("compiler.substitute_f", true)) { + if (PdePreferences.getBoolean("compiler.substitute_f", true)) { /* a = 0.2 * 3 (3.) @@ -76,14 +77,14 @@ public class PdePreprocessorOro extends PdePreprocessor { } // allow int(3.75) instead of just (int)3.75 - if (PdeBase.getBoolean("compiler.enhanced_casting", true)) { + if (PdePreferences.getBoolean("compiler.enhanced_casting", true)) { program = substipoot(program, "([^A-Za-z0-9_])byte\\((.*)\\)", "$1(byte)($2)"); program = substipoot(program, "([^A-Za-z0-9_])char\\((.*)\\)", "$1(char)($2)"); program = substipoot(program, "([^A-Za-z0-9_])int\\((.*)\\)", "$1(int)($2)"); program = substipoot(program, "([^A-Za-z0-9_])float\\((.*)\\)", "$1(float)($2)"); } - if (PdeBase.getBoolean("compiler.color_datatype", true)) { + if (PdePreferences.getBoolean("compiler.color_datatype", true)) { // so that regexp works correctly in this strange edge case if (program.indexOf("color") == 0) program = " " + program; // swap 'color' with 'int' when used as a datatype @@ -100,7 +101,7 @@ public class PdePreprocessorOro extends PdePreprocessor { //program = substipoot(program, "([^A-Za-z0-9_])color\\((.*)\\)", "$1(int)($2)"); } - if (PdeBase.getBoolean("compiler.inline_web_colors", true)) { + if (PdePreferences.getBoolean("compiler.inline_web_colors", true)) { // convert "= #cc9988" into "= 0xffcc9988" //program = substipoot(program, "(=\\s*)\\#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])", "$1 0xff$2$3$4"); //program = substipoot(program, "#([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([;\\s])", "0xff$1$2$3$4"); diff --git a/app/PdeRuntime.java b/app/PdeRuntime.java index 0fc4d5fac..9f6b16ba2 100644 --- a/app/PdeRuntime.java +++ b/app/PdeRuntime.java @@ -146,7 +146,7 @@ public class PdeRuntime implements PdeMessageConsumer { applet.leechErr = leechErr; // has to be before init - applet.serialProperties(PdeBase.properties); + applet.serialProperties(PdePreferences.properties); applet.init(); if (applet.exception != null) { if (applet.exception instanceof PortInUseException) { @@ -257,8 +257,8 @@ public class PdeRuntime implements PdeMessageConsumer { Insets insets = window.getInsets(); //System.out.println(insets); - int minW = PdeBase.getInteger("run.window.width.minimum", 120); - int minH = PdeBase.getInteger("run.window.height.minimum", 120); + int minW = PdePreferences.getInteger("run.window.width.minimum", 120); + int minH = PdePreferences.getInteger("run.window.height.minimum", 120); int windowW = Math.max(applet.width, minW) + insets.left + insets.right; int windowH = Math.max(applet.height, minH) + insets.top + insets.bottom; @@ -280,37 +280,8 @@ public class PdeRuntime implements PdeMessageConsumer { window.setBounds(x1, y1, windowW, windowH); //ww, wh); } - /* - int x1 = parentLoc.x - 20; - int y1 = parentLoc.y; - - Insets insets = window.getInsets(); - //System.out.println(insets); - - int mw = PdeBase.getInteger("run.window.width.minimum", 120); - int mh = PdeBase.getInteger("run.window.height.minimum", 120); - int ww = Math.max(applet.width, mw) + insets.left + insets.right; - int wh = Math.max(applet.height, mh) + insets.top + insets.bottom; - - if (x1 - ww > 10) { // if it fits to the left of the window - window.setBounds(x1 - ww, y1, ww, wh); - - } else { // if it fits inside the editor window - x1 = parentLoc.x + PdeEditor.GRID_SIZE * 2; // 66 - y1 = parentLoc.y + PdeEditor.GRID_SIZE * 2; // 66 - - if ((x1 + ww > screen.width - PdeEditor.GRID_SIZE) || - (y1 + wh > screen.height - PdeEditor.GRID_SIZE)) { - // otherwise center on screen - x1 = (screen.width - ww) / 2; - y1 = (screen.height - wh) / 2; - } - window.setBounds(x1, y1, ww, wh); - } - */ - Color windowBgColor = - PdeBase.getColor("run.window.bgcolor", SystemColor.control); + PdePreferences.getColor("run.window.bgcolor", SystemColor.control); //new Color(102, 102, 102)); window.setBackground(windowBgColor); //window.setBackground(SystemColor.windowBorder); diff --git a/build/shared/lib/pde.properties b/build/shared/lib/pde.properties index a3d26f8ae..f2af1b486 100644 --- a/build/shared/lib/pde.properties +++ b/build/shared/lib/pde.properties @@ -7,15 +7,18 @@ # parameters need to be un-commented before they take effect # usually, the default is listed here, just commented out + +# TextAreaDefaults.java + # font size for editor -#editor.program.font=Monospaced,plain,12 +editor.program.font=Monospaced,plain,12 # anti-aliased text, turned off by default -#editor.program.antialias=false +editor.program.antialias=false # foreground and background colors -#editor.program.fgcolor=#000000 -#editor.program.bgcolor=#ffffff +editor.program.fgcolor=#000000 +editor.program.bgcolor=#ffffff # color to be used for background when 'external editor' enabled editor.program.bgcolor.external=#ddddbb @@ -51,7 +54,7 @@ editor.program.caret.color=#333300 # selection color editor.program.selection.color=#ffcc00 -#editor.program.selection.color=#cccc00 +editor.program.selection.color=#cccc00 # highlight for the current line editor.program.linehighlight.enabled=true @@ -62,8 +65,8 @@ editor.program.brackethighlight.enabled=true editor.program.brackethighligh.color=#ffcc00 # little pooties at the end of lines that show where they finish -#editor.program.eolmarkers.enabled=false -#editor.program.eolmarkers.color=#99991A +editor.program.eolmarkers.enabled=false +editor.program.eolmarkers.color=#99991A # area that's not in use by the text (replaced with tildes) editor.program.invalid.enabled=false @@ -79,11 +82,11 @@ editor.header.fgcolor.primary = #ffffff editor.header.fgcolor.secondary = #ccccbb editor.header.font = SansSerif,plain,12 -#editor.console.bgcolor = #1A1A00 -#editor.console.fgcolor.output = #ccccbb -#editor.console.fgcolor.error = #ff3000 -#editor.console.font = Monospaced,plain,11 -#editor.console.lines = 4 +editor.console.bgcolor = #1A1A00 +editor.console.fgcolor.output = #ccccbb +editor.console.fgcolor.error = #ff3000 +editor.console.font = Monospaced,plain,11 +editor.console.lines = 4 editor.status.notice.fgcolor = #333322 editor.status.notice.bgcolor = #bbbbaa @@ -93,18 +96,18 @@ editor.status.prompt.fgcolor = #ffffee editor.status.prompt.bgcolor = #CC9900 editor.status.font = SansSerif,plain,12 -#editor.expand_tabs=true -#editor.tab_size=2 -#editor.auto_indent=true -#editor.balance_parens=false +# convert tabs to spaces? how many spaces? +editor.tabs.expand = true +editor.tabs.size = 2 + +# automatically indent each line +editor.indent = true # how many lines to scroll for each tick on the wheel mouse -#editor.wheelmouse.multiplier=3 - +editor.wheelmouse.multiplier = 3 # background color for full-screen presentation mode -#run.present.bgcolor=#666666 - +run.present.bgcolor = #666666 # these are the defaults for the serial port # un-comment them and set them to different values if you'd