+
+ * version 0.5.3
+
+ * src/controlP5/ListBox.java:
+ adding clear(). clears a ListBox in order to re-filling list.
+
+ * src/controlP5/ListBox.java:
+ changing behavior of a ListBox-Button.
+ a ListBox-button is clicked, it will call the Button's onLeave()
+ and setIsInside(false) function to solve problem addressed here:
+ http://forum.processing.org/topic/controlp5-listbox-loses-mouseclicks
+
+ * src/controlP5/ListBox.java:
+ adding actAsPulldownMenu() to enable/disable pulldown
+ functionality for a ListBox.
+
+ * src/controlP5/PulldownMenu.java:
+ new Controller, extends ListBox, acts as a pulldown-menu.
+
+
+2010-08-03 Andreas Schlegel
+ * version 0.5.2
+ * Slider2D: a new Controller, 2D slider control.
+ * Button, Bang, Toggle, : setImage() defines an image for DEFAULT,OVER,ACTIVE,HIGHLIGHT mode.
+ * Button, Bang, Toggle, : setImages() defines an image for DEFAULT,OVER,ACTIVE,HIGHLIGHT mode.
+ * Button: adding setSwitch() in order to use a button as a switch (makes toggle obsolete)
+ * Button: adding booleanValue() returns true or false, useful in case a button is set to be a switch.
+ * Button: adding setOn() setOff(), useful when button is a switch.
+ * Toggle: changing default look to ControlP5.SWITCH, an on/off look for toggles. use toggle.setMode(ControlP5.DEFAULT) to reset to the old default look.
+ * ControllerDisplay: adding interface ControllerDisplay to enable custom displays for a controller.
+ * Controller: setImage, allows to replace the default look of a controller with an image (PImage).
+ * Controller: setDisplay allows custom displays for controller. the custom display is called from within a controller's draw function. A custom Display implements interface ControllerDisplay
+ * Controller: adding lock(), unlock(), isLock(), setMoveable(), isMoveable(), isUserInteraction(), setUserInteraction()
+ * Controller: adding plugTo(), unplugFrom() (if this causes any problems or error message, please report)
+ * ControlP5: adding java.util.logging.Logger for logging error, debug, info messages - wrapped in ControlP5.error(), ControlP5.warning(), ControlP5.info(), ControlP5.debug()
+ * ControlP5: added registerDispose()
+ * ControlP5: adding setMoveable() and isMoveable() to disable/enable controllers to be moved around.
+ * ControlP5: adding disableShortcuts(), enableShortcuts() instead of disableKeys() and enableKeys()
+ * ControlP5: deprecating lock(), unlock(), disableKeys(), enableKeys()
+ * ControlWindow: adding begin() and end(). this allows to move controllers automatically to the main window or a separate controlWindow.
+ * Toggle: adding setValue(boolean)
+ * Matrix: mouseReleasedOutside error fixed.
+ * ControlWindow: window is now properly removed when closed, thanks henri.
+ * TextLabel: adding setControlFont()
+ * Knob: all new.
+
+2010-04-04 Andreas Schlegel
+ * version 0.5.1
+ * ControlP5: lock() and unlock() are working again.
+ * ControlEvent: added function id() to make access to the id of controller, group, tab, etc. easier
+ * ControlEvent: added function type() for easier distinguishing between the type of Controller the event was triggered from, returns ControlEvent.UNDEFINED, ControlEvent.CONTROLLER, ControlEvent.TAB, ControlEvent.GROUP
+ * ListBoxItem: adding ListBoxItem to make changes to each item of a listBox especially the color settings of a listBoxItem.
+ * CColor: now with getter and setter functions, supports changing the value of the alpha channel.
+ * ControlWindow: adding begin() and end(). this allows to move controllers automatically to the main window or a separate controlWindow.
+ * ControllerGroup: adding enableCollapse(), disableCollapse(), isCollapse() to enable/disable the collapsing and opening of a controllerGroup e.g. listBox.
+
+2010-03-26 Andreas Schlegel
+ * version 0.5.0
+ * making transition to 1.5+, no more java 1.4 support.
+ * compiling against processing 1.1
+ * ControlP5: added disableKeys() and enableKeys(), suggested in the discourse. disables and enables keyEvents such as hide/show with ALT-h.
+ * Toggle: when inactive, the color refers to colorBackground instead of colorForeground now.
+ * ControlFont: smooth related functions have been disabled and deprecated due to processing 1.1 changes.
+ * Slider: use alignValueLabel() to position the value label of a slider on TOP, CENTER, or BOTTOM
+ * example ControlP5quick: new, ControlP5quick shows how to quickly add Controllers with auto-arrangement.
+
+2010-02-16 Andreas Schlegel
+ * version 0.4.7
+ * Slider: adding TickMarks and replacing steps with snapToTickMarks().
+ * ControlWindow: adding setUndecorated(), isUndecorated(), toggleUndecorated()
+ * ControllerSprite: sprites are now clone-able and state management has been improved, thanks to c.a. church. http://processing.org/discourse/yabb2/YaBB.pl?num=1265905257
+ * Controller: adding getSprite()
+ * BitFontRenderer: adding warning for character that are not supported by the BitFontRenderer.
+
+2010-02-06 Andreas Schlegel
+ * version 0.4.6
+ * ControlWindow: imageMode was not set back to CENTER/CORNER correctly, now fixed.
+
+0.4.5
+ * ControllerGroup: adding moveTo(String). will move ControllerGroups such as e.g. Textarea to another tab.
+
+0.4.4
+ * ControlWindow: imageMode CENTER/CORNER issue fixed.
+
+0.4.3
+ * Controller.isInside is private now. use setIsInside(true/false) and getIsInside() to access this boolean field.
+ * trying to solve the problem of overlapping described here:
+ http://processing.org/discourse/yabb2/YaBB.pl?num=1259885420/0#0
+ yet not successful, but loops managing the mouseEvents have been reversed from i++ to i--
+ * CheckBox,RadioButton: adding activateAll, activate, deactivate, getState to CheckBox and RadioButton to be able to control individual items by code.
+ * CheckBox: adding toggle() to CheckBox to be able to toggle individual items of a checkBox.
+ * CheckBox,RadioButton: adding setItemHeight(), setItemWidth() to radioButton and checkBox
+ * Toggle: adding toggle()
+
+0.4.2
+-
+
+0.4.1
+ * Controller: added changeValue() to change the float value of a controller without broadcasting its change as a event.
+ * Numberbox: added setMultiplier() and multiplier() to customize the value sensitivity.
+ * Toggle: setLabelVisible() is now working.
+ * ControlWindow: adding setTitle, showCoordinates, hideCoordinates to ControlWindow. only applies to controlWindows of type PAppletWindow (external window).
+ * adding Matrix.set
+ * Controller: Controller.isInside() is public now
+ * added ControlFont. does not support textarea and textfield yet.
+
+(note: take a look at subversion changelog generator http://ch.tudelft.nl/~arthur/svn2cl/)
+
+0.3.15
+ * Texfield: textfield scrolls to the left if text is larger than display area.
+ * Knob: knob setValue issue solved.
+
+ * BitFontRenderer: removed getWidth(String theText, int theFontIndex)
+ is now getWidth(String theText, Label theLabel);
+ removed getWidth(String theText, int theFontIndex, int theLength))
+ is now getWidth(String theText, Label theLabel, int theLength));
+
+
+0.3.14
+ * ScrollList: adding void hideScrollbar()
+ adding void showScrollbar()
+ adding void showScrollbar()
+ adding void scroll(float)
+ adding boolean isScrollbarVisible()
+
+ * Textarea: adding void hideScrollbar()
+ adding void showScrollbar()
+ adding void showScrollbar()
+ adding void scroll(float)
+ adding boolean isScrollbarVisible()
+
+ * Textfield: textinput now works from a controlWindow
+
+ * Label: adding adjust() to fix the cutting off of Labels when changing fonts.
+ use e.g. mySlider.captionLabel().setFont(ControlP5.grixel).adjust();
+
+0.3.13
+ * Textfield: adding setAutoClear(true/false) prevents the textfield to be cleared after pressing RETURN.
+ adding clear(), clears the current textline
+ adding keepFocus(true/false)
+ adding getTextList()
+ adding setAutoClear(true/false)
+ adding isAutoClear()
+ adding submit()
+
+0.3.12
+ * Radio: if deactiveAll is set before the first button is added, the first button will not trigger an event.
+ * ControlGroup: added method getBackgroundHeight() to get the height of a group's background that has been set before.
+ * Textfield: fixed bug with clearing the variable myTextline too early.
+
+0.3.11
+ * Textfield: added method setText to Textfield
+ * Range: made corrections to Range, _myUnit was not set properly. now fixed. Range remains experimental.
+
+0.3.10
+ * fixed little issues with setColor, again.
+ * removed decimal point when setDecimalPrecision(0)
+
+0.3.9
+ * Range: defaultValue for min shows correct value now.
+ * Radio: added deactivateAll()
+ * TextLabel: added setWidth, setHeight
+ * setColor -Label(), -Active(), -Value(), -Foreground(), -Background(): issues resolved and tested for slider, range, button, knob, sliderlist, multilist, toggle, radio
+ * Controller: added method setDecimalPrecision(int theNum) to set the decimal precision for floats when displayed as valueLabel. the precision does not apply to the returned float value.
+ Controller.captionLabel().set("txt") is fixed.
+ * ControlP5: controlP5.setAutoDraw(true/false) issue is fixed.
+ * ControlWindow: controlWindow.post() has been deleted.
+ * Knob: issue with minimum value has been resolved.
+
+how to move a textlabel that has been created with "new" to a tab other than the default:
+Tab myTab = controlP5.addTab("new");
+Textlabel myTextlabel = new Textlabel(this,"a single textlabel.",20,100,400,200,0xffff0000,ControlP5.synt24);
+myTab.addDrawable(myTextlabel);
+
diff --git a/out/production/controlp5/controlP5/package.html b/out/production/controlp5/controlP5/package.html
new file mode 100755
index 0000000..132bc08
--- /dev/null
+++ b/out/production/controlp5/controlP5/package.html
@@ -0,0 +1,16 @@
+
+
+
+controlP5 documentation
+
+
+
+ControlP5
+ControlP5 (www.sojamo.de/libraries/controlP5) is a library written by Andreas Schlegel for the programming environment processing. ControlP5 is a GUI and controller library for processing that can be used in authoring, application mode. Controllers including Sliders, Buttons, Toggles, Knobs, Textfields, RadioButtons, Checkboxes amongst others can be easily added to a processing sketch and can be arranged in separate control windows, or can be organized in tabs or groups. The controlP5 source code repository is available on github at github.com/sojamo/controlp5.
+
+Javascript
+Currently there is no javascript version of ControlP5, though I had started implementing a slimmed down version for processing.js but since it is currently unclear which javascript version, processing.js or p5.js, will become the default js version of processing, controlP5.js is on hold.
+
+
+
diff --git a/out/production/controlp5/sketch/Sketch.class b/out/production/controlp5/sketch/Sketch.class
new file mode 100644
index 0000000..b571c9e
Binary files /dev/null and b/out/production/controlp5/sketch/Sketch.class differ
diff --git a/out/production/examples/MidiMapper.pde b/out/production/examples/MidiMapper.pde
new file mode 100644
index 0000000..1bbce64
--- /dev/null
+++ b/out/production/examples/MidiMapper.pde
@@ -0,0 +1,123 @@
+
+
+/**
+ * ControlP5 MidiMapper
+ *
+ * Maps midi input to controlP5 controllers.
+ * This will eventually result in a library.
+ *
+ * by Andreas Schlegel, 2013
+ * www.sojamo.de/libraries/controlp5
+ *
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+import controlP5.*;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.MidiMessage;
+
+ControlP5 cp5;
+
+Map midimapper = new HashMap();
+
+void setup() {
+
+ size( 600, 400 );
+
+ cp5 = new ControlP5( this );
+
+ cp5.begin(cp5.addTab("a"));
+ cp5.addSlider("a-1").setPosition(20, 120).setSize(200, 20);
+ cp5.addSlider("a-2").setPosition(20, 160).setSize(200, 20);
+ cp5.addSlider("a-3").setPosition(20, 200).setSize(200, 20);
+ cp5.addToggle("a-4").setPosition(280, 120).setSize(100, 20);
+ cp5.addButton("a-5").setPosition(280, 160).setSize(100, 20);
+ cp5.addBang("a-6").setPosition(280, 200).setSize(100, 20);
+ cp5.end();
+
+ cp5.begin(cp5.addTab("b"));
+ cp5.addSlider("b-1").setPosition(20, 120).setSize(200, 20);
+ cp5.addSlider("b-2").setPosition(20, 160).setSize(200, 20);
+ cp5.addSlider("b-3").setPosition(20, 200).setSize(200, 20);
+ cp5.end();
+
+ final String device = "SLIDER/KNOB";
+
+ //midimapper.clear();
+
+ midimapper.put( ref( device, 0 ), "a-1" );
+ midimapper.put( ref( device, 1 ), "a-2" );
+ midimapper.put( ref( device, 2 ), "a-3" );
+ midimapper.put( ref( device, 32 ), "a-4" );
+ midimapper.put( ref( device, 48 ), "a-5" );
+ midimapper.put( ref( device, 64 ), "a-6" );
+
+ midimapper.put( ref( device, 16 ), "b-1" );
+ midimapper.put( ref( device, 17 ), "b-2" );
+ midimapper.put( ref( device, 18 ), "b-3" );
+
+ boolean DEBUG = false;
+
+ if (DEBUG) {
+ new MidiSimple( device );
+ }
+ else {
+ new MidiSimple( device , new Receiver() {
+
+ @Override public void send( MidiMessage msg, long timeStamp ) {
+
+ byte[] b = msg.getMessage();
+
+ if ( b[ 0 ] != -48 ) {
+
+ Object index = ( midimapper.get( ref( device , b[ 1 ] ) ) );
+
+ if ( index != null ) {
+
+ Controller c = cp5.getController(index.toString());
+ if (c instanceof Slider ) {
+ float min = c.getMin();
+ float max = c.getMax();
+ c.setValue(map(b[ 2 ], 0, 127, min, max) );
+ } else if ( c instanceof Button ) {
+ if ( b[ 2 ] > 0 ) {
+ c.setValue( c.getValue( ) );
+ c.setColorBackground( 0xff08a2cf );
+ } else {
+ c.setColorBackground( 0xff003652 );
+ }
+ } else if ( c instanceof Bang ) {
+ if ( b[ 2 ] > 0 ) {
+ c.setValue( c.getValue( ) );
+ c.setColorForeground( 0xff08a2cf );
+ } else {
+ c.setColorForeground( 0xff00698c );
+ }
+ } else if ( c instanceof Toggle ) {
+ if ( b[ 2 ] > 0 ) {
+ ( ( Toggle ) c ).toggle( );
+ }
+ }
+ }
+ }
+ }
+
+ @Override public void close( ) {
+ }
+ }
+ );
+ }
+}
+
+
+String ref(String theDevice, int theIndex) {
+ return theDevice+"-"+theIndex;
+}
+
+
+void draw() {
+ background( 0 );
+}
+
+
diff --git a/out/production/resources/ant-contrib-1.0b3.jar b/out/production/resources/ant-contrib-1.0b3.jar
new file mode 100644
index 0000000..0625376
Binary files /dev/null and b/out/production/resources/ant-contrib-1.0b3.jar differ
diff --git a/out/production/resources/doc.sh b/out/production/resources/doc.sh
new file mode 100644
index 0000000..1db9a92
--- /dev/null
+++ b/out/production/resources/doc.sh
@@ -0,0 +1,18 @@
+# a shell script to create a java documentation
+# for a processing library.
+#
+# make changes to the variables below so they
+# fit the structure of your library
+
+# the package name of your library
+package=template;
+
+# source folder location
+src=../src;
+
+# the destination folder of your documentation
+dest=../documentation;
+
+
+# compile the java documentation
+javadoc -d $dest -stylesheetfile ./stylesheet.css -sourcepath ${src} ${package}
diff --git a/resources/addons/addons.iml b/resources/addons/addons.iml
new file mode 100644
index 0000000..2b9413b
--- /dev/null
+++ b/resources/addons/addons.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/resources.iml b/resources/resources.iml
new file mode 100644
index 0000000..d3b4689
--- /dev/null
+++ b/resources/resources.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/controlP5/ControlWindow.java b/src/controlP5/ControlWindow.java
index 968d172..1172bbf 100755
--- a/src/controlP5/ControlWindow.java
+++ b/src/controlP5/ControlWindow.java
@@ -840,12 +840,12 @@ public final class ControlWindow {
public ControlWindow setUndecorated( boolean theFlag ) {
if ( theFlag != isUndecorated( ) ) {
isUndecorated = theFlag;
- _myApplet.frame.removeNotify( );
- _myApplet.frame.setUndecorated( isUndecorated );
+ //_myApplet.frame.removeNotify( );
+ //_myApplet.frame.setUndecorated( isUndecorated );
_myApplet.setSize( _myApplet.width , _myApplet.height );
- _myApplet.setBounds( 0 , 0 , _myApplet.width , _myApplet.height );
- _myApplet.frame.setSize( _myApplet.width , _myApplet.height );
- _myApplet.frame.addNotify( );
+ //_myApplet.setBounds( 0 , 0 , _myApplet.width , _myApplet.height );
+ //_myApplet.frame.setSize( _myApplet.width , _myApplet.height );
+ //_myApplet.frame.addNotify( );
}
return this;
}
@@ -859,7 +859,7 @@ public final class ControlWindow {
}
public ControlWindow setLocation( int theX , int theY ) {
- _myApplet.frame.setLocation( theX , theY );
+ //_myApplet.frame.setLocation( theX , theY );
return this;
}
diff --git a/src/controlP5/Textfield.java b/src/controlP5/Textfield.java
index b42957c..bc00e2e 100755
--- a/src/controlP5/Textfield.java
+++ b/src/controlP5/Textfield.java
@@ -71,7 +71,7 @@ public class Textfield extends Controller< Textfield > {
protected boolean isPasswordMode;
protected boolean autoclear = true;
protected int _myColorCursor = 0x88ffffff;
- private PGraphics buffer;
+ protected PGraphics buffer;
public enum InputFilter {
INTEGER(Arrays.asList( '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' )), FLOAT(Arrays.asList( '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '.' )), BITFONT(Arrays.asList( '\n' , '\r' , ' ' , '!' , '"' , '#' , '$' , '%' ,
diff --git a/src/controlP5/TextfieldMultiline.java b/src/controlP5/TextfieldMultiline.java
new file mode 100755
index 0000000..34a0d3b
--- /dev/null
+++ b/src/controlP5/TextfieldMultiline.java
@@ -0,0 +1,223 @@
+package controlP5;
+
+import processing.core.PApplet;
+import processing.core.PGraphics;
+
+import java.util.ArrayList;
+
+import controlP5.ControlEvent;
+import controlP5.ControlFont;
+import controlP5.ControlListener;
+import controlP5.ControlP5;
+import controlP5.Slider;
+import controlP5.Textfield;
+
+/**
+ * a textarea can be used to leave notes, it uses the controlP5 BitFont to
+ * render text. Scrollbars
+ * will automatically be added when text extends the visible area. Textarea
+ * extends ControllerGroup,
+ * for more methods available see the ControllerGroup documentation.
+ *
+ * @example controllers/ControlP5textarea
+ */
+
+public class TextfieldMultiline extends Textfield implements ControlListener {
+
+ public boolean isScrollbarVisible = false;
+ protected Slider _myScrollbar;
+
+ public int _myWidth = 300;
+ protected int _myTextBufferRowIndex = 0;
+ protected int _myTextBufferColumnIndex = 0;
+
+ private ArrayList _myTextBuffer = new ArrayList();
+
+ public TextfieldMultiline(ControlP5 theControlP5, String theName) {
+ super(theControlP5, theName);
+ _myValueLabel.setLabeltype(_myValueLabel.new MultilineLabel());
+ _myTextBuffer = new ArrayList<>(_myTextBuffer);
+ keyMapping.put(ENTER, new NewLine());
+ keyMapping.put(DOWN, new MoveDown());
+ keyMapping.put(UP, new MoveUp());
+ keyMapping.put(LEFT, new MoveLeft());
+ keyMapping.put(RIGHT, new MoveRight());
+ keyMapping.put(DEFAULT, new InsertCharacter());
+ keyMapping.put(BACKSPACE, new DeleteCharacter());
+ }
+
+ class InsertCharacter implements TextfieldCommand {
+
+ public void execute() {
+
+ if ((int) (cp5.getKey()) == 65535) {
+ return;
+ }
+
+ if (_myInputFilter.apply(cp5.getKey())) {
+
+ _myTextBuffer.get(_myTextBufferRowIndex).insert(_myTextBufferColumnIndex, (char) cp5.getKey());
+ _myTextBufferColumnIndex += 1;
+
+ }
+ }
+ }
+
+ class DeleteCharacter implements TextfieldCommand {
+ public void execute() {
+ if (_myTextBufferColumnIndex > 0) {
+ _myTextBuffer.get(_myTextBufferRowIndex).deleteCharAt(_myTextBufferColumnIndex - 1);
+ _myTextBufferColumnIndex -= 1;
+ }
+ }
+ }
+
+ class NewLine implements TextfieldCommand {
+ public void execute() {
+ _myTextBuffer.add(_myTextBufferRowIndex + 1, new StringBuffer());
+ _myTextBufferRowIndex += 1;
+ _myTextBufferColumnIndex = 0;
+ }
+ }
+
+ class MoveDown implements TextfieldCommand {
+ public void execute() {
+ // if not at the last line
+ if (_myTextBufferRowIndex < _myTextBuffer.size() - 1) {
+ // if the next line is shorter than the current line
+ // set cursor to the end of the next line
+ if (_myTextBuffer.get(_myTextBufferRowIndex + 1).length() < _myTextBufferColumnIndex) {
+ _myTextBufferColumnIndex = _myTextBuffer.get(_myTextBufferRowIndex + 1).length();
+ }
+ _myTextBufferRowIndex += 1;
+ }
+ }
+ }
+
+ class MoveUp implements TextfieldCommand {
+ public void execute() {
+ if (_myTextBufferRowIndex > 0) {
+ // if the next line is shorter than the current line
+ // set cursor to the end of the next line
+ if (_myTextBuffer.get(_myTextBufferRowIndex - 1).length() < _myTextBufferColumnIndex) {
+ _myTextBufferColumnIndex = _myTextBuffer.get(_myTextBufferRowIndex - 1).length();
+ }
+ _myTextBufferRowIndex -= 1;
+ }
+
+ }
+ }
+
+ class MoveLeft implements TextfieldCommand {
+ public void execute() {
+ // if not at the first char
+ if(_myTextBufferColumnIndex > 0) {
+ _myTextBufferColumnIndex -= 1;
+ }// if at the first char of a line
+ else if(_myTextBufferColumnIndex == 0 && _myTextBufferRowIndex > 0) {
+ _myTextBufferRowIndex -= 1;
+ _myTextBufferColumnIndex = _myTextBuffer.get(_myTextBufferRowIndex).length();
+ }
+ }
+ }
+
+ class MoveRight implements TextfieldCommand {
+ public void execute() {
+ if(_myTextBufferColumnIndex < _myTextBuffer.get(_myTextBufferRowIndex).length()) {
+ _myTextBufferColumnIndex += 1;
+ }else if (_myTextBufferColumnIndex == _myTextBuffer.get(_myTextBufferRowIndex).length() && _myTextBufferRowIndex < _myTextBuffer.size() - 1) {
+ _myTextBufferRowIndex += 1;
+ _myTextBufferColumnIndex = 0;
+ }
+ }
+ }
+
+ @Override
+ public void controlEvent(ControlEvent theEvent) {
+
+ }
+
+ @Override
+ public void draw(PGraphics theGraphics) {
+
+ theGraphics.pushStyle();
+ theGraphics.fill(color.getBackground());
+ theGraphics.pushMatrix();
+ theGraphics.translate(x(position), y(position));
+ theGraphics.rect(0, 0, getWidth(), getHeight());
+ theGraphics.noStroke();
+
+ theGraphics.fill(_myColorCursor);
+ theGraphics.pushMatrix();
+ theGraphics.pushStyle();
+
+ buffer.beginDraw();
+ buffer.background(0, 0);
+ final String text = getText();
+ final int textWidth = ControlFont.getWidthFor(text.substring(0, _myTextBufferColumnIndex), _myValueLabel,buffer);
+ final int dif = PApplet.max(textWidth - _myValueLabel.getWidth(), 0);
+ final String thisLine = _myTextBuffer.get(_myTextBufferRowIndex).toString();
+ final int _myTextBufferIndexPosition = ControlFont.getWidthFor(thisLine.substring(0, _myTextBufferColumnIndex),
+ _myValueLabel, buffer);
+ _myValueLabel.setText(text);
+ _myValueLabel.draw(buffer, -dif, 0, this);
+ buffer.noStroke();
+ if (isTexfieldActive) {
+ if (!cp5.papplet.keyPressed) {
+ buffer.fill(_myColorCursor, PApplet.abs(PApplet.sin(cp5.papplet.frameCount * 0.05f)) * 255);
+ } else {
+ buffer.fill(_myColorCursor);
+ }
+
+ buffer.rect(PApplet.max(1, PApplet.min(_myTextBufferIndexPosition, _myValueLabel.getWidth() - 3)),
+ (_myTextBufferRowIndex) * _myValueLabel.getLineHeight(), 1, 10);
+ }
+ buffer.endDraw();
+ theGraphics.image(buffer, 0, 0);
+
+ theGraphics.popStyle();
+ theGraphics.popMatrix();
+
+ theGraphics.fill(isTexfieldActive ? color.getActive() : color.getForeground());
+ theGraphics.rect(0, 0, getWidth(), 1);
+ theGraphics.rect(0, getHeight() - 1, getWidth(), 1);
+ theGraphics.rect(-1, 0, 1, getHeight());
+ theGraphics.rect(getWidth(), 0, 1, getHeight());
+ _myCaptionLabel.draw(theGraphics, 0, 0, this);
+ theGraphics.popMatrix();
+ theGraphics.popStyle();
+ }
+
+ @Override
+ public String getText() {
+ StringBuilder sb = new StringBuilder();
+ for (StringBuffer s : _myTextBuffer) {
+ sb.append(s.toString() + "\n");
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public Textfield setValue(String theText) {
+ _myTextBuffer = new ArrayList();
+
+ // split theText into lines
+ String[] lines = theText.split("\n");
+ for (int i = 0; i < lines.length; i++) {
+ _myTextBuffer.add(i, new StringBuffer(lines[i]));
+ }
+
+ return this;
+ }
+
+ public Textfield setText(String theText) {
+ return setValue(theText);
+ }
+
+ public Textfield setIndex(int theColIndex, int theRowIndex) {
+ _myTextBufferColumnIndex = theColIndex;
+ _myTextBufferRowIndex = theRowIndex;
+ return this;
+ }
+
+}
\ No newline at end of file
diff --git a/src/sketch/Sketch.java b/src/sketch/Sketch.java
new file mode 100644
index 0000000..ee7e42c
--- /dev/null
+++ b/src/sketch/Sketch.java
@@ -0,0 +1,33 @@
+package sketch;
+
+import controlP5.ControlP5;
+import controlP5.TextfieldMultiline;
+import processing.core.PApplet;
+
+public class Sketch extends PApplet {
+
+ static public void main (String[] args){
+
+ PApplet.main("sketch.Sketch");
+ }
+
+ ControlP5 cp5;
+ public void settings(){
+ size(500,500);
+ }
+ public void setup(){
+ cp5 = new ControlP5(this);
+ TextfieldMultiline commandTextfield = new TextfieldMultiline(cp5, "commandTextfield");
+ commandTextfield.setPosition(0, 0)
+ .setSize(200, 50)
+ // .setFont(mainFont)
+ .setColor(color(255))
+ .setColorForeground(color(255, 100))
+ .setText("");
+
+ //cp5.addToggle(commandTextfield,"commandTextfield");
+ }
+ public void draw(){
+
+ }
+}