Got the console working again.

This commit is contained in:
Sandy Noble 2016-01-02 22:00:12 +00:00
parent 1179fd7471
commit 74636289e5
2 changed files with 39 additions and 20 deletions

View File

@ -183,6 +183,18 @@ void updateNumberboxValues()
initialiseNumberboxValues(getAllControls());
}
void initConsoleWindow() {
consoleArea = cp5.addTextarea("txt")
.setPosition(300, 100)
.setSize(400, 600)
.setFont(createFont("", 12))
.setLineHeight(14)
.setColor(color(255))
.setColorBackground(color(0, 200))
.setColorForeground(color(255, 100))
.setVisible(false);
}
Set<String> buildControlsToLockIfBoxNotSpecified()
{
Set<String> result = new HashSet<String>();
@ -220,6 +232,8 @@ Set<String> buildControlsToLockIfImageNotLoaded()
Map<String, Controller> buildAllControls()
{
initConsoleWindow();
Map<String, Controller> map = new HashMap<String, Controller>();

View File

@ -422,6 +422,9 @@ public Integer windowHeight = 400;
public static Integer serialPortNumber = -1;
public Textarea consoleArea = null;
public Println console = null;
public PrintStream savedOut = null;
Properties props = null;
public static String propertiesFilename = "default.properties.txt";
@ -485,9 +488,6 @@ public static final int VECTOR_FILTER_LOW_PASS = 0;
String storeFilename = "comm.txt";
boolean overwriteExistingStoreFile = true;
//private static Logger logger;
public static Console console;
public boolean useWindowedConsole = false;
static boolean drawingTraceShape = true;
static boolean retraceShape = true;
@ -1684,12 +1684,7 @@ void keyPressed()
}
else if (checkKey(CONTROL) && checkKey(KeyEvent.VK_C))
{
if (isUseWindowedConsole())
setUseWindowedConsole(false);
else
setUseWindowedConsole(true);
initLogging();
toggleShowConsole();
}
else if (checkKey(CONTROL) && checkKey(KeyEvent.VK_S))
{
@ -1897,7 +1892,7 @@ void mouseWheel(int delta)
void setChromaKey(PVector p)
{
color col = getDisplayMachine().getPixelAtScreenCoords(p);
color col = getDisplayMachine().getPixelAtScreenCoords(p);
chromaKeyColour = col;
if (getDisplayMachine().pixelsCanBeExtracted() && isBoxSpecified())
{
@ -1919,6 +1914,26 @@ boolean isPreviewable(String command)
}
}
boolean toggleShowConsole() {
if (console == null) {
savedOut = System.out;
console = cp5.addConsole(consoleArea);
consoleArea.setVisible(true);
console.play();
}
else {
console.pause();
consoleArea.setVisible(false);
cp5.remove(console);
console = null;
System.setOut(savedOut);
}
println("Ow");
return console == null;
}
/**
This will comb the command queue and attempt to draw a picture of what it contains.
Coordinates here are in pixels.
@ -3252,16 +3267,6 @@ Integer getBaudRate()
return baudRate;
}
boolean isUseWindowedConsole()
{
return this.useWindowedConsole;
}
void setUseWindowedConsole(boolean use)
{
this.useWindowedConsole = use;
}
void initLogging()
{
try