mirror of
https://github.com/euphy/polargraphcontroller
synced 2025-01-08 19:24:25 +01:00
Updated a bunch of stuff to make it compile and run in Processing v2
This commit is contained in:
parent
111a9b9478
commit
cb4fa89674
46
ControlFrame.pde
Normal file
46
ControlFrame.pde
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// the ControlFrame class extends PApplet, so we
|
||||||
|
// are creating a new processing applet inside a
|
||||||
|
// new frame with a controlP5 object loaded
|
||||||
|
public class ControlFrame extends PApplet {
|
||||||
|
public int w, h;
|
||||||
|
int abc = 100;
|
||||||
|
public ControlP5 cp5;
|
||||||
|
protected Object parent;
|
||||||
|
|
||||||
|
private ControlFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlFrame(Object theParent, int theWidth, int theHeight) {
|
||||||
|
this.parent = theParent;
|
||||||
|
this.w = theWidth;
|
||||||
|
this.h = theHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlP5 cp5() {
|
||||||
|
if (this.cp5 == null) {
|
||||||
|
this.cp5 = this.setupControlP5();
|
||||||
|
}
|
||||||
|
return this.cp5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
size(w, h);
|
||||||
|
frameRate(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlP5 setupControlP5() {
|
||||||
|
println("About to create new ControlP5");
|
||||||
|
ControlP5 cp5 = new ControlP5(this);
|
||||||
|
println("Created: " + cp5);
|
||||||
|
while (cp5 == null) {
|
||||||
|
println("Was null: " + cp5);
|
||||||
|
}
|
||||||
|
println("Finally created: " + cp5);
|
||||||
|
return cp5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
background(abc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,31 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
Polargraph Controller is free software: you can redistribute it and/or modify
|
Polargraph Controller is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Polargraph Controller is distributed in the hope that it will be useful,
|
Polargraph Controller is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Polargraph Controller. If not, see <http://www.gnu.org/licenses/>.
|
along with Polargraph Controller. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Requires the excellent ControlP5 GUI library available from http://www.sojamo.de/libraries/controlP5/.
|
Requires the excellent ControlP5 GUI library available from http://www.sojamo.de/libraries/controlP5/.
|
||||||
Requires the excellent Geomerative library available from http://www.ricardmarxer.com/geomerative/.
|
Requires the excellent Geomerative library available from http://www.ricardmarxer.com/geomerative/.
|
||||||
|
|
||||||
This is an application for controlling a polargraph machine, communicating using ASCII command language over a serial link.
|
This is an application for controlling a polargraph machine, communicating using ASCII command language over a serial link.
|
||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DisplayMachine extends Machine
|
class DisplayMachine extends Machine
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
402
Misc.pde
402
Misc.pde
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Scaler
|
class Scaler
|
||||||
@ -52,202 +52,202 @@ class PreviewVector extends PVector
|
|||||||
{
|
{
|
||||||
public String command;
|
public String command;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
//
|
||||||
import java.awt.Toolkit;
|
//import java.awt.Toolkit;
|
||||||
import java.awt.BorderLayout;
|
//import java.awt.BorderLayout;
|
||||||
import java.awt.GraphicsEnvironment;
|
//import java.awt.GraphicsEnvironment;
|
||||||
|
//
|
||||||
public class Console extends WindowAdapter implements WindowListener, ActionListener, Runnable
|
//public class Console extends WindowAdapter implements WindowListener, ActionListener, Runnable
|
||||||
{
|
//{
|
||||||
private JFrame frame;
|
// private JFrame frame;
|
||||||
private JTextArea textArea;
|
// private JTextArea textArea;
|
||||||
private Thread reader;
|
// private Thread reader;
|
||||||
private Thread reader2;
|
// private Thread reader2;
|
||||||
private boolean quit;
|
// private boolean quit;
|
||||||
|
//
|
||||||
private final PipedInputStream pin=new PipedInputStream();
|
// private final PipedInputStream pin=new PipedInputStream();
|
||||||
private final PipedInputStream pin2=new PipedInputStream();
|
// private final PipedInputStream pin2=new PipedInputStream();
|
||||||
|
//
|
||||||
private PrintStream cOut = System.out;
|
// private PrintStream cOut = System.out;
|
||||||
private PrintStream cErr = System.err;
|
// private PrintStream cErr = System.err;
|
||||||
|
//
|
||||||
Thread errorThrower; // just for testing (Throws an Exception at this Console
|
// Thread errorThrower; // just for testing (Throws an Exception at this Console
|
||||||
|
//
|
||||||
public Console()
|
// public Console()
|
||||||
{
|
// {
|
||||||
// create all components and add them
|
// // create all components and add them
|
||||||
frame=new JFrame("Java Console");
|
// frame=new JFrame("Java Console");
|
||||||
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
|
// Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
Dimension frameSize=new Dimension((int)(screenSize.width/2),(int)(screenSize.height/2));
|
// Dimension frameSize=new Dimension((int)(screenSize.width/2),(int)(screenSize.height/2));
|
||||||
int x=(int)(frameSize.width/2);
|
// int x=(int)(frameSize.width/2);
|
||||||
int y=(int)(frameSize.height/2);
|
// int y=(int)(frameSize.height/2);
|
||||||
frame.setBounds(x,y,frameSize.width,frameSize.height);
|
// frame.setBounds(x,y,frameSize.width,frameSize.height);
|
||||||
|
//
|
||||||
textArea=new JTextArea();
|
// textArea=new JTextArea();
|
||||||
textArea.setEditable(false);
|
// textArea.setEditable(false);
|
||||||
JButton button=new JButton("clear");
|
// JButton button=new JButton("clear");
|
||||||
|
//
|
||||||
frame.getContentPane().setLayout(new BorderLayout());
|
// frame.getContentPane().setLayout(new BorderLayout());
|
||||||
frame.getContentPane().add(new JScrollPane(textArea),BorderLayout.CENTER);
|
// frame.getContentPane().add(new JScrollPane(textArea),BorderLayout.CENTER);
|
||||||
frame.getContentPane().add(button,BorderLayout.SOUTH);
|
// frame.getContentPane().add(button,BorderLayout.SOUTH);
|
||||||
frame.setVisible(true);
|
// frame.setVisible(true);
|
||||||
|
//
|
||||||
frame.addWindowListener(this);
|
// frame.addWindowListener(this);
|
||||||
button.addActionListener(this);
|
// button.addActionListener(this);
|
||||||
|
//
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
this.cOut = System.out;
|
// this.cOut = System.out;
|
||||||
PipedOutputStream pout=new PipedOutputStream(this.pin);
|
// PipedOutputStream pout=new PipedOutputStream(this.pin);
|
||||||
System.setOut(new PrintStream(pout,true));
|
// System.setOut(new PrintStream(pout,true));
|
||||||
}
|
// }
|
||||||
catch (java.io.IOException io)
|
// catch (java.io.IOException io)
|
||||||
{
|
// {
|
||||||
textArea.append("Couldn't redirect STDOUT to this console\n"+io.getMessage());
|
// textArea.append("Couldn't redirect STDOUT to this console\n"+io.getMessage());
|
||||||
}
|
// }
|
||||||
catch (SecurityException se)
|
// catch (SecurityException se)
|
||||||
{
|
// {
|
||||||
textArea.append("Couldn't redirect STDOUT to this console\n"+se.getMessage());
|
// textArea.append("Couldn't redirect STDOUT to this console\n"+se.getMessage());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
this.cErr = System.err;
|
// this.cErr = System.err;
|
||||||
PipedOutputStream pout2=new PipedOutputStream(this.pin2);
|
// PipedOutputStream pout2=new PipedOutputStream(this.pin2);
|
||||||
System.setErr(new PrintStream(pout2,true));
|
// System.setErr(new PrintStream(pout2,true));
|
||||||
}
|
// }
|
||||||
catch (java.io.IOException io)
|
// catch (java.io.IOException io)
|
||||||
{
|
// {
|
||||||
textArea.append("Couldn't redirect STDERR to this console\n"+io.getMessage());
|
// textArea.append("Couldn't redirect STDERR to this console\n"+io.getMessage());
|
||||||
}
|
// }
|
||||||
catch (SecurityException se)
|
// catch (SecurityException se)
|
||||||
{
|
// {
|
||||||
textArea.append("Couldn't redirect STDERR to this console\n"+se.getMessage());
|
// textArea.append("Couldn't redirect STDERR to this console\n"+se.getMessage());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
quit=false; // signals the Threads that they should exit
|
// quit=false; // signals the Threads that they should exit
|
||||||
|
//
|
||||||
// Starting two seperate threads to read from the PipedInputStreams
|
// // Starting two seperate threads to read from the PipedInputStreams
|
||||||
//
|
// //
|
||||||
reader=new Thread(this);
|
// reader=new Thread(this);
|
||||||
reader.setDaemon(true);
|
// reader.setDaemon(true);
|
||||||
reader.start();
|
// reader.start();
|
||||||
//
|
// //
|
||||||
reader2=new Thread(this);
|
// reader2=new Thread(this);
|
||||||
reader2.setDaemon(true);
|
// reader2.setDaemon(true);
|
||||||
reader2.start();
|
// reader2.start();
|
||||||
|
//
|
||||||
// // testing part
|
//// // testing part
|
||||||
// // you may omit this part for your application
|
//// // you may omit this part for your application
|
||||||
// //
|
//// //
|
||||||
// System.out.println("Hello World 2");
|
//// System.out.println("Hello World 2");
|
||||||
// System.out.println("All fonts available to Graphic2D:\n");
|
//// System.out.println("All fonts available to Graphic2D:\n");
|
||||||
// GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
//// GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
// String[] fontNames=ge.getAvailableFontFamilyNames();
|
//// String[] fontNames=ge.getAvailableFontFamilyNames();
|
||||||
// for(int n=0;n<fontNames.length;n++) System.out.println(fontNames[n]);
|
//// for(int n=0;n<fontNames.length;n++) System.out.println(fontNames[n]);
|
||||||
// // Testing part: simple an error thrown anywhere in this JVM will be printed on the Console
|
//// // Testing part: simple an error thrown anywhere in this JVM will be printed on the Console
|
||||||
// // We do it with a seperate Thread becasue we don't wan't to break a Thread used by the Console.
|
//// // We do it with a seperate Thread becasue we don't wan't to break a Thread used by the Console.
|
||||||
// System.out.println("\nLets throw an error on this console");
|
//// System.out.println("\nLets throw an error on this console");
|
||||||
// errorThrower=new Thread(this);
|
//// errorThrower=new Thread(this);
|
||||||
// errorThrower.setDaemon(true);
|
//// errorThrower.setDaemon(true);
|
||||||
// errorThrower.start();
|
//// errorThrower.start();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public synchronized void windowClosed(WindowEvent evt)
|
// public synchronized void windowClosed(WindowEvent evt)
|
||||||
{
|
// {
|
||||||
quit=true;
|
// quit=true;
|
||||||
this.notifyAll(); // stop all threads
|
// this.notifyAll(); // stop all threads
|
||||||
try {
|
// try {
|
||||||
reader.join(1000);
|
// reader.join(1000);
|
||||||
pin.close();
|
// pin.close();
|
||||||
System.setOut(this.cOut);
|
// System.setOut(this.cOut);
|
||||||
}
|
// }
|
||||||
catch (Exception e){
|
// catch (Exception e){
|
||||||
}
|
// }
|
||||||
try {
|
// try {
|
||||||
reader2.join(1000);
|
// reader2.join(1000);
|
||||||
pin2.close();
|
// pin2.close();
|
||||||
System.setErr(this.cErr);
|
// System.setErr(this.cErr);
|
||||||
}
|
// }
|
||||||
catch (Exception e){
|
// catch (Exception e){
|
||||||
}
|
// }
|
||||||
// System.exit(0);
|
//// System.exit(0);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public synchronized void windowClosing(WindowEvent evt)
|
// public synchronized void windowClosing(WindowEvent evt)
|
||||||
{
|
// {
|
||||||
frame.setVisible(false); // default behaviour of JFrame
|
// frame.setVisible(false); // default behaviour of JFrame
|
||||||
frame.dispose();
|
// frame.dispose();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public synchronized void actionPerformed(ActionEvent evt)
|
// public synchronized void actionPerformed(ActionEvent evt)
|
||||||
{
|
// {
|
||||||
textArea.setText("");
|
// textArea.setText("");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public synchronized void run()
|
// public synchronized void run()
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
while (Thread.currentThread()==reader)
|
// while (Thread.currentThread()==reader)
|
||||||
{
|
// {
|
||||||
try {
|
// try {
|
||||||
this.wait(100);
|
// this.wait(100);
|
||||||
}
|
// }
|
||||||
catch(InterruptedException ie) {
|
// catch(InterruptedException ie) {
|
||||||
}
|
// }
|
||||||
if (pin.available()!=0)
|
// if (pin.available()!=0)
|
||||||
{
|
// {
|
||||||
String input=this.readLine(pin);
|
// String input=this.readLine(pin);
|
||||||
textArea.append(input);
|
// textArea.append(input);
|
||||||
textArea.setCaretPosition(textArea.getDocument().getLength());
|
// textArea.setCaretPosition(textArea.getDocument().getLength());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
if (quit) return;
|
// if (quit) return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
while (Thread.currentThread()==reader2)
|
// while (Thread.currentThread()==reader2)
|
||||||
{
|
// {
|
||||||
try {
|
// try {
|
||||||
this.wait(100);
|
// this.wait(100);
|
||||||
}
|
// }
|
||||||
catch(InterruptedException ie) {
|
// catch(InterruptedException ie) {
|
||||||
}
|
// }
|
||||||
if (pin2.available()!=0)
|
// if (pin2.available()!=0)
|
||||||
{
|
// {
|
||||||
String input=this.readLine(pin2);
|
// String input=this.readLine(pin2);
|
||||||
textArea.append(input);
|
// textArea.append(input);
|
||||||
textArea.setCaretPosition(textArea.getDocument().getLength());
|
// textArea.setCaretPosition(textArea.getDocument().getLength());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
if (quit) return;
|
// if (quit) return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
textArea.append("\nConsole reports an Internal error.");
|
// textArea.append("\nConsole reports an Internal error.");
|
||||||
textArea.append("The error is: "+e);
|
// textArea.append("The error is: "+e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void close()
|
// public void close()
|
||||||
{
|
// {
|
||||||
this.windowClosing(null);
|
// this.windowClosing(null);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public synchronized String readLine(PipedInputStream in) throws IOException
|
// public synchronized String readLine(PipedInputStream in) throws IOException
|
||||||
{
|
// {
|
||||||
String input="";
|
// String input="";
|
||||||
do
|
// do
|
||||||
{
|
// {
|
||||||
int available=in.available();
|
// int available=in.available();
|
||||||
if (available==0) break;
|
// if (available==0) break;
|
||||||
byte b[]=new byte[available];
|
// byte b[]=new byte[available];
|
||||||
in.read(b);
|
// in.read(b);
|
||||||
input=input+new String(b,0,b.length);
|
// input=input+new String(b,0,b.length);
|
||||||
}
|
// }
|
||||||
while( !input.endsWith("\n") && !input.endsWith("\r\n") && !quit);
|
// while( !input.endsWith("\n") && !input.endsWith("\r\n") && !quit);
|
||||||
return input;
|
// return input;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
24
Panel.pde
24
Panel.pde
@ -120,9 +120,9 @@ class Panel
|
|||||||
|
|
||||||
public void draw()
|
public void draw()
|
||||||
{
|
{
|
||||||
// stroke(outlineColour);
|
//stroke(outlineColour);
|
||||||
// strokeWeight(2);
|
//strokeWeight(2);
|
||||||
// rect(getOutline().getLeft(), getOutline().getTop(), getOutline().getWidth(), getOutline().getHeight());
|
//rect(getOutline().getLeft(), getOutline().getTop(), getOutline().getWidth(), getOutline().getHeight());
|
||||||
|
|
||||||
drawControls();
|
drawControls();
|
||||||
}
|
}
|
||||||
@ -131,13 +131,13 @@ class Panel
|
|||||||
{
|
{
|
||||||
for (Controller c : this.getControls())
|
for (Controller c : this.getControls())
|
||||||
{
|
{
|
||||||
//println("Control: " + c.name());
|
// println("Control: " + c.getName());
|
||||||
PVector pos = getControlPositions().get(c.name());
|
PVector pos = getControlPositions().get(c.getName());
|
||||||
float x = pos.x+getOutline().getLeft();
|
float x = pos.x+getOutline().getLeft();
|
||||||
float y = pos.y+getOutline().getTop();
|
float y = pos.y+getOutline().getTop();
|
||||||
c.setPosition(x, y);
|
c.setPosition(x, y);
|
||||||
|
|
||||||
PVector cSize = getControlSizes().get(c.name());
|
PVector cSize = getControlSizes().get(c.getName());
|
||||||
c.setSize((int)cSize.x, (int)cSize.y);
|
c.setSize((int)cSize.x, (int)cSize.y);
|
||||||
|
|
||||||
boolean locked = false;
|
boolean locked = false;
|
||||||
@ -146,32 +146,32 @@ class Panel
|
|||||||
|
|
||||||
// any drawing / extracting controls are disabled if there is no selec
|
// any drawing / extracting controls are disabled if there is no selec
|
||||||
// box specified.
|
// box specified.
|
||||||
if (getControlsToLockIfBoxNotSpecified().contains(c.name()) && !isBoxSpecified())
|
if (getControlsToLockIfBoxNotSpecified().contains(c.getName()) && !isBoxSpecified())
|
||||||
{
|
{
|
||||||
locked = true;
|
locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is no vector shape loaded then lock the "draw vector"
|
// if there is no vector shape loaded then lock the "draw vector"
|
||||||
// control.
|
// control.
|
||||||
if (c.name().equals(MODE_RENDER_VECTORS) && getVectorShape() == null)
|
if (c.getName().equals(MODE_RENDER_VECTORS) && getVectorShape() == null)
|
||||||
{
|
{
|
||||||
locked = true;
|
locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there's no image loaded, then hide resizing/moving
|
// if there's no image loaded, then hide resizing/moving
|
||||||
if (getControlsToLockIfImageNotLoaded().contains(c.name()) && getDisplayMachine().getImage() == null)
|
if (getControlsToLockIfImageNotLoaded().contains(c.getName()) && getDisplayMachine().getImage() == null)
|
||||||
{
|
{
|
||||||
locked = true;
|
locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.name().equals(MODE_LOAD_VECTOR_FILE))
|
if (c.getName().equals(MODE_LOAD_VECTOR_FILE))
|
||||||
{
|
{
|
||||||
if (getVectorShape() != null)
|
if (getVectorShape() != null)
|
||||||
c.setLabel("Clear vector");
|
c.setLabel("Clear vector");
|
||||||
else
|
else
|
||||||
c.setLabel("Load vector");
|
c.setLabel("Load vector");
|
||||||
}
|
}
|
||||||
else if (c.name().equals(MODE_LOAD_IMAGE))
|
else if (c.getName().equals(MODE_LOAD_IMAGE))
|
||||||
{
|
{
|
||||||
if (getDisplayMachine().getImage() != null)
|
if (getDisplayMachine().getImage() != null)
|
||||||
c.setLabel("Clear image");
|
c.setLabel("Clear image");
|
||||||
@ -231,6 +231,4 @@ class Panel
|
|||||||
this.getOutline().setWidth(right);
|
this.getOutline().setWidth(right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
class Rectangle
|
class Rectangle
|
||||||
{
|
{
|
||||||
@ -122,4 +122,8 @@ class Rectangle
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return new StringBuffer().append("Rectangle pos: ").append(this.getPosition()).append(", size: ").append(this.getSize()).append(".").toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
void button_mode_begin()
|
void button_mode_begin()
|
||||||
{
|
{
|
||||||
button_mode_clearQueue();
|
button_mode_clearQueue();
|
||||||
}
|
}
|
||||||
@ -719,4 +719,10 @@ void button_mode_sendButtonDeactivate()
|
|||||||
addToCommandQueue(CMD_DEACTIVATE_MACHINE_BUTTON+",END");
|
addToCommandQueue(CMD_DEACTIVATE_MACHINE_BUTTON+",END");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void numberbox_mode_previewCordOffsetValue(int value)
|
||||||
|
{
|
||||||
|
previewCordOffset = value;
|
||||||
|
previewQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,82 +1,73 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
Polargraph Controller is free software: you can redistribute it and/or modify
|
Polargraph Controller is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Polargraph Controller is distributed in the hope that it will be useful,
|
Polargraph Controller is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Polargraph Controller. If not, see <http://www.gnu.org/licenses/>.
|
along with Polargraph Controller. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Requires the excellent ControlP5 GUI library available from http://www.sojamo.de/libraries/controlP5/.
|
Requires the excellent ControlP5 GUI library available from http://www.sojamo.de/libraries/controlP5/.
|
||||||
Requires the excellent Geomerative library available from http://www.ricardmarxer.com/geomerative/.
|
Requires the excellent Geomerative library available from http://www.ricardmarxer.com/geomerative/.
|
||||||
|
|
||||||
This is an application for controlling a polargraph machine, communicating using ASCII command language over a serial link.
|
This is an application for controlling a polargraph machine, communicating using ASCII command language over a serial link.
|
||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
Set<String> getPanelNames()
|
Set<String> getPanelNames() {
|
||||||
{
|
|
||||||
if (this.panelNames == null)
|
if (this.panelNames == null)
|
||||||
this.panelNames = buildPanelNames();
|
this.panelNames = buildPanelNames();
|
||||||
return this.panelNames;
|
return this.panelNames;
|
||||||
}
|
}
|
||||||
List<String> getTabNames()
|
List<String> getTabNames() {
|
||||||
{
|
|
||||||
if (this.tabNames == null)
|
if (this.tabNames == null)
|
||||||
this.tabNames = buildTabNames();
|
this.tabNames = buildTabNames();
|
||||||
return this.tabNames;
|
return this.tabNames;
|
||||||
}
|
}
|
||||||
Set<String> getControlNames()
|
Set<String> getControlNames() {
|
||||||
{
|
|
||||||
if (this.controlNames == null)
|
if (this.controlNames == null)
|
||||||
this.controlNames = buildControlNames();
|
this.controlNames = buildControlNames();
|
||||||
return this.controlNames;
|
return this.controlNames;
|
||||||
}
|
}
|
||||||
Map<String, List<Controller>> getControlsForPanels()
|
Map<String, List<Controller>> getControlsForPanels() {
|
||||||
{
|
|
||||||
if (this.controlsForPanels == null)
|
if (this.controlsForPanels == null)
|
||||||
this.controlsForPanels = buildControlsForPanels();
|
this.controlsForPanels = buildControlsForPanels();
|
||||||
return this.controlsForPanels;
|
return this.controlsForPanels;
|
||||||
}
|
}
|
||||||
Map<String, Controller> getAllControls()
|
Map<String, Controller> getAllControls() {
|
||||||
{
|
|
||||||
if (this.allControls == null)
|
if (this.allControls == null)
|
||||||
this.allControls = buildAllControls();
|
this.allControls = buildAllControls();
|
||||||
return this.allControls;
|
return this.allControls;
|
||||||
}
|
}
|
||||||
Map<String, String> getControlLabels()
|
Map<String, String> getControlLabels() {
|
||||||
{
|
|
||||||
if (this.controlLabels == null)
|
if (this.controlLabels == null)
|
||||||
this.controlLabels = buildControlLabels();
|
this.controlLabels = buildControlLabels();
|
||||||
return this.controlLabels;
|
return this.controlLabels;
|
||||||
}
|
}
|
||||||
Map<String, Set<Panel>> getPanelsForTabs()
|
Map<String, Set<Panel>> getPanelsForTabs() {
|
||||||
{
|
|
||||||
if (this.panelsForTabs == null)
|
if (this.panelsForTabs == null)
|
||||||
this.panelsForTabs = buildPanelsForTabs();
|
this.panelsForTabs = buildPanelsForTabs();
|
||||||
return this.panelsForTabs;
|
return this.panelsForTabs;
|
||||||
}
|
}
|
||||||
Map<String, Panel> getPanels()
|
Map<String, Panel> getPanels() {
|
||||||
{
|
|
||||||
if (this.panels == null)
|
if (this.panels == null)
|
||||||
this.panels = buildPanels();
|
this.panels = buildPanels();
|
||||||
return this.panels;
|
return this.panels;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> getControlsToLockIfBoxNotSpecified()
|
Set<String> getControlsToLockIfBoxNotSpecified() {
|
||||||
{
|
|
||||||
if (this.controlsToLockIfBoxNotSpecified == null)
|
if (this.controlsToLockIfBoxNotSpecified == null)
|
||||||
{
|
{
|
||||||
this.controlsToLockIfBoxNotSpecified = buildControlsToLockIfBoxNotSpecified();
|
this.controlsToLockIfBoxNotSpecified = buildControlsToLockIfBoxNotSpecified();
|
||||||
@ -84,8 +75,7 @@ Set<String> getControlsToLockIfBoxNotSpecified()
|
|||||||
return this.controlsToLockIfBoxNotSpecified;
|
return this.controlsToLockIfBoxNotSpecified;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> getControlsToLockIfImageNotLoaded()
|
Set<String> getControlsToLockIfImageNotLoaded() {
|
||||||
{
|
|
||||||
if (this.controlsToLockIfImageNotLoaded == null)
|
if (this.controlsToLockIfImageNotLoaded == null)
|
||||||
{
|
{
|
||||||
this.controlsToLockIfImageNotLoaded = buildControlsToLockIfImageNotLoaded();
|
this.controlsToLockIfImageNotLoaded = buildControlsToLockIfImageNotLoaded();
|
||||||
@ -93,9 +83,7 @@ Set<String> getControlsToLockIfImageNotLoaded()
|
|||||||
return this.controlsToLockIfImageNotLoaded;
|
return this.controlsToLockIfImageNotLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hideAllControls() {
|
||||||
void hideAllControls()
|
|
||||||
{
|
|
||||||
for (String key : allControls.keySet())
|
for (String key : allControls.keySet())
|
||||||
{
|
{
|
||||||
Controller c = allControls.get(key);
|
Controller c = allControls.get(key);
|
||||||
@ -103,8 +91,7 @@ void hideAllControls()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Panel> buildPanels()
|
Map<String, Panel> buildPanels() {
|
||||||
{
|
|
||||||
Map<String, Panel> panels = new HashMap<String, Panel>();
|
Map<String, Panel> panels = new HashMap<String, Panel>();
|
||||||
|
|
||||||
float panelHeight = frame.getHeight() - getMainPanelPosition().y - (DEFAULT_CONTROL_SIZE.y*3);
|
float panelHeight = frame.getHeight() - getMainPanelPosition().y - (DEFAULT_CONTROL_SIZE.y*3);
|
||||||
@ -121,7 +108,7 @@ Map<String, Panel> buildPanels()
|
|||||||
panels.put(PANEL_NAME_INPUT, inputPanel);
|
panels.put(PANEL_NAME_INPUT, inputPanel);
|
||||||
|
|
||||||
Panel rovingPanel = new Panel(PANEL_NAME_ROVING, panelOutline);
|
Panel rovingPanel = new Panel(PANEL_NAME_ROVING, panelOutline);
|
||||||
rovingPanel.setOutlineColour(color(200,200,200));
|
rovingPanel.setOutlineColour(color(100,200,200));
|
||||||
// get controls
|
// get controls
|
||||||
rovingPanel.setResizable(true);
|
rovingPanel.setResizable(true);
|
||||||
rovingPanel.setControls(getControlsForPanels().get(PANEL_NAME_ROVING));
|
rovingPanel.setControls(getControlsForPanels().get(PANEL_NAME_ROVING));
|
||||||
@ -131,7 +118,7 @@ Map<String, Panel> buildPanels()
|
|||||||
panels.put(PANEL_NAME_ROVING, rovingPanel);
|
panels.put(PANEL_NAME_ROVING, rovingPanel);
|
||||||
|
|
||||||
Panel tracePanel = new Panel(PANEL_NAME_TRACE, panelOutline);
|
Panel tracePanel = new Panel(PANEL_NAME_TRACE, panelOutline);
|
||||||
tracePanel.setOutlineColour(color(200,200,200));
|
tracePanel.setOutlineColour(color(200,255,200));
|
||||||
// get controls
|
// get controls
|
||||||
tracePanel.setResizable(true);
|
tracePanel.setResizable(true);
|
||||||
tracePanel.setControls(getControlsForPanels().get(PANEL_NAME_TRACE));
|
tracePanel.setControls(getControlsForPanels().get(PANEL_NAME_TRACE));
|
||||||
@ -141,7 +128,7 @@ Map<String, Panel> buildPanels()
|
|||||||
panels.put(PANEL_NAME_TRACE, tracePanel);
|
panels.put(PANEL_NAME_TRACE, tracePanel);
|
||||||
|
|
||||||
Panel detailsPanel = new Panel(PANEL_NAME_DETAILS, panelOutline);
|
Panel detailsPanel = new Panel(PANEL_NAME_DETAILS, panelOutline);
|
||||||
detailsPanel.setOutlineColour(color(200, 200, 200));
|
detailsPanel.setOutlineColour(color(200, 200, 255));
|
||||||
// get controls
|
// get controls
|
||||||
detailsPanel.setResizable(true);
|
detailsPanel.setResizable(true);
|
||||||
detailsPanel.setControls(getControlsForPanels().get(PANEL_NAME_DETAILS));
|
detailsPanel.setControls(getControlsForPanels().get(PANEL_NAME_DETAILS));
|
||||||
@ -151,7 +138,7 @@ Map<String, Panel> buildPanels()
|
|||||||
panels.put(PANEL_NAME_DETAILS, detailsPanel);
|
panels.put(PANEL_NAME_DETAILS, detailsPanel);
|
||||||
|
|
||||||
Panel queuePanel = new Panel(PANEL_NAME_QUEUE, panelOutline);
|
Panel queuePanel = new Panel(PANEL_NAME_QUEUE, panelOutline);
|
||||||
queuePanel.setOutlineColour(color(200, 200, 200));
|
queuePanel.setOutlineColour(color(200, 200, 50));
|
||||||
// get controls
|
// get controls
|
||||||
queuePanel.setResizable(true);
|
queuePanel.setResizable(true);
|
||||||
queuePanel.setControls(getControlsForPanels().get(PANEL_NAME_QUEUE));
|
queuePanel.setControls(getControlsForPanels().get(PANEL_NAME_QUEUE));
|
||||||
@ -165,7 +152,7 @@ Map<String, Panel> buildPanels()
|
|||||||
new PVector((DEFAULT_CONTROL_SIZE.x+CONTROL_SPACING.x)*2, (DEFAULT_CONTROL_SIZE.y+CONTROL_SPACING.y)*2));
|
new PVector((DEFAULT_CONTROL_SIZE.x+CONTROL_SPACING.x)*2, (DEFAULT_CONTROL_SIZE.y+CONTROL_SPACING.y)*2));
|
||||||
Panel generalPanel = new Panel(PANEL_NAME_GENERAL, panelOutline);
|
Panel generalPanel = new Panel(PANEL_NAME_GENERAL, panelOutline);
|
||||||
generalPanel.setResizable(false);
|
generalPanel.setResizable(false);
|
||||||
generalPanel.setOutlineColour(color(200, 200, 200));
|
generalPanel.setOutlineColour(color(200, 50, 200));
|
||||||
// get controls
|
// get controls
|
||||||
generalPanel.setControls(getControlsForPanels().get(PANEL_NAME_GENERAL));
|
generalPanel.setControls(getControlsForPanels().get(PANEL_NAME_GENERAL));
|
||||||
// get control positions
|
// get control positions
|
||||||
@ -241,9 +228,9 @@ Map<String, Controller> buildAllControls()
|
|||||||
Toggle t = cp5.addToggle(controlName, false, 100, 100, 100, 100);
|
Toggle t = cp5.addToggle(controlName, false, 100, 100, 100, 100);
|
||||||
t.setLabel(getControlLabels().get(controlName));
|
t.setLabel(getControlLabels().get(controlName));
|
||||||
t.hide();
|
t.hide();
|
||||||
controlP5.Label l = t.captionLabel();
|
controlP5.Label l = t.getCaptionLabel();
|
||||||
l.style().marginTop = -17; //move upwards (relative to button size)
|
l.getStyle().marginTop = -17; //move upwards (relative to button size)
|
||||||
l.style().marginLeft = 4; //move to the right
|
l.getStyle().marginLeft = 4; //move to the right
|
||||||
map.put(controlName, t);
|
map.put(controlName, t);
|
||||||
// println("Added toggle " + controlName);
|
// println("Added toggle " + controlName);
|
||||||
}
|
}
|
||||||
@ -252,9 +239,9 @@ Map<String, Controller> buildAllControls()
|
|||||||
Toggle t = cp5.addToggle(controlName, false, 100, 100, 100, 100);
|
Toggle t = cp5.addToggle(controlName, false, 100, 100, 100, 100);
|
||||||
t.setLabel(getControlLabels().get(controlName));
|
t.setLabel(getControlLabels().get(controlName));
|
||||||
t.hide();
|
t.hide();
|
||||||
controlP5.Label l = t.captionLabel();
|
controlP5.Label l = t.getCaptionLabel();
|
||||||
l.style().marginTop = -17; //move upwards (relative to button size)
|
l.getStyle().marginTop = -17; //move upwards (relative to button size)
|
||||||
l.style().marginLeft = 4; //move to the right
|
l.getStyle().marginLeft = 4; //move to the right
|
||||||
map.put(controlName, t);
|
map.put(controlName, t);
|
||||||
// println("Added minitoggle " + controlName);
|
// println("Added minitoggle " + controlName);
|
||||||
}
|
}
|
||||||
@ -264,9 +251,9 @@ Map<String, Controller> buildAllControls()
|
|||||||
n.setLabel(getControlLabels().get(controlName));
|
n.setLabel(getControlLabels().get(controlName));
|
||||||
n.hide();
|
n.hide();
|
||||||
n.setDecimalPrecision(0);
|
n.setDecimalPrecision(0);
|
||||||
controlP5.Label l = n.captionLabel();
|
controlP5.Label l = n.getCaptionLabel();
|
||||||
l.style().marginTop = -17; //move upwards (relative to button size)
|
l.getStyle().marginTop = -17; //move upwards (relative to button size)
|
||||||
l.style().marginLeft = 40; //move to the right
|
l.getStyle().marginLeft = 40; //move to the right
|
||||||
// change the control direction to left/right
|
// change the control direction to left/right
|
||||||
n.setDirection(Controller.VERTICAL);
|
n.setDirection(Controller.VERTICAL);
|
||||||
map.put(controlName, n);
|
map.put(controlName, n);
|
||||||
@ -500,6 +487,12 @@ Map<String, Controller> initialiseNumberboxValues(Map<String, Controller> map)
|
|||||||
n.setMax(PATH_LENGTH_HIGHPASS_CUTOFF_MAX);
|
n.setMax(PATH_LENGTH_HIGHPASS_CUTOFF_MAX);
|
||||||
n.setMultiplier(0.5);
|
n.setMultiplier(0.5);
|
||||||
}
|
}
|
||||||
|
else if (MODE_ADJUST_PREVIEW_CORD_OFFSET.equals(key))
|
||||||
|
{
|
||||||
|
n.setDecimalPrecision(0);
|
||||||
|
n.setValue(0);
|
||||||
|
n.setMultiplier(0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@ -555,9 +548,6 @@ Map<String, Controller> initialiseToggleValues(Map<String, Controller> map)
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String getControlLabel(String butName)
|
String getControlLabel(String butName)
|
||||||
{
|
{
|
||||||
if (controlLabels.containsKey(butName))
|
if (controlLabels.containsKey(butName))
|
||||||
@ -574,10 +564,10 @@ Map<String, PVector> buildControlPositionsForPanel(Panel panel)
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
for (Controller controller : panel.getControls())
|
for (Controller controller : panel.getControls())
|
||||||
{
|
{
|
||||||
if (controller.name().startsWith("minitoggle_"))
|
if (controller.getName().startsWith("minitoggle_"))
|
||||||
{
|
{
|
||||||
PVector p = new PVector(col*(DEFAULT_CONTROL_SIZE.x+CONTROL_SPACING.x), row*(DEFAULT_CONTROL_SIZE.y+CONTROL_SPACING.y));
|
PVector p = new PVector(col*(DEFAULT_CONTROL_SIZE.x+CONTROL_SPACING.x), row*(DEFAULT_CONTROL_SIZE.y+CONTROL_SPACING.y));
|
||||||
map.put(controller.name(), p);
|
map.put(controller.getName(), p);
|
||||||
row++;
|
row++;
|
||||||
if (p.y + (DEFAULT_CONTROL_SIZE.y*2) >= panel.getOutline().getHeight())
|
if (p.y + (DEFAULT_CONTROL_SIZE.y*2) >= panel.getOutline().getHeight())
|
||||||
{
|
{
|
||||||
@ -588,7 +578,7 @@ Map<String, PVector> buildControlPositionsForPanel(Panel panel)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
PVector p = new PVector(col*(DEFAULT_CONTROL_SIZE.x+CONTROL_SPACING.x), row*(DEFAULT_CONTROL_SIZE.y+CONTROL_SPACING.y));
|
PVector p = new PVector(col*(DEFAULT_CONTROL_SIZE.x+CONTROL_SPACING.x), row*(DEFAULT_CONTROL_SIZE.y+CONTROL_SPACING.y));
|
||||||
map.put(controller.name(), p);
|
map.put(controller.getName(), p);
|
||||||
row++;
|
row++;
|
||||||
if (p.y + (DEFAULT_CONTROL_SIZE.y*2) >= panel.getOutline().getHeight())
|
if (p.y + (DEFAULT_CONTROL_SIZE.y*2) >= panel.getOutline().getHeight())
|
||||||
{
|
{
|
||||||
@ -597,9 +587,9 @@ Map<String, PVector> buildControlPositionsForPanel(Panel panel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, PVector> buildControlSizesForPanel(Panel panel)
|
Map<String, PVector> buildControlSizesForPanel(Panel panel)
|
||||||
{
|
{
|
||||||
//println("Building control sizes for panel " + panel.getName());
|
//println("Building control sizes for panel " + panel.getName());
|
||||||
@ -609,16 +599,16 @@ Map<String, PVector> buildControlSizesForPanel(Panel panel)
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
for (Controller controller : panel.getControls())
|
for (Controller controller : panel.getControls())
|
||||||
{
|
{
|
||||||
if (controller.name().startsWith("minitoggle_"))
|
if (controller.getName().startsWith("minitoggle_"))
|
||||||
{
|
{
|
||||||
PVector s = new PVector(DEFAULT_CONTROL_SIZE.y, DEFAULT_CONTROL_SIZE.y);
|
PVector s = new PVector(DEFAULT_CONTROL_SIZE.y, DEFAULT_CONTROL_SIZE.y);
|
||||||
map.put(controller.name(), s);
|
map.put(controller.getName(), s);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PVector s = new PVector(DEFAULT_CONTROL_SIZE.x, DEFAULT_CONTROL_SIZE.y);
|
PVector s = new PVector(DEFAULT_CONTROL_SIZE.x, DEFAULT_CONTROL_SIZE.y);
|
||||||
map.put(controller.name(), s);
|
map.put(controller.getName(), s);
|
||||||
//println("Added size of " + controller.name() + " to panel. " + s);
|
//println("Added size of " + controller.getName() + " to panel. " + s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,6 +678,8 @@ List<String> getControlNamesForInputPanel()
|
|||||||
controlNames.add(MODE_CHANGE_MIN_VECTOR_LINE_LENGTH);
|
controlNames.add(MODE_CHANGE_MIN_VECTOR_LINE_LENGTH);
|
||||||
//controlNames.add(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF);
|
//controlNames.add(MODE_VECTOR_PATH_LENGTH_HIGHPASS_CUTOFF);
|
||||||
controlNames.add(MODE_RENDER_VECTORS);
|
controlNames.add(MODE_RENDER_VECTORS);
|
||||||
|
|
||||||
|
controlNames.add(MODE_ADJUST_PREVIEW_CORD_OFFSET);
|
||||||
|
|
||||||
controlNames.add(MODE_SHOW_IMAGE);
|
controlNames.add(MODE_SHOW_IMAGE);
|
||||||
controlNames.add(MODE_SHOW_VECTOR);
|
controlNames.add(MODE_SHOW_VECTOR);
|
||||||
@ -784,7 +776,7 @@ List<String> getControlNamesForDetailPanel()
|
|||||||
|
|
||||||
controlNames.add(MODE_SEND_BUTTON_ACTIVATE);
|
controlNames.add(MODE_SEND_BUTTON_ACTIVATE);
|
||||||
controlNames.add(MODE_SEND_BUTTON_DEACTIVATE);
|
controlNames.add(MODE_SEND_BUTTON_DEACTIVATE);
|
||||||
|
|
||||||
controlNames.add(MODE_CHANGE_SERIAL_PORT);
|
controlNames.add(MODE_CHANGE_SERIAL_PORT);
|
||||||
|
|
||||||
return controlNames;
|
return controlNames;
|
||||||
@ -960,6 +952,8 @@ Map<String, String> buildControlLabels()
|
|||||||
result.put(MODE_SEND_BUTTON_ACTIVATE, "Activate button");
|
result.put(MODE_SEND_BUTTON_ACTIVATE, "Activate button");
|
||||||
result.put(MODE_SEND_BUTTON_DEACTIVATE, "Deactivate button");
|
result.put(MODE_SEND_BUTTON_DEACTIVATE, "Deactivate button");
|
||||||
|
|
||||||
|
result.put(MODE_ADJUST_PREVIEW_CORD_OFFSET, "Cord offset");
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1103,6 +1097,7 @@ Set<String> buildControlNames()
|
|||||||
result.add(MODE_SEND_BUTTON_ACTIVATE);
|
result.add(MODE_SEND_BUTTON_ACTIVATE);
|
||||||
result.add(MODE_SEND_BUTTON_DEACTIVATE);
|
result.add(MODE_SEND_BUTTON_DEACTIVATE);
|
||||||
|
|
||||||
|
result.add(MODE_ADJUST_PREVIEW_CORD_OFFSET);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
54
drawing.pde
54
drawing.pde
@ -1,31 +1,31 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
Polargraph Controller is free software: you can redistribute it and/or modify
|
Polargraph Controller is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
Polargraph Controller is distributed in the hope that it will be useful,
|
Polargraph Controller is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Polargraph Controller. If not, see <http://www.gnu.org/licenses/>.
|
along with Polargraph Controller. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Requires the excellent ControlP5 GUI library available from http://www.sojamo.de/libraries/controlP5/.
|
Requires the excellent ControlP5 GUI library available from http://www.sojamo.de/libraries/controlP5/.
|
||||||
Requires the excellent Geomerative library available from http://www.ricardmarxer.com/geomerative/.
|
Requires the excellent Geomerative library available from http://www.ricardmarxer.com/geomerative/.
|
||||||
|
|
||||||
This is an application for controlling a polargraph machine, communicating using ASCII command language over a serial link.
|
This is an application for controlling a polargraph machine, communicating using ASCII command language over a serial link.
|
||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
static final String CMD_CHANGELENGTH = "C01,";
|
static final String CMD_CHANGELENGTH = "C01,";
|
||||||
static final String CMD_CHANGEPENWIDTH = "C02,";
|
static final String CMD_CHANGEPENWIDTH = "C02,";
|
||||||
static final String CMD_CHANGEMOTORSPEED = "C03,";
|
static final String CMD_CHANGEMOTORSPEED = "C03,";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2014.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
|
|
||||||
*/
|
*/
|
||||||
//import processing.video.*;
|
//import processing.video.*;
|
||||||
import diewald_CV_kit.libraryinfo.*;
|
import diewald_CV_kit.libraryinfo.*;
|
||||||
@ -49,10 +48,14 @@ import processing.serial.*;
|
|||||||
import controlP5.*;
|
import controlP5.*;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
|
||||||
int majorVersionNo = 1;
|
import java.lang.reflect.Method;
|
||||||
int minorVersionNo = 10;
|
|
||||||
int buildNo = 2;
|
int majorVersionNo = 2;
|
||||||
|
int minorVersionNo = 0;
|
||||||
|
int buildNo = 0;
|
||||||
|
|
||||||
String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo;
|
String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo;
|
||||||
ControlP5 cp5;
|
ControlP5 cp5;
|
||||||
@ -329,6 +332,8 @@ static final String MODE_ROTATE_WEBCAM_INPUT = "toggle_mode_rotateWebcam";
|
|||||||
static final String MODE_SEND_BUTTON_ACTIVATE = "button_mode_sendButtonActivate";
|
static final String MODE_SEND_BUTTON_ACTIVATE = "button_mode_sendButtonActivate";
|
||||||
static final String MODE_SEND_BUTTON_DEACTIVATE = "button_mode_sendButtonDeactivate";
|
static final String MODE_SEND_BUTTON_DEACTIVATE = "button_mode_sendButtonDeactivate";
|
||||||
|
|
||||||
|
static final String MODE_ADJUST_PREVIEW_CORD_OFFSET = "numberbox_mode_previewCordOffsetValue";
|
||||||
|
|
||||||
|
|
||||||
PVector statusTextPosition = new PVector(300.0, 12.0);
|
PVector statusTextPosition = new PVector(300.0, 12.0);
|
||||||
|
|
||||||
@ -395,6 +400,8 @@ public color guideColour = color(255);
|
|||||||
public color backgroundColour = color(100);
|
public color backgroundColour = color(100);
|
||||||
public color densityPreviewColour = color(0);
|
public color densityPreviewColour = color(0);
|
||||||
|
|
||||||
|
public Integer previewCordOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
public boolean showingSummaryOverlay = true;
|
public boolean showingSummaryOverlay = true;
|
||||||
public boolean showingDialogBox = false;
|
public boolean showingDialogBox = false;
|
||||||
@ -433,7 +440,7 @@ public static final String PANEL_NAME_TRACE = "panel_trace";
|
|||||||
public static final String PANEL_NAME_GENERAL = "panel_general";
|
public static final String PANEL_NAME_GENERAL = "panel_general";
|
||||||
|
|
||||||
public final PVector DEFAULT_CONTROL_SIZE = new PVector(100.0, 20.0);
|
public final PVector DEFAULT_CONTROL_SIZE = new PVector(100.0, 20.0);
|
||||||
public final PVector CONTROL_SPACING = new PVector(2.0, 2.0);
|
public final PVector CONTROL_SPACING = new PVector(4.0, 4.0);
|
||||||
public PVector mainPanelPosition = new PVector(10.0, 85.0);
|
public PVector mainPanelPosition = new PVector(10.0, 85.0);
|
||||||
|
|
||||||
public final Integer PANEL_MIN_HEIGHT = 400;
|
public final Integer PANEL_MIN_HEIGHT = 400;
|
||||||
@ -451,11 +458,13 @@ public Set<String> controlsToLockIfImageNotLoaded = null;
|
|||||||
public Map<String, Set<Panel>> panelsForTabs = null;
|
public Map<String, Set<Panel>> panelsForTabs = null;
|
||||||
public Map<String, Panel> panels = null;
|
public Map<String, Panel> panels = null;
|
||||||
|
|
||||||
|
public Map<String, ControlFrame> controlFrames = new HashMap<String, ControlFrame>();
|
||||||
|
|
||||||
// machine moving
|
// machine moving
|
||||||
PVector machineDragOffset = new PVector (0.0, 0.0);
|
PVector machineDragOffset = new PVector (0.0, 0.0);
|
||||||
PVector lastMachineDragPosition = new PVector (0.0, 0.0);
|
PVector lastMachineDragPosition = new PVector (0.0, 0.0);
|
||||||
public final float MIN_SCALING = 0.1;
|
public final float MIN_SCALING = 0.01;
|
||||||
public final float MAX_SCALING = 15.0;
|
public final float MAX_SCALING = 30.0;
|
||||||
|
|
||||||
RShape vectorShape = null;
|
RShape vectorShape = null;
|
||||||
String vectorFilename = null;
|
String vectorFilename = null;
|
||||||
@ -489,8 +498,6 @@ static int pathLengthHighPassCutoff = 0;
|
|||||||
static final Integer PATH_LENGTH_HIGHPASS_CUTOFF_MAX = 10000;
|
static final Integer PATH_LENGTH_HIGHPASS_CUTOFF_MAX = 10000;
|
||||||
static final Integer PATH_LENGTH_HIGHPASS_CUTOFF_MIN = 0;
|
static final Integer PATH_LENGTH_HIGHPASS_CUTOFF_MIN = 0;
|
||||||
|
|
||||||
//Capture liveCamera;
|
|
||||||
//JMyron liveCamera;
|
|
||||||
BlobDetector blob_detector;
|
BlobDetector blob_detector;
|
||||||
int liveSimplification = 5;
|
int liveSimplification = 5;
|
||||||
int blurValue = 1;
|
int blurValue = 1;
|
||||||
@ -505,20 +512,16 @@ String shapeSavePath = "../../savedcaptures/";
|
|||||||
String shapeSavePrefix = "shape-";
|
String shapeSavePrefix = "shape-";
|
||||||
String shapeSaveExtension = ".svg";
|
String shapeSaveExtension = ".svg";
|
||||||
|
|
||||||
//boolean displayGamepadOverlay = false;
|
String filePath = null;
|
||||||
//PImage yButtonImage = null;
|
|
||||||
//PImage xButtonImage = null;
|
static PApplet parentPapplet = null;
|
||||||
//PImage aButtonImage = null;
|
|
||||||
//PImage bButtonImage = null;
|
|
||||||
//
|
|
||||||
//PImage dpadXImage = null;
|
|
||||||
//PImage dpadYImage = null;
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
println("Running polargraph controller");
|
println("Running polargraph controller");
|
||||||
frame.setResizable(true);
|
frame.setResizable(true);
|
||||||
initLogging();
|
initLogging();
|
||||||
|
parentPapplet = this;
|
||||||
|
|
||||||
initImages();
|
initImages();
|
||||||
|
|
||||||
@ -535,6 +538,7 @@ void setup()
|
|||||||
}
|
}
|
||||||
loadFromPropertiesFile();
|
loadFromPropertiesFile();
|
||||||
|
|
||||||
|
size(windowWidth, windowHeight, JAVA2D );
|
||||||
this.cp5 = new ControlP5(this);
|
this.cp5 = new ControlP5(this);
|
||||||
initTabs();
|
initTabs();
|
||||||
|
|
||||||
@ -580,7 +584,6 @@ void setup()
|
|||||||
|
|
||||||
currentMode = MODE_BEGIN;
|
currentMode = MODE_BEGIN;
|
||||||
preLoadCommandQueue();
|
preLoadCommandQueue();
|
||||||
size(windowWidth, windowHeight, JAVA2D );
|
|
||||||
changeTab(TAB_NAME_INPUT, TAB_NAME_INPUT);
|
changeTab(TAB_NAME_INPUT, TAB_NAME_INPUT);
|
||||||
|
|
||||||
addEventListeners();
|
addEventListeners();
|
||||||
@ -1224,34 +1227,32 @@ void controlEvent(ControlEvent controlEvent)
|
|||||||
{
|
{
|
||||||
if (controlEvent.isTab())
|
if (controlEvent.isTab())
|
||||||
{
|
{
|
||||||
if (controlEvent.tab().name() == getCurrentTab())
|
if (controlEvent.tab().getName() == getCurrentTab())
|
||||||
{
|
{
|
||||||
// already here.
|
// already here.
|
||||||
println("Already here.");
|
println("Already here.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
changeTab(currentTab, controlEvent.tab().name());
|
changeTab(currentTab, controlEvent.tab().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(controlEvent.isGroup())
|
else if(controlEvent.isGroup())
|
||||||
{
|
{
|
||||||
print("got an event from "+controlEvent.group().name()+"\t");
|
print("got an event from "+controlEvent.group().getName()+"\t");
|
||||||
|
|
||||||
// checkbox uses arrayValue to store the state of
|
// checkbox uses arrayValue to store the state of
|
||||||
// individual checkbox-items. usage:
|
// individual checkbox-items. usage:
|
||||||
for (int i=0; i<controlEvent.group().arrayValue().length; i++)
|
for (int i=0; i<controlEvent.group().getArrayValue().length; i++)
|
||||||
{
|
{
|
||||||
int n = (int)controlEvent.group().arrayValue()[i];
|
int n = (int)controlEvent.group().getArrayValue()[i];
|
||||||
}
|
}
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeTab(String from, String to)
|
void changeTab(String from, String to)
|
||||||
{
|
{
|
||||||
|
|
||||||
// hide old panels
|
// hide old panels
|
||||||
currentTab = to;
|
currentTab = to;
|
||||||
for (Panel panel : getPanelsForTab(currentTab))
|
for (Panel panel : getPanelsForTab(currentTab))
|
||||||
@ -1262,7 +1263,6 @@ void changeTab(String from, String to)
|
|||||||
c.show();
|
c.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1334,8 +1334,12 @@ boolean mouseOverPanel()
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (Panel panel : getPanelsForTab(currentTab))
|
for (Panel panel : getPanelsForTab(currentTab))
|
||||||
{
|
{
|
||||||
if (panel.getOutline().surrounds(getMouseVector()))
|
if (panel.getOutline().surrounds(getMouseVector())) {
|
||||||
|
println("Outline: " + panel.getOutline().toString());
|
||||||
|
println("OVER PANEL!" + panel.getName());
|
||||||
result = true;
|
result = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1745,7 +1749,7 @@ void previewQueue()
|
|||||||
String aLenStr = splitted[1];
|
String aLenStr = splitted[1];
|
||||||
String bLenStr = splitted[2];
|
String bLenStr = splitted[2];
|
||||||
|
|
||||||
PVector endPoint = new PVector(Integer.parseInt(aLenStr), Integer.parseInt(bLenStr));
|
PVector endPoint = new PVector(Integer.parseInt(aLenStr)+previewCordOffset, Integer.parseInt(bLenStr)+previewCordOffset);
|
||||||
endPoint = getDisplayMachine().asCartesianCoords(endPoint);
|
endPoint = getDisplayMachine().asCartesianCoords(endPoint);
|
||||||
endPoint = getDisplayMachine().inMM(endPoint);
|
endPoint = getDisplayMachine().inMM(endPoint);
|
||||||
|
|
||||||
@ -1834,8 +1838,8 @@ void exportQueueToFile()
|
|||||||
{
|
{
|
||||||
if (!commandQueue.isEmpty() || !realtimeCommandQueue.isEmpty())
|
if (!commandQueue.isEmpty() || !realtimeCommandQueue.isEmpty())
|
||||||
{
|
{
|
||||||
String savePath = selectOutput(); // Opens file chooser
|
selectOutput("Enter a filename to save to:", "fileSelected"); // Opens file chooser
|
||||||
if (savePath == null)
|
if (filePath == null)
|
||||||
{
|
{
|
||||||
// If a file was not selected
|
// If a file was not selected
|
||||||
println("No output file was selected...");
|
println("No output file was selected...");
|
||||||
@ -1843,29 +1847,41 @@ void exportQueueToFile()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If a file was selected, print path to folder
|
// If a file was selected, print path to folder
|
||||||
println("Output file: " + savePath);
|
println("Output file: " + filePath);
|
||||||
List<String> allCommands = new ArrayList<String>(realtimeCommandQueue);
|
List<String> allCommands = new ArrayList<String>(realtimeCommandQueue);
|
||||||
allCommands.addAll(commandQueue);
|
allCommands.addAll(commandQueue);
|
||||||
|
|
||||||
String[] list = (String[]) allCommands.toArray(new String[0]);
|
String[] list = (String[]) allCommands.toArray(new String[0]);
|
||||||
saveStrings(savePath, list);
|
saveStrings(filePath, list);
|
||||||
println("Completed queue export, " + list.length + " commands exported.");
|
println("Completed queue export, " + list.length + " commands exported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fileSelected(File selection) {
|
||||||
|
if (selection == null) {
|
||||||
|
println("Window was closed or the user hit cancel.");
|
||||||
|
filePath = null;
|
||||||
|
} else {
|
||||||
|
println("User selected " + selection.getAbsolutePath());
|
||||||
|
filePath = selection.getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void importQueueFromFile()
|
void importQueueFromFile()
|
||||||
{
|
{
|
||||||
commandQueue.clear();
|
commandQueue.clear();
|
||||||
String loadPath = selectInput();
|
selectInput("Select file to import queue from", "fileSelected");
|
||||||
if (loadPath == null)
|
if (filePath == null)
|
||||||
{
|
{
|
||||||
// nothing selected
|
// nothing selected
|
||||||
println("No input file was selected.");
|
println("No input file was selected.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
println("Input file: " + loadPath);
|
println("Input file: " + filePath);
|
||||||
String commands[] = loadStrings(loadPath);
|
String commands[] = loadStrings(filePath);
|
||||||
// List<String> list = Arrays
|
// List<String> list = Arrays
|
||||||
commandQueue.addAll(Arrays.asList(commands));
|
commandQueue.addAll(Arrays.asList(commands));
|
||||||
println("Completed queue import, " + commandQueue.size() + " commands found.");
|
println("Completed queue import, " + commandQueue.size() + " commands found.");
|
||||||
@ -1874,17 +1890,17 @@ void importQueueFromFile()
|
|||||||
|
|
||||||
String importTextToWriteFromFile()
|
String importTextToWriteFromFile()
|
||||||
{
|
{
|
||||||
String loadPath = selectInput();
|
selectInput("Select the text file to load the text from:", "fileSelected");
|
||||||
String result = "";
|
String result = "";
|
||||||
if (loadPath == null)
|
if (filePath == null)
|
||||||
{
|
{
|
||||||
// nothing selected
|
// nothing selected
|
||||||
println("No input file was selected.");
|
println("No input file was selected.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
println("Input file: " + loadPath);
|
println("Input file: " + filePath);
|
||||||
List<String> rows = java.util.Arrays.asList(loadStrings(loadPath));
|
List<String> rows = java.util.Arrays.asList(loadStrings(filePath));
|
||||||
StringBuilder sb = new StringBuilder(200);
|
StringBuilder sb = new StringBuilder(200);
|
||||||
for (String row : rows)
|
for (String row : rows)
|
||||||
{
|
{
|
||||||
@ -3063,10 +3079,12 @@ float getPixelScalingOverGridSize()
|
|||||||
{
|
{
|
||||||
return pixelScalingOverGridSize;
|
return pixelScalingOverGridSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPixelScalingOverGridSize(float scaling)
|
void setPixelScalingOverGridSize(float scaling)
|
||||||
{
|
{
|
||||||
pixelScalingOverGridSize = scaling;
|
pixelScalingOverGridSize = scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDensityPreviewStyle()
|
int getDensityPreviewStyle()
|
||||||
{
|
{
|
||||||
return densityPreviewStyle;
|
return densityPreviewStyle;
|
||||||
@ -3076,14 +3094,17 @@ Integer getBaudRate()
|
|||||||
{
|
{
|
||||||
return baudRate;
|
return baudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isUseWindowedConsole()
|
boolean isUseWindowedConsole()
|
||||||
{
|
{
|
||||||
return this.useWindowedConsole;
|
return this.useWindowedConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUseWindowedConsole(boolean use)
|
void setUseWindowedConsole(boolean use)
|
||||||
{
|
{
|
||||||
this.useWindowedConsole = use;
|
this.useWindowedConsole = use;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initLogging()
|
void initLogging()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -3094,21 +3115,22 @@ void initLogging()
|
|||||||
// logger.addHandler(fileHandler);
|
// logger.addHandler(fileHandler);
|
||||||
// logger.setLevel(Level.INFO);
|
// logger.setLevel(Level.INFO);
|
||||||
// logger.info("Hello");
|
// logger.info("Hello");
|
||||||
if (isUseWindowedConsole())
|
// if (isUseWindowedConsole())
|
||||||
{
|
// {
|
||||||
console = new Console();
|
// console = new Console();
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
console.close();
|
// console.close();
|
||||||
console = null;
|
// console = null;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
println("Exception setting up logger: " + e.getMessage());
|
println("Exception setting up logger: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initImages()
|
void initImages()
|
||||||
{
|
{
|
||||||
// try
|
// try
|
||||||
|
34
tabSetup.pde
34
tabSetup.pde
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2015.
|
||||||
|
|
||||||
This file is part of Polargraph Controller.
|
This file is part of Polargraph Controller.
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
sandy.noble@gmail.com
|
sandy.noble@gmail.com
|
||||||
http://www.polargraph.co.uk/
|
http://www.polargraph.co.uk/
|
||||||
http://code.google.com/p/polargraph/
|
https://github.com/euphy/polargraphcontroller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Set<Panel> getPanelsForTab(String tabName)
|
Set<Panel> getPanelsForTab(String tabName)
|
||||||
@ -83,25 +83,25 @@ List<String> buildTabNames()
|
|||||||
|
|
||||||
void initTabs()
|
void initTabs()
|
||||||
{
|
{
|
||||||
cp5.tab(TAB_NAME_INPUT).setLabel(TAB_LABEL_INPUT);
|
cp5.getTab(TAB_NAME_INPUT).setLabel(TAB_LABEL_INPUT);
|
||||||
cp5.tab(TAB_NAME_INPUT).activateEvent(true);
|
cp5.getTab(TAB_NAME_INPUT).activateEvent(true);
|
||||||
cp5.tab(TAB_NAME_INPUT).setId(1);
|
cp5.getTab(TAB_NAME_INPUT).setId(1);
|
||||||
|
|
||||||
cp5.tab(TAB_NAME_DETAILS).setLabel(TAB_LABEL_DETAILS);
|
cp5.getTab(TAB_NAME_DETAILS).setLabel(TAB_LABEL_DETAILS);
|
||||||
cp5.tab(TAB_NAME_DETAILS).activateEvent(true);
|
cp5.getTab(TAB_NAME_DETAILS).activateEvent(true);
|
||||||
cp5.tab(TAB_NAME_DETAILS).setId(2);
|
cp5.getTab(TAB_NAME_DETAILS).setId(2);
|
||||||
|
|
||||||
cp5.tab(TAB_NAME_ROVING).setLabel(TAB_LABEL_ROVING);
|
cp5.getTab(TAB_NAME_ROVING).setLabel(TAB_LABEL_ROVING);
|
||||||
cp5.tab(TAB_NAME_ROVING).activateEvent(true);
|
cp5.getTab(TAB_NAME_ROVING).activateEvent(true);
|
||||||
cp5.tab(TAB_NAME_ROVING).setId(3);
|
cp5.getTab(TAB_NAME_ROVING).setId(3);
|
||||||
|
|
||||||
cp5.tab(TAB_NAME_TRACE).setLabel(TAB_LABEL_TRACE);
|
cp5.getTab(TAB_NAME_TRACE).setLabel(TAB_LABEL_TRACE);
|
||||||
cp5.tab(TAB_NAME_TRACE).activateEvent(true);
|
cp5.getTab(TAB_NAME_TRACE).activateEvent(true);
|
||||||
cp5.tab(TAB_NAME_TRACE).setId(4);
|
cp5.getTab(TAB_NAME_TRACE).setId(4);
|
||||||
|
|
||||||
cp5.tab(TAB_NAME_QUEUE).setLabel(TAB_LABEL_QUEUE);
|
cp5.getTab(TAB_NAME_QUEUE).setLabel(TAB_LABEL_QUEUE);
|
||||||
cp5.tab(TAB_NAME_QUEUE).activateEvent(true);
|
cp5.getTab(TAB_NAME_QUEUE).activateEvent(true);
|
||||||
cp5.tab(TAB_NAME_QUEUE).setId(5);
|
cp5.getTab(TAB_NAME_QUEUE).setId(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> buildPanelNames()
|
public Set<String> buildPanelNames()
|
||||||
|
Loading…
Reference in New Issue
Block a user