mirror of
https://github.com/processing/processing4.git
synced 2026-02-07 23:59:21 +01:00
working on integration of new text editor with coloring
This commit is contained in:
@@ -781,9 +781,32 @@ public class PdeBase implements ActionListener {
|
||||
Integer.parseInt(st.nextToken()));
|
||||
}
|
||||
|
||||
//static public boolean isMacintosh() {
|
||||
//return System.getProperty("os.name").toLowerCase().indexOf("mac") != -1;
|
||||
//}
|
||||
static public SimpleAttributeSet getStyle(String what,
|
||||
SimpleAttributeSet otherwise) {
|
||||
String str = get("editor.program." + which + ".style");
|
||||
if (str == null) return otherwise; // ENABLE LATER
|
||||
StringTokenizer st = new StringTokenizer(str, ",");
|
||||
|
||||
SimpleAttributeSet style = new SimpleAttributeSet();
|
||||
|
||||
StyleConstants.setFontFamily(style, st.nextToken());
|
||||
|
||||
String s = st.nextToken();
|
||||
StyleConstants.setBold(style, s.indexOf("bold") != -1);
|
||||
StyleConstants.setItalic(style, s.indexOf("italic") != -1);
|
||||
|
||||
StyleConstants.setSize(style, Integer.parseInt(st.nextToken()));
|
||||
|
||||
s = st.nextToken();
|
||||
if (s.indexOf("#") == 0) s = s.substring(1);
|
||||
StyleConstants.setForeground(style, new Color(Integer.parseInt(s, 16)));
|
||||
|
||||
s = st.nextToken();
|
||||
if (s.indexOf("#") == 0) s = s.substring(1);
|
||||
StyleConstants.setBackground(style, new Color(Integer.parseInt(s, 16)));
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
// used by PdeEditorButtons, but probably more later
|
||||
|
||||
Reference in New Issue
Block a user