mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
skinnable ui dreck
This commit is contained in:
+8
-7
@@ -307,13 +307,14 @@ public class PdeApplet extends Applet
|
||||
return !isApplet();
|
||||
}
|
||||
|
||||
static public Font getFont(String which) {
|
||||
if (which.equals("editor")) {
|
||||
// 'Monospaced' and 'courier' also caused problems.. ;-/
|
||||
//return new Font("monospaced", Font.PLAIN, 12);
|
||||
return new Font("Monospaced", Font.PLAIN, 12);
|
||||
}
|
||||
return null;
|
||||
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, ",");
|
||||
return new Font(st.nextToken(),
|
||||
st.nextToken().equals("bold") ? Font.BOLD : Font.PLAIN,
|
||||
Integer.parseInt(st.nextToken()));
|
||||
}
|
||||
#endif // PLAYER
|
||||
|
||||
|
||||
+17
-8
@@ -63,7 +63,6 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
|
||||
|
||||
Label dummy = new Label();
|
||||
dummy.setBackground(buttonBgColor);
|
||||
//dummy.setBackground(new Color(0, 100, 0));
|
||||
leftPanel.add("Center", dummy);
|
||||
|
||||
add("West", leftPanel);
|
||||
@@ -113,9 +112,14 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
|
||||
*/
|
||||
|
||||
if (program == null) program = DEFAULT_PROGRAM;
|
||||
textarea = new TextArea(program, 20, 60,
|
||||
TextArea.SCROLLBARS_VERTICAL_ONLY);
|
||||
textarea.setFont(PdeApplet.getFont("editor"));
|
||||
textarea =
|
||||
new TextArea(program,
|
||||
PdeApplet.getInteger("editor.program.rows", 20),
|
||||
PdeApplet.getInteger("editor.program.columns", 60),
|
||||
TextArea.SCROLLBARS_VERTICAL_ONLY);
|
||||
textarea.setFont(PdeApplet.getFont("editor.program.font",
|
||||
new Font("Monospaced",
|
||||
Font.PLAIN, 12)));
|
||||
//right.add("Center", textarea);
|
||||
rightPanel.add("Center", textarea);
|
||||
|
||||
@@ -131,14 +135,19 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
|
||||
statusPanel.add("North", errorLabel);
|
||||
*/
|
||||
status = new PdeEditorStatus(this);
|
||||
statusPanel.add("North", status);
|
||||
statusPanel.add("North", status);
|
||||
|
||||
PdeEditorLabel stdoutLabel = new PdeEditorLabel(2);
|
||||
Color stdoutBgColor = new Color(26, 26, 26);
|
||||
Color stdoutFgColor = new Color(153, 153, 153);
|
||||
Color stdoutBgColor =
|
||||
PdeApplet.getColor("editor.console.bgcolor", new Color(26, 26, 26));
|
||||
Color stdoutFgColor =
|
||||
PdeApplet.getColor("editor.console.fgcolor", new Color(153, 153, 153));
|
||||
stdoutLabel.setBackground(stdoutBgColor);
|
||||
stdoutLabel.setForeground(stdoutFgColor);
|
||||
stdoutLabel.setFont(new Font("monospaced", Font.PLAIN, 11));
|
||||
Font stdoutFont =
|
||||
PdeApplet.getFont("editor.console.font",
|
||||
new Font("monospaced", Font.PLAIN, 11));
|
||||
stdoutLabel.setFont(stdoutFont);
|
||||
//stdoutLabel.setText("Test the print");
|
||||
//stdoutLabel.setInsets(new Insets(4, 4, 4, 4));
|
||||
statusPanel.add("South", stdoutLabel);
|
||||
|
||||
@@ -83,7 +83,10 @@ public class PdeEditorButtons extends Panel {
|
||||
|
||||
setLayout(null);
|
||||
status = new Label();
|
||||
status.setFont(new Font("SansSerif", Font.PLAIN, 10));
|
||||
status.setFont(PdeApplet.getFont("editor.buttons.status.font",
|
||||
new Font("SansSerif", Font.PLAIN, 10)));
|
||||
status.setForeground(PdeApplet.getColor("editor.buttons.status.color",
|
||||
Color.black));
|
||||
//status.setForeground(Color.black);
|
||||
//status.setBackground(Color.yellow);
|
||||
add(status);
|
||||
|
||||
@@ -16,9 +16,13 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
static final String PROJECT_TITLER = "sketch";
|
||||
static final String USER_TITLER = "user";
|
||||
|
||||
static final Color primaryColor = Color.white;
|
||||
static final Color secondaryColor = new Color(153, 153, 153);
|
||||
static final Color backgroundColor = new Color(51, 51, 51);
|
||||
//static final Color primaryColor = Color.white;
|
||||
//static final Color secondaryColor = new Color(153, 153, 153);
|
||||
//static final Color backgroundColor = new Color(51, 51, 51);
|
||||
|
||||
static Color primaryColor; // = Color.white;
|
||||
static Color secondaryColor; // = new Color(153, 153, 153);
|
||||
static Color backgroundColor; // = new Color(51, 51, 51);
|
||||
|
||||
PdeEditor editor;
|
||||
|
||||
@@ -45,6 +49,15 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
this.editor = editor;
|
||||
this.project = project;
|
||||
this.user = user;
|
||||
|
||||
if (primaryColor == null) {
|
||||
backgroundColor = PdeApplet.getColor("editor.header.bgcolor",
|
||||
new Color(51, 51, 51));
|
||||
primaryColor = PdeApplet.getColor("editor.header.fgcolor1",
|
||||
new Color(255, 255, 255));
|
||||
secondaryColor = PdeApplet.getColor("editor.header.fgcolor2",
|
||||
new Color(153, 153, 153));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +110,9 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
|
||||
Graphics g = offscreen.getGraphics();
|
||||
if (font == null) {
|
||||
font = new Font("SansSerif", Font.PLAIN, 12);
|
||||
//font = new Font("SansSerif", Font.PLAIN, 12);
|
||||
font = PdeApplet.getFont("editor.header.font",
|
||||
new Font("SansSerif", Font.PLAIN, 12));
|
||||
g.setFont(font);
|
||||
metrics = g.getFontMetrics();
|
||||
fontAscent = metrics.getAscent();
|
||||
|
||||
+22
-12
@@ -3,18 +3,9 @@ import java.awt.event.*;
|
||||
|
||||
|
||||
public class PdeEditorStatus extends Panel implements ActionListener {
|
||||
static Color bgColor[];
|
||||
static Color fgColor[];
|
||||
|
||||
static final Color bgColor[] = {
|
||||
new Color(102, 102, 102),
|
||||
new Color(102, 26, 0),
|
||||
new Color(204, 153, 0)
|
||||
};
|
||||
|
||||
static final Color fgColor[] = {
|
||||
new Color(255, 255, 255),
|
||||
new Color(255, 255, 255),
|
||||
new Color(0, 0, 0)
|
||||
};
|
||||
|
||||
static final int NOTICE = 0;
|
||||
static final int ERROR = 1;
|
||||
@@ -47,6 +38,23 @@ public class PdeEditorStatus extends Panel implements ActionListener {
|
||||
public PdeEditorStatus(PdeEditor editor) {
|
||||
this.editor = editor;
|
||||
empty();
|
||||
|
||||
if (bgColor == null) {
|
||||
bgColor = new Color[3];
|
||||
bgColor[0] = PdeApplet.getColor("editor.status.notice.bgcolor",
|
||||
new Color(102, 102, 102));
|
||||
bgColor[1] = PdeApplet.getColor("editor.status.error.bgcolor",
|
||||
new Color(102, 26, 0));
|
||||
bgColor[2] = PdeApplet.getColor("editor.status.prompt.bgcolor",
|
||||
new Color(204, 153, 0));
|
||||
fgColor = new Color[3];
|
||||
fgColor[0] = PdeApplet.getColor("editor.status.notice.fgcolor",
|
||||
new Color(255, 255, 255));
|
||||
fgColor[1] = PdeApplet.getColor("editor.status.error.fgcolor",
|
||||
new Color(255, 255, 255));
|
||||
fgColor[2] = PdeApplet.getColor("editor.status.prompt.fgcolor",
|
||||
new Color(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +153,9 @@ public class PdeEditorStatus extends Panel implements ActionListener {
|
||||
|
||||
Graphics g = offscreen.getGraphics();
|
||||
if (font == null) {
|
||||
font = new Font("SansSerif", Font.PLAIN, 10);
|
||||
font = PdeApplet.getFont("editor.status.font",
|
||||
new Font("SansSerif", Font.PLAIN, 10));
|
||||
//font = new Font("SansSerif", Font.PLAIN, 10);
|
||||
g.setFont(font);
|
||||
metrics = g.getFontMetrics();
|
||||
fontAscent = metrics.getAscent();
|
||||
|
||||
Reference in New Issue
Block a user