[FEAT] use Maven a build system root tool

This commit is contained in:
Edouard DUPIN 2024-06-07 09:28:33 +02:00
parent 760fd95b60
commit 730eb4cdfd
71 changed files with 2808 additions and 2506 deletions

View File

@ -1,52 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src">
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="resources"/>
<classpathentry including="**/*.java" kind="src" output="out/eclipse/classes-test" path="test/src">
<classpathentry kind="src" output="out/maven/test-classes" path="test/src">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="atriasoft-ewol/lib"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-esignal">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-gale">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-exml">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/loader3d">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-ejson">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="out/eclipse/classes"/>
<classpathentry kind="output" path="out/maven/classes"/>
</classpath>

View File

@ -1,41 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>atriasoft-ewol</name>
<name>ewol</name>
<comment></comment>
<projects>
<project>atriasoft-ewol</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
<nature>org.python.pydev.pythonNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1646149232192</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

View File

@ -14,5 +14,5 @@ list_elem = [
]
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")
bpy.ops.wm.open_mainfile(filepath="/home/heero/dev/WORKSPACE-game/org.atriasoft/ewol/blender_files/" + elem + ".blend")
bpy.ops.export_scene.emf(filepath="/home/heero/dev/WORKSPACE-game/org.atriasoft/ewol/resources/resources/ewol/theme/shape/" + elem + ".emf")

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gale" exported="" />
<orderEntry type="module" module-name="ejson" exported="" />
<orderEntry type="module" module-name="exml" exported="" />
<orderEntry type="library" name="freetype-jni" level="project" />
<orderEntry type="library" scope="TEST" name="org.junit.jupiter:junit-jupiter-api:5.7.1" level="project" />
</component>
</module>

View File

@ -34,7 +34,7 @@ def configure(target, my_module):
'src/module-info.java',
'src/org/atriasoft/ewol/DrawProperty.java',
'src/org/atriasoft/ewol/internal/LoadPackageStream.java',
'src/org/atriasoft/ewol/internal/Log.java',
'src/org/atriasoft/ewol/internal/LOGGER.java',
'src/org/atriasoft/ewol/context/EwolContext.java',
'src/org/atriasoft/ewol/context/EwolApplication.java',
'src/org/atriasoft/ewol/context/InputManager.java',

View File

