aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-10-03 02:37:32 +0200
committerSven Gothel <[email protected]>2023-10-03 02:37:32 +0200
commitc8ec6fa7cc16a0777db16af8b4d0d0b898f8b546 (patch)
tree7673f7635bd1eff387552f74eae688e33694e728
parent69549319e1d9ddf4d3903aa077f2c4cebb54195e (diff)
GraphUI Shape: 'int name' -> 'int id' and add 'String name', change get/set methods accordingly
-rwxr-xr-xmake/scripts/tests-win.bat4
-rwxr-xr-xmake/scripts/tests-x64-dbg.bat11
-rwxr-xr-xmake/scripts/tests-x64.bat3
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java16
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Container.java4
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java46
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Shape.java25
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java8
12 files changed, 84 insertions, 43 deletions
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index ca8ec5231..d087f61e2 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -70,7 +70,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintin
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLCapabilities01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestDestroyGLAutoDrawableNewtAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestDestroyGLAutoDrawableNewtAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT -time 5000
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT %*
@@ -269,7 +269,7 @@ REM scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo02 %*
REM scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo03 %*
REM scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo10 %*
REM scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo11 %*
-REM scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo20 %*
+scripts\java-win.bat com.jogamp.opengl.demos.graph.ui.UISceneDemo20 %*
REM scripts\java-win.bat com.jogamp.opengl.demos.av.MovieCube %*
REM scripts\java-win.bat com.jogamp.opengl.demos.av.MovieSimple %*
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index 25cfc5761..f334b282a 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -1,11 +1,11 @@
-set TEMP=\\jordan\data\Incoming\windows\temp
-set TMP=\\jordan\data\Incoming\windows\temp
+REM set TEMP=\\jordan\data\Incoming\windows\temp
+REM set TMP=\\jordan\data\Incoming\windows\temp
REM set TEMP=C:\Documents and Settings\jogamp\temp
REM set TMP=C:\Documents and Settings\jogamp\temp
-set LIBGL_DEBUG=verbose
-set MESA_DEBUG=true
+REM set LIBGL_DEBUG=verbose
+REM set MESA_DEBUG=true
set LIBGL_ALWAYS_SOFTWARE=true
REM set INTEL_DEBUG="buf bat"
REM set INTEL_STRICT_CONFORMANCE=1
@@ -109,7 +109,8 @@ REM set MODULE_ARGS=--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java
set MODULE_ARGS=--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens java.desktop/sun.java2d=ALL-UNNAMED
REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %MODULE_ARGS%
-set X_ARGS="-Dsun.java2d.noddraw=true" %MODULE_ARGS%
+REM set X_ARGS="-Dsun.java2d.noddraw=true" %MODULE_ARGS%
+set X_ARGS="-Xcheck:jni" "-Dsun.java2d.noddraw=true" "-Djava.awt.headless=true" %MODULE_ARGS%
scripts\tests-win.bat %*
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index 728dd6ba2..807eae50a 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -34,6 +34,9 @@ REM set MODULE_ARGS=--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java
set MODULE_ARGS=--add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens java.desktop/sun.java2d=ALL-UNNAMED
REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %MODULE_ARGS%
set X_ARGS="-Dsun.java2d.noddraw=true" %MODULE_ARGS%
+REM set X_ARGS="-Xcheck:jni" "-verbose:jni" "-Dsun.java2d.noddraw=true" "-Djava.awt.headless=true" %MODULE_ARGS%
+REM set X_ARGS="-Xcheck:jni" "-Dsun.java2d.noddraw=true" "-Djava.awt.headless=true" %MODULE_ARGS%
+
scripts\tests-win.bat %*
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index dc36d7a48..1c5dcbbde 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -1017,8 +1017,8 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo03 $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo10 $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo11 $*
-#testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $*
-testawt com.jogamp.opengl.test.junit.jogl.acore.TestDestroyGLAutoDrawableNewtAWT $*
+testnoawt com.jogamp.opengl.demos.graph.ui.UISceneDemo20 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestDestroyGLAutoDrawableNewtAWT $*
#testnoawt com.jogamp.opengl.demos.av.MovieSimple $*
#testnoawt com.jogamp.opengl.demos.av.MovieCube $*
#testnoawt com.jogamp.opengl.demos.graph.ui.UIMediaGrid00 $*
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
index 495739f7e..1e9c00967 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
@@ -430,7 +430,7 @@ public class UILayoutBox01 {
final Shape.MouseGestureListener dragZoomRotateListener)
{
final String suffix = String.format("%2d", id);
- g.setName(id);
+ g.setID(id);
final AABBox sceneBox = scene.getBounds();
{
g.addShape( new BaseButton(options.renderModes, 0.70f, 0.70f).setPerp().setColor(0, 1, 0, 1).setBorder(borderThickness).addMouseListener(dragZoomRotateListener) );
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
index 97a1d81f0..8261f6ec0 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
@@ -313,7 +313,7 @@ public class UILayoutBoxGridOffset01 {
final Font font, final int id,
final GroupMod modImpl, final float offX, final float offY) {
final String suffix = String.format("%2d", id);
- g.setName(id);
+ g.setID(id);
final AABBox sceneBox = scene.getBounds();
modImpl.mod(g);
g.setBorder(borderThickness).setBorderColor(groupBorderColor);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
index 82a91d53c..4221e022d 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
@@ -401,7 +401,7 @@ public class UILayoutGrid01 {
final Font font, final int id,
final GroupMod modImpl) {
final String suffix = String.format("%2d", id);
- g.setName(id);
+ g.setID(id);
final AABBox sceneBox = scene.getBounds();
modImpl.mod(g);
g.setBorder(borderThickness).setBorderColor(groupBorderColor);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
index 2942dd58a..1879240ab 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -380,8 +380,8 @@ public class UISceneDemo20 implements GLEventListener {
public static final int BUTTON_MOVIE = 200;
public static final int BUTTON_GLEL = 200;
- public Shape getShapeByName(final int name) {
- return scene.getShapeByName(name);
+ public Shape getShapeByID(final int name) {
+ return scene.getShapeByID(name);
}
private void initSound(final Shape shape,
@@ -483,7 +483,7 @@ public class UISceneDemo20 implements GLEventListener {
BaseButton button;
button = new Button(renderModes, fontSymbols, fontSymbols.getUTF16String("fast_forward"), buttonLWidth, buttonLHeight); // next (ffwd)
((Button)button).setSpacing(symSpacing, fixedSymSize);
- button.setName(BUTTON_NEXTTEXT);
+ button.setID(BUTTON_NEXTTEXT);
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
@@ -499,7 +499,7 @@ public class UISceneDemo20 implements GLEventListener {
buttonsLeft.addShape(button);
button = new Button(renderModes, fontButtons, "Show fps", "Hide fps", buttonLWidth, buttonLHeight, Button.DEFAULT_LABEL_ZOFFSET);
- button.setName(BUTTON_FPS);
+ button.setID(BUTTON_FPS);
button.setToggleable(true);
button.setToggle(fpsLabel.isEnabled());
button.addMouseListener(new Shape.MouseGestureAdapter() {
@@ -515,7 +515,7 @@ public class UISceneDemo20 implements GLEventListener {
buttonsLeft.addShape(button);
button = new Button(renderModes, fontButtons, " V-Sync ", buttonLWidth, buttonLHeight);
- button.setName(BUTTON_VSYNC);
+ button.setID(BUTTON_VSYNC);
button.setToggleable(true);
button.setToggle(gl.getSwapInterval()>0);
button.addMouseListener(new Shape.MouseGestureAdapter() {
@@ -601,7 +601,7 @@ public class UISceneDemo20 implements GLEventListener {
button = new Button(renderModes, fontSymbols, fontSymbols.getUTF16String("power_settings_new"), buttonLWidth, buttonLHeight); // exit (power_settings_new)
((Button)button).setSpacing(symSpacing, fixedSymSize);
- button.setName(BUTTON_QUIT);
+ button.setID(BUTTON_QUIT);
button.setColor(0.7f, 0.3f, 0.3f, 1.0f);
((Button)button).setLabelColor(1.2f, 1.2f, 1.2f);
button.setPressedColorMod(1.1f, 0.0f, 0.0f, 1.0f);
@@ -709,7 +709,7 @@ public class UISceneDemo20 implements GLEventListener {
mPlayer.setTextureUnit(texUnitMediaPlayer);
mPlayer.setAudioChannelLimit(1); // enforce mono to enjoy spatial 3D position effects
button = new MediaButton(renderModes, buttonRWidth, buttonRHeight, mPlayer);
- button.setName(BUTTON_MOVIE);
+ button.setID(BUTTON_MOVIE);
((MediaButton)button).setVerbose(false).addDefaultEventListener().setFixedARatioResize(true);
button.setToggleable(true);
button.setToggle(true); // toggle == false -> mute audio
@@ -895,7 +895,7 @@ public class UISceneDemo20 implements GLEventListener {
}).start();
button = new GLButton(renderModes, buttonRWidth, buttonRHeight,
texUnitGLELButton, gears, false /* useAlpha */);
- button.setName(BUTTON_GLEL);
+ button.setID(BUTTON_GLEL);
button.setToggleable(true);
button.setToggle(false); // toggle == true -> animation
((GLButton)button).setAnimate(false);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Container.java b/src/graphui/classes/com/jogamp/graph/ui/Container.java
index d4bd6c9f8..32da78791 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Container.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Container.java
@@ -75,6 +75,10 @@ public interface Container {
boolean contains(Shape s);
+ Shape getShapeByIdx(final int id);
+ Shape getShapeByID(final int id);
+ Shape getShapeByName(final String name);
+
AABBox getBounds(final PMVMatrix4f pmv, Shape shape);
/** Enable or disable {@link PMVMatrix4f#getFrustum()} culling per {@link Shape}. Default is disabled. */
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index fc29b5eb2..38e1fd12e 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -272,12 +272,10 @@ public class Group extends Shape implements Container {
firstGS = (GraphShape)s;
}
layouter.preValidate(s);
- if( s.isShapeDirty() ) {
- if( null != gl ) {
- s.validate(gl);
- } else {
- s.validate(glp);
- }
+ if( null != gl ) {
+ s.validate(gl);
+ } else {
+ s.validate(glp);
}
}
layouter.layout(this, box, pmv);
@@ -287,12 +285,10 @@ public class Group extends Shape implements Container {
if( needsRMs && null == firstGS && s instanceof GraphShape ) {
firstGS = (GraphShape)s;
}
- if( s.isShapeDirty() ) {
- if( null != gl ) {
- s.validate(gl);
- } else {
- s.validate(glp);
- }
+ if( null != gl ) {
+ s.validate(gl);
+ } else {
+ s.validate(glp);
}
pmv.pushMv();
s.setTransformMv(pmv);
@@ -341,6 +337,32 @@ public class Group extends Shape implements Container {
}
@Override
+ public Shape getShapeByIdx(final int id) {
+ if( 0 > id ) {
+ return null;
+ }
+ return shapes.get(id);
+ }
+ @Override
+ public Shape getShapeByID(final int id) {
+ for(final Shape b : shapes) {
+ if(b.getID() == id ) {
+ return b;
+ }
+ }
+ return null;
+ }
+ @Override
+ public Shape getShapeByName(final String name) {
+ for(final Shape b : shapes) {
+ if( b.getName().equals(name) ) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ @Override
public AABBox getBounds(final PMVMatrix4f pmv, final Shape shape) {
pmv.reset();
setTransformMv(pmv);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
index 254f0ae5c..ee32dbf7e 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
@@ -149,7 +149,8 @@ public abstract class Shape {
private final Vec4f rgba_tmp = new Vec4f(0, 0, 0, 1);
private final Vec4f cWhite = new Vec4f(1, 1, 1, 1);
- private int name = -1;
+ private int id = -1;
+ private String name = "noname";
private static final int IO_ENABLED = 1 << 0;
private static final int IO_INTERACTIVE = 1 << 1;
@@ -191,10 +192,15 @@ public abstract class Shape {
this.box = new AABBox();
}
- /** Set a symbolic name for this shape for identification. Default is -1 for noname. */
- public final Shape setName(final int name) { this.name = name; return this; }
+ /** Set a symbolic ID for this shape for identification. Default is -1 for noname. */
+ public final Shape setID(final int id) { this.id = id; return this; }
+ /** Return the optional symbolic ID for this shape. */
+ public final int getID() { return this.id; }
+
+ /** Set a symbolic name for this shape for identification. Default is noname. */
+ public final Shape setName(final String name) { this.name = name; return this; }
/** Return the optional symbolic name for this shape. */
- public final int getName() { return this.name; }
+ public final String getName() { return this.name; }
/** Returns true if this shape is enabled and hence visible, otherwise false. */
public final boolean isEnabled() { return isIO(IO_ENABLED); }
@@ -1149,7 +1155,9 @@ public abstract class Shape {
final String activeS = isIO(IO_ACTIVE) ? ", active" : "";
final String ps = hasPadding() ? padding.toString()+", " : "";
final String bs = hasBorder() ? "border[l "+getBorderThickness()+", c "+getBorderColor()+"], " : "";
- return getDirtyString()+", id "+name+", enabled "+isIO(IO_ENABLED)+activeS+", toggle "+isIO(IO_TOGGLE)+
+ final String idS = -1 != id ? ", id "+id : "";
+ final String nameS = "noname" != name ? ", '"+name+"'" : "";
+ return getDirtyString()+idS+nameS+", enabled "+isIO(IO_ENABLED)+activeS+", toggle "+isIO(IO_TOGGLE)+
", able[toggle "+isIO(IO_TOGGLEABLE)+", iactive "+isInteractive()+", resize "+isResizable()+", move "+this.isDraggable()+
"], pos["+position+"], "+pivotS+scaleS+rotateS+
ps+bs+"box"+box;
@@ -1167,7 +1175,7 @@ public abstract class Shape {
public final boolean isPressed() { return isIO(IO_DOWN); }
/**
- *
+ * Set this shape toggleable, default is off.
* @param toggleable
* @see #isInteractive()
*/
@@ -1180,6 +1188,11 @@ public abstract class Shape {
*/
public boolean isToggleable() { return isIO(IO_TOGGLEABLE); }
+ /**
+ * Set this shape's toggle state, default is off.
+ * @param v
+ * @return
+ */
public final Shape setToggle(final boolean v) {
setIO(IO_TOGGLE, v);
toggleNotify(v);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
index 80d9d0d50..a507e5de1 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java
@@ -189,7 +189,7 @@ public class BoxLayout implements Group.Layout {
s.getBounds().transform(pmv.getMv(), sbox);
pmv.popMv();
- final int x = 0, y = 0;
+ final float x = 0, y = 0;
if( TRACE_LAYOUT ) {
System.err.println("bl("+i+").0: sbox "+sbox+", s "+s);
}
@@ -245,10 +245,8 @@ public class BoxLayout implements Group.Layout {
}
// Position and scale shape
{
- // New shape position, relative to previous position
- final float aX = x + dxh;
- final float aY = y + dyh;
- s.moveTo( aX, aY, s.getPosition().z() );
+ // New shape position
+ s.moveTo( x + dxh, y + dyh, s.getPosition().z() );
// Remove the negative or positive delta on centered axis.
// Only remove negative offset of non-centered axis (i.e. underline)