diff --git a/.classpath b/.classpath index 71d2e6b..ece7b32 100644 --- a/.classpath +++ b/.classpath @@ -23,17 +23,7 @@ - - - - - - - - - - - + @@ -43,12 +33,12 @@ - + - + @@ -58,15 +48,5 @@ - - - - - - - - - - diff --git a/resources/resources/ewol/data/textured3D.frag b/resources/resources/ewol/data/textured3D.frag index 90e2702..da71b96 100644 --- a/resources/resources/ewol/data/textured3D.frag +++ b/resources/resources/ewol/data/textured3D.frag @@ -1,3 +1,5 @@ +#version 400 core + #ifdef GL_ES precision mediump float; precision mediump int; @@ -10,6 +12,7 @@ varying vec2 io_texcoord; varying vec4 io_color; void main(void) { - gl_FragColor = texture2D(in_texID, io_texcoord) * io_color; + vec4 map = texture2D(in_texID, io_texcoord); + gl_FragColor = map * io_color; //gl_FragColor = vec4(1.0,1.0,0.2,0.6); } diff --git a/resources/resources/ewol/data/textured3D.vert b/resources/resources/ewol/data/textured3D.vert index 542ecc6..bfe04d9 100644 --- a/resources/resources/ewol/data/textured3D.vert +++ b/resources/resources/ewol/data/textured3D.vert @@ -1,21 +1,27 @@ +#version 400 core + #ifdef GL_ES precision mediump float; precision mediump int; #endif -// Input : -attribute vec3 in_coord3d; -attribute vec2 in_texture2d; -attribute vec4 in_color; -uniform mat4 in_MatrixTransformation; + +// VBA Input : +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec2 in_textureCoords; +layout (location = 3) in vec4 in_colors; +uniform mat4 in_matrixTransformation; +uniform mat4 in_matrixProjection; +uniform mat4 in_matrixView; // output : varying vec4 io_color; varying vec2 io_texcoord; void main(void) { - gl_Position = in_MatrixTransformation * vec4(in_coord3d, 1.0); + gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * vec4(in_position, 1.0); + //gl_Position = in_MatrixTransformation * vec4(in_position, 1.0); // set texture output coord - io_texcoord = in_texture2d; + io_texcoord = in_textureCoords; // set output color : - io_color = in_color; + io_color = in_colors; } diff --git a/samples/.classpath b/samples/.classpath index 90b1099..ba2572c 100644 --- a/samples/.classpath +++ b/samples/.classpath @@ -6,10 +6,11 @@ + - + diff --git a/samples/.gitignore b/samples/.gitignore index ae3c172..f6df409 100644 --- a/samples/.gitignore +++ b/samples/.gitignore @@ -1 +1,2 @@ /bin/ +/out/ diff --git a/samples/resources/test-ewol/data/mireA.png b/samples/resources/test-ewol/data/mireA.png new file mode 100644 index 0000000..3943c45 Binary files /dev/null and b/samples/resources/test-ewol/data/mireA.png differ diff --git a/samples/resources/test-ewol/data/mireB.jpg b/samples/resources/test-ewol/data/mireB.jpg new file mode 100644 index 0000000..1077ac0 Binary files /dev/null and b/samples/resources/test-ewol/data/mireB.jpg differ diff --git a/samples/src/module-info.java b/samples/src/module-info.java index 269a2aa..7f5ae2f 100644 --- a/samples/src/module-info.java +++ b/samples/src/module-info.java @@ -1,4 +1,5 @@ module sample.atriasoft.ewol { //exports sample.atriasoft.ewol.simpleWindowsWithImage; requires org.atriasoft.ewol; + requires org.atriasoft.etk; } \ No newline at end of file diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java new file mode 100644 index 0000000..19f8beb --- /dev/null +++ b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java @@ -0,0 +1,80 @@ +package sample.atriasoft.ewol.simpleWindowsLabel; + +import org.atriasoft.etk.Configs; +import org.atriasoft.etk.math.Vector2f; +import org.atriasoft.ewol.context.EwolApplication; +import org.atriasoft.ewol.context.EwolContext; + +public class Appl implements EwolApplication { + + //! [ewol_sample_HW_main_application] + private void localCreate(final EwolContext context) { + //! [ewol_sample_HW_main_parse_arguments] + // parse all the argument of the application + for (int iii = 0; iii < context.getCmd().size(); iii++) { + String tmpppp = context.getCmd().get(iii); + if (tmpppp == "-h" || tmpppp == "--help") { + Log.print(" -h/--help display this help"); + System.exit(0); + } + } + //! [ewol_sample_HW_main_parse_arguments] + //! [ewol_sample_HW_main_set_windows_size] + // TODO : Remove this: Move if in the windows properties + context.setSize(new Vector2f(800, 600)); + //! [ewol_sample_HW_main_set_windows_size] + //! [ewol_sample_HW_main_set_font_property] + // select font preference of der with a basic application size + Configs.getConfigFonts().set("FreeSherif", 12); + //! [ewol_sample_HW_main_set_font_property] + //! [ewol_sample_HW_main_set_windows] + // Create the windows + MainWindows basicWindows = new MainWindows(); + // configure the ewol context to use the new windows + context.setWindows(basicWindows); + //! [ewol_sample_HW_main_set_windows] + } + + @Override + public void onCreate(final EwolContext context) { + Log.info("Application onCreate: [BEGIN]"); + localCreate(context); + Log.info("Application onCreate: [ END ]"); + } + + @Override + public void onDestroy(final EwolContext context) { + Log.info("Application onDestroy: [BEGIN]"); + + Log.info("Application onDestroy: [ END ]"); + } + + @Override + public void onPause(final EwolContext context) { + Log.info("Application onPause: [BEGIN]"); + + Log.info("Application onPause: [ END ]"); + } + + @Override + public void onResume(final EwolContext context) { + Log.info("Application onResume: [BEGIN]"); + + Log.info("Application onResume: [ END ]"); + } + + @Override + public void onStart(final EwolContext context) { + Log.info("Application onStart: [BEGIN]"); + + Log.info("Application onStart: [ END ]"); + } + + @Override + public void onStop(final EwolContext context) { + Log.info("Application onStop: [BEGIN]"); + + Log.info("Application onStop: [ END ]"); + } + +} \ No newline at end of file diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/Log.java b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/Log.java new file mode 100644 index 0000000..59b9f42 --- /dev/null +++ b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/Log.java @@ -0,0 +1,39 @@ +package sample.atriasoft.ewol.simpleWindowsLabel; + +public class Log { + private static final String LIBNAME = "LoxelEngine"; + + public static void critical(final String data) { + System.out.println("[C] " + Log.LIBNAME + " | " + data); + } + + public static void debug(final String data) { + System.out.println("[D] " + Log.LIBNAME + " | " + data); + } + + public static void error(final String data) { + System.out.println("[E] " + Log.LIBNAME + " | " + data); + } + + public static void info(final String data) { + System.out.println("[I] " + Log.LIBNAME + " | " + data); + } + + public static void print(final String data) { + System.out.println(data); + } + + public static void todo(final String data) { + System.out.println("[TODO] " + Log.LIBNAME + " | " + data); + } + + public static void verbose(final String data) { + System.out.println("[V] " + Log.LIBNAME + " | " + data); + } + + public static void warning(final String data) { + System.out.println("[W] " + Log.LIBNAME + " | " + data); + } + + private Log() {} +} diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java new file mode 100644 index 0000000..d0c5246 --- /dev/null +++ b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java @@ -0,0 +1,31 @@ +package sample.atriasoft.ewol.simpleWindowsLabel; + +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.ewol.widget.Label; +import org.atriasoft.ewol.widget.Spacer; +import org.atriasoft.ewol.widget.Windows; + +public class MainWindows extends Windows { + + public MainWindows() { + //! [ewol_sample_HW_windows_title] + setPropertyTitle("Simple sample test"); + //EwolObject.getContext().getFontDefault().setName("FreeSans"); + //! [ewol_sample_HW_windows_label] + if (true) { + //! [ewol_sample_HW_windows_title] + Label simpleLabel = new Label(); + simpleLabel.setPropertyValue( + "Hello. World

