Compare commits

..

9 Commits

112 changed files with 664 additions and 713 deletions

View File

@ -7,13 +7,13 @@
<spacer expand="true,false"/> <spacer expand="true,false"/>
<button name="[{ID}]file-shooser:button-validate"> <button name="[{ID}]file-shooser:button-validate">
<sizer mode="hori"> <sizer mode="hori">
<image src="{ewol}THEME:GUI:Load.svg" fill="true" size="7,7mm"/> <image src="THEME_GUI:///Load.svg?lib=ewol" fill="true" size="7,7mm"/>
<label name="[{ID}]file-shooser:validate-label">_T{Validate}</label> <label name="[{ID}]file-shooser:validate-label">_T{Validate}</label>
</sizer> </sizer>
</button> </button>
<button name="[{ID}]file-shooser:button-cancel"> <button name="[{ID}]file-shooser:button-cancel">
<sizer mode="hori"> <sizer mode="hori">
<image src="{ewol}THEME:GUI:Remove.svg" fill="true" size="7,7mm"/> <image src="THEME_GUI:///Remove.svg?lib=ewol" fill="true" size="7,7mm"/>
<label name="[{ID}]file-shooser:cancel-label">_T{Cancel}</label> <label name="[{ID}]file-shooser:cancel-label">_T{Cancel}</label>
</sizer> </sizer>
</button> </button>
@ -37,13 +37,13 @@
<spacer min-size="2,2mm"/> <spacer min-size="2,2mm"/>
</sizer> </sizer>
<sizer mode="hori"> <sizer mode="hori">
<image name="[{ID}]file-shooser:img-file" src="{ewol}THEME:GUI:File.svg" expand="false" size="8,8mm"/> <image name="[{ID}]file-shooser:img-file" src="THEME_GUI:///File.svg?lib=ewol" expand="false" size="8,8mm"/>
<entry name="[{ID}]file-shooser:entry-file" expand="true,false" fill="true,false"/> <entry name="[{ID}]file-shooser:entry-file" expand="true,false" fill="true,false"/>
</sizer> </sizer>
<sizer mode="hori"> <sizer mode="hori">
<image name="[{ID}]file-shooser:img-folder" src="{ewol}THEME:GUI:Folder.svg" expand="false" size="8,8mm"/> <image name="[{ID}]file-shooser:img-folder" src="THEME_GUI:///Folder.svg?lib=ewol" expand="false" size="8,8mm"/>
<entry name="[{ID}]file-shooser:entry-folder" expand="true,false" fill="true,false"/> <entry name="[{ID}]file-shooser:entry-folder" expand="true,false" fill="true,false"/>
<image name="[{ID}]file-shooser:img-home" src="{ewol}THEME:GUI:Home.svg" expand="false" size="8,8mm"/> <image name="[{ID}]file-shooser:img-home" src="THEME_GUI:///Home.svg?lib=ewol" expand="false" size="8,8mm"/>
</sizer> </sizer>
<label name="[{ID}]file-shooser:title-label">_T{Title}</label> <label name="[{ID}]file-shooser:title-label">_T{Title}</label>
</sizer> </sizer>

View File

@ -30,7 +30,7 @@ void main(void) {
// Smooth // Smooth
gl_FragColor = vec4(f_color[0], f_color[1], f_color[2], f_color[3]*alpha); gl_FragColor = vec4(f_color[0], f_color[1], f_color[2], f_color[3]*alpha);
//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
// Outline // Outline
/* /*
float mu = smoothstep(outline_center-width, outline_center+width, dist); float mu = smoothstep(outline_center-width, outline_center+width, dist);

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Button.prog", program:"THEME_GUI:///Button.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Button.json" color:"THEME_COLOR:///Button.json?lib=ewol"
} }

View File

@ -6,6 +6,6 @@
padding-top:10, padding-top:10,
padding-buttom:10, padding-buttom:10,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:CheckBox.prog", program:"THEME_GUI:///CheckBox.prog?lib=ewol",
color:"{ewol}THEME:COLOR:CheckBox.json" color:"THEME_COLOR:///CheckBox.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:ContextMenu.prog", program:"THEME_GUI:///ContextMenu.prog?lib=ewol",
color:"{ewol}THEME:COLOR:ContextMenu.json" color:"THEME_COLOR:///ContextMenu.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Entry.prog", program:"THEME_GUI:///Entry.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Entry.json" color:"THEME_COLOR:///Entry.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:PopUp.prog", program:"THEME_GUI:///PopUp.prog?lib=ewol,
color:"{ewol}THEME:COLOR:PopUp.json" color:"THEME_COLOR:///PopUp.json?lib=ewol"
} }

View File

@ -4,6 +4,6 @@
padding-top:16, padding-top:16,
padding-buttom:16, padding-buttom:16,
change-time:200, change-time:200,
program:"{ewol}THEME:GUI:WidgetScrolled.prog", program:"THEME_GUI:///WidgetScrolled.prog?lib=ewol",
color:"{ewol}THEME:COLOR:WidgetScrolled.json" color:"THEME_COLOR:///WidgetScrolled.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Button.prog", program:"THEME_GUI:///Button.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Button.json" color:"THEME_COLOR:///Button.json?lib=ewol"
} }

View File

@ -20,6 +20,6 @@
box-size:20, box-size:20,
box-inside:12, box-inside:12,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:CheckBox.prog", program:"THEME_GUI:///CheckBox.prog?lib=ewol",
color:"{ewol}THEME:COLOR:CheckBox.json" color:"THEME_COLOR:///CheckBox.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:2, padding-in-buttom:2,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:ContextMenu.prog", program:"THEME_GUI:///ContextMenu.prog?lib=ewol",
color:"{ewol}THEME:COLOR:ContextMenu.json" color:"THEME_COLOR:///ContextMenu.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:2, padding-in-buttom:2,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Entry.prog", program:"THEME_GUI:///Entry.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Entry.json" color:"THEME_COLOR:///Entry.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:2, padding-in-buttom:2,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:PopUp.prog", program:"THEME_GUI:///PopUp.prog?lib=ewol",
color:"{ewol}THEME:COLOR:PopUp.json" color:"THEME_COLOR:///PopUp.json?lib=ewol"
} }

View File

@ -1,5 +1,5 @@
{ {
entry-shaper:"{ewol}THEME:GUI:SelectEntry.json", entry-shaper:"THEME_GUI:///SelectEntry.json?lib=ewol",
up-shaper:"{ewol}THEME:GUI:SelectBt.json", up-shaper:"THEME_GUI:///SelectBt.json?lib=ewol",
up-data:"<label>*</label>", up-data:"<label>*</label>",
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Button.prog", program:"THEME_GUI:///Button.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Button.json" color:"THEME_COLOR:///Button.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Entry.prog", program:"THEME_GUI:///Entry.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Entry.json" color:"THEME_COLOR:///Entry.json?lib=ewol"
} }

View File

@ -1,7 +1,7 @@
{ {
entry-shaper:"{ewol}THEME:GUI:SpinEntry.json", entry-shaper:"THEME_GUI:///SpinEntry.json?lib=ewol",
up-shaper:"{ewol}THEME:GUI:SpinUp.json", up-shaper:"THEME_GUI:///SpinUp.json?lib=ewol",
up-data:"<label>+</label>", up-data:"<label>+</label>",
down-shaper:"{ewol}THEME:GUI:SpinDown.json", down-shaper:"THEME_GUI:///SpinDown.json?lib=ewol",
down-data:"<label>-</label>", down-data:"<label>-</label>",
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Button.prog", program:"THEME_GUI:///Button.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Button.json" color:"THEME_COLOR:///Button.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Entry.prog", program:"THEME_GUI:///Entry.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Entry.json" color:"THEME_COLOR:///Entry.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:1, padding-in-buttom:1,
change-time:356, change-time:356,
program:"{ewol}THEME:GUI:Button.prog", program:"THEME_GUI:///Button.prog?lib=ewol",
color:"{ewol}THEME:COLOR:Button.json" color:"THEME_COLOR:///Button.json?lib=ewol"
} }

View File

@ -18,6 +18,6 @@
padding-in-buttom:3, padding-in-buttom:3,
change-time:200, change-time:200,
program:"{ewol}THEME:GUI:WidgetScrolled.prog", program:"THEME_GUI:///WidgetScrolled.prog?lib=ewol",
color:"{ewol}THEME:COLOR:WidgetScrolled.json" color:"THEME_COLOR:///WidgetScrolled.json?lib=ewol"
} }

View File

@ -29,7 +29,7 @@ Generic Properties {#ewol_tutorial_file_access_pr
By default we dertermine some basics for files. By default we dertermine some basics for files.
Then we need to determine file in the tree with: Then we need to determine file in the tree with:
- **"DATA:XXX"** Application internal data - **"DATA:///XXX"** Application internal data
* Linux: /usr/share/applName/ * Linux: /usr/share/applName/
* Android: /xxx/yyy/applName.apk/asssets/ * Android: /xxx/yyy/applName.apk/asssets/
* IOs: applName.app/share * IOs: applName.app/share
@ -47,7 +47,7 @@ Then we need to determine file in the tree with:
When you will call a file, you need to just call it with the starting name. When you will call a file, you need to just call it with the starting name.
For example if I want to access at an application data I will call the file : "DATA:myImage.png" For example if I want to access at an application data I will call the file : "DATA:///myImage.png"
Integrate a file in a package {#ewol_tutorial_file_access_package} Integrate a file in a package {#ewol_tutorial_file_access_package}
============================= =============================
@ -61,7 +61,7 @@ In your ```lutin_xxx.py``` file add:
myModule.copy_path("relative/path/start*.png","destination/folder/") myModule.copy_path("relative/path/start*.png","destination/folder/")
``` ```
And now you can acces on these file with : "DATA:destination/folder/fileNewName.svg" And now you can acces on these file with : "DATA:///destination/folder/fileNewName.svg"
Read a file {#ewol_tutorial_file_access_read} Read a file {#ewol_tutorial_file_access_read}
@ -73,7 +73,7 @@ Read a file {#ewol_tutorial_file_access_read}
... ...
etk::FSNode file("DATA:destination/folder/file.svg"); etk::FSNode file("DATA:///destination/folder/file.svg");
if (file.exist() == false) { if (file.exist() == false) {
APPL_ERROR("Can not read the file (Does not exist)"); APPL_ERROR("Can not read the file (Does not exist)");
return; return;
@ -144,7 +144,7 @@ And when you want to change the theme, just call:
This is not done automaticly, because reloading the resources can have a real cost of time. This is not done automaticly, because reloading the resources can have a real cost of time.
``` ```
You can acces on your theme with accessing the filename: "THEME:GUI_COLOR:your/sub/path/file.xx" You can acces on your theme with accessing the filename: "THEME_GUI_COLOR:///your/sub/path/file.xx"
An important think is that the theme file is searching in many path in the order: An important think is that the theme file is searching in many path in the order:
- USERDATA:GUI_COLOR:your/sub/path/file.xx - USERDATA:GUI_COLOR:your/sub/path/file.xx

View File

@ -40,7 +40,7 @@ namespace appl {
//! @brief Constructor //! @brief Constructor
MyObj(void) : MyObj(void) :
propertyConfig(this, "file", propertyConfig(this, "file",
"DATA:ExapleConfig.json", "DATA:///ExapleConfig.json",
"no desc", "no desc",
&appl::MyObj::onChangePropertyFile), &appl::MyObj::onChangePropertyFile),
m_configValId(-1) { m_configValId(-1) {
@ -128,7 +128,7 @@ When loose hardware (juste update internal state the hardware is no more present
void removeContextToLate(); void removeContextToLate();
``` ```
When user request to reload all resources (can be usefull when using file type : THEME:GUI:xxx) When user request to reload all resources (can be usefull when using file type : THEME_GUI:///xxx)
```{.cpp} ```{.cpp}
void reload(); void reload();
``` ```

View File

@ -98,7 +98,7 @@ File ```gui.xml```
```{.cpp} ```{.cpp}
#include <ewol::widget::Composer.hpp> #include <ewol::widget::Composer.hpp>
ewol::widget::WidgetShared tmpWidget = ewol::widget::composerGenerateFile("DATA:gui.xml"); ewol::widget::WidgetShared tmpWidget = ewol::widget::composerGenerateFile("DATA:///gui.xml");
if (tmpWidget == null) { if (tmpWidget == null) {
APPL_CRITICAL("The widget can not be created"); APPL_CRITICAL("The widget can not be created");
} }

View File

@ -46,7 +46,7 @@ ewol::compositing::Area::~Area() {
void ewol::compositing::Area::loadProgram() { void ewol::compositing::Area::loadProgram() {
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = gale::resource::Program::create(etk::String("{ewol}DATA:textured3D.prog")); m_GLprogram = gale::resource::Program::create(etk::String("DATA:///textured3D.prog?lib=ewol"));
if (m_GLprogram != null) { if (m_GLprogram != null) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color"); m_GLColor = m_GLprogram->getAttribute("EW_color");

View File

@ -299,7 +299,7 @@ void ewol::compositing::Drawing::loadProgram() {
// remove previous loading ... in case // remove previous loading ... in case
unLoadProgram(); unLoadProgram();
// oad the new ... // oad the new ...
m_GLprogram = gale::resource::Program::create("{ewol}DATA:color3.prog"); m_GLprogram = gale::resource::Program::create("DATA:///color3.prog?lib=ewol");
// get the shader resource : // get the shader resource :
if (m_GLprogram != null) { if (m_GLprogram != null) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");

View File

@ -17,7 +17,7 @@ const int32_t ewol::compositing::Image::m_vboIdCoordTex(1);
const int32_t ewol::compositing::Image::m_vboIdColor(2); const int32_t ewol::compositing::Image::m_vboIdColor(2);
#define NB_VBO (3) #define NB_VBO (3)
ewol::compositing::Image::Image(const etk::String& _imageName, ewol::compositing::Image::Image(const etk::Uri& _imageName,
bool _df, bool _df,
int32_t _size) : int32_t _size) :
m_filename(_imageName), m_filename(_imageName),
@ -58,9 +58,9 @@ void ewol::compositing::Image::loadProgram() {
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram.reset(); m_GLprogram.reset();
if (m_distanceFieldMode == true) { if (m_distanceFieldMode == true) {
m_GLprogram = gale::resource::Program::create("{ewol}DATA:texturedDF.prog"); m_GLprogram = gale::resource::Program::create("DATA:///texturedDF.prog?lib=ewol");
} else { } else {
m_GLprogram = gale::resource::Program::create("{ewol}DATA:textured3D.prog"); m_GLprogram = gale::resource::Program::create("DATA:///textured3D.prog?lib=ewol");
} }
if (m_GLprogram != null) { if (m_GLprogram != null) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
@ -271,9 +271,9 @@ void ewol::compositing::Image::printPart(const vec2& _size,
m_VBO->flush(); m_VBO->flush();
} }
void ewol::compositing::Image::setSource(const etk::String& _newFile, const vec2& _size) { void ewol::compositing::Image::setSource(const etk::Uri& _uri, const vec2& _size) {
clear(); clear();
if ( m_filename == _newFile if ( m_filename == _uri
&& m_requestSize == _size) { && m_requestSize == _size) {
// Nothing to do ... // Nothing to do ...
return; return;
@ -281,14 +281,14 @@ void ewol::compositing::Image::setSource(const etk::String& _newFile, const vec2
ememory::SharedPtr<ewol::resource::TextureFile> resource = m_resource; ememory::SharedPtr<ewol::resource::TextureFile> resource = m_resource;
ememory::SharedPtr<ewol::resource::ImageDF> resourceDF = m_resourceDF; ememory::SharedPtr<ewol::resource::ImageDF> resourceDF = m_resourceDF;
ememory::SharedPtr<ewol::resource::Texture> resourceTex = m_resourceImage; ememory::SharedPtr<ewol::resource::Texture> resourceTex = m_resourceImage;
m_filename = _newFile; m_filename = _uri;
m_requestSize = _size; m_requestSize = _size;
m_resource.reset(); m_resource.reset();
m_resourceDF.reset(); m_resourceDF.reset();
m_resourceImage.reset(); m_resourceImage.reset();
ivec2 tmpSize(_size.x(),_size.y()); ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded... // note that no image can be loaded...
if (_newFile != "") { if (_uri.isEmpty() == false) {
// link to new one // link to new one
if (m_distanceFieldMode == false) { if (m_distanceFieldMode == false) {
m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize); m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize);

View File

@ -17,7 +17,7 @@ namespace ewol {
public: public:
static const int32_t sizeAuto; static const int32_t sizeAuto;
private: private:
etk::String m_filename; etk::Uri m_filename;
ivec2 m_requestSize; ivec2 m_requestSize;
vec3 m_position; //!< The current position to draw vec3 m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position vec3 m_clippingPosStart; //!< Clipping start position
@ -50,11 +50,11 @@ namespace ewol {
public: public:
/** /**
* @brief generic constructor * @brief generic constructor
* @param[in] _imageName Name of the file that might be loaded * @param[in] _uri URI of the file that might be loaded
* @param[in] _df enable distance field mode * @param[in] _df enable distance field mode
* @param[in] _size for the image when Verctorial image loading is requested * @param[in] _size for the image when Verctorial image loading is requested
*/ */
Image(const etk::String& _imageName="", Image(const etk::Uri& _uri="",
bool _df=false, bool _df=false,
int32_t _size=ewol::compositing::Image::sizeAuto); int32_t _size=ewol::compositing::Image::sizeAuto);
/** /**
@ -156,13 +156,13 @@ namespace ewol {
vec2 _sourcePosStop); vec2 _sourcePosStop);
/** /**
* @brief change the image Source == > can not be done to display 2 images at the same time ... * @brief change the image Source == > can not be done to display 2 images at the same time ...
* @param[in] _newFile New file of the Image * @param[in] _uri New file of the Image
* @param[in] _size for the image when Verctorial image loading is requested * @param[in] _size for the image when Verctorial image loading is requested
*/ */
void setSource(const etk::String& _newFile, int32_t _size=32) { void setSource(const etk::Uri& _uri, int32_t _size=32) {
setSource(_newFile, vec2(_size,_size)); setSource(_uri, vec2(_size,_size));
}; };
void setSource(const etk::String& _newFile, const vec2& _size); void setSource(const etk::Uri& _uri, const vec2& _size);
void setSource(egami::Image _image); void setSource(egami::Image _image);
/** /**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..

View File

@ -4,7 +4,7 @@
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#include <etk/os/FSNode.hpp> #include <etk/uri/uri.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ewol/compositing/Shaper.hpp> #include <ewol/compositing/Shaper.hpp>
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
@ -15,8 +15,8 @@ const int32_t ewol::compositing::Shaper::m_vboIdCoord(0);
const int32_t ewol::compositing::Shaper::m_vboIdPos(1); const int32_t ewol::compositing::Shaper::m_vboIdPos(1);
#define NB_VBO (2) #define NB_VBO (2)
ewol::compositing::Shaper::Shaper(const etk::String& _shaperName) : ewol::compositing::Shaper::Shaper(const etk::Uri& _uri) :
m_name(_shaperName), m_uri(_uri),
m_config(null), m_config(null),
m_confIdMode(-1), m_confIdMode(-1),
m_confIdDisplayOutside(-1), m_confIdDisplayOutside(-1),
@ -83,11 +83,11 @@ void ewol::compositing::Shaper::unLoadProgram() {
} }
void ewol::compositing::Shaper::loadProgram() { void ewol::compositing::Shaper::loadProgram() {
if (m_name == "") { if (m_uri.isEmpty() == true) {
EWOL_DEBUG("no Shaper set for loading resources ..."); EWOL_DEBUG("no Shaper set for loading resources ...");
return; return;
} }
m_config = ewol::resource::ConfigFile::create(m_name); m_config = ewol::resource::ConfigFile::create(m_uri.get());
if (m_config != null) { if (m_config != null) {
m_confIdMode = m_config->request("mode"); m_confIdMode = m_config->request("mode");
m_confIdDisplayOutside = m_config->request("display-outside"); m_confIdDisplayOutside = m_config->request("display-outside");
@ -113,8 +113,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::String tmpFilename(basicShaderFile); etk::String tmpFilename(basicShaderFile);
if (tmpFilename.find(':') == etk::String::npos) { if (tmpFilename.find(':') == etk::String::npos) {
// get the relative position of the current file ... // get the relative position of the current file ...
etk::FSNode file(m_name); etk::Uri tmpUri = m_uri;
tmpFilename = file.getRelativeFolder() + basicShaderFile; tmpUri.setPath(m_uri.getPath().getParent() / basicShaderFile);
tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'"); EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'");
} else { } else {
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "'"); EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "'");
@ -140,8 +141,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::String tmpFilename(basicImageFile); etk::String tmpFilename(basicImageFile);
if (tmpFilename.find(':') == etk::String::npos) { if (tmpFilename.find(':') == etk::String::npos) {
// get the relative position of the current file ... // get the relative position of the current file ...
etk::FSNode file(m_name); etk::Uri tmpUri = m_uri;
tmpFilename = file.getRelativeFolder() + basicImageFile; tmpUri.setPath(m_uri.getPath().getParent() / basicImageFile);
tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "' with base : '" << basicImageFile << "'"); EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "' with base : '" << basicImageFile << "'");
} else { } else {
EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "'"); EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "'");
@ -155,8 +157,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::String tmpFilename(basicColorFile); etk::String tmpFilename(basicColorFile);
if (tmpFilename.find(':') == etk::String::npos) { if (tmpFilename.find(':') == etk::String::npos) {
// get the relative position of the current file ... // get the relative position of the current file ...
etk::FSNode file(m_name); etk::Uri tmpUri = m_uri;
tmpFilename = file.getRelativeFolder() + basicColorFile; tmpUri.setPath(m_uri.getPath().getParent() / basicColorFile);
tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'"); EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'");
} else { } else {
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "'"); EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "'");
@ -626,15 +629,15 @@ ewol::Padding ewol::compositing::Shaper::getBorder() {
return padding; return padding;
} }
void ewol::compositing::Shaper::setSource(const etk::String& _newFile) { void ewol::compositing::Shaper::setSource(const etk::Uri& _uri) {
clear(); clear();
unLoadProgram(); unLoadProgram();
m_name = _newFile; m_uri = _uri;
loadProgram(); loadProgram();
} }
bool ewol::compositing::Shaper::hasSources() { bool ewol::compositing::Shaper::hasSources() {
return m_GLprogram!=null; return m_GLprogram != null;
} }
@ -675,7 +678,7 @@ double ewol::compositing::Shaper::getConfigNumber(int32_t _id) {
namespace etk { namespace etk {
template<> etk::String toString<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) { template<> etk::String toString<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
return _obj.getSource(); return _obj.getSource().get();
} }
template<> etk::UString toUString<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) { template<> etk::UString toUString<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
return etk::toUString(etk::toString(_obj)); return etk::toUString(etk::toString(_obj));

View File

@ -38,7 +38,7 @@ namespace ewol {
// TODO : Abstaraction between states (call by name and the system greate IDs // TODO : Abstaraction between states (call by name and the system greate IDs
class Shaper : public ewol::Compositing { class Shaper : public ewol::Compositing {
private: private:
etk::String m_name; //!< Name of the configuration of the shaper. etk::Uri m_uri; //!< Name of the configuration of the shaper.
// External theme config: // External theme config:
ememory::SharedPtr<ewol::resource::ConfigFile> m_config; //!< pointer on the config file resources ememory::SharedPtr<ewol::resource::ConfigFile> m_config; //!< pointer on the config file resources
int32_t m_confIdPaddingOut[shaperPosCount]; //!< Padding out property : X-left X-right Y-top Y-buttom int32_t m_confIdPaddingOut[shaperPosCount]; //!< Padding out property : X-left X-right Y-top Y-buttom
@ -92,9 +92,9 @@ namespace ewol {
public: public:
/** /**
* @brief generic constructor * @brief generic constructor
* @param[in] _shaperName Name of the file that might be loaded * @param[in] _uri URI of the file that might be loaded
*/ */
Shaper(const etk::String& _shaperName=""); Shaper(const etk::Uri& _uri="");
/** /**
* @brief generic destructor * @brief generic destructor
*/ */
@ -164,15 +164,15 @@ namespace ewol {
ewol::Padding getBorder(); ewol::Padding getBorder();
/** /**
* @brief change the shaper Source * @brief change the shaper Source
* @param[in] _newFile New file of the shaper * @param[in] _uri New file of the shaper
*/ */
void setSource(const etk::String& _newFile); void setSource(const etk::Uri& _uri);
/** /**
* @brief get the shaper file Source * @brief get the shaper file Source
* @return the shapper file name * @return the shapper file name
*/ */
const etk::String& getSource() const { const etk::Uri& getSource() const {
return m_name; return m_uri;
}; };
/** /**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
@ -284,10 +284,10 @@ namespace ewol {
* == operator * == operator
*****************************************************/ *****************************************************/
bool operator== (const Shaper& _obj) const { bool operator== (const Shaper& _obj) const {
return _obj.m_name == m_name; return _obj.m_uri == m_uri;
} }
bool operator!= (const Shaper& _obj) const { bool operator!= (const Shaper& _obj) const {
return _obj.m_name != m_name; return _obj.m_uri != m_uri;
} }
}; };
} }

