diff --git a/.DS_Store b/.DS_Store index e6cb04f..c4707ce 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/README.md b/README.md index 68c3418..7af47fb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ ## this is a fork of the original controlP5 library by Andreas Schlegel -## it provides a pom.xml for maven and can be used as a dependency in maven projects +## My changes include: +- it provides a pom.xml for maven and can be used as a dependency in maven projects +- Tweeks in the getting focus/losing focus for custom controllers that extends the Controller class (See ReleasedOutsideListener.java Interface) + diff --git a/src/main/java/controlP5/Controller.java b/src/main/java/controlP5/Controller.java index 78ffc0c..2def87b 100755 --- a/src/main/java/controlP5/Controller.java +++ b/src/main/java/controlP5/Controller.java @@ -31,6 +31,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import controlP5.events.ReleasedOutsideListener; import processing.core.PApplet; import processing.core.PFont; import processing.core.PGraphics; @@ -583,7 +584,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra return false; } if ( theStatus == true ) { - if ( isInside ) { + if ( inside() ) { isMousePressed = true; if ( !cp5.isAltDown( ) ) { mousePressed( ); @@ -629,7 +630,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra cp5.getControlBroadcaster( ).invokeAction( new CallbackEvent( this , ACTION_RELEASE_OUTSIDE ) ); callListener( ACTION_RELEASE_OUTSIDE ); } - if ( this instanceof Textfield ) { + if ( this instanceof ReleasedOutsideListener) { mouseReleasedOutside( ); onReleaseOutside( ); callListener( ACTION_RELEASE_OUTSIDE ); @@ -1216,7 +1217,7 @@ public abstract class Controller< T > implements ControllerInterface< T > , CDra * * @param KeyEvent theEvent */ - @ControlP5.Invisible public void keyEvent( final KeyEvent theEvent ) { + public void keyEvent( final KeyEvent theEvent ) { } /** diff --git a/src/main/java/controlP5/Textfield.java b/src/main/java/controlP5/Textfield.java index 2c7e7c1..2184159 100755 --- a/src/main/java/controlP5/Textfield.java +++ b/src/main/java/controlP5/Textfield.java @@ -31,6 +31,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import controlP5.events.ReleasedOutsideListener; import processing.core.PApplet; import processing.core.PFont; import processing.core.PGraphics; @@ -48,7 +49,7 @@ import processing.event.KeyEvent; * @example controllers/ControlP5textfield * @nosuperclasses Controller Controller */ -public class Textfield extends Controller< Textfield > { +public class Textfield extends Controller< Textfield > implements ReleasedOutsideListener { /* TODO textspacing does not work properly for bitfonts sometimes first row of pixels in a * bitfont texture gets cut off */ @@ -269,7 +270,7 @@ public class Textfield extends Controller< Textfield > { setFocus( true ); } - @Override protected void mouseReleasedOutside( ) { + @Override public void mouseReleasedOutside( ) { if ( isKeepFocus == false ) { isTexfieldActive = isActive = false; } diff --git a/src/main/java/controlP5/events/ReleasedOutsideListener.java b/src/main/java/controlP5/events/ReleasedOutsideListener.java new file mode 100644 index 0000000..a5f05dd --- /dev/null +++ b/src/main/java/controlP5/events/ReleasedOutsideListener.java @@ -0,0 +1,6 @@ +package controlP5.events; + +public interface ReleasedOutsideListener { + public void mouseReleasedOutside( ) ; + +} diff --git a/src/main/java/sketch/Sketch.java b/src/main/java/sketch/Sketch.java index 9571c3a..5541f71 100644 --- a/src/main/java/sketch/Sketch.java +++ b/src/main/java/sketch/Sketch.java @@ -1,9 +1,6 @@ package sketch; -import controlP5.ControlEvent; -import controlP5.ControlP5; -import controlP5.RadioButton; -import controlP5.TextfieldMultiline; +import controlP5.*; import processing.core.PApplet; public class Sketch extends PApplet { @@ -20,21 +17,8 @@ public class Sketch extends PApplet { public void setup(){ cp5 = new ControlP5(this); - RadioButton b = new RadioButton(cp5,"radioButton") - .setPosition(100,100) - .setSize(40,20) - .setColorForeground(color(120)) - .setColorActive(color(255)) - .setColorLabel(color(255)) - .setItemsPerRow(3) - .setSpacingColumn(50) - .addItem("foo",1) - .addItem("bar",2) - .addItem("baz",3) - .activate(0) - ; - - b.plugTo(this,"radioButton"); + Button b = new Button(cp5,"").setSize(100,100); + MultilineTextfield ml = new MultilineTextfield(cp5,"mlt"); } diff --git a/target/classes/controlP5/Controller$1.class b/target/classes/controlP5/Controller$1.class index 6d2485d..37685ed 100644 Binary files a/target/classes/controlP5/Controller$1.class and b/target/classes/controlP5/Controller$1.class differ diff --git a/target/classes/controlP5/Controller$DebugView.class b/target/classes/controlP5/Controller$DebugView.class index ef4352d..c024745 100644 Binary files a/target/classes/controlP5/Controller$DebugView.class and b/target/classes/controlP5/Controller$DebugView.class differ diff --git a/target/classes/controlP5/Controller.class b/target/classes/controlP5/Controller.class index 6c1743b..b3fd020 100644 Binary files a/target/classes/controlP5/Controller.class and b/target/classes/controlP5/Controller.class differ diff --git a/target/classes/controlP5/Textfield$DeleteCharacter.class b/target/classes/controlP5/Textfield$DeleteCharacter.class index 1a1f253..a1acd4b 100644 Binary files a/target/classes/controlP5/Textfield$DeleteCharacter.class and b/target/classes/controlP5/Textfield$DeleteCharacter.class differ diff --git a/target/classes/controlP5/Textfield$Enter.class b/target/classes/controlP5/Textfield$Enter.class index 12792ee..cdc7b51 100644 Binary files a/target/classes/controlP5/Textfield$Enter.class and b/target/classes/controlP5/Textfield$Enter.class differ diff --git a/target/classes/controlP5/Textfield$InputFilter.class b/target/classes/controlP5/Textfield$InputFilter.class index 77469bd..b90952f 100644 Binary files a/target/classes/controlP5/Textfield$InputFilter.class and b/target/classes/controlP5/Textfield$InputFilter.class differ diff --git a/target/classes/controlP5/Textfield$InsertCharacter.class b/target/classes/controlP5/Textfield$InsertCharacter.class index 635d540..3367dd6 100644 Binary files a/target/classes/controlP5/Textfield$InsertCharacter.class and b/target/classes/controlP5/Textfield$InsertCharacter.class differ diff --git a/target/classes/controlP5/Textfield$MoveDown.class b/target/classes/controlP5/Textfield$MoveDown.class index 55fb1ec..8c340cf 100644 Binary files a/target/classes/controlP5/Textfield$MoveDown.class and b/target/classes/controlP5/Textfield$MoveDown.class differ diff --git a/target/classes/controlP5/Textfield$MoveLeft.class b/target/classes/controlP5/Textfield$MoveLeft.class index 3f91581..ab48072 100644 Binary files a/target/classes/controlP5/Textfield$MoveLeft.class and b/target/classes/controlP5/Textfield$MoveLeft.class differ diff --git a/target/classes/controlP5/Textfield$MoveRight.class b/target/classes/controlP5/Textfield$MoveRight.class index 74ab7da..396cda8 100644 Binary files a/target/classes/controlP5/Textfield$MoveRight.class and b/target/classes/controlP5/Textfield$MoveRight.class differ diff --git a/target/classes/controlP5/Textfield$MoveUp.class b/target/classes/controlP5/Textfield$MoveUp.class index baa5d2d..c7c21cd 100644 Binary files a/target/classes/controlP5/Textfield$MoveUp.class and b/target/classes/controlP5/Textfield$MoveUp.class differ diff --git a/target/classes/controlP5/Textfield.class b/target/classes/controlP5/Textfield.class index 1a7ea1d..99e7eb7 100644 Binary files a/target/classes/controlP5/Textfield.class and b/target/classes/controlP5/Textfield.class differ diff --git a/target/classes/controlP5/events/ReleasedOutsideListener.class b/target/classes/controlP5/events/ReleasedOutsideListener.class new file mode 100644 index 0000000..9e85c1e Binary files /dev/null and b/target/classes/controlP5/events/ReleasedOutsideListener.class differ diff --git a/target/classes/controlP5/layout/LayoutBuilder.class b/target/classes/controlP5/layout/LayoutBuilder.class deleted file mode 100644 index 151473f..0000000 Binary files a/target/classes/controlP5/layout/LayoutBuilder.class and /dev/null differ diff --git a/target/classes/sketch/Sketch.class b/target/classes/sketch/Sketch.class index bf2c474..1966ce9 100644 Binary files a/target/classes/sketch/Sketch.class and b/target/classes/sketch/Sketch.class differ diff --git a/target/controlp5-2.2.6.jar b/target/controlp5-2.2.6.jar index 9a7db63..f61d5c8 100644 Binary files a/target/controlp5-2.2.6.jar and b/target/controlp5-2.2.6.jar differ diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 37924f8..396a4bc 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -117,7 +117,6 @@ controlP5/ColorWheel$1.class controlP5/FieldChangedListener$1.class controlP5/Slider2D$Slider2DView.class controlP5/TextfieldMultiline$MoveLeft.class -controlP5/layout/LayoutBuilder.class controlP5/ControlBroadcaster$EmptyController.class controlP5/Chart$ChartViewLine.class controlP5/Icon$IconImageView.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 96a8f32..ee8b5e5 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -18,6 +18,7 @@ /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControllerProperty.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ColorPicker.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Tooltip.java +/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/events/ReleasedOutsideListener.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Group.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/CP.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Tab.java @@ -37,7 +38,6 @@ /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlKey.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlP5Base.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Slider.java -/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/layout/LayoutBuilder.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/MultiList.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControllerGroup.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Textfield.java @@ -74,6 +74,7 @@ /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControllerView.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlWindowCanvas.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlTimer.java +/Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/MultilineTextfield.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlWindow.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/ControlBroadcaster.java /Users/gabrielsalvador/Code/controlp5/src/main/java/controlP5/Pointer.java