- Coucou comment ca vas ???
- Pas trop bien, je me suis cassé la jambe.

The end
"); + simpleLabel.setPropertyExpand(new Vector2b(true, true)); + simpleLabel.setPropertyFill(new Vector2b(true, true)); + setSubWidget(simpleLabel); + //! [ewol_sample_HW_windows_label] + } else { + Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyExpand(new Vector2b(true, true)); + simpleSpacer.setPropertyFill(new Vector2b(true, true)); + setSubWidget(simpleSpacer); + } + } +} diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java new file mode 100644 index 0000000..6434b8a --- /dev/null +++ b/samples/src/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java @@ -0,0 +1,15 @@ +package sample.atriasoft.ewol.simpleWindowsLabel; + +import org.atriasoft.etk.Uri; +import org.atriasoft.ewol.Ewol; + +public class SimpleWindowsLabelMain { + public static void main(final String[] args) { + Ewol.init(); + //Uri.addLibrary("ne", MainCollisionTest.class, "testDataLoxelEngine/"); + Uri.setApplication(SimpleWindowsLabelMain.class); + Ewol.run(new Appl(), args); + } + + private SimpleWindowsLabelMain() {} +} diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java index e716a5a..7c8f13a 100644 --- a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java +++ b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java @@ -1,31 +1,24 @@ package sample.atriasoft.ewol.simpleWindowsWithImage; +import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2b; -import org.atriasoft.ewol.widget.Label; -import org.atriasoft.ewol.widget.Spacer; +import org.atriasoft.ewol.widget.ImageDisplay; import org.atriasoft.ewol.widget.Windows; public class MainWindows extends Windows { public MainWindows() { //! [ewol_sample_HW_windows_title] - setPropertyTitle("Simple sample test"); + setPropertyTitle("Simple label"); //EwolObject.getContext().getFontDefault().setName("FreeSans"); //! [ewol_sample_HW_windows_label] - if (true) { - //! [ewol_sample_HW_windows_title] - Label simpleLabel = new Label(); - simpleLabel.setPropertyValue( - "Hello. World