View File

@ -99,7 +99,7 @@ namespace ewol {
/** /**
* @brief generic constructor * @brief generic constructor
*/ */
TextBase(const etk::String& _shaderName = "{ewol}DATA:text.prog", bool _loadProgram = true); TextBase(const etk::String& _shaderName = "DATA:///text.prog?lib=ewol", bool _loadProgram = true);
/** /**
* @brief generic destructor * @brief generic destructor
*/ */

View File

@ -17,7 +17,7 @@ ewol::compositing::TextDF::TextDF(const etk::String& _fontName, int32_t _fontSiz
m_GLglyphLevel(-1), m_GLglyphLevel(-1),
m_size(12.0) { m_size(12.0) {
setFont(_fontName, _fontSize); setFont(_fontName, _fontSize);
loadProgram("{ewol}DATA:fontDistanceField/font1.prog"); loadProgram("DATA:///fontDistanceField/font1.prog?lib=ewol");
} }
ewol::compositing::TextDF::~TextDF() { ewol::compositing::TextDF::~TextDF() {

View File

@ -10,7 +10,7 @@
ETK_DECLARE_TYPE(ewol::context::ConfigFont); ETK_DECLARE_TYPE(ewol::context::ConfigFont);
ewol::context::ConfigFont::ConfigFont() : ewol::context::ConfigFont::ConfigFont() :
m_folder("{ewol}DATA:fonts"), m_folder("DATA:///fonts?lib=ewol"),
m_name("Arial;Helvetica"), m_name("Arial;Helvetica"),
m_size(10), m_size(10),
m_useExternal(false) { m_useExternal(false) {
@ -28,16 +28,16 @@ ewol::context::ConfigFont::~ConfigFont() {
void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) { void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) {
m_name = _fontName; m_name = _fontName;
m_size = _size; m_size = _size;
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size); EWOL_DEBUG("Set default Font : '" << m_name << "' size=" << m_size);
} }
void ewol::context::ConfigFont::setSize(int32_t _size) { void ewol::context::ConfigFont::setSize(int32_t _size) {
m_size = _size; m_size = _size;
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size << " (change size only)"); EWOL_DEBUG("Set default Font : '" << m_name << "' size=" << m_size << " (change size only)");
} }
void ewol::context::ConfigFont::setName(const etk::String& _fontName) { void ewol::context::ConfigFont::setName(const etk::String& _fontName) {
m_name = _fontName; m_name = _fontName;
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size << " (change name only)"); EWOL_DEBUG("Set default Font : '" << m_name << "' size=" << m_size << " (change name only)");
} }

View File

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <etk/uri/uri.hpp>
namespace ewol { namespace ewol {
namespace context { namespace context {
@ -17,20 +18,20 @@ namespace ewol {
ConfigFont(); ConfigFont();
virtual ~ConfigFont(); virtual ~ConfigFont();
private: private:
etk::String m_folder; etk::Uri m_folder;
public: public:
/** /**
* @brief Specify the default font folder for the Ewol search system (only needed when embended font) * @brief Specify the default font folder for the Ewol search system (only needed when embended font)
* @param[in] _folder basic folder of the font (ex: DATA:fonts) * @param[in] _folder basic folder of the font (ex: DATA:fonts)
*/ */
void setFolder(const etk::String& _folder) { void setFolder(const etk::Uri& _folder) {
m_folder = _folder; m_folder = _folder;
}; };
/** /**
* @brief get the default font folder. * @brief get the default font folder.
* @return The default font folder. * @return The default font folder.
*/ */
const etk::String& getFolder() { const etk::Uri& getFolder() {
return m_folder; return m_folder;
}; };
private: private:

View File

@ -8,9 +8,9 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/etk.hpp> #include <etk/etk.hpp>
#include <etk/tool.hpp> #include <etk/tool.hpp>
#include <etk/os/FSNode.hpp> #include <etk/theme/theme.hpp>
#include <ethread/tools.hpp> #include <ethread/tools.hpp>
#include <ethread/Mutex.hpp> #include <ethread/Mutex.hpp>
@ -44,7 +44,7 @@ ewol::Context& ewol::getContext() {
} }
void ewol::Context::setInitImage(const etk::String& _fileName) { void ewol::Context::setInitImage(const etk::Uri& _fileName) {
//m_initDisplayImageName = _fileName; //m_initDisplayImageName = _fileName;
} }
@ -68,7 +68,7 @@ void ewol::Context::inputEventUnGrabPointer() {
void ewol::Context::onCreate(gale::Context& _context) { void ewol::Context::onCreate(gale::Context& _context) {
EWOL_INFO(" == > Ewol system create (BEGIN)"); EWOL_INFO(" == > Ewol system create (BEGIN)");
// Add basic ewol translation: // Add basic ewol translation:
etranslate::addPath("ewol", "{ewol}DATA:translate/ewol/"); etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol");
etranslate::autoDetectLanguage(); etranslate::autoDetectLanguage();
// By default we set 2 themes (1 color and 1 shape ...) : // By default we set 2 themes (1 color and 1 shape ...) :
etk::theme::setNameDefault("GUI", "shape/square/"); etk::theme::setNameDefault("GUI", "shape/square/");

View File

@ -142,7 +142,7 @@ namespace ewol {
* @brief Special for init (main) set the start image when loading data * @brief Special for init (main) set the start image when loading data
* @param[in] _fileName Name of the image to load * @param[in] _fileName Name of the image to load
*/ */
void setInitImage(const etk::String& _fileName); void setInitImage(const etk::Uri& _fileName);
public: public:
/** /**
* @brief Request a display after call a resize * @brief Request a display after call a resize

View File

@ -11,7 +11,6 @@
#include <etranslate/etranslate.hpp> #include <etranslate/etranslate.hpp>
#include <gale/context/commandLine.hpp> #include <gale/context/commandLine.hpp>
#include <etk/os/FSNode.hpp>
#include <gale/Dimension.hpp> #include <gale/Dimension.hpp>
#ifndef EWOL_VERSION #ifndef EWOL_VERSION

View File

@ -4,7 +4,7 @@
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#include <etk/os/FSNode.hpp> #include <etk/uri/uri.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ewol/resource/ColorFile.hpp> #include <ewol/resource/ColorFile.hpp>
#include <ejson/ejson.hpp> #include <ejson/ejson.hpp>
@ -19,10 +19,10 @@ ewol::resource::ColorFile::ColorFile() :
addResourceType("ewol::ColorFile"); addResourceType("ewol::ColorFile");
} }
void ewol::resource::ColorFile::init(const etk::String& _filename) { void ewol::resource::ColorFile::init(const etk::Uri& _uri) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
gale::Resource::init(_filename); gale::Resource::init(_uri.get());
EWOL_DEBUG("CF : load \"" << _filename << "\""); EWOL_DEBUG("CF : load \"" << _uri << "\"");
reload(); reload();
EWOL_DEBUG("List of all color : " << m_list.getKeys()); EWOL_DEBUG("List of all color : " << m_list.getKeys());
} }
@ -41,8 +41,8 @@ void ewol::resource::ColorFile::reload() {
} }
// open and read all json elements: // open and read all json elements:
ejson::Document doc; ejson::Document doc;
if (doc.load(m_name) == false) { if (doc.load(etk::Uri(m_name)) == false) {
EWOL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); EWOL_ERROR("Can not load file : '" << m_name << "'");
return; return;
} }
ejson::Array baseArray = doc["color"].toArray(); ejson::Array baseArray = doc["color"].toArray();

View File

@ -23,12 +23,12 @@ namespace ewol {
protected: protected:
/** /**
* @brief Constructor of the color property file * @brief Constructor of the color property file
* @param[in] _filename Name of the file needed * @param[in] _uri Name of the file needed
*/ */
ColorFile(); ColorFile();
void init(const etk::String& _filename); void init(const etk::Uri& _uri);
public: public:
DECLARE_RESOURCE_NAMED_FACTORY(ColorFile); DECLARE_RESOURCE_URI_FACTORY(ColorFile);
/** /**
* @brief Simple Destructor of this class (nothing specific ...) * @brief Simple Destructor of this class (nothing specific ...)
*/ */

View File

@ -24,7 +24,7 @@ void ewol::resource::Colored3DObject::init() {
gale::Resource::init(); gale::Resource::init();
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = gale::resource::Program::create("{ewol}DATA:simple3D.prog"); m_GLprogram = gale::resource::Program::create("DATA:///simple3D.prog?lib=ewol");
if (m_GLprogram != null) { if (m_GLprogram != null) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getUniform("EW_color"); m_GLColor = m_GLprogram->getUniform("EW_color");

View File

@ -4,7 +4,7 @@
* @license MPL v2.0 (see license file) * @license MPL v2.0 (see license file)
*/ */
#include <etk/os/FSNode.hpp> #include <etk/uri/uri.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ewol/resource/ConfigFile.hpp> #include <ewol/resource/ConfigFile.hpp>
#include <gale/resource/Manager.hpp> #include <gale/resource/Manager.hpp>
@ -21,10 +21,10 @@ ewol::resource::ConfigFile::ConfigFile() :
addResourceType("ewol::ConfigFile"); addResourceType("ewol::ConfigFile");
} }
void ewol::resource::ConfigFile::init(const etk::String& _filename) { void ewol::resource::ConfigFile::init(const etk::Uri& _uri) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
gale::Resource::init(_filename); gale::Resource::init(_uri.get());
EWOL_DEBUG("SFP : load \"" << _filename << "\""); EWOL_DEBUG("SFP : load \"" << _uri << "\"");
reload(); reload();
} }
@ -41,7 +41,7 @@ void ewol::resource::ConfigFile::reload() {
m_list.getValue(iii) = ejson::empty(); m_list.getValue(iii) = ejson::empty();
} }
} }
m_doc.load(m_name); m_doc.load(etk::Uri(m_name));
for (auto elementName : m_list.getKeys()) { for (auto elementName : m_list.getKeys()) {
if (m_doc[elementName].exist() == true) { if (m_doc[elementName].exist() == true) {

View File

@ -19,10 +19,10 @@ namespace ewol {
etk::Map<etk::String, ejson::Value> m_list; etk::Map<etk::String, ejson::Value> m_list;
protected: protected:
ConfigFile(); ConfigFile();
void init(const etk::String& _filename); void init(const etk::Uri& _filename);
public: public:
virtual ~ConfigFile(); virtual ~ConfigFile();
DECLARE_RESOURCE_NAMED_FACTORY(ConfigFile); DECLARE_RESOURCE_URI_FACTORY(ConfigFile);
public: public:
void reload(); void reload();

View File

@ -5,7 +5,7 @@
*/ */
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/os/FSNode.hpp> #include <etk/uri/uri.hpp>
#include <egami/egami.hpp> #include <egami/egami.hpp>
#include <gale/resource/Manager.hpp> #include <gale/resource/Manager.hpp>
@ -34,41 +34,59 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() :
m_sizeRatio = 1.0f; m_sizeRatio = 1.0f;
} }
/**
* @brief Get all the Path contain in the specidy path:
* @param[in] _path Generic path to parse ...
* @return The list of path found
* @example[start]
* auto out = explodeMultiplePath("DATA:///font?lib=ewol");
* // out contain: {"DATA:///font", "DATA:///font?lib=ewol"}
* @example[stop]
*/
static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
etk::Vector<etk::Uri> out;
out.pushBack(_uri);
if (_uri.getQuery().exist("lib") == true) {
etk::Uri tmp = _uri;
tmp.getQuery().erase("lib");
out.pushBack(tmp);
}
return out;
}
void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) { void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_fontName); ewol::resource::Texture::init(_fontName);
etk::String localName = _fontName; etk::String localName = _fontName;
etk::Vector<etk::String> folderList; etk::Vector<etk::Uri> folderList;
if (true == ewol::getContext().getFontDefault().getUseExternal()) { if (ewol::getContext().getFontDefault().getUseExternal() == true) {
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
folderList.pushBack("ROOT:system/fonts"); folderList.pushBack(etk::Path("/system/fonts"));
#elif defined(__TARGET_OS__Linux) #elif defined(__TARGET_OS__Linux)
folderList.pushBack("ROOT:usr/share/fonts/truetype"); folderList.pushBack(etk::Path("/usr/share/fonts"));
#endif #endif
} }
etk::String applicationBaseFont = ewol::getContext().getFontDefault().getFolder(); etk::Uri applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
etk::Vector<etk::String> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont); for (auto &it : explodeMultiplePath(applicationBaseFont)) {
for (auto &it : applicationBaseFontList) {
folderList.pushBack(it); folderList.pushBack(it);
} }
for (size_t folderID = 0; folderID < folderList.size() ; folderID++) { for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]); etk::Vector<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]);
// find the real Font name :
etk::Vector<etk::String> output;
myFolder.folderGetRecursiveFiles(output);
etk::Vector<etk::String> split = etk::split(localName, ';'); etk::Vector<etk::String> split = etk::split(localName, ';');
EWOL_INFO("try to find font named : " << split << " in: " << myFolder); EWOL_INFO("try to find font named : " << split << " in: " << output);
//EWOL_CRITICAL("parse string : " << split); //EWOL_CRITICAL("parse string : " << split);
bool hasFindAFont = false; bool hasFindAFont = false;
for (size_t jjj=0; jjj<split.size(); jjj++) { for (size_t jjj=0; jjj<split.size(); jjj++) {
EWOL_INFO(" try with : '" << split[jjj] << "'"); EWOL_INFO(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) { for (size_t iii=0; iii<output.size(); iii++) {
etk::String nameFolder = output[iii].getPath().getString();
//EWOL_DEBUG(" file : " << output[iii]); //EWOL_DEBUG(" file : " << output[iii]);
if( true == etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false) if( true == etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false) || true == etk::end_with(nameFolder, split[jjj]+"-"+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false) || true == etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"r"+".ttf", false) || true == etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+".ttf", false)) { || true == etk::end_with(nameFolder, split[jjj]+".ttf", false)) {
EWOL_INFO(" find Font [Regular] : " << output[iii]); EWOL_INFO(" find Font [Regular] : " << output[iii]);
m_fileName = output[iii]; m_fileName = output[iii];
hasFindAFont=true; hasFindAFont=true;
@ -90,8 +108,8 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
} }
} }
if (m_fileName.size() == 0) { if (m_fileName.isEmpty() == true) {
EWOL_ERROR("can not load FONT name : '" << m_fileName << "'" ); EWOL_ERROR("can not load FONT name : '" << _fontName << "'" );
m_font = null; m_font = null;
return; return;
} }
@ -114,10 +132,9 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
m_sizeRatio = ((float)SIZE_GENERATION) / ((float)m_font->getHeight(SIZE_GENERATION)); m_sizeRatio = ((float)SIZE_GENERATION) / ((float)m_font->getHeight(SIZE_GENERATION));
// TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ??? // TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ???
setImageSize(ivec2(256,32)); setImageSize(ivec2(512,32));
// now we can acces directly on the image // now we can acces directly on the image
m_data.clear(etk::Color<>(0x00000000)); m_data.clear(etk::Color<>(0x00000000));
// add error glyph // add error glyph
addGlyph(0); addGlyph(0);
// by default we set only the first AINSI char availlable // by default we set only the first AINSI char availlable
@ -125,7 +142,12 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
addGlyph(iii); addGlyph(iii);
} }
flush(); flush();
//exportOnFile(); if (true) {
EWOL_ERROR("Save in cache the loaded data ..... ");
egami::store(m_data, "CACHE:///fileFont.bmp"); // ==> for debug test only ...
egami::store(m_data, "CACHE:///fileFont.png");
}
exportOnFile();
} }
ewol::resource::DistanceFieldFont::~DistanceFieldFont() { ewol::resource::DistanceFieldFont::~DistanceFieldFont() {
@ -140,15 +162,25 @@ float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) { void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
EWOL_INFO("Generate Distance field font [START]");
EWOL_INFO(" _input.getSize()=" << _input.getSize());
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y(); int32_t size = _input.getSize().x() * _input.getSize().y();
etk::Vector<short> xdist(size); etk::Vector<short> xdist;
etk::Vector<short> ydist(size); etk::Vector<short> ydist;
etk::Vector<double> gx(size); etk::Vector<double> gx;
etk::Vector<double> gy(size); etk::Vector<double> gy;
etk::Vector<double> data(size); etk::Vector<double> data;
etk::Vector<double> outside(size); etk::Vector<double> outside;
etk::Vector<double> inside(size); etk::Vector<double> inside;
xdist.resize(size, 0);
ydist.resize(size, 0);
gx.resize(size, 0.0);
gy.resize(size, 0.0);
data.resize(size, 0.0);
outside.resize(size, 0.0);
inside.resize(size, 0.0);
EWOL_INFO(" size=" << size);
// Convert img into double (data) // Convert img into double (data)
double img_min = 255, img_max = -255; double img_min = 255, img_max = -255;
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
@ -171,7 +203,6 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
data[iii] = (_input.get(ivec2(xxx, yyy))-img_min)/img_max; data[iii] = (_input.get(ivec2(xxx, yyy))-img_min)/img_max;
} }
} }
// Compute outside = edtaa3(bitmap); % Transform background (0's) // Compute outside = edtaa3(bitmap); % Transform background (0's)
computegradient(&data[0], _input.getSize().x(), _input.getSize().y(), &gx[0], &gy[0]); computegradient(&data[0], _input.getSize().x(), _input.getSize().y(), &gx[0], &gy[0]);
edtaa3(&data[0], &gx[0], &gy[0], _input.getSize().x(), _input.getSize().y(), &xdist[0], &ydist[0], &outside[0]); edtaa3(&data[0], &gx[0], &gy[0], _input.getSize().x(), _input.getSize().y(), &xdist[0], &ydist[0], &outside[0]);
@ -180,7 +211,6 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
outside[iii] = 0.0; outside[iii] = 0.0;
} }
} }
// Compute inside = edtaa3(1-bitmap); % Transform foreground (1's) // Compute inside = edtaa3(1-bitmap); % Transform foreground (1's)
for(size_t iii = 0; iii < gx.size(); ++iii) { for(size_t iii = 0; iii < gx.size(); ++iii) {
gx[iii] = 0; gx[iii] = 0;
@ -198,7 +228,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
inside[iii] = 0.0; inside[iii] = 0.0;
} }
} }
EWOL_INFO(" _output=" << _output);
_output.resize(_input.getSize(), etk::Color<>(0)); _output.resize(_input.getSize(), etk::Color<>(0));
_output.clear(etk::Color<>(0)); _output.clear(etk::Color<>(0));
for (int32_t xxx = 0; xxx < _output.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < _output.getSize().x(); ++xxx) {
@ -217,6 +247,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
_output.set(ivec2(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255)); _output.set(ivec2(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255));
} }
} }
EWOL_INFO(" _output=" << _output);
} }
bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) { bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
@ -229,11 +260,11 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
GlyphProperty tmpchar; GlyphProperty tmpchar;
tmpchar.m_UVal = _val; tmpchar.m_UVal = _val;
egami::ImageMono imageGlyphRaw; egami::ImageMono imageGlyphRaw;
egami::Image imageGlyphDistanceField; egami::Image imageGlyphDistanceField(ivec2(32,32), egami::colorType::RGBA8);
EWOL_DEBUG("Generate Glyph : " << _val); EWOL_DEBUG("Generate Glyph : " << _val);
if (m_font->getGlyphProperty(SIZE_GENERATION, tmpchar) == true) { if (m_font->getGlyphProperty(SIZE_GENERATION, tmpchar) == true) {
//EWOL_DEBUG("load char : '" << _val << "'=" << _val.get()); //EWOL_DEBUG("load char: '" << _val << "'=" << _val);
hasChange = true; hasChange = true;
// change line if needed ... // change line if needed ...
if (m_lastGlyphPos.x() + tmpchar.m_sizeTexture.x()+m_borderSize*2.0 > m_data.getSize().x()) { if (m_lastGlyphPos.x() + tmpchar.m_sizeTexture.x()+m_borderSize*2.0 > m_data.getSize().x()) {
@ -244,6 +275,7 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
while(m_lastGlyphPos.y()+tmpchar.m_sizeTexture.y()+m_borderSize*2.0 > m_data.getSize().y()) { while(m_lastGlyphPos.y()+tmpchar.m_sizeTexture.y()+m_borderSize*2.0 > m_data.getSize().y()) {
ivec2 size = m_data.getSize(); ivec2 size = m_data.getSize();
size.setY(size.y()*2); size.setY(size.y()*2);
EWOL_VERBOSE("resize " << m_data.getSize() << " => " << size);
m_data.resize(size, etk::Color<>(0)); m_data.resize(size, etk::Color<>(0));
// change the coordonate on the element in the texture // change the coordonate on the element in the texture
for (size_t jjj = 0; jjj < m_listElement.size(); ++jjj) { for (size_t jjj = 0; jjj < m_listElement.size(); ++jjj) {
@ -257,15 +289,16 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
m_font->drawGlyph(imageGlyphRaw, SIZE_GENERATION, tmpchar, m_borderSize); m_font->drawGlyph(imageGlyphRaw, SIZE_GENERATION, tmpchar, m_borderSize);
generateDistanceField(imageGlyphRaw, imageGlyphDistanceField); generateDistanceField(imageGlyphRaw, imageGlyphDistanceField);
/*
if (_val == 'Z') { if (_val == 100) {
EWOL_DEBUG("print char: " << _val << " size=" << imageGlyphDistanceField.getSize());
for (int32_t yyy = 0; yyy < imageGlyphDistanceField.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < imageGlyphDistanceField.getSize().y(); ++yyy) {
for (int32_t xxx = 0; xxx < imageGlyphDistanceField.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < imageGlyphDistanceField.getSize().x(); ++xxx) {
EWOL_DEBUG((int)(imageGlyphDistanceField.get(ivec2(xxx, yyy)).r()) << " "); EWOL_PRINT((int)(imageGlyphDistanceField.get(ivec2(xxx, yyy)).r()) << " ");
} }
} }
} }
*/
m_data.insert(m_lastGlyphPos, imageGlyphDistanceField); m_data.insert(m_lastGlyphPos, imageGlyphDistanceField);
// set image position // set image position
@ -295,7 +328,9 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
} }
if (hasChange == true) { if (hasChange == true) {
flush(); flush();
//egami::store(m_data, "fileFont.bmp"); // ==> for debug test only ... //EWOL_ERROR("Save in cache the loaded data ..... ");
//egami::store(m_data, "CACHE:///fileFont.bmp"); // ==> for debug test only ...
//egami::store(m_data, "CACHE:///fileFont.png");
} }
return hasChange; return hasChange;
} }
@ -329,7 +364,7 @@ int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const char32_t& _charcode) { ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const char32_t& _charcode) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
//EWOL_DEBUG("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]); EWOL_VERBOSE("getGlyphPointer : " << uint32_t(_charcode));
int32_t index = getIndex(_charcode); int32_t index = getIndex(_charcode);
if( index < 0 if( index < 0
|| (size_t)index >= m_listElement.size() ) { || (size_t)index >= m_listElement.size() ) {
@ -370,25 +405,40 @@ void ewol::resource::DistanceFieldFont::exportOnFile() {
doc.add("m_lastRawHeigh", ejson::Number(m_lastRawHeigh)); doc.add("m_lastRawHeigh", ejson::Number(m_lastRawHeigh));
doc.add("m_borderSize", ejson::Number(m_borderSize)); doc.add("m_borderSize", ejson::Number(m_borderSize));
doc.add("m_textureBorderSize", ejson::String(m_textureBorderSize)); doc.add("m_textureBorderSize", ejson::String(m_textureBorderSize));
doc.store(m_fileName + ".json"); etk::Uri tmpUri = m_fileName;
egami::store(m_data, m_fileName + ".bmp"); tmpUri.setScheme("CACHE");
egami::store(m_data, m_fileName + ".png"); tmpUri.setPath(m_fileName.getPath() + ".json");
doc.store(tmpUri);
//tmpUri.setPath(m_fileName.getPath() + ".bmp");
//egami::store(m_data, tmpUri);
tmpUri.setPath(m_fileName.getPath() + ".png");
egami::store(m_data, tmpUri);
} }
bool ewol::resource::DistanceFieldFont::importFromFile() { bool ewol::resource::DistanceFieldFont::importFromFile() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
EWOL_DEBUG("IMPORT: DistanceFieldFont : file : '" << m_fileName << ".json'"); etk::Uri tmpUriJson = m_fileName;
tmpUriJson.setScheme("CACHE");
tmpUriJson.setPath(m_fileName.getPath() + ".json");
etk::Uri tmpUriBmp = m_fileName;
tmpUriBmp.setScheme("CACHE");
tmpUriBmp.setPath(m_fileName.getPath() + ".png");
EWOL_DEBUG("IMPORT: DistanceFieldFont : file : '" << tmpUriJson << "'");
// test file existance: // test file existance:
etk::FSNode fileJSON(m_fileName + ".json"); if ( etk::uri::exist(tmpUriJson) == false
etk::FSNode fileBMP(m_fileName + ".bmp"); || etk::uri::exist(tmpUriBmp) == false) {
if ( fileJSON.exist() == false
|| fileBMP.exist() == false) {
EWOL_DEBUG("Does not import file for distance field system"); EWOL_DEBUG("Does not import file for distance field system");
return false; return false;
} }
ejson::Document doc; ejson::Document doc;
doc.load(m_fileName + ".json"); if (doc.load(tmpUriJson) == false) {
return false;
}
egami::Image tmpImage = egami::load(tmpUriBmp);
if (tmpImage.exist() == false) {
return false;
}
m_data = tmpImage;
m_sizeRatio = doc["m_sizeRatio"].toNumber().get(0); m_sizeRatio = doc["m_sizeRatio"].toNumber().get(0);
m_lastGlyphPos = doc["m_lastGlyphPos"].toString().get("0,0"); m_lastGlyphPos = doc["m_lastGlyphPos"].toString().get("0,0");
m_lastRawHeigh = doc["m_lastRawHeigh"].toNumber().get(0); m_lastRawHeigh = doc["m_lastRawHeigh"].toNumber().get(0);
@ -416,6 +466,5 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
prop.m_exist = tmpObj["m_exist"].toBoolean().get(false); prop.m_exist = tmpObj["m_exist"].toBoolean().get(false);
m_listElement.pushBack(prop); m_listElement.pushBack(prop);
} }
m_data = egami::load(m_fileName + ".bmp");
return m_data.exist(); return m_data.exist();
} }

View File

@ -13,7 +13,7 @@ namespace ewol {
namespace resource { namespace resource {
class DistanceFieldFont : public ewol::resource::Texture { class DistanceFieldFont : public ewol::resource::Texture {
private: private:
etk::String m_fileName; etk::Uri m_fileName;
float m_sizeRatio; float m_sizeRatio;
// specific element to have the the know if the specify element is known... // specific element to have the the know if the specify element is known...
// == > otherwise I can just generate italic ... // == > otherwise I can just generate italic ...

View File

@ -6,7 +6,6 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/Vector.hpp> #include <etk/Vector.hpp>
#include <etk/os/FSNode.hpp>
#include <gale/renderer/openGL/openGL.hpp> #include <gale/renderer/openGL/openGL.hpp>
@ -56,42 +55,30 @@ ewol::resource::FontFreeType::FontFreeType() {
m_FileSize = 0; m_FileSize = 0;
} }
void ewol::resource::FontFreeType::init(const etk::String& _fontName) { void ewol::resource::FontFreeType::init(const etk::Uri& _uri) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::FontBase::init(_fontName); ewol::resource::FontBase::init(_uri);
etk::FSNode myfile(_fontName); auto fileIO = etk::uri::get(_uri);
if (myfile.exist() == false) { if (fileIO == null) {
EWOL_ERROR("File Does not exist : " << myfile); EWOL_ERROR("File Does not exist : " << _uri);
return; return;
} }
m_FileSize = myfile.fileSize(); if (fileIO->open(etk::io::OpenMode::Read) == false) {
if (m_FileSize == 0) { EWOL_ERROR("Can not open the file : " << _uri);
EWOL_ERROR("This file is empty : " << myfile);
return; return;
} }
if (myfile.fileOpenRead() == false) { m_FileBuffer = fileIO->readAll<FT_Byte>();
EWOL_ERROR("Can not open the file : " << myfile);
return;
}
// allocate data
m_FileBuffer.resize(m_FileSize, 0);
if (m_FileBuffer.size() != m_FileSize) {
EWOL_ERROR("Error Memory allocation size=" << _fontName);
return;
}
// load data from the file :
myfile.fileRead(&m_FileBuffer[0], 1, m_FileSize);
// close the file: // close the file:
myfile.fileClose(); fileIO->close();
// load Face ... // load Face ...
int32_t error = FT_New_Memory_Face(library, &m_FileBuffer[0], m_FileSize, 0, &m_fftFace ); int32_t error = FT_New_Memory_Face(library, &m_FileBuffer[0], m_FileBuffer.size(), 0, &m_fftFace );
if( FT_Err_Unknown_File_Format == error) { if( FT_Err_Unknown_File_Format == error) {
EWOL_ERROR("... the font file could be opened and read, but it appears ... that its font format is unsupported"); EWOL_ERROR("... the font file could be opened and read, but it appears ... that its font format is unsupported");
} else if (0 != error) { } else if (0 != error) {
EWOL_ERROR("... another error code means that the font file could not ... be opened or read, or simply that it is broken..."); EWOL_ERROR("... another error code means that the font file could not ... be opened or read, or simply that it is broken...");
} else { } else {
// all OK // all OK
EWOL_INFO("load font : \"" << _fontName << "\" glyph count = " << (int)m_fftFace->num_glyphs); EWOL_DEBUG("load font : \"" << _uri << "\" glyph count = " << (int)m_fftFace->num_glyphs);
m_init = true; m_init = true;
//display(); //display();
} }
@ -171,7 +158,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int8_t _posInImage) { int8_t _posInImage) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if(false == m_init) { if(m_init == false) {
return false; return false;
} }
// 300dpi (hight quality) 96 dpi (normal quality) // 300dpi (hight quality) 96 dpi (normal quality)

View File

@ -7,6 +7,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <ewol/resource/font/FontBase.hpp> #include <ewol/resource/font/FontBase.hpp>
#include <etk/uri/uri.hpp>
#include <egami/egami.hpp> #include <egami/egami.hpp>
extern "C" { extern "C" {
@ -26,9 +27,9 @@ namespace ewol {
void display(); void display();
protected: protected:
FontFreeType(); FontFreeType();
void init(const etk::String& _fontName); void init(const etk::Uri& _uri);
public: public:
DECLARE_RESOURCE_NAMED_FACTORY(FontFreeType); DECLARE_RESOURCE_URI_FACTORY(FontFreeType);
virtual ~FontFreeType(); virtual ~FontFreeType();
public: public:

View File

@ -25,13 +25,13 @@ void ewol::resource::ImageDF::init() {
ewol::resource::Texture::init(); ewol::resource::Texture::init();
} }
void ewol::resource::ImageDF::init(etk::String _genName, const etk::String& _tmpfileName, const ivec2& _size) { void ewol::resource::ImageDF::init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_genName); ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size); EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size);
m_data = egami::load(_tmpfileName, _size); m_data = egami::load(_uri, _size);
if (m_data.exist() == false) { if (m_data.exist() == false) {
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName); EWOL_ERROR("ERROR when loading the image : " << _uri);
} }
ivec2 tmp = m_data.getSize(); ivec2 tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y()); m_realImageSize = vec2(tmp.x(), tmp.y());
@ -54,13 +54,20 @@ void ewol::resource::ImageDF::init(etk::String _genName, const etk::String& _tmp
void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) { void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y(); int32_t size = _input.getSize().x() * _input.getSize().y();
etk::Vector<short> xdist(size); etk::Vector<short> xdist;
etk::Vector<short> ydist(size); etk::Vector<short> ydist;
etk::Vector<double> gx(size); etk::Vector<double> gx;
etk::Vector<double> gy(size); etk::Vector<double> gy;
etk::Vector<double> data(size); etk::Vector<double> data;
etk::Vector<double> outside(size); etk::Vector<double> outside;
etk::Vector<double> inside(size); etk::Vector<double> inside;
xdist.resize(size, 0);
ydist.resize(size, 0);
gx.resize(size, 0.0);
gy.resize(size, 0.0);
data.resize(size, 0.0);
outside.resize(size, 0.0);
inside.resize(size, 0.0);
// Convert img into double (data) // Convert img into double (data)
double img_min = 255, img_max = -255; double img_min = 255, img_max = -255;
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
@ -153,9 +160,9 @@ static int32_t nextP2(int32_t _value) {
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::String& _filename, ivec2 _size) { ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, ivec2 _size) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size); EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size);
if (_filename == "") { if (_uri.isEmpty() == true) {
ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF)); ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : ??TEX??"); EWOL_ERROR("allocation error of a resource : ??TEX??");
@ -173,8 +180,8 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
_size.setY(-1); _size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???"); //EWOL_ERROR("Error Request the image size.y() =0 ???");
} }
etk::String TmpFilename = _filename; etk::Uri tmpFilename = _uri;
if (etk::end_with(_filename, ".svg") == false) { if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
_size = ivec2(-1,-1); _size = ivec2(-1,-1);
} }
#ifdef __TARGET_OS__MacOs #ifdef __TARGET_OS__MacOs
@ -187,33 +194,31 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
_size.setValue(nextP2(_size.x()), nextP2(_size.y())); _size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif #endif
TmpFilename += ":"; tmpFilename.getQuery().set("x", etk::toString(_size.x()));
TmpFilename += etk::toString(_size.x()); tmpFilename.getQuery().set("y", etk::toString(_size.y()));
TmpFilename += "x";
TmpFilename += etk::toString(_size.y());
} }
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size); EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
ememory::SharedPtr<ewol::resource::ImageDF> object = null; ememory::SharedPtr<ewol::resource::ImageDF> object = null;
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + TmpFilename); ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + tmpFilename.getString());
if (object2 != null) { if (object2 != null) {
object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2); object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2);
if (object == null) { if (object == null) {
EWOL_CRITICAL("Request resource file : '" << TmpFilename << "' With the wrong type (dynamic cast error)"); EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)");
return null; return null;
} }
} }
if (object != null) { if (object != null) {
return object; return object;
} }
EWOL_INFO("CREATE: ImageDF: '" << TmpFilename << "' size=" << _size); EWOL_INFO("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size);
// need to crate a new one ... // need to crate a new one ...
object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF)); object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : " << _filename); EWOL_ERROR("allocation error of a resource : " << _uri);
return null; return null;
} }
object->init("DF__" + TmpFilename, _filename, _size); object->init("DF__" + tmpFilename.getString(), _uri, _size);
getManager().localAdd(object); getManager().localAdd(object);
return object; return object;
} }