@ -65,7 +65,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
if (needRedraw() == false) {
return;
}
Log.debug("redraw");
LOGGER.debug("redraw");
this.text.clear();
this.shaper.clear();
@ -144,7 +144,7 @@ boolean ewol::widget::ButtonColor::onEventInput( ewol::event::Input _event) {
}
}
boolean previousPressed = this.buttonPressed;
//Log.debug("Event on BT ... mouse position : " + this.mouseHover);
//LOGGER.debug("Event on BT ... mouse position : " + this.mouseHover);
if (true == this.mouseHover) {
if (1 == _event.getId()) {
if(KeyStatus::down == _event.getStatus()) {
@ -161,7 +161,7 @@ boolean ewol::widget::ButtonColor::onEventInput( ewol::event::Input _event) {
// create a context menu :
this.widgetContextMenu = ewol::widget::ContextMenu::create();
if (this.widgetContextMenu == null) {
Log.error("Allocation Error");
LOGGER.error("Allocation Error");
return true;
}
Vector2f tmpPos = this.origin + this.selectableAreaPos + this.selectableAreaSize;
@ -175,7 +175,7 @@ boolean ewol::widget::ButtonColor::onEventInput( ewol::event::Input _event) {
myColorChooser.signalChange.connect(sharedFromThis(), ewol::widget::ButtonColor::onCallbackColorChange);
ewol::widget::Windows currentWindows = getWindows();
if (currentWindows == null) {
Log.error("Can not get the curent Windows...");
LOGGER.error("Can not get the curent Windows...");
this.widgetContextMenu.reset();
} else {
currentWindows.popUpWidgetPush(this.widgetContextMenu);

View File

@ -51,7 +51,7 @@ static etk::Color<> s_listColor[NB_BAND_COLOR+1] = {
void ewol::widget::ColorBar::onChangePropertyValue() {
propertyValue.getDirect().setA(0xFF);
// estimate the cursor position:
Log.todo("Later when really needed ...");
LOGGER.info("[TODO] Later when really needed ...");
}
void ewol::widget::ColorBar::onDraw() {
@ -159,7 +159,7 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
boolean ewol::widget::ColorBar::onEventInput( ewol::event::Input _event) {
Vector2f relativePos = relativePosition(_event.getPos());
//Log.debug("Event on BT ...");
//LOGGER.debug("Event on BT ...");
if (1 == _event.getId()) {
relativePos.setValue( etk::avg(0.0f, this.size.x(),relativePos.x()),
etk::avg(0.0f, this.size.y(),relativePos.y()) );
@ -170,11 +170,11 @@ boolean ewol::widget::ColorBar::onEventInput( ewol::event::Input _event) {
relativePos.y()/this.size.y() );
markToRedraw();
// == > try to estimate color
Log.verbose("event on (" + relativePos.x() + "," + relativePos.y() + ")");
LOGGER.trace("event on (" + relativePos.x() + "," + relativePos.y() + ")");
int bandID = (int)(relativePos.x()/(this.size.x()/6));
float localPos = relativePos.x() - (this.size.x()/6) * bandID;
float poroportionnalPos = localPos/(this.size.x()/6);
Log.verbose("bandId=" + bandID + " relative pos=" + localPos);
LOGGER.trace("bandId=" + bandID + " relative pos=" + localPos);
etk::Color<> estimateColor = etk::color::white;
if (s_listColor[bandID].r() == s_listColor[bandID+1].r()) {
estimateColor.setR(s_listColor[bandID].r());

View File

@ -59,7 +59,7 @@ void ewol::widget::ContextMenu::onChangeSize() {
markToRedraw();
// pop-up fill all the display :
ewol::Padding padding = this.shaper.getPadding();
Log.verbose("our origin=" + this.origin + " size=" + this.size);
LOGGER.trace("our origin=" + this.origin + " size=" + this.size);
if (this.subWidget == null) {
return;
}
@ -115,7 +115,7 @@ void ewol::widget::ContextMenu::onChangeSize() {
}
break;
}
Log.verbose(" == > sub origin=" + subWidgetOrigin + " size=" + subWidgetSize);
LOGGER.trace(" == > sub origin=" + subWidgetOrigin + " size=" + subWidgetSize);
this.subWidget.setOrigin(subWidgetOrigin);
this.subWidget.setSize(subWidgetSize);
this.subWidget.onChangeSize();
@ -128,7 +128,7 @@ void ewol::widget::ContextMenu::calculateMinMaxSize() {
// add padding of the display
ewol::Padding padding = this.shaper.getPadding();
this.minSize += Vector2f(padding.x(), padding.y());
//Log.debug("CalculateMinSize=>>" + this.minSize);
//LOGGER.debug("CalculateMinSize=>>" + this.minSize);
markToRedraw();
}
@ -195,7 +195,7 @@ void ewol::widget::ContextMenu::onRegenerateDisplay() {
default:
case markRight:
case markLeft:
Log.todo("later");
LOGGER.info("[TODO] later");
break;
}

View File

@ -75,7 +75,7 @@ class Joystick extends Widget {
_newRatio = 1;
}
this.ratio = _newRatio;
Log.info("Set default Joystick ratio at " + this.ratio);
LOGGER.info("Set default Joystick ratio at " + this.ratio);
}
/**
* set the Background of the widget joystick
@ -86,7 +86,7 @@ class Joystick extends Widget {
// TODO : check if it existed
this.background = _imageNameInData;
this.displayBackground = _display;
Log.info("Set default Joystick background at " + this.background + " display it=" + this.displayBackground);
LOGGER.info("Set default Joystick background at " + this.background + " display it=" + this.displayBackground);
}
/**
* set the Foreground of the widget joystick
@ -95,7 +95,7 @@ class Joystick extends Widget {
public void foreground(String _imageNameInData) {
// TODO : check if it existed
this.foreground = imageNameInData;
Log.info("Set default Joystick Foreground at " + this.foreground);
LOGGER.info("Set default Joystick Foreground at " + this.foreground);
}
/**
* get the property of the joystick
@ -189,7 +189,7 @@ class Joystick extends Widget {
signalMove.emit(this.angle+M_PI/2);
}
//teta += M_PI/2;
//Log.debug("TETA = " + (this.angle*180/M_PI) + " deg distance = " + this.distance);
//LOGGER.debug("TETA = " + (this.angle*180/M_PI) + " deg distance = " + this.distance);
return true;
} else if( KeyStatus::up == typeEvent) {
if( true == this.lock

View File

@ -48,16 +48,16 @@ public class Menu extends Sizer
ewol::widget::Sizer::subWidgetRemoveAll();
}
private int subWidgetAdd(Widget _newWidget){
Log.error("Not availlable");
LOGGER.error("Not availlable");
return -1;
}
private void subWidgetRemove(Widget _newWidget){
Log.error("Not availlable");
LOGGER.error("Not availlable");
}
private void subWidgetUnLink(Widget _newWidget){
Log.error("Not availlable");
LOGGER.error("Not availlable");
}
protected static final String eventButtonPressed = "menu-local-pressed";
private boolean loadXML( exml::Element _node) ;
@ -98,7 +98,7 @@ public class Menu extends Sizer
if (tmpObject.this.parentId == -1) {
ewol::widget::Button myButton = ewol::widget::Button::create();
if (myButton == null) {
Log.error("Allocation button error");
LOGGER.error("Allocation button error");
return tmpObject.this.localId;
}
if (tmpObject.this.image.size()!=0) {
@ -137,7 +137,7 @@ public class Menu extends Sizer
if (tmpObject.this.parentId == -1) {
ewol::widget::Spacer mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Allocation spacer error");
LOGGER.error("Allocation spacer error");
return tmpObject.this.localId;
}
mySpacer.propertyExpand.set(Vector2b(true,true));
@ -153,7 +153,7 @@ public class Menu extends Sizer
}
public void remove(int _id){
Log.todo("NOT remove...");
LOGGER.info("[TODO] NOT remove...");
}
@ -169,17 +169,17 @@ public class Menu extends Sizer
}
// 2 posible case (have a message or have a child ...
if (it.this.message.size() > 0) {
Log.debug("Menu == > generate Event");
LOGGER.debug("Menu == > generate Event");
// Send a multicast event ...
signalSelect.emit(it.this.message);
ewol::widget::ContextMenu tmpContext = this.widgetContextMenu.lock();
if (tmpContext != null) {
Log.debug("Mark the menu to remove ...");
LOGGER.debug("Mark the menu to remove ...");
tmpContext.destroy();
}
return;
}
Log.debug("Menu == > load Sub Menu");
LOGGER.debug("Menu == > load Sub Menu");
boolean findChild = false;
for (auto it2 : this.listElement) {
if (it.this.localId == it2.this.parentId) {
@ -188,14 +188,14 @@ public class Menu extends Sizer
}
}
if (false == findChild) {
Log.warning("Event on menu element with no child an no event... label=" + it.this.label);
LOGGER.warn("Event on menu element with no child an no event... label=" + it.this.label);
return;
}
// create a context menu:
ewol::widget::ContextMenu tmpContext = ewol::widget::ContextMenu::create();
this.widgetContextMenu = tmpContext;
if (tmpContext == null) {
Log.error("Allocation Error");
LOGGER.error("Allocation Error");
return;
}
// get the button widget:
@ -235,7 +235,7 @@ public class Menu extends Sizer
if (this.listElement[iii].this.message == "" LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.listElement[iii].this.label == "") {
ewol::widget::Spacer mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Allocation spacer error");
LOGGER.error("Allocation spacer error");
continue;
}
mySpacer.propertyExpand.set(Vector2b(true,true));
@ -248,7 +248,7 @@ public class Menu extends Sizer
} else {
myButton = ewol::widget::Button::create();
if (myButton == null) {
Log.error("Allocation Error");
LOGGER.error("Allocation Error");
continue;
}
myButton.propertyExpand.set(Vector2b(true,true));
@ -293,7 +293,7 @@ public class Menu extends Sizer
}
ewol::widget::Windows currentWindows = getWindows();
if (currentWindows == null) {
Log.error("Can not get the curent Windows...");
LOGGER.error("Can not get the curent Windows...");
} else {
currentWindows.popUpWidgetPush(tmpContext);
}
@ -316,7 +316,7 @@ boolean ewol::widget::Menu::loadXML( exml::Element _node) {
continue;
}
String widgetName = pNode.getValue();
Log.info("Get node : " + pNode);
LOGGER.info("Get node : " + pNode);
if (widgetName == "elem") {
// <elem title="_T{Title of the button}" image="DATA:///List.svg" event="menu:exit">
int idMenu = addTitle(pNode.attributes["title"], pNode.attributes["image"], pNode.attributes["event"]);
@ -334,13 +334,13 @@ boolean ewol::widget::Menu::loadXML( exml::Element _node) {
} else if (widgetName2 == "separator") {
addSpacer(idMenu);
} else {
Log.error("[" + getId() + "] {" + getObjectType() + "} (l " + pNode2.getPos() + ") Unknown basic node='" + widgetName2 + "' not in : [elem,separator]" );
LOGGER.error("[" + getId() + "] {" + getObjectType() + "} (l " + pNode2.getPos() + ") Unknown basic node='" + widgetName2 + "' not in : [elem,separator]" );
}
}
} else if (widgetName == "separator") {
addSpacer();
} else {
Log.error("[" + getId() + "] {" + getObjectType() + "} (l " + pNode.getPos() + ") Unknown basic node='" + widgetName + "' not in : [elem,separator]" );
LOGGER.error("[" + getId() + "] {" + getObjectType() + "} (l " + pNode.getPos() + ") Unknown basic node='" + widgetName + "' not in : [elem,separator]" );
}
}
return true;

View File

@ -72,7 +72,7 @@ class Select extends SpinBase {
protected List<ewol::widget::Select::Element> this.listElement;
public void optionSelectDefault(){
if (this.widgetEntry == null) {
Log.error("Can not acces at entry ...");
LOGGER.error("Can not acces at entry ...");
return;
}
for (auto it : this.listElement) {
@ -88,7 +88,7 @@ class Select extends SpinBase {
public void optionRemove(int _value){
for (auto it=this.listElement.begin(); it != this.listElement.end(); ++it) {
if (_value == it.this.value) {
Log.debug("remove element: " + _value);
LOGGER.debug("remove element: " + _value);
this.listElement.erase(it);
break;
}
@ -104,7 +104,7 @@ class Select extends SpinBase {
public void optionAdd(int _value, String _name) {
for (auto it : this.listElement) {
if (_value == it.this.value) {
Log.debug("replace element: " + _value + " with: '" + _data + "'");
LOGGER.debug("replace element: " + _value + " with: '" + _data + "'");
it.this.name = _data;
}
}
@ -127,7 +127,7 @@ class Select extends SpinBase {
continue;
}
if (pNode.getValue() != "option") {
Log.error("(l " + pNode.getPos() + ") Unknown basic node='" + pNode.getValue() + "' not in : [option]" );
LOGGER.error("(l " + pNode.getPos() + ") Unknown basic node='" + pNode.getValue() + "' not in : [option]" );
continue;
}
String valId = pNode.attributes["id"];
@ -139,7 +139,7 @@ class Select extends SpinBase {
if (select == true) {
propertyValue.set(id);
}
Log.warning("Add option : id='" + valId + "' select='" + valIsSelected + "' text='" + valText + "'");
LOGGER.warn("Add option : id='" + valId + "' select='" + valIsSelected + "' text='" + valText + "'");
}
return true;
}
@ -161,7 +161,7 @@ class Select extends SpinBase {
// create a context menu:
ewol::widget::ContextMenu tmpContext = ewol::widget::ContextMenu::create();
if (tmpContext == null) {
Log.error("Allocation Error");
LOGGER.error("Allocation Error");
return;
}
// auto-select mark position:
@ -169,7 +169,7 @@ class Select extends SpinBase {
ewol::widget::Sizer mySizer;
mySizer = ewol::widget::Sizer::create();
if (mySizer == null) {
Log.error("Allocation Error or sizer");
LOGGER.error("Allocation Error or sizer");
return;
}
mySizer.propertyMode.set(widget::Sizer::modeVert);
@ -180,7 +180,7 @@ class Select extends SpinBase {
for (auto it : this.listElement) {
ewol::widget::Label myLabel = ewol::widget::Label::create();
if (myLabel == null) {
Log.error("Allocation Error");
LOGGER.error("Allocation Error");
continue;
}
if (it.this.selected == true) {
@ -198,13 +198,13 @@ class Select extends SpinBase {
}
ewol::widget::Windows currentWindows = getWindows();
if (currentWindows == null) {
Log.error("Can not get the curent Windows...");
LOGGER.error("Can not get the curent Windows...");
} else {
currentWindows.popUpWidgetPush(tmpContext);
}
}
protected void onCallbackLabelPressed(int _value){
Log.verbose("User select:" + _value);
LOGGER.trace("User select:" + _value);
propertyValue.set(_value);
}
protected esignal::Connection connectionEntry = null;
@ -212,7 +212,7 @@ class Select extends SpinBase {
protected void onChangePropertyValue(){
markToRedraw();
if (this.widgetEntry == null) {
Log.error("Can not acces at entry ...");
LOGGER.error("Can not acces at entry ...");
return;
}
for (auto it : this.listElement) {

View File

@ -124,7 +124,7 @@ void ewol::widget::TreeView::drawElement( Vector2i _pos, Vector2f _start, Vect
tmpImage.setPos(posStart);
tmpImage.print(Vector2f(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get()));
} else {
Log.error("can not get : " + iconName );
LOGGER.error("can not get : " + iconName );
}
// move right
posStart.setX(posStart.x() + propertyIconTreeViewSize.get());
@ -161,7 +161,7 @@ boolean ewol::widget::TreeView::onItemEvent( ewol::event::Input _event, Vector2
if (_pos.x() != 0) {
return false;
}
//Log.info("event: " + _event);
//LOGGER.info("event: " + _event);
Vector2f posStart = Vector2f(0,0);
boolean haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean();
if (haveChild == false) {
@ -172,7 +172,7 @@ boolean ewol::widget::TreeView::onItemEvent( ewol::event::Input _event, Vector2
posStart.setX(posStart.x() + value.getSafeNumber() * propertyOffsetTreeView.get());
}
// Inverse the display of Y
Log.verbose("check: " + Vector2f(_mousePosition.x(), this.listSizeY[_pos.y()] - _mousePosition.y())
LOGGER.trace("check: " + Vector2f(_mousePosition.x(), this.listSizeY[_pos.y()] - _mousePosition.y())
+ " in " + posStart
+ " . " + (posStart+Vector2f(propertyIconTreeViewSize.get(),propertyIconTreeViewSize.get())));
if ( _mousePosition.x() >= posStart.x()

View File

@ -104,7 +104,7 @@ void ewol::widget::WSlider::onChangeSize() {
void ewol::widget::WSlider::subWidgetSelectSetVectorId(int _id) {
if (_id<0) {
Log.error("Can not change to a widget not present : vectID=" + _id);
LOGGER.error("Can not change to a widget not present : vectID=" + _id);
return;
}
if (_id != this.windowsDestination) {
@ -143,7 +143,7 @@ void ewol::widget::WSlider::subWidgetSelectSet(int _id) {
void ewol::widget::WSlider::subWidgetSelectSet( Widget _widgetPointer) {
if (_widgetPointer == null) {
Log.error("Can not change to a widget null");
LOGGER.error("Can not change to a widget null");
return;
}
int iii = 0;
@ -161,15 +161,15 @@ void ewol::widget::WSlider::subWidgetSelectSet( Widget _widgetPointer) {
}
iii++;
}
Log.error("Can not change to a widget not present");
LOGGER.error("Can not change to a widget not present");
}
void ewol::widget::WSlider::subWidgetSelectSet( String _widgetName) {
if (_widgetName == "") {
Log.error("Can not change to a widget with no name (input)");
LOGGER.error("Can not change to a widget with no name (input)");
return;
}
Log.verbose("Select a new sub-widget to dosplay : '" + _widgetName + "'");
LOGGER.trace("Select a new sub-widget to dosplay : '" + _widgetName + "'");
int iii = 0;
for (auto it : this.subWidget) {
if ( it != null
@ -181,10 +181,10 @@ void ewol::widget::WSlider::subWidgetSelectSet( String _widgetName) {
}
iii++;
}
Log.error("Can not change to a widget not present");
LOGGER.error("Can not change to a widget not present");
}
void ewol::widget::WSlider::periodicCall( ewol::event::Time _event) {
Log.error("Periodic: " + this.slidingProgress + "/1.0 " + this.windowsSources + " ==> " + this.windowsDestination + " " + _event);
LOGGER.error("Periodic: " + this.slidingProgress + "/1.0 " + this.windowsSources + " ==> " + this.windowsDestination + " " + _event);
if (this.slidingProgress >= 1.0) {
this.windowsSources = this.windowsDestination;
if( this.windowsRequested != -1
@ -230,16 +230,16 @@ void ewol::widget::WSlider::systemDraw( ewol::DrawProperty _displayProp) {
prop.limit(this.origin, this.size);
if (this.windowsDestination == this.windowsSources) {
//Log.debug("Draw : " + this.windowsDestination);
//LOGGER.debug("Draw : " + this.windowsDestination);
auto it = this.subWidget.begin();
it += this.windowsDestination;
if ( it != this.subWidget.end()
LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM *it != null) {
//Log.info("Draw : [" + propertyName + "] t=" + getObjectType() + "o=" + this.origin + " s=" + this.size);
//LOGGER.info("Draw : [" + propertyName + "] t=" + getObjectType() + "o=" + this.origin + " s=" + this.size);
(*it).systemDraw(prop);
}
} else {
//Log.debug("Draw : " + this.windowsSources + "=>" + this.windowsDestination + "progress=" + ((float)this.slidingProgress/1000.) );
//LOGGER.debug("Draw : " + this.windowsSources + "=>" + this.windowsDestination + "progress=" + ((float)this.slidingProgress/1000.) );
// draw Sources :
auto it = this.subWidget.begin();
it += this.windowsSources;
@ -283,7 +283,7 @@ void ewol::widget::WSlider::onRegenerateDisplay() {
void ewol::widget::WSlider::onChangePropertySelectWidget() {
if (propertySelectWidget.get() != "") {
Log.error("SELECT new widget: " + propertySelectWidget.get());
LOGGER.error("SELECT new widget: " + propertySelectWidget.get());
subWidgetSelectSet(*propertySelectWidget);
}
}

View File

@ -44,9 +44,9 @@ void ewol::widget::Parameter::init() {
mySizerVert = ewol::widget::Sizer::create();
if (mySizerVert == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
Log.info("add widget");
LOGGER.info("add widget");
mySizerVert.propertyMode.set(widget::Sizer::modeVert);
mySizerVert.propertyLockExpand.set(Vector2b(true,true));
mySizerVert.propertyExpand.set(Vector2b(true,true));
@ -55,14 +55,14 @@ void ewol::widget::Parameter::init() {
mySizerHori = ewol::widget::Sizer::create();
if (mySizerHori == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySizerHori.propertyMode.set(widget::Sizer::modeHori);
mySizerVert.subWidgetAdd(mySizerHori);
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySpacer.propertyExpand.set(Vector2b(true,false));
mySizerHori.subWidgetAdd(mySpacer);
@ -70,7 +70,7 @@ void ewol::widget::Parameter::init() {
ewol::widget::Button tmpButton = widget::Button::create();
if (tmpButton == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
tmpButton.setSubWidget(ewol::widget::composerGenerateString(
"<sizer mode='hori'>\n"
@ -83,7 +83,7 @@ void ewol::widget::Parameter::init() {
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySpacer.propertyExpand.set(Vector2b(false,false));
mySpacer.propertyMinSize.set(gale::Dimension(Vector2f(10,0)));
@ -92,7 +92,7 @@ void ewol::widget::Parameter::init() {
tmpButton = ewol::widget::Button::create();
if (tmpButton == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
tmpButton.setSubWidget(ewol::widget::composerGenerateString(
"<sizer mode='hori'>\n"
@ -106,14 +106,14 @@ void ewol::widget::Parameter::init() {
mySizerHori = ewol::widget::Sizer::create();
if (mySizerHori == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySizerHori.propertyMode.set(widget::Sizer::modeHori);
mySizerVert.subWidgetAdd(mySizerHori);
this.paramList = ewol::widget::ParameterList::create();
if (this.paramList == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
this.paramList.signalSelect.connect(sharedFromThis(), ewol::widget::Parameter::onCallbackMenuSelected);
@ -123,7 +123,7 @@ void ewol::widget::Parameter::init() {
}
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySpacer.propertyFill.set(Vector2b(false,true));
mySpacer.propertyMinSize.set(Vector2f(5,5));
@ -133,14 +133,14 @@ void ewol::widget::Parameter::init() {
ewol::widget::Sizer mySizerVert2 = widget::Sizer::create();
if (mySizerVert2 == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySizerVert2.propertyMode.set(widget::Sizer::modeVert);
mySizerHori.subWidgetAdd(mySizerVert2);
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySpacer.propertyExpand.set(Vector2b(true,false));
mySpacer.propertyMinSize.set(Vector2f(5,5));
@ -150,7 +150,7 @@ void ewol::widget::Parameter::init() {
this.wSlider = ewol::widget::WSlider::create();
if (this.wSlider == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
this.wSlider.propertyTransitionSpeed.set(0.5);
this.wSlider.propertyTransitionMode.set(ewol::widget::WSlider::sladingTransitionVert);
@ -162,7 +162,7 @@ void ewol::widget::Parameter::init() {
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
mySpacer.propertyExpand.set(Vector2b(true,false));
mySpacer.propertyMinSize.set(Vector2f(5,5));
@ -172,7 +172,7 @@ void ewol::widget::Parameter::init() {
this.widgetTitle = ewol::widget::Label::create();
if (this.widgetTitle == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
this.widgetTitle.propertyValue.set(propertyLabelTitle);
this.widgetTitle.propertyExpand.set(Vector2b(true,false));
@ -200,11 +200,11 @@ void ewol::widget::Parameter::onCallbackMenuclosed() {
}
void ewol::widget::Parameter::onCallbackParameterSave() {
//ewol::userConfig::Save();
Log.todo("Save Parameter !!! ");
LOGGER.info("[TODO] Save Parameter !!! ");
}
void ewol::widget::Parameter::onCallbackMenuSelected( int _value) {
if (this.wSlider != null) {
Log.debug("event on the parameter : Menu-select select ID=" + _value + "");
LOGGER.debug("event on the parameter : Menu-select select ID=" + _value + "");
this.wSlider.subWidgetSelectSet(_value);
}
}
@ -216,10 +216,10 @@ void ewol::widget::Parameter::menuAdd(String _label, String _image, Widget _asso
if (_associateWidget != null) {
this.wSlider.subWidgetAdd(_associateWidget);
} else {
Log.debug("Associate an empty widget on it ...");
LOGGER.debug("Associate an empty widget on it ...");
ewol::widget::Label myLabel = widget::Label::create();
if (myLabel == null) {
Log.error("Can not allocate widget == > display might be in error");
LOGGER.error("Can not allocate widget == > display might be in error");
} else {
myLabel.propertyValue.set(String("No widget for : ") + _label);
myLabel.propertyExpand.set(Vector2b(true,true));

View File

@ -52,7 +52,7 @@ void ewol::widget::ParameterList::calculateMinMaxSize() {
void ewol::widget::ParameterList::addOObject( ememory::Ptr<ewol::Compositing> _newObject, int _pos) {
if (_newObject == null) {
Log.error("Try to add an empty object in the Widget generic display system");
LOGGER.error("Try to add an empty object in the Widget generic display system");
return;
}
if (_pos < 0 || (int)_pos >= this.listOObject.size() ) {
@ -79,7 +79,7 @@ void ewol::widget::ParameterList::onRegenerateDisplay() {
if (needRedraw() == true) {
// clean the object list ...
clearOObjectList();
//Log.debug("OnRegenerateDisplay(" + this.size.x + "," + this.size.y + ")");
//LOGGER.debug("OnRegenerateDisplay(" + this.size.x + "," + this.size.y + ")");
int tmpOriginX = 0;
int tmpOriginY = 0;
@ -195,17 +195,17 @@ boolean ewol::widget::ParameterList::onEventInput( ewol::event::Input _event) {
}
void ewol::widget::ParameterList::onGetFocus() {
Log.debug("Ewol::List get focus");
LOGGER.debug("Ewol::List get focus");
}
void ewol::widget::ParameterList::onLostFocus() {
Log.debug("Ewol::List Lost focus");
LOGGER.debug("Ewol::List Lost focus");
}
void ewol::widget::ParameterList::menuAdd(String _label, int _refId, String _image) {
ememory::Ptr<ewol::widget::elementPL> tmpEmement = ememory::make<widget::elementPL>(_label, _refId, _image, false);
if (tmpEmement == null) {
Log.error("Can not allocacte menu parameter");
LOGGER.error("Can not allocacte menu parameter");
return;
}
this.list.pushBack(tmpEmement);
@ -219,7 +219,7 @@ void ewol::widget::ParameterList::menuAddGroup(String _label) {
String image = "";
ememory::Ptr<ewol::widget::elementPL> tmpEmement = ememory::make<widget::elementPL>(_label, -1, image, true);
if (tmpEmement == null) {
Log.error("Can not allocacte menu parameter");
LOGGER.error("Can not allocacte menu parameter");
return;
}
this.list.pushBack(tmpEmement);

View File

@ -104,17 +104,17 @@ void ewol::widget::StdPopUp::onChangePropertyComment() {
ewol::widget::Button ewol::widget::StdPopUp::addButton( String _text, boolean _autoExit) {
if (this.subBar == null) {
Log.error("button-bar does not existed ...");
LOGGER.error("button-bar does not existed ...");
return null;
}
ewol::widget::Button myButton = widget::Button::create();
if (myButton == null) {
Log.error("Can not allocate new button ...");
LOGGER.error("Can not allocate new button ...");
return null;
}
ewol::widget::Label myLabel = ewol::widget::Label::create();
if (myLabel == null) {
Log.error("Can not allocate new label ...");
LOGGER.error("Can not allocate new label ...");
return null;
}
myLabel.propertyValue.set(_text);

153
pom.xml Normal file
View File

@ -0,0 +1,153 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.atriasoft</groupId>
<artifactId>ewol</artifactId>
<version>0.1.0</version>
<properties>
<maven.compiler.version>3.13.0</maven.compiler.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.dependency.version>3.1.1</maven.dependency.version>
</properties>
<repositories>
<repository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</repository>
<snapshotRepository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>gale</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>io-gami</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>esvg</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>ejson</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>exml</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>esignal</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>loader3d</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test/src</testSourceDirectory>
<directory>${project.basedir}/out/maven/</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<!--<encoding>${project.build.sourceEncoding}</encoding>-->
</configuration>
</plugin>
<!-- Create the source bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- junit results -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!-- Java-doc generation for stand-alone site -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
</configuration>
</plugin>
</plugins>
</build>
<!-- Generate Java-docs As Part Of Project Reports -->
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>public</show>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -177,7 +177,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Dimension2f castedValue) {
Log.warning("Set new value: {}", castedValue.withSize(castedValue.size().withX(valueButton)));
LOGGER.warn("Set new value: {}", castedValue.withSize(castedValue.size().withX(valueButton)));
pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withX(valueButton)));
}
} catch (final AknotException e) {
@ -209,7 +209,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Dimension2f castedValue) {
Log.warning("Set new value: {}", castedValue.withSize(castedValue.size().withY(valueButton)));
LOGGER.warn("Set new value: {}", castedValue.withSize(castedValue.size().withY(valueButton)));
pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withY(valueButton)));
}
} catch (final AknotException e) {
@ -253,7 +253,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Dimension3f castedValue) {
Log.warning("Set new value: {}", castedValue.withSize(castedValue.size().withX(valueButton)));
LOGGER.warn("Set new value: {}", castedValue.withSize(castedValue.size().withX(valueButton)));
pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withX(valueButton)));
}
} catch (final AknotException e) {
@ -285,7 +285,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Dimension3f castedValue) {
Log.warning("Set new value: {}", castedValue.withSize(castedValue.size().withY(valueButton)));
LOGGER.warn("Set new value: {}", castedValue.withSize(castedValue.size().withY(valueButton)));
pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withY(valueButton)));
}
} catch (final AknotException e) {
@ -317,7 +317,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Dimension3f castedValue) {
Log.warning("Set new value: {}", castedValue.withSize(castedValue.size().withZ(valueButton)));
LOGGER.warn("Set new value: {}", castedValue.withSize(castedValue.size().withZ(valueButton)));
pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withZ(valueButton)));
}
} catch (final AknotException e) {
@ -346,7 +346,7 @@ public class BasicWindows extends Windows {
this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect((valueButton) -> {
try {
Log.warning("Set new value: {}", valueButton);
LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, (double) valueButton);
} catch (final AknotException e) {
e.printStackTrace();
@ -373,7 +373,7 @@ public class BasicWindows extends Windows {
this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect((valueButton) -> {
try {
Log.warning("Set new value: {}", valueButton);
LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, (float) valueButton);
} catch (final AknotException e) {
e.printStackTrace();
@ -430,7 +430,7 @@ public class BasicWindows extends Windows {
state = new Gravity(GravityHorizontal.LEFT, GravityVertical.BOTTOM, GravityDepth.CENTER);
}
gravLabel.setPropertyValue(LABEL_GRAVITY + state.toString());
Log.warning("Set new value: {}", state);
LOGGER.warn("Set new value: {}", state);
pojo.setExistingValue(widget, state);
}
} catch (final AknotException e) {
@ -458,7 +458,7 @@ public class BasicWindows extends Windows {
this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect((valueButton) -> {
try {
Log.warning("Set new value: {}", valueButton);
LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, (int) (long) valueButton);
} catch (final AknotException e) {
@ -486,7 +486,7 @@ public class BasicWindows extends Windows {
this.sizerMenu.subWidgetAdd(spin);
final Connection con = spin.signalValue.connect((valueButton) -> {
try {
Log.warning("Set new value: {}", valueButton);
LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, valueButton);
} catch (final AknotException e) {
e.printStackTrace();
@ -513,7 +513,7 @@ public class BasicWindows extends Windows {
this.sizerMenu.subWidgetAdd(element);
final Connection con = element.signalModify.connect((valueButton) -> {
try {
Log.warning("Set new value: {}", valueButton);
LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, valueButton);
} catch (final AknotException e) {
e.printStackTrace();
@ -540,7 +540,7 @@ public class BasicWindows extends Windows {
this.sizerMenu.subWidgetAdd(element);
final Connection con = element.signalModify.connect((valueButton) -> {
try {
Log.warning("Set new value: {}", valueButton);
LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, Uri.valueOf(valueButton));
} catch (final AknotException e) {
e.printStackTrace();
@ -574,7 +574,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector2b castedValue) {
Log.warning("Set new value: {}", castedValue.withX(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withX(valueButton));
pojo.setExistingValue(widget, castedValue.withX(valueButton));
}
} catch (final AknotException e) {
@ -638,7 +638,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector2f castedValue) {
Log.warning("Set new value: {}", castedValue.withX(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withX(valueButton));
pojo.setExistingValue(widget, castedValue.withX(valueButton));
}
} catch (final AknotException e) {
@ -670,7 +670,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector2f castedValue) {
Log.warning("Set new value: {}", castedValue.withY(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withY(valueButton));
pojo.setExistingValue(widget, castedValue.withY(valueButton));
}
} catch (final AknotException e) {
@ -714,7 +714,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector2i castedValue) {
Log.warning("Set new value: {}", castedValue.withX((int) (long) valueButton));
LOGGER.warn("Set new value: {}", castedValue.withX((int) (long) valueButton));
pojo.setExistingValue(widget, castedValue.withX((int) (long) valueButton));
}
} catch (final AknotException e) {
@ -746,7 +746,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector2i castedValue) {
Log.warning("Set new value: {}", castedValue.withY((int) (long) valueButton));
LOGGER.warn("Set new value: {}", castedValue.withY((int) (long) valueButton));
pojo.setExistingValue(widget, castedValue.withY((int) (long) valueButton));
}
} catch (final AknotException e) {
@ -782,7 +782,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3b castedValue) {
Log.warning("Set new value: {}", castedValue.withX(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withX(valueButton));
pojo.setExistingValue(widget, castedValue.withX(valueButton));
}
} catch (final AknotException e) {
@ -865,7 +865,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3f castedValue) {
Log.warning("Set new value: {}", castedValue.withX(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withX(valueButton));
pojo.setExistingValue(widget, castedValue.withX(valueButton));
}
} catch (final AknotException e) {
@ -897,7 +897,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3f castedValue) {
Log.warning("Set new value: {}", castedValue.withY(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withY(valueButton));
pojo.setExistingValue(widget, castedValue.withY(valueButton));
}
} catch (final AknotException e) {
@ -929,7 +929,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3f castedValue) {
Log.warning("Set new value: {}", castedValue.withZ(valueButton));
LOGGER.warn("Set new value: {}", castedValue.withZ(valueButton));
pojo.setExistingValue(widget, castedValue.withZ(valueButton));
}
} catch (final AknotException e) {
@ -973,7 +973,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3i castedValue) {
Log.warning("Set new value: {}", castedValue.withX((int) (long) valueButton));
LOGGER.warn("Set new value: {}", castedValue.withX((int) (long) valueButton));
pojo.setExistingValue(widget, castedValue.withX((int) (long) valueButton));
}
} catch (final AknotException e) {
@ -1005,7 +1005,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3i castedValue) {
Log.warning("Set new value: {}", castedValue.withY((int) (long) valueButton));
LOGGER.warn("Set new value: {}", castedValue.withY((int) (long) valueButton));
pojo.setExistingValue(widget, castedValue.withY((int) (long) valueButton));
}
} catch (final AknotException e) {
@ -1037,7 +1037,7 @@ public class BasicWindows extends Windows {
try {
final Object oldValue = pojo.getValue(widget);
if (oldValue instanceof final Vector3i castedValue) {
Log.warning("Set new value: {}", castedValue.withZ((int) (long) valueButton));
LOGGER.warn("Set new value: {}", castedValue.withZ((int) (long) valueButton));
pojo.setExistingValue(widget, castedValue.withZ((int) (long) valueButton));
}
} catch (final AknotException e) {
@ -1051,40 +1051,40 @@ public class BasicWindows extends Windows {
}
public void connectAllSignals(final Widget widget, final IntrospectionModelComplex modelPojo) throws Exception {
Log.warning("Connect all signal(s) on '{}'", widget.getName());
LOGGER.warn("Connect all signal(s) on '{}'", widget.getName());
final List<IntrospectionProperty> signals = modelPojo.getSignals();
for (final IntrospectionProperty pojo : signals) {
Log.warning(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames()));
Log.warning(" ==> description='{}'", pojo.getDescription());
Log.warning(" ==> type='{}'", pojo.getType());
Log.warning(" ==> sub-type='{}'", pojo.getSubType());
LOGGER.warn(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames()));
LOGGER.warn(" ==> description='{}'", pojo.getDescription());
LOGGER.warn(" ==> type='{}'", pojo.getType());
LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType());
final String eventName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] : pojo.getBeanName();
if (pojo.getSubType() != null && pojo.getType() == Signal.class) {
Log.warning(" ** Signal<{}>", pojo.getSubType());
LOGGER.warn(" ** Signal<{}>", pojo.getSubType());
final Object signalObject = pojo.getValue(widget);
if (signalObject == null) {
Log.error("Signal is not accessible !!!!!!! ");
LOGGER.error("Signal is not accessible !!!!!!! ");
} else {
final String valueNameOfSignal = eventName;
@SuppressWarnings("unchecked")
final Signal<Object> tmp = (Signal<Object>) signalObject;
tmp.connect((object) -> {
Log.print("Get event from '{}' value='{}'", valueNameOfSignal, object);
LOGGER.print("Get event from '{}' value='{}'", valueNameOfSignal, object);
});
}
}
if (pojo.getSubType() == null && pojo.getType() == SignalEmpty.class) {
Log.warning(" ** SignalEmpty");
LOGGER.warn(" ** SignalEmpty");
final Object signalObject = pojo.getValue(widget);
if (signalObject == null) {
Log.error("Signal is not accessible !!!!!!! ");
LOGGER.error("Signal is not accessible !!!!!!! ");
} else {
final String valueNameOfSignal = eventName;
final SignalEmpty tmp = (SignalEmpty) signalObject;
tmp.connect(() -> {
Log.print("Get event from '{}'", valueNameOfSignal);
LOGGER.print("Get event from '{}'", valueNameOfSignal);
});
}
@ -1093,13 +1093,13 @@ public class BasicWindows extends Windows {
}
public void displayAllPropertyWithType(final Widget widget, final IntrospectionModel modelPojo) throws Exception {
Log.warning("Connect all property(ies) on '{}'", widget.getName());
LOGGER.warn("Connect all property(ies) on '{}'", widget.getName());
final List<IntrospectionProperty> atributes = modelPojo.getAttributes();
for (final IntrospectionProperty pojo : atributes) {
Log.warning(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames()));
Log.warning(" ==> description='{}'", pojo.getDescription());
Log.warning(" ==> type='{}'", pojo.getType());
Log.warning(" ==> sub-type='{}'", pojo.getSubType());
LOGGER.warn(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames()));
LOGGER.warn(" ==> description='{}'", pojo.getDescription());
LOGGER.warn(" ==> type='{}'", pojo.getType());
LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType());
final String propertyName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] : pojo.getBeanName();
if (pojo.getType() == int.class || pojo.getType() == Integer.class) {
addMenuInt(widget, pojo);
@ -1130,13 +1130,13 @@ public class BasicWindows extends Windows {
} else if (pojo.getType() == Dimension2f.class) {
addMenuDimension2f(widget, pojo);
} else if (pojo.getType() == DisplayMode.class) {
Log.error(" ==> plop");
LOGGER.error(" ==> plop");
} else if (pojo.getType() == Uri.class) {
addMenuURI(widget, pojo);
} else if (pojo.getType() == Gravity.class) {
addMenuGravity(widget, pojo);
} else {
Log.error(" ==> property type unknown='{}'", pojo.getType());
LOGGER.error(" ==> property type unknown='{}'", pojo.getType());
}
{
final Label simpleLabel = new Label("<b>" + propertyName + ":</b>");

View File

@ -16,7 +16,7 @@ public class Appl implements EwolApplication {
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");
LOGGER.print(" -h/--help display this help");
System.exit(0);
}
}
@ -39,44 +39,44 @@ public class Appl implements EwolApplication {
@Override
public void onCreate(final EwolContext context) {
Log.info("Application onCreate: [BEGIN]");
LOGGER.info("Application onCreate: [BEGIN]");
localCreate(context);
Log.info("Application onCreate: [ END ]");
LOGGER.info("Application onCreate: [ END ]");
}
@Override
public void onDestroy(final EwolContext context) {
Log.info("Application onDestroy: [BEGIN]");
LOGGER.info("Application onDestroy: [BEGIN]");
Log.info("Application onDestroy: [ END ]");
LOGGER.info("Application onDestroy: [ END ]");
}
@Override
public void onPause(final EwolContext context) {
Log.info("Application onPause: [BEGIN]");
LOGGER.info("Application onPause: [BEGIN]");
Log.info("Application onPause: [ END ]");
LOGGER.info("Application onPause: [ END ]");
}
@Override
public void onResume(final EwolContext context) {
Log.info("Application onResume: [BEGIN]");
LOGGER.info("Application onResume: [BEGIN]");
Log.info("Application onResume: [ END ]");
LOGGER.info("Application onResume: [ END ]");
}
@Override
public void onStart(final EwolContext context) {
Log.info("Application onStart: [BEGIN]");
LOGGER.info("Application onStart: [BEGIN]");
Log.info("Application onStart: [ END ]");
LOGGER.info("Application onStart: [ END ]");
}
@Override
public void onStop(final EwolContext context) {
Log.info("Application onStop: [BEGIN]");
LOGGER.info("Application onStop: [BEGIN]");
Log.info("Application onStop: [ END ]");
LOGGER.info("Application onStop: [ END ]");
}
}

View File

@ -6,15 +6,15 @@ import org.atriasoft.reggol.Logger;
public class Log {
private static final boolean FORCE_ALL = false;
private static final String LIB_NAME = "ewol-sample";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LOGGER.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_INFO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.PRINT);
private static final boolean PRINT_TODO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.WARNING);
public static void critical(final Exception e, final String data) {
e.printStackTrace();

View File

@ -16,7 +16,7 @@ public class Appl implements EwolApplication {
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");
LOGGER.print(" -h/--help display this help");
System.exit(0);
}
}
@ -39,44 +39,44 @@ public class Appl implements EwolApplication {
@Override
public void onCreate(final EwolContext context) {
Log.info("Application onCreate: [BEGIN]");
LOGGER.info("Application onCreate: [BEGIN]");
localCreate(context);
Log.info("Application onCreate: [ END ]");
LOGGER.info("Application onCreate: [ END ]");
}
@Override
public void onDestroy(final EwolContext context) {
Log.info("Application onDestroy: [BEGIN]");
LOGGER.info("Application onDestroy: [BEGIN]");
Log.info("Application onDestroy: [ END ]");
LOGGER.info("Application onDestroy: [ END ]");
}
@Override
public void onPause(final EwolContext context) {
Log.info("Application onPause: [BEGIN]");
LOGGER.info("Application onPause: [BEGIN]");
Log.info("Application onPause: [ END ]");
LOGGER.info("Application onPause: [ END ]");
}
@Override
public void onResume(final EwolContext context) {
Log.info("Application onResume: [BEGIN]");
LOGGER.info("Application onResume: [BEGIN]");
Log.info("Application onResume: [ END ]");
LOGGER.info("Application onResume: [ END ]");
}
@Override
public void onStart(final EwolContext context) {
Log.info("Application onStart: [BEGIN]");
LOGGER.info("Application onStart: [BEGIN]");
Log.info("Application onStart: [ END ]");
LOGGER.info("Application onStart: [ END ]");
}
@Override
public void onStop(final EwolContext context) {
Log.info("Application onStop: [BEGIN]");
LOGGER.info("Application onStop: [BEGIN]");
Log.info("Application onStop: [ END ]");
LOGGER.info("Application onStop: [ END ]");
}
}

View File

@ -16,7 +16,7 @@ public class Appl implements EwolApplication {
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");
LOGGER.print(" -h/--help display this help");
System.exit(0);
}
}
@ -39,44 +39,44 @@ public class Appl implements EwolApplication {
@Override
public void onCreate(final EwolContext context) {
Log.info("Application onCreate: [BEGIN]");
LOGGER.info("Application onCreate: [BEGIN]");
localCreate(context);
Log.info("Application onCreate: [ END ]");
LOGGER.info("Application onCreate: [ END ]");
}
@Override
public void onDestroy(final EwolContext context) {
Log.info("Application onDestroy: [BEGIN]");
LOGGER.info("Application onDestroy: [BEGIN]");
Log.info("Application onDestroy: [ END ]");
LOGGER.info("Application onDestroy: [ END ]");
}
@Override
public void onPause(final EwolContext context) {
Log.info("Application onPause: [BEGIN]");
LOGGER.info("Application onPause: [BEGIN]");
Log.info("Application onPause: [ END ]");
LOGGER.info("Application onPause: [ END ]");
}
@Override
public void onResume(final EwolContext context) {
Log.info("Application onResume: [BEGIN]");
LOGGER.info("Application onResume: [BEGIN]");
Log.info("Application onResume: [ END ]");
LOGGER.info("Application onResume: [ END ]");
}
@Override
public void onStart(final EwolContext context) {
Log.info("Application onStart: [BEGIN]");
LOGGER.info("Application onStart: [BEGIN]");
Log.info("Application onStart: [ END ]");
LOGGER.info("Application onStart: [ END ]");
}
@Override
public void onStop(final EwolContext context) {
Log.info("Application onStop: [BEGIN]");
LOGGER.info("Application onStop: [BEGIN]");
Log.info("Application onStop: [ END ]");
LOGGER.info("Application onStop: [ END ]");
}
}

View File

@ -16,7 +16,7 @@ public class Appl implements EwolApplication {
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");
LOGGER.print(" -h/--help display this help");
System.exit(0);
}
}
@ -39,44 +39,44 @@ public class Appl implements EwolApplication {
@Override
public void onCreate(final EwolContext context) {
Log.info("Application onCreate: [BEGIN]");
LOGGER.info("Application onCreate: [BEGIN]");
localCreate(context);
Log.info("Application onCreate: [ END ]");
LOGGER.info("Application onCreate: [ END ]");
}
@Override
public void onDestroy(final EwolContext context) {
Log.info("Application onDestroy: [BEGIN]");
LOGGER.info("Application onDestroy: [BEGIN]");
Log.info("Application onDestroy: [ END ]");
LOGGER.info("Application onDestroy: [ END ]");
}
@Override
public void onPause(final EwolContext context) {
Log.info("Application onPause: [BEGIN]");
LOGGER.info("Application onPause: [BEGIN]");
Log.info("Application onPause: [ END ]");
LOGGER.info("Application onPause: [ END ]");
}
@Override
public void onResume(final EwolContext context) {
Log.info("Application onResume: [BEGIN]");
LOGGER.info("Application onResume: [BEGIN]");
Log.info("Application onResume: [ END ]");
LOGGER.info("Application onResume: [ END ]");
}
@Override
public void onStart(final EwolContext context) {
Log.info("Application onStart: [BEGIN]");
LOGGER.info("Application onStart: [BEGIN]");
Log.info("Application onStart: [ END ]");
LOGGER.info("Application onStart: [ END ]");
}
@Override
public void onStop(final EwolContext context) {
Log.info("Application onStop: [BEGIN]");
LOGGER.info("Application onStop: [BEGIN]");
Log.info("Application onStop: [ END ]");
LOGGER.info("Application onStop: [ END ]");
}
}

View File

@ -16,7 +16,7 @@ public class Appl implements EwolApplication {
for (int iii = 0; iii < context.getCmd().size(); iii++) {
final String tmpppp = context.getCmd().get(iii);
if (tmpppp == "-h" || tmpppp == "--help") {
Log.print(" -h/--help display this help");
LOGGER.print(" -h/--help display this help");
System.exit(0);
}
}
@ -39,44 +39,44 @@ public class Appl implements EwolApplication {
@Override
public void onCreate(final EwolContext context) {
Log.info("Application onCreate: [BEGIN]");
LOGGER.info("Application onCreate: [BEGIN]");
localCreate(context);
Log.info("Application onCreate: [ END ]");
LOGGER.info("Application onCreate: [ END ]");
}
@Override
public void onDestroy(final EwolContext context) {
Log.info("Application onDestroy: [BEGIN]");
LOGGER.info("Application onDestroy: [BEGIN]");
Log.info("Application onDestroy: [ END ]");
LOGGER.info("Application onDestroy: [ END ]");
}
@Override
public void onPause(final EwolContext context) {
Log.info("Application onPause: [BEGIN]");
LOGGER.info("Application onPause: [BEGIN]");
Log.info("Application onPause: [ END ]");
LOGGER.info("Application onPause: [ END ]");
}
@Override
public void onResume(final EwolContext context) {
Log.info("Application onResume: [BEGIN]");
LOGGER.info("Application onResume: [BEGIN]");
Log.info("Application onResume: [ END ]");
LOGGER.info("Application onResume: [ END ]");
}
@Override
public void onStart(final EwolContext context) {
Log.info("Application onStart: [BEGIN]");
LOGGER.info("Application onStart: [BEGIN]");
Log.info("Application onStart: [ END ]");
LOGGER.info("Application onStart: [ END ]");
}
@Override
public void onStop(final EwolContext context) {
Log.info("Application onStop: [BEGIN]");
LOGGER.info("Application onStop: [BEGIN]");
Log.info("Application onStop: [ END ]");
LOGGER.info("Application onStop: [ END ]");
}
}

View File

@ -22,7 +22,6 @@ open module org.atriasoft.ewol {
requires transitive org.atriasoft.esvg;
requires transitive org.atriasoft.exml;
requires transitive org.atriasoft.ejson;
requires transitive org.atriasoft.reggol;
requires org.atriasoft.loader3d;
requires org.atriasoft.egami;
requires java.base;

View File

@ -8,7 +8,8 @@ import org.atriasoft.ejson.Ejson;
import org.atriasoft.ejson.model.JsonNode;
import org.atriasoft.ejson.model.JsonObject;
import org.atriasoft.etk.Uri;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a simple interface to converte application display string in a
@ -21,6 +22,7 @@ import org.atriasoft.ewol.internal.Log;
* Portuguese, Brazilian : "PT" Chinese : "ZH"
*/
public class ETranslate {
private static final Logger LOGGER = LoggerFactory.getLogger(ETranslate.class);
private static boolean globalIsInit = false;
private static String globalLanguage = "";
private static String globalLanguageDefault = "EN";
@ -29,13 +31,6 @@ public class ETranslate {
private static Map<String, String> globalTranslate = new HashMap<>();
private static boolean globalTranslateLoadad = false;
/**
* Initialize etranslate
* @param argc Number of argument list
* @param argv List of arguments
*/
static {}
/**
* Set the path folder of the translation files
* @param lib Library name that the path depend
@ -51,7 +46,7 @@ public class ETranslate {
ETranslate.globalListPath.put(lib, uri);
if (major) {
ETranslate.globalMajor = lib;
Log.info("Change major translation : '" + ETranslate.globalMajor + "'");
LOGGER.info("Change major translation : '" + ETranslate.globalMajor + "'");
}
ETranslate.globalTranslateLoadad = false;
ETranslate.globalTranslate.clear();
@ -62,23 +57,23 @@ public class ETranslate {
*/
public static void autoDetectLanguage() {
if (!ETranslate.globalIsInit) {
Log.error("E-translate system has not been init");
LOGGER.error("E-translate system has not been init");
}
Log.verbose("Auto-detect language of system");
LOGGER.trace("Auto-detect language of system");
final String nonameLocalName = "EN";
final String userLocalName = "EN";
final String globalLocalName = "EN";
/*
* try { nonameLocalName = setlocale(LC_ALL, ""); userLocalName =
* setlocale(LC_MESSAGES, ""); globalLocalName = setlocale(LC_CTYPE, "");
* Log.error(" The default locale is '" + globalLocalName + "'");
* Log.error(" The user's locale is '" + userLocalName + "'");
* Log.error(" A nameless locale is '" + nonameLocalName + "'"); } catch (int
* LOGGER.error(" The default locale is '" + globalLocalName + "'");
* LOGGER.error(" The user's locale is '" + userLocalName + "'");
* LOGGER.error(" A nameless locale is '" + nonameLocalName + "'"); } catch (int
* e) {
* // TODO Do it better RuntimeError e) {
* Log.error("Can not get Locals ==> set English ..."); }
* LOGGER.error("Can not get Locals ==> set English ..."); }
*/
Log.error("Can not get Locals ==> set English ...");
LOGGER.error("Can not get Locals ==> set English ...");
String lang = nonameLocalName;
if (lang.equals("*") || lang.isEmpty()) {
@ -92,7 +87,7 @@ public class ETranslate {
}
lang = lang.substring(0, 2);
lang = lang.toUpperCase();
Log.info("Select Language : '" + lang + "'");
LOGGER.info("Select Language : '" + lang + "'");
ETranslate.setLanguage(lang);
}
@ -104,14 +99,14 @@ public class ETranslate {
*/
public static String get(final String instance) {
ETranslate.loadTranslation();
Log.verbose("Request translate: '" + instance + "'");
LOGGER.trace("Request translate: '" + instance + "'");
// find all iterance of 'T{' ... '}'
final String out = Pattern.compile("_T\\{(.*)\\}").matcher(instance).replaceAll(mr -> {
final String data = mr.group(1);
Log.info("translate : '" + data + "'");
LOGGER.info("translate : '" + data + "'");
final String itTranslate = ETranslate.globalTranslate.get(data);
if (itTranslate == null) {
Log.debug("Can not find tranlation : '" + instance + "'");
LOGGER.debug("Can not find tranlation : '" + instance + "'");
return data;
}
return itTranslate;
@ -148,8 +143,9 @@ public class ETranslate {
if (ETranslate.globalTranslateLoadad) {
return;
}
Log.debug("Load Translation MAJOR='" + ETranslate.globalMajor + "' LANG='" + ETranslate.globalLanguage + "' default=" + ETranslate.globalLanguageDefault);
Log.debug("list path=" + ETranslate.globalListPath.keySet());
LOGGER.debug("Load Translation MAJOR='" + ETranslate.globalMajor + "' LANG='" + ETranslate.globalLanguage
+ "' default=" + ETranslate.globalLanguageDefault);
LOGGER.debug("list path=" + ETranslate.globalListPath.keySet());
// start parse language for Major:
final Uri itMajor = ETranslate.globalListPath.get(ETranslate.globalMajor);
if (itMajor != null) {
@ -158,7 +154,7 @@ public class ETranslate {
final JsonObject root = (JsonObject) Ejson.parse(uri);
for (final Map.Entry<String, JsonNode> element : root.getNodes().entrySet()) {
final String val = element.getValue().toJsonString().getValue();
//Log.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
//LOGGER.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
ETranslate.globalTranslate.put(element.getKey(), val);
}
} catch (final Exception e) {
@ -170,7 +166,7 @@ public class ETranslate {
final JsonObject root = (JsonObject) Ejson.parse(uri);
for (final Map.Entry<String, JsonNode> element : root.getNodes().entrySet()) {
final String val = element.getValue().toJsonString().getValue();
//Log.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
//LOGGER.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
ETranslate.globalTranslate.put(element.getKey(), val);
}
} catch (final Exception e) {
@ -197,7 +193,7 @@ public class ETranslate {
}
for (final Map.Entry<String, JsonNode> element : doc.getNodes().entrySet()) {
final String val = element.getValue().toJsonString().getValue();
//Log.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
//LOGGER.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
ETranslate.globalTranslate.put(element.getKey(), val);
}
}
@ -206,7 +202,8 @@ public class ETranslate {
if (it.getKey().contentEquals(ETranslate.globalMajor)) {
continue;
}
final Uri uri = it.getValue().withPath(it.getValue().getPath() + "/" + ETranslate.globalLanguageDefault + ".json");
final Uri uri = it.getValue()
.withPath(it.getValue().getPath() + "/" + ETranslate.globalLanguageDefault + ".json");
/*
* TODO ... if (Uri.exist(uri) == false) { continue; }
*/
@ -220,7 +217,7 @@ public class ETranslate {
}
for (final Map.Entry<String, JsonNode> element : doc.getNodes().entrySet()) {
final String val = element.getValue().toJsonString().getValue();
//Log.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
//LOGGER.info("Add global translate: '" + element.getKey() + "' => '" + val + "'");
ETranslate.globalTranslate.put(element.getKey(), val);
}
}
@ -241,27 +238,27 @@ public class ETranslate {
ETranslate.globalTranslateLoadad = false;
ETranslate.globalTranslate.clear();
if (lang.equals("EN")) {
Log.info("Change language translation: '" + lang + "'=English");
LOGGER.info("Change language translation: '" + lang + "'=English");
} else if (lang.equals("FR")) {
Log.info("Change language translation: '" + lang + "'=French");
LOGGER.info("Change language translation: '" + lang + "'=French");
} else if (lang.equals("DE")) {
Log.info("Change language translation: '" + lang + "'=German");
LOGGER.info("Change language translation: '" + lang + "'=German");
} else if (lang.equals("SP")) {
Log.info("Change language translation: '" + lang + "'=Spanish");
LOGGER.info("Change language translation: '" + lang + "'=Spanish");
} else if (lang.equals("JA")) {
Log.info("Change language translation: '" + lang + "'=Japanese");
LOGGER.info("Change language translation: '" + lang + "'=Japanese");
} else if (lang.equals("IT")) {
Log.info("Change language translation: '" + lang + "'=Italian");
LOGGER.info("Change language translation: '" + lang + "'=Italian");
} else if (lang.equals("KO")) {
Log.info("Change language translation: '" + lang + "'=Korean");
LOGGER.info("Change language translation: '" + lang + "'=Korean");
} else if (lang.equals("RU")) {
Log.info("Change language translation: '" + lang + "'=Russian");
LOGGER.info("Change language translation: '" + lang + "'=Russian");
} else if (lang.equals("PT")) {
Log.info("Change language translation: '" + lang + "'=Portuguese, Brazilian");
LOGGER.info("Change language translation: '" + lang + "'=Portuguese, Brazilian");
} else if (lang.equals("ZH")) {
Log.info("Change language translation: '" + lang + "'=Chinese");
LOGGER.info("Change language translation: '" + lang + "'=Chinese");
} else {
Log.info("Change language translation: '" + lang + "'=Unknow");
LOGGER.info("Change language translation: '" + lang + "'=Unknow");
}
}
@ -275,7 +272,7 @@ public class ETranslate {
if (ETranslate.globalLanguageDefault.equals(lang)) {
return;
}
Log.info("Change default language translation : '" + lang + "'");
LOGGER.info("Change default language translation : '" + lang + "'");
ETranslate.globalLanguageDefault = lang;
ETranslate.globalTranslateLoadad = false;
ETranslate.globalTranslate.clear();

View File

@ -14,12 +14,14 @@ import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.resource.ResourceProgram;
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompositingDrawing extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingDrawing.class);
protected static int vboIdColor = 1;
protected static int vboIdCoord = 0;
@ -184,12 +186,12 @@ public class CompositingDrawing extends Compositing {
@Override
public void draw(final boolean disableDepthTest) {
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
// set Matrix : translation/positionMatrix
Matrix4f projMatrix = OpenGL.getMatrix();
Matrix4f camMatrix = OpenGL.getCameraMatrix();
final Matrix4f projMatrix = OpenGL.getMatrix();
final Matrix4f camMatrix = OpenGL.getCameraMatrix();
this.oGLprogram.use();
this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix);
@ -301,9 +303,9 @@ public class CompositingDrawing extends Compositing {
public void lineTo(final Vector3f dest) {
resetCount();
internalSetColor(this.color);
// Log.verbose("DrawLine : " + this.position + " to " + dest);
// LOGGER.trace("DrawLine : " + this.position + " to " + dest);
if (this.position.x() == dest.x() && this.position.y() == dest.y() && this.position.z() == dest.z()) {
// Log.warning("Try to draw a line width 0");
// LOGGER.warn("Try to draw a line width 0");
return;
}
// teta = tan-1(oposer/adjacent)
@ -318,7 +320,7 @@ public class CompositingDrawing extends Compositing {
} else if (teta > 2 * FMath.PI) {
teta -= 2 * FMath.PI;
}
// Log.debug("teta = " + (teta*180/(FMath.PI)) + " deg." );
// LOGGER.debug("teta = " + (teta*180/(FMath.PI)) + " deg." );
final float offsety = FMath.sin(teta - FMath.PI / 2) * (this.thickness / 2);
final float offsetx = FMath.cos(teta - FMath.PI / 2) * (this.thickness / 2);
setPoint(new Vector3f(this.position.x() - offsetx, this.position.y() - offsety, this.position.z()));
@ -339,7 +341,8 @@ public class CompositingDrawing extends Compositing {
// remove previous loading ... in case
unLoadProgram();
// oad the new ...
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "color3.vert", "ewol"), new Uri("DATA", "color3.frag", "ewol"));
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "color3.vert", "ewol"),
new Uri("DATA", "color3.frag", "ewol"));
// get the shader resource :
if (this.oGLprogram != null) {
//this.oGLPosition = this.oGLprogram.getAttribute("in_coord3d");

View File

@ -12,10 +12,12 @@ import org.atriasoft.esvg.JoinMode;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.resource.ResourceTexture2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompositingGraphicContext extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingGraphicContext.class);
GraphicContext context = new GraphicContext();
private final ResourceTexture2 texture = new ResourceTexture2();
@ -69,10 +71,10 @@ public class CompositingGraphicContext extends Compositing {
@Override
public void flush() {
if (this.texture == null) {
Log.warning("texture is null");
LOGGER.warn("texture is null");
return;
}
ImageByte img = this.context.render();
final ImageByte img = this.context.render();
//IOgami.storePNG(new Uri("/home/heero/000000000aaaaplopppp222.png"), img);
this.texture.set(img);
this.texture.flush();

View File

@ -12,15 +12,17 @@ import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.backend3d.OpenGL;
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.ResourceVirtualArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompositingImage extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingImage.class);
public static final int NB_VBO = 3;
public static final int SIZE_AUTO = 0;
public static final int VBO_ID_COLOR = 2;
@ -59,7 +61,7 @@ public class CompositingImage extends Compositing {
// Create the VBO:
this.vbo = ResourceVirtualArrayObject.createDynamic();
if (this.vbo == null) {
Log.error("can not instanciate VBO ...");
LOGGER.error("can not instanciate VBO ...");
return;
}
// TO facilitate some debugs we add a name of the VBO:
@ -91,7 +93,7 @@ public class CompositingImage extends Compositing {
public void draw(final boolean disableDepthTest) {
/*
if (this.VBO.bufferSize(this.vboIdCoord) <= 0) {
//Log.warning("Nothink to draw...");
//LOGGER.warn("Nothink to draw...");
return;
}
*/
@ -100,10 +102,10 @@ public class CompositingImage extends Compositing {
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
//Log.warning("Display image : " + this.VBO.bufferSize(this.vboIdCoord));
//LOGGER.warn("Display image : " + this.VBO.bufferSize(this.vboIdCoord));
if (disableDepthTest) {
OpenGL.disable(OpenGL.Flag.flag_depthTest);
} else {
@ -123,7 +125,7 @@ public class CompositingImage extends Compositing {
} else if (this.resource != null) {
this.resource.bindForRendering(0);
} else {
Log.error("FONT type error Request normal and display distance field ...");
LOGGER.error("FONT type error Request normal and display distance field ...");
}
this.vbo.renderArrays(RenderMode.TRIANGLE);
this.vbo.unBindForRendering();
@ -174,7 +176,8 @@ public class CompositingImage extends Compositing {
*/
private void loadProgram() {
// get the shader resource:
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"), new Uri("DATA", "textured3D.frag", "ewol"));
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"),
new Uri("DATA", "textured3D.frag", "ewol"));
if (this.oGLprogram != null) {
this.oGLMatrixTransformation = this.oGLprogram.getUniform("in_matrixTransformation");
this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection");
@ -209,7 +212,8 @@ public class CompositingImage extends Compositing {
final Vector2f ratio = new Vector2f(usefullSize.x() / openGLSize.x(), usefullSize.y() / openGLSize.y());
final Vector2f sourcePosStart = sourcePosStartIn.multiply(ratio);
final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio);
Log.verbose(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart + " stop=" + sourcePosStop);
LOGGER.trace(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart
+ " stop=" + sourcePosStop);
this.vboDataColors = new Color[6];
this.vboDataCoords = new Vector3f[6];
@ -394,16 +398,16 @@ public class CompositingImage extends Compositing {
// link to new one
this.resource = ResourceTextureFile.create(this.filename, tmpSize);
if (this.resource == null) {
Log.error("Can not get Image resource");
LOGGER.error("Can not get Image resource");
}
}
if (this.resource == null && this.resourceImage == null) {
if (resource != null) {
Log.warning("Retrive previous resource");
LOGGER.warn("Retrive previous resource");
this.resource = resource;
}
if (resourceTex != null) {
Log.warning("Retrive previous resource (image)");
LOGGER.warn("Retrive previous resource (image)");
this.resourceImage = resourceTex;
}
}

View File

@ -15,13 +15,15 @@ import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.ResourceTexturedFont;
import org.atriasoft.ewol.resource.font.FontMode;
import org.atriasoft.ewol.resource.font.GlyphProperty;
import org.atriasoft.gale.backend3d.OpenGL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompositingText extends TextBase {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingText.class);
protected List<Color> colors = new ArrayList<>();
protected ResourceTexturedFont font; // !< Font resources
protected List<Vector3f> pointPositions = new ArrayList<>();
@ -59,9 +61,9 @@ public class CompositingText extends TextBase {
final int fontHeigh = (int) getHeight();
if (myGlyphProperty == null) {
if (this.font == null) {
Log.warning("no Glyph... in no font");
LOGGER.warn("no Glyph... in no font");
} else {
Log.warning("no Glyph... in font : " + this.font.getName());
LOGGER.warn("no Glyph... in font : " + this.font.getName());
}
return new Vector3f(0.2f, fontHeigh, 0);
}
@ -71,7 +73,8 @@ public class CompositingText extends TextBase {
kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode);
}
final Vector3f outputSize = new Vector3f((myGlyphProperty.getAdvenceX() + kerningOffset) * renderRatio, (fontHeigh), 0);
final Vector3f outputSize = new Vector3f((myGlyphProperty.getAdvenceX() + kerningOffset) * renderRatio,
(fontHeigh), 0);
// Register the previous character
this.previousCharcode = charcode;
return outputSize;
@ -94,15 +97,15 @@ public class CompositingText extends TextBase {
this.vectorialDraw.draw(disableDepthTest);
if (this.vbo.getVertexCount() <= 0 || this.font == null) {
// Log.warning("Nothink to draw...");
// LOGGER.warn("Nothink to draw...");
return;
}
if (this.font == null) {
Log.warning("no font...");
LOGGER.warn("no font...");
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
// set Matrix : translation/positionMatrix
@ -132,11 +135,11 @@ public class CompositingText extends TextBase {
if (this.vbo.getVertexCount() <= 0 || this.font == null) {
// TODO : set it back ...
// Log.warning("Nothink to draw...");
// LOGGER.warn("Nothink to draw...");
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
if (enableDepthTest) {
@ -180,7 +183,7 @@ public class CompositingText extends TextBase {
@Override
public GlyphProperty getGlyphPointer(final Character charcode) {
if (this.font == null) {
Log.warning("no font...");
LOGGER.warn("no font...");
return null;
}
return this.font.getGlyph(charcode, this.mode);
@ -189,7 +192,7 @@ public class CompositingText extends TextBase {
@Override
public float getHeight() {
if (this.font == null) {
Log.warning("no font...");
LOGGER.warn("no font...");
return 10.0f;
}
final float renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired;
@ -199,7 +202,7 @@ public class CompositingText extends TextBase {
@Override
public float getSize() {
if (this.font == null) {
Log.warning("no font...");
LOGGER.warn("no font...");
return 1.0f;
}
final float renderRatio = (float) this.currentFontSizeRequired / (float) this.currentFontSizeRequired;
@ -208,11 +211,11 @@ public class CompositingText extends TextBase {
@Override
public void printChar(final Character charcode) {
//Log.error("Request printChar : '{}' @pos={}", charcode, this.position);
//LOGGER.error("Request printChar : '{}' @pos={}", charcode, this.position);
// get a pointer on the glyph property :
final GlyphProperty myGlyphProperty = getGlyphPointer(charcode);
if (myGlyphProperty == null) {
Log.error(" font does not really existed ...");
LOGGER.error(" font does not really existed ...");
return;
}
// sometime we do net require the correct size to the glyph renderer (due to the fact SVG render is not clear on lower size...)
@ -226,7 +229,7 @@ public class CompositingText extends TextBase {
if (this.kerning) {
kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode) * renderRatio;
if (kerningOffset != 0) {
// Log.debug("Kerning between : '" + this.previousCharcode + "''" + myGlyph.UVal
// LOGGER.debug("Kerning between : '" + this.previousCharcode + "''" + myGlyph.UVal
// + "' value : " + kerningOffset);
}
}
@ -237,7 +240,8 @@ public class CompositingText extends TextBase {
*/
float dxA = this.position.x() + myGlyphProperty.getTextureRenderOffset().x() * renderRatio + kerningOffset;
float dxB = dxA + myGlyphProperty.sizeTexture.x() * renderRatio;
float dyC = this.position.y() + myGlyphProperty.getTextureRenderOffset().y() * renderRatio + fontHeigh - fontSize;
float dyC = this.position.y() + myGlyphProperty.getTextureRenderOffset().y() * renderRatio + fontHeigh
- fontSize;
float dyD = dyC - myGlyphProperty.sizeTexture.y() * renderRatio;
float tuA = myGlyphProperty.texturePosStart.x();
@ -246,7 +250,8 @@ public class CompositingText extends TextBase {
float tvD = tvC + myGlyphProperty.texturePosSize.y();
// Clipping and drawing area
if (this.clippingEnable && (dxB < this.clippingPosStart.x() || dxA > this.clippingPosStop.x() || dyC < this.clippingPosStart.y() || dyD > this.clippingPosStop.y())) {
if (this.clippingEnable && (dxB < this.clippingPosStart.x() || dxA > this.clippingPosStop.x()
|| dyC < this.clippingPosStart.y() || dyD > this.clippingPosStop.y())) {
// Nothing to display ...
} else {
if (this.clippingEnable) {
@ -346,10 +351,11 @@ public class CompositingText extends TextBase {
}
}
// move the position :
// Log.debug(" 5 pos=" + this.position + " advance=" + myGlyph.advance.x() + "
// LOGGER.debug(" 5 pos=" + this.position + " advance=" + myGlyph.advance.x() + "
// kerningOffset=" + kerningOffset);
this.position = this.position.withX(this.position.x() + myGlyphProperty.getAdvenceX() * renderRatio + kerningOffset);
// Log.debug(" 6 print '" + char-code + "' : start=" + this.sizeDisplayStart + "
this.position = this.position
.withX(this.position.x() + myGlyphProperty.getAdvenceX() * renderRatio + kerningOffset);
// LOGGER.debug(" 6 print '" + char-code + "' : start=" + this.sizeDisplayStart + "
// stop=" + this.sizeDisplayStop + " pos=" + this.position);
// Register the previous character
this.previousCharcode = charcode;
@ -387,14 +393,14 @@ public class CompositingText extends TextBase {
clear();
final Uri fontUri = Configs.getConfigFonts().getFontUri(fontName).clone();
fontUri.setProperty("size", Integer.toString(sizeRequest));
Log.verbose("plop : " + fontName + " size=" + sizeRequest + " result :" + fontName);
LOGGER.trace("plop : " + fontName + " size=" + sizeRequest + " result :" + fontName);
// link to new one
if (this.forceClimp) {
fontUri.setProperty("FORCE_CLIMP", "true");
}
this.font = ResourceTexturedFont.create(fontUri);
if (this.font == null) {
Log.error("Can not get font resource");
LOGGER.error("Can not get font resource");
this.font = previousFont;
} else {
this.currentFontName = inputFontName;

View File

@ -13,7 +13,6 @@ import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.event.EventTime;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.ResourceConfigFile;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.backend3d.OpenGL.Flag;
@ -21,6 +20,8 @@ import org.atriasoft.gale.resource.ResourceProgram;
import org.atriasoft.gale.resource.ResourceTexture2;
import org.atriasoft.loader3d.resources.ResourceMesh;
import org.atriasoft.loader3d.resources.ResourcePaletteFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @brief the Shaper system is a basic theme configuration for every widget, it corresponds at a background display described by a pool of files
@ -28,6 +29,8 @@ import org.atriasoft.loader3d.resources.ResourcePaletteFile;
// TODO : load image
// TODO : Abstaraction between states (call by name and the system greate IDs
public class GuiShape extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(GuiShape.class);
private class SpecificValues {
public Matrix4f transform = Matrix4f.IDENTITY;
public Vector3f offsetScaleInside = Vector3f.ZERO;
@ -138,17 +141,18 @@ public class GuiShape extends Compositing {
return;
}
if (idMesh == 0 && this.valueSpecific[0] == null) {
Log.error("No Object (0) to display ...");
LOGGER.error("No Object (0) to display ...");
return;
} else if (idMesh == 1 && this.valueSpecific[1] == null) {
Log.error("No Object (1) to display ...");
LOGGER.error("No Object (1) to display ...");
return;
} else if (idMesh < 0 && idMesh > 1) {
Log.critical("No Object (" + idMesh + ") to display [0..1]");
LOGGER.error("No Object (" + idMesh + ") to display [0..1]");
System.exit(-1);
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
OpenGL.enable(Flag.flag_depthTest);
@ -163,7 +167,7 @@ public class GuiShape extends Compositing {
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
final Set<String> layers = this.valueSpecific[idMesh].mesh.getLayers();
Log.verbose("get layers:" + layers);
LOGGER.trace("get layers:" + layers);
// Texture:
final float imageDelta = (float) 1 / ResourcePaletteFile.getHeight();
float basicValue = this.stateOld.getValue() / ResourcePaletteFile.getHeight();
@ -188,12 +192,13 @@ public class GuiShape extends Compositing {
}
}
}
Log.verbose("colorDelta = " + basicValue + " old = " + this.stateOld + "(" + this.stateOld.getValue() * imageDelta + ") new = " + this.stateNew + "(" + this.stateNew.getValue() * imageDelta
+ ")");
LOGGER.trace(
"colorDelta = " + basicValue + " old = " + this.stateOld + "(" + this.stateOld.getValue() * imageDelta
+ ") new = " + this.stateNew + "(" + this.stateNew.getValue() * imageDelta + ")");
this.oGLprogram.uniformFloat(this.oGLPaletteOffset, basicValue);
//Log.verbose("plop: " + this.offsetScaleOutside);
//Log.verbose("plop: " + this.offsetScaleInside);
//LOGGER.trace("plop: " + this.offsetScaleOutside);
//LOGGER.trace("plop: " + this.offsetScaleInside);
this.oGLprogram.uniformVector(this.oGLOffsetScaleInside, this.valueSpecific[idMesh].offsetScaleInside);
this.oGLprogram.uniformVector(this.oGLOffsetScaleOutside, this.valueSpecific[idMesh].offsetScaleOutside);
@ -254,8 +259,10 @@ public class GuiShape extends Compositing {
public Padding getPaddingIn() {
Padding out = Padding.ZERO;
if (this.config != null) {
out = new Padding(this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_LEFT]), this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_TOP]),
this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_RIGHT]), this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_BOTTOM]));
out = new Padding(this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_LEFT]),
this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_TOP]),
this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_RIGHT]),
this.config.getNumber(this.confIdPaddingIn[GuiShape.SHAPER_POS_BOTTOM]));
}
return out;
}
@ -263,8 +270,10 @@ public class GuiShape extends Compositing {
public Padding getPaddingOut() {
Padding out = Padding.ZERO;
if (this.config != null) {
out = new Padding(this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_LEFT]), this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_TOP]),
this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_RIGHT]), this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_BOTTOM]));
out = new Padding(this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_LEFT]),
this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_TOP]),
this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_RIGHT]),
this.config.getNumber(this.confIdPaddingOut[GuiShape.SHAPER_POS_BOTTOM]));
}
return out;
}
@ -295,7 +304,7 @@ public class GuiShape extends Compositing {
private void loadConfigFile() {
if (this.uri.isEmpty()) {
Log.debug("no Shaper set for loading resources ...");
LOGGER.debug("no Shaper set for loading resources ...");
return;
}
this.config = ResourceConfigFile.create(this.uri);
@ -323,7 +332,7 @@ public class GuiShape extends Compositing {
this.palette = ResourcePaletteFile.create(paletteFileInterface);
this.texture = ResourceTexture2.createNamed("TEXTURE_OF_PALETTE:" + paletteFile);
if (this.texture == null) {
Log.error("can not instanciate Texture ...");
LOGGER.error("can not instanciate Texture ...");
}
// element already called
loadPaletteUpdate();
@ -334,7 +343,7 @@ public class GuiShape extends Compositing {
}
protected void loadPaletteUpdate() {
Log.warning("update palet environnement");
LOGGER.warn("update palet environnement");
final ImageByte img = this.palette.getImageByte();
//IOgami.storePNG(new Uri("/home/heero/000000000aaaaplopppp.png"), img);
this.texture.set(img);
@ -345,13 +354,14 @@ public class GuiShape extends Compositing {
*/
private void loadProgram() {
if (this.config == null) {
Log.debug("no Shaper set for loading resources ...");
LOGGER.debug("no Shaper set for loading resources ...");
return;
}
final String basicShaderFileVert = this.config.getString(this.confProgramFileVert);
final String basicShaderFileFrag = this.config.getString(this.confProgramFileFrag);
if (!basicShaderFileVert.isEmpty() && !basicShaderFileFrag.isEmpty()) {
this.oGLprogram = ResourceProgram.create(Uri.valueOf(basicShaderFileVert), Uri.valueOf(basicShaderFileFrag));
this.oGLprogram = ResourceProgram.create(Uri.valueOf(basicShaderFileVert),
Uri.valueOf(basicShaderFileFrag));
if (this.oGLprogram != null) {
this.oGLMatrixTransformation = this.oGLprogram.getUniform("in_matrixTransformation");
this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection");
@ -368,7 +378,7 @@ public class GuiShape extends Compositing {
*/
private void loadUpdateObjectSize() {
if (this.config == null) {
Log.debug("no Shaper set for loading resources ...");
LOGGER.debug("no Shaper set for loading resources ...");
return;
}
final String objectFile = this.config.getString(this.confObjectFile);
@ -385,16 +395,17 @@ public class GuiShape extends Compositing {
float font = 0;
// estimate size of border:
if (verticesToModify == null) {
Log.critical("Element is null : verticesToModify 1");
LOGGER.error("Element is null : verticesToModify 1");
System.exit(-1);
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());
for (final Vector3f element : verticesToModify) {
left = Math.min(left, element.x());
right = Math.max(right, element.x());
top = Math.min(top, element.y());
bottom = Math.max(bottom, element.y());
back = Math.min(back, element.z());
font = Math.max(font, element.z());
}
this.sizeObject = new Padding(Math.abs(left), Math.abs(top), Math.abs(right), Math.abs(bottom));
} else {
@ -415,16 +426,17 @@ public class GuiShape extends Compositing {
float font = 0;
// estimate size of border:
if (verticesToModify == null) {
Log.critical("Element is null : verticesToModify 2");
LOGGER.error("Element is null : verticesToModify 2");
System.exit(-1);
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());
for (final Vector3f element : verticesToModify) {
left = Math.min(left, element.x());
right = Math.max(right, element.x());
top = Math.min(top, element.y());
bottom = Math.max(bottom, element.y());
back = Math.min(back, element.z());
font = Math.max(font, element.z());
}
} else {
final int idMesh = 1;
@ -439,7 +451,8 @@ public class GuiShape extends Compositing {
* @return false No need to request the periodic call.
*/
public boolean periodicCall(final EventTime event) {
Log.verbose("call=" + event.getTimeDeltaCallSecond() + "s state transition=" + this.stateTransition + " speedTime=" + this.config.getNumber(this.confIdChangeTime));
LOGGER.trace("call=" + event.getTimeDeltaCallSecond() + "s state transition=" + this.stateTransition
+ " speedTime=" + this.config.getNumber(this.confIdChangeTime));
// start :
if (this.stateTransition >= 1.0) {
this.stateOld = this.stateNew;
@ -451,7 +464,7 @@ public class GuiShape extends Compositing {
this.stateNew = this.nextStatusRequested;
this.nextStatusRequested = GuiShapeMode.NONE;
this.stateTransition = 0.0f;
Log.verbose(" ##### START ##### ");
LOGGER.trace(" ##### START ##### ");
return true;
}
if (this.stateTransition < 1.0) {
@ -473,7 +486,7 @@ public class GuiShape extends Compositing {
this.stateTransition += event.getTimeDeltaCallSecond() / timeRelativity;
//stateTransition += _event.getDeltaCall();
this.stateTransition = FMath.avg(0.0f, this.stateTransition, 1.0f);
Log.verbose("relative=" + timeRelativity + " Transition : " + this.stateTransition);
LOGGER.trace("relative=" + timeRelativity + " Transition : " + this.stateTransition);
}
return true;
}
@ -491,10 +504,16 @@ public class GuiShape extends Compositing {
setShape(idMesh, origin, size, origin.add(tmp.left(), tmp.bottom(), 0), size.less(tmp.x(), tmp.y(), 0));
}
public void setShape(final int idMesh, final Vector3f origin, final Vector3f size, final Vector3f insidePos, final Vector3f insideSize) {
public void setShape(
final int idMesh,
final Vector3f origin,
final Vector3f size,
final Vector3f insidePos,
final Vector3f insideSize) {
final Vector3f halfSize = insideSize.multiply(0.5f);
this.valueSpecific[idMesh].offsetScaleOutside = halfSize;
this.valueSpecific[idMesh].offsetScaleInside = halfSize.add(this.sizeObject.x() * 0.25f, this.sizeObject.y() * 0.25f, 0);
this.valueSpecific[idMesh].offsetScaleInside = halfSize.add(this.sizeObject.x() * 0.25f,
this.sizeObject.y() * 0.25f, 0);
/*
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
float[] newVertices = new float[verticesToModify.size()*3];
@ -506,7 +525,8 @@ public class GuiShape extends Compositing {
}
this.mesh.setModifiedPosition(newVertices);
*/
this.valueSpecific[idMesh].transform = Matrix4f.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, origin.z() + size.z() * 0.5f));
this.valueSpecific[idMesh].transform = Matrix4f.createMatrixTranslate(
new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, origin.z() + size.z() * 0.5f));
}
// private float getUpdatedPos(final float value, final float halfsize) {
@ -564,11 +584,16 @@ public class GuiShape extends Compositing {
* @param center Center of the object
* @param size Size of the display
*/
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);
public void setShape(
final Vector2f origin,
final Vector2f size,
final Vector2f insidePos,
final Vector2f insideSize) {
//LOGGER.error("Set shape property : origin=" + origin + " size=" + size + " in-pos=" + insidePos + " in-size=" + insideSize);
final Vector2f halfSize = insideSize.multiply(0.5f);
final Vector3f offsetScaleOutside = new Vector3f(halfSize.x(), halfSize.y(), 1.0f);
final Vector3f offsetScaleInside = new Vector3f(halfSize.x() + this.sizeObject.x() * 0.25f, halfSize.y() + this.sizeObject.y() * 0.25f, 1.0f);
final Vector3f 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();
float[] newVertices = new float[verticesToModify.size()*3];
@ -582,7 +607,8 @@ public class GuiShape extends Compositing {
//this.transform = this.transform.multiply(Matrix4f.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, 0.0f)));
this.mesh.setModifiedPosition(newVertices);
*/
final Matrix4f transform = Matrix4f.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, 0.0f));
final Matrix4f transform = Matrix4f
.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, 0.0f));
for (int iii = 0; iii < 2; iii++) {
if (this.valueSpecific[iii] == null) {
continue;
@ -598,7 +624,11 @@ public class GuiShape extends Compositing {
setShape(origin, size, origin.add(tmp.left(), tmp.bottom(), 0), size.less(tmp.x(), tmp.y(), 0));
}
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) {
final Vector3f halfSize = insideSize.multiply(0.5f);
final Vector3f offsetScaleOutside = halfSize;
final Vector3f offsetScaleInside = halfSize.add(this.sizeObject.x() * 0.25f, this.sizeObject.y() * 0.25f, 0);
@ -613,7 +643,8 @@ public class GuiShape extends Compositing {
}
this.mesh.setModifiedPosition(newVertices);
*/
final Matrix4f transform = Matrix4f.createMatrixTranslate(new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, origin.z() + size.z() * 0.5f));
final Matrix4f transform = Matrix4f.createMatrixTranslate(
new Vector3f(origin.x() + size.x() * 0.5f, origin.y() + size.y() * 0.5f, origin.z() + size.z() * 0.5f));
for (int iii = 0; iii < 2; iii++) {
if (this.valueSpecific[iii] == null) {
continue;

View File

@ -16,7 +16,6 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.util.Dynamic;
import org.atriasoft.ewol.compositing.tools.TextDecoration;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.font.FontMode;
import org.atriasoft.ewol.resource.font.GlyphProperty;
import org.atriasoft.exml.Exml;
@ -28,8 +27,11 @@ import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.exml.model.XmlNode;
import org.atriasoft.gale.resource.ResourceProgram;
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class TextBase extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(TextBase.class);
// previously this line and the center is perform with this one)
protected AlignMode alignment = AlignMode.DISABLE; // !< Current Alignment mode (justify/left/right ...)
protected boolean clippingEnable = false; // !< true if the clipping must be activated
@ -144,27 +146,29 @@ public abstract class TextBase extends Compositing {
public Vector3f calculateSizeHTML(final String text) {
// remove intermediate result
reset();
// Log.debug(" 0 size for=\n" + text);
// LOGGER.debug(" 0 size for=\n" + text);
// disable display system
this.needDisplay = false;
setPos(Vector3f.ZERO);
// same as print without the end display ...
printHTML(text);
//Log.error(" ]]]] position={}", this.position);
//Log.error(" ]]]] sizeDisplayStart={}", this.sizeDisplayStart);
//Log.error(" ]]]] sizeDisplayStop={}", this.sizeDisplayStop);
//LOGGER.error(" ]]]] position={}", this.position);
//LOGGER.error(" ]]]] sizeDisplayStart={}", this.sizeDisplayStart);
//LOGGER.error(" ]]]] sizeDisplayStop={}", this.sizeDisplayStop);
// get the last elements
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop);
this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart);
// Log.debug(" 2 Start pos=" + this.sizeDisplayStart);
// Log.debug(" 2 Stop pos=" + this.sizeDisplayStop);
// LOGGER.debug(" 2 Start pos=" + this.sizeDisplayStart);
// LOGGER.debug(" 2 Stop pos=" + this.sizeDisplayStop);
// set back the display system
this.needDisplay = true;
return new Vector3f(this.sizeDisplayStop.x() - this.sizeDisplayStart.x(), this.sizeDisplayStop.y() - this.sizeDisplayStart.y(), this.sizeDisplayStop.z() - this.sizeDisplayStart.z());
return new Vector3f(this.sizeDisplayStop.x() - this.sizeDisplayStart.x(),
this.sizeDisplayStop.y() - this.sizeDisplayStart.y(),
this.sizeDisplayStop.z() - this.sizeDisplayStart.z());
}
/**
@ -230,7 +234,12 @@ public abstract class TextBase extends Compositing {
* @return true if the right has free space that can be use for justify.
* false if we find '\n'
*/
public boolean extrapolateLastId(final String text, final int start, final Dynamic<Integer> stop, final Dynamic<Integer> space, final Dynamic<Integer> freeSpace) {
public boolean extrapolateLastId(
final String text,
final int start,
final Dynamic<Integer> stop,
final Dynamic<Integer> space,
final Dynamic<Integer> freeSpace) {
// store previous :
final Character storePrevious = this.previousCharcode;
@ -341,8 +350,9 @@ public abstract class TextBase extends Compositing {
* @param data The cuurent data to add.
*/
public void htmlAddData(final String data) {
//Log.error("Add data '{}' @pos=", data, this.position);
if (this.htmlCurrentLine.length() > 0 && this.htmlCurrentLine.charAt(this.htmlCurrentLine.length() - 1) != (char) Character.SPACE_SEPARATOR) {
//LOGGER.error("Add data '{}' @pos=", data, this.position);
if (this.htmlCurrentLine.length() > 0
&& this.htmlCurrentLine.charAt(this.htmlCurrentLine.length() - 1) != (char) Character.SPACE_SEPARATOR) {
this.htmlCurrentLine += (char) Character.SPACE_SEPARATOR;
if (this.htmlDecoration.size() > 0) {
final TextDecoration tmp = this.htmlDecoration.get(this.htmlDecoration.size() - 1);
@ -382,7 +392,7 @@ public abstract class TextBase extends Compositing {
this.oGLtextWidth = this.oGLprogram.getUniform("in_texWidth");
this.oGLtextHeight = this.oGLprogram.getUniform("in_texHeight");
} else {
Log.error("Can not load the program => create previous one...");
LOGGER.error("Can not load the program => create previous one...");
this.oGLprogram = old;
old = null;
}
@ -401,21 +411,21 @@ public abstract class TextBase extends Compositing {
}
if (it.isText()) {
htmlAddData(it.getValue());
Log.verbose("XML add : " + it.getValue());
LOGGER.trace("XML add : " + it.getValue());
continue;
}
if (!it.isElement()) {
Log.error("node not suported type : " + it.getType() + " val='" + it.getValue() + "'");
LOGGER.error("node not suported type : " + it.getType() + " val='" + it.getValue() + "'");
continue;
}
final XmlElement elem = (XmlElement) it;
final String lowercaseValue = elem.getValue().toLowerCase();
if (lowercaseValue.contentEquals("br")) {
htmlFlush();
Log.verbose("XML flush newLine");
LOGGER.trace("XML flush newLine");
forceLineReturn();
} else if (lowercaseValue.contentEquals("font")) {
Log.verbose("XML Font ...");
LOGGER.trace("XML Font ...");
final TextDecoration tmpDeco = this.htmlDecoTmp;
if (elem.existAttribute("color")) {
try {
@ -424,10 +434,10 @@ public abstract class TextBase extends Compositing {
this.htmlDecoTmp = this.htmlDecoTmp.withFG(Color.valueOf(colorValue));
}
} catch (final ExmlAttributeDoesNotExist e) {
Log.error("Can not get attribute 'color' in XML:" + e.getMessage());
LOGGER.error("Can not get attribute 'color' in XML:" + e.getMessage());
e.printStackTrace();
} catch (final Exception e) {
Log.error("Can not parse attribute 'color' in XML:" + e.getMessage());
LOGGER.error("Can not parse attribute 'color' in XML:" + e.getMessage());
e.printStackTrace();
}
}
@ -438,17 +448,17 @@ public abstract class TextBase extends Compositing {
this.htmlDecoTmp = this.htmlDecoTmp.withBG(Color.valueOf(colorValue));
}
} catch (final ExmlAttributeDoesNotExist e) {
Log.error("Can not get attribute 'colorBg' in XML:" + e.getMessage());
LOGGER.error("Can not get attribute 'colorBg' in XML:" + e.getMessage());
e.printStackTrace();
} catch (final Exception e) {
Log.error("Can not parse attribute 'colorBg' in XML:" + e.getMessage());
LOGGER.error("Can not parse attribute 'colorBg' in XML:" + e.getMessage());
e.printStackTrace();
}
}
parseHtmlNode(elem);
this.htmlDecoTmp = tmpDeco;
} else if (lowercaseValue.contentEquals("b") || lowercaseValue.contentEquals("bold")) {
Log.verbose("XML bold ...");
LOGGER.trace("XML bold ...");
final TextDecoration tmpDeco = this.htmlDecoTmp;
if (this.htmlDecoTmp.mode() == FontMode.REGULAR) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.BOLD);
@ -458,7 +468,7 @@ public abstract class TextBase extends Compositing {
parseHtmlNode(elem);
this.htmlDecoTmp = tmpDeco;
} else if (lowercaseValue.contentEquals("i") || lowercaseValue.contentEquals("italic")) {
Log.verbose("XML italic ...");
LOGGER.trace("XML italic ...");
final TextDecoration tmpDeco = this.htmlDecoTmp;
if (this.htmlDecoTmp.mode() == FontMode.REGULAR) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.ITALIC);
@ -468,40 +478,40 @@ public abstract class TextBase extends Compositing {
parseHtmlNode(elem);
this.htmlDecoTmp = tmpDeco;
} else if (lowercaseValue.contentEquals("u") || lowercaseValue.contentEquals("underline")) {
Log.verbose("XML underline ...");
LOGGER.trace("XML underline ...");
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("p") || lowercaseValue.contentEquals("paragraph")) {
Log.verbose("XML paragraph ...");
LOGGER.trace("XML paragraph ...");
htmlFlush();
this.alignment = AlignMode.LEFT;
forceLineReturn();
parseHtmlNode(elem);
forceLineReturn();
} else if (lowercaseValue.contentEquals("center")) {
Log.verbose("XML center ...");
LOGGER.trace("XML center ...");
htmlFlush();
this.alignment = AlignMode.CENTER;
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("left")) {
Log.verbose("XML left ...");
LOGGER.trace("XML left ...");
htmlFlush();
this.alignment = AlignMode.LEFT;
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("right")) {
Log.verbose("XML right ...");
LOGGER.trace("XML right ...");
htmlFlush();
this.alignment = AlignMode.RIGHT;
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("justify")) {
Log.verbose("XML justify ...");
LOGGER.trace("XML justify ...");
htmlFlush();
this.alignment = AlignMode.JUSTIFY;
parseHtmlNode(elem);
} else {
Log.error("node not suported type: " + elem.getType() + " val='" + elem.getValue() + "'");
LOGGER.error("node not suported type: " + elem.getType() + " val='" + elem.getValue() + "'");
}
//Log.error("Add data elems... @pos=", this.position);
//LOGGER.error("Add data elems... @pos=", this.position);
}
}
@ -525,7 +535,7 @@ public abstract class TextBase extends Compositing {
Color tmpFg = this.color;
Color tmpBg = this.colorBg;
if (this.alignment == AlignMode.DISABLE) {
// Log.debug(" 1 print in not aligned mode : start=" + this.sizeDisplayStart + " stop=" + this.sizeDisplayStop + " pos=" + this.position);
// LOGGER.debug(" 1 print in not aligned mode : start=" + this.sizeDisplayStart + " stop=" + this.sizeDisplayStop + " pos=" + this.position);
// display the cursor if needed (if it is at the start position...)
if (this.needDisplay) {
if (0 == this.cursorPos) {
@ -544,7 +554,8 @@ public abstract class TextBase extends Compositing {
}
// if real display : ( not display is for size calculation)
if (this.needDisplay) {
if ((this.selectionStartPos - 1 < (long) iii && (long) iii <= this.cursorPos - 1) || (this.selectionStartPos - 1 >= (long) iii && (long) iii > this.cursorPos - 1)) {
if ((this.selectionStartPos - 1 < (long) iii && (long) iii <= this.cursorPos - 1)
|| (this.selectionStartPos - 1 >= (long) iii && (long) iii > this.cursorPos - 1)) {
setColor(Color.BLACK);
setColorBg(this.colorSelection);
} else {
@ -572,10 +583,10 @@ public abstract class TextBase extends Compositing {
}
}
}
// Log.debug(" 2 print in not aligned mode : start=" + this.sizeDisplayStart +
// LOGGER.debug(" 2 print in not aligned mode : start=" + this.sizeDisplayStart +
// " stop=" + this.sizeDisplayStop + " pos=" + this.position);
} else {
// Log.debug(" 3 print in not aligned mode : start=" + this.sizeDisplayStart +
// LOGGER.debug(" 3 print in not aligned mode : start=" + this.sizeDisplayStart +
// " stop=" + this.sizeDisplayStop + " pos=" + this.position);
// special start case at the right of the endpoint :
if (this.stopTextPos < this.position.x()) {
@ -602,13 +613,15 @@ public abstract class TextBase extends Compositing {
case RIGHT:
if (this.needDisplay) {
// Move the first char at the right :
setPos(new Vector3f(this.position.x() + freeSpace.value, this.position.y(), this.position.z()));
setPos(new Vector3f(this.position.x() + freeSpace.value, this.position.y(),
this.position.z()));
}
break;
case CENTER:
if (this.needDisplay) {
// Move the first char at the right :
setPos(new Vector3f(this.position.x() + freeSpace.value / 2, this.position.y(), this.position.z()));
setPos(new Vector3f(this.position.x() + freeSpace.value / 2, this.position.y(),
this.position.z()));
}
break;
default:
@ -629,7 +642,8 @@ public abstract class TextBase extends Compositing {
setFontMode(decoration.get(iii).mode());
}
if (this.needDisplay) {
if ((this.selectionStartPos - 1 < (long) iii && (long) iii <= this.cursorPos - 1) || (this.selectionStartPos - 1 >= (long) iii && (long) iii > this.cursorPos - 1)) {
if ((this.selectionStartPos - 1 < (long) iii && (long) iii <= this.cursorPos - 1)
|| (this.selectionStartPos - 1 >= (long) iii && (long) iii > this.cursorPos - 1)) {
setColor(Color.BLACK);
setColorBg(this.colorSelection);
} else {
@ -639,7 +653,7 @@ public abstract class TextBase extends Compositing {
}
// special for the justify mode
if (text.charAt(iii) == (char) Character.SPACE_SEPARATOR) {
// Log.debug(" generateString : \" \"");
// LOGGER.debug(" generateString : \" \"");
if (this.needDisplay && this.colorBg.a() != 0) {
this.vectorialDraw.setPos(this.position);
}
@ -648,7 +662,7 @@ public abstract class TextBase extends Compositing {
if (this.needDisplay && this.colorBg.a() != 0) {
this.vectorialDraw.rectangleWidth(new Vector3f(interpolation, fontHeigh, 0.0f));
}
} else // Log.debug(" generateString : \"" + (char)text[iii] + "\"");
} else // LOGGER.debug(" generateString : \"" + (char)text[iii] + "\"");
if (this.needDisplay && this.colorBg.a() != 0) {
final Vector3f pos = this.position;
this.vectorialDraw.setPos(pos);
@ -687,7 +701,8 @@ public abstract class TextBase extends Compositing {
currentId = stop.value;
}
}
Log.debug(" 4 print in not alligned mode : start=" + this.sizeDisplayStart + " stop=" + this.sizeDisplayStop + " pos=" + this.position);
LOGGER.debug(" 4 print in not alligned mode : start=" + this.sizeDisplayStart + " stop="
+ this.sizeDisplayStop + " pos=" + this.position);
}
}
@ -749,7 +764,7 @@ public abstract class TextBase extends Compositing {
final StringBuilder tmpData = new StringBuilder("<html>\n<body>\n");
tmpData.append(text);
tmpData.append("\n</body>\n</html>\n");
// Log.debug("plop : " + tmpData);
// LOGGER.debug("plop : " + tmpData);
printHTML(tmpData.toString());
}
@ -787,30 +802,30 @@ public abstract class TextBase extends Compositing {
try {
final XmlElement doc = Exml.parse(text);
if (!doc.existNode("html")) {
Log.error("can not load XML: main node not find: 'html'");
LOGGER.error("can not load XML: main node not find: 'html'");
Exml.display(doc);
return;
}
final XmlElement root = (XmlElement) doc.getNode("html");
if (!root.existNode("body")) {
Log.error("can not load XML: main node not find: 'body'");
LOGGER.error("can not load XML: main node not find: 'body'");
return;
}
final XmlElement bodyNode = (XmlElement) root.getNode("body");
parseHtmlNode(bodyNode);
htmlFlush();
} catch (final ExmlParserErrorMulti e) {
Log.error("Can not parse XML data in printHTML:" + e.getMessage());
LOGGER.error("Can not parse XML data in printHTML:" + e.getMessage());
e.printStackTrace();
} catch (final ExmlBuilderException e) {
Log.error("Can not generate XML data in printHTML:" + e.getMessage());
LOGGER.error("Can not generate XML data in printHTML:" + e.getMessage());
e.printStackTrace();
} catch (final ExmlException e) {
Log.error("Error in finding node from XML data in printHTML:" + e.getMessage());
LOGGER.error("Error in finding node from XML data in printHTML:" + e.getMessage());
e.printStackTrace();
} catch (final AknotException e) {
Log.error("Error in parsing pojo data in printHTML:" + e.getMessage());
LOGGER.error("Error in parsing pojo data in printHTML:" + e.getMessage());
e.printStackTrace();
}
}
@ -1048,7 +1063,7 @@ public abstract class TextBase extends Compositing {
public void setPos(final Vector3f pos) {
// check min max for display area
if (this.nbCharDisplayed != 0) {
//Log.verbose("update size 1 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
//LOGGER.trace("update size 1 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop);
this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart);
}
@ -1060,12 +1075,12 @@ public abstract class TextBase extends Compositing {
if (this.nbCharDisplayed == 0) {
this.sizeDisplayStart = this.position;
this.sizeDisplayStop = this.position.withY(this.sizeDisplayStop.y() + getHeight());
//Log.verbose("update size 0 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
//LOGGER.trace("update size 0 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
} else {
//Log.verbose("update size 3 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
//LOGGER.trace("update size 3 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop);
this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart);
//Log.verbose("update size 4 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
//LOGGER.trace("update size 4 " + this.sizeDisplayStart + " " + this.sizeDisplayStop);
}
}
@ -1109,7 +1124,7 @@ public abstract class TextBase extends Compositing {
this.alignment = alignement;
if (this.startTextPos >= this.stopTextPos) {
// TODO understand why this flush ...
Log.verbose("Request alignment with Borne position error : " + startTextPos + " => " + stopTextPos);
LOGGER.trace("Request alignment with Borne position error : " + startTextPos + " => " + stopTextPos);
}
}

View File

@ -13,7 +13,6 @@ import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.event.EntrySystem;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.ObjectManager;
import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.ewol.widget.WidgetManager;
@ -28,9 +27,12 @@ import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
import org.atriasoft.gale.resource.ResourceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// Here we herited from the gale application to be agnostic of the OW where we work ...
public class EwolContext extends GaleApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(EwolContext.class);
/**
* From everywhere in the program, we can get the context inteface.
@ -59,7 +61,8 @@ public class EwolContext extends GaleApplication {
this.objectManager = new ObjectManager(this);
this.input = new InputManager(this);
if (this.application == null) {
Log.critical("Can not start context with no Application ==> rtfm ...");
LOGGER.error("Can not start context with no Application ==> rtfm ...");
System.exit(-1);
}
}
@ -67,7 +70,7 @@ public class EwolContext extends GaleApplication {
* Redraw all the windows
*/
public void forceRedrawAll() {
Log.warning("force redraw on windows:" + this.windowsCurrent);
LOGGER.warn("force redraw on windows:" + this.windowsCurrent);
if (this.windowsCurrent == null) {
return;
}
@ -78,7 +81,7 @@ public class EwolContext extends GaleApplication {
}
public void forceRedrawAllAsync() {
Log.verbose("force redraw ALL (ASYNC):");
LOGGER.trace("force redraw ALL (ASYNC):");
GaleContext.getContext().requestUpdateSize();
}
@ -146,18 +149,18 @@ public class EwolContext extends GaleApplication {
@Override
public void onCreate(final GaleContext context) {
Log.info(" == > Ewol system create (BEGIN)");
LOGGER.info(" == > Ewol system create (BEGIN)");
// Add basic ewol translation:
ETranslate.addPath("ewol", new Uri("TRANSLATE", "", "ewol"));
ETranslate.autoDetectLanguage();
// parse for help:
for (int iii = 0; iii < context.getCmd().size(); ++iii) {
if (context.getCmd().get(iii).equals("-h") || context.getCmd().get(iii).equals("--help")) {
Log.print("ewol - help : ");
Log.print(" xxxxxxxxxxxxx [options]");
Log.print(" -h/--help: Display this help");
Log.print(" example:");
Log.print(" xxxxxxxxxxxxx --help");
LOGGER.info("ewol - help : ");
LOGGER.info(" xxxxxxxxxxxxx [options]");
LOGGER.info(" -h/--help: Display this help");
LOGGER.info(" example:");
LOGGER.info(" xxxxxxxxxxxxx --help");
// this is a global help system does not remove it
continue;
}
@ -165,7 +168,7 @@ public class EwolContext extends GaleApplication {
//--iii;
}
// Log.info("EWOL v:" + ewol::getVersion());
// LOGGER.info("EWOL v:" + ewol::getVersion());
// force a recalculation
/*
* requestUpdateSize(){ Context context = gale::getContext();
@ -178,16 +181,16 @@ public class EwolContext extends GaleApplication {
*/
final EwolApplication appl = this.application;
if (appl == null) {
Log.error(" == > Create without application");
LOGGER.error(" == > Create without application");
return;
}
appl.onCreate(this);
Log.info(" == > Ewol system create (END)");
LOGGER.info(" == > Ewol system create (END)");
}
@Override
public void onDestroy(final GaleContext context) {
Log.info(" == > Ewol system destroy (BEGIN)");
LOGGER.info(" == > Ewol system destroy (BEGIN)");
// Remove current windows
this.windowsCurrent = null;
// clean all widget and sub widget with their resources:
@ -200,16 +203,16 @@ public class EwolContext extends GaleApplication {
}
// internal clean elements
this.objectManager.cleanInternalRemoved();
Log.info("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
LOGGER.info("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
this.objectManager.displayListObject();
// now All must be removed !!!
this.objectManager.unInit();
Log.info(" == > Ewol system destroy (END)");
LOGGER.info(" == > Ewol system destroy (END)");
}
@Override
public void onDraw(final GaleContext context) {
//Log.verbose("EWOL DRAW");
//LOGGER.trace("EWOL DRAW");
// clean internal data...
this.objectManager.cleanInternalRemoved();
// real draw...
@ -221,8 +224,12 @@ public class EwolContext extends GaleApplication {
}
@Override
public void onKeyboard(final KeySpecial special, final KeyKeyboard type, final Character value, final KeyStatus state) {
Log.verbose("event {" + special + "} " + type + " '" + value + "' " + state);
public void onKeyboard(
final KeySpecial special,
final KeyKeyboard type,
final Character value,
final KeyStatus state) {
LOGGER.trace("event {" + special + "} " + type + " '" + value + "' " + state);
// store the keyboard special key status for mouse event...
this.input.setLastKeyboardSpecial(special);
if (this.windowsCurrent == null) {
@ -242,7 +249,7 @@ public class EwolContext extends GaleApplication {
return;
}
// check if the widget allow repeating key events.
// Log.info("repeating test :" + repeate + " widget=" +
// LOGGER.info("repeating test :" + repeate + " widget=" +
// tmpWidget.getKeyboardRepeate() + " state=" + isDown);
if (!repeate || (repeate && tmpWidget.getKeyboardRepeat())) {
// check Widget shortcut
@ -266,32 +273,32 @@ public class EwolContext extends GaleApplication {
tmpWidget.systemEventEntry(tmpEntryEvent);
}
} else {
Log.debug("remove Repeate key ...");
LOGGER.debug("remove Repeate key ...");
}
}
}
@Override
public void onKillDemand(final GaleContext context) {
Log.info(" == > User demand a destroy (BEGIN)");
LOGGER.info(" == > User demand a destroy (BEGIN)");
final EwolApplication appl = this.application;
if (appl == null) {
exit(0);
return;
}
appl.onKillDemand(this);
Log.info(" == > User demand a destroy (END)");
LOGGER.info(" == > User demand a destroy (END)");
}
@Override
public void onPause(final GaleContext context) {
Log.info(" == > Ewol system pause (BEGIN)");
LOGGER.info(" == > Ewol system pause (BEGIN)");
final EwolApplication appl = this.application;
if (appl == null) {
return;
}
appl.onPause(this);
Log.info(" == > Ewol system pause (END)");
LOGGER.info(" == > Ewol system pause (END)");
}
@Override
@ -300,35 +307,40 @@ public class EwolContext extends GaleApplication {
}
@Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) {
public void onPointer(
final KeySpecial special,
final KeyType type,
final int pointerID,
final Vector2f pos,
final KeyStatus state) {
this.input.setLastKeyboardSpecial(special);
switch (state) {
case move:
// Log.debug("Receive MSG : THREAD_INPUT_MOTION");
// LOGGER.debug("Receive MSG : THREAD_INPUT_MOTION");
this.input.motion(type, pointerID, pos);
break;
case down:
case downRepeat:
// Log.debug("Receive MSG : THREAD_INPUT_STATE");
// LOGGER.debug("Receive MSG : THREAD_INPUT_STATE");
this.input.state(type, pointerID, true, pos);
break;
case up:
// Log.debug("Receive MSG : THREAD_INPUT_STATE");
// LOGGER.debug("Receive MSG : THREAD_INPUT_STATE");
this.input.state(type, pointerID, false, pos);
break;
default:
Log.debug("Unknow state : " + state);
LOGGER.debug("Unknow state : " + state);
break;
}
}
@Override
public void onRegenerateDisplay(final GaleContext context) {
//Log.info("EWOL onRegenerateDisplay /// ");
//LOGGER.info("EWOL onRegenerateDisplay /// ");
// check if the user selected a windows
final Windows window = this.windowsCurrent;
if (window == null) {
Log.error("No windows ...");
LOGGER.error("No windows ...");
return;
}
// Redraw all needed elements
@ -346,42 +358,42 @@ public class EwolContext extends GaleApplication {
}
public void onResize(final Vector2i size) {
Log.verbose("Resize: " + size);
LOGGER.trace("Resize: " + size);
forceRedrawAll();
}
@Override
public void onResume(final GaleContext context) {
Log.info(" == > Ewol system resume (BEGIN)");
LOGGER.info(" == > Ewol system resume (BEGIN)");
final EwolApplication appl = this.application;
if (appl == null) {
return;
}
appl.onResume(this);
Log.info(" == > Ewol system resume (END)");
LOGGER.info(" == > Ewol system resume (END)");
}
@Override
public void onStart(final GaleContext context) {
Log.info(" == > Ewol system start (BEGIN)");
LOGGER.info(" == > Ewol system start (BEGIN)");
final EwolApplication appl = this.application;
if (appl == null) {
// TODO : Request exit of the application .... with error ...
return;
}
appl.onStart(this);
Log.info(" == > Ewol system start (END)");
LOGGER.info(" == > Ewol system start (END)");
}
@Override
public void onStop(final GaleContext context) {
Log.info(" == > Ewol system stop (BEGIN)");
LOGGER.info(" == > Ewol system stop (BEGIN)");
final EwolApplication appl = this.application;
if (appl == null) {
return;
}
appl.onStop(this);
Log.info(" == > Ewol system stop (END)");
LOGGER.info(" == > Ewol system stop (END)");
}
/**
@ -412,7 +424,7 @@ public class EwolContext extends GaleApplication {
* @param windows Windows that might be displayed
*/
public void setWindows(final Windows windows) {
Log.info("set New windows");
LOGGER.info("set New windows");
// remove current focus :
this.widgetManager.focusSetDefault(null);
this.widgetManager.focusRelease();

View File

@ -11,12 +11,13 @@ import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.event.InputSystem;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.ewol.widget.Windows;
import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* internal structure
@ -27,6 +28,7 @@ class InputLimit {
}
class InputManager {
private static final Logger LOGGER = LoggerFactory.getLogger(InputManager.class);
private static final long MILLI_TO_DURATION = 1000000;
private static final long SECONDS_TO_DURATION = 1000000000;
private static final int MAX_MANAGE_INPUT = 15;
@ -45,14 +47,14 @@ class InputManager {
this.context = context;
setDpi(200);
Log.info("Init (start)");
LOGGER.info("Init (start)");
for (int iii = 0; iii < InputManager.MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
this.eventInputSaved[iii] = new InputPoperty();
this.eventMouseSaved[iii] = new InputPoperty();
}
Log.info("Init (end)");
LOGGER.info("Init (end)");
}
public void abortElement(final InputPoperty[] eventTable, final int idInput, final KeyType type) {
@ -60,7 +62,8 @@ class InputManager {
return;
}
if (eventTable[idInput].isUsed) {
localEventInput(type, eventTable[idInput].curentWidgetEvent.get(), eventTable[idInput].destinationInputId, KeyStatus.abort, eventTable[idInput].posEvent);
localEventInput(type, eventTable[idInput].curentWidgetEvent.get(), eventTable[idInput].destinationInputId,
KeyStatus.abort, eventTable[idInput].posEvent);
}
}
@ -75,7 +78,7 @@ class InputManager {
if (eventMouseSaved2 == null) {
return;
}
//Log.info("CleanElement[" + idInput + "] = @" + (long)eventTable);
//LOGGER.info("CleanElement[" + idInput + "] = @" + (long)eventTable);
eventMouseSaved2[idInput].clear();
}
@ -104,12 +107,18 @@ class InputManager {
* @param pos position of the event
* @return true if event has been greped
*/
public boolean localEventInput(final KeyType type, final Widget destWidget, final int idInput, final KeyStatus status, final Vector2f pos) {
public boolean localEventInput(
final KeyType type,
final Widget destWidget,
final int idInput,
final KeyStatus status,
final Vector2f pos) {
if (destWidget != null) {
if (type == KeyType.mouse || type == KeyType.finger) {
// create the system Event :
// TODO : set the real ID ...
final InputSystem tmpEventSystem = new InputSystem(type, status, idInput, pos, destWidget, 0, this.specialKey);
final InputSystem tmpEventSystem = new InputSystem(type, status, idInput, pos, destWidget, 0,
this.specialKey);
// generate the event :
return destWidget.systemEventInput(tmpEventSystem);
}
@ -147,7 +156,7 @@ class InputManager {
// note if id<0 == > the it was finger event ...
public void motion(final KeyType type, final int pointerID, final Vector2f pos) {
//Log.debug("motion event : " + type + " " + pointerID + " " + pos);
//LOGGER.debug("motion event : " + type + " " + pointerID + " " + pos);
if (InputManager.MAX_MANAGE_INPUT <= pointerID) {
// reject pointer == > out of IDs...
return;
@ -158,7 +167,7 @@ class InputManager {
} else if (type == KeyType.finger) {
eventTable = this.eventInputSaved;
} else {
Log.error("Unknown type of event");
LOGGER.error("Unknown type of event");
return;
}
if (pointerID > InputManager.MAX_MANAGE_INPUT || pointerID < 0) {
@ -177,13 +186,17 @@ class InputManager {
} else if (tmpWindows != null) {
tmpWidget = tmpWindows.getWidgetAtPos(new Vector3f(pos.x(), pos.y(), 0));
}
if (eventTable[pointerID].curentWidgetEvent != null && tmpWidget != eventTable[pointerID].curentWidgetEvent.get()
|| (eventTable[pointerID].isInside && (eventTable[pointerID].origin.x() > pos.x() || eventTable[pointerID].origin.y() > pos.y()
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x() || (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()))) {
if (eventTable[pointerID].curentWidgetEvent != null
&& tmpWidget != eventTable[pointerID].curentWidgetEvent.get()
|| (eventTable[pointerID].isInside && (eventTable[pointerID].origin.x() > pos.x()
|| eventTable[pointerID].origin.y() > pos.y()
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()))) {
eventTable[pointerID].isInside = false;
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [LEAVE] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [LEAVE] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(), eventTable[pointerID].destinationInputId, KeyStatus.leave, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(),
eventTable[pointerID].destinationInputId, KeyStatus.leave, pos);
}
if (!eventTable[pointerID].isInside) {
// set the element inside ...
@ -197,32 +210,38 @@ class InputManager {
eventTable[pointerID].size = tmpWidget.getSize();
}
eventTable[pointerID].destinationInputId = 0;
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [ENTER] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [ENTER] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, tmpWidget, eventTable[pointerID].destinationInputId, KeyStatus.enter, pos);
}
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [MOVE] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [MOVE] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, tmpWidget, eventTable[pointerID].destinationInputId, KeyStatus.move, pos);
} else if (eventTable[pointerID].isUsed) {
if (eventTable[pointerID].isInside) {
if (eventTable[pointerID].origin.x() > pos.x() || eventTable[pointerID].origin.y() > pos.y() || (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
if (eventTable[pointerID].origin.x() > pos.x() || eventTable[pointerID].origin.y() > pos.y()
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) {
eventTable[pointerID].isInside = false;
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [LEAVE] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [LEAVE] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(), eventTable[pointerID].destinationInputId, KeyStatus.leave, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(),
eventTable[pointerID].destinationInputId, KeyStatus.leave, pos);
}
} else if ((eventTable[pointerID].origin.x() <= pos.x() && (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) >= pos.x())
&& (eventTable[pointerID].origin.y() <= pos.y() && (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) >= pos.y())) {
} else if ((eventTable[pointerID].origin.x() <= pos.x()
&& (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) >= pos.x())
&& (eventTable[pointerID].origin.y() <= pos.y()
&& (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) >= pos.y())) {
eventTable[pointerID].isInside = true;
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [ENTER] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [ENTER] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(), eventTable[pointerID].destinationInputId, KeyStatus.enter, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(),
eventTable[pointerID].destinationInputId, KeyStatus.enter, pos);
}
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [MOVE] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [MOVE] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(), eventTable[pointerID].destinationInputId, KeyStatus.move, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(),
eventTable[pointerID].destinationInputId, KeyStatus.move, pos);
}
}
@ -254,7 +273,7 @@ class InputManager {
// reject pointer == > out of IDs...
return;
}
//Log.debug("event pointerId=" + pointerID);
//LOGGER.debug("event pointerId=" + pointerID);
// convert position in open-GL coordonates ...
InputPoperty[] eventTable = null;
InputLimit localLimit;
@ -265,7 +284,7 @@ class InputManager {
eventTable = this.eventInputSaved;
localLimit = this.eventInputLimit;
} else {
Log.error("Unknown type of event");
LOGGER.error("Unknown type of event");
return;
}
if (pointerID > InputManager.MAX_MANAGE_INPUT || pointerID <= 0) {
@ -277,12 +296,13 @@ class InputManager {
final Windows tmpWindows = this.context.getWindows();
if (isDown) {
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [DOWN] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [DOWN] " + pos);
if (eventTable[pointerID].isUsed) {
// we have an event previously ... check delay between click and offset position
if (currentTime - eventTable[pointerID].lastTimeEvent > localLimit.sepatateTime) {
cleanElement(eventTable, pointerID);
} else if (FMath.abs(eventTable[pointerID].downStart.x() - pos.x()) >= localLimit.dpiOffset || FMath.abs(eventTable[pointerID].downStart.y() - pos.y()) >= localLimit.dpiOffset) {
} else if (FMath.abs(eventTable[pointerID].downStart.x() - pos.x()) >= localLimit.dpiOffset
|| FMath.abs(eventTable[pointerID].downStart.y() - pos.y()) >= localLimit.dpiOffset) {
cleanElement(eventTable, pointerID);
}
}
@ -290,9 +310,10 @@ class InputManager {
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
// generate DOWN Event
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [DOWN] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [DOWN] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(), eventTable[pointerID].destinationInputId, KeyStatus.down, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent.get(),
eventTable[pointerID].destinationInputId, KeyStatus.down, pos);
} else {
// Mark it used :
eventTable[pointerID].isUsed = true;
@ -312,9 +333,9 @@ class InputManager {
eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
/*
if (tmpWidget != null) {
Log.debug("Get widget at pos=" + pos + " type: " + tmpWidget.getObjectType());
LOGGER.debug("Get widget at pos=" + pos + " type: " + tmpWidget.getObjectType());
} else {
Log.debug("Get widget at pos=" + pos + " NO WIDGET");
LOGGER.debug("Get widget at pos=" + pos + " NO WIDGET");
}
*/
}
@ -330,35 +351,36 @@ class InputManager {
eventTable[pointerID].destinationInputId = -1;
}
// generate DOWN Event
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [DOWN] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [DOWN] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, tmpWidget, eventTable[pointerID].destinationInputId, KeyStatus.down, pos);
}
} else {
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [UP] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [UP] " + pos);
final Widget tmpWidget = eventTable[pointerID].curentWidgetEvent.get();
if (!eventTable[pointerID].isUsed) {
// bad case ... ???
Log.debug("Up event without previous down ... ");
LOGGER.debug("Up event without previous down ... ");
// Mark it un-used :
eventTable[pointerID].isUsed = false;
// revove the widget ...
eventTable[pointerID].curentWidgetEvent = null;
} else if (tmpWidget == null) {
// The widget has been removed:
//Log.debug(" Object Removed ...");
//LOGGER.debug(" Object Removed ...");
// Mark it un-used :
eventTable[pointerID].isUsed = false;
// revove the widget ...
eventTable[pointerID].curentWidgetEvent = null;
} else {
// generate UP Event
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [UP] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [UP] " + pos);
eventTable[pointerID].posEvent = pos;
// send up event after the single event to prevent multiple widget getting elements
localEventInput(type, tmpWidget, pointerID, KeyStatus.up, pos);
// generate event (single)
if (FMath.abs(eventTable[pointerID].downStart.x() - pos.x()) < localLimit.dpiOffset && FMath.abs(eventTable[pointerID].downStart.y() - pos.y()) < localLimit.dpiOffset) {
if (FMath.abs(eventTable[pointerID].downStart.x() - pos.x()) < localLimit.dpiOffset
&& FMath.abs(eventTable[pointerID].downStart.y() - pos.y()) < localLimit.dpiOffset) {
// Save current position :
eventTable[pointerID].downStart = pos;
// save start time
@ -369,12 +391,14 @@ class InputManager {
nbClickMax = 5;
}
// in grab mode the single to quinte event are not generated ....
if ((this.grabWidget == null || this.grabWidget.get() == null || type != KeyType.mouse) && eventTable[pointerID].nbClickEvent < nbClickMax) {
if ((this.grabWidget == null || this.grabWidget.get() == null || type != KeyType.mouse)
&& eventTable[pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE :
eventTable[pointerID].nbClickEvent++;
//Log.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [" + eventTable[pointerID].nbClickEvent + "] " + pos);
//LOGGER.debug("GUI : Input ID=" + pointerID + " == >" + eventTable[pointerID].destinationInputId + " [" + eventTable[pointerID].nbClickEvent + "] " + pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, tmpWidget, eventTable[pointerID].destinationInputId, KeyStatus.pressCount(eventTable[pointerID].nbClickEvent), pos);
localEventInput(type, tmpWidget, eventTable[pointerID].destinationInputId,
KeyStatus.pressCount(eventTable[pointerID].nbClickEvent), pos);
if (eventTable[pointerID].nbClickEvent >= nbClickMax) {
eventTable[pointerID].nbClickEvent = 0;
}
@ -406,24 +430,28 @@ class InputManager {
Widget tmpWidget = this.eventInputSaved[iii].curentWidgetEvent.get();
if (tmpWidget == source) {
// inform the widget that it does not receive the event now
//Log.debug("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENTINPUTTYPEABORT] " + this.eventInputSaved[iii].posEvent);
localEventInput(KeyType.finger, tmpWidget, this.eventInputSaved[iii].destinationInputId, KeyStatus.abort, this.eventInputSaved[iii].posEvent);
//LOGGER.debug("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENTINPUTTYPEABORT] " + this.eventInputSaved[iii].posEvent);
localEventInput(KeyType.finger, tmpWidget, this.eventInputSaved[iii].destinationInputId,
KeyStatus.abort, this.eventInputSaved[iii].posEvent);
// set the new widget ...
this.eventInputSaved[iii].curentWidgetEvent = new WeakReference<>(destination);
// inform the widget that he receive the event property now...
//Log.debug("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENTINPUTTYPETRANSFERT] " + this.eventInputSaved[iii].posEvent);
localEventInput(KeyType.finger, destination, this.eventInputSaved[iii].destinationInputId, KeyStatus.transfer, this.eventInputSaved[iii].posEvent);
//LOGGER.debug("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENTINPUTTYPETRANSFERT] " + this.eventInputSaved[iii].posEvent);
localEventInput(KeyType.finger, destination, this.eventInputSaved[iii].destinationInputId,
KeyStatus.transfer, this.eventInputSaved[iii].posEvent);
}
tmpWidget = this.eventMouseSaved[iii].curentWidgetEvent.get();
if (tmpWidget == source) {
// inform the widget that it does not receive the event now
//Log.debug("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENTINPUTTYPEABORT] " + this.eventMouseSaved[iii].posEvent);
localEventInput(KeyType.mouse, tmpWidget, this.eventMouseSaved[iii].destinationInputId, KeyStatus.abort, this.eventMouseSaved[iii].posEvent);
//LOGGER.debug("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENTINPUTTYPEABORT] " + this.eventMouseSaved[iii].posEvent);
localEventInput(KeyType.mouse, tmpWidget, this.eventMouseSaved[iii].destinationInputId, KeyStatus.abort,
this.eventMouseSaved[iii].posEvent);
// set the new widget ...
this.eventMouseSaved[iii].curentWidgetEvent = new WeakReference<>(destination);
// inform the widget that he receive the event property now...
//Log.debug("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENTINPUTTYPETRANSFERT] " + this.eventMouseSaved[iii].posEvent);
localEventInput(KeyType.mouse, destination, this.eventMouseSaved[iii].destinationInputId, KeyStatus.transfer, this.eventMouseSaved[iii].posEvent);
//LOGGER.debug("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENTINPUTTYPETRANSFERT] " + this.eventMouseSaved[iii].posEvent);
localEventInput(KeyType.mouse, destination, this.eventMouseSaved[iii].destinationInputId,
KeyStatus.transfer, this.eventMouseSaved[iii].posEvent);
}
}
}

View File

@ -14,14 +14,20 @@ import java.nio.file.Paths;
import java.util.Collections;
import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoadPackageStream {
private static final Logger LOGGER = LoggerFactory.getLogger(LoadPackageStream.class);
public static byte[] getAllData(final String resourceName) {
Log.verbose("Load resource: '/resources" + resourceName + "'");
LOGGER.trace("Load resource: '/resources" + resourceName + "'");
final InputStream out = LoadPackageStream.class.getResourceAsStream("/resources" + resourceName);
if (out == null) {
Log.error("Can not load resource: '" + resourceName + "'");
for (final Path elem : LoadPackageStream.getResources(LoadPackageStream.class.getResource("/resources")).toArray(Path[]::new)) {
Log.warning(" - '" + elem + "'");
LOGGER.error("Can not load resource: '" + resourceName + "'");
for (final Path elem : LoadPackageStream.getResources(LoadPackageStream.class.getResource("/resources"))
.toArray(Path[]::new)) {
LOGGER.warn(" - '" + elem + "'");
}
return null;
}
@ -68,12 +74,13 @@ public class LoadPackageStream {
}
public static InputStream getStream(final String resourceName) {
Log.verbose("Load resource: '/resources" + resourceName + "'");
LOGGER.trace("Load resource: '/resources" + resourceName + "'");
final InputStream out = LoadPackageStream.class.getResourceAsStream("/resources" + resourceName);
if (out == null) {
Log.error("Can not load resource: '" + resourceName + "'");
for (final Path elem : LoadPackageStream.getResources(LoadPackageStream.class.getResource("/resources")).toArray(Path[]::new)) {
Log.warning(" - '" + elem + "'");
LOGGER.error("Can not load resource: '" + resourceName + "'");
for (final Path elem : LoadPackageStream.getResources(LoadPackageStream.class.getResource("/resources"))
.toArray(Path[]::new)) {
LOGGER.warn(" - '" + elem + "'");
}
}
return out;

View File

@ -1,76 +0,0 @@
package org.atriasoft.ewol.internal;
import org.atriasoft.reggol.LogLevel;
import org.atriasoft.reggol.Logger;
public class Log {
private static final boolean FORCE_ALL = false;
private static final String LIB_NAME = "ewol";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
public static void critical(final Exception e, final String data) {
e.printStackTrace();
if (PRINT_CRITICAL || FORCE_ALL) {
Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
}
}
public static void critical(final String data, final Object... objects) {
if (PRINT_CRITICAL || FORCE_ALL) {
Logger.critical(LIB_NAME_DRAW, data, objects);
}
}
public static void debug(final String data, final Object... objects) {
if (PRINT_DEBUG || FORCE_ALL) {
Logger.debug(LIB_NAME_DRAW, data, objects);
}
}
public static void error(final String data, final Object... objects) {
if (PRINT_ERROR || FORCE_ALL) {
Logger.error(LIB_NAME_DRAW, data, objects);
}
}
public static void info(final String data, final Object... objects) {
if (PRINT_INFO || FORCE_ALL) {
Logger.info(LIB_NAME_DRAW, data, objects);
}
}
public static void print(final String data, final Object... objects) {
if (PRINT_PRINT || FORCE_ALL) {
Logger.print(LIB_NAME_DRAW, data, objects);
}
}
public static void todo(final String data, final Object... objects) {
if (PRINT_TODO || FORCE_ALL) {
Logger.todo(LIB_NAME_DRAW, data, objects);
}
}
public static void verbose(final String data, final Object... objects) {
if (PRINT_VERBOSE || FORCE_ALL) {
Logger.verbose(LIB_NAME_DRAW, data, objects);
}
}
public static void warning(final String data, final Object... objects) {
if (PRINT_WARNING || FORCE_ALL) {
Logger.warning(LIB_NAME_DRAW, data, objects);
}
}
private Log() {}
}

View File

@ -12,7 +12,8 @@ import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.ewol.Ewol;
import org.atriasoft.ewol.context.EwolContext;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** @file
* @author Edouard DUPIN
@ -29,6 +30,7 @@ import org.atriasoft.ewol.internal.Log;
@AknotDefaultAttribute
@AknotIgnoreUnknown
public class EwolObject {
private static final Logger LOGGER = LoggerFactory.getLogger(EwolObject.class);
private static Integer valUID = 0; //!< Static used for the unique ID definition
/**
@ -76,7 +78,7 @@ public class EwolObject {
synchronized (EwolObject.valUID) {
this.uniqueId = EwolObject.valUID++;
}
Log.debug("new Object : [" + this.uniqueId + "]");
LOGGER.debug("new Object : [" + this.uniqueId + "]");
EwolObject.getObjectManager().add(this);
}
@ -85,12 +87,12 @@ public class EwolObject {
* Auto-destroy the object
*/
protected void autoDestroy() {
Log.verbose("Destroy object: [" + getId() + "] type:" + this.getClass().getCanonicalName());
LOGGER.trace("Destroy object: [" + getId() + "] type:" + this.getClass().getCanonicalName());
if (this.parent != null) {
final EwolObject parent = this.parent.get();
// TODO : set a signal to do this ...
if (parent != null) {
Log.verbose("Destroy object: Call parrent");
LOGGER.trace("Destroy object: Call parrent");
parent.requestDestroyFromChild(this);
}
}
@ -144,7 +146,7 @@ public class EwolObject {
* @return the requested object or null
*/
public EwolObject getSubObjectNamed(final String objectName) {
Log.verbose("check if name : " + objectName + " ?= " + this.name);
LOGGER.trace("check if name : " + objectName + " ?= " + this.name);
if (objectName.equals(this.name)) {
return this;
}
@ -172,8 +174,10 @@ public class EwolObject {
* @param child Object of the child that want to remove itself
*/
protected void requestDestroyFromChild(final EwolObject child) {
Log.info("requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ...");
Log.critical("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)");
LOGGER.info(
"requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ...");
LOGGER.error("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)");
System.exit(-1);
}
public void setName(final String name) {

View File

@ -10,7 +10,8 @@ import java.util.List;
import org.atriasoft.esignal.Signal;
import org.atriasoft.ewol.context.EwolContext;
import org.atriasoft.ewol.event.EventTime;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** @file
* @author Edouard DUPIN
@ -19,6 +20,7 @@ import org.atriasoft.ewol.internal.Log;
*/
public class ObjectManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ObjectManager.class);
private final long applWakeUpTime; //!< Time of the application initialize
private final Clock applWakeUpClock; //!< Time of the application initialize
private EwolContext context = null;
@ -35,8 +37,8 @@ public class ObjectManager {
public ObjectManager(final EwolContext context) {
this.context = context;
//periodicCall(this, "periodic", "Call every time system render");
Log.debug(" == > init Object-Manager");
Log.todo("set this back ...");
LOGGER.debug(" == > init Object-Manager");
LOGGER.info("[TODO] set this back ...");
//this.periodicCall.setPeriodic(true);
// set the basic time properties :
this.applWakeUpTime = System.nanoTime();
@ -52,7 +54,7 @@ public class ObjectManager {
*/
public synchronized void add(final EwolObject object) {
if (object == null) {
Log.error("try to add an inexistant Object in manager");
LOGGER.error("try to add an inexistant Object in manager");
}
this.eObjectList.add(new WeakReference<>(object));
}
@ -62,7 +64,7 @@ public class ObjectManager {
*/
public synchronized void cleanInternalRemoved() {
final int nbObject = this.eObjectList.size();
//Log.verbose("Clean Object List (if needed) : " + this.eObjectList.size() + " elements");
//LOGGER.trace("Clean Object List (if needed) : " + this.eObjectList.size() + " elements");
final Iterator<WeakReference<EwolObject>> iterator = this.eObjectList.iterator();
while (iterator.hasNext()) {
final WeakReference<EwolObject> elem = iterator.next();
@ -71,7 +73,7 @@ public class ObjectManager {
}
}
if (this.eObjectList.size() != nbObject) {
Log.verbose(" remove " + (nbObject - this.eObjectList.size()) + " deprecated objects");
LOGGER.trace(" remove " + (nbObject - this.eObjectList.size()) + " deprecated objects");
}
}
@ -79,11 +81,12 @@ public class ObjectManager {
* Display all object Open.
*/
public synchronized void displayListObject() {
Log.info("List loaded object : ");
LOGGER.info("List loaded object : ");
for (final WeakReference<EwolObject> it : this.eObjectList) {
final EwolObject element = it.get();
if (element != null) {
Log.info(" [" + element.getId() + "] name='" + element.getName() + "' type=" + element.getClass().getCanonicalName());
LOGGER.info(" [" + element.getId() + "] name='" + element.getName() + "' type="
+ element.getClass().getCanonicalName());
}
}
}
@ -128,18 +131,19 @@ public class ObjectManager {
* @param localTime Current system Time.
*/
public synchronized void timeCall(final Clock clock, final long time) {
Log.verbose("Periodic main function : Call [START]");
LOGGER.trace("Periodic main function : Call [START]");
final long previousTime = this.lastPeriodicCallTime;
this.lastPeriodicCallTime = time;
if (this.periodicCall.size() <= 0) {
Log.verbose("Periodic main dunction: Call [ END ] ==> no connection");
LOGGER.trace("Periodic main dunction: Call [ END ] ==> no connection");
return;
}
final Duration deltaTime = Duration.ofNanos(time - previousTime);
final EventTime myTime = new EventTime(clock, this.applWakeUpClock, time, this.applWakeUpTime, deltaTime, deltaTime);
final EventTime myTime = new EventTime(clock, this.applWakeUpClock, time, this.applWakeUpTime, deltaTime,
deltaTime);
this.periodicCall.emit(myTime);
Log.verbose("Periodic main dunction : Call [END]");
LOGGER.trace("Periodic main dunction : Call [END]");
}
/**
@ -163,9 +167,9 @@ public class ObjectManager {
* remove all resources (un-init) out of the destructor (due to the system implementation)
*/
public synchronized void unInit() {
Log.debug(" == > Un-Init Object-Manager");
LOGGER.debug(" == > Un-Init Object-Manager");
if (this.workerList.size() > 0) {
Log.debug(" == > Remove all workers");
LOGGER.debug(" == > Remove all workers");
this.workerList.clear();
}
for (final WeakReference<EwolObject> it : this.eObjectList) {
@ -175,7 +179,7 @@ public class ObjectManager {
}
}
if (this.eObjectList.size() != 0) {
Log.error("Have " + this.eObjectList.size() + " active Object");
LOGGER.error("Have " + this.eObjectList.size() + " active Object");
}
this.eObjectList.clear();
}

View File

@ -12,16 +12,18 @@ import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.resource.Resource;
import org.atriasoft.gale.resource.ResourceProgram;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* simple display of Colored3DObject ==> for DEBUG only Not availlable on
* ALL platform (like webGL)
*/
public class RefactorColored3DObject extends Resource {
private static final Logger LOGGER = LoggerFactory.getLogger(RefactorColored3DObject.class);
protected int oGLColor;
protected int oGLMatrix;
protected int oGLPosition;
@ -30,7 +32,8 @@ public class RefactorColored3DObject extends Resource {
public RefactorColored3DObject() {
// get the shader resource :
this.oGLPosition = 0;
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "simple3D.vert", "ewol"), new Uri("DATA", "simple3D.frag", "ewol"));
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "simple3D.vert", "ewol"),
new Uri("DATA", "simple3D.frag", "ewol"));
if (this.oGLprogram != null) {
this.oGLPosition = this.oGLprogram.getAttribute("EWcoord3d");
this.oGLColor = this.oGLprogram.getUniform("EWcolor");
@ -48,12 +51,16 @@ public class RefactorColored3DObject extends Resource {
draw(vertices, color, true, true);
}
public void draw(final List<Vector3f> vertices, final Color color, final boolean updateDepthBuffer, final boolean depthtest) {
public void draw(
final List<Vector3f> vertices,
final Color color,
final boolean updateDepthBuffer,
final boolean depthtest) {
if (vertices.size() <= 0) {
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
if (depthtest) {
@ -63,7 +70,7 @@ public class RefactorColored3DObject extends Resource {
}
}
// Log.debug(" display " + this.coord.size() + " elements" );
// LOGGER.debug(" display " + this.coord.size() + " elements" );
this.oGLprogram.use();
// set Matrix: translation/positionMatrix
final Matrix4f projMatrix = OpenGL.getMatrix();
@ -71,7 +78,8 @@ public class RefactorColored3DObject extends Resource {
final Matrix4f tmpMatrix = projMatrix.multiply(camMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
// position :
this.oGLprogram.sendAttribute(this.oGLPosition, 3/* x,y,z,unused */, ResourceProgram.storeDataInFloatBufferVector3f(vertices), 3);
this.oGLprogram.sendAttribute(this.oGLPosition, 3/* x,y,z,unused */,
ResourceProgram.storeDataInFloatBufferVector3f(vertices), 3);
// color :
this.oGLprogram.uniformColor(this.oGLColor, color);
// Request the draw od the elements:
@ -93,12 +101,17 @@ public class RefactorColored3DObject extends Resource {
draw(vertices, color, transformationMatrix, true, true);
}
public void draw(final List<Vector3f> vertices, final Color color, final Matrix4f transformationMatrix, final boolean updateDepthBuffer, final boolean depthTest) {
public void draw(
final List<Vector3f> vertices,
final Color color,
final Matrix4f transformationMatrix,
final boolean updateDepthBuffer,
final boolean depthTest) {
if (vertices.size() <= 0) {
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
if (depthTest) {
@ -107,7 +120,7 @@ public class RefactorColored3DObject extends Resource {
OpenGL.setDeathMask(false);
}
}
// Log.debug(" display " + this.coord.size() + " elements" );
// LOGGER.debug(" display " + this.coord.size() + " elements" );
this.oGLprogram.use();
// set Matrix: translation/positionMatrix
final Matrix4f projMatrix = OpenGL.getMatrix();
@ -115,7 +128,8 @@ public class RefactorColored3DObject extends Resource {
final Matrix4f tmpMatrix = projMatrix.multiply(camMatrix).multiply(transformationMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
// position :
this.oGLprogram.sendAttribute(this.oGLPosition, 3/* x,y,z */, ResourceProgram.storeDataInFloatBufferVector3f(vertices), 3); // TODO : check 4->3
this.oGLprogram.sendAttribute(this.oGLPosition, 3/* x,y,z */,
ResourceProgram.storeDataInFloatBufferVector3f(vertices), 3); // TODO : check 4->3
// color :
this.oGLprogram.uniformColor(this.oGLColor, color);
// Request the draw od the elements:
@ -129,7 +143,13 @@ public class RefactorColored3DObject extends Resource {
}
}
public void drawCapsule(final float radius, final float size, int lats, final int longs, final Matrix4f transformationMatrix, final Color tmpColor) {
public void drawCapsule(
final float radius,
final float size,
int lats,
final int longs,
final Matrix4f transformationMatrix,
final Color tmpColor) {
final List<Vector3f> tmpVertices = new ArrayList<>();
lats = lats / 2 * 2;
@ -225,7 +245,13 @@ public class RefactorColored3DObject extends Resource {
draw(tmpVertices, tmpColor, transformationMatrix);
}
public void drawCone(final float radius, final float size, final int lats, final int longs, final Matrix4f transformationMatrix, final Color tmpColor) {
public void drawCone(
final float radius,
final float size,
final int lats,
final int longs,
final Matrix4f transformationMatrix,
final Color tmpColor) {
final List<Vector3f> tmpVertices = new ArrayList<>();
// center to border (TOP)
for (int jjj = 0; jjj < longs; ++jjj) {
@ -265,11 +291,21 @@ public class RefactorColored3DObject extends Resource {
draw(tmpVertices, tmpColor, transformationMatrix);
}
public void drawCubeLine(final Vector3f min, final Vector3f max, final Color color, final Matrix4f transformationMatrix) {
public void drawCubeLine(
final Vector3f min,
final Vector3f max,
final Color color,
final Matrix4f transformationMatrix) {
drawCubeLine(min, max, color, transformationMatrix, true, true);
}
public void drawCubeLine(final Vector3f min, final Vector3f max, final Color color, final Matrix4f transformationMatrix, final boolean updateDepthBuffer, final boolean depthtest) {
public void drawCubeLine(
final Vector3f min,
final Vector3f max,
final Color color,
final Matrix4f transformationMatrix,
final boolean updateDepthBuffer,
final boolean depthtest) {
final List<Vector3f> vertices = new ArrayList<>();
vertices.add(new Vector3f(min.x(), min.y(), min.z()));
vertices.add(new Vector3f(max.x(), min.y(), min.z()));
@ -310,7 +346,13 @@ public class RefactorColored3DObject extends Resource {
drawLine(vertices, color, transformationMatrix, updateDepthBuffer, depthtest);
}
public void drawCylinder(final float radius, final float size, final int lats, final int longs, final Matrix4f transformationMatrix, final Color tmpColor) {
public void drawCylinder(
final float radius,
final float size,
final int lats,
final int longs,
final Matrix4f transformationMatrix,
final Color tmpColor) {
final List<Vector3f> tmpVertices = new ArrayList<>();
// center to border (TOP)
@ -384,12 +426,17 @@ public class RefactorColored3DObject extends Resource {
drawLine(vertices, color, transformationMatrix, true, true);
}
public void drawLine(final List<Vector3f> vertices, final Color color, final Matrix4f transformationMatrix, final boolean updateDepthBuffer, final boolean depthTest) {
public void drawLine(
final List<Vector3f> vertices,
final Color color,
final Matrix4f transformationMatrix,
final boolean updateDepthBuffer,
final boolean depthTest) {
if (vertices.size() <= 0) {
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
LOGGER.error("No shader ...");
return;
}
if (depthTest) {
@ -398,7 +445,7 @@ public class RefactorColored3DObject extends Resource {
OpenGL.setDeathMask(false);
}
}
// Log.debug(" display " + this.coord.size() + " elements" );
// LOGGER.debug(" display " + this.coord.size() + " elements" );
this.oGLprogram.use();
// set Matrix: translation/positionMatrix
final Matrix4f projMatrix = OpenGL.getMatrix();
@ -406,7 +453,8 @@ public class RefactorColored3DObject extends Resource {
final Matrix4f tmpMatrix = projMatrix.multiply(camMatrix).multiply(transformationMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
// position :
this.oGLprogram.sendAttribute(this.oGLPosition, 3/* x,y,z */, ResourceProgram.storeDataInFloatBufferVector3f(vertices), 3);// TODO check 4->3
this.oGLprogram.sendAttribute(this.oGLPosition, 3/* x,y,z */,
ResourceProgram.storeDataInFloatBufferVector3f(vertices), 3);// TODO check 4->3
// color :
this.oGLprogram.uniformColor(this.oGLColor, color);
// Request the draw od the elements:
@ -420,7 +468,12 @@ public class RefactorColored3DObject extends Resource {
}
}
public void drawSphere(final float radius, final int lats, final int longs, final Matrix4f transformationMatrix, final Color tmpColor) {
public void drawSphere(
final float radius,
final int lats,
final int longs,
final Matrix4f transformationMatrix,
final Color tmpColor) {
final List<Vector3f> tmpVertices = new ArrayList<>();
for (int iii = 0; iii <= lats; ++iii) {
final float lat0 = (float) (Math.PI) * (-0.5f + (float) (iii - 1) / lats);
@ -458,9 +511,12 @@ public class RefactorColored3DObject extends Resource {
public void drawSquare(final Vector3f size, final Matrix4f transformationMatrix, final Color tmpColor) {
final List<Vector3f> tmpVertices = new ArrayList<>();
final int[] indices = { 0, 1, 2, 3, 2, 1, 4, 0, 6, 6, 0, 2, 5, 1, 4, 4, 1, 0, 7, 3, 1, 7, 1, 5, 5, 4, 7, 7, 4, 6, 7, 2, 3, 7, 6, 2 };
final Vector3f[] vertices = { new Vector3f(size.x(), size.y(), size.z()), new Vector3f(-size.x(), size.y(), size.z()), new Vector3f(size.x(), -size.y(), size.z()),
new Vector3f(-size.x(), -size.y(), size.z()), new Vector3f(size.x(), size.y(), -size.z()), new Vector3f(-size.x(), size.y(), -size.z()), new Vector3f(size.x(), -size.y(), -size.z()),
final int[] indices = { 0, 1, 2, 3, 2, 1, 4, 0, 6, 6, 0, 2, 5, 1, 4, 4, 1, 0, 7, 3, 1, 7, 1, 5, 5, 4, 7, 7, 4,
6, 7, 2, 3, 7, 6, 2 };
final Vector3f[] vertices = { new Vector3f(size.x(), size.y(), size.z()),
new Vector3f(-size.x(), size.y(), size.z()), new Vector3f(size.x(), -size.y(), size.z()),
new Vector3f(-size.x(), -size.y(), size.z()), new Vector3f(size.x(), size.y(), -size.z()),
new Vector3f(-size.x(), size.y(), -size.z()), new Vector3f(size.x(), -size.y(), -size.z()),
new Vector3f(-size.x(), -size.y(), -size.z()) };
for (int iii = 0; iii < 36; iii += 3) {
// normal calculation :
@ -474,22 +530,31 @@ public class RefactorColored3DObject extends Resource {
draw(tmpVertices, tmpColor, transformationMatrix);
}
public void drawTriangles(final List<Vector3f> vertex, final List<Integer> indice, final Matrix4f transformationMatrix, final Color tmpColor) {
public void drawTriangles(
final List<Vector3f> vertex,
final List<Integer> indice,
final Matrix4f transformationMatrix,
final Color tmpColor) {
drawTriangles(vertex, indice, transformationMatrix, tmpColor, new Vector3f(0.0f, 0.0f, 0.1f));
}
public void drawTriangles(final List<Vector3f> vertex, final List<Integer> indice, final Matrix4f transformationMatrix, final Color tmpColor, final Vector3f offset) {
public void drawTriangles(
final List<Vector3f> vertex,
final List<Integer> indice,
final Matrix4f transformationMatrix,
final Color tmpColor,
final Vector3f offset) {
final List<Vector3f> tmpVertices = new ArrayList<>();
for (int iii = 0; iii < indice.size() / 3; ++iii) {
tmpVertices.add(vertex.get(indice.get(iii * 3)).add(offset));
tmpVertices.add(vertex.get(indice.get(iii * 3 + 1)).add(offset));
tmpVertices.add(vertex.get(indice.get(iii * 3 + 2)).add(offset));
// Log.info(" indices " + indice[iii*3 + 0] + " " + indice[iii*3 + 1] + " " +
// LOGGER.info(" indices " + indice[iii*3 + 0] + " " + indice[iii*3 + 1] + " " +
// indice[iii*3 + 2]);
// Log.info(" triangle " + vertex[indice[iii*3 + 0]] + " " +
// LOGGER.info(" triangle " + vertex[indice[iii*3 + 0]] + " " +
// vertex[indice[iii*3 + 1]] + " " + vertex[indice[iii*3 + 2]]);
}
// Log.info("display " + tmpVertices.size() + " vertices form " +
// LOGGER.info("display " + tmpVertices.size() + " vertices form " +
// indice.size());
draw(tmpVertices, tmpColor, transformationMatrix);
}

View File

@ -14,8 +14,9 @@ import org.atriasoft.ejson.model.JsonNode;
import org.atriasoft.ejson.model.JsonObject;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class ListElement {
public Color color;
@ -33,18 +34,21 @@ class ListElement {
* example black, or white or orange ...)
*/
public class ResourceColorFile extends Resource {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceColorFile.class);
public static ResourceColorFile create(final Uri uri) {
Log.verbose("KEEP: ColorFile: " + uri);
ResourceColorFile object = null;
LOGGER.trace("KEEP: ColorFile: " + uri);
final ResourceColorFile object = null;
final Resource object2 = Resource.getManager().localKeep(uri);
if (object2 != null) {
if (object2 instanceof ResourceColorFile) {
return (ResourceColorFile) object2;
}
Log.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
LOGGER.error("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
System.exit(-1);
return null;
}
Log.debug("CREATE: FontFreeType: " + uri);
LOGGER.debug("CREATE: FontFreeType: " + uri);
// need to crate a new one ...
return new ResourceColorFile(uri);
}
@ -59,9 +63,9 @@ public class ResourceColorFile extends Resource {
*/
public ResourceColorFile(final Uri uri) {
super(uri);
Log.debug("CF : load \"" + uri + "\"");
LOGGER.debug("CF : load \"" + uri + "\"");
reload();
// Log.debug("List of all color : " + this.list.keySet());
// LOGGER.debug("List of all color : " + this.list.keySet());
}
@Override
@ -94,8 +98,8 @@ public class ResourceColorFile extends Resource {
}
public synchronized void put(final String name, final Color color) {
for (int iii = 0; iii < this.list.size(); iii++) {
final ListElement elem = this.list.get(iii);
for (final ListElement element : this.list) {
final ListElement elem = element;
if (elem.name.contentEquals(name)) {
elem.color = color;
return;
@ -107,17 +111,17 @@ public class ResourceColorFile extends Resource {
@Override
public synchronized void reload() {
// remove all previous set of value :
for (int iii = 0; iii < this.list.size(); ++iii) {
this.list.get(iii).color = this.errorColor;
for (final ListElement element : this.list) {
element.color = this.errorColor;
}
Log.todo("Mut be implemented ...");
LOGGER.info("[TODO] Mut be implemented ...");
// open and read all json elements:
try {
final JsonObject out = Ejson.parse(Uri.valueOf(this.name)).toJsonObject();
final JsonArray baseArray = out.get("color").toJsonArray();
if (baseArray == null) {
Log.error("Can not get basic array : 'color' in file:" + this.name);
LOGGER.error("Can not get basic array : 'color' in file:" + this.name);
Ejson.display(out);
return;
}
@ -125,15 +129,15 @@ public class ResourceColorFile extends Resource {
for (final JsonNode it : baseArray.getNodes()) {
final JsonObject tmpObj = it.toJsonObject();
if (tmpObj == null) {
Log.error(" can not get object in 'color' : " + it);
LOGGER.error(" can not get object in 'color' : " + it);
findError = true;
continue;
}
final String name = tmpObj.get("name").toJsonString().getValue();
final String color = tmpObj.get("color").toJsonString().getValue();
Log.debug("find new color : '" + name + "' color='" + color + "'");
LOGGER.debug("find new color : '" + name + "' color='" + color + "'");
if (name.length() == 0) {
Log.error("Drop an empty name");
LOGGER.error("Drop an empty name");
findError = true;
continue;
}
@ -143,11 +147,11 @@ public class ResourceColorFile extends Resource {
put(name, Color.valueOf(color));
}
if (findError) {
Log.error("pb in parsing file:" + this.name);
LOGGER.error("pb in parsing file:" + this.name);
Ejson.display(out);
}
} catch (final Exception e) {
Log.error("chach exception in parsing config file... " + e.getMessage());
LOGGER.error("chach exception in parsing config file... " + e.getMessage());
e.printStackTrace();
}
}

View File

@ -12,8 +12,9 @@ import org.atriasoft.ejson.Ejson;
import org.atriasoft.ejson.model.JsonNode;
import org.atriasoft.ejson.model.JsonObject;
import org.atriasoft.etk.Uri;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class ListElementConfig {
public final String name;
@ -26,6 +27,8 @@ class ListElementConfig {
}
public class ResourceConfigFile extends Resource {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceConfigFile.class);
/**
* keep the resource pointer.
* @note Never free this pointer by your own...
@ -42,7 +45,8 @@ public class ResourceConfigFile extends Resource {
resource2.keep();
return tmpp;
}
Log.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
LOGGER.error("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
System.exit(-1);
return null;
}
final ResourceConfigFile resource = new ResourceConfigFile(name);
@ -60,7 +64,7 @@ public class ResourceConfigFile extends Resource {
protected ResourceConfigFile(final Uri uri) {
super(uri.toString());
Log.debug("SFP : load '" + uri + "'");
LOGGER.debug("SFP : load '" + uri + "'");
reload();
}

View File

@ -14,20 +14,23 @@ import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.font.GlyphProperty;
import org.atriasoft.gale.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
public class ResourceFontSvg extends Resource {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceFontSvg.class);
public static ResourceFontSvg create(final Uri uri) {
Log.verbose("KEEP: FontFreeType: " + uri);
LOGGER.trace("KEEP: FontFreeType: " + uri);
ResourceFontSvg object = null;
final Resource object2 = Resource.getManager().localKeep(uri);
if (object2 != null) {
if (!(object2 instanceof ResourceFontSvg)) {
Log.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
LOGGER.error("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
System.exit(-1);
return null;
}
object = (ResourceFontSvg) object2;
@ -35,7 +38,7 @@ public class ResourceFontSvg extends Resource {
if (object != null) {
return object;
}
Log.debug("CREATE: FontFreeType: " + uri);
LOGGER.debug("CREATE: FontFreeType: " + uri);
// need to crate a new one ...
return new ResourceFontSvg(uri);
}
@ -46,10 +49,11 @@ public class ResourceFontSvg extends Resource {
super(uri);
this.font = EsvgFont.load(uri);
if (this.font == null) {
Log.error("... the font file could be opened and read, but it appears ... that its font format is unsupported");
LOGGER.error(
"... the font file could be opened and read, but it appears ... that its font format is unsupported");
} else {
// all OK
Log.debug("load font : '" + uri + "' glyph count = " + this.font.getNumGlyphs());
LOGGER.debug("load font : '" + uri + "' glyph count = " + this.font.getNumGlyphs());
// display();
}
}
@ -60,15 +64,26 @@ public class ResourceFontSvg extends Resource {
}
public synchronized void display() {
Log.info(" number of glyph = " + this.font.getNumGlyphs());
LOGGER.info(" number of glyph = " + this.font.getNumGlyphs());
}
public boolean drawGlyph(final ImageByte imageOut, final int fontSize, final Vector2i glyphPosition, final GlyphProperty property, final int posInImage) {
public boolean drawGlyph(
final ImageByte imageOut,
final int fontSize,
final Vector2i glyphPosition,
final GlyphProperty property,
final int posInImage) {
return drawGlyph(imageOut, fontSize, glyphPosition, property, posInImage, false);
}
// the forceClimp is to generate a forcing of the rendering in small font, this permit to have a correct view of the font, otherwise it will be transparent.
public synchronized boolean drawGlyph(final ImageByte imageOut, final int fontSize, final Vector2i glyphPosition, final GlyphProperty property, final int posInImage, final boolean forceClimp) {
public synchronized boolean drawGlyph(
final ImageByte imageOut,
final int fontSize,
final Vector2i glyphPosition,
final GlyphProperty property,
final int posInImage,
final boolean forceClimp) {
final Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
if (weight == null) {
return false;
@ -101,7 +116,11 @@ public class ResourceFontSvg extends Resource {
return true;
}
public synchronized boolean drawGlyph(final ImageByteMono imageOut, final int fontSize, final GlyphProperty property, final int borderSize) {
public synchronized boolean drawGlyph(
final ImageByteMono imageOut,
final int fontSize,
final GlyphProperty property,
final int borderSize) {
final Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
for (int jjj = 0; jjj < weight.getHeight(); jjj++) {
for (int iii = 0; iii < weight.getWidth(); iii++) {

View File

@ -13,18 +13,21 @@ import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Ewol;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.font.FontMode;
import org.atriasoft.ewol.resource.font.GlyphProperty;
import org.atriasoft.gale.resource.Resource;
import org.atriasoft.gale.resource.ResourceTexture2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ResourceTexturedFont extends ResourceTexture2 {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceTexturedFont.class);
public static ResourceTexturedFont create(final Uri fontBaseUri) {
ResourceTexturedFont resource;
Resource resource2;
if (fontBaseUri.isEmpty()) {
Log.error("Can not create a Texture Font without a filaname " + fontBaseUri);
LOGGER.error("Can not create a Texture Font without a filaname " + fontBaseUri);
return null;
}
resource2 = Resource.getManager().localKeep("__TEXTURED__>>" + fontBaseUri.toString());
@ -33,7 +36,8 @@ public class ResourceTexturedFont extends ResourceTexture2 {
resource2.keep();
return (ResourceTexturedFont) resource2;
}
Log.critical("Request resource fontName : '" + fontBaseUri + "' With the wrong type (dynamic cast error)");
LOGGER.error("Request resource fontName : '" + fontBaseUri + "' With the wrong type (dynamic cast error)");
System.exit(-1);
return null;
}
resource = new ResourceTexturedFont(fontBaseUri);
@ -60,7 +64,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
protected ResourceTexturedFont(final Uri fontBaseUri) {
super("__TEXTURED_FONT__>>" + fontBaseUri.toString());
this.forceClimp = "true".equals(fontBaseUri.getProperty("FORCE_CLIMP"));
Log.debug("Load font : '" + fontBaseUri + "'");
LOGGER.debug("Load font : '" + fontBaseUri + "'");
this.font[0] = null;
this.font[1] = null;
@ -94,9 +98,12 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.size = Integer.parseInt(sizeString);
}
// find all the fonts...
final Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Bold.svg"), fontBaseUri.getproperties());
final Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Oblique.svg"), fontBaseUri.getproperties());
final Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "BoldOblique.svg"), fontBaseUri.getproperties());
final Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Bold.svg"),
fontBaseUri.getproperties());
final Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(),
fontBaseUri.getPath().replace(".svg", "Oblique.svg"), fontBaseUri.getproperties());
final Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(),
fontBaseUri.getPath().replace(".svg", "BoldOblique.svg"), fontBaseUri.getproperties());
if (fontBaseUri.exist()) {
this.fileName[FontMode.REGULAR.getValue()] = fontBaseUri;
}
@ -117,7 +124,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
refMode = FontMode.get(iii);
}
}
Log.debug(" set reference mode : " + refMode);
LOGGER.debug(" set reference mode : " + refMode);
// generate the wrapping on the preventing error
for (int iii = 3; iii >= 0; iii--) {
if (this.fileName[iii] != null) {
@ -129,14 +136,17 @@ public class ResourceTexturedFont extends ResourceTexture2 {
for (int iiiFontId = 0; iiiFontId < 4; iiiFontId++) {
if (this.fileName[iiiFontId] == null) {
Log.debug("can not load FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId] + "\" == > size=" + this.size);
LOGGER.debug("can not load FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId]
+ "\" == > size=" + this.size);
this.font[iiiFontId] = null;
continue;
}
Log.debug("Load FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId] + "\" == > size=" + this.size);
LOGGER.debug("Load FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId] + "\" == > size="
+ this.size);
this.font[iiiFontId] = ResourceFontSvg.create(this.fileName[iiiFontId]);
if (this.font[iiiFontId] == null) {
Log.debug("error in loading FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId] + "\" == > size=" + this.size);
LOGGER.debug("error in loading FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId]
+ "\" == > size=" + this.size);
}
}
for (int iiiFontId = 0; iiiFontId < 4; iiiFontId++) {
@ -156,15 +166,15 @@ public class ResourceTexturedFont extends ResourceTexture2 {
addGlyph((char) 0);
// by default we set only the first AINSI char available
for (int iii = 0x20; iii < 0x7F; iii++) {
Log.verbose("Add clyph :" + iii);
LOGGER.trace("Add clyph :" + iii);
addGlyph((char) iii);
}
flush();
Log.debug("Wrapping properties : ");
Log.debug(" " + FontMode.REGULAR + " == >" + getWrappingMode(FontMode.REGULAR));
Log.debug(" " + FontMode.ITALIC + " == >" + getWrappingMode(FontMode.ITALIC));
Log.debug(" " + FontMode.BOLD + " == >" + getWrappingMode(FontMode.BOLD));
Log.debug(" " + FontMode.BOLD_ITALIC + " == >" + getWrappingMode(FontMode.BOLD_ITALIC));
LOGGER.debug("Wrapping properties : ");
LOGGER.debug(" " + FontMode.REGULAR + " == >" + getWrappingMode(FontMode.REGULAR));
LOGGER.debug(" " + FontMode.ITALIC + " == >" + getWrappingMode(FontMode.ITALIC));
LOGGER.debug(" " + FontMode.BOLD + " == >" + getWrappingMode(FontMode.BOLD));
LOGGER.debug(" " + FontMode.BOLD_ITALIC + " == >" + getWrappingMode(FontMode.BOLD_ITALIC));
}
/**
@ -183,30 +193,34 @@ public class ResourceTexturedFont extends ResourceTexture2 {
final GlyphProperty tmpchar = this.font[iii].getGlyphProperty(this.size, val);
if (tmpchar != null && tmpchar.exist()) {
Log.debug("load char : '" + val + "'=" + (int) val);
LOGGER.debug("load char : '" + val + "'=" + (int) val);
hasChange = true;
// change line if needed ...
if (this.lastGlyphPos[iii].x() + tmpchar.sizeTexture.x() + 3 > this.data.getSize().x()) {
this.lastGlyphPos[iii] = new Vector2i(1, this.lastGlyphPos[iii].y() + this.lastRawHeigh[iii]);
this.lastRawHeigh[iii] = 0;
}
Log.verbose("glyph texture size = " + tmpchar.sizeTexture + "last posY=" + this.lastGlyphPos[iii].y() + " out size=" + this.data.getSize());
LOGGER.trace("glyph texture size = " + tmpchar.sizeTexture + "last posY=" + this.lastGlyphPos[iii].y()
+ " out size=" + this.data.getSize());
while (this.lastGlyphPos[iii].y() + tmpchar.sizeTexture.y() + 3 > this.data.getSize().y()) {
this.data.resize(this.data.getSize().x(), this.data.getSize().y() * 2);
// note : need to rework all the layer due to the fact that the texture is used by the 4 type...
for (int kkk = 0; kkk < 4; kkk++) {
// change the coordinate on the element in the texture
for (int jjj = 0; jjj < this.listElement[kkk].size(); ++jjj) {
this.listElement[kkk].get(jjj).texturePosStart = this.listElement[kkk].get(jjj).texturePosStart.multiply(new Vector2f(1.0f, 0.5f));
this.listElement[kkk].get(jjj).texturePosSize = this.listElement[kkk].get(jjj).texturePosSize.multiply(new Vector2f(1.0f, 0.5f));
for (final GlyphProperty element : this.listElement[kkk]) {
element.texturePosStart = element.texturePosStart.multiply(new Vector2f(1.0f, 0.5f));
element.texturePosSize = element.texturePosSize.multiply(new Vector2f(1.0f, 0.5f));
}
}
}
// draw the glyph
this.font[iii].drawGlyph(this.data, this.size, this.lastGlyphPos[iii], tmpchar, iii);
// set video position
tmpchar.texturePosStart = new Vector2f((float) this.lastGlyphPos[iii].x() / (float) this.data.getSize().x(), (float) this.lastGlyphPos[iii].y() / (float) this.data.getSize().y());
tmpchar.texturePosSize = new Vector2f((float) tmpchar.sizeTexture.x() / this.data.getSize().x(), (float) tmpchar.sizeTexture.y() / this.data.getSize().y());
tmpchar.texturePosStart = new Vector2f(
(float) this.lastGlyphPos[iii].x() / (float) this.data.getSize().x(),
(float) this.lastGlyphPos[iii].y() / (float) this.data.getSize().y());
tmpchar.texturePosSize = new Vector2f((float) tmpchar.sizeTexture.x() / this.data.getSize().x(),
(float) tmpchar.sizeTexture.y() / this.data.getSize().y());
// update the maximum of the line hight :
if (this.lastRawHeigh[iii] < tmpchar.sizeTexture.y()) {
@ -217,12 +231,12 @@ public class ResourceTexturedFont extends ResourceTexture2 {
// update the Bitmap position drawing :
this.lastGlyphPos[iii] = this.lastGlyphPos[iii].add(new Vector2i(tmpchar.sizeTexture.x() + 1, 0));
} else {
Log.warning("Did not find char : '" + val + "'=" + val);
LOGGER.warn("Did not find char : '" + val + "'=" + val);
}
this.listElement[iii].add(tmpchar);
}
if (hasChange) {
Log.verbose("All gliph added ====> request a redraw of all the GUI");
LOGGER.trace("All gliph added ====> request a redraw of all the GUI");
flush();
Ewol.getContext().forceRedrawAllAsync();
//IOgami.storePNG(new Uri("file", "fileFont.png"), this.data); // ==> for debug test only ...
@ -245,22 +259,22 @@ public class ResourceTexturedFont extends ResourceTexture2 {
* @return The pointer on the glyph == > never null
*/
public synchronized GlyphProperty getGlyph(final Character charcode, final FontMode displayMode) {
// Log.debug("Get glyph property for mode: " + displayMode + " == > wrapping
// LOGGER.debug("Get glyph property for mode: " + displayMode + " == > wrapping
// index : " + this.modeWraping[displayMode]);
final int index = getIndex(charcode, displayMode);
if (index < 0 || index >= this.listElement[displayMode.getValue()].size()) {
Log.error(" Try to get glyph index inexistant ... == > return the index 0 ... id=" + index);
LOGGER.error(" Try to get glyph index inexistant ... == > return the index 0 ... id=" + index);
if (this.listElement[displayMode.getValue()].size() > 0) {
return this.listElement[displayMode.getValue()].get(0);
}
return this.emptyGlyph;
}
// Log.error(" index=" + index);
// Log.error(" this.UVal=" + this.listElement[displayMode][index].UVal);
// Log.error(" this.glyphIndex=" +
// LOGGER.error(" index=" + index);
// LOGGER.error(" this.UVal=" + this.listElement[displayMode][index].UVal);
// LOGGER.error(" this.glyphIndex=" +
// this.listElement[displayMode][index].glyphIndex);
// Log.error(" this.advance=" + this.listElement[displayMode][index].advance);
// Log.error(" this.bearing=" + this.listElement[displayMode][index].bearing);
// LOGGER.error(" this.advance=" + this.listElement[displayMode][index].advance);
// LOGGER.error(" this.bearing=" + this.listElement[displayMode][index].bearing);
return this.listElement[displayMode.getValue()].get(index);
}
@ -291,12 +305,12 @@ public class ResourceTexturedFont extends ResourceTexture2 {
return charcode - 0x1F;
}
for (int iii = 0x80 - 0x20; iii < this.listElement[displayMode.getValue()].size(); iii++) {
// Log.debug("search : '" + charcode + "' =?= '" +
// LOGGER.debug("search : '" + charcode + "' =?= '" +
// (this.listElement[displayMode])[iii].UVal + "'");
if (charcode == this.listElement[displayMode.getValue()].get(iii).getUnicodeValue()) {
// Log.debug("search : '" + charcode + "'");
// LOGGER.debug("search : '" + charcode + "'");
if (this.listElement[displayMode.getValue()].get(iii).exist()) {
// Log.debug("return " + iii);
// LOGGER.debug("return " + iii);
return charcode;
}
return 0;

View File

@ -6,9 +6,12 @@
*/
package org.atriasoft.ewol.tools;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Message {
private static final Logger LOGGER = LoggerFactory.getLogger(Message.class);
private enum Type {
critical, //!< Critical message pop-up, //!< information message pop-up
error, //!< warning message pop-up
@ -22,7 +25,7 @@ public class Message {
* @param message message to display (decorated text)
*/
private static void create(final Type type, final String message) {
Log.todo("Generic message display (simple interface...)");
LOGGER.info("[TODO] Generic message display (simple interface...)");
/*
StdPopUp tmpPopUp = new StdPopUp();
switch (type) {
@ -38,7 +41,7 @@ public class Message {
EwolContext context = Ewol.getContext();
Windows windows = context.getWindows();
if (windows == null) {
Log.error("can not get the current windows ... ==> can not display message : " + message);
LOGGER.error("can not get the current windows ... ==> can not display message : " + message);
return;
}
windows.popUpWidgetPush(tmpPopUp);

View File

@ -19,10 +19,11 @@ import org.atriasoft.ewol.compositing.ShapeBox;
import org.atriasoft.ewol.event.EventEntry;
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.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @ingroup ewolWidgetGroup
@ -35,6 +36,8 @@ import org.atriasoft.gale.key.KeyStatus;
* ~~~~~~~~~~~~~~~~~~~~~~
*/
public class Button extends ContainerToggle {
private static final Logger LOGGER = LoggerFactory.getLogger(Button.class);
public enum ButtonLock {
LOCK_NONE, //!< normal status of the button
LOCK_WHEN_PRESSED, //!< When the state is set in pressed, the status stay in this one
@ -81,7 +84,7 @@ public class Button extends ContainerToggle {
* @param event Time generic event
*/
protected static void periodicCall(final Button self, final EventTime event) {
Log.verbose("Periodic call on Entry(" + event + ")");
LOGGER.trace("Periodic call on Entry(" + event + ")");
if (!self.shape.periodicCall(event)) {
self.periodicConnectionHanble.close();
}
@ -148,14 +151,15 @@ public class Button extends ContainerToggle {
padding = this.shape.getPadding();
}
calculateMinMaxSizePadded(padding);
Log.verbose("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
}
protected void changeStatusIn(final GuiShapeMode newStatusId) {
if (this.shape.changeStatusIn(newStatusId)) {
if (!this.periodicConnectionHanble.isConnected()) {
//Log.error("REQUEST: connection on periodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, Button::periodicCall);
//LOGGER.error("REQUEST: connection on periodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this,
Button::periodicCall);
}
markToRedraw();
}
@ -252,12 +256,10 @@ public class Button extends ContainerToggle {
this.signalValue.emit(this.propertyValue);
if (!this.propertyToggleMode) {
this.idWidgetDisplayed = 0;
} else if (!this.propertyValue) {
this.idWidgetDisplayed = 0;
} else {
if (!this.propertyValue) {
this.idWidgetDisplayed = 0;
} else {
this.idWidgetDisplayed = 1;
}
this.idWidgetDisplayed = 1;
}
if (this.propertyEnableSingle) {
if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) {
@ -305,7 +307,7 @@ public class Button extends ContainerToggle {
@Override
protected boolean onEventEntry(final EventEntry event) {
//Log.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
//LOGGER.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
if (event.type() == KeyKeyboard.CHARACTER && event.status() == KeyStatus.down && event.getChar() == '\r') {
this.signalEnter.emit();
return true;
@ -316,7 +318,7 @@ public class Button extends ContainerToggle {
@Override
public boolean onEventInput(final EventInput event) {
final Vector3f relPos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0));
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos);
final boolean over = this.shapeProperty.isInside(relPos);
//filter if outside the element...
if (event.status() == KeyStatus.leave) {
@ -329,7 +331,7 @@ public class Button extends ContainerToggle {
if (KeyStatus.leave == event.status()) {
changeStatusIn(GuiShapeMode.NORMAL);
} else {
Log.verbose("Detect Over : " + this.shapeProperty);
LOGGER.trace("Detect Over : " + this.shapeProperty);
if (over) {
changeStatusIn(GuiShapeMode.OVER);
} else {
@ -346,10 +348,10 @@ public class Button extends ContainerToggle {
keepFocus();
this.signalClick.emit();
if (this.propertyToggleMode) {
this.setPropertyValue(!this.propertyValue);
setPropertyValue(!this.propertyValue);
} else {
this.setPropertyValue(!this.propertyValue);
this.setPropertyValue(!this.propertyValue);
setPropertyValue(!this.propertyValue);
setPropertyValue(!this.propertyValue);
}
return true;
}
@ -380,7 +382,7 @@ public class Button extends ContainerToggle {
@Override
protected void onLostFocus() {
this.buttonPressed = false;
Log.verbose(this.name + " : Remove Focus ...");
LOGGER.trace(this.name + " : Remove Focus ...");
checkStatus();
}
@ -390,7 +392,7 @@ public class Button extends ContainerToggle {
if (!needRedraw()) {
//return;
}
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
//LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
this.shape.clear();
final Padding padding = this.shape.getPadding();

View File

@ -17,7 +17,6 @@ import org.atriasoft.etk.math.Vector3b;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
import org.atriasoft.exml.XmlMapper;
import org.atriasoft.exml.exception.ExmlException;
@ -25,11 +24,15 @@ import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.context.Cursor;
import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeySpecial;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* the composer widget is a widget that create a link on a string.file to parse the data and generate some widget tree
*/
public class Composer extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Composer.class);
public static Widget composerGenerateFile(final Uri data) {
return composerGenerateFile(data, 0);
}
@ -37,13 +40,13 @@ public class Composer extends Container {
public static Widget composerGenerateFile(final Uri uri, final long id) {
final byte[] elemData = Uri.getAllData(uri);
if (elemData == null) {
Log.error("Can not read the Stream : {}", uri);
LOGGER.error("Can not read the Stream : {}", uri);
return null;
}
final String dataToParse = new String(elemData);
final Widget tmp = composerGenerateString(dataToParse, id);
if (tmp == null) {
Log.error("Fail to Load data: {}", uri);
LOGGER.error("Fail to Load data: {}", uri);
}
return tmp;
}
@ -64,7 +67,7 @@ public class Composer extends Container {
try {
result = mapper.parse(data, Composer.class);//new WidgetXmlFactory());
} catch (final ExmlException | AknotException ex) {
Log.error("Fail to load Data !!! {}", ex.toString());
LOGGER.error("Fail to load Data !!! {}", ex.toString());
ex.printStackTrace();
}
if (result == null) {
@ -379,7 +382,7 @@ public class Composer extends Container {
* @return false == > some error occured
*/
public boolean loadFromFile(final Uri uri) {
final Widget data = composerGenerateFile(uri, this.getId());
final Widget data = composerGenerateFile(uri, getId());
// check parse is well done.
if (data == null) {
return false;
@ -402,7 +405,7 @@ public class Composer extends Container {
* @return false == > some error occured
*/
public boolean loadFromString(final String composerXmlString) {
final Widget data = composerGenerateString(composerXmlString, this.getId());
final Widget data = composerGenerateString(composerXmlString, getId());
// check parse is well done.
if (data == null) {
return false;
@ -428,14 +431,14 @@ public class Composer extends Container {
}
protected void onChangePropertySubFile() {
Log.info("Load compositing form external file : " + this.propertySubFile);
LOGGER.info("Load compositing form external file : " + this.propertySubFile);
if (this.propertySubFile.isEmpty()) {
// remove all elements:
subWidgetRemove();
return;
}
if (!loadFromFile(this.propertySubFile)) {
Log.error("Can not load Player GUI from file ... " + this.propertySubFile);
LOGGER.error("Can not load Player GUI from file ... " + this.propertySubFile);
}
}
@ -458,7 +461,11 @@ public class Composer extends Container {
}
@Override
public boolean onEventShortCut(final KeySpecial special, final Character unicodeValue, final KeyKeyboard kbMove, final boolean isDown) {
public boolean onEventShortCut(
final KeySpecial special,
final Character unicodeValue,
final KeyKeyboard kbMove,
final boolean isDown) {
if (this.subWidget != null) {
return this.subWidget.onEventShortCut(special, unicodeValue, kbMove, isDown);
}
@ -486,7 +493,7 @@ public class Composer extends Container {
public void requestDestroyFromChild(final EwolObject child) {
super.requestDestroyFromChild(child);
if (this.propertyRemoveIfUnderRemove) {
Log.debug("Child widget remove ==> auto-remove");
LOGGER.debug("Child widget remove ==> auto-remove");
autoDestroy();
}
}

View File

@ -12,14 +12,16 @@ import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.etk.math.Vector3b;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* @ingroup ewolWidgetGroup
* the Cotainer widget is a widget that have an only one subWidget
*/
public class Container extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Container.class);
protected Widget subWidget = null;
/**
@ -37,7 +39,7 @@ public class Container extends Widget {
final Vector3f min = this.subWidget.getCalculateMinSize();
this.minSize = Vector3f.max(this.minSize, min);
}
Log.warning("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.warn("[{}] Result min size : {}", getId(), this.minSize);
}
@Override
@ -100,30 +102,30 @@ public class Container extends Widget {
// }
// XmlElement pNode = it.toElement();
// String widgetName = pNode.getValue();
// Log.verbose("[" + getId() + "] t=" + getClass().getCanonicalName() + " Load node name : '" + widgetName + "'");
// LOGGER.trace("[" + getId() + "] t=" + getClass().getCanonicalName() + " Load node name : '" + widgetName + "'");
// if (!getWidgetManager().exist(widgetName)) {
// Log.error("Unknown basic node='" + widgetName + "' not in : [" + getWidgetManager().list() + "]");
// LOGGER.error("Unknown basic node='" + widgetName + "' not in : [" + getWidgetManager().list() + "]");
// continue;
// }
// if (getSubWidget() != null) {
// Log.error("Can only have one subWidget ??? node='" + widgetName + "'");
// LOGGER.error("Can only have one subWidget ??? node='" + widgetName + "'");
// continue;
// }
// Log.debug("try to create subwidget : '" + widgetName + "'");
// LOGGER.debug("try to create subwidget : '" + widgetName + "'");
// Widget tmpWidget = getWidgetManager().create(widgetName, pNode);
// if (tmpWidget == null) {
// Log.error("Can not create the widget : '" + widgetName + "'");
// LOGGER.error("Can not create the widget : '" + widgetName + "'");
// continue;
// }
// // add widget :
// setSubWidget(tmpWidget);
// if (!tmpWidget.loadXML(pNode)) {
// Log.error("can not load widget properties : '" + widgetName + "'");
// LOGGER.error("can not load widget properties : '" + widgetName + "'");
// return false;
// }
// }
// if (node.getNodes().size() != 0 && this.subWidget == null) {
// Log.warning("Load container with no data inside");
// LOGGER.warn("Load container with no data inside");
// }
// return true;
// }
@ -213,7 +215,7 @@ public class Container extends Widget {
*/
public void subWidgetReplace(final Widget oldWidget, final Widget newWidget) {
if (this.subWidget != oldWidget) {
Log.warning("Request replace with a wrong old widget");
LOGGER.warn("Request replace with a wrong old widget");
return;
}
this.subWidget.removeParent();
@ -244,10 +246,10 @@ public class Container extends Widget {
super.systemDraw(displayProp);
if (this.subWidget != null) {
final DrawProperty prop = displayProp.withLimit(this.origin, this.size);
//Log.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
//LOGGER.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
this.subWidget.systemDraw(prop);
} else {
Log.info("[" + getId() + "] ++++++ : [null]");
LOGGER.info("[" + getId() + "] ++++++ : [null]");
}
}
}

View File

@ -18,14 +18,16 @@ import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.math.Vector3b;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @ingroup ewolWidgetGroup
* the Cotainer widget is a widget that have an only one subWidget
*/
public class ContainerN extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerN.class);
protected Vector3b propertyLockExpand = Vector3b.FALSE; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
protected Vector3b subExpend = Vector3b.FALSE; //!< reference of the sub element expention requested.
@ -41,7 +43,7 @@ public class ContainerN extends Widget {
this.subExpend = Vector3b.FALSE;
this.minSize = Vector3f.ZERO;
this.maxSize = Vector3f.MAX_VALUE;
//Log.error("[" + getId() + "] {" + getObjectType() + "} set min size : " + this.minSize);
//LOGGER.error("[" + getId() + "] {" + getObjectType() + "} set min size : " + this.minSize);
for (final Widget it : this.subWidget) {
if (it != null) {
it.calculateMinMaxSize();
@ -56,7 +58,7 @@ public class ContainerN extends Widget {
this.minSize = Vector3f.max(tmpSize, this.minSize);
}
}
Log.warning("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.warn("[{}] Result min size : {}", getId(), this.minSize);
}
// herited function
@ -73,7 +75,7 @@ public class ContainerN extends Widget {
res = res.withY(true);
}
}
//Log.debug("Expend check : user=" + this.userExpand + " lock=" + propertyLockExpand + " sub=" + this.subExpend + " res=" + res);
//LOGGER.debug("Expend check : user=" + this.userExpand + " lock=" + propertyLockExpand + " sub=" + this.subExpend + " res=" + res);
return res;
}
@ -130,7 +132,8 @@ public class ContainerN extends Widget {
if (it != null) {
final Vector3f tmpSize = it.getSize();
final Vector3f tmpOrigin = it.getOrigin();
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
final Widget tmpWidget = it.getWidgetAtPos(pos);
if (tmpWidget != null) {
return tmpWidget;
@ -203,7 +206,7 @@ public class ContainerN extends Widget {
public void setSubWidgets(final List<Widget> listData) {
// Clean all previous widget
this.subWidgetRemoveAll();
subWidgetRemoveAll();
// add separately all widgets
for (final Widget elem : listData) {
if (elem == null) {
@ -223,7 +226,7 @@ public class ContainerN extends Widget {
*/
public int subWidgetAdd(final Widget newWidget) {
if (newWidget == null) {
Log.error("[" + getId() + "] {" + getClass().getCanonicalName() + "} Try to add An empty Widget ... ");
LOGGER.error("[" + getId() + "] {" + getClass().getCanonicalName() + "} Try to add An empty Widget ... ");
return -1;
}
newWidget.setParent(this);
@ -256,7 +259,8 @@ public class ContainerN extends Widget {
*/
public int subWidgetAddStart(final Widget newWidget) {
if (newWidget == null) {
Log.error("[" + getId() + "] {" + getClass().getCanonicalName() + "} Try to add start An empty Widget ... ");
LOGGER.error(
"[" + getId() + "] {" + getClass().getCanonicalName() + "} Try to add start An empty Widget ... ");
return -1;
}
if (newWidget != null) {
@ -331,7 +335,7 @@ public class ContainerN extends Widget {
haveChange = true;
}
if (!haveChange) {
Log.warning("Request replace with a wrong old widget");
LOGGER.warn("Request replace with a wrong old widget");
return;
}
markToRedraw();
@ -373,7 +377,7 @@ public class ContainerN extends Widget {
while (it.hasPrevious()) {
final Widget elem = it.previous();
if (elem != null) {
//Log.info(" ***** : [" + (*it).propertyName + "] t=" + (*it).getObjectType() + " o=" + (*it).this.origin + " s=" + (*it).this.size);
//LOGGER.info(" ***** : [" + (*it).propertyName + "] t=" + (*it).getObjectType() + " o=" + (*it).this.origin + " s=" + (*it).this.size);
elem.systemDraw(prop);
}
}

View File

@ -11,14 +11,16 @@ import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* @ingroup ewolWidgetGroup
* the Cotainer widget is a widget that have an only one subWidget
*/
public class ContainerToggle extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerToggle.class);
protected Widget[] subWidget = new Widget[2];
int idWidgetDisplayed = 0; //!< current widget displayed
@ -34,10 +36,10 @@ public class ContainerToggle extends Widget {
// call main class
this.minSize = Vector3f.ZERO;
// call sub classes
for (int iii = 0; iii < this.subWidget.length; ++iii) {
if (this.subWidget[iii] != null) {
this.subWidget[iii].calculateMinMaxSize();
final Vector3f min = this.subWidget[iii].getCalculateMinSize();
for (final Widget element : this.subWidget) {
if (element != null) {
element.calculateMinMaxSize();
final Vector3f min = element.getCalculateMinSize();
this.minSize = this.minSize.max(min);
}
}
@ -46,7 +48,7 @@ public class ContainerToggle extends Widget {
// verify the min max of the min size ...
checkMinSize();
//markToRedraw();
Log.verbose("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
}
@Override
@ -100,24 +102,27 @@ public class ContainerToggle extends Widget {
if (this.propertyFill.z()) {
subElementSize = subElementSize.withZ(this.size.z() - padding.z());
}
final Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(subElementSize.add(padding.x(), padding.y(), padding.z())));
final Vector3f delta = this.propertyGravity
.gravityGenerateDelta(this.size.less(subElementSize.add(padding.x(), padding.y(), padding.z())));
final Vector3f deltaPadded = delta.add(padding.left(), padding.bottom(), padding.back());
//subElementSize = subElementSize.less(padding.x(), padding.y(), padding.z());
for (int iii = 0; iii < this.subWidget.length; ++iii) {
if (this.subWidget[iii] != null) {
for (final Widget element : this.subWidget) {
if (element != null) {
//final Vector3f origin2 = this.origin.add(this.offset);
//final Vector3f minSize = this.subWidget[iii].getCalculateMinSize();
//Vector2b expand = this.subWidget[iii].propertyExpand.get();
//origin2 = origin2.add(this.propertyGravity.gravityGenerateDelta(minSize.less(localAvaillable)));
this.subWidget[iii].setOrigin(this.origin.add(deltaPadded));
this.subWidget[iii].setSize(subElementSize);
this.subWidget[iii].onChangeSize();
element.setOrigin(this.origin.add(deltaPadded));
element.setSize(subElementSize);
element.onChangeSize();
}
}
final Vector3f selectableAreaPos = this.origin.add(delta);//.less(padding.left(), padding.bottom(), padding.back());
final Vector3f selectableAreaEndPos = this.size.less(selectableAreaPos.add(subElementSize.add(padding.x(), padding.y(), padding.z())));
final Vector3f selectableAreaEndPos = this.size
.less(selectableAreaPos.add(subElementSize.add(padding.x(), padding.y(), padding.z())));
markToRedraw();
return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(), selectableAreaPos.y());
return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(),
selectableAreaPos.y());
}
@Override
@ -170,7 +175,7 @@ public class ContainerToggle extends Widget {
subWidgetRemove(idWidget);
this.subWidget[idWidget] = newWidget;
if (this.subWidget[idWidget] != null) {
Log.verbose("Add widget : " + idWidget);
LOGGER.trace("Add widget : " + idWidget);
this.subWidget[idWidget].setParent(this);
}
markToRedraw();
@ -185,7 +190,7 @@ public class ContainerToggle extends Widget {
public void subWidgetRemove(final int idWidget) {
if (this.subWidget[idWidget] != null) {
Log.verbose("Remove widget : " + idWidget);
LOGGER.trace("Remove widget : " + idWidget);
this.subWidget[idWidget].removeParent();
this.subWidget[idWidget] = null;
markToRedraw();
@ -207,7 +212,7 @@ public class ContainerToggle extends Widget {
haveChange = true;
}
if (!haveChange) {
Log.warning("Request replace with a wrong old widget");
LOGGER.warn("Request replace with a wrong old widget");
return;
}
markToRedraw();
@ -217,7 +222,7 @@ public class ContainerToggle extends Widget {
public void subWidgetUnLink(final int idWidget) {
if (this.subWidget[idWidget] != null) {
this.subWidget[idWidget].removeParent();
Log.verbose("Unlink widget : " + idWidget);
LOGGER.trace("Unlink widget : " + idWidget);
}
this.subWidget[idWidget] = null;
}
@ -231,10 +236,10 @@ public class ContainerToggle extends Widget {
super.systemDraw(displayProp);
if (this.subWidget[this.idWidgetDisplayed] != null) {
final DrawProperty prop = displayProp.withLimit(this.origin, this.size);
//Log.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
//LOGGER.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
this.subWidget[this.idWidgetDisplayed].systemDraw(prop);
} else {
Log.info("[" + getId() + "] ++++++ : [null]");
LOGGER.info("[" + getId() + "] ++++++ : [null]");
}
}
}

View File

@ -15,12 +15,14 @@ import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.GuiShape;
import org.atriasoft.ewol.compositing.ShapeBox;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Simple Container that have a Shape (not directly instantiate!!!!)
*/
public class ContainerWithShape extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerWithShape.class);
// properties
public Uri propertyShape = null; //!< Compositing theme.
@ -47,7 +49,7 @@ public class ContainerWithShape extends Container {
final Padding padding = this.shape.getPadding();
this.minSize = Vector3f.max(this.minSize, min.add(padding.x(), padding.y(), padding.z()));
}
Log.warning("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.warn("[{}] Result min size : {}", getId(), this.minSize);
}
@AknotManaged

View File

@ -21,13 +21,14 @@ import org.atriasoft.ewol.compositing.GuiShapeMode;
import org.atriasoft.ewol.event.EventEntry;
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.gale.context.ClipBoard;
import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @ingroup ewolWidgetGroup
@ -40,12 +41,14 @@ import org.atriasoft.gale.key.KeyType;
* ~~~~~~~~~~~~~~~~~~~~~~
*/
public class Entry extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Entry.class);
/**
* 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 + ")");
LOGGER.trace("Periodic call on Entry(" + event + ")");
if (!self.shape.periodicCall(event)) {
self.periodicConnectionHanble.close();
}
@ -112,7 +115,7 @@ public class Entry extends Widget {
this.regex = Pattern.compile(this.propertyRegex);
if (this.regex == null) {
Log.error("can not parse regex for : " + this.propertyRegex);
LOGGER.error("can not parse regex for : " + this.propertyRegex);
}
markToRedraw();
shortCutAdd("ctrl+w", "clean");
@ -142,14 +145,15 @@ public class Entry extends Widget {
this.minSize = Vector3f.max(this.minSize, minimumSizeBase);
// verify the min max of the min size ...
checkMinSize();
Log.error("min size = " + this.minSize);
LOGGER.error("min size = " + this.minSize);
}
protected void changeStatusIn(final GuiShapeMode newStatusId) {
if (this.shape.changeStatusIn(newStatusId)) {
if (!this.periodicConnectionHanble.isConnected()) {
Log.error("REQUEST: connection on operiodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, Entry::periodicCall);
LOGGER.error("REQUEST: connection on operiodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this,
Entry::periodicCall);
}
markToRedraw();
}
@ -246,14 +250,14 @@ public class Entry extends Widget {
} else if (value.equals("copy")) {
onCallbackCopy();
} else if (value.equals("paste")) {
Log.warning("Request past ...");
LOGGER.warn("Request past ...");
onCallbackPaste();
} else if (value.equals("select:all")) {
onCallbackSelect(true);
} else if (value.equals("select:none")) {
onCallbackSelect(false);
} else {
Log.warning("Unknow event from ShortCut : " + value);
LOGGER.warn("Unknow event from ShortCut : " + value);
}
}
@ -268,7 +272,7 @@ public class Entry extends Widget {
protected void onChangePropertyRegex() {
this.regex = Pattern.compile(this.propertyRegex);
if (this.regex != null) {
Log.error("can not parse regex for : " + this.propertyRegex);
LOGGER.error("can not parse regex for : " + this.propertyRegex);
}
markToRedraw();
}
@ -293,14 +297,14 @@ public class Entry extends Widget {
String newData = this.propertyValue;
if ((long) newData.length() > this.propertyMaxCharacter) {
newData = newData.substring(0, this.propertyMaxCharacter);
Log.debug("Limit entry set of data... " + newData);
LOGGER.debug("Limit entry set of data... " + newData);
}
// set the value with the check of the RegExp ...
setInternalValue(newData);
if (newData == this.propertyValue) {
this.displayCursorPos = this.propertyValue.length();
this.displayCursorPosSelection = this.displayCursorPos;
Log.verbose("Set : '" + newData + "'");
LOGGER.trace("Set : '" + newData + "'");
}
markToRedraw();
}
@ -339,7 +343,7 @@ public class Entry extends Widget {
@Override
public boolean onEventEntry(final EventEntry event) {
Log.verbose("Event on Entry ... " + event);
LOGGER.trace("Event on Entry ... " + event);
if (event.type() == KeyKeyboard.CHARACTER) {
if (event.status() == KeyStatus.down) {
// remove current selected data ...
@ -368,9 +372,9 @@ public class Entry extends Widget {
this.displayCursorPosSelection = this.displayCursorPos;
}
} else if (event.getChar() >= 20) {
Log.error("get data: '" + event.getChar() + "' = '" + event.getChar() + "'");
LOGGER.error("get data: '" + event.getChar() + "' = '" + event.getChar() + "'");
if ((long) this.propertyValue.length() > this.propertyMaxCharacter) {
Log.info("Reject data for entry : '" + event.getChar() + "'");
LOGGER.info("Reject data for entry : '" + event.getChar() + "'");
} else {
final StringBuilder newData = new StringBuilder(this.propertyValue);
newData.insert(this.displayCursorPos, event.getChar());
@ -417,14 +421,15 @@ public class Entry extends Widget {
public boolean onEventInput(final EventInput event) {
final Vector3f absolutePosition = new Vector3f(event.pos().x(), event.pos().y(), 0);
final Vector3f relPos = relativePosition(absolutePosition);
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
LOGGER.trace("Event on Input ... " + event + " relPos = " + relPos);
if (event.inputId() == 0) {
if (!isFocused()) {
if (KeyStatus.leave == event.status()) {
changeStatusIn(GuiShapeMode.NORMAL);
} else {
Log.verbose("Detect Over : " + this.overPositionStart + " -> " + this.overPositionStop);
if (relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y()) {
LOGGER.trace("Detect Over : " + this.overPositionStart + " -> " + this.overPositionStop);
if (relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y()
&& relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y()) {
changeStatusIn(GuiShapeMode.OVER);
} else {
changeStatusIn(GuiShapeMode.NORMAL);
@ -432,8 +437,9 @@ public class Entry extends Widget {
}
}
}
if (relPos.x() < this.overPositionStart.x() || relPos.y() < this.overPositionStart.y() || relPos.x() > this.overPositionStop.x() || relPos.y() > this.overPositionStop.y()) {
Log.warning("Reject {}", relPos);
if (relPos.x() < this.overPositionStart.x() || relPos.y() < this.overPositionStart.y()
|| relPos.x() > this.overPositionStop.x() || relPos.y() > this.overPositionStop.y()) {
LOGGER.warn("Reject {}", relPos);
return false;
}
if (event.inputId() == 1) {
@ -453,8 +459,10 @@ public class Entry extends Widget {
this.displayCursorPos = iii;
break;
}
if (!((this.propertyValue.charAt(iii) >= 'a' && this.propertyValue.charAt(iii) <= 'z') || (this.propertyValue.charAt(iii) >= 'A' && this.propertyValue.charAt(iii) <= 'Z')
|| (this.propertyValue.charAt(iii) >= '0' && this.propertyValue.charAt(iii) <= '9') || this.propertyValue.charAt(iii) == '_' || this.propertyValue.charAt(iii) == '-')) {
if (!((this.propertyValue.charAt(iii) >= 'a' && this.propertyValue.charAt(iii) <= 'z')
|| (this.propertyValue.charAt(iii) >= 'A' && this.propertyValue.charAt(iii) <= 'Z')
|| (this.propertyValue.charAt(iii) >= '0' && this.propertyValue.charAt(iii) <= '9')
|| this.propertyValue.charAt(iii) == '_' || this.propertyValue.charAt(iii) == '-')) {
this.displayCursorPos = iii;
break;
}
@ -465,8 +473,10 @@ public class Entry extends Widget {
this.displayCursorPosSelection = 0;
break;
}
if (!((this.propertyValue.charAt(iii) >= 'a' && this.propertyValue.charAt(iii) <= 'z') || (this.propertyValue.charAt(iii) >= 'A' && this.propertyValue.charAt(iii) <= 'Z')
|| (this.propertyValue.charAt(iii) >= '0' && this.propertyValue.charAt(iii) <= '9') || this.propertyValue.charAt(iii) == '_' || this.propertyValue.charAt(iii) == '-')) {
if (!((this.propertyValue.charAt(iii) >= 'a' && this.propertyValue.charAt(iii) <= 'z')
|| (this.propertyValue.charAt(iii) >= 'A' && this.propertyValue.charAt(iii) <= 'Z')
|| (this.propertyValue.charAt(iii) >= '0' && this.propertyValue.charAt(iii) <= '9')
|| this.propertyValue.charAt(iii) == '_' || this.propertyValue.charAt(iii) == '-')) {
this.displayCursorPosSelection = iii + 1;
break;
}
@ -494,7 +504,8 @@ public class Entry extends Widget {
markToRedraw();
}
} else if (KeyType.mouse == event.type() && event.inputId() == 2) {
if (event.status() == KeyStatus.down || event.status() == KeyStatus.move || event.status() == KeyStatus.up) {
if (event.status() == KeyStatus.down || event.status() == KeyStatus.move
|| event.status() == KeyStatus.up) {
keepFocus();
// updatethe cursor position :
updateCursorPosition(absolutePosition);
@ -530,7 +541,7 @@ public class Entry extends Widget {
if (!needRedraw()) {
//return;
}
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
//LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
this.shape.clear();
this.text.clear();
if (this.colorIdTextFg >= 0) {
@ -640,15 +651,15 @@ public class Entry extends Widget {
if (newData.length() > 0) {
/*
if (this.regex.parse(_newData, 0, _newData.size()) == false) {
Log.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "'" );
LOGGER.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "'" );
return;
}
if (this.regex.start() != 0) {
Log.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "' (start position error)" );
LOGGER.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "' (start position error)" );
return;
}
if (this.regex.stop() != _newData.size()) {
Log.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "' (stop position error)" );
LOGGER.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "' (stop position error)" );
return;
}
*/
@ -749,12 +760,12 @@ public class Entry extends Widget {
this.displayStartPosition = this.propertyValue.length();
}
if (this.displayStartPosition < 0) {
Log.error("wring cursor position : " + this.displayStartPosition + "/" + this.propertyValue.length());
LOGGER.error("wring cursor position : " + this.displayStartPosition + "/" + this.propertyValue.length());
this.displayStartPosition = 0;
}
String tmpDisplay = this.propertyValue.substring(0, this.displayStartPosition);
final int displayHidenSize = (int) this.text.calculateSize(tmpDisplay).x();
//Log.debug("hidenSize : " + displayHidenSize);
//LOGGER.debug("hidenSize : " + displayHidenSize);
int newCursorPosition = -1;
final int tmpTextOriginX = (int) padding.left();
for (int iii = 0; iii < this.propertyValue.length(); iii++) {
@ -808,7 +819,8 @@ public class Entry extends Widget {
} else {
// check if the Cursor is visible at 10px nearest the border :
final int tmp1 = this.displayCursorPositionPixel + this.displayStartPosition;
Log.debug("cursorPos=" + this.displayCursorPositionPixel + "px maxSize=" + tmpUserSize + "px tmp1=" + tmp1);
LOGGER.debug(
"cursorPos=" + this.displayCursorPositionPixel + "px maxSize=" + tmpUserSize + "px tmp1=" + tmp1);
if (tmp1 < 10) {
// set the cursor on the left
this.displayStartPosition = Math.min(-this.displayCursorPositionPixel + 10, 0);

View File

@ -10,12 +10,15 @@ import java.util.List;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @ingroup ewolWidgetGroup
*/
class Gird extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Gird.class);
protected class GirdProperties {
public Widget widget;
public int row;
@ -45,7 +48,7 @@ class Gird extends Widget {
this.sizeCol.set(iii, 0);
}
}
//Log.debug("Update minimum size");
//LOGGER.debug("Update minimum size");
this.minSize = this.propertyMinSize.getPixel();
this.maxSize = this.propertyMaxSize.getPixel();
this.uniformSizeRow = 0;
@ -59,12 +62,13 @@ class Gird extends Widget {
if (this.subWidget.get(iii).widget != null) {
this.subWidget.get(iii).widget.calculateMinMaxSize();
final Vector3f tmpSize = this.subWidget.get(iii).widget.getCalculateMinSize();
Log.debug(" [" + iii + "] subWidgetMinSize=" + tmpSize);
LOGGER.debug(" [" + iii + "] subWidgetMinSize=" + tmpSize);
// for all we get the max size :
this.uniformSizeRow = Math.max((int) tmpSize.y(), this.uniformSizeRow);
// for the colomn size : We set the autamatic value in negative :
if (this.sizeCol.get(this.subWidget.get(iii).col) <= 0) {
this.sizeCol.set(this.subWidget.get(iii).col, Math.min(this.sizeCol.get(this.subWidget.get(iii).col), (int) -tmpSize.x()));
this.sizeCol.set(this.subWidget.get(iii).col,
Math.min(this.sizeCol.get(this.subWidget.get(iii).col), (int) -tmpSize.x()));
}
}
}
@ -73,16 +77,16 @@ class Gird extends Widget {
this.uniformSizeRow = this.sizeRow;
}
int tmpSizeWidth = 0;
for (int iii = 0; iii < this.sizeCol.size(); iii++) {
tmpSizeWidth += Math.abs(this.sizeCol.get(iii));
for (final Integer element : this.sizeCol) {
tmpSizeWidth += Math.abs(element);
}
Log.debug(" tmpSizeWidth=" + tmpSizeWidth);
Log.debug(" this.uniformSizeRow=" + this.uniformSizeRow);
LOGGER.debug(" tmpSizeWidth=" + tmpSizeWidth);
LOGGER.debug(" this.uniformSizeRow=" + this.uniformSizeRow);
this.minSize = this.minSize.add(tmpSizeWidth, (lastLineID + 1) * this.uniformSizeRow, 0);
Log.debug("Calculate min size : " + this.minSize);
LOGGER.debug("Calculate min size : " + this.minSize);
//Log.debug("Vert Result : expand="+ this.userExpand + " minSize="+ this.minSize);
//LOGGER.debug("Vert Result : expand="+ this.userExpand + " minSize="+ this.minSize);
}
/**
@ -105,7 +109,7 @@ class Gird extends Widget {
}
return this.sizeCol.get(colId);
}
Log.error("Can not get the Colomn size : " + colId + 1 + " we have " + this.sizeCol.size() + " colomn");
LOGGER.error("Can not get the Colomn size : " + colId + 1 + " we have " + this.sizeCol.size() + " colomn");
return 0;
}
@ -133,7 +137,8 @@ class Gird extends Widget {
}
final Vector3f tmpSize = it.widget.getSize();
final Vector3f tmpOrigin = it.widget.getOrigin();
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
final Widget tmpWidget = it.widget.getWidgetAtPos(pos);
if (tmpWidget != null) {
return tmpWidget;
@ -147,8 +152,9 @@ class Gird extends Widget {
@Override
public void onChangeSize() {
//Log.debug("Update size");
this.size = this.size.less(this.propertyBorderSize.x() * 2, this.propertyBorderSize.y() * 2, this.propertyBorderSize.y() * 2);
//LOGGER.debug("Update size");
this.size = this.size.less(this.propertyBorderSize.x() * 2, this.propertyBorderSize.y() * 2,
this.propertyBorderSize.y() * 2);
for (int iii = 0; iii < this.subWidget.size(); iii++) {
if (this.subWidget.get(iii).widget != null) {
@ -171,16 +177,19 @@ class Gird extends Widget {
}
tmpOrigin = tmpOrigin.add(tmpSizeWidth, addingPos, 0);
Log.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin, new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0));
LOGGER.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin,
new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0));
// set the origin :
this.subWidget.get(iii).widget.setOrigin(tmpOrigin.clipInteger());
// all time set all the space .
this.subWidget.get(iii).widget.setSize((new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0)).clipInteger());
this.subWidget.get(iii).widget.setSize(
(new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0))
.clipInteger());
this.subWidget.get(iii).widget.onChangeSize();
}
}
this.size = this.size.add(this.propertyBorderSize.multiply(0.5f));
Log.debug("Calculate size : " + this.size);
LOGGER.debug("Calculate size : " + this.size);
markToRedraw();
}
@ -216,11 +225,12 @@ class Gird extends Widget {
this.subWidget.get(iii).widget = null;
// no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ...
if (errorControl == this.subWidget.size()) {
Log.critical(
"[" + getId() + "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function...");
LOGGER.error("[" + getId()
+ "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function...");
System.exit(-1);
}
} else {
Log.warning("[" + getId() + "] Must not have null pointer on the subWidget list ...");
LOGGER.warn("[" + getId() + "] Must not have null pointer on the subWidget list ...");
this.subWidget.remove(iii);
}
errorControl = this.subWidget.size();
@ -245,7 +255,8 @@ class Gird extends Widget {
if ((long) this.sizeCol.size() > colId) {
this.sizeCol.set(colId, size);
} else {
Log.error("Can not set the Colomn size : " + colId + 1 + " at " + size + "px we have " + this.sizeCol.size() + " colomn");
LOGGER.error("Can not set the Colomn size : " + colId + 1 + " at " + size + "px we have "
+ this.sizeCol.size() + " colomn");
}
}
@ -268,11 +279,11 @@ class Gird extends Widget {
public void setPropertyBorderSize(final Vector3f propertyBorderSize) {
this.propertyBorderSize = propertyBorderSize;
if (this.propertyBorderSize.x() < 0) {
Log.error("Try to set a border size <0 on x : " + this.propertyBorderSize.x() + " == > restore to 0");
LOGGER.error("Try to set a border size <0 on x : " + this.propertyBorderSize.x() + " == > restore to 0");
this.propertyBorderSize = this.propertyBorderSize.withX(0);
}
if (this.propertyBorderSize.y() < 0) {
Log.error("Try to set a border size <0 on y : " + this.propertyBorderSize.y() + " == > restore to 0");
LOGGER.error("Try to set a border size <0 on y : " + this.propertyBorderSize.y() + " == > restore to 0");
this.propertyBorderSize = this.propertyBorderSize.withY(0);
}
markToRedraw();
@ -310,19 +321,17 @@ class Gird extends Widget {
// find a new position;
this.subWidget.add(iii, prop);
return;
} else if (this.subWidget.get(iii).col < prop.col) {
continue;
} else if (this.subWidget.get(iii).col > prop.col) {
// find a new position;
this.subWidget.add(iii, prop);
return;
} else {
if (this.subWidget.get(iii).col < prop.col) {
continue;
} else if (this.subWidget.get(iii).col > prop.col) {
// find a new position;
this.subWidget.add(iii, prop);
return;
} else {
// The element already exist == > replace it ...
this.tmpWidget = this.subWidget.get(iii).widget;
this.subWidget.get(iii).widget = newWidget;
this.tmpWidget = null;
}
// The element already exist == > replace it ...
this.tmpWidget = this.subWidget.get(iii).widget;
this.subWidget.get(iii).widget = newWidget;
this.tmpWidget = null;
}
}
// not find == > just adding it ...
@ -336,7 +345,7 @@ class Gird extends Widget {
*/
public void subWidgetRemove(final int colId, final int rowId) {
if (colId < 0 || rowId < 0) {
Log.warning("[" + getId() + "] try to remove widget with id < 0 col=" + colId + " row=" + rowId);
LOGGER.warn("[" + getId() + "] try to remove widget with id < 0 col=" + colId + " row=" + rowId);
return;
}
final int errorControl = this.subWidget.size();
@ -347,7 +356,7 @@ class Gird extends Widget {
return;
}
}
Log.warning("[" + getId() + "] Can not remove unExistant widget");
LOGGER.warn("[" + getId() + "] Can not remove unExistant widget");
}
/**
@ -361,7 +370,7 @@ class Gird extends Widget {
return;
}
}
Log.warning("[" + getId() + "] Can not remove unExistant widget");
LOGGER.warn("[" + getId() + "] Can not remove unExistant widget");
}
/**
@ -379,7 +388,7 @@ class Gird extends Widget {
*/
public void subWidgetUnLink(final int colId, final int rowId) {
if (colId < 0 || rowId < 0) {
Log.warning("[" + getId() + "] try to Unlink widget with id < 0 col=" + colId + " row=" + rowId);
LOGGER.warn("[" + getId() + "] try to Unlink widget with id < 0 col=" + colId + " row=" + rowId);
return;
}
// try to find it ...
@ -389,7 +398,7 @@ class Gird extends Widget {
return;
}
}
Log.warning("[" + getId() + "] Can not unLink unExistant widget");
LOGGER.warn("[" + getId() + "] Can not unLink unExistant widget");
}
/**

View File

@ -19,11 +19,13 @@ import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
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.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ImageDisplay extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(ImageDisplay.class);
protected int colorId = -1; //!< Color of the image.
protected ResourceColorFile colorProperty = null; //!< theme color property
protected CompositingImage compositing = new CompositingImage(); //!< compositing element of the image.
@ -50,30 +52,32 @@ public class ImageDisplay extends Widget {
@Override
public void calculateMinMaxSize() {
Log.debug("calculate min size: border=" + this.propertyBorder + " size=" + this.propertyImageSize + " min-size=" + this.propertyMinSize);
LOGGER.debug("calculate min size: border=" + this.propertyBorder + " size=" + this.propertyImageSize
+ " min-size=" + this.propertyMinSize);
final Vector2f imageBoder = this.propertyBorder.getPixel().multiply(2.0f);
final Vector2f imageSize = this.propertyImageSize.getPixel();
final Vector3f size = this.propertyMinSize.getPixel();
Log.debug(" ==> border=" + imageBoder + " size=" + imageSize + " min-size=" + size);
LOGGER.debug(" ==> border=" + imageBoder + " size=" + imageSize + " min-size=" + size);
if (!imageSize.isZero()) {
final Vector2f tmp = imageBoder.add(imageSize);
this.minSize = new Vector3f(tmp.x(), tmp.y(), 0);
this.maxSize = this.minSize;
} else {
final Vector2i imageSizeReal = this.getPropertyMinSize().getPixeli();//.compositing.getRealSize();
Log.verbose(" Real Size = " + imageSizeReal);
final Vector2i imageSizeReal = getPropertyMinSize().getPixeli();//.compositing.getRealSize();
LOGGER.trace(" Real Size = " + imageSizeReal);
final Vector3f min1 = this.propertyMinSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0);
this.minSize = new Vector3f(imageBoder.x() + imageSizeReal.x(), imageBoder.y() + imageSizeReal.y(), 0);
Log.verbose(" set max : " + this.minSize + " min1=" + min1);
LOGGER.trace(" set max : " + this.minSize + " min1=" + min1);
this.minSize = Vector3f.max(this.minSize, min1);
Log.verbose(" result : " + this.minSize);
LOGGER.trace(" result : " + this.minSize);
this.maxSize = this.propertyMaxSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0);
this.minSize = Vector3f.min(this.minSize, this.maxSize);
}
this.imageRenderSize = new Vector2f(this.minSize.x(), this.minSize.y());
this.minSize = Vector3f.max(this.minSize, size);
this.maxSize = Vector3f.max(this.maxSize, this.minSize);
Log.debug("set widget min=" + this.minSize + " max=" + this.maxSize + " with real Image size=" + this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize);
LOGGER.debug("set widget min=" + this.minSize + " max=" + this.maxSize + " with real Image size="
+ this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize);
markToRedraw();
}
@ -148,7 +152,7 @@ public class ImageDisplay extends Widget {
@Override
public boolean onEventInput(final EventInput event) {
//Log.debug("Event on BT ...");
//LOGGER.debug("Event on BT ...");
if (event.inputId() == 1) {
if (KeyStatus.pressSingle == event.status()) {
this.signalPressed.emit();
@ -178,7 +182,8 @@ public class ImageDisplay extends Widget {
final Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart);
//imageRealSizeMax *= ratioSizeDisplayRequested;
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y(), 0));
Vector3f delta = this.propertyGravity
.gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y(), 0));
if (this.propertyFill.x()) {
imageRealSize = imageRealSize.withX(imageRealSizeMax.x());
delta = delta.withX(0.0f);
@ -192,7 +197,8 @@ public class ImageDisplay extends Widget {
if (this.propertyKeepRatio) {
final Vector2i tmpSize = this.compositing.getRealSize();
//float ratio = tmpSize.x() / tmpSize.y();
final float ratio = (tmpSize.x() * ratioSizeDisplayRequested.x()) / (tmpSize.y() * ratioSizeDisplayRequested.y());
final float ratio = (tmpSize.x() * ratioSizeDisplayRequested.x())
/ (tmpSize.y() * ratioSizeDisplayRequested.y());
//float ratioCurrent = (imageRealSize.x()*ratioSizeDisplayRequested.x()) / (imageRealSize.y() * ratioSizeDisplayRequested.y());
final float ratioCurrent = imageRealSize.x() / imageRealSize.y();
if (ratio == ratioCurrent) {
@ -215,9 +221,10 @@ public class ImageDisplay extends Widget {
this.compositing.setPos(Vector3f.clipInt(origin));
}
this.compositing.printPart(imageRealSize, this.propertyPosStart, this.propertyPosStop);
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);
LOGGER.debug("Paint Image at : " + origin + " size=" + imageRealSize);
LOGGER.debug("Paint Image :" + this.propertySource + " realsize=" + this.compositing.getRealSize() + " origin="
+ origin + " size=" + imageRealSize);
LOGGER.debug(" start=" + this.propertyPosStart + " stop=" + this.propertyPosStop);
this.compositing.flush();
}
@ -227,7 +234,7 @@ public class ImageDisplay extends Widget {
* @param border New border size to set
*/
public void set(final Uri uri, final Dimension2f border) {
Log.verbose("Set Image : " + uri + " border=" + border);
LOGGER.trace("Set Image : " + uri + " border=" + border);
setPropertyBorder(border);
setPropertySource(uri);
}
@ -259,7 +266,7 @@ public class ImageDisplay extends Widget {
this.propertyImageSize = propertyImageSize;
markToRedraw();
requestUpdateSize();
Log.verbose("Set sources : " + this.propertySource + " size=" + propertyImageSize);
LOGGER.trace("Set sources : " + this.propertySource + " size=" + propertyImageSize);
this.compositing.setSource(this.propertySource, propertyImageSize.getPixeli());
}
@ -305,7 +312,7 @@ public class ImageDisplay extends Widget {
this.propertySource = propertySource;
markToRedraw();
requestUpdateSize();
Log.verbose("Set sources : " + propertySource + " size=" + this.propertyImageSize);
LOGGER.trace("Set sources : " + propertySource + " size=" + this.propertyImageSize);
this.compositing.setSource(propertySource, this.propertyImageSize.getPixeli());
}

View File

@ -20,11 +20,13 @@ import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.AlignMode;
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.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Label extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Label.class);
@AknotSignal
@AknotName("pressed")
@AknotDescription("Label is pressed")
@ -56,7 +58,7 @@ public class Label extends Widget {
@Override
public void calculateMinMaxSize() {
Log.verbose("calculateMinMaxSize !!! data = '{}'", this.value);
LOGGER.trace("calculateMinMaxSize !!! data = '{}'", this.value);
final Vector3f tmpMax = this.propertyMaxSize.getPixel();
final Vector3f tmpMin = this.propertyMinSize.getPixel();
//EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} tmpMax : " + tmpMax);
@ -74,7 +76,7 @@ public class Label extends Widget {
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), //
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), //
10);
Log.verbose("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
}
public int getPropertyFontSize() {
@ -96,7 +98,7 @@ public class Label extends Widget {
@Override
public boolean onEventInput(final EventInput event) {
//Log.debug("Event on Label ...");
//LOGGER.debug("Event on Label ...");
if (event.inputId() == 1) {
if (KeyStatus.pressSingle == event.status()) {
// nothing to do ...
@ -131,7 +133,8 @@ public class Label extends Widget {
Vector3f tmpSizeShaper = this.minSize;
// no change for the text origin :
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - minSize.x()) * 0.5f, (this.size.y() - minSize.y()) * 0.5f, 0);
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - minSize.x()) * 0.5f,
(this.size.y() - minSize.y()) * 0.5f, 0);
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) {
@ -155,12 +158,14 @@ public class Label extends Widget {
//localSize = localSize.less(2 * paddingSize, 2 * paddingSize, 0);
//tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y());
tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + this.minSize.y() - this.textCompose.getHeight() - padding.top());// - this.minSize.y() - paddingSize);
tmpTextOrigin = tmpTextOrigin
.withY(tmpTextOrigin.y() + this.minSize.y() - this.textCompose.getHeight() - padding.top());// - this.minSize.y() - paddingSize);
tmpTextOrigin = tmpTextOrigin.withX(tmpTextOrigin.x() + padding.left());
final Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0);
final Vector3f drawClippingPos = tmpOriginShaper.less(new Vector3f(padding.left(), padding.bottom(), padding.back()));
final Vector3f drawClippingPos = tmpOriginShaper
.less(new Vector3f(padding.left(), padding.bottom(), padding.back()));
final Vector3f drawClippingSize = tmpOriginShaper.add(tmpSizeShaper); /// new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
// clean the element
@ -173,7 +178,7 @@ public class Label extends Widget {
this.textCompose.setDefaultColorBg(this.colorProperty.get(this.colorDefaultBgText));
}
this.textCompose.setPos(tmpTextOrigin);
Log.verbose("[{}] '{}' display at pos={}, size={}", getId(), this.value, tmpTextOrigin, this.size);
LOGGER.trace("[{}] '{}' display at pos={}, size={}", getId(), this.value, tmpTextOrigin, this.size);
this.textCompose.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + tmpSizeText.x(), AlignMode.LEFT);
this.textCompose.setClipping(drawClippingPos, drawClippingSize);
this.textCompose.printDecorated(this.value);

View File

@ -19,11 +19,13 @@ import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.compositing.AlignMode;
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.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LabelOnSVG extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(LabelOnSVG.class);
protected int colorDefaultBgText = -1; //!< Default Background color of the text
protected int colorDefaultFgText = -1; //!< Default color of the text
protected ResourceColorFile colorProperty; //!< theme color property
@ -67,16 +69,18 @@ public class LabelOnSVG extends Widget {
public void calculateMinMaxSize() {
final Vector3f tmpMax = this.propertyMaxSize.getPixel();
final Vector3f tmpMin = this.propertyMinSize.getPixel();
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT);
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement ");
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement ");
}
final Vector3f minSize = this.text.calculateSizeDecorated(this.value);
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), FMath.avg(tmpMin.z(), 4 + minSize.z(), tmpMax.z()));
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < " + this.minSize + " < " + tmpMax);
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()),
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), FMath.avg(tmpMin.z(), 4 + minSize.z(), tmpMax.z()));
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < "
+ this.minSize + " < " + tmpMax);
}
public int getPropertyFontSize() {
@ -98,7 +102,7 @@ public class LabelOnSVG extends Widget {
@Override
public boolean onEventInput(final EventInput event) {
//Log.debug("Event on Label ...");
//LOGGER.debug("Event on Label ...");
if (event.inputId() == 1) {
if (KeyStatus.pressSingle == event.status()) {
// nothing to do ...
@ -131,7 +135,8 @@ public class LabelOnSVG extends Widget {
Vector2i localSize = new Vector2i((int) this.minSize.x(), (int) this.minSize.y());
// no change for the text origin :
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - this.minSize.x()) / 2.0f, (this.size.y() - this.minSize.y()) / 2.0f, 0);
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - this.minSize.x()) / 2.0f,
(this.size.y() - this.minSize.y()) / 2.0f, 0);
if (this.propertyFill.x()) {
localSize = localSize.withX((int) this.size.x());
@ -161,7 +166,7 @@ public class LabelOnSVG extends Widget {
this.text.setDefaultColorBg(this.colorProperty.get(this.colorDefaultBgText));
}
this.text.setPos(tmpTextOrigin);
Log.verbose("[" + getId() + "] {" + this.value + "} display at pos : " + tmpTextOrigin);
LOGGER.trace("[" + getId() + "] {" + this.value + "} display at pos : " + tmpTextOrigin);
this.text.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + localSize.x(), AlignMode.LEFT);
this.text.setClipping(drawClippingPos, drawClippingSize);
this.text.printDecorated(this.value);

View File

@ -29,15 +29,17 @@ import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.math.Vector3i;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.ResourceColorFile;
import org.atriasoft.ewol.widget.model.ListRole;
import org.atriasoft.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Generic display folder class. This widget display the content of a single folder :
*/
public class ListFileSystem extends WidgetList {
private static final Logger LOGGER = LoggerFactory.getLogger(ListFileSystem.class);
@AknotSignal
@AknotName(value = "file-select")
@AknotDescription(value = "A file has been selected in the List")
@ -114,7 +116,8 @@ public class ListFileSystem extends WidgetList {
}
}
if (pos.y() - offset >= 0 && pos.y() - offset < this.list.size()) {
Log.verbose("get filename for : {}:'{}'", this.list.get(pos.y() - offset), this.list.get(pos.y() - offset).getName());
LOGGER.trace("get filename for : {}:'{}'", this.list.get(pos.y() - offset),
this.list.get(pos.y() - offset).getName());
return this.list.get(pos.y() - offset).getName();
}
}
@ -207,7 +210,11 @@ public class ListFileSystem extends WidgetList {
return this.propertyShowHidden;
}
public List<File> listSelectedFiles(final String dir, final boolean showFiles, final boolean showFolder, final boolean showHidden) throws IOException {
public List<File> listSelectedFiles(
final String dir,
final boolean showFiles,
final boolean showFolder,
final boolean showHidden) throws IOException {
final List<File> fileList = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(dir))) {
for (final Path path : stream) {
@ -215,11 +222,11 @@ public class ListFileSystem extends WidgetList {
continue;
}
if (Files.isDirectory(path) && showFolder) {
Log.error("Add Directory '{}'", path);
LOGGER.error("Add Directory '{}'", path);
fileList.add(new File(path.toString()));
}
if (!Files.isDirectory(path) && showFiles) {
Log.error("Add File '{}'", path);
LOGGER.error("Add File '{}'", path);
fileList.add(new File(path.toString()));
}
}
@ -238,7 +245,7 @@ public class ListFileSystem extends WidgetList {
}
}
if (event.status() == KeyStatus.pressSingle || event.status() == KeyStatus.pressDouble) {
Log.verbose("Event on List : IdInput=" + event.inputId() + " _pos=" + pos);
LOGGER.trace("Event on List : IdInput=" + event.inputId() + " _pos=" + pos);
if (1 == event.inputId()) {
if (pos.y() > this.list.size() + offset) {
this.selectedLine = -1;
@ -267,12 +274,10 @@ public class ListFileSystem extends WidgetList {
} else {
this.signalFolderValidate.emit(this.list.get(this.selectedLine - offset).getPath());
}
} else if (event.status() == KeyStatus.pressSingle) {
this.signalFileSelect.emit(this.list.get(this.selectedLine - offset).getPath());
} else {
if (event.status() == KeyStatus.pressSingle) {
this.signalFileSelect.emit(this.list.get(this.selectedLine - offset).getPath());
} else {
this.signalFileValidate.emit(this.list.get(this.selectedLine - offset).getPath());
}
this.signalFileValidate.emit(this.list.get(this.selectedLine - offset).getPath());
}
}
// need to regenerate the display of the list :
@ -293,7 +298,8 @@ public class ListFileSystem extends WidgetList {
this.originScrooled = new Vector2f(0, 0);
final int flags = 0;
try {
this.list = listSelectedFiles(this.propertyPath, this.propertyShowFile, this.propertyShowFolder, this.propertyShowHidden);
this.list = listSelectedFiles(this.propertyPath, this.propertyShowFile, this.propertyShowFolder,
this.propertyShowHidden);
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@ -20,11 +20,13 @@ import org.atriasoft.ewol.HighSpeedMode;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.GuiShape;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class Scroll extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Scroll.class);
protected static final int SCROLL_BAR_SPACE = 15;
protected Vector3f propertyLimit = new Vector3f(0.15f, 0.5f, 0.0f); //!< Set the limitation of the ratio in the screen
@ -161,7 +163,7 @@ class Scroll extends Container {
} else if (this.propertyGravity.y() == GravityVertical.BOTTOM) {
// nothing to do ... origin +=
} else {
Log.error(" Not manage other gravity ...");
LOGGER.error(" Not manage other gravity ...");
}
this.subWidget.setOrigin(origin);
this.subWidget.onChangeSize();
@ -184,9 +186,10 @@ class Scroll extends Container {
scrollOffset = this.subWidget.getOffset();
scrollSize = this.subWidget.getSize();
}
Log.verbose("Get Event on scroll : " + event);
LOGGER.trace("Get Event on scroll : " + event);
relativePos = relativePos.withY(this.size.y() - relativePos.y());
if (event.type() == KeyType.mouse && (this.highSpeedType == KeyType.unknow || this.highSpeedType == KeyType.mouse)) {
if (event.type() == KeyType.mouse
&& (this.highSpeedType == KeyType.unknow || this.highSpeedType == KeyType.mouse)) {
if (event.inputId() == 1 && event.status() == KeyStatus.down) {
// check if selected the scrolling position whth the scrolling bar ...
if (relativePos.x() >= (this.size.x() - SCROLL_BAR_SPACE)) {
@ -194,11 +197,14 @@ class Scroll extends Container {
this.highSpeedMode = HighSpeedMode.speedModeEnableVertical;
this.highSpeedType = KeyType.mouse;
this.highSpeedStartPos = this.highSpeedStartPos.withX(relativePos.x());
this.highSpeedStartPos = this.highSpeedStartPos.withY(scrollOffset.y() / scrollSize.y() * (this.size.y() - SCROLL_BAR_SPACE * 2));
this.highSpeedStartPos = this.highSpeedStartPos
.withY(scrollOffset.y() / scrollSize.y() * (this.size.y() - SCROLL_BAR_SPACE * 2));
this.highSpeedButton = 1;
// force direct scrolling in this case
scrollOffset = scrollOffset.withY((int) (scrollSize.y() * (relativePos.y() - SCROLL_BAR_SPACE) / (this.size.y() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(), (scrollSize.y() - this.size.y() * this.propertyLimit.y())));
scrollOffset = scrollOffset.withY((int) (scrollSize.y() * (relativePos.y() - SCROLL_BAR_SPACE)
/ (this.size.y() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(),
(scrollSize.y() - this.size.y() * this.propertyLimit.y())));
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -209,12 +215,15 @@ class Scroll extends Container {
if (this.size.x() < scrollSize.x() || scrollOffset.x() != 0) {
this.highSpeedMode = HighSpeedMode.speedModeEnableHorizontal;
this.highSpeedType = KeyType.mouse;
this.highSpeedStartPos = this.highSpeedStartPos.withX(scrollOffset.x() / scrollSize.x() * (this.size.x() - SCROLL_BAR_SPACE * 2));
this.highSpeedStartPos = this.highSpeedStartPos
.withX(scrollOffset.x() / scrollSize.x() * (this.size.x() - SCROLL_BAR_SPACE * 2));
this.highSpeedStartPos = this.highSpeedStartPos.withY(relativePos.y());
this.highSpeedButton = 1;
// force direct scrolling in this case
scrollOffset = scrollOffset.withX((int) (scrollSize.x() * (relativePos.x() - SCROLL_BAR_SPACE) / (this.size.x() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.x(), (scrollSize.x() - this.size.x() * this.propertyLimit.x())));
scrollOffset = scrollOffset.withX((int) (scrollSize.x() * (relativePos.x() - SCROLL_BAR_SPACE)
/ (this.size.x() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.x(),
(scrollSize.x() - this.size.x() * this.propertyLimit.x())));
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -224,10 +233,11 @@ class Scroll extends Container {
}
return false;
} else if (event.inputId() == 4 && event.status() == KeyStatus.up) {
Log.verbose(" mode UP " + this.size.y() + "<" + scrollSize.y());
LOGGER.trace(" mode UP " + this.size.y() + "<" + scrollSize.y());
if (this.size.y() < scrollSize.y()) {
scrollOffset = scrollOffset.withY(scrollOffset.y() - this.pixelScrolling);
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(), (scrollSize.y() - this.size.y() * this.propertyLimit.y())));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(),
(scrollSize.y() - this.size.y() * this.propertyLimit.y())));
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -235,10 +245,11 @@ class Scroll extends Container {
return true;
}
} else if (event.inputId() == 5 && event.status() == KeyStatus.up) {
Log.verbose(" mode DOWN " + this.size.y() + "<" + scrollSize.y());
LOGGER.trace(" mode DOWN " + this.size.y() + "<" + scrollSize.y());
if (this.size.y() < scrollSize.y()) {
scrollOffset = scrollOffset.withY(scrollOffset.y() + this.pixelScrolling);
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(), (scrollSize.y() - this.size.y() * this.propertyLimit.y())));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(),
(scrollSize.y() - this.size.y() * this.propertyLimit.y())));
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -282,7 +293,8 @@ class Scroll extends Container {
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeInit && event.status() == KeyStatus.move) {
// wait that the cursor move more than 10 px to enable it :
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10 || FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10
|| FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
// the scrooling can start :
// select the direction :
if (relativePos.x() == this.highSpeedStartPos.x()) {
@ -290,7 +302,8 @@ class Scroll extends Container {
} else if (relativePos.y() == this.highSpeedStartPos.y()) {
this.highSpeedMode = HighSpeedMode.speedModeEnableHorizontal;
} else {
final float coef = (relativePos.y() - this.highSpeedStartPos.y()) / (relativePos.x() - this.highSpeedStartPos.x());
final float coef = (relativePos.y() - this.highSpeedStartPos.y())
/ (relativePos.x() - this.highSpeedStartPos.x());
if (FMath.abs(coef) <= 1) {
this.highSpeedMode = HighSpeedMode.speedModeEnableHorizontal;
} else {
@ -298,21 +311,26 @@ class Scroll extends Container {
}
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableHorizontal) {
this.highSpeedStartPos = this.highSpeedStartPos.withX(scrollOffset.x() / scrollSize.x() * (this.size.x() - SCROLL_BAR_SPACE * 2));
this.highSpeedStartPos = this.highSpeedStartPos
.withX(scrollOffset.x() / scrollSize.x() * (this.size.x() - SCROLL_BAR_SPACE * 2));
} else {
this.highSpeedStartPos = this.highSpeedStartPos.withY(scrollOffset.y() / scrollSize.y() * (this.size.y() - SCROLL_BAR_SPACE * 2));
this.highSpeedStartPos = this.highSpeedStartPos
.withY(scrollOffset.y() / scrollSize.y() * (this.size.y() - SCROLL_BAR_SPACE * 2));
}
markToRedraw();
}
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(), (scrollSize.y() - this.size.y() * this.propertyLimit.y())));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(),
(scrollSize.y() - this.size.y() * this.propertyLimit.y())));
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
}
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableHorizontal && event.status() == KeyStatus.move) {
scrollOffset = scrollOffset.withX((int) (scrollSize.x() * (relativePos.x() - SCROLL_BAR_SPACE) / (this.size.x() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withX(FMath.avg(0.0f, scrollOffset.x(), (scrollSize.x() - this.size.x() * this.propertyLimit.x())));
scrollOffset = scrollOffset.withX((int) (scrollSize.x() * (relativePos.x() - SCROLL_BAR_SPACE)
/ (this.size.x() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withX(FMath.avg(0.0f, scrollOffset.x(),
(scrollSize.x() - this.size.x() * this.propertyLimit.x())));
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -320,8 +338,10 @@ class Scroll extends Container {
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableVertical && event.status() == KeyStatus.move) {
scrollOffset = scrollOffset.withY((int) (scrollSize.y() * (relativePos.y() - SCROLL_BAR_SPACE) / (this.size.y() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(), (scrollSize.y() - this.size.y() * this.propertyLimit.x())));
scrollOffset = scrollOffset.withY((int) (scrollSize.y() * (relativePos.y() - SCROLL_BAR_SPACE)
/ (this.size.y() - SCROLL_BAR_SPACE * 2)));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(),
(scrollSize.y() - this.size.y() * this.propertyLimit.x())));
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -329,46 +349,54 @@ class Scroll extends Container {
return true;
}
}
} else if (KeyType.finger == event.type() && (KeyType.unknow == this.highSpeedType || KeyType.finger == this.highSpeedType)) {
} else if (KeyType.finger == event.type()
&& (KeyType.unknow == this.highSpeedType || KeyType.finger == this.highSpeedType)) {
if (1 == event.inputId()) {
Log.verbose("event: " + event);
LOGGER.trace("event: " + event);
if (KeyStatus.down == event.status()) {
this.highSpeedMode = HighSpeedMode.speedModeInit;
this.highSpeedType = KeyType.finger;
this.highSpeedStartPos = new Vector3f(relativePos.x(), relativePos.y(), 0);
Log.verbose("SCROOL == > INIT pos=" + this.highSpeedStartPos + " && curent scrollOffset=" + scrollOffset);
LOGGER.trace("SCROOL == > INIT pos=" + this.highSpeedStartPos + " && curent scrollOffset="
+ scrollOffset);
return true;
} else if (KeyStatus.upAfter == event.status()) {
this.highSpeedMode = HighSpeedMode.speedModeDisable;
this.highSpeedType = KeyType.unknow;
Log.verbose("SCROOL == > DISABLE");
LOGGER.trace("SCROOL == > DISABLE");
markToRedraw();
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeInit && KeyStatus.move == event.status()) {
// wait that the cursor move more than 10 px to enable it :
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10 || FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10
|| FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
// the scrooling can start :
// select the direction :
this.highSpeedMode = HighSpeedMode.speedModeEnableFinger;
Log.verbose("SCROOL == > ENABLE");
LOGGER.trace("SCROOL == > ENABLE");
markToRedraw();
}
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger && KeyStatus.move == event.status()) {
Log.verbose("SCROOL == > INIT scrollOffset=" + scrollOffset.y() + " relativePos=" + relativePos.y() + " this.highSpeedStartPos=" + this.highSpeedStartPos.y());
LOGGER.trace("SCROOL == > INIT scrollOffset=" + scrollOffset.y() + " relativePos="
+ relativePos.y() + " this.highSpeedStartPos=" + this.highSpeedStartPos.y());
//scrollOffset.x = (int)(scrollSize.x * x / this.size.x);
if (this.propertyLimit.x() != 0.0f) {
scrollOffset = scrollOffset.withX(scrollOffset.x() + (relativePos.x() - this.highSpeedStartPos.x()));
scrollOffset = scrollOffset.withX(FMath.avg(0.0f, scrollOffset.x(), (scrollSize.x() - this.size.x() * this.propertyLimit.x())));
scrollOffset = scrollOffset
.withX(scrollOffset.x() + (relativePos.x() - this.highSpeedStartPos.x()));
scrollOffset = scrollOffset.withX(FMath.avg(0.0f, scrollOffset.x(),
(scrollSize.x() - this.size.x() * this.propertyLimit.x())));
}
if (this.propertyLimit.y() != 0.0f) {
scrollOffset = scrollOffset.withY(scrollOffset.y() - (relativePos.y() - this.highSpeedStartPos.y()));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(), (scrollSize.y() - this.size.y() * this.propertyLimit.y())));
scrollOffset = scrollOffset
.withY(scrollOffset.y() - (relativePos.y() - this.highSpeedStartPos.y()));
scrollOffset = scrollOffset.withY(FMath.avg(0.0f, scrollOffset.y(),
(scrollSize.y() - this.size.y() * this.propertyLimit.y())));
}
// update current position:
this.highSpeedStartPos = relativePos;
Log.verbose("SCROOL == > MOVE " + scrollOffset);
LOGGER.trace("SCROOL == > MOVE " + scrollOffset);
markToRedraw();
if (this.subWidget != null) {
this.subWidget.setOffset(scrollOffset);
@ -381,7 +409,7 @@ class Scroll extends Container {
} else if (this.highSpeedMode != HighSpeedMode.speedModeDisable && KeyStatus.leave == event.status()) {
this.highSpeedMode = HighSpeedMode.speedModeDisable;
this.highSpeedType = KeyType.unknow;
Log.verbose("SCROOL == > DISABLE");
LOGGER.trace("SCROOL == > DISABLE");
markToRedraw();
return true;
}
@ -416,16 +444,20 @@ class Scroll extends Container {
float originScrollBar = scrollOffset.y() / (scrollSize.y() - this.size.y() * this.propertyLimit.y());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.y() - lenScrollBar);
this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0), new Vector2f(paddingVert.x(), this.size.y()),
new Vector2f(this.size.x() - paddingVert.right(), this.size.y() - originScrollBar - lenScrollBar), new Vector2f(0, lenScrollBar));
this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0),
new Vector2f(paddingVert.x(), this.size.y()),
new Vector2f(this.size.x() - paddingVert.right(), this.size.y() - originScrollBar - lenScrollBar),
new Vector2f(0, lenScrollBar));
}
if (this.size.x() < scrollSize.x() || scrollOffset.x() != 0) {
float lenScrollBar = (this.size.x() - paddingHori.left()) * (this.size.x() - paddingVert.x()) / scrollSize.x();
float lenScrollBar = (this.size.x() - paddingHori.left()) * (this.size.x() - paddingVert.x())
/ scrollSize.x();
lenScrollBar = FMath.avg(10.0f, lenScrollBar, (this.size.x() - paddingVert.x()));
float originScrollBar = scrollOffset.x() / (scrollSize.x() - this.size.x() * this.propertyLimit.x());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.x() - paddingHori.right() - lenScrollBar);
this.shaperH.setShape(Vector2f.ZERO, new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()), new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));
this.shaperH.setShape(Vector2f.ZERO, new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()),
new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));
}
}

View File

@ -15,9 +15,12 @@ import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector3b;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.math.Vector3i;
import org.atriasoft.ewol.internal.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Sizer extends ContainerN {
private static final Logger LOGGER = LoggerFactory.getLogger(Sizer.class);
@AknotCaseSensitive(value = false)
public enum DisplayMode {
HORIZONTAL, //!< Horizontal mode
@ -44,11 +47,11 @@ public class Sizer extends ContainerN {
@Override
public void calculateMinMaxSize() {
Log.verbose("[" + getId() + "] update minimum size");
LOGGER.trace("[" + getId() + "] update minimum size");
this.subExpend = Vector3b.FALSE;
this.minSize = this.propertyMinSize.getPixel();
final Vector3f tmpBorderSize = this.propertyBorderSize.getPixel();
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} set min size : " + this.minSize);
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} set min size : " + this.minSize);
for (final Widget it : this.subWidget) {
if (it == null) {
continue;
@ -61,8 +64,8 @@ public class Sizer extends ContainerN {
this.subExpend = this.subExpend.withY(true);
}
final Vector3f tmpSize = it.getCalculateMinSize();
Log.verbose("[" + getId() + "] NewMinSize=" + tmpSize);
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} Get minSize=" + tmpSize);
LOGGER.trace("[" + getId() + "] NewMinSize=" + tmpSize);
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Get minSize=" + tmpSize);
if (this.propertyMode == DisplayMode.VERTICAL) {
this.minSize = this.minSize.withY(this.minSize.y() + tmpSize.y());
if (tmpSize.x() > this.minSize.x()) {
@ -76,7 +79,7 @@ public class Sizer extends ContainerN {
}
}
this.minSize = this.minSize.add(tmpBorderSize.multiply(2));
Log.verbose("[{}] Result min size : {}", getId(), this.minSize);
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
}
@AknotManaged
@ -99,7 +102,8 @@ public class Sizer extends ContainerN {
public void onChangeSize() {
super.onChangeSize();
final Vector3f tmpBorderSize = this.propertyBorderSize.getPixel();
Log.verbose("[" + getId() + "] update size : " + this.size + " nbElement : " + this.subWidget.size() + " borderSize=" + tmpBorderSize + " from border=" + this.propertyBorderSize);
LOGGER.trace("[" + getId() + "] update size : " + this.size + " nbElement : " + this.subWidget.size()
+ " borderSize=" + tmpBorderSize + " from border=" + this.propertyBorderSize);
final Vector3f localWidgetSize = this.size.less(tmpBorderSize.multiply(2.0f));
// -1- calculate min-size and expand requested:
Vector3f minSize = Vector3f.ZERO;
@ -110,9 +114,11 @@ public class Sizer extends ContainerN {
}
final Vector3f tmpSize = it.getCalculateMinSize();
if (this.propertyMode == DisplayMode.VERTICAL) {
minSize = new Vector3f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y(), Math.max(minSize.z(), tmpSize.z()));
minSize = new Vector3f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y(),
Math.max(minSize.z(), tmpSize.z()));
} else {
minSize = new Vector3f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()), Math.max(minSize.z(), tmpSize.z()));
minSize = new Vector3f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()),
Math.max(minSize.z(), tmpSize.z()));
}
final Vector3b expand = it.canExpand();
nbWidgetExpand = nbWidgetExpand.add(expand.x() ? 1 : 0, expand.y() ? 1 : 0, 0);
@ -209,14 +215,16 @@ public class Sizer extends ContainerN {
continue;
}
Vector3f tmpSizeMin = it.getSize();
tmpSizeMin = tmpSizeMin.withX(FMath.avg(tmpSizeMin.x(), localWidgetSize.x(), it.getCalculateMaxSize().x()));
tmpSizeMin = tmpSizeMin
.withX(FMath.avg(tmpSizeMin.x(), localWidgetSize.x(), it.getCalculateMaxSize().x()));
it.setSize(tmpSizeMin);
} else {
if (!it.canExpand().y() && !it.canExpandIfFree().y()) {
continue;
}
Vector3f tmpSizeMin = it.getSize();
tmpSizeMin = tmpSizeMin.withY(FMath.avg(tmpSizeMin.y(), localWidgetSize.y(), it.getCalculateMaxSize().y()));
tmpSizeMin = tmpSizeMin
.withY(FMath.avg(tmpSizeMin.y(), localWidgetSize.y(), it.getCalculateMaxSize().y()));
it.setSize(tmpSizeMin);
}
}
@ -235,9 +243,11 @@ public class Sizer extends ContainerN {
}
final Vector3f size = it.getSize();
if (this.propertyMode == DisplayMode.VERTICAL) {
underSize = new Vector3f(Math.max(underSize.x(), size.x()), underSize.y() + size.y(), Math.max(underSize.z(), size.z()));
underSize = new Vector3f(Math.max(underSize.x(), size.x()), underSize.y() + size.y(),
Math.max(underSize.z(), size.z()));
} else {
underSize = new Vector3f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()), Math.max(underSize.z(), size.z()));
underSize = new Vector3f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()),
Math.max(underSize.z(), size.z()));
}
}
final Vector3f deltas = localWidgetSize.less(underSize);
@ -252,9 +262,11 @@ public class Sizer extends ContainerN {
Vector3f origin;
final Vector3f size = it.getSize();
if (this.propertyMode == DisplayMode.VERTICAL) {
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(this.propertyGravity.gravityGenerateDelta(new Vector3f(underSize.x() - size.x(), 0.0f, 0.0f))));
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(
this.propertyGravity.gravityGenerateDelta(new Vector3f(underSize.x() - size.x(), 0.0f, 0.0f))));
} else {
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(this.propertyGravity.gravityGenerateDelta(new Vector3f(0.0f, underSize.y() - size.y(), 0.0f))));
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(
this.propertyGravity.gravityGenerateDelta(new Vector3f(0.0f, underSize.y() - size.y(), 0.0f))));
}
it.setOrigin(origin);
if (this.propertyMode == DisplayMode.VERTICAL) {

View File

@ -15,8 +15,9 @@ import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.compositing.GuiShape;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** @file
* @author Edouard DUPIN
@ -28,6 +29,7 @@ import org.atriasoft.gale.key.KeyStatus;
* @ingroup ewolWidgetGroup
*/
public class Slider extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Slider.class);
private Uri propertyConfig = new Uri("THEME", "shape/Slider.json", "ewol");
@ -82,12 +84,13 @@ public class Slider extends Widget {
this.minSize = Vector3f.max(this.minSize, minimumSizeBase);
// verify the min max of the min size ...
checkMinSize();
Log.error("min size = " + this.minSize);
LOGGER.error("min size = " + this.minSize);
}
private boolean checkIfOver(final Vector3f relPos) {
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y()
&& relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
}
@AknotManaged
@ -153,7 +156,7 @@ public class Slider extends Widget {
public boolean onEventInput(final EventInput event) {
final Vector3f positionAbsolute = new Vector3f(event.pos().x(), event.pos().y(), 0);
final Vector3f relPos = relativePosition(positionAbsolute);
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos);
final boolean over = checkIfOver(relPos);
if (event.inputId() != 1) {
return false;
@ -161,7 +164,8 @@ public class Slider extends Widget {
if (KeyStatus.pressSingle == event.status() && over) {
keepFocus();
// get percent value
final float pourcent = (relPos.x() - this.overPositionStart.x()) / (this.overPositionStop.x() - this.overPositionStart.x());
final float pourcent = (relPos.x() - this.overPositionStart.x())
/ (this.overPositionStop.x() - this.overPositionStart.x());
float value = (this.propertyMaximum - this.propertyMinimum) * pourcent + this.propertyMinimum;
if (this.propertyStep != 0.0f) {
value += this.propertyStep * 0.5f;
@ -172,7 +176,8 @@ public class Slider extends Widget {
if (KeyStatus.down == event.status() && over) {
keepFocus();
// get percent value
final float pourcent = (relPos.x() - this.overPositionStart.x()) / (this.overPositionStop.x() - this.overPositionStart.x());
final float pourcent = (relPos.x() - this.overPositionStart.x())
/ (this.overPositionStop.x() - this.overPositionStart.x());
float value = (this.propertyMaximum - this.propertyMinimum) * pourcent + this.propertyMinimum;
if (this.propertyStep != 0.0f) {
value += this.propertyStep * 0.5f;
@ -183,7 +188,8 @@ public class Slider extends Widget {
if (KeyStatus.move == event.status() && over) {
keepFocus();
// get percent value
final float pourcent = (relPos.x() - this.overPositionStart.x()) / (this.overPositionStop.x() - this.overPositionStart.x());
final float pourcent = (relPos.x() - this.overPositionStart.x())
/ (this.overPositionStop.x() - this.overPositionStart.x());
float value = (this.propertyMaximum - this.propertyMinimum) * pourcent + this.propertyMinimum;
if (this.propertyStep != 0.0f) {
value += this.propertyStep * 0.5f;
@ -194,7 +200,8 @@ public class Slider extends Widget {
if (KeyStatus.up == event.status() && over) {
keepFocus();
// get percent value
final float pourcent = (relPos.x() - this.overPositionStart.x()) / (this.overPositionStop.x() - this.overPositionStart.x());
final float pourcent = (relPos.x() - this.overPositionStart.x())
/ (this.overPositionStop.x() - this.overPositionStart.x());
float value = (this.propertyMaximum - this.propertyMinimum) * pourcent + this.propertyMinimum;
if (this.propertyStep != 0.0f) {
value += this.propertyStep * 0.5f;
@ -210,7 +217,7 @@ public class Slider extends Widget {
if (!needRedraw()) {
//return;
}
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
//LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
this.shape.clear();
//this.gc.clear();
/*
@ -266,7 +273,8 @@ public class Slider extends Widget {
final float xxx = tmpOriginShaper.x() * 2.0f;
tmpOriginShaper = tmpOriginShaper.withX(xxx * (this.propertyValue - this.propertyMinimum) / (this.propertyMaximum - this.propertyMinimum));
tmpOriginShaper = tmpOriginShaper.withX(
xxx * (this.propertyValue - this.propertyMinimum) / (this.propertyMaximum - this.propertyMinimum));
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
// fix all the position in the int class:
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper);

View File

@ -9,14 +9,16 @@ import org.atriasoft.esignal.Connection;
import org.atriasoft.esignal.Signal;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.widget.meta.SpinBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* a composed Spin is a Spin with an inside composed with the specify XML element
* ==> this permit to generate standard element simple
*/
public class Spin extends SpinBase {
private static final Logger LOGGER = LoggerFactory.getLogger(Spin.class);
// Event list of properties
@AknotSignal
@AknotName("value")
@ -54,7 +56,7 @@ public class Spin extends SpinBase {
}
public void connectGui() {
Log.warning("updateGui [START]");
LOGGER.warn("updateGui [START]");
super.updateGui();
if (this.widgetEntry != null && !this.connectionEntry.isConnected()) {
this.connectionEntry = this.widgetEntry.signalModify.connect(this, Spin::onCallbackModify);
@ -66,7 +68,7 @@ public class Spin extends SpinBase {
this.connectionButtonDown = this.widgetButtonDown.signalValue.connect(this, Spin::onCallbackDown);
}
checkValue(this.propertyValue);
Log.warning("updateGui [STOP]");
LOGGER.warn("updateGui [STOP]");
}
@AknotManaged
@ -152,7 +154,7 @@ public class Spin extends SpinBase {
protected void onChangePropertyValue() {
markToRedraw();
if (this.widgetEntry == null) {
Log.error("Can not acces at entry ...");
LOGGER.error("Can not acces at entry ...");
return;
}
checkValue(this.propertyValue);

View File

@ -16,9 +16,10 @@ import org.atriasoft.ewol.compositing.GuiShape;
import org.atriasoft.ewol.compositing.GuiShapeMode;
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.gale.key.KeyStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @ingroup ewolWidgetGroup
@ -40,14 +41,16 @@ public Signal<Boolean> signalValue;
public Uri> propertyShape; //!< shape of the widget
*/
public class Tick extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Tick.class);
/**
* Periodic call to update grapgic display
* @param _event Time generic event
*/
protected static void periodicCall(final Tick self, final EventTime event) {
Log.verbose("Periodic call on Entry(" + event + ")");
LOGGER.trace("Periodic call on Entry(" + event + ")");
if (!self.shape.periodicCall(event)) {
//Log.error("end periodic call");
//LOGGER.error("end periodic call");
self.periodicConnectionHanble.close();
}
self.markToRedraw();
@ -114,21 +117,23 @@ public class Tick extends Widget {
this.minSize = Vector3f.max(this.minSize, minimumSizeBase);
// verify the min max of the min size ...
checkMinSize();
Log.error("min size = " + this.minSize);
LOGGER.error("min size = " + this.minSize);
}
protected void changeStatusIn(final GuiShapeMode newStatusId) {
if (this.shape.changeStatusIn(newStatusId)) {
if (!this.periodicConnectionHanble.isConnected()) {
//Log.error("REQUEST: connection on periodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, Tick::periodicCall);
//LOGGER.error("REQUEST: connection on periodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this,
Tick::periodicCall);
}
markToRedraw();
}
}
private boolean checkIfOver(final Vector3f relPos) {
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y()
&& relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
}
@AknotManaged
@ -175,7 +180,7 @@ public class Tick extends Widget {
public boolean onEventInput(final EventInput event) {
final Vector3f positionAbsolute = new Vector3f(event.pos().x(), event.pos().y(), 0);
final Vector3f relPos = relativePosition(positionAbsolute);
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
LOGGER.warn("Event on Input ... " + event + " relPos = " + relPos);
final boolean over = checkIfOver(relPos);
//filter if outside the element...
if (event.status() == KeyStatus.leave) {
@ -188,7 +193,7 @@ public class Tick extends Widget {
if (KeyStatus.leave == event.status()) {
changeStatusIn(GuiShapeMode.NORMAL);
} else {
Log.verbose("Detect Over : " + this.overPositionStart + " -> " + this.overPositionStop);
LOGGER.trace("Detect Over : " + this.overPositionStart + " -> " + this.overPositionStop);
if (over) {
changeStatusIn(GuiShapeMode.OVER);
} else {
@ -236,7 +241,7 @@ public class Tick extends Widget {
if (!needRedraw()) {
//return;
}
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
//LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
this.shape.clear();
//this.gc.clear();
if (this.colorIdTextFg >= 0) {

View File

@ -31,7 +31,6 @@ import org.atriasoft.ewol.event.EventEntry;
import org.atriasoft.ewol.event.EventInput;
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.gale.backend3d.OpenGL;
import org.atriasoft.gale.context.ClipboardList;
@ -39,6 +38,8 @@ import org.atriasoft.gale.context.Cursor;
import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeySpecial;
import org.lwjgl.opengl.GL11;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Widget class is the main widget interface, it has so me generic properties:
@ -49,6 +50,7 @@ import org.lwjgl.opengl.GL11;
*
*/
public class Widget extends EwolObject {
private static final Logger LOGGER = LoggerFactory.getLogger(Widget.class);
// ----------------------------------------------------------------------------------------------------------------
// -- keyboard event properties Area
// ----------------------------------------------------------------------------------------------------------------
@ -121,7 +123,7 @@ public class Widget extends EwolObject {
protected void calculateMinMaxSizeWidget() {
this.minSize = this.propertyMinSize.getPixel();
//Log.error("[" + getId() + "] convert in min size : " + propertyMinSize + " out=" + this.minSize);
//LOGGER.error("[" + getId() + "] convert in min size : " + propertyMinSize + " out=" + this.minSize);
this.maxSize = this.propertyMaxSize.getPixel();
markToRedraw();
}
@ -194,7 +196,8 @@ public class Widget extends EwolObject {
for (int iii = 0; iii < level; ++iii) {
space.append(" ");
}
Log.print(space.append("[").append(getId()).append("] name='").append(this.name).append("' type=").append(getClass().getCanonicalName()).append(" o=").append(this.origin).append(" s=")
LOGGER.info(space.append("[").append(getId()).append("] name='").append(this.name).append("' type=")
.append(getClass().getCanonicalName()).append(" o=").append(this.origin).append(" s=")
.append(this.size).append(" hide=").append(this.propertyHide).toString());
}
@ -444,7 +447,7 @@ public class Widget extends EwolObject {
* @note INTERNAL EWOL SYSTEM
*/
public void onChangeSize() {
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} update size : " + this.size);
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} update size : " + this.size);
markToRedraw();
}
@ -493,33 +496,43 @@ public class Widget extends EwolObject {
* @return false if the event has not been used.
* @note To prevent some error when you get an event get it if it is down and Up ... ==> like this it could not generate some mistake in the error.
*/
public boolean onEventShortCut(final KeySpecial special, Character unicodeValue, final KeyKeyboard kbMove, final boolean isDown) {
public boolean onEventShortCut(
final KeySpecial special,
Character unicodeValue,
final KeyKeyboard kbMove,
final boolean isDown) {
unicodeValue = Character.toLowerCase(unicodeValue);
//Log.verbose("check shortcut...." + special + " " + unicodeValue + " " + kbMove + " " + (isDown ? "DOWN" : "UP") + " nb shortcut:" + this.localShortcut.size());
//LOGGER.trace("check shortcut...." + special + " " + unicodeValue + " " + kbMove + " " + (isDown ? "DOWN" : "UP") + " nb shortcut:" + this.localShortcut.size());
// Remove the up event of the shortcut...
if (!isDown) {
for (int iii = this.localShortcut.size() - 1; iii >= 0; iii--) {
if (!this.localShortcut.get(iii).isActive) {
continue;
}
if ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.UNKNOWN && this.localShortcut.get(iii).unicodeValue() == unicodeValue)
|| (this.localShortcut.get(iii).keyboardMoveValue() == kbMove && this.localShortcut.get(iii).unicodeValue() == 0)) {
if ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.UNKNOWN
&& this.localShortcut.get(iii).unicodeValue() == unicodeValue)
|| (this.localShortcut.get(iii).keyboardMoveValue() == kbMove
&& this.localShortcut.get(iii).unicodeValue() == 0)) {
// In this case we grap the event in case of an error can occured ...
this.localShortcut.get(iii).isActive = false;
Log.verbose("detect up of a shortcut");
LOGGER.trace("detect up of a shortcut");
return true;
}
}
}
//Log.info("Try to indexOf generic shortcut ...");
//LOGGER.info("Try to indexOf generic shortcut ...");
for (int iii = this.localShortcut.size() - 1; iii >= 0; iii--) {
if (this.localShortcut.get(iii).specialKey().getShift() == special.getShift() && this.localShortcut.get(iii).specialKey().getCtrl() == special.getCtrl()
&& this.localShortcut.get(iii).specialKey().getAlt() == special.getAlt() && this.localShortcut.get(iii).specialKey().getMeta() == special.getMeta()
&& ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.UNKNOWN && this.localShortcut.get(iii).unicodeValue() == unicodeValue)
|| (this.localShortcut.get(iii).keyboardMoveValue() == kbMove && this.localShortcut.get(iii).unicodeValue() == 0))) {
if (this.localShortcut.get(iii).specialKey().getShift() == special.getShift()
&& this.localShortcut.get(iii).specialKey().getCtrl() == special.getCtrl()
&& this.localShortcut.get(iii).specialKey().getAlt() == special.getAlt()
&& this.localShortcut.get(iii).specialKey().getMeta() == special.getMeta()
&& ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.UNKNOWN
&& this.localShortcut.get(iii).unicodeValue() == unicodeValue)
|| (this.localShortcut.get(iii).keyboardMoveValue() == kbMove
&& this.localShortcut.get(iii).unicodeValue() == 0))) {
if (isDown) {
this.localShortcut.get(iii).isActive = true;
Log.verbose("Generate shortCut: " + this.localShortcut.get(iii).message());
LOGGER.trace("Generate shortCut: " + this.localShortcut.get(iii).message());
this.signalShortcut.emit(this.localShortcut.get(iii).message());
}
return true;
@ -545,7 +558,7 @@ public class Widget extends EwolObject {
final Vector3f pixelMax = this.propertyMaxSize.getPixel();
// check minimum maximum compatibility :
if (pixelMin.x() > pixelMax.x() || pixelMin.y() > pixelMax.y()) {
Log.error("Can not set a 'min size' > 'max size' reset to maximum ...");
LOGGER.error("Can not set a 'min size' > 'max size' reset to maximum ...");
this.propertyMaxSize = new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL);
}
requestUpdateSize();
@ -587,7 +600,7 @@ public class Widget extends EwolObject {
* @param newCursor selected new cursor.
*/
public void setCursor(final Cursor newCursor) {
Log.debug("Change Cursor in " + newCursor);
LOGGER.debug("Change Cursor in " + newCursor);
this.cursorDisplay = newCursor;
EwolObject.getContext().setCursor(this.cursorDisplay);
}
@ -597,16 +610,17 @@ public class Widget extends EwolObject {
* @return return true if the widget keep the focus
*/
public boolean setFocus() {
Log.verbose("set focus (start) *propertyCanFocus=" + this.propertyCanFocus + " this.hasFocus=" + this.hasFocus);
LOGGER.trace(
"set focus (start) *propertyCanFocus=" + this.propertyCanFocus + " this.hasFocus=" + this.hasFocus);
if (this.propertyCanFocus) {
if (!this.hasFocus) {
this.hasFocus = true;
onGetFocus();
}
Log.verbose("set focus (stop) ret true");
LOGGER.trace("set focus (stop) ret true");
return true;
}
Log.verbose("set focus (stop) ret false");
LOGGER.trace("set focus (stop) ret false");
return false;
}
@ -645,7 +659,7 @@ public class Widget extends EwolObject {
* @param newVal offset value.
*/
public void setOffset(final Vector3f newVal) {
Log.info("Set offset: " + newVal);
LOGGER.info("Set offset: " + newVal);
if (this.offset != newVal) {
this.offset = newVal;
markToRedraw();
@ -772,7 +786,7 @@ public class Widget extends EwolObject {
*/
protected void shortCutAdd(final String descriptiveString, final String sendMessage) {
if (descriptiveString.length() == 0) {
Log.error("try to add shortcut with no descriptive string ...");
LOGGER.error("try to add shortcut with no descriptive string ...");
return;
}
String message; //!< data link with the event
@ -918,7 +932,7 @@ public class Widget extends EwolObject {
}
protected void systemDrawWidget(final DrawProperty displayProp) {
//Log.info("[" + getId() + "] Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" << this.size << " hide=" << propertyHide);
//LOGGER.info("[" + getId() + "] Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" << this.size << " hide=" << propertyHide);
if (this.propertyHide) {
// widget is hidden ...
return;
@ -935,20 +949,23 @@ public class Widget extends EwolObject {
if (tmpSize.size().x() <= 0 || tmpSize.size().y() <= 0) {
return;
}
//Log.info("setViewport(" + tmpSize.origin() + ", " + tmpSize.size() + ")");
//LOGGER.info("setViewport(" + tmpSize.origin() + ", " + tmpSize.size() + ")");
OpenGL.setViewPort(tmpSize.origin(), tmpSize.size());
// special case, when origin < display origin, we need to cut the display :
Vector2i downOffset = new Vector2i((int) (this.origin.x() - tmpSize.origin().x()), (int) (this.origin.y() - tmpSize.origin().y()));
Vector2i downOffset = new Vector2i((int) (this.origin.x() - tmpSize.origin().x()),
(int) (this.origin.y() - tmpSize.origin().y()));
downOffset = Vector2i.min(downOffset, Vector2i.ZERO);
//Log.info("translate : (" + (new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
//LOGGER.info("translate : (" + (new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
// translate the display to have a Gui 0,0 position on the Left button angle
final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate((new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
.createMatrixTranslate((new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(),
-tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
//final Matrix4f tmpTranslate = Matrix4f.createMatrixTranslate(new Vector3f(0, 0, 1.0f));
// Scale if needed (feature not validate)
final Matrix4f tmpScale = Matrix4f.createMatrixScale(this.zoom, this.zoom, 1.0f);
// create orthogonal projection for GUI ==> simple to manage staking
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-tmpSize.size().x() / 2, tmpSize.size().x() / 2, -tmpSize.size().y() / 2, tmpSize.size().y() / 2, -500, 500);
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-tmpSize.size().x() / 2, tmpSize.size().x() / 2,
-tmpSize.size().y() / 2, tmpSize.size().y() / 2, -500, 500);
//Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate);
OpenGL.push();

View File

@ -20,10 +20,12 @@ import org.atriasoft.ewol.compositing.Compositing;
import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.compositing.CompositingText;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.widget.model.ListRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class WidgetList extends WidgetScrolled {
private static final Logger LOGGER = LoggerFactory.getLogger(WidgetList.class);
// drawing capabilities ....
protected List<Compositing> listOObject = new ArrayList<>(); //!< generic element to display...
@ -205,7 +207,8 @@ class WidgetList extends WidgetScrolled {
if (this.listSizeY.size() == 0) {
return false;
}
relativePos = new Vector3f(relativePos.x() + this.originScrooled.x(), this.size.y() - relativePos.y() + this.originScrooled.y(), 0);
relativePos = new Vector3f(relativePos.x() + this.originScrooled.x(),
this.size.y() - relativePos.y() + this.originScrooled.y(), 0);
// Find the colomn and the row
Vector3i pos = Vector3i.ZERO;
float offsetY = 0;
@ -252,7 +255,7 @@ class WidgetList extends WidgetScrolled {
//void setRawVisible(int _id);
@Override
protected void onGetFocus() {
Log.debug("WidgetList get focus");
LOGGER.debug("WidgetList get focus");
}
protected boolean onItemEvent(final EventInput event, final Vector3i pos, final Vector3f mousePosition) {
@ -261,7 +264,7 @@ class WidgetList extends WidgetScrolled {
@Override
protected void onLostFocus() {
Log.debug("WidgetList Lost focus");
LOGGER.debug("WidgetList Lost focus");
}
@Override
@ -371,7 +374,7 @@ class WidgetList extends WidgetScrolled {
}
for (int xxx = 0; xxx < matrixSize.x(); ++xxx) {
final float startXposition = -this.originScrooled.x() + listStartPosX.get(xxx);
//Log.error("display start: " + startXposition);
//LOGGER.error("display start: " + startXposition);
if (startXposition + this.listSizeX.get(xxx) < 0) {
// ==> element out of range ==> nothing to display
continue;
@ -380,7 +383,8 @@ class WidgetList extends WidgetScrolled {
// ==> element out of range ==> nothing to display
break;
}
drawElement(new Vector2i(xxx, yyy), new Vector2f(startXposition, startYposition), new Vector2f(this.listSizeX.get(xxx), this.listSizeY.get(yyy)));
drawElement(new Vector2i(xxx, yyy), new Vector2f(startXposition, startYposition),
new Vector2f(this.listSizeX.get(xxx), this.listSizeY.get(yyy)));
}
}
// -------------------------------------------------------

View File

@ -2,8 +2,9 @@ package org.atriasoft.ewol.widget;
import java.lang.ref.WeakReference;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.exml.model.XmlElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** @file
* @author Edouard DUPIN
@ -12,6 +13,7 @@ import org.atriasoft.exml.model.XmlElement;
*/
public class WidgetManager {
private static final Logger LOGGER = LoggerFactory.getLogger(WidgetManager.class);
// ---------------------------------------------
// -- Factory area
@ -48,7 +50,7 @@ public class WidgetManager {
return null;
}
}
Log.warning("try to create an UnExistant widget : " + nameLower);
LOGGER.warn("try to create an UnExistant widget : " + nameLower);
return null;
}
*/
@ -93,7 +95,7 @@ public class WidgetManager {
// final String nameLower = name.toLowerCase();
// final Class<?> it = WidgetXmlFactory.creatorList.get(nameLower);
// if (it != null) {
// Log.warning("Replace Creator of a specify widget : " + nameLower);
// LOGGER.warn("Replace Creator of a specify widget : " + nameLower);
// return;
// }
// this.creatorList.put(nameLower, klass);
@ -117,7 +119,7 @@ public class WidgetManager {
// return null;
// }
// }
Log.warning("try to create an UnExistant widget : " + nameLower);
LOGGER.warn("try to create an UnExistant widget : " + nameLower);
return null;
}
@ -134,7 +136,7 @@ public class WidgetManager {
// return null;
// }
// }
Log.warning("try to create an UnExistant widget : " + nameLower);
LOGGER.warn("try to create an UnExistant widget : " + nameLower);
return null;
}
@ -166,7 +168,7 @@ public class WidgetManager {
// nothing to do ...
return;
}
Log.debug("focusKeep=" + newWidget.getId());
LOGGER.debug("focusKeep=" + newWidget.getId());
//elog::displayBacktrace();
Widget focusWidgetCurrent = this.focusWidgetCurrent.get();
if (newWidget == focusWidgetCurrent) {
@ -174,17 +176,17 @@ public class WidgetManager {
return;
}
if (focusWidgetCurrent != null) {
Log.debug("Rm focus on WidgetID=" + focusWidgetCurrent.getId());
LOGGER.debug("Rm focus on WidgetID=" + focusWidgetCurrent.getId());
focusWidgetCurrent.rmFocus();
focusWidgetCurrent = null;
}
if (!newWidget.propertyCanFocus) {
Log.debug("Widget can not have focus, id=" + newWidget.getId());
LOGGER.debug("Widget can not have focus, id=" + newWidget.getId());
return;
}
this.focusWidgetCurrent = new WeakReference<>(newWidget);
if (newWidget != null) {
Log.debug("Set focus on WidgetID=" + newWidget.getId());
LOGGER.debug("Set focus on WidgetID=" + newWidget.getId());
newWidget.setFocus();
}
}
@ -200,13 +202,13 @@ public class WidgetManager {
return;
}
if (focusWidgetCurrent != null) {
Log.debug("Rm focus on WidgetID=" + focusWidgetCurrent.getId());
LOGGER.debug("Rm focus on WidgetID=" + focusWidgetCurrent.getId());
focusWidgetCurrent.rmFocus();
}
this.focusWidgetCurrent = this.focusWidgetDefault;
focusWidgetCurrent = this.focusWidgetCurrent.get();
if (focusWidgetCurrent != null) {
Log.debug("Set focus on WidgetID=" + focusWidgetCurrent.getId());
LOGGER.debug("Set focus on WidgetID=" + focusWidgetCurrent.getId());
focusWidgetCurrent.setFocus();
}
}
@ -217,7 +219,7 @@ public class WidgetManager {
*/
public void focusSetDefault(final Widget newWidget) {
if ((newWidget != null) && (!newWidget.propertyCanFocus)) {
Log.verbose("Widget can not have focus, id=" + newWidget.getId());
LOGGER.trace("Widget can not have focus, id=" + newWidget.getId());
return;
}
Widget focusWidgetDefault = null;
@ -230,12 +232,12 @@ public class WidgetManager {
}
if (focusWidgetDefault == focusWidgetCurrent) {
if (focusWidgetCurrent != null) {
Log.debug("Rm focus on WidgetID=" + focusWidgetCurrent.getId());
LOGGER.debug("Rm focus on WidgetID=" + focusWidgetCurrent.getId());
focusWidgetCurrent.rmFocus();
}
this.focusWidgetCurrent = new WeakReference<>(newWidget);
if (newWidget != null) {
Log.debug("Set focus on WidgetID=" + newWidget.getId());
LOGGER.debug("Set focus on WidgetID=" + newWidget.getId());
newWidget.setFocus();
}
}

View File

@ -14,15 +14,18 @@ import org.atriasoft.ewol.HighSpeedMode;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.GuiShape;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Widget to integrate a scrool bar in a widget. This is not a stadalone widget.
*/
class WidgetScrolled extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(WidgetScrolled.class);
public enum ScrollingMode {
scroolModeNormal, //!< No Zoom , can UP and down, left and right
scroolModeCenter, //!< Zoom enable, no move left and right
@ -110,14 +113,15 @@ class WidgetScrolled extends Widget {
@Override
public boolean onEventInput(final EventInput event) {
Log.verbose("event XXX {}", event);
LOGGER.trace("event XXX {}", event);
Vector3f relativePos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0.0f));
// Correction due to the open Gl insertion ...
relativePos = relativePos.withY(this.size.y() - relativePos.y());
final Padding paddingV = this.shaperV.getPadding();
final Padding paddingH = this.shaperH.getPadding();
if (this.scroollingMode == ScrollingMode.scroolModeNormal) {
if (event.type() == KeyType.mouse && (this.highSpeedType == KeyType.unknow || this.highSpeedType == KeyType.mouse)) {
if (event.type() == KeyType.mouse
&& (this.highSpeedType == KeyType.unknow || this.highSpeedType == KeyType.mouse)) {
if (event.inputId() == 1 && event.status() == KeyStatus.down) {
// check if selected the scrolling position with the scrolling bar ...
if (relativePos.x() >= (this.size.x() - paddingV.x())) {
@ -125,11 +129,14 @@ class WidgetScrolled extends Widget {
this.highSpeedMode = HighSpeedMode.speedModeEnableVertical;
this.highSpeedType = KeyType.mouse;
this.highSpeedStartPos = this.highSpeedStartPos.withX(relativePos.x());
this.highSpeedStartPos = this.highSpeedStartPos.withY(this.originScrooled.y() / this.maxSize.y() * (this.size.y() - paddingV.y()));
this.highSpeedStartPos = this.highSpeedStartPos
.withY(this.originScrooled.y() / this.maxSize.y() * (this.size.y() - paddingV.y()));
this.highSpeedButton = 1;
// force direct scrolling in this case
this.originScrooled = this.originScrooled.withY((int) (this.maxSize.y() * (relativePos.y() - paddingV.bottom()) / (this.size.y() - paddingV.bottom() * 2)));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
this.originScrooled = this.originScrooled.withY((int) (this.maxSize.y()
* (relativePos.y() - paddingV.bottom()) / (this.size.y() - paddingV.bottom() * 2)));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
markToRedraw();
return true;
}
@ -137,12 +144,15 @@ class WidgetScrolled extends Widget {
if (this.size.x() < this.maxSize.x() || this.originScrooled.x() != 0) {
this.highSpeedMode = HighSpeedMode.speedModeEnableHorizontal;
this.highSpeedType = KeyType.mouse;
this.highSpeedStartPos = this.highSpeedStartPos.withX(this.originScrooled.x() / this.maxSize.x() * (this.size.x() - paddingH.x()));
this.highSpeedStartPos = this.highSpeedStartPos
.withX(this.originScrooled.x() / this.maxSize.x() * (this.size.x() - paddingH.x()));
this.highSpeedStartPos = this.highSpeedStartPos.withY(relativePos.y());
this.highSpeedButton = 1;
// force direct scrolling in this case
this.originScrooled = this.originScrooled.withX((int) (this.maxSize.x() * (relativePos.x() - paddingH.left()) / (this.size.x() - paddingH.left() * 2)));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(), (this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withX((int) (this.maxSize.x()
* (relativePos.x() - paddingH.left()) / (this.size.x() - paddingH.left() * 2)));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(),
(this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
markToRedraw();
return true;
}
@ -156,13 +166,13 @@ class WidgetScrolled extends Widget {
zoom = FMath.avg(0.1f, zoom, 5000.0f);
setZoom(zoom);
*/
} else {
if (this.size.y() < this.maxSize.y() || this.originScrooled.y() != 0 || this.size.y() * this.limitScrolling.y() < this.maxSize.y()) {
this.originScrooled = this.originScrooled.withY(this.originScrooled.y() - this.pixelScrolling);
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
markToRedraw();
return true;
}
} else if (this.size.y() < this.maxSize.y() || this.originScrooled.y() != 0
|| this.size.y() * this.limitScrolling.y() < this.maxSize.y()) {
this.originScrooled = this.originScrooled.withY(this.originScrooled.y() - this.pixelScrolling);
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
markToRedraw();
return true;
}
} else if (event.inputId() == 5 && event.status() == KeyStatus.up) {
if (event.specialKey().getCtrl()) {
@ -172,27 +182,31 @@ class WidgetScrolled extends Widget {
zoom = FMath.avg(0.1f, zoom, 5000.0f);
setZoom(zoom);
*/
} else {
if (this.size.y() < this.maxSize.y() || this.originScrooled.y() != 0 || this.size.y() * this.limitScrolling.y() < this.maxSize.y()) {
this.originScrooled = this.originScrooled.withY(this.originScrooled.y() + this.pixelScrolling);
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
markToRedraw();
return true;
}
} else if (this.size.y() < this.maxSize.y() || this.originScrooled.y() != 0
|| this.size.y() * this.limitScrolling.y() < this.maxSize.y()) {
this.originScrooled = this.originScrooled.withY(this.originScrooled.y() + this.pixelScrolling);
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
markToRedraw();
return true;
}
} else if (event.inputId() == 11 && event.status() == KeyStatus.up) {
// Scrool Left
if (this.size.x() < this.maxSize.x() || this.originScrooled.x() != 0 || this.size.x() * this.limitScrolling.x() < this.maxSize.x()) {
if (this.size.x() < this.maxSize.x() || this.originScrooled.x() != 0
|| this.size.x() * this.limitScrolling.x() < this.maxSize.x()) {
this.originScrooled = this.originScrooled.withX(this.originScrooled.x() - this.pixelScrolling);
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(), (this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(),
(this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
markToRedraw();
return true;
}
} else if (event.inputId() == 10 && event.status() == KeyStatus.up) {
// Scrool Right
if (this.size.x() < this.maxSize.x() || this.originScrooled.x() != 0 || this.size.x() * this.limitScrolling.x() < this.maxSize.x()) {
if (this.size.x() < this.maxSize.x() || this.originScrooled.x() != 0
|| this.size.x() * this.limitScrolling.x() < this.maxSize.x()) {
this.originScrooled = this.originScrooled.withX(this.originScrooled.x() + this.pixelScrolling);
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(), (this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(),
(this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
markToRedraw();
return true;
}
@ -235,7 +249,8 @@ class WidgetScrolled extends Widget {
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeInit && event.status() == KeyStatus.move) {
// wait that the cursor move more than 10 px to enable it :
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10 || FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10
|| FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
// the scrolling can start :
// select the direction :
if (relativePos.x() == this.highSpeedStartPos.x()) {
@ -243,7 +258,8 @@ class WidgetScrolled extends Widget {
} else if (relativePos.y() == this.highSpeedStartPos.y()) {
this.highSpeedMode = HighSpeedMode.speedModeEnableHorizontal;
} else {
final float coef = (relativePos.y() - this.highSpeedStartPos.y()) / (relativePos.x() - this.highSpeedStartPos.x());
final float coef = (relativePos.y() - this.highSpeedStartPos.y())
/ (relativePos.x() - this.highSpeedStartPos.x());
if (FMath.abs(coef) <= 1) {
this.highSpeedMode = HighSpeedMode.speedModeEnableHorizontal;
} else {
@ -251,29 +267,39 @@ class WidgetScrolled extends Widget {
}
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableHorizontal) {
this.highSpeedStartPos = this.highSpeedStartPos.withX(this.originScrooled.x() / this.maxSize.x() * (this.size.x() - paddingV.x()));
this.highSpeedStartPos = this.highSpeedStartPos.withX(
this.originScrooled.x() / this.maxSize.x() * (this.size.x() - paddingV.x()));
} else {
this.highSpeedStartPos = this.highSpeedStartPos.withY(this.originScrooled.y() / this.maxSize.y() * (this.size.y() - paddingV.y()));
this.highSpeedStartPos = this.highSpeedStartPos.withY(
this.originScrooled.y() / this.maxSize.y() * (this.size.y() - paddingV.y()));
}
markToRedraw();
}
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableHorizontal && event.status() == KeyStatus.move) {
this.originScrooled = this.originScrooled.withX((int) (this.maxSize.x() * (relativePos.x() - paddingH.left()) / (this.size.x() - paddingH.x())));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(), (this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
if (this.highSpeedMode == HighSpeedMode.speedModeEnableHorizontal
&& event.status() == KeyStatus.move) {
this.originScrooled = this.originScrooled.withX((int) (this.maxSize.x()
* (relativePos.x() - paddingH.left()) / (this.size.x() - paddingH.x())));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(),
(this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
markToRedraw();
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableVertical && event.status() == KeyStatus.move) {
this.originScrooled = this.originScrooled.withY((int) (this.maxSize.y() * (relativePos.y() - paddingV.bottom()) / (this.size.y() - paddingV.y())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
if (this.highSpeedMode == HighSpeedMode.speedModeEnableVertical
&& event.status() == KeyStatus.move) {
this.originScrooled = this.originScrooled.withY((int) (this.maxSize.y()
* (relativePos.y() - paddingV.bottom()) / (this.size.y() - paddingV.y())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
markToRedraw();
return true;
}
}
} else if (event.type() == KeyType.finger && (this.highSpeedType == KeyType.unknow || this.highSpeedType == KeyType.finger)) {
} else if (event.type() == KeyType.finger
&& (this.highSpeedType == KeyType.unknow || this.highSpeedType == KeyType.finger)) {
if (!this.singleFingerMode) {
// ***********************
// ** Two finger mode : **
@ -292,18 +318,23 @@ class WidgetScrolled extends Widget {
}
if (this.fingerPresent[0] && this.fingerPresent[1] && !this.fingerScoolActivated) {
this.fingerScoolActivated = true;
Log.verbose("SCROOL == > START pos=" + this.fingerMoveStartPos);
LOGGER.trace("SCROOL == > START pos=" + this.fingerMoveStartPos);
}
if (this.fingerScoolActivated) {
// 1: HighSpeedMode...
// 2: remove all unneeded sub event ... ==> maybe a better methode ...
if (event.status() == KeyStatus.move) {
this.originScrooled = this.originScrooled.withX(this.originScrooled.x() - (relativePos.x() - this.fingerMoveStartPos[idTable].x()) * 0.5f);
this.originScrooled = this.originScrooled.withY(this.originScrooled.y() - (relativePos.y() - this.fingerMoveStartPos[idTable].y()) * 0.5f);
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(), (this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
this.originScrooled = this.originScrooled.withX(this.originScrooled.x()
- (relativePos.x() - this.fingerMoveStartPos[idTable].x()) * 0.5f);
this.originScrooled = this.originScrooled.withY(this.originScrooled.y()
- (relativePos.y() - this.fingerMoveStartPos[idTable].y()) * 0.5f);
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(),
(this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
this.fingerMoveStartPos[idTable] = new Vector2f(relativePos.x(), relativePos.y());
Log.verbose("SCROOL == > MOVE this.originScrooled=" + this.originScrooled + " " + relativePos + " " + this.highSpeedStartPos);
LOGGER.trace("SCROOL == > MOVE this.originScrooled=" + this.originScrooled + " "
+ relativePos + " " + this.highSpeedStartPos);
markToRedraw();
}
if (!this.fingerPresent[0] && !this.fingerPresent[1]) {
@ -315,66 +346,72 @@ class WidgetScrolled extends Widget {
}
return true;
}
} else {
// **************************
// ** Single finger mode : **
// **************************
if (event.inputId() == 1) {
Log.verbose("event 1 " + event);
if (event.status() == KeyStatus.down) {
this.highSpeedMode = HighSpeedMode.speedModeInit;
this.highSpeedType = KeyType.finger;
this.highSpeedStartPos = new Vector2f(relativePos.x(), relativePos.y());
Log.verbose("SCROOL == > INIT");
return true;
} else if (event.status() == KeyStatus.upAfter) {
this.highSpeedMode = HighSpeedMode.speedModeDisable;
this.highSpeedType = KeyType.unknow;
Log.verbose("SCROOL == > DISABLE");
markToRedraw();
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeInit && event.status() == KeyStatus.move) {
// wait that the cursor move more than 10 px to enable it :
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10 || FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
// the scrooling can start :
// select the direction :
this.highSpeedMode = HighSpeedMode.speedModeEnableFinger;
Log.debug("SCROOL == > ENABLE");
markToRedraw();
}
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger && event.status() == KeyStatus.pressSingle) {
// Keep all event in the range of moving
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger && event.status() == KeyStatus.pressDouble) {
// Keep all event in the range of moving
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger && event.status() == KeyStatus.move) {
//this.originScrooled.x = (int)(this.maxSize.x * x / this.size.x);
this.originScrooled = this.originScrooled.withX(this.originScrooled.x() - (relativePos.x() - this.highSpeedStartPos.x()));
this.originScrooled = this.originScrooled.withY(this.originScrooled.y() - (relativePos.y() - this.highSpeedStartPos.y()));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(), (this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(), (this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
this.highSpeedStartPos = new Vector2f(relativePos.x(), relativePos.y());
Log.verbose("SCROOL == > MOVE this.originScrooled=" + this.originScrooled + " " + relativePos + " " + this.highSpeedStartPos);
markToRedraw();
return true;
}
} else if (this.highSpeedMode == HighSpeedMode.speedModeDisable && event.status() == KeyStatus.leave) {
} else // **************************
// ** Single finger mode : **
// **************************
if (event.inputId() == 1) {
LOGGER.trace("event 1 " + event);
if (event.status() == KeyStatus.down) {
this.highSpeedMode = HighSpeedMode.speedModeInit;
this.highSpeedType = KeyType.finger;
this.highSpeedStartPos = new Vector2f(relativePos.x(), relativePos.y());
LOGGER.trace("SCROOL == > INIT");
return true;
} else if (event.status() == KeyStatus.upAfter) {
this.highSpeedMode = HighSpeedMode.speedModeDisable;
this.highSpeedType = KeyType.unknow;
Log.verbose("SCROOL == > DISABLE");
LOGGER.trace("SCROOL == > DISABLE");
markToRedraw();
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeInit && event.status() == KeyStatus.move) {
// wait that the cursor move more than 10 px to enable it :
if (FMath.abs(relativePos.x() - this.highSpeedStartPos.x()) > 10
|| FMath.abs(relativePos.y() - this.highSpeedStartPos.y()) > 10) {
// the scrooling can start :
// select the direction :
this.highSpeedMode = HighSpeedMode.speedModeEnableFinger;
LOGGER.debug("SCROOL == > ENABLE");
markToRedraw();
}
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger
&& event.status() == KeyStatus.pressSingle) {
// Keep all event in the range of moving
return true;
} else if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger
&& event.status() == KeyStatus.pressDouble) {
// Keep all event in the range of moving
return true;
}
if (this.highSpeedMode == HighSpeedMode.speedModeEnableFinger && event.status() == KeyStatus.move) {
//this.originScrooled.x = (int)(this.maxSize.x * x / this.size.x);
this.originScrooled = this.originScrooled
.withX(this.originScrooled.x() - (relativePos.x() - this.highSpeedStartPos.x()));
this.originScrooled = this.originScrooled
.withY(this.originScrooled.y() - (relativePos.y() - this.highSpeedStartPos.y()));
this.originScrooled = this.originScrooled.withX(FMath.avg(0.0f, this.originScrooled.x(),
(this.maxSize.x() - this.size.x() * this.limitScrolling.x())));
this.originScrooled = this.originScrooled.withY(FMath.avg(0.0f, this.originScrooled.y(),
(this.maxSize.y() - this.size.y() * this.limitScrolling.y())));
this.highSpeedStartPos = new Vector2f(relativePos.x(), relativePos.y());
LOGGER.trace("SCROOL == > MOVE this.originScrooled=" + this.originScrooled + " " + relativePos
+ " " + this.highSpeedStartPos);
markToRedraw();
return true;
}
} else if (this.highSpeedMode == HighSpeedMode.speedModeDisable && event.status() == KeyStatus.leave) {
this.highSpeedMode = HighSpeedMode.speedModeDisable;
this.highSpeedType = KeyType.unknow;
LOGGER.trace("SCROOL == > DISABLE");
markToRedraw();
return true;
}
}
} else if (this.scroollingMode == ScrollingMode.scroolModeCenter) {
if (event.type() == KeyType.mouse) {
float tmp1 = this.size.x() / this.maxSize.y();
final float tmp2 = this.size.y() / this.maxSize.x();
//Log.info(" elements Zoom : " + tmp1 + " " + tmp2);
//LOGGER.info(" elements Zoom : " + tmp1 + " " + tmp2);
tmp1 = FMath.min(tmp1, tmp2);
if (event.inputId() == 4 && event.status() == KeyStatus.up) {
this.zoom -= 0.1;
@ -399,7 +436,7 @@ class WidgetScrolled extends Widget {
} else if (this.scroollingMode == ScrollingMode.scroolModeGame) {
} else {
Log.error("Scrolling mode unknow ... " + this.scroollingMode);
LOGGER.error("Scrolling mode unknow ... " + this.scroollingMode);
}
return false;
}
@ -417,20 +454,25 @@ class WidgetScrolled extends Widget {
if (this.size.y() < this.maxSize.y() || this.originScrooled.y() != 0) {
float lenScrollBar = this.size.y() * this.size.y() / this.maxSize.y();
lenScrollBar = FMath.avg(10.0f, lenScrollBar, this.size.y());
float originScrollBar = this.originScrooled.y() / (this.maxSize.y() - this.size.y() * this.limitScrolling.y());
float originScrollBar = this.originScrooled.y()
/ (this.maxSize.y() - this.size.y() * this.limitScrolling.y());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.y() - lenScrollBar);
this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0), new Vector2f(paddingVert.x(), this.size.y()),
new Vector2f(this.size.x() - paddingVert.right(), this.size.y() - originScrollBar - lenScrollBar), new Vector2f(0, lenScrollBar));
this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0),
new Vector2f(paddingVert.x(), this.size.y()),
new Vector2f(this.size.x() - paddingVert.right(), this.size.y() - originScrollBar - lenScrollBar),
new Vector2f(0, lenScrollBar));
}
if (this.size.x() < this.maxSize.x() || this.originScrooled.x() != 0) {
float lenScrollBar = (this.size.x() - paddingHori.left()) * (this.size.x() - paddingVert.x()) / this.maxSize.x();
float lenScrollBar = (this.size.x() - paddingHori.left()) * (this.size.x() - paddingVert.x())
/ this.maxSize.x();
lenScrollBar = FMath.avg(10.0f, lenScrollBar, (this.size.x() - paddingVert.x()));
float originScrollBar = this.originScrooled.x() / (this.maxSize.x() - this.size.x() * this.limitScrolling.x());
float originScrollBar = this.originScrooled.x()
/ (this.maxSize.x() - this.size.x() * this.limitScrolling.x());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.x() - paddingHori.right() - lenScrollBar);
this.shaperH.setShape(new Vector2f(0, 0), new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()), new Vector2f(originScrollBar, paddingHori.bottom()),
new Vector2f(lenScrollBar, 0));
this.shaperH.setShape(new Vector2f(0, 0), new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()),
new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));
}
}
@ -468,7 +510,8 @@ class WidgetScrolled extends Widget {
* @param poucentageLimit pourcent of the limit of view nothing in the widget when arriving at the end for axis specific...
*/
protected void setLimitScrolling(final Vector2f poucentageLimit) {
this.limitScrolling = new Vector2f(FMath.avg(0.1f, poucentageLimit.x(), 1.0f), FMath.avg(0.1f, poucentageLimit.y(), 1.0f));
this.limitScrolling = new Vector2f(FMath.avg(0.1f, poucentageLimit.x(), 1.0f),
FMath.avg(0.1f, poucentageLimit.y(), 1.0f));
}
/**
@ -505,7 +548,10 @@ class WidgetScrolled extends Widget {
setScrollingPositionDynamic(borderWidth, currentPosition, false);
}
protected void setScrollingPositionDynamic(Vector2f borderWidth, final Vector2f currentPosition, final boolean center) {
protected void setScrollingPositionDynamic(
Vector2f borderWidth,
final Vector2f currentPosition,
final boolean center) {
if (center) {
borderWidth = new Vector2f(this.size.x() / 2 - borderWidth.x(), this.size.y() / 2 - borderWidth.y());
}
@ -552,9 +598,11 @@ class WidgetScrolled extends Widget {
if (this.scroollingMode == ScrollingMode.scroolModeCenter) {
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
OpenGL.setViewPort(this.origin, this.size);
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2, -this.size.y() / 2, this.size.y() / 2, -1, 1);
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2,
-this.size.y() / 2, this.size.y() / 2, -1, 1);
final Matrix4f tmpScale = Matrix4f.createMatrixScale(new Vector3f(this.zoom, this.zoom, 1));
final Matrix4f tmpTranslate = Matrix4f.createMatrixTranslate(new Vector3f(-this.maxSize.x() / 2, -this.maxSize.y() / 2, -1));
final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate(new Vector3f(-this.maxSize.x() / 2, -this.maxSize.y() / 2, -1));
final Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate);
// set internal matrix system :
OpenGL.setMatrix(tmpMat);
@ -564,8 +612,10 @@ class WidgetScrolled extends Widget {
if (this.scroollingMode == ScrollingMode.scroolModeGame) {
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
OpenGL.setViewPort(this.origin, this.size);
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2, -this.size.y() / 2, this.size.y() / 2, -1, 1);
final Matrix4f tmpTranslate = Matrix4f.createMatrixTranslate(new Vector3f(-this.maxSize.x() / 2, -this.maxSize.y() / 2, -1));
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-this.size.x() / 2, this.size.x() / 2,
-this.size.y() / 2, this.size.y() / 2, -1, 1);
final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate(new Vector3f(-this.maxSize.x() / 2, -this.maxSize.y() / 2, -1));
final Matrix4f tmpMat = tmpProjection.multiply(tmpTranslate);
// set internal matrix system :
OpenGL.setMatrix(tmpMat);

View File

@ -21,15 +21,17 @@ import org.atriasoft.etk.math.Vector3i;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.compositing.CompositingDrawing;
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.gale.backend3d.OpenGL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Windows basic interface
*/
public class Windows extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Windows.class);
protected int colorBg = -1; //!< Default background color of the windows
@ -110,7 +112,7 @@ public class Windows extends Widget {
@Override
public Widget getWidgetAtPos(final Vector3f pos) {
Log.verbose("Get widget at pos : " + pos);
LOGGER.trace("Get widget at pos : " + pos);
// calculate relative position
final Vector3f relativePos = relativePosition(pos);
// event go directly on the pop-up
@ -130,7 +132,8 @@ public class Windows extends Widget {
if (this.resourceColor != null) {
this.colorBg = this.resourceColor.request("background");
} else {
Log.warning("Can not open the default color configuration file for the windows: " + this.propertyColorConfiguration);
LOGGER.warn("Can not open the default color configuration file for the windows: "
+ this.propertyColorConfiguration);
}
}
@ -191,7 +194,7 @@ public class Windows extends Widget {
public void popUpWidgetPush(final Widget widget) {
if (widget == null) {
// nothing to do an error appear :
Log.error("can not set widget pop-up (null pointer)");
LOGGER.error("can not set widget pop-up (null pointer)");
return;
}
this.popUpWidgetList.add(widget);
@ -207,12 +210,12 @@ public class Windows extends Widget {
//!< main sub-widget of the Windows.
@Override
public void requestDestroyFromChild(final EwolObject child) {
Log.verbose("A child has been removed");
LOGGER.trace("A child has been removed");
ListIterator<Widget> it = this.popUpWidgetList.listIterator();
while (it.hasNext()) {
final Widget elem = it.next();
if (elem == child) {
Log.verbose(" Find it ...");
LOGGER.trace(" Find it ...");
if (elem != null) {
elem.removeParent();
}
@ -222,7 +225,7 @@ public class Windows extends Widget {
}
}
if (this.subWidget == child) {
Log.verbose(" Find it ... 2");
LOGGER.trace(" Find it ... 2");
if (this.subWidget == null) {
return;
}
@ -249,7 +252,7 @@ public class Windows extends Widget {
if (context.getWindows() == this) {
context.setTitle(propertyTitle);
} else {
Log.info("Set title is delayed ...");
LOGGER.info("Set title is delayed ...");
}
}
@ -259,7 +262,7 @@ public class Windows extends Widget {
*/
public void setSubWidget(final Widget widget) {
if (this.subWidget != null) {
Log.info("Remove current main windows Widget...");
LOGGER.info("Remove current main windows Widget...");
this.subWidget.removeParent();
this.subWidget = null;
}
@ -272,7 +275,7 @@ public class Windows extends Widget {
}
public void sysDraw() {
//Log.verbose("Draw on " + this.size);
//LOGGER.trace("Draw on " + this.size);
// set the size of the open GL system
OpenGL.setViewPort(Vector3f.ZERO, this.size);
OpenGL.disable(OpenGL.Flag.flag_dither);
@ -309,18 +312,18 @@ public class Windows extends Widget {
OpenGL.clear(OpenGL.ClearFlag.clearFlag_colorBuffer);
OpenGL.clear(OpenGL.ClearFlag.clearFlag_depthBuffer);
//Log.warning(" WINDOWS draw on " + this.currentDrawId);
//LOGGER.warn(" WINDOWS draw on " + this.currentDrawId);
// first display the windows on the display
if (this.subWidget != null) {
this.subWidget.systemDraw(displayProp);
//Log.debug("Draw Windows");
//LOGGER.debug("Draw Windows");
}
// second display the pop-up
for (final Widget it : this.popUpWidgetList) {
if (it != null) {
it.systemDraw(displayProp);
//Log.debug("Draw Pop-up");
//LOGGER.debug("Draw Pop-up");
}
}
}

View File

@ -15,7 +15,6 @@ import org.atriasoft.aknot.annotation.AknotSignal;
import org.atriasoft.esignal.Signal;
import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.Uri;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.widget.Button;
import org.atriasoft.ewol.widget.CheckBox;
import org.atriasoft.ewol.widget.Composer;
@ -23,6 +22,8 @@ import org.atriasoft.ewol.widget.Entry;
import org.atriasoft.ewol.widget.ImageDisplay;
import org.atriasoft.ewol.widget.Label;
import org.atriasoft.ewol.widget.ListFileSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* File Chooser is a simple selector of file for opening, saving, and what you want ...
@ -73,6 +74,7 @@ import org.atriasoft.ewol.widget.ListFileSystem;
* This is the best example of a Meta-widget.
*/
public class FileChooser extends Composer {
private static final Logger LOGGER = LoggerFactory.getLogger(FileChooser.class);
static void onCallbackButtonCancelPressed(final FileChooser self, final Boolean value) {
if (!value) {
@ -91,7 +93,8 @@ public class FileChooser extends Composer {
// == > change the file name.get(.get(
self.propertyFile = value;
// update the selected file in the list :
if (self.getSubObjectNamed("[" + Long.toString(self.getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
if (self.getSubObjectNamed(
"[" + Long.toString(self.getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
tmp.setPropertyFile(new File(self.propertyFile));
}
}
@ -102,17 +105,19 @@ public class FileChooser extends Composer {
}
protected static void onCallbackHidenFileChangeChangeValue(final FileChooser self, final Boolean value) {
if (self.getSubObjectNamed("[" + Long.toString(self.getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
if (self.getSubObjectNamed(
"[" + Long.toString(self.getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
tmp.setPropertyShowHidden(value);
}
if (self.getSubObjectNamed("[" + Long.toString(self.getId()) + "]file-chooser:list-folder") instanceof final ListFileSystem tmp) {
if (self.getSubObjectNamed(
"[" + Long.toString(self.getId()) + "]file-chooser:list-folder") instanceof final ListFileSystem tmp) {
tmp.setPropertyShowHidden(value);
}
}
protected static void onCallbackHomePressed(final FileChooser self) {
final String tmpUserFolder = System.getProperty("user.home");
Log.debug("new PATH: '" + tmpUserFolder + "'");
LOGGER.debug("new PATH: '" + tmpUserFolder + "'");
self.propertyPath = tmpUserFolder;
self.propertyFile = "";
@ -131,16 +136,16 @@ public class FileChooser extends Composer {
protected static void onCallbackListFileValidate(final FileChooser self, final String value) {
// select the file == > generate a validate
self.setPropertyFile(value);
Log.verbose(" generate a fiel opening : '" + self.propertyFile + "'");
LOGGER.trace(" generate a fiel opening : '" + self.propertyFile + "'");
self.signalValidate.emit(value);
self.autoDestroy();
}
protected static void onCallbackListFolderSelectChange(final FileChooser self, final String value) {
// == > this is an internal event ...
Log.debug(" old PATH: '" + self.propertyPath + "' ==> '" + value + "'");
LOGGER.debug(" old PATH: '" + self.propertyPath + "' ==> '" + value + "'");
self.propertyPath = value;
Log.debug("new PATH: '" + self.propertyPath + "'");
LOGGER.debug("new PATH: '" + self.propertyPath + "'");
self.propertyFile = "";
self.updateCurrentFolder();
}
@ -150,10 +155,10 @@ public class FileChooser extends Composer {
return;
}
if (self.propertyFile.isEmpty()) {
Log.warning(" Validate : '" + self.propertyFile + "' ==> error No name ...");
LOGGER.warn(" Validate : '" + self.propertyFile + "' ==> error No name ...");
return;
}
Log.debug(" generate a file opening : '" + self.propertyFile + "'");
LOGGER.debug(" generate a file opening : '" + self.propertyFile + "'");
self.signalValidate.emit(self.propertyFile);
self.autoDestroy();
}
@ -184,30 +189,36 @@ public class FileChooser extends Composer {
onChangePropertyLabelValidate();
onChangePropertyLabelCancel();
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:show-hiden-file") instanceof final CheckBox tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:show-hiden-file") instanceof final CheckBox tmp) {
tmp.signalValue.connectAuto(this, FileChooser::onCallbackHidenFileChangeChangeValue);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:button-validate") instanceof final Button tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:button-validate") instanceof final Button tmp) {
tmp.signalValue.connectAuto(this, FileChooser::onCallbackListValidate);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:button-cancel") instanceof final Button tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:button-cancel") instanceof final Button tmp) {
tmp.signalValue.connectAuto(this, FileChooser::onCallbackButtonCancelPressed);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:list-folder") instanceof final ListFileSystem tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:list-folder") instanceof final ListFileSystem tmp) {
tmp.signalFolderValidate.connectAuto(this, FileChooser::onCallbackListFolderSelectChange);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
tmp.signalFileSelect.connectAuto(this, FileChooser::onCallbackListFileSelectChange);
tmp.signalFileValidate.connectAuto(this, FileChooser::onCallbackListFileValidate);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:entry-file") instanceof final Entry tmp) {
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:entry-file") instanceof final Entry tmp) {
tmp.signalModify.connectAuto(this, FileChooser::onCallbackEntryFileChangeValue);
tmp.signalEnter.connectAuto(this, FileChooser::onCallbackEntryFileChangeValidate);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:entry-folder") instanceof final Entry tmp) {
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:entry-folder") instanceof final Entry tmp) {
tmp.signalModify.connectAuto(this, FileChooser::onCallbackEntryFolderChangeValue);
}
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:img-home") instanceof final ImageDisplay tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:img-home") instanceof final ImageDisplay tmp) {
tmp.signalPressed.connectAuto(this, FileChooser::onCallbackHomePressed);
}
// set the default Folder properties:
@ -237,25 +248,27 @@ public class FileChooser extends Composer {
}
protected void onChangePropertyFile() {
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:entry-file") instanceof final ListFileSystem tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:entry-file") instanceof final ListFileSystem tmp) {
tmp.setPropertyFile(new File(this.propertyFile));
}
}
protected void onChangePropertyLabelCancel() {
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:cancel-label") instanceof final Label tmp) {
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:cancel-label") instanceof final Label tmp) {
tmp.setPropertyValue(this.propertyLabelCancel);
}
}
protected void onChangePropertyLabelTitle() {
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:title-label") instanceof final Label tmp) {
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:title-label") instanceof final Label tmp) {
tmp.setPropertyValue(this.propertyLabelTitle);
}
}
protected void onChangePropertyLabelValidate() {
if (this.getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:validate-label") instanceof final Label tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:validate-label") instanceof final Label tmp) {
tmp.setPropertyValue(this.propertyLabelValidate);
}
}
@ -333,10 +346,12 @@ public class FileChooser extends Composer {
}
private void updateCurrentFolder() {
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:list-files") instanceof final ListFileSystem tmp) {
tmp.setPropertyPath(this.propertyPath);
}
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:list-folder") instanceof final ListFileSystem tmp) {
if (getSubObjectNamed(
"[" + Long.toString(getId()) + "]file-chooser:list-folder") instanceof final ListFileSystem tmp) {
tmp.setPropertyPath(this.propertyPath);
}
if (getSubObjectNamed("[" + Long.toString(getId()) + "]file-chooser:entry-folder") instanceof final Entry tmp) {

View File

@ -7,7 +7,6 @@ import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector3b;
import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.ResourceConfigFile;
import org.atriasoft.ewol.widget.Button;
import org.atriasoft.ewol.widget.Composer;
@ -15,11 +14,14 @@ import org.atriasoft.ewol.widget.Entry;
import org.atriasoft.ewol.widget.Sizer;
import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.ewol.widget.model.SpinPosition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @ingroup ewolWidgetGroup
*/
public class SpinBase extends Sizer {
private static final Logger LOGGER = LoggerFactory.getLogger(SpinBase.class);
// properties list:
private Uri propertyShape; //!< Shape of the widget
private SpinPosition propertySpinMode = SpinPosition.RIGHT_RIGHT; //!< How to display the spin base
@ -109,7 +111,7 @@ public class SpinBase extends Sizer {
this.widgetEntry = new Entry();
if (this.config != null) {
final String shaper = this.config.getString(this.confIdEntryShaper);
Log.verbose("shaper entry : " + shaper);
LOGGER.trace("shaper entry : " + shaper);
if (!shaper.isEmpty()) {
this.widgetEntry.setPropertyConfig(Uri.valueOf(shaper));
}
@ -121,7 +123,7 @@ public class SpinBase extends Sizer {
this.widgetButtonDown = new Button();
if (this.config != null) {
final String shaper = this.config.getString(this.confIdDownShaper);
Log.verbose("shaper button DOWN : " + shaper);
LOGGER.trace("shaper button DOWN : " + shaper);
if (!shaper.isEmpty()) {
this.widgetButtonDown.setPropertyConfig(Uri.valueOf(shaper));
}
@ -136,7 +138,7 @@ public class SpinBase extends Sizer {
this.widgetButtonUp = new Button();
if (this.config != null) {
final String shaper = this.config.getString(this.confIdUpShaper);
Log.verbose("shaper button UP : " + shaper);
LOGGER.trace("shaper button UP : " + shaper);
if (!shaper.isEmpty()) {
this.widgetButtonUp.setPropertyConfig(Uri.valueOf(shaper));
}

View File

@ -1,59 +0,0 @@
package test.atriasoft.ewol;
import org.atriasoft.reggol.LogLevel;
import org.atriasoft.reggol.Logger;
public class Log {
private static final String LIB_NAME = "etk-test";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
private Log() {}
public static void print(String data) {
if (PRINT_PRINT)
Logger.print(LIB_NAME_DRAW, data);
}
public static void critical(String data) {
if (PRINT_CRITICAL)
Logger.critical(LIB_NAME_DRAW, data);
}
public static void error(String data) {
if (PRINT_ERROR)
Logger.error(LIB_NAME_DRAW, data);
}
public static void warning(String data) {
if (PRINT_WARNING)
Logger.warning(LIB_NAME_DRAW, data);
}
public static void info(String data) {
if (PRINT_INFO)
Logger.info(LIB_NAME_DRAW, data);
}
public static void debug(String data) {
if (PRINT_DEBUG)
Logger.debug(LIB_NAME_DRAW, data);
}
public static void verbose(String data) {
if (PRINT_VERBOSE)
Logger.verbose(LIB_NAME_DRAW, data);
}
public static void todo(String data) {
if (PRINT_TODO)
Logger.todo(LIB_NAME_DRAW, data);
}
}

View File

@ -1,18 +0,0 @@
package test.atriasoft.ewol;
import org.atriasoft.reggol.LogLevel;
import org.atriasoft.reggol.Logger;
public class Log2 {
private static final String LIB_NAME = "etk-test-2";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
private Log2() {}
public static void debug(String data) {
if (PRINT_DEBUG)
Logger.debug(LIB_NAME_DRAW, data);
}
}

View File

@ -8,14 +8,9 @@
******************************************************************************/
package test.atriasoft.ewol;
import java.util.ArrayList;
import java.util.List;
import org.atriasoft.reggol.Logger;
import org.junit.Test;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
//import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
@ -25,79 +20,7 @@ public class TestBasicLog {
@Test
@Order(1)
public void aaFirstInitialisation() {
List<String> args = new ArrayList<>();
args.add("--log-level=999");
args.add("--log-level=1");
args.add("--log-no-color");
args.add("--log-color");
args.add("--log-lib=sc-log-test+6");
args.add("--log-lib=sc-log-test/6");
args.add("--log-lib=sc-log-test:6");
args.add("--log-lib=sc-log-test:verbose");
args.add("--log-lib=sc-log-test2+3");
args.add("--log-lib=sc-log-test");
args.add("--log-with-stupid-parameter=sdkfjsqdlkf");
args.add("--help");
Logger.init(args);
}
@Test
@Order(2)
public void bbSecondInitialisation() {
List<String> args = new ArrayList<>();
Logger.init(args);
}
@Test
@Order(3)
public void ccBasicLogCall() {
Log.print("Simple print");
Log.todo("Simple todo");
Log.error("Simple error");
Log.warning("Simple warning");
Log.info("Simple info");
Log.debug("Simple debug");
Log.verbose("Simple verbose");
}
// TODO REFACTO REMOVE this and set it in the Test of the logger.
public static String getAAAAAAA(int dfsdf) {
int hhh = 0;
for (int kkk = 0; kkk < dfsdf; kkk++)
for (int iii = 0; iii < 10000; iii++)
for (int jjj = 0; jjj < 100000; jjj++)
for (int lll = 0; lll < 100000; lll++)
hhh++;
return "kkk" + hhh;
}
public static void testLog() {
Log.print("test direct [START]");
// test de 10 secondes contre 0.0?? second quand le niveau n'est pas assez grand ...
long timeStart = System.currentTimeMillis();
for (int iii = 0; iii < 100000000; iii++)
Log2.debug("test direct");
long timeStop = System.currentTimeMillis();
Log.print("test direct [END] : " + timeStart + " to " + timeStop + " ==> delta=" + (timeStop - timeStart));
Log.print("test concat [START]");
// C'est très long dans les 2 cas ...
timeStart = System.currentTimeMillis();
for (int iii = 0; iii < 6; iii++)
Log2.debug("test concat: non fonctionnel, il applelle le get a chaque log ... " + getAAAAAAA(iii));
timeStop = System.currentTimeMillis();
Log.print("test concat [END] : " + timeStart + " to " + timeStop + " ==> delta=" + (timeStop - timeStart));
}
@Test
@Order(4)
public void ddTestSimpleLog() {
testLog();
}
@Test
@Order(4)
public void eeUsage() {
Logger.usage();
// basic kanva
}
}