2.2.3 release

pull/8/head v2.2.3
sojamo 8 years ago
parent e2b6800bd3
commit 388b13569b

1
.gitignore vendored

@ -9,4 +9,3 @@
.buildpath
.classpath
.project

@ -366,4 +366,4 @@ If you want to help improve ControlP5, the first place for me to do so would be
If you have used ControlP5 in any of your projects, let me know, send me details, send me links, send me screeshots.
Copyright 2006-2014 Andreas Schlegel
Copyright 2006-2015 Andreas Schlegel

@ -200,7 +200,7 @@ controlP5.Controller : void setView(ControllerView, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:39
created: 2015/03/24 12:20:51
*/

@ -196,7 +196,7 @@ controlP5.Controller : void setView(ControllerView, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:40
created: 2015/03/24 12:21:00
*/

@ -279,7 +279,7 @@ controlP5.ControllerGroup : void remove()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:42
created: 2015/03/24 12:25:32
*/

@ -181,7 +181,7 @@ controlP5.ControllerGroup : void remove()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:44
created: 2015/03/24 12:25:35
*/

@ -224,7 +224,7 @@ controlP5.Controller : void setView(ControllerView, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:45
created: 2015/03/24 12:25:36
*/

@ -260,7 +260,7 @@ controlP5.Controller : void setView(ControllerView, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:47
created: 2015/03/24 12:20:49
*/

@ -82,7 +82,7 @@ controlP5.Canvas : void update(PApplet)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:48
created: 2015/03/24 12:20:53
*/

@ -236,7 +236,7 @@ controlP5.Controller : void setView(ControllerView, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:50
created: 2015/03/24 12:20:54
*/

@ -235,7 +235,7 @@ controlP5.ControllerGroup : void remove()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:51
created: 2015/03/24 12:20:56
*/

@ -181,7 +181,7 @@ controlP5.ControllerGroup : void remove()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:53
created: 2015/03/24 12:20:58
*/

@ -56,7 +56,7 @@ controlP5.ControlTimer : void update()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:55
created: 2015/03/24 12:21:02
*/

@ -158,7 +158,7 @@ controlP5.ControllerProperties : void setFormat(String)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:56
created: 2015/03/24 12:21:03
*/

@ -304,7 +304,7 @@ controlP5.DropdownList : void updateItemIndexOffset()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:18:58
created: 2015/03/24 12:21:05
*/

@ -228,7 +228,7 @@ controlP5.ControllerGroup : void remove()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:00
created: 2015/03/24 12:21:07
*/

@ -211,7 +211,7 @@ controlP5.Icon : int getFontIcon(int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:01
created: 2015/03/24 12:21:09
*/

@ -253,7 +253,7 @@ controlP5.Knob : int getViewStyle()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:02
created: 2015/03/24 12:21:10
*/

@ -312,7 +312,7 @@ controlP5.ListBox : void updateItemIndexOffset()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:04
created: 2015/03/24 12:21:12
*/

@ -289,7 +289,7 @@ controlP5.Matrix : void remove()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:06
created: 2015/03/24 12:21:14
*/

@ -207,7 +207,7 @@ controlP5.Numberbox : float getMultiplier()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:09
created: 2015/03/24 12:25:44
*/

@ -231,7 +231,7 @@ controlP5.RadioButton : void updateLayout()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:11
created: 2015/03/24 12:21:19
*/

@ -237,7 +237,7 @@ controlP5.Range : float[] getArrayValue()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:12
created: 2015/03/24 12:21:20
*/

@ -254,7 +254,7 @@ controlP5.ScrollableList : void updateItemIndexOffset()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:14
created: 2015/03/24 12:21:22
*/

@ -290,7 +290,7 @@ controlP5.Slider : int getTriggerEvent()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:16
created: 2015/03/24 12:25:46
*/

@ -231,7 +231,7 @@ controlP5.Slider2D : void setValueLabelSeparator(String)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:18
created: 2015/03/24 12:25:47
*/

@ -229,7 +229,7 @@ controlP5.Tab : float getValue()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:19
created: 2015/03/24 12:25:49
*/

@ -222,7 +222,7 @@ controlP5.Textarea : void controlEvent(ControlEvent)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:21
created: 2015/03/24 12:21:29
*/

@ -250,7 +250,7 @@ controlP5.Textfield : void keyEvent(KeyEvent)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:23
created: 2015/03/24 12:21:31
*/

@ -204,7 +204,7 @@ controlP5.Textlabel : void draw(int, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:24
created: 2015/03/24 12:21:33
*/

@ -228,10 +228,11 @@ controlP5.Toggle : Toggle toggle()
controlP5.Toggle : Toggle update()
controlP5.Toggle : boolean getBooleanValue()
controlP5.Toggle : boolean getState()
controlP5.Toggle : int getMode()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:26
created: 2015/03/24 12:21:35
*/

@ -109,7 +109,7 @@ controlP5.Tooltip : int getWidth()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:27
created: 2015/03/24 12:21:36
*/

@ -192,7 +192,7 @@ controlP5.Textlabel : void draw(int, int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:19:51
created: 2015/03/24 12:22:02
*/

@ -68,7 +68,7 @@ ClassName : returnType methodName(parameter type)
created: 2014/09/08 01:20:02
created: 2015/03/24 12:22:14
*/

@ -112,7 +112,7 @@ controlP5.ControlEvent : int getType()
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:20:21
created: 2015/03/24 12:22:35
*/

@ -127,7 +127,7 @@ controlP5.ControlFont : void setSize(int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
created: 2014/09/08 01:20:23
created: 2015/03/24 12:22:36
*/

@ -13,13 +13,13 @@
</path>
<property name="javaVersion" value="1.6"/>
<property name="author" value="Andreas Schlegel"/>
<property name="copyright" value="(c) 2006-2014"/>
<property name="copyright" value="(c) 2006-2015"/>
<property name="libraryName" value="controlP5"/>
<property name="versionNumber" value="2.2.2"/>
<property name="versionNumber" value="2.2.3"/>
<property name="yourLink" value="http://www.sojamo.de" />
<property name="keywords" value="gui, ui, controller, interface, user interface" />
<property name="tested:platform" value="osx, windows, linux" />
<property name="tested:processingVersion" value="2.2.1" />
<property name="tested:processingVersion" value="2.2.3" />
<property name="tested:dependencies" value="none" />
<property name="source:host" value="github" />
<property name="source:url" value="https://github.com/sojamo/controlp5" />

@ -22,7 +22,7 @@ category = GUI
# shown from inside the PDE when the library is being installed. Avoid repeating
# the name of your library here. Also, avoid saying anything redundant like
# mentioning that its a library.
sentence = A GUI library with a range of controllers to build custom user interfaces for desktop and android mode.
sentence = A GUI library to build custom user interfaces for desktop and android mode.
# Additional information suitable for the Processing website. The value of
# 'sentence' always will be prepended, so you should start by writing the
@ -38,7 +38,7 @@ paragraph = Includes interface elements such as slider, button, knob, toggle, te
# is used to compare different versions of the same library, and
# check if an update is available. You should think of it as a
# counter, counting the total number of releases you've had.
version = 81 # This must be parsable as an int
version = 82 # This must be parsable as an int
# The version as the user will see it. If blank, the version attribute will be used here
prettyVersion = 2.2.2 # This is treated as a String
prettyVersion = 2.2.3 # This is treated as a String

@ -34,33 +34,20 @@ import java.io.Serializable;
public class CColor implements Serializable {
private int colorBackground = 0xff003652;
private int colorForeground = 0xff00698c;
private int colorActive = 0xff08a2cf; // 0699C4;
private int colorCaptionLabel = 0xffffffff;
private int colorValueLabel = 0xffffffff;
private int colorBackgroundAlpha = 0xff;
private int colorForegroundAlpha = 0xff;
private int colorActiveAlpha = 0xff; // 0699C4;
private int colorCaptionLabelAlpha = 0xff;
private int colorValueLabelAlpha = 0xff;
private int alpha = 0xff;
private int maskA = 0x00ffffff;
int maskR = 0xff00ffff;
int maskG = 0xffff00ff;
int maskB = 0xffffff00;
protected CColor set( CColor theColor ) {

@ -47,29 +47,17 @@ import java.util.Set;
public class ControlBroadcaster {
private int _myControlEventType = ControlP5Constants.INVALID;
private ControllerPlug _myControlEventPlug = null;
private ControllerPlug _myControllerCallbackEventPlug = null;
private ControlP5 cp5;
private String _myEventMethod = "controlEvent";
private String _myControllerCallbackEventMethod = "controlEvent";
private ArrayList< ControlListener > _myControlListeners;
private Set< Entry< CallbackListener , Controller< ? >>> _myControllerCallbackListeners;
private static boolean setPrintStackTrace = true;
private static boolean ignoreErrorMessage = false;
private static Map< Class< ? > , Field[] > fieldcache = new HashMap< Class< ? > , Field[] >( );
private static Map< Class< ? > , Method[] > methodcache = new HashMap< Class< ? > , Method[] >( );
boolean broadcast = true;
protected ControlBroadcaster( ControlP5 theControlP5 ) {

@ -33,11 +33,14 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -87,12 +90,15 @@ public class ControlP5 extends ControlP5Base {
*/
@ControlP5.Invisible PGraphics pg;
int pgx = 0 , pgy = 0 , pgw = 0 , pgh = 0;
int ox = 0;
int oy = 0;
boolean isGraphics = false;
/**
* @exclude
*/
@ControlP5.Invisible public static final String VERSION = "2.2.2";// "##version##";
@ControlP5.Invisible public static final String VERSION = "2.2.3";// "##version##";
/**
* @exclude
@ -256,6 +262,12 @@ public class ControlP5 extends ControlP5Base {
return this;
}
public ControlP5 setPosition( int theX , int theY ) {
ox = theX;
oy = theY;
return this;
}
/**
* By default event originating from tabs are disabled,
* use setTabEventsActive(true) to receive controlEvents
@ -1359,14 +1371,44 @@ public class ControlP5 extends ControlP5Base {
return str.matches( "(-|\\+)?\\d+(\\.\\d+)?" );
}
static public List toList( final Object ... args ) {
List l = new ArrayList( );
Collections.addAll( l , args );
return l;
}
static public List toList( Object o ) {
return o != null ? ( o instanceof List ) ? ( List ) o : ( o instanceof String ) ? toList( o.toString( ) ) : Collections.EMPTY_LIST : Collections.EMPTY_LIST;
}
static public Map toMap( final String s ) {
/* similar to mapFrom(Object ... args) but with type
* (Number,String) sensitivity */
String[] arr = s.trim( ).split( delimiter );
Map m = new LinkedHashMap( );
if ( arr.length % 2 == 0 ) {
for ( int i = 0 ; i < arr.length ; i += 2 ) {
String s1 = arr[ i + 1 ];
m.put( arr[ i ] , isNumeric( s1 ) ? s1.indexOf( "." ) == -1 ? i( s1 ) : f( s1 ) : s1 );
}
}
return m;
}
static public Map toMap( Object o ) {
return o != null ? ( o instanceof Map ) ? ( Map ) o : Collections.EMPTY_MAP : Collections.EMPTY_MAP;
}
static public Map toMap( final Object ... args ) {
Map m = new LinkedHashMap( );
if ( args.length % 2 == 0 ) {
for ( int i = 0 ; i < args.length ; i += 2 ) {
m.put( args[ i ] , args[ i + 1 ] );
}
}
return m;
}
static public String s( String o ) {
return ( o != null ) ? o : "";
}
@ -1382,6 +1424,18 @@ public class ControlP5 extends ControlP5Base {
}
};
static public void sleep( long theMillis ) {
try {
Thread.sleep( theMillis );
} catch ( Exception e ) {
}
}
static public String timestamp( ) {
return new SimpleDateFormat( "yyyyMMdd-HHmmss" ).format( new Date( ) );
}
/* add Objects with Annotation */
public static Logger logger( ) {

@ -169,6 +169,8 @@ public interface ControlP5Constants {
public final static CColor THEME_GREY = new CColor( 0xffeeeeee, 0xffbbbbbb , 0xffffffff , 0xff555555 , 0xff555555 );
public final static CColor THEME_A = new CColor( 0xff00FFC8 , 0xff00D7FF , 0xffffff00 , 0xff00B0FF , 0xff00B0FF );
// other colors: #ff3838 red-salmon; #08ffb4 turquoise; #40afff light-blue; #f3eddb beige;
public static final int standard58 = 0;
public static final int standard56 = 1;
public static final int synt24 = 2;
@ -180,4 +182,7 @@ public interface ControlP5Constants {
public final static String JSON = "JSON";
public final static String SERIALIZED = "SERIALIZED";
static public final String delimiter = " ";
static public final String pathdelimiter = "/";
}

@ -195,7 +195,7 @@ public final class ControlWindow {
/**
* Sets the position of the tab bar which is set to 0,0
* by default. to move the tabs to y-position 100, use
* cp5.window().setPositionOfTabs(new PVector(0,100,0));
* cp5.getWindow().setPositionOfTabs(new PVector(0,100,0));
*
* @param thePVector
*/
@ -413,8 +413,8 @@ public final class ControlWindow {
*/
public void mouseEvent( int theX , int theY , boolean pressed ) {
mouseX = theX - cp5.pgx;
mouseY = theY - cp5.pgy;
mouseX = theX - cp5.pgx - cp5.ox;
mouseY = theY - cp5.pgy - cp5.oy;
if ( pressed && !pmousePressed ) {
updateEvents( );
@ -451,8 +451,8 @@ public final class ControlWindow {
*/
public void mouseEvent( MouseEvent theMouseEvent ) {
if ( isMouse ) {
mouseX = theMouseEvent.getX( ) - cp5.pgx;
mouseY = theMouseEvent.getY( ) - cp5.pgy;
mouseX = theMouseEvent.getX( ) - cp5.pgx - cp5.ox;
mouseY = theMouseEvent.getY( ) - cp5.pgy - cp5.oy;
if ( theMouseEvent.getAction( ) == MouseEvent.PRESS ) {
mousePressedEvent( );
}
@ -526,7 +526,8 @@ public final class ControlWindow {
}
public void draw( PGraphics pg ) {
pg.pushMatrix( );
pg.translate( cp5.ox , cp5.oy );
if ( cp5.blockDraw == false ) {
if ( cp5.isAndroid ) {
mouseEvent( cp5.papplet.mouseX , cp5.papplet.mouseY , cp5.papplet.mousePressed );
@ -625,7 +626,7 @@ public final class ControlWindow {
}
}
}
pg.popMatrix( );
}
/**

@ -38,23 +38,14 @@ import java.security.AccessControlException;
public class ControllerPlug {
private Object _myObject;
private String _myName;
private Method _myMethod;
private Field _myField;
private int _myType = ControlP5Constants.INVALID;
private Class< ? > _myParameterClass;
private int _myParameterType = -1;
private Object _myValue = null;
private Class< ? >[] _myAcceptClassList;
private Class< ? > _myEventMethodParameter = ControlEvent.class;
public ControllerPlug( final Object theObject , final String theName , final int theType , final int theParameterType , Class< ? >[] theAcceptClassList ) {

@ -67,6 +67,7 @@ public class DropdownList extends Controller< DropdownList > implements ControlL
super( theControlP5 , theGroup , theName , theX , theY , theW , theH );
items = new ArrayList< Map< String , Object > >( );
updateHeight( );
getValueLabel( ).align( PApplet.LEFT , PApplet.CENTER );
}
public boolean isOpen( ) {
@ -389,7 +390,7 @@ public class DropdownList extends Controller< DropdownList > implements ControlL
}
g.popMatrix( );
c.getCaptionLabel( ).align( PApplet.LEFT , PApplet.CENTER ).draw( g , 4 , c.barHeight / 2 );
c.getCaptionLabel( ).draw( g , 4 , c.barHeight / 2 );
}
if ( c.isOpen( ) ) {
@ -411,7 +412,7 @@ public class DropdownList extends Controller< DropdownList > implements ControlL
CColor color = ( CColor ) item.get( "color" );
g.fill( ( b( item.get( "state" ) ) ) ? color.getActive( ) : ( i == c.itemHover ) ? ( c.isMousePressed ? color.getActive( ) : color.getForeground( ) ) : color.getBackground( ) );
g.rect( 0 , 0 , c.getWidth( ) , c.itemHeight - 1 );
c.getValueLabel( ).align( PApplet.LEFT , PApplet.CENTER ).set( item.get( "text" ).toString( ) ).draw( g , 4 , c.itemHeight / 2 );
c.getValueLabel( ).set( item.get( "text" ).toString( ) ).draw( g , 4 , c.itemHeight / 2 );
g.translate( 0 , c.itemHeight );
}
g.popMatrix( );

@ -75,6 +75,7 @@ public class ScrollableList extends Controller< ScrollableList > implements Cont
super( theControlP5 , theGroup , theName , theX , theY , theW , theH );
items = new ArrayList< Map< String , Object > >( );
updateHeight( );
getValueLabel( ).align( PApplet.LEFT , PApplet.CENTER );
}
public boolean isOpen( ) {
@ -397,7 +398,8 @@ public class ScrollableList extends Controller< ScrollableList > implements Cont
}
g.popMatrix( );
c.getCaptionLabel( ).align( PApplet.LEFT , PApplet.CENTER ).draw( g , 4 , c.barHeight / 2 );
c.getCaptionLabel( ).draw( g , 4 , c.barHeight / 2 );
}
if ( c.isOpen( ) ) {
@ -419,7 +421,7 @@ public class ScrollableList extends Controller< ScrollableList > implements Cont
CColor color = ( CColor ) item.get( "color" );
g.fill( ( b( item.get( "state" ) ) ) ? color.getActive( ) : ( i == c.itemHover ) ? ( c.isMousePressed ? color.getActive( ) : color.getForeground( ) ) : color.getBackground( ) );
g.rect( 0 , 0 , c.getWidth( ) , c.itemHeight - 1 );
c.getValueLabel( ).align( PApplet.LEFT , PApplet.CENTER ).set( item.get( "text" ).toString( ) ).draw( g , 4 , c.itemHeight / 2 );
c.getValueLabel( ).set( item.get( "text" ).toString( ) ).draw( g , 4 , c.itemHeight / 2 );
g.translate( 0 , c.itemHeight );
}
g.popMatrix( );

@ -1,3 +1,7 @@
2014-09-08 Andreas Schlegel
* add glyphicons reference to controlp5.Icon.java http://glyphicons.com
* add useiconic to controlp5.Icon.java https://useiconic.com/open
2014-05-29 Andreas Schlegel
* distinguish between left,center, right mouse click events http://forum.processing.org/two/discussion/5422/controlp5-mousepressed-only-if-mousebutton-left-

@ -167,6 +167,10 @@ public class Toggle extends Controller< Toggle > {
return this;
}
public int getMode( ) {
return _myDisplayMode;
}
/**
* by default a toggle returns 0 (for off) and 1 (for on). the internal value variable can be
* used to store an additional value for a toggle event.

Loading…
Cancel
Save