- Coucou comment ca vas ???
- Pas trop bien, je me suis cassé la jambe.

The end
"); - simpleLabel.setPropertyExpand(new Vector2b(true, true)); - simpleLabel.setPropertyFill(new Vector2b(true, true)); - setSubWidget(simpleLabel); - //! [ewol_sample_HW_windows_label] - } else { - Spacer simpleSpacer = new Spacer(); - simpleSpacer.setPropertyExpand(new Vector2b(true, true)); - simpleSpacer.setPropertyFill(new Vector2b(true, true)); - setSubWidget(simpleSpacer); - } + //! [ewol_sample_HW_windows_title] + ImageDisplay testWidget = new ImageDisplay(); + testWidget.setPropertySource(new Uri("DATA", "mireA.png")); + testWidget.setPropertyExpand(new Vector2b(true, true)); + testWidget.setPropertyFill(new Vector2b(true, true)); + setSubWidget(testWidget); + //! [ewol_sample_HW_windows_label] + } } diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java index b1b93ac..5f1261a 100644 --- a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java +++ b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java @@ -6,8 +6,8 @@ import org.atriasoft.ewol.Ewol; public class SimpleWindowsWithImageMain { public static void main(final String[] args) { Ewol.init(); - //Uri.addLibrary("ne", MainCollisionTest.class, "testDataLoxelEngine/"); - Uri.setApplication(SimpleWindowsWithImageMain.class); + //Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/"); + Uri.setApplication(SimpleWindowsWithImageMain.class, "test-ewol/"); Ewol.run(new Appl(), args); } diff --git a/src/org/atriasoft/ewol/annotation/EwolObjectProperty.java b/src/org/atriasoft/ewol/annotation/EwolObjectProperty.java new file mode 100644 index 0000000..1b405f0 --- /dev/null +++ b/src/org/atriasoft/ewol/annotation/EwolObjectProperty.java @@ -0,0 +1,13 @@ +package org.atriasoft.ewol.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.FIELD, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@EwolAnnotation +public @interface EwolObjectProperty { + +} diff --git a/src/org/atriasoft/ewol/compositing/CompositingImage.java b/src/org/atriasoft/ewol/compositing/CompositingImage.java index 1e15544..ca9cfce 100644 --- a/src/org/atriasoft/ewol/compositing/CompositingImage.java +++ b/src/org/atriasoft/ewol/compositing/CompositingImage.java @@ -19,7 +19,7 @@ import org.atriasoft.gale.backend3d.OpenGL.RenderMode; import org.atriasoft.gale.resource.ResourceProgram; import org.atriasoft.gale.resource.ResourceTexture2; import org.atriasoft.gale.resource.ResourceTextureFile; -import org.atriasoft.gale.resource.ResourceVirtualBufferObject; +import org.atriasoft.gale.resource.ResourceVirtualArrayObject; public class CompositingImage extends Compositing { public static final int NB_VBO = 3; @@ -30,26 +30,28 @@ public class CompositingImage extends Compositing { public static final int VBO_ID_COORD_TEX = 1; private float angle = 0; //!< Angle to set at the axes private boolean clippingEnable = true; //!< true if the clipping must be activated - private Vector3f clippingPosStart = new Vector3f(0, 0, 0); //!< Clipping start position - private Vector3f clippingPosStop = new Vector3f(0, 0, 0); //!< Clipping stop position + private Vector3f clippingPosStart = Vector3f.ZERO; //!< Clipping start position + private Vector3f clippingPosStop = Vector3f.ZERO; //!< Clipping stop position private Color color = new Color(1, 1, 1); //!< The text foreground color private Uri filename; - private int oGLColor = -1; //!< openGL id on the element (color buffer) - private int oGLMatrix = -1; //!< openGL id on the element (transformation matrix) + private final int oGLColor = -1; //!< openGL id on the element (color buffer) + protected int oGLMatrixProjection = -1; //!< openGL id on the element (Projection matrix) + protected int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix) + protected int oGLMatrixView = -1; //!< openGL id on the element (view matrix) private int oGLPosition = -1; //!< openGL id on the element (vertex buffer) private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program private int oGLtexID = -1; //!< openGL id on the element (texture ID) - private int oGLtexture = -1; //!< openGL id on the element (Texture position) - private Vector3f position = new Vector3f(0, 0, 0); //!< The current position to draw + private final int oGLtexture = -1; //!< openGL id on the element (Texture position) + private Vector3f position = Vector3f.ZERO; //!< The current position to draw private Vector2i requestSize = new Vector2i(2, 2); private ResourceTextureFile resource = null; //!< texture resources private ResourceTexture2 resourceImage = null; //!< texture resources - private ResourceVirtualBufferObject vbo = null; + private ResourceVirtualArrayObject vbo = null; - final Color[] vboDataColors = new Color[6]; - final Vector3f[] vboDataCoords = new Vector3f[6]; - final Vector2f[] vboDataCoordsTex = new Vector2f[6]; + private Color[] vboDataColors = null; + private Vector3f[] vboDataCoords = null; + private Vector2f[] vboDataCoordsTex = null; public CompositingImage() { this(new Uri("DATA", ""), CompositingImage.SIZE_AUTO); @@ -63,7 +65,7 @@ public class CompositingImage extends Compositing { public CompositingImage(final Uri uri, final int size) { this.filename = uri; // Create the VBO: - this.vbo = ResourceVirtualBufferObject.create(CompositingImage.NB_VBO); + this.vbo = ResourceVirtualArrayObject.createDynamic(); if (this.vbo == null) { Log.error("can not instanciate VBO ..."); return; @@ -84,9 +86,9 @@ public class CompositingImage extends Compositing { // reset Buffer : this.vbo.clear(); // reset temporal variables : - this.position = new Vector3f(0, 0, 0); - this.clippingPosStart = new Vector3f(0, 0, 0); - this.clippingPosStop = new Vector3f(0, 0, 0); + this.position = Vector3f.ZERO; + this.clippingPosStart = Vector3f.ZERO; + this.clippingPosStop = Vector3f.ZERO; this.clippingEnable = false; this.color = Color.WHITE; this.angle = 0; @@ -119,9 +121,13 @@ public class CompositingImage extends Compositing { OpenGL.enable(OpenGL.Flag.flag_depthTest); } // set Matrix : translation/positionMatrix - final Matrix4f tmpMatrix = OpenGL.getMatrix().multiply(this.matrixApply); + final Matrix4f projMatrix = OpenGL.getMatrix(); + final Matrix4f camMatrix = OpenGL.getCameraMatrix(); this.oGLprogram.use(); - this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix); + this.vbo.bindForRendering(); + this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix); + this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, this.matrixApply); + this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix); // TextureID if (this.resourceImage != null) { this.resourceImage.bindForRendering(0); @@ -130,25 +136,17 @@ public class CompositingImage extends Compositing { } else { Log.error("FONT type error Request normal and display distance field ..."); } - // position: - this.oGLprogram.sendAttributePointer(this.oGLPosition, this.vbo, CompositingImage.VBO_ID_COORD); - // Texture: - this.oGLprogram.sendAttributePointer(this.oGLtexture, this.vbo, CompositingImage.VBO_ID_COORD_TEX); - // color: - this.oGLprogram.sendAttributePointer(this.oGLColor, this.vbo, CompositingImage.VBO_ID_COLOR); - // Request the draw of the elements: - OpenGL.drawArrays(RenderMode.TRIANGLE, 0, this.vbo.bufferSize(CompositingImage.VBO_ID_COORD)); - + this.vbo.renderArrays(RenderMode.TRIANGLE); + this.vbo.unBindForRendering(); this.oGLprogram.unUse(); } @Override public void flush() { - - this.vbo.setVboData(CompositingImage.VBO_ID_COORD, this.vboDataCoords); - this.vbo.setVboData(CompositingImage.VBO_ID_COORD_TEX, this.vboDataCoordsTex); - this.vbo.setVboData(CompositingImage.VBO_ID_COLOR, this.vboDataColors); - + this.vbo.setPosition(this.vboDataCoords); + this.vbo.setTextureCoordinate(this.vboDataCoordsTex); + this.vbo.setColors(this.vboDataColors); + this.vbo.setVertexCount(this.vboDataCoords.length); this.vbo.flush(); } @@ -190,16 +188,15 @@ public class CompositingImage extends Compositing { this.oGLPosition = 0; this.oGLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"), new Uri("DATA", "textured3D.frag", "ewol")); if (this.oGLprogram != null) { - this.oGLPosition = this.oGLprogram.getAttribute("in_coord3d"); - this.oGLColor = this.oGLprogram.getAttribute("in_color"); - this.oGLtexture = this.oGLprogram.getAttribute("in_texture2d"); - this.oGLMatrix = this.oGLprogram.getUniform("in_MatrixTransformation"); + this.oGLMatrixTransformation = this.oGLprogram.getUniform("in_matrixTransformation"); + this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection"); + this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView"); this.oGLtexID = this.oGLprogram.getUniform("in_texID"); } } public void print(final Vector2f size) { - printPart(size, new Vector2f(0, 0), new Vector2f(1, 1)); + printPart(size, Vector2f.ZERO, Vector2f.ONE); } /** @@ -226,6 +223,10 @@ public class CompositingImage extends Compositing { final Vector2f sourcePosStart = sourcePosStartIn.multiply(ratio); final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio); Log.verbose(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart + " stop=" + sourcePosStop); + + this.vboDataColors = new Color[6]; + this.vboDataCoords = new Vector3f[6]; + this.vboDataCoordsTex = new Vector2f[6]; if (this.angle == 0.0f) { Vector3f point = this.position; @@ -276,7 +277,7 @@ public class CompositingImage extends Compositing { final Vector3f limitedSize = new Vector3f(size.x() * 0.5f, size.y() * 0.5f, 0.0f); - Vector3f point = new Vector3f(0, 0, 0); + Vector3f point = Vector3f.ZERO; Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); diff --git a/src/org/atriasoft/ewol/compositing/CompositingText.java b/src/org/atriasoft/ewol/compositing/CompositingText.java index 3cbec18..7b42c0e 100644 --- a/src/org/atriasoft/ewol/compositing/CompositingText.java +++ b/src/org/atriasoft/ewol/compositing/CompositingText.java @@ -356,7 +356,7 @@ public class CompositingText extends TextBase { fontName = Configs.getConfigFonts().getName(); } Uri fontUri = Configs.getConfigFonts().getFontUri(fontName).clone(); - fontUri.setproperty("size", Integer.toString(fontSize)); + fontUri.setProperty("size", Integer.toString(fontSize)); Log.verbose("plop : " + fontName + " size=" + fontSize + " result :" + fontName); // link to new one this.font = ResourceTexturedFont.create(fontUri); diff --git a/src/org/atriasoft/ewol/widget/Button.java b/src/org/atriasoft/ewol/widget/Button.java index 9f17bd6..d98cf5e 100644 --- a/src/org/atriasoft/ewol/widget/Button.java +++ b/src/org/atriasoft/ewol/widget/Button.java @@ -16,9 +16,9 @@ import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.gale.key.KeyStatus; /** @@ -39,13 +39,13 @@ public class Button extends Widget { /// Periodic call handle to remove it when needed protected Connection periodicConnectionHanble = new Connection(); @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "config") @EwolDescription(value = "configuration of the widget") private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol"); @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "value") @EwolDescription(value = "Value display in the entry (decorated text)") private String propertyValue = "Test Text..."; //!< string that must be displayed diff --git a/src/org/atriasoft/ewol/widget/ContainerN.java b/src/org/atriasoft/ewol/widget/ContainerN.java index 8d9da0a..0bb64e0 100644 --- a/src/org/atriasoft/ewol/widget/ContainerN.java +++ b/src/org/atriasoft/ewol/widget/ContainerN.java @@ -16,9 +16,9 @@ import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.exml.model.XmlElement; import org.atriasoft.exml.model.XmlNode; @@ -29,7 +29,7 @@ import org.atriasoft.exml.model.XmlNode; public class ContainerN extends Widget { @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "lock") @EwolDescription(value = "Lock the subwidget expand") protected Vector2b propertyLockExpand = new Vector2b(false, false); //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget diff --git a/src/org/atriasoft/ewol/widget/Entry.java b/src/org/atriasoft/ewol/widget/Entry.java index ecb3499..6286cbf 100644 --- a/src/org/atriasoft/ewol/widget/Entry.java +++ b/src/org/atriasoft/ewol/widget/Entry.java @@ -21,9 +21,9 @@ import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.gale.context.ClipBoard; import org.atriasoft.gale.context.ClipboardList; import org.atriasoft.gale.key.KeyKeyboard; @@ -60,36 +60,36 @@ public class Entry extends Widget { /// Periodic call handle to remove it when needed protected Connection periodicConnectionHanble = new Connection(); @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "config") @EwolDescription(value = "configuration of the widget") private Uri propertyConfig = new Uri("THEME", "shape/Entry.json", "ewol"); @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "max") @EwolDescription(value = "Maximum char that can be set on the Entry") private int propertyMaxCharacter = Integer.MAX_VALUE; //!< number max of Character in the list @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "password") @EwolDescription(value = "Not display content in password mode") private boolean propertyPassword = false; //!< Disable display of the content of the entry /// regular expression value @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "regex") @EwolDescription(value = "Control what it is write with a regular expression") private String propertyRegex = ".*"; /// Text to display when nothing in in the entry (decorated text...) @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "empty-text") @EwolDescription(value = "Text when nothing is written") private String propertyTextWhenNothing = null; @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "value") @EwolDescription(value = "Value display in the entry (decorated text)") private String propertyValue = "Test Text..."; //!< string that must be displayed diff --git a/src/org/atriasoft/ewol/widget/ImageDisplay.java b/src/org/atriasoft/ewol/widget/ImageDisplay.java index bbae8cc..63905e0 100644 --- a/src/org/atriasoft/ewol/widget/ImageDisplay.java +++ b/src/org/atriasoft/ewol/widget/ImageDisplay.java @@ -18,9 +18,9 @@ import org.atriasoft.ewol.compositing.CompositingImage; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceColorFile; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.exml.model.XmlElement; import org.atriasoft.gale.key.KeyStatus; @@ -32,46 +32,16 @@ public class ImageDisplay extends Widget { protected ResourceColorFile colorProperty = null; //!< theme color property protected CompositingImage compositing = new CompositingImage(); //!< compositing element of the image. protected Vector2f imageRenderSize = Vector2f.ZERO; //!< size of the image when we render it - @XmlManaged - @XmlProperty - @XmlName(value = "border") - @EwolDescription(value = "Border of the image") + protected Dimension propertyBorder = Dimension.ZERO; //!< border to add at the image. - @XmlManaged - @XmlProperty - @XmlName(value = "size") - @EwolDescription(value = "Basic display size of the image") protected Dimension propertyImageSize = Dimension.ZERO; //!< border to add at the image. - @XmlManaged - @XmlProperty - @XmlName(value = "ratio") - @EwolDescription(value = "Keep ratio of the image") protected boolean propertyKeepRatio = true; //!< keep the image ratio between width and hight - @XmlManaged - @XmlProperty - @XmlName(value = "part-start") - @EwolDescription(value = "Start display position in the image") protected Vector2f propertyPosStart = Vector2f.ZERO; //!< position in the image to start the sisplay (when we want not to display all the image) - @XmlManaged - @XmlProperty - @XmlName(value = "part-stop") - @EwolDescription(value = "Start display position in the image") - protected Vector2f propertyPosStop = Vector2f.ZERO; //!< position in the image to start the sisplay (when we want not to display all the image) + protected Vector2f propertyPosStop = Vector2f.ONE; //!< position in the image to start the sisplay (when we want not to display all the image) - @XmlManaged - @XmlProperty - @XmlName(value = "smooth") - @EwolDescription(value = "Smooth display of the image") - protected boolean propertySmooth = true; //!< display is done in the pixed approximation if false - @XmlManaged - @XmlProperty - @XmlName(value = "src") - @EwolDescription(value = "Image source path") + + protected boolean propertySmooth = true; //!< display is done in the pixel approximation if false protected Uri propertySource = null; //!< file name of the image. - @XmlManaged - @XmlProperty - @XmlName(value = "use-theme-color") - @EwolDescription(value = "Use the theme color to display images") protected boolean propertyUseThemeColor = false; //!< Use the themo color management ("THEMECOLOR:///Image.json?lib=ewol") default false @EwolSignal(name = "pressed") @EwolDescription(value = "Image is pressed") @@ -110,34 +80,64 @@ public class ImageDisplay extends Widget { markToRedraw(); } + @XmlManaged + @XmlAttribute + @XmlName(value = "border") + @EwolDescription(value = "Border of the image") public Dimension getPropertyBorder() { return this.propertyBorder; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "size") + @EwolDescription(value = "Basic display size of the image") public Dimension getPropertyImageSize() { return this.propertyImageSize; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "part-start") + @EwolDescription(value = "Start display position in the image") public Vector2f getPropertyPosStart() { return this.propertyPosStart; } - + @XmlManaged + @XmlAttribute + @XmlName(value = "part-stop") + @EwolDescription(value = "Start display position in the image") public Vector2f getPropertyPosStop() { return this.propertyPosStop; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "src") + @EwolDescription(value = "Image source path") public Uri getPropertySource() { return this.propertySource; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "ratio") + @EwolDescription(value = "Keep ratio of the image") public boolean isPropertyKeepRatio() { return this.propertyKeepRatio; } - + @XmlManaged + @XmlAttribute + @XmlName(value = "smooth") + @EwolDescription(value = "Smooth display of the image") public boolean isPropertySmooth() { return this.propertySmooth; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "use-theme-color") + @EwolDescription(value = "Use the theme color to display images") public boolean isPropertyUseThemeColor() { return this.propertyUseThemeColor; } @@ -263,6 +263,7 @@ public class ImageDisplay extends Widget { Log.debug("Paint Image at : " + origin + " size=" + imageRealSize); Log.debug("Paint Image :" + this.propertySource + " realsize=" + this.compositing.getRealSize() + " origin=" + origin + " size=" + imageRealSize); Log.debug(" start=" + this.propertyPosStart + " stop=" + this.propertyPosStop); + this.compositing.flush(); } /** @@ -343,7 +344,7 @@ public class ImageDisplay extends Widget { } public void setPropertySource(final Uri propertySource) { - if (this.propertySource.equals(propertySource)) { + if (this.propertySource != null && this.propertySource.equals(propertySource)) { return; } this.propertySource = propertySource; diff --git a/src/org/atriasoft/ewol/widget/Label.java b/src/org/atriasoft/ewol/widget/Label.java index 4270415..9eee268 100644 --- a/src/org/atriasoft/ewol/widget/Label.java +++ b/src/org/atriasoft/ewol/widget/Label.java @@ -19,9 +19,9 @@ import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceColorFile; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.exml.model.XmlElement; import org.atriasoft.gale.key.KeyStatus; @@ -30,18 +30,18 @@ public class Label extends Widget { protected int colorDefaultFgText = -1; //!< Default color of the text protected ResourceColorFile colorProperty; //!< theme color property @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "auto-translate") @EwolDescription(value = "Translate the String with the marker {T:xxxxxx}") protected boolean propertyAutoTranslate = true; //!< if at true the data is translate automaticaly translate. @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "font-size") @EwolDescription(value = "Default font size (0=> system default)") protected int propertyFontSize = 0; //!< default size of the font. @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "value") @EwolDescription(value = "Displayed value string") protected String propertyValue = ""; //!< decorated text to display. diff --git a/src/org/atriasoft/ewol/widget/ProgressBar.java b/src/org/atriasoft/ewol/widget/ProgressBar.java index 513cd8a..120a343 100644 --- a/src/org/atriasoft/ewol/widget/ProgressBar.java +++ b/src/org/atriasoft/ewol/widget/ProgressBar.java @@ -10,32 +10,17 @@ import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.CompositingDrawing; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; class ProgressBar extends Widget { private static final int DOT_RADIUS = 6; private final CompositingDrawing draw = new CompositingDrawing(); // basic drawing element - @XmlManaged - @XmlProperty - @XmlName(value = "color-off") - @EwolDescription(value = "Color of the false value") + protected Color propertyTextColorBgOff = Color.NONE; - @XmlManaged - @XmlProperty - @XmlName(value = "color-on") - @EwolDescription(value = "Color of the true value") protected Color propertyTextColorBgOn = Color.GREEN; - @XmlManaged - @XmlProperty - @XmlName(value = "color-bg") - @EwolDescription(value = "ackground color") protected Color propertyTextColorFg = Color.BLACK; - @XmlManaged - @XmlProperty - @XmlName(value = "value") - @EwolDescription(value = "Value of the progress bar [0..1]") protected float propertyValue = 0; public ProgressBar() { @@ -48,19 +33,34 @@ class ProgressBar extends Widget { this.minSize = new Vector2f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f)); markToRedraw(); } - + @XmlManaged + @XmlAttribute + @XmlName(value = "color-off") + @EwolDescription(value = "Color of the false value") public Color getPropertyTextColorBgOff() { return this.propertyTextColorBgOff; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "color-on") + @EwolDescription(value = "Color of the true value") public Color getPropertyTextColorBgOn() { return this.propertyTextColorBgOn; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "color-bg") + @EwolDescription(value = "ackground color") public Color getPropertyTextColorFg() { return this.propertyTextColorFg; } - + + @XmlManaged + @XmlAttribute + @XmlName(value = "value") + @EwolDescription(value = "Value of the progress bar [0..1]") public float getPropertyValue() { return this.propertyValue; } diff --git a/src/org/atriasoft/ewol/widget/Sizer.java b/src/org/atriasoft/ewol/widget/Sizer.java index 2a422d0..4263645 100644 --- a/src/org/atriasoft/ewol/widget/Sizer.java +++ b/src/org/atriasoft/ewol/widget/Sizer.java @@ -13,10 +13,11 @@ import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2i; import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.annotation.EwolDescription; +import org.atriasoft.ewol.annotation.EwolObjectProperty; import org.atriasoft.ewol.internal.Log; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; public class Sizer extends ContainerN { public enum DisplayMode { @@ -24,17 +25,9 @@ public class Sizer extends ContainerN { modeVert; //!< Horizontal mode } - @XmlManaged - @XmlProperty - @XmlName(value = "border") - @EwolDescription(value = "The sizer border size") - public Dimension propertyBorderSize = new Dimension(Vector2f.ZERO, Distance.PIXEL); //!< Border size needed for all the display + protected Dimension propertyBorderSize = new Dimension(Vector2f.ZERO, Distance.PIXEL); //!< Border size needed for all the display - @XmlManaged - @XmlProperty - @XmlName(value = "mode") - @EwolDescription(value = "The display mode") - public DisplayMode propertyMode = DisplayMode.modeHori; //!< Methode to display the widget list (vert/hory ...) + protected DisplayMode propertyMode = DisplayMode.modeHori; //!< Methode to display the widget list (vert/hory ...) /** * Constructor @@ -87,11 +80,21 @@ public class Sizer extends ContainerN { this.minSize = this.minSize.add(tmpBorderSize.multiply(2)); //Log.error("[" + getId() + "] {" + getObjectType() + "} Result min size : " + this.minSize); } - + + @XmlManaged + @XmlAttribute + @XmlName("border") + @EwolObjectProperty + @EwolDescription("The sizer border size") public Dimension getPropertyBorderSize() { return this.propertyBorderSize; } - + + @XmlManaged + @XmlAttribute + @XmlName("mode") + @EwolObjectProperty + @EwolDescription("The display mode") public DisplayMode getPropertyMode() { return this.propertyMode; } diff --git a/src/org/atriasoft/ewol/widget/Spacer.java b/src/org/atriasoft/ewol/widget/Spacer.java index b3a6986..94115b2 100644 --- a/src/org/atriasoft/ewol/widget/Spacer.java +++ b/src/org/atriasoft/ewol/widget/Spacer.java @@ -11,9 +11,9 @@ import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.CompositingDrawing; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; /** * @ingroup ewolWidgetGroup @@ -21,7 +21,7 @@ import org.atriasoft.exml.annotation.XmlProperty; public class Spacer extends Widget { private final CompositingDrawing draw = new CompositingDrawing(); //!< Compositing drawing element @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "color") @EwolDescription(value = "background of the spacer") protected Color propertyColor = Color.GREEN; //!< Background color diff --git a/src/org/atriasoft/ewol/widget/Widget.java b/src/org/atriasoft/ewol/widget/Widget.java index 93764c9..9dc0c7a 100644 --- a/src/org/atriasoft/ewol/widget/Widget.java +++ b/src/org/atriasoft/ewol/widget/Widget.java @@ -31,10 +31,10 @@ import org.atriasoft.ewol.event.EventShortCut; import org.atriasoft.ewol.event.InputSystem; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlDefaultManaged; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.exml.model.XmlElement; import org.atriasoft.gale.backend3d.OpenGL; import org.atriasoft.gale.context.ClipboardList; @@ -89,43 +89,43 @@ public class Widget extends EwolObject { protected Vector2f origin = new Vector2f(0, 0); //!< internal ... I do not really known how if can use it ... @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "focus") @EwolDescription(value = "enable the widget to have the focus capacity") protected boolean propertyCanFocus = false; //!< the focus can be done on this widget @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "expand") @EwolDescription(value = "Request the widget Expand size while space is available") protected Vector2b propertyExpand = new Vector2b(false, false); //!< the widget will expand if possible @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "fill") @EwolDescription(value = "Fill the widget available size") protected Vector2b propertyFill = new Vector2b(true, true); //!< the widget will fill all the space provided by the parent. @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "gravity") @EwolDescription(value = "Gravity orientation") protected Gravity propertyGravity = Gravity.buttomLeft; //!< Gravity of the widget @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "hide") @EwolDescription(value = "The widget start hided") protected boolean propertyHide = false; //!< hide a widget on the display @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "max-size") @EwolDescription(value = "User maximum size") protected Dimension propertyMaxSize = new Dimension(new Vector2f(999999, 999999), Distance.PIXEL); //!< user define the maximum size of the widget @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "min-size") @EwolDescription(value = "User minimum size") protected Dimension propertyMinSize = new Dimension(new Vector2f(0, 0), Distance.PIXEL); //!< user define the minimum size of the widget diff --git a/src/org/atriasoft/ewol/widget/Windows.java b/src/org/atriasoft/ewol/widget/Windows.java index 7339f74..6e44b21 100644 --- a/src/org/atriasoft/ewol/widget/Windows.java +++ b/src/org/atriasoft/ewol/widget/Windows.java @@ -21,9 +21,9 @@ import org.atriasoft.ewol.context.EwolContext; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.ewol.resource.ResourceColorFile; +import org.atriasoft.exml.annotation.XmlAttribute; import org.atriasoft.exml.annotation.XmlManaged; import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlProperty; import org.atriasoft.gale.backend3d.OpenGL; /** @@ -36,12 +36,12 @@ public class Windows extends Widget { protected List popUpWidgetList = new ArrayList(); @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "file-color") @EwolDescription(value = "File color of the Windows") public Uri propertyColorConfiguration = new Uri("THEME", "color/Windows.json", "ewol"); //!< Configuration file of the windows theme @XmlManaged - @XmlProperty + @XmlAttribute @XmlName(value = "title") @EwolDescription(value = "Title of the windows") public String propertyTitle = "No title"; //!< Current title of the windows