mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
added option to remove the background image at the top of the window per Casey's request
This commit is contained in:
@@ -55,7 +55,10 @@ public class EditorHeader extends JComponent {
|
||||
// (total tab width will be this plus TEXT_MARGIN*2)
|
||||
static final int NO_TEXT_WIDTH = 10;
|
||||
|
||||
Color backgroundColor;
|
||||
Color bgColor;
|
||||
boolean hiding;
|
||||
Color hideColor;
|
||||
|
||||
Color textColor[] = new Color[2];
|
||||
Color tabColor[] = new Color[2];
|
||||
Color modifiedColor;
|
||||
@@ -194,7 +197,11 @@ public class EditorHeader extends JComponent {
|
||||
tabArrow = Toolkit.getLibImage("tab-arrow" + suffix);
|
||||
}
|
||||
|
||||
backgroundColor = mode.getColor("header.bgcolor");
|
||||
bgColor = mode.getColor("header.bgcolor");
|
||||
|
||||
hiding = Preferences.getBoolean("buttons.hide.image");
|
||||
hideColor = mode.getColor("buttons.hide.color");
|
||||
|
||||
textColor[SELECTED] = mode.getColor("header.text.selected.color");
|
||||
textColor[UNSELECTED] = mode.getColor("header.text.unselected.color");
|
||||
font = mode.getFont("header.text.font");
|
||||
@@ -259,24 +266,13 @@ public class EditorHeader extends JComponent {
|
||||
}
|
||||
|
||||
// set the background for the offscreen
|
||||
g.setColor(backgroundColor);
|
||||
g.setColor(hiding ? hideColor : bgColor);
|
||||
g.fillRect(0, 0, imageW, imageH);
|
||||
|
||||
// EditorToolbar toolbar = editor.toolbar;
|
||||
// if (toolbar != null && toolbar.backgroundImage != null) {
|
||||
// g.drawImage(toolbar.backgroundImage,
|
||||
// 0, -toolbar.getHeight(),
|
||||
// EditorToolbar.BACKGROUND_WIDTH,
|
||||
// EditorToolbar.BACKGROUND_HEIGHT, null);
|
||||
// }
|
||||
//editor.getMode().drawBackground(g, EditorToolbar.BUTTON_HEIGHT);
|
||||
editor.getMode().drawBackground(g, Preferences.GRID_SIZE);
|
||||
if (!hiding) {
|
||||
editor.getMode().drawBackground(g, Preferences.GRID_SIZE);
|
||||
}
|
||||
|
||||
// int codeCount = sketch.getCodeCount();
|
||||
// if ((tabLeft == null) || (tabLeft.length < codeCount)) {
|
||||
// tabLeft = new int[codeCount];
|
||||
// tabRight = new int[codeCount];
|
||||
// }
|
||||
if (tabs.length != sketch.getCodeCount()) {
|
||||
tabs = new Tab[sketch.getCodeCount()];
|
||||
for (int i = 0; i < tabs.length; i++) {
|
||||
@@ -285,9 +281,6 @@ public class EditorHeader extends JComponent {
|
||||
visitOrder = new Tab[sketch.getCodeCount() - 1];
|
||||
}
|
||||
|
||||
// menuRight = sizeW - 16;
|
||||
// menuLeft = menuRight - pieces[0][MENU].getWidth(this);
|
||||
// menuLeft = menuRight - 50; // FIXME!!
|
||||
int leftover =
|
||||
ARROW_GAP_WIDTH + ARROW_WIDTH + MARGIN_WIDTH; // + SCROLLBAR_WIDTH;
|
||||
int tabMax = getWidth() - leftover;
|
||||
|
||||
@@ -56,7 +56,9 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList
|
||||
Image offscreen;
|
||||
int width, height;
|
||||
|
||||
Color bgcolor;
|
||||
Color bgColor;
|
||||
boolean hiding;
|
||||
Color hideColor;
|
||||
|
||||
protected Button rollover;
|
||||
|
||||
@@ -92,13 +94,16 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList
|
||||
rollover = null;
|
||||
|
||||
mode = editor.getMode();
|
||||
bgcolor = mode.getColor("buttons.bgcolor");
|
||||
bgColor = mode.getColor("buttons.bgcolor");
|
||||
statusFont = mode.getFont("buttons.status.font");
|
||||
statusColor = mode.getColor("buttons.status.color");
|
||||
// modeTitle = mode.getTitle().toUpperCase();
|
||||
modeTitle = mode.getTitle();
|
||||
modeTextFont = mode.getFont("mode.button.font");
|
||||
modeButtonColor = mode.getColor("mode.button.color");
|
||||
|
||||
hiding = Preferences.getBoolean("buttons.hide.image");
|
||||
hideColor = mode.getColor("buttons.hide.color");
|
||||
|
||||
if (modeArrow == null) {
|
||||
String suffix = Toolkit.highResDisplay() ? "-2x.png" : ".png";
|
||||
@@ -212,12 +217,14 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
}
|
||||
|
||||
g.setColor(bgcolor); //getBackground());
|
||||
g.setColor(hiding ? hideColor : bgColor);
|
||||
g.fillRect(0, 0, width, height);
|
||||
// if (backgroundImage != null) {
|
||||
// g.drawImage(backgroundImage, 0, 0, BACKGROUND_WIDTH, BACKGROUND_HEIGHT, null);
|
||||
// }
|
||||
mode.drawBackground(g, 0);
|
||||
if (!hiding) {
|
||||
mode.drawBackground(g, 0);
|
||||
}
|
||||
|
||||
// for (int i = 0; i < buttonCount; i++) {
|
||||
// g.drawImage(stateImage[i], x1[i], y1, null);
|
||||
|
||||
@@ -109,9 +109,8 @@ public class Preferences {
|
||||
|
||||
JTextField sketchbookLocationField;
|
||||
JCheckBox editorAntialiasBox;
|
||||
// JCheckBox exportSeparateBox;
|
||||
JCheckBox deletePreviousBox;
|
||||
// JCheckBox externalEditorBox;
|
||||
JCheckBox whinyBox;
|
||||
JCheckBox memoryOverrideBox;
|
||||
JTextField memoryField;
|
||||
JCheckBox checkUpdatesBox;
|
||||
@@ -390,6 +389,16 @@ public class Preferences {
|
||||
// right = Math.max(right, left + d.width);
|
||||
// top += d.height + GUI_BETWEEN;
|
||||
|
||||
|
||||
// [ ] Use external editor
|
||||
|
||||
whinyBox = new JCheckBox("Hide tab/toolbar background image (requires restart)");
|
||||
pain.add(whinyBox);
|
||||
d = whinyBox.getPreferredSize();
|
||||
whinyBox.setBounds(left, top, d.width + 10, d.height);
|
||||
right = Math.max(right, left + d.width);
|
||||
top += d.height + GUI_BETWEEN;
|
||||
|
||||
|
||||
// [ ] Check for updates on startup
|
||||
|
||||
@@ -602,15 +611,15 @@ public class Preferences {
|
||||
protected void applyFrame() {
|
||||
setBoolean("editor.antialias", editorAntialiasBox.isSelected()); //$NON-NLS-1$
|
||||
|
||||
// setBoolean("export.applet.separate_jar_files",
|
||||
// exportSeparateBox.isSelected());
|
||||
setBoolean("export.delete_target_folder", //$NON-NLS-1$
|
||||
deletePreviousBox.isSelected());
|
||||
|
||||
// setBoolean("sketchbook.closing_last_window_quits",
|
||||
// closingLastQuitsBox.isSelected());
|
||||
//setBoolean("sketchbook.prompt", sketchPromptBox.isSelected());
|
||||
//setBoolean("sketchbook.auto_clean", sketchCleanBox.isSelected());
|
||||
boolean wine = whinyBox.isSelected();
|
||||
setBoolean("header.hide.image", wine); //$NON-NLS-1$
|
||||
setBoolean("buttons.hide.image", wine); //$NON-NLS-1$
|
||||
// Could iterate through editors here and repaint them all, but probably
|
||||
// requires a doLayout() call, and that may have different effects on
|
||||
// each platform, and nobody wants to debug/support that.
|
||||
|
||||
// if the sketchbook path has changed, rebuild the menus
|
||||
String oldPath = get("sketchbook.path"); //$NON-NLS-1$
|
||||
@@ -721,6 +730,9 @@ public class Preferences {
|
||||
checkUpdatesBox.
|
||||
setSelected(getBoolean("update.check")); //$NON-NLS-1$
|
||||
|
||||
whinyBox.setSelected(getBoolean("header.hide.image") || //$NON-NLS-1$
|
||||
getBoolean("buttons.hide.image")); //$NON-NLS-1$
|
||||
|
||||
updateDisplayList();
|
||||
int displayNum = getInteger("run.display"); //$NON-NLS-1$
|
||||
// System.out.println("display is " + displayNum + ", d count is " + displayCount);
|
||||
|
||||
Reference in New Issue
Block a user