disabling tooltip

This commit is contained in:
sojamo 2014-08-16 17:49:39 +08:00
parent e056913c43
commit 2a516872a8
2 changed files with 25 additions and 45 deletions

View File

@ -8,6 +8,7 @@ import static controlP5.Controller.*;
public class ControlP5Legacy {
private ControlP5Base base;
public static boolean DEBUG = false;
void init( ControlP5Base theControlP5 ) {
base = theControlP5;
@ -56,6 +57,7 @@ public class ControlP5Legacy {
}
public Tooltip addTooltip( ) {
println( "Tooltip is not available with this Version (" , ControlP5.VERSION , ") of ControlP5" );
return null;
}
@ -542,6 +544,26 @@ public class ControlP5Legacy {
return addController( null , "" , theName , theClass , theX , theY );
}
static public void println( final Object ... strs ) {
for ( Object str : strs ) {
System.out.print( str + " " );
}
System.out.println( );
}
static public void debug( final Object ... strs ) {
if ( DEBUG ) {
println( strs );
}
}
static public void printerr( final Object ... strs ) {
for ( Object str : strs ) {
System.err.print( str + " " );
}
System.err.println( );
}
@Deprecated public Controller< ? > getController( String theName , Object theObject ) {
if ( base._myObjectToControllerMap.containsKey( theObject ) ) {
ArrayList< ControllerInterface< ? >> cs = base._myObjectToControllerMap.get( theObject );
@ -570,27 +592,6 @@ public class ControlP5Legacy {
}
@Deprecated public ControlWindow addControlWindow( final String theName , final int theX , final int theY , final int theWidth , final int theHeight , String theRenderer , int theFrameRate ) {
// for (int i = 0; i < cp5.controlWindowList.size();
// i++) {
// if (((ControlWindow)
// cp5.controlWindowList.get(i)).name().equals(theWindowName))
// {
// ControlP5.logger().warning("ControlWindow with name "
// + theWindowName +
// " already exists. overwriting now.");
// }
// }
// PAppletWindow myPAppletWindow = new
// PAppletWindow(cp5, theWindowName, theX, theY,
// theWidth, theHeight, theRenderer,
// theFrameRate);
// myPAppletWindow.setParent(cp5);
// myPAppletWindow.setMode(PAppletWindow.ECONOMIC);
// ControlWindow myControlWindow = new
// ControlWindow(cp5, myPAppletWindow);
// cp5.controlWindowList.add(myControlWindow);
// return myControlWindow;
return addControlWindow( theName );
}

View File

@ -17,43 +17,24 @@ import processing.core.PVector;
public class Tooltip {
private ControllerView< ? > _myView;
private PVector position = new PVector( );
private PVector currentPosition = new PVector( );
private PVector previousPosition = new PVector( );
private PVector offset = new PVector( );
private Controller< ? > _myController;
private long startTime = 0;
private long _myDelayInMillis = 500;
private int _myMode = ControlP5.INACTIVE;
private int _myHeight = 20;
private int _myBackgroundColor = 0xffffffb4;
private int _myMaxAlpha = 255;
private int _myAlpha = 0;
private Map< Controller< ? > , String > map;
private Label _myLabel;
private boolean enabled = true;
private int _myBorder;
private ControlP5 cp5;
private int _myAlignH = ControlP5.RIGHT;
private int _myColor = 0x00000000;
Tooltip( ControlP5 theControlP5 ) {
@ -122,6 +103,7 @@ public class Tooltip {
* @param theWindow
*/
void draw( ControlWindow theWindow ) {
/*
if ( enabled ) {
if ( _myMode >= ControlP5.WAIT ) {
@ -180,11 +162,7 @@ public class Tooltip {
theWindow.papplet( ).pushMatrix( );
theWindow.papplet( ).translate( position.x , position.y );
theWindow.papplet( ).translate( offset.x , offset.y );
/* TODO should request the
* current PGraphics element,
* not only the PApplet context.
* What if we render into a
* PGraphics buffer? */
// TODO should request the current PGraphics element, not only the PApplet context. What if we render into a PGraphics buffer?
_myView.display( theWindow.papplet( ).g , null );
theWindow.papplet( ).popMatrix( );
}
@ -197,6 +175,7 @@ public class Tooltip {
}
}
}
*/
}
private boolean moved( ) {