View File

@ -18,7 +18,7 @@ namespace ewol {
protected: protected:
ImageDF(); ImageDF();
void init(); void init();
void init(etk::String _genName, const etk::String& _fileName, const ivec2& _size); void init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size);
public: public:
virtual ~ImageDF() { }; virtual ~ImageDF() { };
protected: protected:
@ -40,7 +40,7 @@ namespace ewol {
* @param[in] _requested size of the image (usefull when loading .svg to automatic rescale) * @param[in] _requested size of the image (usefull when loading .svg to automatic rescale)
* @return pointer on the resource or null if an error occured. * @return pointer on the resource or null if an error occured.
*/ */
static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::String& _filename, ivec2 _size=ivec2(-1,-1)); static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::Uri& _uri, ivec2 _size=ivec2(-1,-1));
}; };
}; };
}; };

View File

@ -142,9 +142,9 @@ bool ewol::resource::Texture::updateContext() {
m_lastSize = m_data.getSize(); m_lastSize = m_data.getSize();
m_lastTypeObject = typeObject; m_lastTypeObject = typeObject;
m_lastSizeObject = sizeObject; m_lastSizeObject = sizeObject;
EWOL_WARNING("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType()); EWOL_DEBUG("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType());
} else { } else {
EWOL_WARNING("TEXTURE: update [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType()); EWOL_DEBUG("TEXTURE: update [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType());
} }
// in all case we set the texture properties : // in all case we set the texture properties :
// TODO : check error ??? // TODO : check error ???
@ -300,13 +300,13 @@ void ewol::resource::Texture::setImageSize(ivec2 _newSize) {
} }
void ewol::resource::Texture::set(egami::Image _image) { void ewol::resource::Texture::set(egami::Image _image) {
EWOL_WARNING("Set a new image in a texture:"); EWOL_DEBUG("Set a new image in a texture:");
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if (_image.exist() == false) { if (_image.exist() == false) {
EWOL_ERROR("ERROR when loading the image : [raw data]"); EWOL_ERROR("ERROR when loading the image : [raw data]");
return; return;
} }
EWOL_WARNING(" size=" << _image.getSize()); EWOL_DEBUG(" size=" << _image.getSize());
etk::swap(m_data, _image); etk::swap(m_data, _image);
ivec2 tmp = m_data.getSize(); ivec2 tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y()); m_realImageSize = vec2(tmp.x(), tmp.y());

View File

@ -45,22 +45,22 @@ void ewol::resource::TextureFile::init() {
ewol::resource::Texture::init(); ewol::resource::Texture::init();
} }
void ewol::resource::TextureFile::init(etk::String _genName, const etk::String& _tmpFilename, const ivec2& _size) { void ewol::resource::TextureFile::init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_genName); ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpFilename=" << _tmpFilename << " size=" << _size); EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size);
egami::Image tmp = egami::load(_tmpFilename, _size); egami::Image tmp = egami::load(_uri, _size);
set(etk::move(tmp)); set(etk::move(tmp));
//m_lastSize = m_realImageSize; //m_lastSize = m_realImageSize;
#ifdef GENERATE_DISTANCE_FIELD_MODE #ifdef GENERATE_DISTANCE_FIELD_MODE
//egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".bmp"); //egami::generateDistanceFieldFile(_uri, etk::String(_uri, 0, _uri.size()-4) + ".bmp");
egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".edf"); egami::generateDistanceFieldFile(_uri, etk::String(_uri, 0, _uri.size()-4) + ".edf");
#endif #endif
} }
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::String& _filename, ivec2 _size, ivec2 _sizeRegister) { ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::Uri& _uri, ivec2 _size, ivec2 _sizeRegister) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size << " sizeRegister=" << _sizeRegister); EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size << " sizeRegister=" << _sizeRegister);
if (_filename == "") { if (_uri.isEmpty() == true) {
ememory::SharedPtr<ewol::resource::TextureFile> object(ETK_NEW(ewol::resource::TextureFile)); ememory::SharedPtr<ewol::resource::TextureFile> object(ETK_NEW(ewol::resource::TextureFile));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : ??TEX??"); EWOL_ERROR("allocation error of a resource : ??TEX??");
@ -78,8 +78,8 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
_size.setY(-1); _size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???"); //EWOL_ERROR("Error Request the image size.y() =0 ???");
} }
etk::String tmpFilename = _filename; etk::Uri tmpFilename = _uri;
if (etk::end_with(_filename, ".svg") == false) { if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
_size = ewol::resource::TextureFile::sizeAuto; _size = ewol::resource::TextureFile::sizeAuto;
} }
if (_size.x()>0 && _size.y()>0) { if (_size.x()>0 && _size.y()>0) {
@ -87,17 +87,15 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
_size.setValue(nextP2(_size.x()), nextP2(_size.y())); _size.setValue(nextP2(_size.x()), nextP2(_size.y()));
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) { if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) { if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) {
tmpFilename += ":"; tmpFilename.getQuery().set("x", etk::toString(_size.x()));
tmpFilename += etk::toString(_size.x()); tmpFilename.getQuery().set("y", etk::toString(_size.y()));
tmpFilename += "x";
tmpFilename += etk::toString(_size.y());
} }
} }
} }
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size); EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
ememory::SharedPtr<ewol::resource::TextureFile> object = null; ememory::SharedPtr<ewol::resource::TextureFile> object = null;
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename); ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename.getString());
if (object2 != null) { if (object2 != null) {
object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2); object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2);
if (object == null) { if (object == null) {
@ -108,14 +106,14 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
if (object != null) { if (object != null) {
return object; return object;
} }
EWOL_INFO("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size); EWOL_DEBUG("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size);
// need to crate a new one ... // need to crate a new one ...
object = ememory::SharedPtr<ewol::resource::TextureFile>(ETK_NEW(ewol::resource::TextureFile)); object = ememory::SharedPtr<ewol::resource::TextureFile>(ETK_NEW(ewol::resource::TextureFile));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : " << _filename); EWOL_ERROR("allocation error of a resource : " << _uri);
return null; return null;
} }
object->init(tmpFilename, _filename, _size); object->init(tmpFilename.getString(), _uri, _size);
getManager().localAdd(object); getManager().localAdd(object);
return object; return object;
} }

