added option to remove the background image at the top of the window per Casey's request

This commit is contained in:
Ben Fry
2013-06-20 21:14:27 -04:00
parent 8383086713
commit 3ec691e883
7 changed files with 62 additions and 40 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -157,6 +157,11 @@ editor.divider.size = 0
# but keeps it from being annoyingly obtrusive
editor.divider.size.windows = 2
# Hide the background image. Gross because this is a pref that
# really lives over in theme.txt but it's split here.
buttons.hide.image = false
toolbar.hide.image = false
# font choice and size for the console
#console.font = Monospaced,plain,11
#console.font.macosx = Monaco,plain,10

View File

@@ -13,6 +13,8 @@ status.font = processing.sans,plain,13
# TABS
# Settings for the tab area at the top.
header.bgcolor = #000000
#header.hide.image = false # in preferences.txt
header.hide.color = #0E1B25
header.text.selected.color = #000000
header.text.unselected.color = #ffffff
header.text.font = processing.sans,plain,14
@@ -26,8 +28,10 @@ console.output.color = #cccccc
console.error.color = #ff3000
# TOOLBAR BUTTONS
#buttons.bgcolor = #4a545e
buttons.bgcolor = #000000
#buttons.hide.image = false # in preferences.txt
buttons.hide.color = #0E1B25
buttons.bgimage = true
# TOOLBAR BUTTON TEXT
buttons.status.font = processing.sans,plain,13

View File

@@ -27,6 +27,8 @@ two contributed from Josh Giesbrecht. Thanks Josh!
+ Add error message for that reports what line was bad while parsing a table.
(Otherwise confusing ArrayIndexOutOfBoundsException while parsing bad CSV.)
+ Added option to remove the background image at the top of the window.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

View File

@@ -8,13 +8,7 @@ X fixes from Josh Giesbrecht
X line ending problem with args.txt for Windows when exporting from others
X (exporting from OS X to Windows)
X https://github.com/processing/processing/issues/1890
_ half-installed mode causes a lot of trouble
_ https://github.com/processing/processing/issues/1875
_ mode install requires restart *and* still doesn't show as installed
_ even though it gets added to the modes menu properly after the restart
_ https://github.com/processing/processing/issues/1782
X add option to remove the background image at the top of the window
high
@@ -35,6 +29,11 @@ _ figure out Android build w/o javac so we can remove tools.jar and javac
_ also to the p5 repo with just a JRE
_ remove initRequirements from Base (no longer need JDI)
_ move this into Android mode?
_ half-installed mode causes a lot of trouble
_ https://github.com/processing/processing/issues/1875
_ mode install requires restart *and* still doesn't show as installed
_ even though it gets added to the modes menu properly after the restart
_ https://github.com/processing/processing/issues/1782
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .