mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 10:30:44 +01:00
farked up merge with header
This commit is contained in:
10
app/src/processing/app/Base.java
Normal file → Executable file
10
app/src/processing/app/Base.java
Normal file → Executable file
@@ -44,7 +44,7 @@ import processing.core.*;
|
||||
* files and images, etc) that comes from that.
|
||||
*/
|
||||
public class Base {
|
||||
// Added accessors for 0218 because the UpdateCheck class was not properly
|
||||
// Added accessors for 0218 because the UpdateCheck class was not properly
|
||||
// updating the values, because javac was inlining the static final values.
|
||||
static private final int REVISION = 218;
|
||||
/** This might be replaced by main() if there's a lib/version.txt file. */
|
||||
@@ -53,8 +53,8 @@ public class Base {
|
||||
// static private boolean RELEASE = false;
|
||||
|
||||
/** True if heavy debugging error/log messages are enabled */
|
||||
static public boolean DEBUG = false;
|
||||
// static public boolean DEBUG = true;
|
||||
// static public boolean DEBUG = false;
|
||||
static public boolean DEBUG = true;
|
||||
|
||||
static HashMap<Integer, String> platformNames =
|
||||
new HashMap<Integer, String>();
|
||||
@@ -1556,7 +1556,7 @@ public class Base {
|
||||
static public int getRevision() {
|
||||
return REVISION;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the version name, something like 1.5 or 2.0b8 or 0213 if it's not
|
||||
@@ -1566,7 +1566,7 @@ public class Base {
|
||||
return VERSION_NAME;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//...................................................................
|
||||
|
||||
|
||||
|
||||
32
app/src/processing/app/EditorHeader.java
Normal file → Executable file
32
app/src/processing/app/EditorHeader.java
Normal file → Executable file
@@ -28,7 +28,6 @@ import java.awt.event.*;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -50,7 +49,7 @@ public class EditorHeader extends JComponent {
|
||||
static final int TAB_HEIGHT = 27;
|
||||
// amount of margin on the left/right for the text on the tab
|
||||
static final int TEXT_MARGIN = 5;
|
||||
// width of the tab when no text visible
|
||||
// width of the tab when no text visible
|
||||
// (total tab width will be this plus TEXT_MARGIN*2)
|
||||
static final int NO_TEXT_WIDTH = 10;
|
||||
|
||||
@@ -88,7 +87,7 @@ public class EditorHeader extends JComponent {
|
||||
static final int PIECE_WIDTH = 4;
|
||||
static final int PIECE_HEIGHT = 33;
|
||||
Image[][] pieces;
|
||||
|
||||
|
||||
static final int ARROW_WIDTH = 14;
|
||||
static final int ARROW_HEIGHT = 14;
|
||||
static Image tabArrow;
|
||||
@@ -159,13 +158,13 @@ public class EditorHeader extends JComponent {
|
||||
// protected String tabFile(int status, int where) {
|
||||
// return "theme/tab-" + STATUS[status] + "-" + WHERE[where];
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
public void updateMode() {
|
||||
Mode mode = editor.getMode();
|
||||
// int res = Toolkit.isRetina() ? 2 : 1;
|
||||
// String suffix = "-2x.png"; // wishful thinking
|
||||
// // Some modes may not have a 2x version. If a mode doesn't have a 1x
|
||||
// // Some modes may not have a 2x version. If a mode doesn't have a 1x
|
||||
// // version, this will cause an error... they should always have 1x.
|
||||
// if (res == 2) {
|
||||
// if (!mode.getContentFile(tabFile(0, 0) + suffix).exists()) {
|
||||
@@ -178,7 +177,7 @@ public class EditorHeader extends JComponent {
|
||||
// suffix = ".gif";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// pieces = new Image[STATUS.length][WHERE.length];
|
||||
// for (int status = 0; status < STATUS.length; status++) {
|
||||
// for (int where = 0; where < WHERE.length; where++) {
|
||||
@@ -186,7 +185,7 @@ public class EditorHeader extends JComponent {
|
||||
// pieces[status][where] = mode.loadImage(tabFile(status, where) + suffix);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (tabArrow == null) {
|
||||
String suffix = Toolkit.highResDisplay() ? "-2x.png" : ".png";
|
||||
tabArrow = Toolkit.getLibImage("tab-arrow" + suffix);
|
||||
@@ -196,7 +195,7 @@ public class EditorHeader extends JComponent {
|
||||
textColor[SELECTED] = mode.getColor("header.text.selected.color");
|
||||
textColor[UNSELECTED] = mode.getColor("header.text.unselected.color");
|
||||
font = mode.getFont("header.text.font");
|
||||
|
||||
|
||||
tabColor[SELECTED] = mode.getColor("header.tab.selected.color");
|
||||
tabColor[UNSELECTED] = mode.getColor("header.tab.unselected.color");
|
||||
}
|
||||
@@ -258,12 +257,12 @@ public class EditorHeader extends JComponent {
|
||||
// set the background for the offscreen
|
||||
g.setColor(backgroundColor);
|
||||
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,
|
||||
// g.drawImage(toolbar.backgroundImage,
|
||||
// 0, -toolbar.getHeight(),
|
||||
// EditorToolbar.BACKGROUND_WIDTH,
|
||||
// EditorToolbar.BACKGROUND_HEIGHT, null);
|
||||
// }
|
||||
editor.getMode().drawBackground(g, EditorToolbar.BUTTON_HEIGHT);
|
||||
@@ -284,7 +283,7 @@ public class EditorHeader extends JComponent {
|
||||
// menuRight = sizeW - 16;
|
||||
// menuLeft = menuRight - pieces[0][MENU].getWidth(this);
|
||||
// menuLeft = menuRight - 50; // FIXME!!
|
||||
int leftover =
|
||||
int leftover =
|
||||
ARROW_GAP_WIDTH + ARROW_WIDTH + MARGIN_WIDTH; // + SCROLLBAR_WIDTH;
|
||||
int tabMax = getWidth() - leftover;
|
||||
|
||||
@@ -336,7 +335,7 @@ public class EditorHeader extends JComponent {
|
||||
menuLeft = tabs[tabs.length - 1].right + ARROW_GAP_WIDTH;
|
||||
menuRight = menuLeft + ARROW_WIDTH;
|
||||
int arrowY = (getHeight() - TAB_HEIGHT) + (TAB_HEIGHT - ARROW_HEIGHT)/2;
|
||||
g.drawImage(tabArrow, menuLeft, arrowY,
|
||||
g.drawImage(tabArrow, menuLeft, arrowY,
|
||||
ARROW_WIDTH, ARROW_HEIGHT, null);
|
||||
// g.drawImage(pieces[popup.isVisible() ? SELECTED : UNSELECTED][MENU],
|
||||
// menuLeft, 0, null);
|
||||
@@ -352,7 +351,7 @@ public class EditorHeader extends JComponent {
|
||||
final int bottom = getHeight();
|
||||
final int top = bottom - TAB_HEIGHT;
|
||||
GeneralPath path = null;
|
||||
|
||||
|
||||
for (int i = 0; i < sketch.getCodeCount(); i++) {
|
||||
SketchCode code = sketch.getCode(i);
|
||||
Tab tab = tabs[i];
|
||||
@@ -411,6 +410,7 @@ public class EditorHeader extends JComponent {
|
||||
//g.drawString(sketch.code[i].name, textLeft, baseline);
|
||||
g.drawString(tab.text, textLeft, baseline);
|
||||
g.drawLine(tab.left, baseline-fontAscent, tab.right, baseline-fontAscent);
|
||||
g.drawLine(tab.left, baseline, tab.right, baseline);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
app/src/processing/app/Toolkit.java
Normal file → Executable file
2
app/src/processing/app/Toolkit.java
Normal file → Executable file
@@ -291,6 +291,7 @@ public class Toolkit {
|
||||
monoFont = createFont("SourceCodePro-Regular.ttf", size);
|
||||
monoBoldFont = createFont("SourceCodePro-Semibold.ttf", size);
|
||||
} catch (Exception e) {
|
||||
Base.log("Could not load mono font", e);
|
||||
monoFont = new Font("Monospaced", Font.PLAIN, size);
|
||||
monoBoldFont = new Font("Monospaced", Font.BOLD, size);
|
||||
}
|
||||
@@ -322,6 +323,7 @@ public class Toolkit {
|
||||
sansFont = createFont("SourceSansPro-Regular.ttf", size);
|
||||
sansBoldFont = createFont("SourceSansPro-Semibold.ttf", size);
|
||||
} catch (Exception e) {
|
||||
Base.log("Could not load sans font", e);
|
||||
sansFont = new Font("Monospaced", Font.PLAIN, size);
|
||||
sansBoldFont = new Font("Monospaced", Font.BOLD, size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user