View File

@ -22,7 +22,7 @@ namespace ewol {
protected: protected:
TextureFile(); TextureFile();
void init(); void init();
void init(etk::String _genName, const etk::String& _fileName, const ivec2& _size); void init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size);
public: public:
virtual ~TextureFile() { }; virtual ~TextureFile() { };
public: public:
@ -38,7 +38,7 @@ namespace ewol {
* @param[in] _sizeRegister size register in named (When you preaload the images the size write here will be ) * @param[in] _sizeRegister size register in named (When you preaload the images the size write here will be )
* @return pointer on the resource or null if an error occured. * @return pointer on the resource or null if an error occured.
*/ */
static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::String& _filename, static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::Uri& _filename,
ivec2 _size=ewol::resource::TextureFile::sizeAuto, ivec2 _size=ewol::resource::TextureFile::sizeAuto,
ivec2 _sizeRegister=ewol::resource::TextureFile::sizeAuto); ivec2 _sizeRegister=ewol::resource::TextureFile::sizeAuto);
}; };

View File

@ -5,7 +5,6 @@
*/ */
#include <etk/types.hpp> #include <etk/types.hpp>
#include <etk/os/FSNode.hpp>
#include <egami/egami.hpp> #include <egami/egami.hpp>
#include <gale/resource/Manager.hpp> #include <gale/resource/Manager.hpp>
@ -44,6 +43,26 @@ ewol::resource::TexturedFont::TexturedFont():
addResourceType("ewol::resource::TexturedFont"); addResourceType("ewol::resource::TexturedFont");
} }
/**
* @brief Get all the Path contain in the specidy path:
* @param[in] _path Generic path to parse ...
* @return The list of path found
* @example[start]
* auto out = explodeMultiplePath("DATA:///font?lib=ewol");
* // out contain: {"DATA:///font", "DATA:///font?lib=ewol"}
* @example[stop]
*/
static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
etk::Vector<etk::Uri> out;
out.pushBack(_uri);
if (_uri.getQuery().exist("lib") == true) {
etk::Uri tmp = _uri;
tmp.getQuery().erase("lib");
out.pushBack(tmp);
}
return out;
}
void ewol::resource::TexturedFont::init(const etk::String& _fontName) { void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_fontName); ewol::resource::Texture::init(_fontName);
@ -76,98 +95,96 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
if (tmpPos == null) { if (tmpPos == null) {
m_size = 1; m_size = 1;
EWOL_CRITICAL("Can not parse the font name : '" << _fontName << "' ??? ':' " ); EWOL_CRITICAL("Can not parse the font name: '" << _fontName << "' ??? ':' " );
return; return;
} else { } else {
if (sscanf(tmpPos+1, "%d", &tmpSize)!=1) { if (sscanf(tmpPos+1, "%d", &tmpSize)!=1) {
m_size = 1; m_size = 1;
EWOL_CRITICAL("Can not parse the font name : '" << _fontName << "' == > size ???"); EWOL_CRITICAL("Can not parse the font name: '" << _fontName << "' == > size ???");
return; return;
} }
} }
etk::String localName(_fontName, 0, (tmpPos - tmpData)); etk::String localName(_fontName, 0, (tmpPos - tmpData));
if (tmpSize>400) { if (tmpSize>400) {
EWOL_ERROR("Font size too big ==> limit at 400 when exxeed ==> error : " << tmpSize << "==>30"); EWOL_ERROR("Font size too big ==> limit at 400 when exxeed ==> error: " << tmpSize << "==>30");
tmpSize = 30; tmpSize = 30;
} }
m_size = tmpSize; m_size = tmpSize;
etk::Vector<etk::String> folderList; etk::Vector<etk::Uri> folderList;
if (ewol::getContext().getFontDefault().getUseExternal() == true) { if (ewol::getContext().getFontDefault().getUseExternal() == true) {
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
folderList.pushBack("ROOT:system/fonts"); folderList.pushBack(etk::Path("/system/fonts"));
#elif defined(__TARGET_OS__Linux) #elif defined(__TARGET_OS__Linux)
folderList.pushBack("ROOT:usr/share/fonts"); folderList.pushBack(etk::Path("/usr/share/fonts"));
#endif #endif
} }
etk::String applicationBaseFont = ewol::getContext().getFontDefault().getFolder(); etk::Uri applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
etk::Vector<etk::String> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont); for (auto &it : explodeMultiplePath(applicationBaseFont)) {
for (auto &it : applicationBaseFontList) {
folderList.pushBack(it); folderList.pushBack(it);
} }
for (size_t folderID=0; folderID<folderList.size() ; folderID++) { for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]); etk::Vector<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]);
// find the real Font name :
etk::Vector<etk::String> output;
myFolder.folderGetRecursiveFiles(output);
etk::Vector<etk::String> split = etk::split(localName, ';'); etk::Vector<etk::String> split = etk::split(localName, ';');
EWOL_INFO("try to find font named : " << split << " in: " << myFolder); EWOL_DEBUG("try to find font named : " << split << " in: " << output);
//EWOL_CRITICAL("parse string : " << split); //EWOL_CRITICAL("parse string : " << split);
bool hasFindAFont = false; bool hasFindAFont = false;
for (size_t jjj=0; jjj<split.size(); jjj++) { for (size_t jjj=0; jjj<split.size(); jjj++) {
EWOL_INFO(" try with : '" << split[jjj] << "'"); EWOL_DEBUG(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) { for (size_t iii=0; iii<output.size(); iii++) {
etk::String nameFolder = output[iii].getPath().getString();
//EWOL_DEBUG(" file : " << output[iii]); //EWOL_DEBUG(" file : " << output[iii]);
if( etk::end_with(output[iii], split[jjj]+"-"+"bold"+".ttf", false) == true if( etk::end_with(nameFolder, split[jjj]+"-"+"bold"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"b"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"b"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"bd"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"bd"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bold"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bold"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bd"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bd"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"b"+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+"b"+".ttf", false) == true) {
EWOL_INFO(" find Font [Bold] : " << output[iii]); EWOL_DEBUG(" find Font [Bold] : " << output[iii]);
m_fileName[ewol::font::Bold] = output[iii]; m_fileName[ewol::font::Bold] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} else if( etk::end_with(output[iii], split[jjj]+"-"+"oblique"+".ttf", false) == true } else if( etk::end_with(nameFolder, split[jjj]+"-"+"oblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"italic"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"italic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"Light"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"Light"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"i"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"i"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"oblique"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"oblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"italic"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"italic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"light"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"light"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"i"+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+"i"+".ttf", false) == true) {
EWOL_INFO(" find Font [Italic] : " << output[iii]); EWOL_DEBUG(" find Font [Italic] : " << output[iii]);
m_fileName[ewol::font::Italic] = output[iii]; m_fileName[ewol::font::Italic] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} else if( etk::end_with(output[iii], split[jjj]+"-"+"bolditalic"+".ttf", false) == true } else if( etk::end_with(nameFolder, split[jjj]+"-"+"bolditalic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"boldoblique"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"boldoblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"bi"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"bi"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"z"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"z"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bolditalic"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bolditalic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"boldoblique"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"boldoblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bi"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bi"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"z"+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+"z"+".ttf", false) == true) {
EWOL_INFO(" find Font [Bold-Italic] : " << output[iii]); EWOL_DEBUG(" find Font [Bold-Italic] : " << output[iii]);
m_fileName[ewol::font::BoldItalic] = output[iii]; m_fileName[ewol::font::BoldItalic] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} else if( etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false) == true } else if( etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"r"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"r"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+".ttf", false) == true) {
EWOL_INFO(" find Font [Regular] : " << output[iii]); EWOL_DEBUG(" find Font [Regular] : " << output[iii]);
m_fileName[ewol::font::Regular] = output[iii]; m_fileName[ewol::font::Regular] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} }
} }
if (hasFindAFont == true) { if (hasFindAFont == true) {
EWOL_INFO(" find this font : '" << split[jjj] << "'"); EWOL_DEBUG(" find this font : '" << split[jjj] << "'");
break; break;
} else if (jjj == split.size()-1) { } else if (jjj == split.size()-1) {
EWOL_ERROR("Find NO font in the LIST ... " << split); EWOL_DEBUG("Find NO font in the LIST ... " << split);
} }
} }
if (hasFindAFont == true) { if (hasFindAFont == true) {
EWOL_INFO(" find this font : '" << folderList[folderID] << "'"); EWOL_DEBUG(" find this font : '" << folderList[folderID] << "'");
break; break;
} else if (folderID == folderList.size()-1) { } else if (folderID == folderList.size()-1) {
EWOL_ERROR("Find NO font in the LIST ... " << folderList); EWOL_ERROR("Find NO font in the LIST ... " << folderList);
@ -176,15 +193,14 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
// try to find the reference mode : // try to find the reference mode :
enum ewol::font::mode refMode = ewol::font::Regular; enum ewol::font::mode refMode = ewol::font::Regular;
for(int32_t iii=3; iii >= 0; iii--) { for(int32_t iii=3; iii >= 0; iii--) {
if (m_fileName[iii].size() != 0) { if (m_fileName[iii].isEmpty() == false) {
refMode = (enum ewol::font::mode)iii; refMode = (enum ewol::font::mode)iii;
} }
} }
EWOL_DEBUG(" set reference mode : " << refMode); EWOL_DEBUG(" set reference mode : " << refMode);
// generate the wrapping on the preventing error // generate the wrapping on the preventing error
for(int32_t iii=3; iii >= 0; iii--) { for(int32_t iii=3; iii >= 0; iii--) {
if (m_fileName[iii].size() != 0) { if (m_fileName[iii].isEmpty() == false) {
m_modeWraping[iii] = (enum ewol::font::mode)iii; m_modeWraping[iii] = (enum ewol::font::mode)iii;
} else { } else {
m_modeWraping[iii] = refMode; m_modeWraping[iii] = refMode;
@ -192,12 +208,12 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
} }
for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) { for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) {
if (m_fileName[iiiFontId].size() == 0) { if (m_fileName[iiiFontId].isEmpty() == true) {
EWOL_DEBUG("can not load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size ); EWOL_DEBUG("can not load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size );
m_font[iiiFontId] = null; m_font[iiiFontId] = null;
continue; continue;
} }
EWOL_INFO("Load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size); EWOL_DEBUG("Load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size);
m_font[iiiFontId] = ewol::resource::FontFreeType::create(m_fileName[iiiFontId]); m_font[iiiFontId] = ewol::resource::FontFreeType::create(m_fileName[iiiFontId]);
if (m_font[iiiFontId] == null) { if (m_font[iiiFontId] == null) {
EWOL_DEBUG("error in loading FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size ); EWOL_DEBUG("error in loading FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size );

View File

@ -25,7 +25,7 @@ namespace ewol {
namespace resource { namespace resource {
class TexturedFont : public ewol::resource::Texture { class TexturedFont : public ewol::resource::Texture {
private: private:
etk::String m_fileName[4]; etk::Uri m_fileName[4];
int32_t m_size; int32_t m_size;
int32_t m_height[4]; int32_t m_height[4];
// specific element to have the the know if the specify element is known... // specific element to have the the know if the specify element is known...

View File

@ -21,8 +21,8 @@ namespace ewol {
FontBase() { FontBase() {
addResourceType("ewol::FontFreeType"); addResourceType("ewol::FontFreeType");
} }
void init(const etk::String& _fontName) { void init(const etk::Uri& _uri) {
gale::Resource::init(_fontName); gale::Resource::init(_uri);
}; };
virtual ~FontBase() { }; virtual ~FontBase() { };

View File

@ -24,7 +24,7 @@ ewol::widget::Button::Button() :
signalEnter(this, "enter", "The cursor enter inside the button"), signalEnter(this, "enter", "The cursor enter inside the button"),
signalLeave(this, "leave", "the cursor leave the button"), signalLeave(this, "leave", "the cursor leave the button"),
signalValue(this, "value", "button value change"), signalValue(this, "value", "button value change"),
propertyShape(this, "shape", "{ewol}THEME:GUI:Button.json", "The display name for config file", &ewol::widget::Button::onChangePropertyShape), propertyShape(this, "shape", etk::Uri("THEME_GUI:///Button.json?lib=ewol"), "The display name for config file", &ewol::widget::Button::onChangePropertyShape),
propertyValue(this, "value", false, "Value of the Button", &ewol::widget::Button::onChangePropertyValue), propertyValue(this, "value", false, "Value of the Button", &ewol::widget::Button::onChangePropertyValue),
propertyLock(this, "lock", lockNone, "Lock the button in a special state to permit changing state only by the coder", &ewol::widget::Button::onChangePropertyLock), propertyLock(this, "lock", lockNone, "Lock the button in a special state to permit changing state only by the coder", &ewol::widget::Button::onChangePropertyLock),
propertyToggleMode(this, "toggle", false, "The Button can toogle", &ewol::widget::Button::onChangePropertyToggleMode), propertyToggleMode(this, "toggle", false, "The Button can toogle", &ewol::widget::Button::onChangePropertyToggleMode),
@ -129,10 +129,10 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
markToRedraw(); markToRedraw();
} }
if(_event.getStatus() == gale::key::status::pressSingle) { if(_event.getStatus() == gale::key::status::pressSingle) {
if( ( *propertyValue == true if ( ( *propertyValue == true
&& *propertyLock == ewol::widget::Button::lockWhenPressed) && *propertyLock == ewol::widget::Button::lockWhenPressed)
|| ( *propertyValue == false || ( *propertyValue == false
&& *propertyLock == ewol::widget::Button::lockWhenReleased) ) { && *propertyLock == ewol::widget::Button::lockWhenReleased) ) {
// nothing to do : Lock mode ... // nothing to do : Lock mode ...
// user might set himself the new correct value with @ref setValue(xxx) // user might set himself the new correct value with @ref setValue(xxx)
} else { } else {

View File

@ -41,7 +41,7 @@ namespace ewol {
esignal::Signal<> signalLeave; esignal::Signal<> signalLeave;
esignal::Signal<bool> signalValue; esignal::Signal<bool> signalValue;
public: // propertie list public: // propertie list
eproperty::Value<etk::String> propertyShape; //!< shaper name property eproperty::Value<etk::Uri> propertyShape; //!< shaper name property
eproperty::Value<bool> propertyValue; //!< Current state of the button. eproperty::Value<bool> propertyValue; //!< Current state of the button.
eproperty::List<enum buttonLock> propertyLock; //!< Current lock state of the button. eproperty::List<enum buttonLock> propertyLock; //!< Current lock state of the button.
eproperty::Value<bool> propertyToggleMode; //!< The button is able to toggle. eproperty::Value<bool> propertyToggleMode; //!< The button is able to toggle.

View File

@ -25,7 +25,7 @@ ETK_DECLARE_TYPE(ewol::widget::ButtonColor);
ewol::widget::ButtonColor::ButtonColor() : ewol::widget::ButtonColor::ButtonColor() :
signalChange(this, "change", "Button color change value"), signalChange(this, "change", "Button color change value"),
propertyValue(this, "color", etk::color::black, "Current color", &ewol::widget::ButtonColor::onChangePropertyValue), propertyValue(this, "color", etk::color::black, "Current color", &ewol::widget::ButtonColor::onChangePropertyValue),
propertyShape(this, "shape", "{ewol}THEME:GUI:Button.json", "shape of the widget", &ewol::widget::ButtonColor::onChangePropertyShape), propertyShape(this, "shape", etk::Uri("THEME_GUI:///Button.json?lib=ewol"), "shape of the widget", &ewol::widget::ButtonColor::onChangePropertyShape),
m_widgetContextMenu(null) { m_widgetContextMenu(null) {
addObjectType("ewol::widget::ButtonColor"); addObjectType("ewol::widget::ButtonColor");
changeStatusIn(STATUS_UP); changeStatusIn(STATUS_UP);

View File

@ -25,7 +25,7 @@ namespace ewol {
esignal::Signal<etk::Color<>> signalChange; esignal::Signal<etk::Color<>> signalChange;
public: // properties public: // properties
eproperty::Value<etk::Color<>> propertyValue; //!< Current color. eproperty::Value<etk::Color<>> propertyValue; //!< Current color.
eproperty::Value<etk::String> propertyShape; //!< Current color. eproperty::Value<etk::Uri> propertyShape; //!< Current color.
private: private:
ewol::compositing::Shaper m_shaper; //!< Compositing theme. ewol::compositing::Shaper m_shaper; //!< Compositing theme.
ewol::compositing::Text m_text; //!< Compositing Test display. ewol::compositing::Text m_text; //!< Compositing Test display.

View File

@ -27,7 +27,7 @@ ewol::widget::CheckBox::CheckBox() :
"Basic value of the widget", "Basic value of the widget",
&ewol::widget::CheckBox::onChangePropertyValue), &ewol::widget::CheckBox::onChangePropertyValue),
propertyShape(this, "shape", propertyShape(this, "shape",
"{ewol}THEME:GUI:CheckBox.json", etk::Uri("THEME_GUI:///CheckBox.json?lib=ewol"),
"The display name for config file", "The display name for config file",
&ewol::widget::CheckBox::onChangePropertyShape), &ewol::widget::CheckBox::onChangePropertyShape),
m_mouseHover(false), m_mouseHover(false),

View File

@ -27,7 +27,7 @@ namespace ewol {
esignal::Signal<bool> signalValue; esignal::Signal<bool> signalValue;
public: // propertie list public: // propertie list
eproperty::Value<bool> propertyValue; //!< Current state of the checkbox. eproperty::Value<bool> propertyValue; //!< Current state of the checkbox.
eproperty::Value<etk::String> propertyShape; //!< shape of the widget eproperty::Value<etk::Uri> propertyShape; //!< shape of the widget
private: private:
ewol::compositing::Shaper m_shaper; //!< Compositing theme. ewol::compositing::Shaper m_shaper; //!< Compositing theme.
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).

View File

@ -7,7 +7,7 @@
#include <ewol/ewol.hpp> #include <ewol/ewol.hpp>
#include <ewol/widget/Composer.hpp> #include <ewol/widget/Composer.hpp>
#include <etk/os/FSNode.hpp> #include <etk/uri/uri.hpp>
#include <ewol/widget/Manager.hpp> #include <ewol/widget/Manager.hpp>
#include <ewol/context/Context.hpp> #include <ewol/context/Context.hpp>
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
@ -20,8 +20,12 @@ ewol::widget::Composer::Composer() :
// nothing to do ... // nothing to do ...
} }
ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::String& _fileName, uint64_t _id) { ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::Uri& _uri, uint64_t _id) {
etk::String tmpData = etk::FSNodeReadAllData(_fileName); etk::String tmpData;
if (etk::uri::readAll(_uri, tmpData) == false) {
EWOL_ERROR("Can not read the file: " << _uri);
return null;
}
return ewol::widget::composerGenerateString(tmpData, _id); return ewol::widget::composerGenerateString(tmpData, _id);
} }
@ -74,8 +78,12 @@ ewol::widget::Composer::~Composer() {
} }
bool ewol::widget::Composer::loadFromFile(const etk::String& _fileName, uint64_t _id) { bool ewol::widget::Composer::loadFromFile(const etk::Uri& _uri, uint64_t _id) {
etk::String tmpData = etk::FSNodeReadAllData(_fileName); etk::String tmpData;
if (etk::uri::readAll(_uri, tmpData) == false) {
EWOL_ERROR("Can not read the file: " << _uri);
return false;
}
return loadFromString(tmpData, _id); return loadFromString(tmpData, _id);
} }

View File

@ -8,6 +8,7 @@
#include <etk/types.hpp> #include <etk/types.hpp>
#include <ewol/debug.hpp> #include <ewol/debug.hpp>
#include <ewol/widget/Container.hpp> #include <ewol/widget/Container.hpp>
#include <etk/uri/uri.hpp>
namespace ewol { namespace ewol {
namespace widget { namespace widget {
@ -21,7 +22,7 @@ namespace ewol {
class Composer : public ewol::widget::Container { class Composer : public ewol::widget::Container {
public: public:
eproperty::Value<bool> propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove eproperty::Value<bool> propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove
eproperty::Value<etk::String> propertySubFile; //!< If loading a sub-file, we must do it here ==> permit to con,figure it in the xml and not have wrong display eproperty::Value<etk::Uri> propertySubFile; //!< If loading a sub-file, we must do it here ==> permit to configure it in the xml and not have wrong display
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
@ -35,12 +36,12 @@ namespace ewol {
virtual ~Composer(); virtual ~Composer();
/** /**
* @brief load a composition with a file * @brief load a composition with a file
* @param[in] _fileName Name of the file * @param[in] _uri Name of the file
* @param[in] _id Unique ID that is used in replacing the balise "{ID}" inside the File (do nothing if == 0) * @param[in] _id Unique ID that is used in replacing the balise "{ID}" inside the File (do nothing if == 0)
* @return true == > all done OK * @return true == > all done OK
* @return false == > some error occured * @return false == > some error occured
*/ */
bool loadFromFile(const etk::String& _fileName, uint64_t _id=0); bool loadFromFile(const etk::Uri& _uri, uint64_t _id=0);
/** /**
* @brief load a composition with a file * @brief load a composition with a file
* @param[in] _composerXmlString xml to parse directly * @param[in] _composerXmlString xml to parse directly
@ -57,6 +58,6 @@ namespace ewol {
virtual void onChangePropertySubFile(); virtual void onChangePropertySubFile();
}; };
ewol::WidgetShared composerGenerateString(const etk::String& _data = "", uint64_t _id=0); ewol::WidgetShared composerGenerateString(const etk::String& _data = "", uint64_t _id=0);
ewol::WidgetShared composerGenerateFile(const etk::String& _data = "", uint64_t _id=0); ewol::WidgetShared composerGenerateFile(const etk::Uri& _uri = "", uint64_t _id=0);
}; };
}; };

View File

@ -18,7 +18,7 @@ ETK_DECLARE_TYPE(enum ewol::widget::ContextMenu::markPosition);
ewol::widget::ContextMenu::ContextMenu(): ewol::widget::ContextMenu::ContextMenu():
propertyShape(this, "shape", propertyShape(this, "shape",
"{ewol}THEME:GUI:ContextMenu.json", etk::Uri("THEME_GUI:///ContextMenu.json?lib=ewol"),
"the display name for config file", "the display name for config file",
&ewol::widget::ContextMenu::onChangePropertyShape), &ewol::widget::ContextMenu::onChangePropertyShape),
propertyArrowPos(this, "arrow-position", propertyArrowPos(this, "arrow-position",

View File

@ -31,7 +31,7 @@ namespace ewol {
markNone markNone
}; };
public: // properties public: // properties
eproperty::Value<etk::String> propertyShape; //!< shape of the widget. eproperty::Value<etk::Uri> propertyShape; //!< shape of the widget.
eproperty::Value<vec2> propertyArrowPos; eproperty::Value<vec2> propertyArrowPos;
eproperty::List<enum markPosition> propertyArrawBorder; eproperty::List<enum markPosition> propertyArrawBorder;
protected: protected:

View File

@ -27,7 +27,7 @@ ewol::widget::Entry::Entry() :
"Not display content in password mode", "Not display content in password mode",
&ewol::widget::Entry::onChangePropertyPassword), &ewol::widget::Entry::onChangePropertyPassword),
propertyShape(this, "shape", propertyShape(this, "shape",
"{ewol}THEME:GUI:Entry.json", etk::Uri("THEME_GUI:///Entry.json?lib=ewol"),
"Shaper to display the background", "Shaper to display the background",
&ewol::widget::Entry::onChangePropertyShaper), &ewol::widget::Entry::onChangePropertyShaper),
propertyValue(this, "value", propertyValue(this, "value",
@ -162,7 +162,7 @@ void ewol::widget::Entry::onRegenerateDisplay() {
} else { } else {
m_text.setCursorPos(m_displayCursorPos); m_text.setCursorPos(m_displayCursorPos);
} }
etk::String valueToDisplay = *propertyValue; etk::UString valueToDisplay = etk::toUString(*propertyValue);
if (*propertyPassword == true) { if (*propertyPassword == true) {
for (auto &it: valueToDisplay) { for (auto &it: valueToDisplay) {
it = '*'; it = '*';
@ -375,14 +375,16 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
m_displayCursorPosSelection = m_displayCursorPos; m_displayCursorPosSelection = m_displayCursorPos;
} }
} else if(_event.getChar() >= 20) { } else if(_event.getChar() >= 20) {
EWOL_ERROR("get data: '" << _event.getChar() << "' = '" << u32char::convertToUtf8(_event.getChar()) << "'");
if ((int64_t)propertyValue->size() > propertyMaxCharacter) { if ((int64_t)propertyValue->size() > propertyMaxCharacter) {
EWOL_INFO("Reject data for entry : '" << _event.getChar() << "'"); EWOL_INFO("Reject data for entry : '" << _event.getChar() << "'");
} else { } else {
etk::String newData = propertyValue; etk::String newData = propertyValue;
newData.insert(newData.begin()+m_displayCursorPos, _event.getChar()); etk::String inputData = u32char::convertToUtf8(_event.getChar());
newData.insert(newData.begin()+m_displayCursorPos, inputData);
setInternalValue(newData); setInternalValue(newData);
if (propertyValue.get() == newData) { if (propertyValue.get() == newData) {
m_displayCursorPos++; m_displayCursorPos += inputData.size();
m_displayCursorPosSelection = m_displayCursorPos; m_displayCursorPosSelection = m_displayCursorPos;
} }
} }

View File

@ -38,7 +38,7 @@ namespace ewol {
esignal::Signal<etk::String> signalModify; //!< data change esignal::Signal<etk::String> signalModify; //!< data change
public: // propertie list public: // propertie list
eproperty::Value<bool> propertyPassword; //!< Disable display of the content of the entry eproperty::Value<bool> propertyPassword; //!< Disable display of the content of the entry
eproperty::Value<etk::String> propertyShape; eproperty::Value<etk::Uri> propertyShape;
eproperty::Value<etk::String> propertyValue; //!< string that must be displayed eproperty::Value<etk::String> propertyValue; //!< string that must be displayed
eproperty::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list eproperty::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list
eproperty::Value<etk::String> propertyRegex; //!< regular expression value eproperty::Value<etk::String> propertyRegex; //!< regular expression value

View File

@ -28,7 +28,7 @@ ewol::widget::Image::Image() :
m_colorId(-1) { m_colorId(-1) {
addObjectType("ewol::widget::Image"); addObjectType("ewol::widget::Image");
m_imageRenderSize = vec2(0,0); m_imageRenderSize = vec2(0,0);
m_colorProperty = ewol::resource::ColorFile::create("{ewol}THEME:COLOR:Image.json"); m_colorProperty = ewol::resource::ColorFile::create(etk::Uri("THEME_COLOR:///Image.json?lib=ewol"));
if (m_colorProperty != null) { if (m_colorProperty != null) {
m_colorId = m_colorProperty->request("foreground"); m_colorId = m_colorProperty->request("foreground");
} }
@ -44,10 +44,10 @@ void ewol::widget::Image::init() {
} }
} }
void ewol::widget::Image::set(const etk::String& _file, const gale::Dimension& _border) { void ewol::widget::Image::set(const etk::Uri& _uri, const gale::Dimension& _border) {
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border); EWOL_VERBOSE("Set Image : " << _uri << " border=" << _border);
propertyBorder.set(_border); propertyBorder.set(_border);
propertySource.set(_file); propertySource.set(_uri);
} }
void ewol::widget::Image::setCustumSource(const egami::Image& _image) { void ewol::widget::Image::setCustumSource(const egami::Image& _image) {

View File

@ -25,7 +25,7 @@ namespace ewol {
public: // signals public: // signals
esignal::Signal<> signalPressed; esignal::Signal<> signalPressed;
public: // properties public: // properties
eproperty::Value<etk::String> propertySource; //!< file name of the image. eproperty::Value<etk::Uri> propertySource; //!< file name of the image.
eproperty::Value<gale::Dimension> propertyBorder; //!< border to add at the image. eproperty::Value<gale::Dimension> propertyBorder; //!< border to add at the image.
eproperty::Value<gale::Dimension> propertyImageSize; //!< border to add at the image. eproperty::Value<gale::Dimension> propertyImageSize; //!< border to add at the image.
eproperty::Value<bool> propertyKeepRatio; //!< keep the image ratio between width and hight eproperty::Value<bool> propertyKeepRatio; //!< keep the image ratio between width and hight
@ -33,7 +33,7 @@ namespace ewol {
eproperty::Range<vec2> propertyPosStop; //!< position in the image to start the sisplay (when we want not to display all the image) eproperty::Range<vec2> propertyPosStop; //!< position in the image to start the sisplay (when we want not to display all the image)
eproperty::Value<bool> propertyDistanceFieldMode; //!< to have a parameter eproperty::Value<bool> propertyDistanceFieldMode; //!< to have a parameter
eproperty::Value<bool> propertySmooth; //!< display is done in the pixed approximation if false eproperty::Value<bool> propertySmooth; //!< display is done in the pixed approximation if false
eproperty::Value<bool> propertyUseThemeColor; //!< Use the themo color management ("{ewol}THEME:COLOR:Image.json") default false eproperty::Value<bool> propertyUseThemeColor; //!< Use the themo color management ("THEME_COLOR:///Image.json?lib=ewol") default false
protected: protected:
ewol::compositing::Image m_compositing; //!< compositing element of the image. ewol::compositing::Image m_compositing; //!< compositing element of the image.
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property
@ -52,10 +52,10 @@ namespace ewol {
virtual ~Image(); virtual ~Image();
/** /**
* @brief set All the configuration of the current image * @brief set All the configuration of the current image
* @param[in] _file Filaneme of the new image * @param[in] _uri URI of the new image
* @param[in] _border New border size to set * @param[in] _border New border size to set
*/ */
void set(const etk::String& _file, const gale::Dimension& _border); void set(const etk::Uri& _uri, const gale::Dimension& _border);
/** /**
* @brief Set an image with direct elements * @brief Set an image with direct elements
* @param[in] _image Image to set in the display * @param[in] _image Image to set in the display

View File

@ -23,12 +23,16 @@ ewol::widget::Label::Label() :
"", "",
"displayed value string", "displayed value string",
&ewol::widget::Label::onChangePropertyValue), &ewol::widget::Label::onChangePropertyValue),
propertyFontSize(this, "font-size",
0,
"default font size (0=> system default)",
&ewol::widget::Label::onChangePropertyFontSize),
m_value(U""), m_value(U""),
m_colorProperty(null), m_colorProperty(null),
m_colorDefaultFgText(-1), m_colorDefaultFgText(-1),
m_colorDefaultBgText(-1){ m_colorDefaultBgText(-1){
addObjectType("ewol::widget::Label"); addObjectType("ewol::widget::Label");
m_colorProperty = ewol::resource::ColorFile::create("{ewol}THEME:COLOR:Label.json"); m_colorProperty = ewol::resource::ColorFile::create(etk::Uri("THEME_COLOR:///Label.json?lib=ewol"));
if (m_colorProperty != null) { if (m_colorProperty != null) {
m_colorDefaultFgText = m_colorProperty->request("foreground"); m_colorDefaultFgText = m_colorProperty->request("foreground");
m_colorDefaultBgText = m_colorProperty->request("background"); m_colorDefaultBgText = m_colorProperty->request("background");
@ -115,6 +119,9 @@ void ewol::widget::Label::onRegenerateDisplay() {
// clean the element // clean the element
m_text.reset(); m_text.reset();
if (propertyFontSize.get() != 0) {
m_text.setFontSize(propertyFontSize.get());
}
if (m_colorProperty != null) { if (m_colorProperty != null) {
m_text.setDefaultColorFg(m_colorProperty->get(m_colorDefaultFgText)); m_text.setDefaultColorFg(m_colorProperty->get(m_colorDefaultFgText));
m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText)); m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText));
@ -159,6 +166,10 @@ void ewol::widget::Label::onChangePropertyValue() {
requestUpdateSize(); requestUpdateSize();
} }
void ewol::widget::Label::onChangePropertyFontSize() {
onChangePropertyValue();
}
void ewol::widget::Label::onChangePropertyAutoTranslate() { void ewol::widget::Label::onChangePropertyAutoTranslate() {
onChangePropertyValue(); onChangePropertyValue();
} }

View File

@ -27,6 +27,7 @@ namespace ewol {
public: // properties public: // properties
eproperty::Value<bool> propertyAutoTranslate; //!< if at true the data is translate automaticaly translate. eproperty::Value<bool> propertyAutoTranslate; //!< if at true the data is translate automaticaly translate.
eproperty::Value<etk::String> propertyValue; //!< decorated text to display. eproperty::Value<etk::String> propertyValue; //!< decorated text to display.
eproperty::Value<int32_t> propertyFontSize; //!< default size of the font.
private: private:
ewol::compositing::Text m_text; //!< Compositing text element. ewol::compositing::Text m_text; //!< Compositing text element.
etk::UString m_value; etk::UString m_value;
@ -56,6 +57,7 @@ namespace ewol {
protected: protected:
virtual void onChangePropertyValue(); virtual void onChangePropertyValue();
virtual void onChangePropertyAutoTranslate(); virtual void onChangePropertyAutoTranslate();
virtual void onChangePropertyFontSize();
}; };
}; };
}; };

View File

@ -29,16 +29,31 @@ ewol::widget::List::List() {
void ewol::widget::List::init() { void ewol::widget::List::init() {
ewol::widget::WidgetScrolled::init(); ewol::widget::WidgetScrolled::init();
addComposeElemnent("drawing", ememory::makeShared<ewol::compositing::Drawing>());
addComposeElemnent("text", ememory::makeShared<ewol::compositing::Text>());
} }
ewol::widget::List::~List() { ewol::widget::List::~List() {
//clean all the object }
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
ETK_DELETE(ewol::Compositing, m_listOObject[iii]); void ewol::widget::List::addComposeElemnent(const etk::String& _name, const ememory::SharedPtr<ewol::Compositing>& _element) {
m_listOObject[iii] = null; m_compositingElements.set(_name, _element);
m_listOObject.pushBack(_element);
}
void ewol::widget::List::clearComposeElemnent() {
for (auto &it: m_compositingElements) {
it.second->clear();
} }
m_listOObject.clear(); }
void ewol::widget::List::removeComposeElemnent() {
m_compositingElements.clear();
}
ememory::SharedPtr<ewol::Compositing> ewol::widget::List::getComposeElemnent(const etk::String& _name) {
return m_compositingElements[_name];
} }
/* /*
void ewol::widget::List::setRawVisible(int32_t _id) { void ewol::widget::List::setRawVisible(int32_t _id) {
@ -79,27 +94,6 @@ void ewol::widget::List::calculateMinMaxSize() {
m_minSize.setValue(200, 150); m_minSize.setValue(200, 150);
} }
void ewol::widget::List::addOObject(ewol::Compositing* _newObject, int32_t _pos) {
if (_newObject == null) {
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
return;
}
if ( _pos < 0
|| (size_t)_pos >= m_listOObject.size() ) {
m_listOObject.pushBack(_newObject);
} else {
m_listOObject.insert(m_listOObject.begin()+_pos, _newObject);
}
}
void ewol::widget::List::clearOObjectList() {
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
ETK_DELETE(ewol::Compositing, m_listOObject[iii]);
m_listOObject[iii] = null;
}
m_listOObject.clear();
}
void ewol::widget::List::onDraw() { void ewol::widget::List::onDraw() {
for (size_t iii=0; iii<m_listOObject.size(); iii++) { for (size_t iii=0; iii<m_listOObject.size(); iii++) {
if (m_listOObject[iii] != null) { if (m_listOObject[iii] != null) {
@ -112,7 +106,7 @@ void ewol::widget::List::onDraw() {
void ewol::widget::List::onRegenerateDisplay() { void ewol::widget::List::onRegenerateDisplay() {
if (needRedraw() == true) { if (needRedraw() == true) {
// clean the object list ... // clean the object list ...
clearOObjectList(); clearComposeElemnent();
// ------------------------------------------------------- // -------------------------------------------------------
// -- Calculate the size of each element // -- Calculate the size of each element
// ------------------------------------------------------- // -------------------------------------------------------
@ -232,9 +226,9 @@ ivec2 ewol::widget::List::getMatrixSize() const {
} }
vec2 ewol::widget::List::calculateElementSize(const ivec2& _pos) { vec2 ewol::widget::List::calculateElementSize(const ivec2& _pos) {
ewol::compositing::Text tmpText; auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString(); etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
vec3 textSize = tmpText.calculateSize(myTextToWrite); vec3 textSize = tmpText->calculateSize(myTextToWrite);
ivec2 count = getMatrixSize(); ivec2 count = getMatrixSize();
return vec2(textSize.x(), return vec2(textSize.x(),
textSize.y() + m_paddingSizeY*3 textSize.y() + m_paddingSizeY*3
@ -242,9 +236,8 @@ vec2 ewol::widget::List::calculateElementSize(const ivec2& _pos) {
} }
void ewol::widget::List::drawBackground() { void ewol::widget::List::drawBackground() {
ewol::compositing::Drawing * BGOObjects = ETK_NEW(ewol::compositing::Drawing); auto BGOObjects = ememory::staticPointerCast<ewol::compositing::Drawing>(getComposeElemnent("drawing"));
if (BGOObjects != null) { if (BGOObjects != null) {
addOObject(BGOObjects);
etk::Color<> basicBG = getBasicBG(); etk::Color<> basicBG = getBasicBG();
BGOObjects->setColor(basicBG); BGOObjects->setColor(basicBG);
BGOObjects->setPos(vec3(0, 0, 0) ); BGOObjects->setPos(vec3(0, 0, 0) );
@ -258,18 +251,16 @@ void ewol::widget::List::drawElement(const ivec2& _pos, const vec2& _start, cons
auto backgroundVariant = getData(ListRole::BgColor, _pos); auto backgroundVariant = getData(ListRole::BgColor, _pos);
if (backgroundVariant.isColor() == true) { if (backgroundVariant.isColor() == true) {
etk::Color<> bg = backgroundVariant.getColor(); etk::Color<> bg = backgroundVariant.getColor();
ewol::compositing::Drawing * BGOObjects = ETK_NEW(ewol::compositing::Drawing); auto BGOObjects = ememory::staticPointerCast<ewol::compositing::Drawing>(getComposeElemnent("drawing"));
if (BGOObjects != null) { if (BGOObjects != null) {
addOObject(BGOObjects);
BGOObjects->setColor(bg); BGOObjects->setColor(bg);
BGOObjects->setPos(vec3(_start.x(), _start.y(), 0) ); BGOObjects->setPos(vec3(_start.x(), _start.y(), 0) );
BGOObjects->rectangleWidth(_size); BGOObjects->rectangleWidth(_size);
} }
} }
if (myTextToWrite != "") { if (myTextToWrite != "") {
ewol::compositing::Text * tmpText = ETK_NEW(ewol::compositing::Text); auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
if (tmpText != null) { if (tmpText != null) {
addOObject(tmpText);
int32_t displayPositionY = _start.y() + m_paddingSizeY; int32_t displayPositionY = _start.y() + m_paddingSizeY;
tmpText->setColor(fg); tmpText->setColor(fg);
tmpText->setPos(vec3(_start.x() + m_paddingSizeX, displayPositionY, 0) ); tmpText->setPos(vec3(_start.x() + m_paddingSizeX, displayPositionY, 0) );

View File

@ -45,11 +45,16 @@ namespace ewol {
void calculateMinMaxSize() override; void calculateMinMaxSize() override;
// drawing capabilities .... // drawing capabilities ....
protected: protected:
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display... etk::Vector<ememory::SharedPtr<ewol::Compositing>> m_listOObject; //!< generic element to display...
etk::Vector<int32_t> m_listSizeX; //!< size of every colomns etk::Vector<int32_t> m_listSizeX; //!< size of every colomns
etk::Vector<int32_t> m_listSizeY; //!< size of every rows etk::Vector<int32_t> m_listSizeY; //!< size of every rows
protected:
etk::Map<etk::String, ememory::SharedPtr<ewol::Compositing>> m_compositingElements;
void addComposeElemnent(const etk::String& _name, const ememory::SharedPtr<ewol::Compositing>& _element);
void clearComposeElemnent();
void removeComposeElemnent();
ememory::SharedPtr<ewol::Compositing> getComposeElemnent(const etk::String& _name);
public: public:
void addOObject(ewol::Compositing* _newObject, int32_t _pos=-1);
void clearOObjectList(); void clearOObjectList();
// list properties ... // list properties ...
protected: protected:

View File

@ -6,8 +6,8 @@
#include <ewol/widget/ListFileSystem.hpp> #include <ewol/widget/ListFileSystem.hpp>
#include <etk/tool.hpp> #include <etk/tool.hpp>
#include <etk/os/FSNode.hpp> #include <etk/path/fileSystem.hpp>
#include <etk/algorithm.hpp>
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(ewol::widget::ListFileSystem); ETK_DECLARE_TYPE(ewol::widget::ListFileSystem);
@ -17,11 +17,11 @@ ewol::widget::ListFileSystem::ListFileSystem() :
signalFolderSelect(this, "folder-select", ""), signalFolderSelect(this, "folder-select", ""),
signalFolderValidate(this, "folder-validate", ""), signalFolderValidate(this, "folder-validate", ""),
propertyPath(this, "path", propertyPath(this, "path",
"/", etk::Path("/"),
"Path to display", "Path to display",
&ewol::widget::ListFileSystem::onChangePropertyPath), &ewol::widget::ListFileSystem::onChangePropertyPath),
propertyFile(this, "select", propertyFile(this, "select",
"", etk::Path(),
"selection af a specific file", "selection af a specific file",
&ewol::widget::ListFileSystem::onChangePropertyFile), &ewol::widget::ListFileSystem::onChangePropertyFile),
propertyShowFile(this, "show-file", propertyShowFile(this, "show-file",
@ -45,14 +45,14 @@ ewol::widget::ListFileSystem::ListFileSystem() :
#if defined(__TARGET_OS__Windows) #if defined(__TARGET_OS__Windows)
propertyPath.setDirectCheck("c:/"); propertyPath.setDirectCheck("c:/");
#endif #endif
m_colorProperty = ewol::resource::ColorFile::create("{ewol}THEME:COLOR:ListFileSystem.json"); m_colorProperty = ewol::resource::ColorFile::create("THEME_COLOR:///ListFileSystem.json?lib=ewol");
if (m_colorProperty != null) { if (m_colorProperty != null) {
m_colorIdText = m_colorProperty->request("text"); m_colorIdText = m_colorProperty->request("text");
m_colorIdBackground1 = m_colorProperty->request("background1"); m_colorIdBackground1 = m_colorProperty->request("background1");
m_colorIdBackground2 = m_colorProperty->request("background2"); m_colorIdBackground2 = m_colorProperty->request("background2");
m_colorIdBackgroundSelected = m_colorProperty->request("selected"); m_colorIdBackgroundSelected = m_colorProperty->request("selected");
} }
setMouseLimit(1); setMouseLimit(2);
} }
ewol::widget::ListFileSystem::~ListFileSystem() { ewol::widget::ListFileSystem::~ListFileSystem() {
@ -60,53 +60,58 @@ ewol::widget::ListFileSystem::~ListFileSystem() {
} }
void ewol::widget::ListFileSystem::clearList() { void ewol::widget::ListFileSystem::clearList() {
for (auto &it : m_list) { m_list.clear();
if (it != null) {
ETK_DELETE(etk::FSNode, it);
it = null;
}
}
} }
etk::Color<> ewol::widget::ListFileSystem::getBasicBG() { etk::Color<> ewol::widget::ListFileSystem::getBasicBG() {
return m_colorProperty->get(m_colorIdBackground1); return m_colorProperty->get(m_colorIdBackground1);
} }
static bool localSort(const etk::Path& _left, const etk::Path& _right) {
return _left.getString().toUpper() <= _right.getString().toUpper();
}
void ewol::widget::ListFileSystem::regenerateView() { void ewol::widget::ListFileSystem::regenerateView() {
clearList(); clearList();
m_selectedLine = -1; m_selectedLine = -1;
m_list.clear(); m_list.clear();
m_originScrooled.setValue(0,0); m_originScrooled.setValue(0,0);
etk::FSNode tmpFolder(*propertyPath); uint32_t flags = 0;
// get the list: if (*propertyShowHidden == true) {
m_list = tmpFolder.folderGetSubList(*propertyShowHidden, *propertyShowFolder, *propertyShowFile, *propertyFilter); flags |= etk::path::LIST_HIDDEN;
}
if (*propertyShowFolder == true) {
flags |= etk::path::LIST_FOLDER;
}
if (*propertyShowFile == true) {
flags |= etk::path::LIST_FILE;
}
m_list = etk::path::list(*propertyPath, flags);
EWOL_ERROR("Lsit of element: " << m_list.size() );
// Sort the list:
etk::algorithm::quickSort(m_list, localSort);
// request a redraw ... // request a redraw ...
markToRedraw(); markToRedraw();
} }
etk::String ewol::widget::ListFileSystem::getSelect() const { etk::Path ewol::widget::ListFileSystem::getSelect() const {
etk::String tmpVal = ""; etk::String tmpVal = "";
if (m_selectedLine >= 0) { if (m_selectedLine >= 0) {
if (m_list[m_selectedLine] != null) { tmpVal = m_list[m_selectedLine].getFileName();
tmpVal = m_list[m_selectedLine]->getNameFile();
}
} }
return tmpVal; return tmpVal;
} }
// select the specific file // select the specific file
void ewol::widget::ListFileSystem::setSelect(const etk::String& _data) { void ewol::widget::ListFileSystem::setSelect(const etk::Path& _data) {
// remove selected line // remove selected line
m_selectedLine = -1; m_selectedLine = -1;
// search the coresponding file : // search the coresponding file :
for (size_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
if (m_list[iii] != null) { if (m_list[iii] == _data) {
if (m_list[iii]->getNameFile() == _data) { // we find the line :
// we find the line : m_selectedLine = iii;
m_selectedLine = iii; break;
break;
}
} }
} }
markToRedraw(); markToRedraw();
@ -143,10 +148,9 @@ fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const ive
} }
} }
if( _pos.y()-offset >= 0 if( _pos.y()-offset >= 0
&& _pos.y()-offset < (int32_t)m_list.size() && _pos.y()-offset < (int32_t)m_list.size()) {
&& m_list[_pos.y()-offset] != null) { EWOL_VERBOSE("get filename for : '" << m_list[_pos.y()-offset] << ":'" << m_list[_pos.y()-offset].getFileName() << "'");
EWOL_VERBOSE("get filename for : '" << *m_list[_pos.y()-offset] << ":'" << m_list[_pos.y()-offset]->getNameFile() << "'"); return m_list[_pos.y()-offset].getFileName();
return m_list[_pos.y()-offset]->getNameFile();
} }
} }
return "<<<ERROR>>>"; return "<<<ERROR>>>";
@ -175,62 +179,45 @@ bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event,
offset = 2; offset = 2;
} }
} }
if (_event.getStatus() == gale::key::status::pressSingle) { if ( _event.getStatus() == gale::key::status::pressSingle
|| _event.getStatus() == gale::key::status::pressDouble) {
EWOL_VERBOSE("Event on List : IdInput=" << _event.getId() << " _pos=" << _pos ); EWOL_VERBOSE("Event on List : IdInput=" << _event.getId() << " _pos=" << _pos );
if (1 == _event.getId()) { if (1 == _event.getId()) {
int32_t previousRaw = m_selectedLine;
if (_pos.y() > (int32_t)m_list.size()+offset ) { if (_pos.y() > (int32_t)m_list.size()+offset ) {
m_selectedLine = -1; m_selectedLine = -1;
} else { } else {
m_selectedLine = _pos.y(); m_selectedLine = _pos.y();
} }
if (previousRaw != m_selectedLine) { if( *propertyShowFolder == true
if( *propertyShowFolder == true && m_selectedLine == 0) {
&& m_selectedLine == 0) { // "." folder
// "." folder if (_event.getStatus() == gale::key::status::pressSingle) {
signalFolderSelect.emit("."); signalFolderSelect.emit(*propertyPath);
} else if ( *propertyShowFolder == true } else {
&& m_selectedLine == 1) { signalFolderValidate.emit(*propertyPath);
// ".." folder
signalFolderSelect.emit("..");
} else if( m_selectedLine-offset >= 0
&& m_selectedLine-offset < (int32_t)m_list.size()
&& null != m_list[m_selectedLine-offset] ) {
// generate event extern :
switch(m_list[m_selectedLine-offset]->getNodeType()) {
case etk::typeNode_file :
signalFileSelect.emit(m_list[m_selectedLine-offset]->getNameFile());
break;
case etk::typeNode_folder :
signalFolderSelect.emit(m_list[m_selectedLine-offset]->getNameFile());
break;
default:
EWOL_ERROR("Can not generate event on an unknow type");
break;
}
} }
} else { } else if ( *propertyShowFolder == true
if( *propertyShowFolder == true && m_selectedLine == 1) {
&& m_selectedLine == 0) { // ".." folder
// "." folder if (_event.getStatus() == gale::key::status::pressSingle) {
signalFolderValidate.emit("."); signalFolderSelect.emit(propertyPath->getParent());
} else if ( *propertyShowFolder == true } else {
&& m_selectedLine == 1) { signalFolderValidate.emit(propertyPath->getParent());
// ".." folder }
signalFolderValidate.emit(".."); } else if( m_selectedLine-offset >= 0
} else if( m_selectedLine-offset >= 0 && m_selectedLine-offset < (int32_t)m_list.size() ) {
&& m_selectedLine-offset < (int32_t)m_list.size() // generate event extern:
&& null != m_list[m_selectedLine-offset] ) { if(etk::path::isDirectory(m_list[m_selectedLine-offset])) {
switch(m_list[m_selectedLine-offset]->getNodeType()) { if (_event.getStatus() == gale::key::status::pressSingle) {
case etk::typeNode_file : signalFolderSelect.emit(m_list[m_selectedLine-offset]);
signalFileValidate.emit(m_list[m_selectedLine-offset]->getNameFile()); } else {
break; signalFolderValidate.emit(m_list[m_selectedLine-offset]);
case etk::typeNode_folder : }
signalFolderValidate.emit(m_list[m_selectedLine-offset]->getNameFile()); } else {
break; if (_event.getStatus() == gale::key::status::pressSingle) {
default: signalFileSelect.emit(m_list[m_selectedLine-offset]);
EWOL_ERROR("Can not generate event on an unknow type"); } else {
break; signalFileValidate.emit(m_list[m_selectedLine-offset]);
} }
} }
} }
@ -243,6 +230,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event,
} }
void ewol::widget::ListFileSystem::onChangePropertyPath() { void ewol::widget::ListFileSystem::onChangePropertyPath() {
EWOL_WARNING("Change Path: " << *propertyPath << " selected File=" << *propertyFile);;
regenerateView(); regenerateView();
} }

View File

@ -6,7 +6,6 @@
#pragma once #pragma once
#include <ewol/widget/List.hpp> #include <ewol/widget/List.hpp>
#include <etk/os/FSNode.hpp>
#include <ewol/resource/ColorFile.hpp> #include <ewol/resource/ColorFile.hpp>
#include <esignal/Signal.hpp> #include <esignal/Signal.hpp>
@ -20,13 +19,13 @@ namespace ewol {
*/ */
class ListFileSystem : public ewol::widget::List { class ListFileSystem : public ewol::widget::List {
public: // signals public: // signals
esignal::Signal<etk::String> signalFileSelect; //!< @event "file-select" Generated when a file is selected. esignal::Signal<etk::Path> signalFileSelect; //!< @event "file-select" Generated when a file is selected.
esignal::Signal<etk::String> signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element esignal::Signal<etk::Path> signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element
esignal::Signal<etk::String> signalFolderSelect; esignal::Signal<etk::Path> signalFolderSelect;
esignal::Signal<etk::String> signalFolderValidate; esignal::Signal<etk::Path> signalFolderValidate;
public: // properties public: // properties
eproperty::Value<etk::String> propertyPath; //!< Current folder that display point on. eproperty::Value<etk::Path> propertyPath; //!< Current folder that display point on.
eproperty::Value<etk::String> propertyFile; //!< current selected file eproperty::Value<etk::Path> propertyFile; //!< current selected file
eproperty::Value<bool> propertyShowFile; //!< Show files elements eproperty::Value<bool> propertyShowFile; //!< Show files elements
eproperty::Value<bool> propertyShowFolder; //!< Display the folders elements eproperty::Value<bool> propertyShowFolder; //!< Display the folders elements
eproperty::Value<bool> propertyShowHidden; //!< Display hidden elements eproperty::Value<bool> propertyShowHidden; //!< Display hidden elements
@ -48,8 +47,7 @@ namespace ewol {
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override; fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override; bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override;
protected: protected:
// TODO: use shred_ptr etk::Vector<etk::Path> m_list; //!< List of all element in the path. (they are filtered)
etk::Vector<etk::FSNode *> m_list; //!< List of all element in the path. (they are filtered)
/** /**
* @brief Clean the list of element. * @brief Clean the list of element.
*/ */
@ -65,12 +63,12 @@ namespace ewol {
* @brief Select a specific file in the path * @brief Select a specific file in the path
* @param[in] _data File to selested. * @param[in] _data File to selested.
*/ */
virtual void setSelect(const etk::String& _data); virtual void setSelect(const etk::Path& _data);
/** /**
* @brief Get the current selected file/folder/... in the list * @brief Get the current selected file/folder/... in the list
* @return the String of the element selected. * @return the String of the element selected.
*/ */
etk::String getSelect() const ; etk::Path getSelect() const ;
protected: protected:
virtual void onChangePropertyPath(); virtual void onChangePropertyPath();
virtual void onChangePropertyFile(); virtual void onChangePropertyFile();

View File

@ -301,7 +301,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
etk::String widgetName = pNode.getValue(); etk::String widgetName = pNode.getValue();
EWOL_INFO("Get node : " << pNode); EWOL_INFO("Get node : " << pNode);
if (widgetName == "elem") { if (widgetName == "elem") {
// <elem title="_T{Title of the button}" image="DATA:List.svg" event="menu:exit"> // <elem title="_T{Title of the button}" image="DATA:///List.svg" event="menu:exit">
int32_t idMenu = addTitle(pNode.attributes["title"], pNode.attributes["image"], pNode.attributes["event"]); int32_t idMenu = addTitle(pNode.attributes["title"], pNode.attributes["image"], pNode.attributes["event"]);
for (const auto nodeIt2 : pNode.nodes) { for (const auto nodeIt2 : pNode.nodes) {
@ -312,7 +312,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
} }
etk::String widgetName2 = pNode2.getValue(); etk::String widgetName2 = pNode2.getValue();
if (widgetName2 == "elem") { if (widgetName2 == "elem") {
// <elem title="_T{Title of the button}" image="DATA:List.svg" event="menu:exit"> // <elem title="_T{Title of the button}" image="DATA:///List.svg" event="menu:exit">
add(idMenu, pNode2.attributes["title"], pNode2.attributes["image"], pNode2.attributes["event"]); add(idMenu, pNode2.attributes["title"], pNode2.attributes["image"], pNode2.attributes["event"]);
} else if (widgetName2 == "separator") { } else if (widgetName2 == "separator") {
addSpacer(idMenu); addSpacer(idMenu);

View File

@ -17,7 +17,7 @@ static const char* annimationIncrease = "increase";
ewol::widget::PopUp::PopUp() : ewol::widget::PopUp::PopUp() :
propertyShape(this, "shaper", propertyShape(this, "shaper",
"{ewol}THEME:GUI:PopUp.json", etk::Uri("THEME_GUI:///PopUp.json?lib=ewol"),
"The shaper properties", "The shaper properties",
&ewol::widget::PopUp::onChangePropertyShape), &ewol::widget::PopUp::onChangePropertyShape),
propertyLockExpand(this, "lock", propertyLockExpand(this, "lock",

View File

@ -23,7 +23,7 @@ namespace ewol {
*/ */
class PopUp : public ewol::widget::Container { class PopUp : public ewol::widget::Container {
public: // properties public: // properties
eproperty::Value<etk::String> propertyShape; //!< Compositing theme. eproperty::Value<etk::Uri> propertyShape; //!< Compositing theme.
eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
eproperty::Value<bool> propertyCloseOutEvent; //!< ratio progression of a sliding eproperty::Value<bool> propertyCloseOutEvent; //!< ratio progression of a sliding
protected: protected:

View File

@ -18,11 +18,11 @@ ewol::widget::Scroll::Scroll() :
"Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end", "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end",
&ewol::widget::Scroll::onChangePropertyLimit), &ewol::widget::Scroll::onChangePropertyLimit),
propertyShapeVert(this, "shape-vert", propertyShapeVert(this, "shape-vert",
"{ewol}THEME:GUI:WidgetScrolled.json", etk::Uri("THEME_GUI:///WidgetScrolled.json?lib=ewol"),
"shape for the vertical display", "shape for the vertical display",
&ewol::widget::Scroll::onChangePropertyShapeVert), &ewol::widget::Scroll::onChangePropertyShapeVert),
propertyShapeHori(this, "shape-hori", propertyShapeHori(this, "shape-hori",
"{ewol}THEME:GUI:WidgetScrolled.json", etk::Uri("THEME_GUI:///WidgetScrolled.json?lib=ewol"),
"shape for the horizonal display", "shape for the horizonal display",
&ewol::widget::Scroll::onChangePropertyShapeHori), &ewol::widget::Scroll::onChangePropertyShapeHori),
propertyHover(this, "hover", propertyHover(this, "hover",

View File

@ -20,8 +20,8 @@ namespace ewol {
class Scroll : public ewol::widget::Container { class Scroll : public ewol::widget::Container {
public: // properties public: // properties
eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen
eproperty::Value<etk::String> propertyShapeVert; //!< Vertical shaper name eproperty::Value<etk::Uri> propertyShapeVert; //!< Vertical shaper name
eproperty::Value<etk::String> propertyShapeHori; //!< Horizontal shaper name eproperty::Value<etk::Uri> propertyShapeHori; //!< Horizontal shaper name
eproperty::Value<bool> propertyHover; //!< Horizontal shaper name eproperty::Value<bool> propertyHover; //!< Horizontal shaper name
public: public:
enum highSpeedMode { enum highSpeedMode {

View File

@ -28,7 +28,7 @@ ewol::widget::Select::Select() :
&ewol::widget::Select::onChangePropertyValue) { &ewol::widget::Select::onChangePropertyValue) {
addObjectType("ewol::widget::Select"); addObjectType("ewol::widget::Select");
// override the basic parameter: // override the basic parameter:
propertyShape.setDirectCheck("{ewol}THEME:GUI:Select.json"); propertyShape.setDirectCheck(etk::Uri("THEME_GUI:///Select.json?lib=ewol"));
propertySpinMode.setDirect(ewol::widget::spinPosition_noneRight); propertySpinMode.setDirect(ewol::widget::spinPosition_noneRight);
propertySpinMode.changeDefault(ewol::widget::spinPosition_noneRight); propertySpinMode.changeDefault(ewol::widget::spinPosition_noneRight);
propertySpinMode.rename("none-none", "none"); propertySpinMode.rename("none-none", "none");

View File

@ -38,7 +38,7 @@ ewol::widget::Spin::Spin() :
"fix-point mantis", "fix-point mantis",
&ewol::widget::Spin::onChangePropertyMantis) { &ewol::widget::Spin::onChangePropertyMantis) {
addObjectType("ewol::widget::Spin"); addObjectType("ewol::widget::Spin");
propertyShape.setDirectCheck("{ewol}THEME:GUI:Spin.json"); propertyShape.setDirectCheck(etk::Uri("THEME_GUI:///Spin.json?lib=ewol"));
} }
ewol::widget::Spin::~Spin() { ewol::widget::Spin::~Spin() {

View File

@ -17,7 +17,7 @@ ETK_DECLARE_TYPE(ewol::widget::TreeView);
ewol::widget::TreeView::TreeView(): ewol::widget::TreeView::TreeView():
ewol::widget::List(), ewol::widget::List(),
propertyOffsetTreeView(this, "offsetTreeView", propertyOffsetTreeView(this, "offsetTreeView",
30, 15,
"Offset indentation for each node", "Offset indentation for each node",
&ewol::widget::TreeView::onChangePropertyOffsetTreeView), &ewol::widget::TreeView::onChangePropertyOffsetTreeView),
propertyIconTreeViewSize(this, "iconTreeViewSize", propertyIconTreeViewSize(this, "iconTreeViewSize",
@ -34,6 +34,8 @@ ewol::widget::TreeView::TreeView():
void ewol::widget::TreeView::init() { void ewol::widget::TreeView::init() {
ewol::widget::List::init(); ewol::widget::List::init();
propertyFill.set(bvec2(true,false)); propertyFill.set(bvec2(true,false));
addComposeElemnent("image_ChevronRight", ememory::makeShared<ewol::compositing::Image>("THEME_GUI:///ChevronRight.svg?lib=ewol"));
addComposeElemnent("image_ChevronMore", ememory::makeShared<ewol::compositing::Image>("THEME_GUI:///ChevronMore.svg?lib=ewol"));
} }
ewol::widget::TreeView::~TreeView() { ewol::widget::TreeView::~TreeView() {
@ -41,7 +43,7 @@ ewol::widget::TreeView::~TreeView() {
} }
vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) { vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) {
ewol::compositing::Text tmpText; auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString(); etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
float_t treeOffset = 0; float_t treeOffset = 0;
if (_pos.x() == 0) { if (_pos.x() == 0) {
@ -65,9 +67,9 @@ vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) {
} }
vec3 textSize; vec3 textSize;
if (propertyTextIsDecorated.get() == true) { if (propertyTextIsDecorated.get() == true) {
textSize = tmpText.calculateSizeDecorated(myTextToWrite); textSize = tmpText->calculateSizeDecorated(myTextToWrite);
} else { } else {
textSize = tmpText.calculateSize(myTextToWrite); textSize = tmpText->calculateSize(myTextToWrite);
} }
ivec2 count = getMatrixSize(); ivec2 count = getMatrixSize();
return vec2(textSize.x() + treeOffset + iconSize, return vec2(textSize.x() + treeOffset + iconSize,
@ -87,14 +89,13 @@ void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start,
iconName = getData(ListRole::Icon, _pos).getSafeString(); iconName = getData(ListRole::Icon, _pos).getSafeString();
bool haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean(); bool haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean();
if (haveChild == true) { if (haveChild == true) {
ewol::compositing::Image * tmpImage = null; ememory::SharedPtr<ewol::compositing::Image> tmpImage = null;
if ( getData(ListRole::IsExpand, _pos).getSafeBoolean() == false) { if ( getData(ListRole::IsExpand, _pos).getSafeBoolean() == false) {
tmpImage = ETK_NEW(ewol::compositing::Image, "{ewol}THEME:GUI:ChevronRight.svg"); tmpImage = ememory::staticPointerCast<ewol::compositing::Image>(getComposeElemnent("image_ChevronRight"));
} else { } else {
tmpImage = ETK_NEW(ewol::compositing::Image, "{ewol}THEME:GUI:ChevronMore.svg"); tmpImage = ememory::staticPointerCast<ewol::compositing::Image>(getComposeElemnent("image_ChevronMore"));
} }
if (tmpImage != null) { if (tmpImage != null) {
addOObject(tmpImage);
tmpImage->setColor(fg); tmpImage->setColor(fg);
tmpImage->setPos(posStart); tmpImage->setPos(posStart);
tmpImage->print(vec2(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get())); tmpImage->print(vec2(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get()));
@ -108,9 +109,8 @@ void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start,
auto backgroundVariant = getData(ListRole::BgColor, _pos); auto backgroundVariant = getData(ListRole::BgColor, _pos);
if (backgroundVariant.isColor() == true) { if (backgroundVariant.isColor() == true) {
etk::Color<> bg = backgroundVariant.getColor(); etk::Color<> bg = backgroundVariant.getColor();
ewol::compositing::Drawing * BGOObjects = ETK_NEW(ewol::compositing::Drawing); auto BGOObjects = ememory::staticPointerCast<ewol::compositing::Drawing>(getComposeElemnent("drawing"));
if (BGOObjects != null) { if (BGOObjects != null) {
addOObject(BGOObjects);
BGOObjects->setColor(bg); BGOObjects->setColor(bg);
BGOObjects->setPos(_start); BGOObjects->setPos(_start);
BGOObjects->rectangleWidth(_size); BGOObjects->rectangleWidth(_size);
@ -118,20 +118,20 @@ void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start,
} }
posStart += vec2(m_paddingSizeX, m_paddingSizeY); posStart += vec2(m_paddingSizeX, m_paddingSizeY);
if (iconName != "") { if (iconName != "") {
ewol::compositing::Image * tmpImage = ETK_NEW(ewol::compositing::Image, iconName); auto tmpImage = ememory::staticPointerCast<ewol::compositing::Image>(getComposeElemnent(iconName));
if (tmpImage != null) { if (tmpImage != null) {
addOObject(tmpImage);
tmpImage->setColor(fg); tmpImage->setColor(fg);
tmpImage->setPos(posStart); tmpImage->setPos(posStart);
tmpImage->print(vec2(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get())); tmpImage->print(vec2(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get()));
} else {
EWOL_ERROR("can not get : " << iconName );
} }
// move right // move right
posStart.setX(posStart.x() + propertyIconTreeViewSize.get()); posStart.setX(posStart.x() + propertyIconTreeViewSize.get());
} }
if (myTextToWrite != "") { if (myTextToWrite != "") {
ewol::compositing::Text * tmpText = ETK_NEW(ewol::compositing::Text); auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
if (tmpText != null) { if (tmpText != null) {
addOObject(tmpText);
tmpText->setColor(fg); tmpText->setColor(fg);
tmpText->setPos(posStart); tmpText->setPos(posStart);
if (propertyTextIsDecorated.get() == true) { if (propertyTextIsDecorated.get() == true) {

View File

@ -15,11 +15,11 @@ ETK_DECLARE_TYPE(ewol::widget::WidgetScrolled);
ewol::widget::WidgetScrolled::WidgetScrolled() : ewol::widget::WidgetScrolled::WidgetScrolled() :
propertyShapeVert(this, "shape-vert", propertyShapeVert(this, "shape-vert",
"{ewol}THEME:GUI:WidgetScrolled.json", etk::Uri("THEME_GUI:///WidgetScrolled.json?lib=ewol"),
"shape for the vertical display", "shape for the vertical display",
&ewol::widget::WidgetScrolled::onChangePropertyShapeVert), &ewol::widget::WidgetScrolled::onChangePropertyShapeVert),
propertyShapeHori(this, "shape-hori", propertyShapeHori(this, "shape-hori",
"{ewol}THEME:GUI:WidgetScrolled.json", etk::Uri("THEME_GUI:///WidgetScrolled.json?lib=ewol"),
"shape for the horizonal display", "shape for the horizonal display",
&ewol::widget::WidgetScrolled::onChangePropertyShapeHori), &ewol::widget::WidgetScrolled::onChangePropertyShapeHori),
m_shaperH(), m_shaperH(),

View File

@ -23,8 +23,8 @@ namespace ewol {
*/ */
class WidgetScrolled : public ewol::Widget { class WidgetScrolled : public ewol::Widget {
public: // properties: public: // properties:
eproperty::Value<etk::String> propertyShapeVert; //!< Vertical shaper name eproperty::Value<etk::Uri> propertyShapeVert; //!< Vertical shaper name
eproperty::Value<etk::String> propertyShapeHori; //!< Horizontal shaper name eproperty::Value<etk::Uri> propertyShapeHori; //!< Horizontal shaper name
// TODO : All property // TODO : All property
public: public:
enum scrollingMode { enum scrollingMode {

View File

@ -18,8 +18,16 @@
ETK_DECLARE_TYPE(ewol::widget::Windows); ETK_DECLARE_TYPE(ewol::widget::Windows);
ewol::widget::Windows::Windows() : ewol::widget::Windows::Windows() :
propertyColorConfiguration(this, "file-color", "{ewol}THEME:COLOR:Windows.json", "color file link on the theme", &ewol::widget::Windows::onChangePropertyColor), propertyColorConfiguration(this,
propertyTitle(this, "title", "No title", "Title of the windows", &ewol::widget::Windows::onChangePropertyTitle), "file-color",
etk::Uri("THEME_COLOR:///Windows.json?lib=ewol"),
"File color of the Windows",
&ewol::widget::Windows::onChangePropertyColor),
propertyTitle(this,
"title",
"No title",
"Title of the windows",
&ewol::widget::Windows::onChangePropertyTitle),
m_resourceColor(null), m_resourceColor(null),
m_colorBg(-1) { m_colorBg(-1) {
addObjectType("ewol::widget::Windows"); addObjectType("ewol::widget::Windows");

View File

@ -21,7 +21,7 @@ namespace ewol {
*/ */
class Windows : public ewol::Widget { class Windows : public ewol::Widget {
public: public:
eproperty::Value<etk::String> propertyColorConfiguration; //!< Configuration file of the windows theme eproperty::Value<etk::Uri> propertyColorConfiguration; //!< Configuration file of the windows theme
eproperty::Value<etk::String> propertyTitle; //!< Current title of the windows eproperty::Value<etk::String> propertyTitle; //!< Current title of the windows
protected: protected:
ememory::SharedPtr<ewol::resource::ColorFile> m_resourceColor; //!< theme color property (name of file in @ref propertyColorConfiguration) ememory::SharedPtr<ewol::resource::ColorFile> m_resourceColor; //!< theme color property (name of file in @ref propertyColorConfiguration)

View File

@ -19,7 +19,7 @@
//#include <etk/Vector.hpp> //#include <etk/Vector.hpp>
#include <etk/Vector.hpp> #include <etk/Vector.hpp>
#include <etk/tool.hpp> #include <etk/tool.hpp>
#include <etk/os/FSNode.hpp> #include <etk/path/fileSystem.hpp>
extern "C" { extern "C" {
// file browsing ... // file browsing ...
@ -34,7 +34,7 @@ ewol::widget::FileChooser::FileChooser() :
signalCancel(this, "cancel", ""), signalCancel(this, "cancel", ""),
signalValidate(this, "validate", ""), signalValidate(this, "validate", ""),
propertyPath(this, "path", propertyPath(this, "path",
etk::getUserHomeFolder(), etk::path::getHomePath(),
"", "",
&ewol::widget::FileChooser::onChangePropertyPath), &ewol::widget::FileChooser::onChangePropertyPath),
propertyFile(this, "file", propertyFile(this, "file",
@ -59,7 +59,7 @@ ewol::widget::FileChooser::FileChooser() :
void ewol::widget::FileChooser::init() { void ewol::widget::FileChooser::init() {
ewol::widget::Composer::init(); ewol::widget::Composer::init();
// Load file with replacing the "{ID}" with the local ID of the widget ==> obtain unique ID // Load file with replacing the "{ID}" with the local ID of the widget ==> obtain unique ID
loadFromFile("{ewol}DATA:ewol-gui-file-chooser.xml", getId()); loadFromFile("DATA:///ewol-gui-file-chooser.xml?lib=ewol", getId());
// Basic replacement of labels // Basic replacement of labels
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:title-label", "value", propertyLabelTitle); propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:title-label", "value", propertyLabelTitle);
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:validate-label", "value", propertyLabelValidate); propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:validate-label", "value", propertyLabelValidate);
@ -72,7 +72,7 @@ void ewol::widget::FileChooser::init() {
subBind(ewol::widget::ListFileSystem, "[" + etk::toString(getId()) + "]file-shooser:list-files", signalFileSelect, sharedFromThis(), &ewol::widget::FileChooser::onCallbackListFileSelectChange); subBind(ewol::widget::ListFileSystem, "[" + etk::toString(getId()) + "]file-shooser:list-files", signalFileSelect, sharedFromThis(), &ewol::widget::FileChooser::onCallbackListFileSelectChange);
subBind(ewol::widget::ListFileSystem, "[" + etk::toString(getId()) + "]file-shooser:list-files", signalFileValidate, sharedFromThis(), &ewol::widget::FileChooser::onCallbackListFileValidate); subBind(ewol::widget::ListFileSystem, "[" + etk::toString(getId()) + "]file-shooser:list-files", signalFileValidate, sharedFromThis(), &ewol::widget::FileChooser::onCallbackListFileValidate);
subBind(ewol::widget::Entry, "[" + etk::toString(getId()) + "]file-shooser:entry-file", signalModify, sharedFromThis(), &ewol::widget::FileChooser::onCallbackEntryFileChangeValue); subBind(ewol::widget::Entry, "[" + etk::toString(getId()) + "]file-shooser:entry-file", signalModify, sharedFromThis(), &ewol::widget::FileChooser::onCallbackEntryFileChangeValue);
subBind(ewol::widget::Entry, "[" + etk::toString(getId()) + "]file-shooser:entry-file", signalEnter, sharedFromThis(), &ewol::widget::FileChooser::onCallbackListFileValidate); subBind(ewol::widget::Entry, "[" + etk::toString(getId()) + "]file-shooser:entry-file", signalEnter, sharedFromThis(), &ewol::widget::FileChooser::onCallbackEntryFileChangeValidate);
subBind(ewol::widget::Entry, "[" + etk::toString(getId()) + "]file-shooser:entry-folder", signalModify, sharedFromThis(), &ewol::widget::FileChooser::onCallbackEntryFolderChangeValue); subBind(ewol::widget::Entry, "[" + etk::toString(getId()) + "]file-shooser:entry-folder", signalModify, sharedFromThis(), &ewol::widget::FileChooser::onCallbackEntryFolderChangeValue);
//composerBind(ewol::widget::CheckBox, "[" + etk::toString(getId()) + "]file-shooser:entry-folder", signalEnter, sharedFromThis(), &ewol::widget::FileChooser::); //composerBind(ewol::widget::CheckBox, "[" + etk::toString(getId()) + "]file-shooser:entry-folder", signalEnter, sharedFromThis(), &ewol::widget::FileChooser::);
subBind(ewol::widget::Image, "[" + etk::toString(getId()) + "]file-shooser:img-home", signalPressed, sharedFromThis(), &ewol::widget::FileChooser::onCallbackHomePressed); subBind(ewol::widget::Image, "[" + etk::toString(getId()) + "]file-shooser:img-home", signalPressed, sharedFromThis(), &ewol::widget::FileChooser::onCallbackHomePressed);
@ -96,7 +96,7 @@ void ewol::widget::FileChooser::onChangePropertyPath() {
} }
void ewol::widget::FileChooser::onChangePropertyFile() { void ewol::widget::FileChooser::onChangePropertyFile() {
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:entry-file", "value", propertyFile); propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:entry-file", "value", propertyFile->getFileName());
//updateCurrentFolder(); //updateCurrentFolder();
} }
@ -118,10 +118,10 @@ void ewol::widget::FileChooser::onCallbackEntryFolderChangeValue(const etk::Stri
} }
void ewol::widget::FileChooser::onCallbackEntryFileChangeValue(const etk::String& _value) { void ewol::widget::FileChooser::onCallbackEntryFileChangeValue(const etk::String& _value) {
// == > change the file name // == > change the file name.get(.get(
propertyFile.setDirect(_value); propertyFile.setDirect(_value);
// update the selected file in the list : // update the selected file in the list :
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-files", "select", propertyFile); propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-files", "select", propertyFile.getString());
} }
void ewol::widget::FileChooser::onCallbackButtonCancelPressed() { void ewol::widget::FileChooser::onCallbackButtonCancelPressed() {
@ -140,17 +140,16 @@ void ewol::widget::FileChooser::onCallbackHidenFileChangeChangeValue(const bool&
} }
} }
void ewol::widget::FileChooser::onCallbackListFolderSelectChange(const etk::String& _value) { void ewol::widget::FileChooser::onCallbackListFolderSelectChange(const etk::Path& _value) {
// == > this is an internal event ... // == > this is an internal event ...
EWOL_DEBUG(" old PATH: '" << *propertyPath << "' + '" << _value << "'"); EWOL_DEBUG(" old PATH: '" << *propertyPath << "' ==> '" << _value << "'");
propertyPath.setDirect(propertyPath.get() + _value); propertyPath.setDirect(_value);
EWOL_DEBUG("new PATH: '" << *propertyPath << "'"); EWOL_DEBUG("new PATH: '" << *propertyPath << "'");
propertyPath.setDirect(etk::simplifyPath(*propertyPath));
propertyFile.setDirect(""); propertyFile.setDirect("");
updateCurrentFolder(); updateCurrentFolder();
} }
void ewol::widget::FileChooser::onCallbackListFileSelectChange(const etk::String& _value) { void ewol::widget::FileChooser::onCallbackListFileSelectChange(const etk::Path& _value) {
propertyFile.set(_value); propertyFile.set(_value);
/* /*
etk::String tmpFileCompleatName = m_folder; etk::String tmpFileCompleatName = m_folder;
@ -159,50 +158,40 @@ void ewol::widget::FileChooser::onCallbackListFileSelectChange(const etk::String
*/ */
} }
void ewol::widget::FileChooser::onCallbackListFileValidate(const etk::String& _value) { void ewol::widget::FileChooser::onCallbackListFileValidate(const etk::Path& _value) {
// select the file == > generate a validate // select the file == > generate a validate
propertyFile.set(_value); propertyFile.set(_value);
EWOL_VERBOSE(" generate a fiel opening : '" << propertyPath << "' / '" << propertyFile << "'"); EWOL_VERBOSE(" generate a fiel opening : '" << propertyFile << "'");
signalValidate.emit(getCompleateFileName()); signalValidate.emit(_value);
autoDestroy(); autoDestroy();
} }
void ewol::widget::FileChooser::onCallbackEntryFileChangeValidate(const etk::String& _value) {
onCallbackListFileValidate(_value);
}
void ewol::widget::FileChooser::onCallbackListValidate() { void ewol::widget::FileChooser::onCallbackListValidate() {
if (propertyFile.get() == "") { if (propertyFile.get() == "") {
EWOL_WARNING(" Validate : '" << propertyPath << "' / '" << propertyFile << "' ==> error No name ..."); EWOL_WARNING(" Validate : '" << *propertyFile << "' ==> error No name ...");
return; return;
} }
EWOL_DEBUG(" generate a file opening : '" << propertyPath << "' / '" << propertyFile << "'"); EWOL_DEBUG(" generate a file opening : '" << *propertyFile << "'");
signalValidate.emit(getCompleateFileName()); signalValidate.emit(*propertyFile);
autoDestroy(); autoDestroy();
} }
void ewol::widget::FileChooser::onCallbackHomePressed() { void ewol::widget::FileChooser::onCallbackHomePressed() {
etk::String tmpUserFolder = etk::getUserHomeFolder(); etk::Path tmpUserFolder = etk::path::getHomePath();
EWOL_DEBUG("new PATH : \"" << tmpUserFolder << "\""); EWOL_DEBUG("new PATH: '" << tmpUserFolder << "'");
propertyPath.setDirect(etk::simplifyPath(tmpUserFolder));
propertyPath.setDirect(tmpUserFolder);
propertyFile.setDirect(""); propertyFile.setDirect("");
updateCurrentFolder(); updateCurrentFolder();
} }
void ewol::widget::FileChooser::updateCurrentFolder() { void ewol::widget::FileChooser::updateCurrentFolder() {
if (*propertyPath != "") { propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-files", "path", propertyPath.getString());
if (propertyPath.get()[propertyPath->size()-1] != '/') { propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-folder", "path", propertyPath.getString());
propertyPath.getDirect() += "/"; propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:entry-folder", "value", propertyPath.getString());
}
}
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-files", "path", propertyPath);
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-folder", "path", propertyPath);
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:entry-folder", "value", propertyPath);
markToRedraw(); markToRedraw();
} }
etk::String ewol::widget::FileChooser::getCompleateFileName() {
etk::String tmpString = propertyPath;
tmpString += "/";
tmpString += propertyFile;
etk::FSNode node(tmpString);
return node.getName();
}

View File

@ -66,10 +66,10 @@ namespace ewol {
class FileChooser : public ewol::widget::Composer { class FileChooser : public ewol::widget::Composer {
public: // signals public: // signals
esignal::Signal<> signalCancel; //!< abort the display of the pop-up or press cancel button esignal::Signal<> signalCancel; //!< abort the display of the pop-up or press cancel button
esignal::Signal<etk::String> signalValidate; //!< select file(s) esignal::Signal<etk::Path> signalValidate; //!< select file(s)
public: // properties public: // properties
eproperty::Value<etk::String> propertyPath; //!< Current path to explore eproperty::Value<etk::Path> propertyPath; //!< Current path to explore
eproperty::Value<etk::String> propertyFile; //!< Selected file eproperty::Value<etk::Path> propertyFile; //!< Selected file
eproperty::Value<etk::String> propertyLabelTitle; //!< Label of the pop-up (can use translation) eproperty::Value<etk::String> propertyLabelTitle; //!< Label of the pop-up (can use translation)
eproperty::Value<etk::String> propertyLabelValidate; //!< Label of validate button of the pop-up (can use translation) eproperty::Value<etk::String> propertyLabelValidate; //!< Label of validate button of the pop-up (can use translation)
eproperty::Value<etk::String> propertyLabelCancel; //!< Label of cancel/close button of the pop-up (can use translation) eproperty::Value<etk::String> propertyLabelCancel; //!< Label of cancel/close button of the pop-up (can use translation)
@ -80,7 +80,6 @@ namespace ewol {
DECLARE_WIDGET_FACTORY(FileChooser, "FileChooser"); DECLARE_WIDGET_FACTORY(FileChooser, "FileChooser");
virtual ~FileChooser(); virtual ~FileChooser();
private: private:
etk::String getCompleateFileName();
void updateCurrentFolder(); void updateCurrentFolder();
public: public:
void onGetFocus() override; void onGetFocus() override;
@ -88,11 +87,12 @@ namespace ewol {
// callback functions: // callback functions:
void onCallbackEntryFolderChangeValue(const etk::String& _value); void onCallbackEntryFolderChangeValue(const etk::String& _value);
void onCallbackEntryFileChangeValue(const etk::String& _value); void onCallbackEntryFileChangeValue(const etk::String& _value);
void onCallbackEntryFileChangeValidate(const etk::String& _value);
void onCallbackButtonCancelPressed(); void onCallbackButtonCancelPressed();
void onCallbackHidenFileChangeChangeValue(const bool& _value); void onCallbackHidenFileChangeChangeValue(const bool& _value);
void onCallbackListFolderSelectChange(const etk::String& _value); void onCallbackListFolderSelectChange(const etk::Path& _value);
void onCallbackListFileSelectChange(const etk::String& _value); void onCallbackListFileSelectChange(const etk::Path& _value);
void onCallbackListFileValidate(const etk::String& _value); void onCallbackListFileValidate(const etk::Path& _value);
void onCallbackListValidate(); void onCallbackListValidate();
void onCallbackHomePressed(); void onCallbackHomePressed();
protected: protected:

View File

@ -74,7 +74,7 @@ void ewol::widget::Parameter::init() {
} else { } else {
tmpButton->setSubWidget(ewol::widget::composerGenerateString( tmpButton->setSubWidget(ewol::widget::composerGenerateString(
"<sizer mode='hori'>\n" "<sizer mode='hori'>\n"
" <image src='{ewol}THEME:GUI:Save.svg' expand='true' size='8,8mm'/>\n" " <image src='THEME_GUI:///Save.svg?lib=ewol' expand='true' size='8,8mm'/>\n"
" <label>_T{Save}</label>\n" " <label>_T{Save}</label>\n"
"</sizer>\n")); "</sizer>\n"));
tmpButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Parameter::onCallbackParameterSave); tmpButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Parameter::onCallbackParameterSave);
@ -96,7 +96,7 @@ void ewol::widget::Parameter::init() {
} else { } else {
tmpButton->setSubWidget(ewol::widget::composerGenerateString( tmpButton->setSubWidget(ewol::widget::composerGenerateString(
"<sizer mode='hori'>\n" "<sizer mode='hori'>\n"
" <image src='{ewol}THEME:GUI:Remove.svg' expand='true' size='8,8mm'/>\n" " <image src='THEME_GUI:///Remove.svg?lib=ewol' expand='true' size='8,8mm'/>\n"
" <label>_T{Close}</label>\n" " <label>_T{Close}</label>\n"
"</sizer>\n")); "</sizer>\n"));
tmpButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Parameter::onCallbackMenuclosed); tmpButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Parameter::onCallbackMenuclosed);

View File

@ -63,7 +63,7 @@ namespace ewol {
*/ */
class SpinBase : public ewol::widget::Sizer { class SpinBase : public ewol::widget::Sizer {
public: // properties list: public: // properties list:
eproperty::Value<etk::String> propertyShape; //!< Shape of the widget eproperty::Value<etk::Uri> propertyShape; //!< Shape of the widget
eproperty::List<enum ewol::widget::spinPosition> propertySpinMode; //!< How to display the spin base eproperty::List<enum ewol::widget::spinPosition> propertySpinMode; //!< How to display the spin base
public: public:
UN_DECLARE_FACTORY(SpinBase); UN_DECLARE_FACTORY(SpinBase);

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools
def get_type(): def get_type():

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools
def get_type(): def get_type():

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools
def get_type(): def get_type():

View File

@ -6,7 +6,6 @@
#include "BasicTree.hpp" #include "BasicTree.hpp"
#include <etk/tool.hpp> #include <etk/tool.hpp>
#include <etk/os/FSNode.hpp>
#include <test-debug/debug.hpp> #include <test-debug/debug.hpp>
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
@ -82,13 +81,13 @@ fluorine::Variant appl::widget::BasicTree::getData(int32_t _role, const ivec2& _
return value.m_isExpand; return value.m_isExpand;
case ewol::widget::ListRole::Icon: case ewol::widget::ListRole::Icon:
if (elem->countToRoot() == 0) { if (elem->countToRoot() == 0) {
return "{ewol}THEME:GUI:Home.svg"; return "THEME_GUI:///Home.svg?lib=ewol";
} }
if (elem->countToRoot() == 1) { if (elem->countToRoot() == 1) {
return "{ewol}THEME:GUI:Folder.svg"; return "THEME_GUI:///Folder.svg?lib=ewol";
} }
if (elem->countToRoot() == 2) { if (elem->countToRoot() == 2) {
return "{ewol}THEME:GUI:File.svg"; return "THEME_GUI:///File.svg?lib=ewol";
} }
return ""; return "";
case ewol::widget::ListRole::FgColor: case ewol::widget::ListRole::FgColor:

View File

@ -6,7 +6,6 @@
#pragma once #pragma once
#include <ewol/widget/TreeView.hpp> #include <ewol/widget/TreeView.hpp>
#include <etk/os/FSNode.hpp>
#include <ewol/resource/ColorFile.hpp> #include <ewol/resource/ColorFile.hpp>
#include <esignal/Signal.hpp> #include <esignal/Signal.hpp>
#include <etk/FlatTree.hpp> #include <etk/FlatTree.hpp>

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools
def get_type(): def get_type():

View File

@ -17,7 +17,7 @@ appl::WidgetDisplay::WidgetDisplay() {
void appl::WidgetDisplay::init() { void appl::WidgetDisplay::init() {
ewol::Widget::init(); ewol::Widget::init();
m_compositing.setSource("DATA:SnowFlake.svg", ivec2(128,128)); m_compositing.setSource("DATA:///SnowFlake.svg", ivec2(128,128));
getObjectManager().periodicCall.connect(sharedFromThis(), &appl::WidgetDisplay::periodicCall); getObjectManager().periodicCall.connect(sharedFromThis(), &appl::WidgetDisplay::periodicCall);
for (int32_t iii=0; iii<250 ; ++iii) { for (int32_t iii=0; iii<250 ; ++iii) {
m_elements.pushBack(appl::WidgetDisplay::Element()); m_elements.pushBack(appl::WidgetDisplay::Element());

View File

@ -1,5 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
import lutin.debug as debug import realog.debug as debug
import lutin.tools as tools import lutin.tools as tools

Some files were not shown because too many files have changed in this diff Show More