[DEV] add checkbox ready ==> must be optimized...
This commit is contained in:
parent
a374caf9ba
commit
1f315d1afd
15
blender_files/exportEmf.py
Normal file
15
blender_files/exportEmf.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import bpy
|
||||||
|
|
||||||
|
##To export manualy a emf... (for test ...)
|
||||||
|
# blender --background -P ./exportEmf.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
list_elem = [
|
||||||
|
"Entry",
|
||||||
|
"CheckBox"
|
||||||
|
]
|
||||||
|
|
||||||
|
for elem in list_elem:
|
||||||
|
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/jatria-soft/ewol/blender_files/" + elem + ".blend")
|
||||||
|
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/jatria-soft/ewol/resources/resources/ewol/theme/shape/" + elem + ".emf")
|
90
resources/resources/ewol/theme/shape/CheckBox.emf
Normal file
90
resources/resources/ewol/theme/shape/CheckBox.emf
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
EMF(STRING)
|
||||||
|
# Blender v3.0.0 EMF File: 'CheckBox.blend'
|
||||||
|
Mesh:CheckBox_Cube
|
||||||
|
Vertex:16
|
||||||
|
20.042355 19.982376 -7.860689|20.042355 -20.102333 -7.862826|20.042355 19.981716 4.524041|20.042355 -20.102993 4.521903|-20.042355 19.982376 -7.860689|-20.042355 -20.102333 -7.862826|-20.042355 19.981716 4.524041|-20.042355 -20.102993 4.521903|10.127714 10.066911 7.616918|10.127714 -10.188519 7.615837|-10.127714 10.066911 7.616918|-10.127714 -10.188519 7.615837|-10.199120 -10.192897 3.116539|-10.199120 10.181330 3.117619|10.199120 10.181330 3.117619|10.199120 -10.192897 3.116539|
|
||||||
|
UV-mapping:
|
||||||
|
0.074219 0.995849|0.120606 0.943115|0.121582 0.993408|0.112927 0.992387|0.078245 0.948093|0.073324 0.991157|0.101769 0.970961|0.080974 0.959440|0.102023 0.957458|0.111927 0.985005|0.078476 0.953015|0.082167 0.983774|0.074219 0.944092|0.111696 0.944402|0.080720 0.975385|0.113157 0.949323|0.174907 0.947863|0.131613 0.991157|0.132843 0.945402|0.178368 0.944941|0.137534 0.984544|0.142456 0.948632|0.171985 0.949093|0.136074 0.991157|0.137304 0.950323|0.174677 0.949093|0.135074 0.992387|0.136304 0.949093|0.178598 0.993618|0.178368 0.988235|0.173216 0.991157|0.175907 0.989926|0.013265 0.951784|0.051868 0.992387|0.013034 0.993618|0.054098 0.951784|0.137534 0.988235|0.177138 0.947863|0.135074 0.947862|0.172446 0.988465|
|
||||||
|
Normal(face):28
|
||||||
|
-0.297843 -0.000051 0.954615|0.000000 -0.297894 0.954599|0.000000 0.297792 0.954631|0.297843 -0.000051 0.954615|0.000000 1.000000 0.000053|-1.000000 0.000000 0.000000|0.000000 -1.000000 -0.000053|1.000000 -0.000000 -0.000000|-0.999874 0.000001 -0.015868|0.000000 -0.999677 -0.025422|0.999874 0.000001 -0.015868|0.000000 1.000000 -0.000973|0.000000 -0.000053 1.000000|0.000000 0.000053 -1.000000|
|
||||||
|
Face:28
|
||||||
|
palette:gui_border_1
|
||||||
|
7/0/0 10/1/0 6/2/0| 3/3/1 11/4/1 7/5/1| 6/6/2 8/7/2 2/8/2| 2/9/3 9/10/3 3/11/3| 7/0/0 11/12/0 10/1/0| 3/3/1 9/13/1 11/4/1| 6/6/2 10/14/2 8/7/2| 2/9/3 8/15/3 9/10/3|
|
||||||
|
palette:gui_border_2
|
||||||
|
4/16/4 2/17/4 0/18/4| 6/19/5 5/20/5 7/21/5| 1/22/6 7/23/6 5/24/6| 0/25/7 3/26/7 1/27/7| 4/16/4 6/28/4 2/17/4| 6/19/5 4/29/5 5/20/5| 1/22/6 3/30/6 7/23/6| 0/25/7 2/31/7 3/26/7|
|
||||||
|
pallette_gui_border_inside
|
||||||
|
8/7/8 15/32/8 9/10/8| 13/33/9 8/7/9 10/14/9| 10/14/10 12/34/10 13/33/10| 15/32/11 11/4/11 9/10/11| 8/7/8 14/35/8 15/32/8| 13/33/9 14/35/9 8/7/9| 10/14/10 11/4/10 12/34/10| 15/32/11 12/34/11 11/4/11|
|
||||||
|
palette:gui_center
|
||||||
|
15/32/12 13/33/12 12/34/12| 15/32/12 14/35/12 13/33/12|
|
||||||
|
palette:gui_back
|
||||||
|
5/36/13 0/37/13 1/38/13| 5/36/13 4/39/13 0/37/13|
|
||||||
|
Mesh:Check_Cube.001
|
||||||
|
Vertex:24
|
||||||
|
8.995508 -7.035839 7.616555|6.980225 -8.995319 7.616555|8.995420 -8.995663 7.616555|9.004554 7.030243 7.616555|-7.023398 -9.003085 7.616555|-9.002556 -9.002914 7.616555|-9.002995 -7.043067 7.616555|-8.995707 7.044378 7.616555|-8.996955 9.000613 7.616555|-7.018671 8.999785 7.616555|6.991146 8.995932 7.616555|9.004070 8.994483 7.616555|8.995508 -7.035839 3.038752|6.980224 -8.995319 3.038752|8.995419 -8.995663 3.038752|9.004553 7.030243 3.038752|-7.023399 -9.003085 3.038752|-9.002556 -9.002914 3.038752|-9.002996 -7.043067 3.038752|-8.995708 7.044378 3.038752|-8.996956 9.000613 3.038752|-7.018671 8.999785 3.038752|6.991146 8.995932 3.038752|9.004069 8.994483 3.038752|
|
||||||
|
UV-mapping:
|
||||||
|
0.000000 0.000000|
|
||||||
|
Normal(face):32
|
||||||
|
0.000000 0.000000 1.000000|-1.000000 -0.000638 0.000000|-0.000170 -1.000000 0.000000|0.000720 1.000000 -0.000000|-1.000000 -0.000224 -0.000000|1.000000 0.000246 -0.000000|0.707580 0.706634 0.000000|0.707225 -0.706988 0.000000|-0.708096 0.706116 0.000000|-0.000086 -1.000000 0.000000|0.000418 1.000000 -0.000000|1.000000 -0.000045 0.000000|-0.708514 -0.705697 0.000000|-1.000000 -0.000225 0.000000|1.000000 -0.000046 -0.000000|
|
||||||
|
Face:32
|
||||||
|
palette:gui_checked
|
||||||
|
5/0/0 4/0/0 6/0/0| 8/0/1 19/0/1 7/0/1| 1/0/2 14/0/2 2/0/2| 10/0/3 23/0/3 22/0/3| 6/0/4 17/0/4 5/0/4| 3/0/5 23/0/5 11/0/5| 12/0/6 9/0/6 0/0/6| 16/0/7 3/0/7 4/0/7| 6/0/8 22/0/8 18/0/8| 5/0/9 16/0/9 4/0/9| 9/0/10 20/0/10 8/0/10| 2/0/11 12/0/11 0/0/11| 7/0/12 13/0/12 1/0/12| 9/0/0 1/0/0 0/0/0| 8/0/0 7/0/0 9/0/0| 4/0/0 10/0/0 6/0/0| 10/0/0 3/0/0 11/0/0| 2/0/0 0/0/0 1/0/0| 8/0/1 20/0/1 19/0/1| 1/0/2 13/0/2 14/0/2| 10/0/3 11/0/3 23/0/3| 6/0/13 18/0/13 17/0/13| 3/0/5 15/0/5 23/0/5| 12/0/6 21/0/6 9/0/6| 16/0/7 15/0/7 3/0/7| 6/0/8 10/0/8 22/0/8| 5/0/9 17/0/9 16/0/9| 9/0/10 21/0/10 20/0/10| 2/0/14 14/0/14 12/0/14| 7/0/12 19/0/12 13/0/12| 9/0/0 7/0/0 1/0/0| 4/0/0 3/0/0 10/0/0|
|
||||||
|
|
||||||
|
# Just for information:
|
||||||
|
Palettes:gui_back
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.800000 0.000000 0.005632
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
vNi 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
# Just for information:
|
||||||
|
Palettes:gui_border_1
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.000000 0.002615 0.800000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
vNi 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
# Just for information:
|
||||||
|
Palettes:gui_border_2
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.000000 0.800000 0.170495
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
vNi 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
# Just for information:
|
||||||
|
Palettes:gui_center
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.438544 0.438544 0.438544
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
vNi 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
# Just for information:
|
||||||
|
Palettes:gui_checked
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.000000 0.000000 0.000000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
vNi 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
Materials:pallette_gui_border_inside
|
||||||
|
Ns 225.000000
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.003877 0.001682 0.147314
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
vNi 1.450000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
@ -6,10 +6,10 @@
|
|||||||
"padding-out-buttom":2,
|
"padding-out-buttom":2,
|
||||||
|
|
||||||
# padding "inside" the object in pixel ==> prevent bad display
|
# padding "inside" the object in pixel ==> prevent bad display
|
||||||
"padding-in-left":2,
|
"padding-in-left":0,
|
||||||
"padding-in-right":2,
|
"padding-in-right":0,
|
||||||
"padding-in-top":2,
|
"padding-in-top":0,
|
||||||
"padding-in-buttom":2,
|
"padding-in-buttom":0,
|
||||||
|
|
||||||
# render program:
|
# render program:
|
||||||
"program-vert":"THEME:shape/aaRenderShape.vert?lib=ewol",
|
"program-vert":"THEME:shape/aaRenderShape.vert?lib=ewol",
|
||||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
EMF(STRING)
|
EMF(STRING)
|
||||||
# Blender v2.92.0 EMF File: 'Entry.blend'
|
# Blender v3.0.0 EMF File: 'Entry.blend'
|
||||||
Mesh:EntryBox_Cube
|
Mesh:EntryBox_Cube
|
||||||
Vertex:16
|
Vertex:16
|
||||||
20.042355 19.982376 -7.860689|20.042355 -20.102333 -7.862826|20.042355 19.981716 4.524041|20.042355 -20.102993 4.521903|-20.042355 19.982376 -7.860689|-20.042355 -20.102333 -7.862826|-20.042355 19.981716 4.524041|-20.042355 -20.102993 4.521903|10.127714 10.066911 7.616918|10.127714 -10.188519 7.615837|-10.127714 10.066911 7.616918|-10.127714 -10.188519 7.615837|-10.127714 -10.188596 7.897926|-10.127714 10.066834 7.899007|10.127714 10.066834 7.899007|10.127714 -10.188596 7.897926|
|
20.042355 19.982376 -7.860689|20.042355 -20.102333 -7.862826|20.042355 19.981716 4.524041|20.042355 -20.102993 4.521903|-20.042355 19.982376 -7.860689|-20.042355 -20.102333 -7.862826|-20.042355 19.981716 4.524041|-20.042355 -20.102993 4.521903|10.127714 10.066911 7.616918|10.127714 -10.188519 7.615837|-10.127714 10.066911 7.616918|-10.127714 -10.188519 7.615837|-10.127714 -10.188596 7.897926|-10.127714 10.066834 7.899007|10.127714 10.066834 7.899007|10.127714 -10.188596 7.897926|
|
||||||
|
@ -9,7 +9,8 @@ precision mediump int;
|
|||||||
layout (location = 0) in vec3 in_position;
|
layout (location = 0) in vec3 in_position;
|
||||||
layout (location = 1) in vec2 in_textureCoords;
|
layout (location = 1) in vec2 in_textureCoords;
|
||||||
|
|
||||||
uniform vec3 in_offsetScale;
|
uniform vec3 in_offsetScaleInside;
|
||||||
|
uniform vec3 in_offsetScaleOutside;
|
||||||
|
|
||||||
uniform mat4 in_matrixTransformation;
|
uniform mat4 in_matrixTransformation;
|
||||||
uniform mat4 in_matrixProjection;
|
uniform mat4 in_matrixProjection;
|
||||||
@ -19,9 +20,31 @@ uniform mat4 in_matrixView;
|
|||||||
out vec2 io_textureCoords;
|
out vec2 io_textureCoords;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 position = vec4(in_position.x + sign(in_position.x)*in_offsetScale.x,
|
float xxx = in_position.x;
|
||||||
in_position.y + sign(in_position.y)*in_offsetScale.y,
|
if (abs(xxx) < 10.0) {
|
||||||
in_position.z + sign(in_position.z)*in_offsetScale.z, 1.0);
|
xxx = xxx * in_offsetScaleInside.x * 0.1;
|
||||||
|
} else {
|
||||||
|
xxx = xxx + sign(xxx)*in_offsetScaleOutside.x;
|
||||||
|
}
|
||||||
|
float yyy = in_position.y;
|
||||||
|
if (abs(yyy) < 10.0) {
|
||||||
|
yyy = yyy * in_offsetScaleInside.y * 0.1;
|
||||||
|
} else {
|
||||||
|
yyy = yyy + sign(yyy)*in_offsetScaleOutside.y;
|
||||||
|
}
|
||||||
|
float zzz = in_position.z;
|
||||||
|
if (abs(zzz) < 10.0) {
|
||||||
|
zzz = zzz * in_offsetScaleInside.z * 0.1;
|
||||||
|
} else {
|
||||||
|
zzz = zzz + sign(zzz)*in_offsetScaleOutside.z;
|
||||||
|
}
|
||||||
|
vec4 position = vec4(xxx, yyy, zzz, 1.0);
|
||||||
|
/*
|
||||||
|
// this is the old mode before checkbox : ==> maybe create 2 shader????
|
||||||
|
vec4 position = vec4(in_position.x + sign(in_position.x)*in_offsetScaleOutside.x,
|
||||||
|
in_position.y + sign(in_position.y)*in_offsetScaleOutside.y,
|
||||||
|
in_position.z + sign(in_position.z)*in_offsetScaleOutside.z, 1.0);
|
||||||
|
*/
|
||||||
gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * position;
|
gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * position;
|
||||||
io_textureCoords = in_textureCoords;
|
io_textureCoords = in_textureCoords;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -27,6 +27,12 @@
|
|||||||
},
|
},
|
||||||
"gui_back":{
|
"gui_back":{
|
||||||
"Kd":"1.0 0.0 0.0"
|
"Kd":"1.0 0.0 0.0"
|
||||||
|
},
|
||||||
|
"gui_checked":{
|
||||||
|
"Kd":"0.0 0.0 0.0"
|
||||||
|
},
|
||||||
|
"gui_border_inside":{
|
||||||
|
"Kd":"0.5 0.5 0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
@ -49,7 +49,8 @@ public class GuiShape extends Compositing {
|
|||||||
private int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix)
|
private int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix)
|
||||||
private int oGLMatrixView = -1; //!< openGL id on the element (view matrix)
|
private int oGLMatrixView = -1; //!< openGL id on the element (view matrix)
|
||||||
private int oGLPaletteOffset = -1; //!< openGL id on the element (offset for the palet rendering)
|
private int oGLPaletteOffset = -1; //!< openGL id on the element (offset for the palet rendering)
|
||||||
private int oGLOffsetScale = -1;
|
private int oGLOffsetScaleInside = -1;
|
||||||
|
private int oGLOffsetScaleOutside = -1;
|
||||||
// openGL shaders programs:
|
// openGL shaders programs:
|
||||||
private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program
|
private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program
|
||||||
// For the Image :
|
// For the Image :
|
||||||
@ -64,10 +65,11 @@ public class GuiShape extends Compositing {
|
|||||||
private Matrix4f transform = Matrix4f.IDENTITY;
|
private Matrix4f transform = Matrix4f.IDENTITY;
|
||||||
private Uri uri; //!< Name of the configuration of the shaper.
|
private Uri uri; //!< Name of the configuration of the shaper.
|
||||||
|
|
||||||
private Vector3f offsetScale = Vector3f.ZERO;
|
private Vector3f offsetScaleInside = Vector3f.ZERO;
|
||||||
|
private Vector3f offsetScaleOutside = Vector3f.ZERO;
|
||||||
|
|
||||||
// dynamic change:
|
// dynamic change:
|
||||||
private float stateTransition = 0; //!< working state between 2 states
|
private float stateTransition = 0; //!< working state between 2 states
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief generic constructor
|
* @brief generic constructor
|
||||||
@ -85,27 +87,7 @@ public class GuiShape extends Compositing {
|
|||||||
loadPalette();
|
loadPalette();
|
||||||
loadProgram();
|
loadProgram();
|
||||||
}
|
}
|
||||||
protected void loadPalette() {
|
|
||||||
String paletteFile = this.config.getString(this.confIdPaletteFile);
|
|
||||||
Uri paletteFileInterface = Uri.valueOf(paletteFile);
|
|
||||||
this.palette = ResourcePaletteFile.create(paletteFileInterface);
|
|
||||||
this.texture = ResourceTexture2.createNamed("TEXTURE_OF_PALETTE:" + paletteFile);
|
|
||||||
if (this.texture == null) {
|
|
||||||
Log.error("can not instanciate Texture ...");
|
|
||||||
}
|
|
||||||
// element already called
|
|
||||||
loadPaletteUpdate();
|
|
||||||
// for next update (realTime reload)
|
|
||||||
this.palette.onUpdate(() -> {
|
|
||||||
loadPaletteUpdate();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
protected void loadPaletteUpdate() {
|
|
||||||
Log.warning("update palet environnement");
|
|
||||||
final ImageByte img = this.palette.getImageByte();
|
|
||||||
//IOgami.storePNG(new Uri("/home/heero/000000000aaaaplopppp.png"), img);
|
|
||||||
this.texture.set(img);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @brief change the current status in an other
|
* @brief change the current status in an other
|
||||||
* @param _newStatusId the next new status requested
|
* @param _newStatusId the next new status requested
|
||||||
@ -156,39 +138,41 @@ public class GuiShape extends Compositing {
|
|||||||
this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, tmpMatrix);
|
this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, tmpMatrix);
|
||||||
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
|
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
|
||||||
|
|
||||||
|
|
||||||
Set<String> layers = this.mesh.getLayers();
|
Set<String> layers = this.mesh.getLayers();
|
||||||
Log.verbose("get layers:" + layers);
|
Log.verbose("get layers:" + layers);
|
||||||
// Texture:
|
// Texture:
|
||||||
float imageDelta = (float)1 / ResourcePaletteFile.getHeight();
|
float imageDelta = (float) 1 / ResourcePaletteFile.getHeight();
|
||||||
float basicValue = this.stateOld.getValue() / ResourcePaletteFile.getHeight();
|
float basicValue = this.stateOld.getValue() / ResourcePaletteFile.getHeight();
|
||||||
if (this.stateOld != this.stateNew) {
|
if (this.stateOld != this.stateNew) {
|
||||||
if(this.stateOld == GuiShapeMode.NORMAL) {
|
if (this.stateOld == GuiShapeMode.NORMAL) {
|
||||||
if (this.stateNew == GuiShapeMode.OVER) {
|
if (this.stateNew == GuiShapeMode.OVER) {
|
||||||
basicValue += imageDelta*this.stateTransition;
|
basicValue += imageDelta * this.stateTransition;
|
||||||
} else if (this.stateNew == GuiShapeMode.SELECT) {
|
} else if (this.stateNew == GuiShapeMode.SELECT) {
|
||||||
basicValue += imageDelta*3.0f - imageDelta*this.stateTransition;
|
basicValue += imageDelta * 3.0f - imageDelta * this.stateTransition;
|
||||||
}
|
}
|
||||||
} else if(this.stateOld == GuiShapeMode.OVER) {
|
} else if (this.stateOld == GuiShapeMode.OVER) {
|
||||||
if (this.stateNew == GuiShapeMode.NORMAL) {
|
if (this.stateNew == GuiShapeMode.NORMAL) {
|
||||||
basicValue -= imageDelta*this.stateTransition;
|
basicValue -= imageDelta * this.stateTransition;
|
||||||
} else if (this.stateNew == GuiShapeMode.SELECT) {
|
} else if (this.stateNew == GuiShapeMode.SELECT) {
|
||||||
basicValue += imageDelta*this.stateTransition;
|
basicValue += imageDelta * this.stateTransition;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if(this.stateOld == GuiShapeMode.SELECT) {
|
} else if (this.stateOld == GuiShapeMode.SELECT) {
|
||||||
if (this.stateNew == GuiShapeMode.NORMAL) {
|
if (this.stateNew == GuiShapeMode.NORMAL) {
|
||||||
basicValue += imageDelta*this.stateTransition;
|
basicValue += imageDelta * this.stateTransition;
|
||||||
} else if (this.stateNew == GuiShapeMode.OVER) {
|
} else if (this.stateNew == GuiShapeMode.OVER) {
|
||||||
basicValue -= imageDelta*this.stateTransition;
|
basicValue -= imageDelta * this.stateTransition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.verbose("colorDelta = " + basicValue + " old = " + this.stateOld + "(" + this.stateOld.getValue()*imageDelta + ") new = " + this.stateNew + "(" + this.stateNew.getValue()*imageDelta + ")");
|
Log.verbose("colorDelta = " + basicValue + " old = " + this.stateOld + "(" + this.stateOld.getValue() * imageDelta + ") new = " + this.stateNew + "(" + this.stateNew.getValue() * imageDelta
|
||||||
|
+ ")");
|
||||||
this.oGLprogram.uniformFloat(this.oGLPaletteOffset, basicValue);
|
this.oGLprogram.uniformFloat(this.oGLPaletteOffset, basicValue);
|
||||||
|
|
||||||
Log.error("plop: " + this.offsetScale);
|
Log.error("plop: " + this.offsetScaleOutside);
|
||||||
this.oGLprogram.uniformVector(this.oGLOffsetScale, this.offsetScale);
|
Log.error("plop: " + this.offsetScaleInside);
|
||||||
|
this.oGLprogram.uniformVector(this.oGLOffsetScaleInside, this.offsetScaleInside);
|
||||||
|
this.oGLprogram.uniformVector(this.oGLOffsetScaleOutside, this.offsetScaleOutside);
|
||||||
|
|
||||||
this.texture.bindForRendering(0);
|
this.texture.bindForRendering(0);
|
||||||
this.mesh.render("palette");
|
this.mesh.render("palette");
|
||||||
@ -271,7 +255,7 @@ public class GuiShape extends Compositing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get the current trasion status
|
* @brief get the current transition status
|
||||||
* @return value of the transition status (0.0f when no activity)
|
* @return value of the transition status (0.0f when no activity)
|
||||||
*/
|
*/
|
||||||
public float getTransitionStatus() {
|
public float getTransitionStatus() {
|
||||||
@ -309,35 +293,27 @@ public class GuiShape extends Compositing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected void loadPalette() {
|
||||||
* load the openGL program and get all the ID needed
|
String paletteFile = this.config.getString(this.confIdPaletteFile);
|
||||||
*/
|
Uri paletteFileInterface = Uri.valueOf(paletteFile);
|
||||||
private void loadUpdateObjectSize() {
|
this.palette = ResourcePaletteFile.create(paletteFileInterface);
|
||||||
if (this.config == null) {
|
this.texture = ResourceTexture2.createNamed("TEXTURE_OF_PALETTE:" + paletteFile);
|
||||||
Log.debug("no Shaper set for loading resources ...");
|
if (this.texture == null) {
|
||||||
return;
|
Log.error("can not instanciate Texture ...");
|
||||||
}
|
|
||||||
String objectFile = this.config.getString(this.confObjectFile);
|
|
||||||
if (!objectFile.isEmpty()) {
|
|
||||||
this.mesh = ResourceMesh.create(Uri.valueOf(objectFile));
|
|
||||||
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
|
|
||||||
float top = 0;
|
|
||||||
float bottom = 0;
|
|
||||||
float left = 0;
|
|
||||||
float right = 0;
|
|
||||||
float back = 0;
|
|
||||||
float font = 0;
|
|
||||||
// estimate size of border:
|
|
||||||
for (int iii = 0; iii < verticesToModify.size(); iii++) {
|
|
||||||
left = Math.min(left, verticesToModify.get(iii).x());
|
|
||||||
right = Math.max(right, verticesToModify.get(iii).x());
|
|
||||||
top = Math.min(top, verticesToModify.get(iii).y());
|
|
||||||
bottom = Math.max(bottom, verticesToModify.get(iii).y());
|
|
||||||
back = Math.min(back, verticesToModify.get(iii).z());
|
|
||||||
font = Math.max(font, verticesToModify.get(iii).z());
|
|
||||||
}
|
|
||||||
this.sizeObject = new Padding(Math.abs(left), Math.abs(top), Math.abs(right), Math.abs(bottom));
|
|
||||||
}
|
}
|
||||||
|
// element already called
|
||||||
|
loadPaletteUpdate();
|
||||||
|
// for next update (realTime reload)
|
||||||
|
this.palette.onUpdate(() -> {
|
||||||
|
loadPaletteUpdate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadPaletteUpdate() {
|
||||||
|
Log.warning("update palet environnement");
|
||||||
|
final ImageByte img = this.palette.getImageByte();
|
||||||
|
//IOgami.storePNG(new Uri("/home/heero/000000000aaaaplopppp.png"), img);
|
||||||
|
this.texture.set(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,11 +333,47 @@ public class GuiShape extends Compositing {
|
|||||||
this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection");
|
this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection");
|
||||||
this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView");
|
this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView");
|
||||||
this.oGLPaletteOffset = this.oGLprogram.getUniform("in_offsetPalette");
|
this.oGLPaletteOffset = this.oGLprogram.getUniform("in_offsetPalette");
|
||||||
this.oGLOffsetScale = this.oGLprogram.getUniform("in_offsetScale");
|
this.oGLOffsetScaleInside = this.oGLprogram.getUniform("in_offsetScaleInside");
|
||||||
|
this.oGLOffsetScaleOutside = this.oGLprogram.getUniform("in_offsetScaleOutside");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* load the openGL program and get all the ID needed
|
||||||
|
*/
|
||||||
|
private void loadUpdateObjectSize() {
|
||||||
|
if (this.config == null) {
|
||||||
|
Log.debug("no Shaper set for loading resources ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String objectFile = this.config.getString(this.confObjectFile);
|
||||||
|
if (!objectFile.isEmpty()) {
|
||||||
|
this.mesh = ResourceMesh.create(Uri.valueOf(objectFile));
|
||||||
|
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
|
||||||
|
float top = 0;
|
||||||
|
float bottom = 0;
|
||||||
|
float left = 0;
|
||||||
|
float right = 0;
|
||||||
|
float back = 0;
|
||||||
|
float font = 0;
|
||||||
|
// estimate size of border:
|
||||||
|
if (verticesToModify == null) {
|
||||||
|
Log.critical("Element is null : verticesToModify");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int iii = 0; iii < verticesToModify.size(); iii++) {
|
||||||
|
left = Math.min(left, verticesToModify.get(iii).x());
|
||||||
|
right = Math.max(right, verticesToModify.get(iii).x());
|
||||||
|
top = Math.min(top, verticesToModify.get(iii).y());
|
||||||
|
bottom = Math.max(bottom, verticesToModify.get(iii).y());
|
||||||
|
back = Math.min(back, verticesToModify.get(iii).z());
|
||||||
|
font = Math.max(font, verticesToModify.get(iii).z());
|
||||||
|
}
|
||||||
|
this.sizeObject = new Padding(Math.abs(left), Math.abs(top), Math.abs(right), Math.abs(bottom));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Same as the widfget periodic call (this is for change display)
|
* @brief Same as the widfget periodic call (this is for change display)
|
||||||
* @param event The current time of the call.
|
* @param event The current time of the call.
|
||||||
@ -373,7 +385,7 @@ public class GuiShape extends Compositing {
|
|||||||
// start :
|
// start :
|
||||||
if (this.stateTransition >= 1.0) {
|
if (this.stateTransition >= 1.0) {
|
||||||
this.stateOld = this.stateNew;
|
this.stateOld = this.stateNew;
|
||||||
if( (this.nextStatusRequested == GuiShapeMode.NONE) || (this.nextStatusRequested == this.stateOld)) {
|
if ((this.nextStatusRequested == GuiShapeMode.NONE) || (this.nextStatusRequested == this.stateOld)) {
|
||||||
this.nextStatusRequested = GuiShapeMode.NONE;
|
this.nextStatusRequested = GuiShapeMode.NONE;
|
||||||
// disable periodic call ...
|
// disable periodic call ...
|
||||||
return false;
|
return false;
|
||||||
@ -384,9 +396,9 @@ public class GuiShape extends Compositing {
|
|||||||
Log.verbose(" ##### START ##### ");
|
Log.verbose(" ##### START ##### ");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.stateTransition<1.0) {
|
if (this.stateTransition < 1.0) {
|
||||||
// check if no new state requested:
|
// check if no new state requested:
|
||||||
if (this.nextStatusRequested != GuiShapeMode.NONE && this.stateTransition<0.5) {
|
if (this.nextStatusRequested != GuiShapeMode.NONE && this.stateTransition < 0.5) {
|
||||||
// invert sources with destination
|
// invert sources with destination
|
||||||
GuiShapeMode tmppp = this.stateOld;
|
GuiShapeMode tmppp = this.stateOld;
|
||||||
this.stateOld = this.stateNew;
|
this.stateOld = this.stateNew;
|
||||||
@ -467,7 +479,8 @@ public class GuiShape extends Compositing {
|
|||||||
public void setShape(final Vector2f origin, final Vector2f size, final Vector2f insidePos, final Vector2f insideSize) {
|
public void setShape(final Vector2f origin, final Vector2f size, final Vector2f insidePos, final Vector2f insideSize) {
|
||||||
//Log.error("Set shape property : origin=" + origin + " size=" + size + " in-pos=" + insidePos + " in-size=" + insideSize);
|
//Log.error("Set shape property : origin=" + origin + " size=" + size + " in-pos=" + insidePos + " in-size=" + insideSize);
|
||||||
Vector2f halfSize = insideSize.multiply(0.5f);
|
Vector2f halfSize = insideSize.multiply(0.5f);
|
||||||
this.offsetScale = new Vector3f(halfSize.x(), halfSize.y(), 1.0f);
|
this.offsetScaleOutside = new Vector3f(halfSize.x(), halfSize.y(), 1.0f);
|
||||||
|
this.offsetScaleInside = new Vector3f(halfSize.x() + this.sizeObject.x() * 0.25f, halfSize.y() + this.sizeObject.y() * 0.25f, 1.0f);
|
||||||
/*
|
/*
|
||||||
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
|
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
|
||||||
float[] newVertices = new float[verticesToModify.size()*3];
|
float[] newVertices = new float[verticesToModify.size()*3];
|
||||||
@ -484,12 +497,12 @@ public class GuiShape extends Compositing {
|
|||||||
this.transform = Matrix4f.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, 0.0f));
|
this.transform = Matrix4f.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// private float getUpdatedPos(final float value, final float halfsize) {
|
// private float getUpdatedPos(final float value, final float halfsize) {
|
||||||
// if (value <= 0.0f) {
|
// if (value <= 0.0f) {
|
||||||
// return value - halfsize;
|
// return value - halfsize;
|
||||||
// }
|
// }
|
||||||
// return value + halfsize;
|
// return value + halfsize;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void setShape(final Vector3f origin, final Vector3f size) {
|
public void setShape(final Vector3f origin, final Vector3f size) {
|
||||||
Padding tmp = getPadding();
|
Padding tmp = getPadding();
|
||||||
@ -498,7 +511,8 @@ public class GuiShape extends Compositing {
|
|||||||
|
|
||||||
public void setShape(final Vector3f origin, final Vector3f size, final Vector3f insidePos, final Vector3f insideSize) {
|
public void setShape(final Vector3f origin, final Vector3f size, final Vector3f insidePos, final Vector3f insideSize) {
|
||||||
Vector3f halfSize = insideSize.multiply(0.5f);
|
Vector3f halfSize = insideSize.multiply(0.5f);
|
||||||
this.offsetScale = halfSize;
|
this.offsetScaleOutside = halfSize;
|
||||||
|
this.offsetScaleInside = halfSize.add(this.sizeObject.x() * 0.25f, this.sizeObject.y() * 0.25f, 0);
|
||||||
/*
|
/*
|
||||||
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
|
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
|
||||||
float[] newVertices = new float[verticesToModify.size()*3];
|
float[] newVertices = new float[verticesToModify.size()*3];
|
||||||
|
@ -32,27 +32,40 @@ import org.atriasoft.gale.key.KeyStatus;
|
|||||||
* ~~~~~~~~~~~~~~~~~~~~~~
|
* ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*/
|
*/
|
||||||
public class Button extends Widget {
|
public class Button extends Widget {
|
||||||
|
/**
|
||||||
|
* Periodic call to update grapgic display
|
||||||
|
* @param _event Time generic event
|
||||||
|
*/
|
||||||
|
protected static void periodicCall(final Button self, final EventTime event) {
|
||||||
|
Log.verbose("Periodic call on Entry(" + event + ")");
|
||||||
|
if (!self.shape.periodicCall(event)) {
|
||||||
|
self.periodicConnectionHanble.close();
|
||||||
|
}
|
||||||
|
self.markToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
/// color property of the text foreground
|
/// color property of the text foreground
|
||||||
private int colorIdTextFg;
|
private int colorIdTextFg;
|
||||||
/// text display this.text
|
/// text display this.text
|
||||||
private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
||||||
/// Periodic call handle to remove it when needed
|
/// Periodic call handle to remove it when needed
|
||||||
protected Connection periodicConnectionHanble = new Connection();
|
protected Connection periodicConnectionHanble = new Connection();
|
||||||
|
|
||||||
private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol");
|
private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol");
|
||||||
|
|
||||||
private String propertyValue = "Test Text..."; //!< string that must be displayed
|
private String propertyValue = "Test Text..."; //!< string that must be displayed
|
||||||
|
|
||||||
private GuiShape shape;
|
private GuiShape shape;
|
||||||
@EwolSignal(name = "down", description = "Button is Down")
|
@EwolSignal(name = "down", description = "Button is Down")
|
||||||
public SignalEmpty signalDown = new SignalEmpty();
|
public SignalEmpty signalDown = new SignalEmpty();
|
||||||
@EwolSignal(name = "up", description = "Button is Up")
|
@EwolSignal(name = "up", description = "Button is Up")
|
||||||
public SignalEmpty signalUp = new SignalEmpty();
|
public SignalEmpty signalUp = new SignalEmpty();
|
||||||
|
|
||||||
@EwolSignal(name = "click", description = "Button is Clicked")
|
@EwolSignal(name = "click", description = "Button is Clicked")
|
||||||
public SignalEmpty signalClick = new SignalEmpty();
|
public SignalEmpty signalClick = new SignalEmpty();
|
||||||
|
|
||||||
// element over:
|
// element over:
|
||||||
Vector2f overPositionStart = Vector2f.ZERO;
|
Vector2f overPositionStart = Vector2f.ZERO;
|
||||||
Vector2f overPositionStop = Vector2f.ZERO;
|
Vector2f overPositionStop = Vector2f.ZERO;
|
||||||
|
|
||||||
private boolean isDown;
|
private boolean isDown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,7 +124,6 @@ public class Button extends Widget {
|
|||||||
return this.propertyValue;
|
return this.propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void onChangePropertyShaper() {
|
protected void onChangePropertyShaper() {
|
||||||
if (this.shape == null) {
|
if (this.shape == null) {
|
||||||
this.shape = new GuiShape(this.propertyConfig);
|
this.shape = new GuiShape(this.propertyConfig);
|
||||||
@ -139,7 +151,7 @@ public class Button extends Widget {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onEventInput(final EventInput event) {
|
public boolean onEventInput(final EventInput event) {
|
||||||
Vector2f relPos = relativePosition(event.pos());
|
Vector2f relPos = relativePosition(event.pos());
|
||||||
Log.verbose("Event on Input ... " + event + " relPos = "+ relPos);
|
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
|
||||||
if (event.inputId() == 0) {
|
if (event.inputId() == 0) {
|
||||||
if (!this.isDown) {
|
if (!this.isDown) {
|
||||||
if (KeyStatus.leave == event.status()) {
|
if (KeyStatus.leave == event.status()) {
|
||||||
@ -223,7 +235,7 @@ public class Button extends Widget {
|
|||||||
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
||||||
|
|
||||||
this.gc.clear();
|
this.gc.clear();
|
||||||
this.gc.setSize((int)tmpSizeText.x(), (int)tmpSizeText.y());
|
this.gc.setSize((int) tmpSizeText.x(), (int) tmpSizeText.y());
|
||||||
|
|
||||||
this.gc.setColorFill(Color.BLACK);
|
this.gc.setColorFill(Color.BLACK);
|
||||||
this.gc.setColorStroke(Color.NONE);
|
this.gc.setColorStroke(Color.NONE);
|
||||||
@ -237,18 +249,6 @@ public class Button extends Widget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Periodic call to update grapgic display
|
|
||||||
* @param _event Time generic event
|
|
||||||
*/
|
|
||||||
protected static void periodicCall(final Button self, final EventTime event) {
|
|
||||||
Log.verbose("Periodic call on Entry(" + event + ")");
|
|
||||||
if (!self.shape.periodicCall(event)) {
|
|
||||||
self.periodicConnectionHanble.close();
|
|
||||||
}
|
|
||||||
self.markToRedraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal check the value with RegExp checking
|
* internal check the value with RegExp checking
|
||||||
* @param newData The new string to display
|
* @param newData The new string to display
|
||||||
@ -284,7 +284,6 @@ public class Button extends Widget {
|
|||||||
onChangePropertyShaper();
|
onChangePropertyShaper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setPropertyValue(final String propertyValue) {
|
public void setPropertyValue(final String propertyValue) {
|
||||||
if (this.propertyValue.equals(propertyValue)) {
|
if (this.propertyValue.equals(propertyValue)) {
|
||||||
return;
|
return;
|
||||||
|
@ -40,16 +40,28 @@ public Signal<Boolean> signalValue;
|
|||||||
public Uri> propertyShape; //!< shape of the widget
|
public Uri> propertyShape; //!< shape of the widget
|
||||||
*/
|
*/
|
||||||
public class CheckBox extends Widget {
|
public class CheckBox extends Widget {
|
||||||
|
/**
|
||||||
|
* Periodic call to update grapgic display
|
||||||
|
* @param _event Time generic event
|
||||||
|
*/
|
||||||
|
protected static void periodicCall(final CheckBox self, final EventTime event) {
|
||||||
|
Log.verbose("Periodic call on Entry(" + event + ")");
|
||||||
|
if (!self.shape.periodicCall(event)) {
|
||||||
|
self.periodicConnectionHanble.close();
|
||||||
|
}
|
||||||
|
self.markToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
/// color property of the text foreground
|
/// color property of the text foreground
|
||||||
private int colorIdTextFg;
|
private int colorIdTextFg;
|
||||||
/// text display this.text
|
/// text display this.text
|
||||||
//private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
//private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
||||||
/// Periodic call handle to remove it when needed
|
/// Periodic call handle to remove it when needed
|
||||||
protected Connection periodicConnectionHanble = new Connection();
|
protected Connection periodicConnectionHanble = new Connection();
|
||||||
|
|
||||||
private Uri propertyConfig = new Uri("THEME", "shape/CheckBox.json", "ewol");
|
private Uri propertyConfig = new Uri("THEME", "shape/CheckBox.json", "ewol");
|
||||||
|
|
||||||
private Boolean propertyValue = false; //!< string that must be displayed
|
private Boolean propertyValue = false; //!< string that must be displayed
|
||||||
|
|
||||||
private GuiShape shape;
|
private GuiShape shape;
|
||||||
@EwolSignal(name = "down", description = "CheckBox is Down")
|
@EwolSignal(name = "down", description = "CheckBox is Down")
|
||||||
public SignalEmpty signalDown = new SignalEmpty();
|
public SignalEmpty signalDown = new SignalEmpty();
|
||||||
@ -59,10 +71,10 @@ public class CheckBox extends Widget {
|
|||||||
public SignalEmpty signalClick = new SignalEmpty();
|
public SignalEmpty signalClick = new SignalEmpty();
|
||||||
@EwolSignal(name = "value", description = "CheckBox value change")
|
@EwolSignal(name = "value", description = "CheckBox value change")
|
||||||
public Signal<Boolean> signalValue;
|
public Signal<Boolean> signalValue;
|
||||||
|
|
||||||
// element over:
|
// element over:
|
||||||
Vector2f overPositionStart = Vector2f.ZERO;
|
Vector2f overPositionStart = Vector2f.ZERO;
|
||||||
Vector2f overPositionStop = Vector2f.ZERO;
|
Vector2f overPositionStop = Vector2f.ZERO;
|
||||||
|
|
||||||
private boolean isDown;
|
private boolean isDown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,7 +133,6 @@ public class CheckBox extends Widget {
|
|||||||
return this.propertyValue;
|
return this.propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void onChangePropertyShaper() {
|
protected void onChangePropertyShaper() {
|
||||||
if (this.shape == null) {
|
if (this.shape == null) {
|
||||||
this.shape = new GuiShape(this.propertyConfig);
|
this.shape = new GuiShape(this.propertyConfig);
|
||||||
@ -142,14 +153,14 @@ public class CheckBox extends Widget {
|
|||||||
@Override
|
@Override
|
||||||
protected void onDraw() {
|
protected void onDraw() {
|
||||||
if (this.shape != null) {
|
if (this.shape != null) {
|
||||||
//this.shape.draw(this.gc.getResourceTexture(), true);
|
this.shape.draw(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEventInput(final EventInput event) {
|
public boolean onEventInput(final EventInput event) {
|
||||||
Vector2f relPos = relativePosition(event.pos());
|
Vector2f relPos = relativePosition(event.pos());
|
||||||
Log.verbose("Event on Input ... " + event + " relPos = "+ relPos);
|
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
|
||||||
if (event.inputId() == 0) {
|
if (event.inputId() == 0) {
|
||||||
if (!this.isDown) {
|
if (!this.isDown) {
|
||||||
if (KeyStatus.leave == event.status()) {
|
if (KeyStatus.leave == event.status()) {
|
||||||
@ -247,18 +258,6 @@ public class CheckBox extends Widget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Periodic call to update grapgic display
|
|
||||||
* @param _event Time generic event
|
|
||||||
*/
|
|
||||||
protected static void periodicCall(final CheckBox self, final EventTime event) {
|
|
||||||
Log.verbose("Periodic call on Entry(" + event + ")");
|
|
||||||
if (!self.shape.periodicCall(event)) {
|
|
||||||
self.periodicConnectionHanble.close();
|
|
||||||
}
|
|
||||||
self.markToRedraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal check the value with RegExp checking
|
* internal check the value with RegExp checking
|
||||||
* @param newData The new string to display
|
* @param newData The new string to display
|
||||||
@ -276,7 +275,6 @@ public class CheckBox extends Widget {
|
|||||||
onChangePropertyShaper();
|
onChangePropertyShaper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setPropertyValue(final Boolean propertyValue) {
|
public void setPropertyValue(final Boolean propertyValue) {
|
||||||
if (this.propertyValue.equals(propertyValue)) {
|
if (this.propertyValue.equals(propertyValue)) {
|
||||||
return;
|
return;
|
||||||
|
@ -41,6 +41,18 @@ import org.atriasoft.gale.key.KeyType;
|
|||||||
* ~~~~~~~~~~~~~~~~~~~~~~
|
* ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*/
|
*/
|
||||||
public class Entry extends Widget {
|
public class Entry extends Widget {
|
||||||
|
/**
|
||||||
|
* Periodic call to update grapgic display
|
||||||
|
* @param _event Time generic event
|
||||||
|
*/
|
||||||
|
protected static void periodicCall(final Entry self, final EventTime event) {
|
||||||
|
Log.verbose("Periodic call on Entry(" + event + ")");
|
||||||
|
if (!self.shape.periodicCall(event)) {
|
||||||
|
self.periodicConnectionHanble.close();
|
||||||
|
}
|
||||||
|
self.markToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
/// color property of the text foreground
|
/// color property of the text foreground
|
||||||
private int colorIdTextFg;
|
private int colorIdTextFg;
|
||||||
/// Cursor must be display only when the widget has the focus
|
/// Cursor must be display only when the widget has the focus
|
||||||
@ -74,6 +86,7 @@ public class Entry extends Widget {
|
|||||||
@XmlName(value = "password")
|
@XmlName(value = "password")
|
||||||
@EwolDescription(value = "Not display content in password mode")
|
@EwolDescription(value = "Not display content in password mode")
|
||||||
private boolean propertyPassword = false; //!< Disable display of the content of the entry
|
private boolean propertyPassword = false; //!< Disable display of the content of the entry
|
||||||
|
|
||||||
/// regular expression value
|
/// regular expression value
|
||||||
@XmlManaged
|
@XmlManaged
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
@ -93,7 +106,6 @@ public class Entry extends Widget {
|
|||||||
@XmlName(value = "value")
|
@XmlName(value = "value")
|
||||||
@EwolDescription(value = "Value display in the entry (decorated text)")
|
@EwolDescription(value = "Value display in the entry (decorated text)")
|
||||||
private String propertyValue = "Test Text..."; //!< string that must be displayed
|
private String propertyValue = "Test Text..."; //!< string that must be displayed
|
||||||
|
|
||||||
private Pattern regex = null; //!< regular expression to check content
|
private Pattern regex = null; //!< regular expression to check content
|
||||||
private GuiShape shape;
|
private GuiShape shape;
|
||||||
//.create()
|
//.create()
|
||||||
@ -101,11 +113,12 @@ public class Entry extends Widget {
|
|||||||
public SignalEmpty signalClick = new SignalEmpty(); //!< bang on click the entry box
|
public SignalEmpty signalClick = new SignalEmpty(); //!< bang on click the entry box
|
||||||
@EwolSignal(name = "enter", description = "The cursor enter inside the button")
|
@EwolSignal(name = "enter", description = "The cursor enter inside the button")
|
||||||
public Signal<String> signalEnter = new Signal<>(); //!< Enter key is pressed
|
public Signal<String> signalEnter = new Signal<>(); //!< Enter key is pressed
|
||||||
|
|
||||||
@EwolSignal(name = "modify", description = "Entry box value change")
|
@EwolSignal(name = "modify", description = "Entry box value change")
|
||||||
public Signal<String> signalModify = new Signal<>(); //!< data change
|
public Signal<String> signalModify = new Signal<>(); //!< data change
|
||||||
|
|
||||||
// element over:
|
// element over:
|
||||||
Vector2f overPositionStart = Vector2f.ZERO;
|
Vector2f overPositionStart = Vector2f.ZERO;
|
||||||
|
|
||||||
Vector2f overPositionStop = Vector2f.ZERO;
|
Vector2f overPositionStop = Vector2f.ZERO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -379,7 +392,7 @@ public class Entry extends Widget {
|
|||||||
} else {
|
} else {
|
||||||
StringBuilder newData = new StringBuilder(this.propertyValue);
|
StringBuilder newData = new StringBuilder(this.propertyValue);
|
||||||
newData.insert(this.displayCursorPos, event.getChar());
|
newData.insert(this.displayCursorPos, event.getChar());
|
||||||
String newDataGenerated =newData.toString();
|
String newDataGenerated = newData.toString();
|
||||||
setInternalValue(newDataGenerated);
|
setInternalValue(newDataGenerated);
|
||||||
if (this.propertyValue.equals(newDataGenerated)) {
|
if (this.propertyValue.equals(newDataGenerated)) {
|
||||||
this.displayCursorPos += 1;//inputData.length();
|
this.displayCursorPos += 1;//inputData.length();
|
||||||
@ -421,7 +434,7 @@ public class Entry extends Widget {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onEventInput(final EventInput event) {
|
public boolean onEventInput(final EventInput event) {
|
||||||
Vector2f relPos = relativePosition(event.pos());
|
Vector2f relPos = relativePosition(event.pos());
|
||||||
Log.verbose("Event on Input ... " + event + " relPos = "+ relPos);
|
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
|
||||||
if (event.inputId() == 0) {
|
if (event.inputId() == 0) {
|
||||||
if (!isFocused()) {
|
if (!isFocused()) {
|
||||||
if (KeyStatus.leave == event.status()) {
|
if (KeyStatus.leave == event.status()) {
|
||||||
@ -568,20 +581,19 @@ public class Entry extends Widget {
|
|||||||
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
||||||
|
|
||||||
this.gc.clear();
|
this.gc.clear();
|
||||||
this.gc.setSize((int)tmpSizeText.x(), (int)tmpSizeText.y());
|
this.gc.setSize((int) tmpSizeText.x(), (int) tmpSizeText.y());
|
||||||
|
|
||||||
// if (this.displayCursorPosSelection != this.displayCursorPos) {
|
// if (this.displayCursorPosSelection != this.displayCursorPos) {
|
||||||
//
|
//
|
||||||
// //this.text.setCursorSelection(this.displayCursorPos, this.displayCursorPosSelection);
|
// //this.text.setCursorSelection(this.displayCursorPos, this.displayCursorPosSelection);
|
||||||
// } else {
|
// } else {
|
||||||
// this.text.setCursorPos(this.displayCursorPos);
|
// this.text.setCursorPos(this.displayCursorPos);
|
||||||
// }
|
// }
|
||||||
this.gc.setColorFill(Color.RED);
|
this.gc.setColorFill(Color.RED);
|
||||||
this.gc.setColorStroke(Color.GREEN);
|
this.gc.setColorStroke(Color.GREEN);
|
||||||
this.gc.setStrokeWidth(5);
|
this.gc.setStrokeWidth(5);
|
||||||
//this.gc.rectangleRounded(new Vector2f(20, 2), new Vector2f(55, 70), new Vector2f(15, 15));
|
//this.gc.rectangleRounded(new Vector2f(20, 2), new Vector2f(55, 70), new Vector2f(15, 15));
|
||||||
this.gc.line(new Vector2f(this.displayCursorPositionPixel, 2), new Vector2f(this.displayCursorPositionPixel, this.gc.getTextHeight()-4));
|
this.gc.line(new Vector2f(this.displayCursorPositionPixel, 2), new Vector2f(this.displayCursorPositionPixel, this.gc.getTextHeight() - 4));
|
||||||
|
|
||||||
|
|
||||||
this.gc.setColorFill(Color.BLACK);
|
this.gc.setColorFill(Color.BLACK);
|
||||||
this.gc.setColorStroke(Color.NONE);
|
this.gc.setColorStroke(Color.NONE);
|
||||||
@ -604,18 +616,6 @@ public class Entry extends Widget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Periodic call to update grapgic display
|
|
||||||
* @param _event Time generic event
|
|
||||||
*/
|
|
||||||
protected static void periodicCall(final Entry self, final EventTime event) {
|
|
||||||
Log.verbose("Periodic call on Entry(" + event + ")");
|
|
||||||
if (!self.shape.periodicCall(event)) {
|
|
||||||
self.periodicConnectionHanble.close();
|
|
||||||
}
|
|
||||||
self.markToRedraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove the selected area
|
* remove the selected area
|
||||||
* @note This request a regeneration of the display
|
* @note This request a regeneration of the display
|
||||||
@ -737,7 +737,7 @@ public class Entry extends Widget {
|
|||||||
if (this.displayStartPosition > this.propertyValue.length()) {
|
if (this.displayStartPosition > this.propertyValue.length()) {
|
||||||
this.displayStartPosition = this.propertyValue.length();
|
this.displayStartPosition = this.propertyValue.length();
|
||||||
}
|
}
|
||||||
if (this.displayStartPosition <0) {
|
if (this.displayStartPosition < 0) {
|
||||||
Log.error("wring cursor position : " + this.displayStartPosition + "/" + this.propertyValue.length());
|
Log.error("wring cursor position : " + this.displayStartPosition + "/" + this.propertyValue.length());
|
||||||
this.displayStartPosition = 0;
|
this.displayStartPosition = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user