Compare commits

...

9 Commits

112 changed files with 664 additions and 713 deletions

View File

@ -7,13 +7,13 @@
<spacer expand="true,false"/>
<button name="[{ID}]file-shooser:button-validate">
<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>
</sizer>
</button>
<button name="[{ID}]file-shooser:button-cancel">
<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>
</sizer>
</button>
@ -37,13 +37,13 @@
<spacer min-size="2,2mm"/>
</sizer>
<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"/>
</sizer>
<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"/>
<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>
<label name="[{ID}]file-shooser:title-label">_T{Title}</label>
</sizer>

View File

@ -30,7 +30,7 @@ void main(void) {
// Smooth
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
/*
float mu = smoothstep(outline_center-width, outline_center+width, dist);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,6 +18,6 @@
padding-in-buttom:3,
change-time:200,
program:"{ewol}THEME:GUI:WidgetScrolled.prog",
color:"{ewol}THEME:COLOR:WidgetScrolled.json"
program:"THEME_GUI:///WidgetScrolled.prog?lib=ewol",
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.
Then we need to determine file in the tree with:
- **"DATA:XXX"** Application internal data
- **"DATA:///XXX"** Application internal data
* Linux: /usr/share/applName/
* Android: /xxx/yyy/applName.apk/asssets/
* 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.
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}
=============================
@ -61,7 +61,7 @@ In your ```lutin_xxx.py``` file add:
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}
@ -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) {
APPL_ERROR("Can not read the file (Does not exist)");
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.
```
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:
- USERDATA:GUI_COLOR:your/sub/path/file.xx

View File

@ -40,7 +40,7 @@ namespace appl {
//! @brief Constructor
MyObj(void) :
propertyConfig(this, "file",
"DATA:ExapleConfig.json",
"DATA:///ExapleConfig.json",
"no desc",
&appl::MyObj::onChangePropertyFile),
m_configValId(-1) {
@ -128,7 +128,7 @@ When loose hardware (juste update internal state the hardware is no more present
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}
void reload();
```

View File

@ -98,7 +98,7 @@ File ```gui.xml```
```{.cpp}
#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) {
APPL_CRITICAL("The widget can not be created");
}

View File

@ -46,7 +46,7 @@ ewol::compositing::Area::~Area() {
void ewol::compositing::Area::loadProgram() {
// get the shader resource :
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) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");

View File

@ -299,7 +299,7 @@ void ewol::compositing::Drawing::loadProgram() {
// remove previous loading ... in case
unLoadProgram();
// 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 :
if (m_GLprogram != null) {
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);
#define NB_VBO (3)
ewol::compositing::Image::Image(const etk::String& _imageName,
ewol::compositing::Image::Image(const etk::Uri& _imageName,
bool _df,
int32_t _size) :
m_filename(_imageName),
@ -58,9 +58,9 @@ void ewol::compositing::Image::loadProgram() {
m_GLPosition = 0;
m_GLprogram.reset();
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 {
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) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
@ -271,9 +271,9 @@ void ewol::compositing::Image::printPart(const vec2& _size,
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();
if ( m_filename == _newFile
if ( m_filename == _uri
&& m_requestSize == _size) {
// Nothing to do ...
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::ImageDF> resourceDF = m_resourceDF;
ememory::SharedPtr<ewol::resource::Texture> resourceTex = m_resourceImage;
m_filename = _newFile;
m_filename = _uri;
m_requestSize = _size;
m_resource.reset();
m_resourceDF.reset();
m_resourceImage.reset();
ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded...
if (_newFile != "") {
if (_uri.isEmpty() == false) {
// link to new one
if (m_distanceFieldMode == false) {
m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize);

View File

@ -17,7 +17,7 @@ namespace ewol {
public:
static const int32_t sizeAuto;
private:
etk::String m_filename;
etk::Uri m_filename;
ivec2 m_requestSize;
vec3 m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position
@ -50,11 +50,11 @@ namespace ewol {
public:
/**
* @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] _size for the image when Verctorial image loading is requested
*/
Image(const etk::String& _imageName="",
Image(const etk::Uri& _uri="",
bool _df=false,
int32_t _size=ewol::compositing::Image::sizeAuto);
/**
@ -156,13 +156,13 @@ namespace ewol {
vec2 _sourcePosStop);
/**
* @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
*/
void setSource(const etk::String& _newFile, int32_t _size=32) {
setSource(_newFile, vec2(_size,_size));
void setSource(const etk::Uri& _uri, int32_t _size=32) {
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);
/**
* @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)
*/
#include <etk/os/FSNode.hpp>
#include <etk/uri/uri.hpp>
#include <ewol/debug.hpp>
#include <ewol/compositing/Shaper.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);
#define NB_VBO (2)
ewol::compositing::Shaper::Shaper(const etk::String& _shaperName) :
m_name(_shaperName),
ewol::compositing::Shaper::Shaper(const etk::Uri& _uri) :
m_uri(_uri),
m_config(null),
m_confIdMode(-1),
m_confIdDisplayOutside(-1),
@ -83,11 +83,11 @@ void ewol::compositing::Shaper::unLoadProgram() {
}
void ewol::compositing::Shaper::loadProgram() {
if (m_name == "") {
if (m_uri.isEmpty() == true) {
EWOL_DEBUG("no Shaper set for loading resources ...");
return;
}
m_config = ewol::resource::ConfigFile::create(m_name);
m_config = ewol::resource::ConfigFile::create(m_uri.get());
if (m_config != null) {
m_confIdMode = m_config->request("mode");
m_confIdDisplayOutside = m_config->request("display-outside");
@ -113,8 +113,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::String tmpFilename(basicShaderFile);
if (tmpFilename.find(':') == etk::String::npos) {
// get the relative position of the current file ...
etk::FSNode file(m_name);
tmpFilename = file.getRelativeFolder() + basicShaderFile;
etk::Uri tmpUri = m_uri;
tmpUri.setPath(m_uri.getPath().getParent() / basicShaderFile);
tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'");
} else {
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "'");
@ -140,8 +141,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::String tmpFilename(basicImageFile);
if (tmpFilename.find(':') == etk::String::npos) {
// get the relative position of the current file ...
etk::FSNode file(m_name);
tmpFilename = file.getRelativeFolder() + basicImageFile;
etk::Uri tmpUri = m_uri;
tmpUri.setPath(m_uri.getPath().getParent() / basicImageFile);
tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "' with base : '" << basicImageFile << "'");
} else {
EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "'");
@ -155,8 +157,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::String tmpFilename(basicColorFile);
if (tmpFilename.find(':') == etk::String::npos) {
// get the relative position of the current file ...
etk::FSNode file(m_name);
tmpFilename = file.getRelativeFolder() + basicColorFile;
etk::Uri tmpUri = m_uri;
tmpUri.setPath(m_uri.getPath().getParent() / basicColorFile);
tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'");
} else {
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "'");
@ -626,15 +629,15 @@ ewol::Padding ewol::compositing::Shaper::getBorder() {
return padding;
}
void ewol::compositing::Shaper::setSource(const etk::String& _newFile) {
void ewol::compositing::Shaper::setSource(const etk::Uri& _uri) {
clear();
unLoadProgram();
m_name = _newFile;
m_uri = _uri;
loadProgram();
}
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 {
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) {
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
class Shaper : public ewol::Compositing {
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:
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
@ -92,9 +92,9 @@ namespace ewol {
public:
/**
* @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
*/
@ -164,15 +164,15 @@ namespace ewol {
ewol::Padding getBorder();
/**
* @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
* @return the shapper file name
*/
const etk::String& getSource() const {
return m_name;
const etk::Uri& getSource() const {
return m_uri;
};
/**
* @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
*****************************************************/
bool operator== (const Shaper& _obj) const {
return _obj.m_name == m_name;
return _obj.m_uri == m_uri;
}
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
*/
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
*/

View File

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

View File

@ -10,7 +10,7 @@
ETK_DECLARE_TYPE(ewol::context::ConfigFont);
ewol::context::ConfigFont::ConfigFont() :
m_folder("{ewol}DATA:fonts"),
m_folder("DATA:///fonts?lib=ewol"),
m_name("Arial;Helvetica"),
m_size(10),
m_useExternal(false) {
@ -28,16 +28,16 @@ ewol::context::ConfigFont::~ConfigFont() {
void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) {
m_name = _fontName;
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) {
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) {
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
#include <ewol/debug.hpp>
#include <etk/uri/uri.hpp>
namespace ewol {
namespace context {
@ -17,20 +18,20 @@ namespace ewol {
ConfigFont();
virtual ~ConfigFont();
private:
etk::String m_folder;
etk::Uri m_folder;
public:
/**
* @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)
*/
void setFolder(const etk::String& _folder) {
void setFolder(const etk::Uri& _folder) {
m_folder = _folder;
};
/**
* @brief get the default font folder.
* @return The default font folder.
*/
const etk::String& getFolder() {
const etk::Uri& getFolder() {
return m_folder;
};
private:

View File

@ -8,9 +8,9 @@
#include <etk/types.hpp>
#include <etk/etk.hpp>
#include <etk/tool.hpp>
#include <etk/os/FSNode.hpp>
#include <etk/theme/theme.hpp>
#include <ethread/tools.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;
}
@ -68,7 +68,7 @@ void ewol::Context::inputEventUnGrabPointer() {
void ewol::Context::onCreate(gale::Context& _context) {
EWOL_INFO(" == > Ewol system create (BEGIN)");
// Add basic ewol translation:
etranslate::addPath("ewol", "{ewol}DATA:translate/ewol/");
etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol");
etranslate::autoDetectLanguage();
// By default we set 2 themes (1 color and 1 shape ...) :
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
* @param[in] _fileName Name of the image to load
*/
void setInitImage(const etk::String& _fileName);
void setInitImage(const etk::Uri& _fileName);
public:
/**
* @brief Request a display after call a resize

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ void ewol::resource::Colored3DObject::init() {
gale::Resource::init();
// get the shader resource :
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) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getUniform("EW_color");

View File

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

View File

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

View File

@ -5,7 +5,7 @@
*/
#include <etk/types.hpp>
#include <etk/os/FSNode.hpp>
#include <etk/uri/uri.hpp>
#include <egami/egami.hpp>
#include <gale/resource/Manager.hpp>
@ -34,41 +34,59 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() :
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) {
ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_fontName);
etk::String localName = _fontName;
etk::Vector<etk::String> folderList;
if (true == ewol::getContext().getFontDefault().getUseExternal()) {
etk::Vector<etk::Uri> folderList;
if (ewol::getContext().getFontDefault().getUseExternal() == true) {
#if defined(__TARGET_OS__Android)
folderList.pushBack("ROOT:system/fonts");
folderList.pushBack(etk::Path("/system/fonts"));
#elif defined(__TARGET_OS__Linux)
folderList.pushBack("ROOT:usr/share/fonts/truetype");
folderList.pushBack(etk::Path("/usr/share/fonts"));
#endif
}
etk::String applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
etk::Vector<etk::String> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont);
for (auto &it : applicationBaseFontList) {
etk::Uri applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
for (auto &it : explodeMultiplePath(applicationBaseFont)) {
folderList.pushBack(it);
}
for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]);
// find the real Font name :
etk::Vector<etk::String> output;
myFolder.folderGetRecursiveFiles(output);
etk::Vector<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]);
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);
bool hasFindAFont = false;
for (size_t jjj=0; jjj<split.size(); jjj++) {
EWOL_INFO(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) {
etk::String nameFolder = output[iii].getPath().getString();
//EWOL_DEBUG(" file : " << output[iii]);
if( true == etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+"r"+".ttf", false)
|| true == etk::end_with(output[iii], split[jjj]+".ttf", false)) {
if( true == etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+"-"+"r"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+".ttf", false)) {
EWOL_INFO(" find Font [Regular] : " << output[iii]);
m_fileName = output[iii];
hasFindAFont=true;
@ -90,8 +108,8 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
}
}
if (m_fileName.size() == 0) {
EWOL_ERROR("can not load FONT name : '" << m_fileName << "'" );
if (m_fileName.isEmpty() == true) {
EWOL_ERROR("can not load FONT name : '" << _fontName << "'" );
m_font = null;
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));
// 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
m_data.clear(etk::Color<>(0x00000000));
// add error glyph
addGlyph(0);
// 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);
}
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() {
@ -140,15 +162,25 @@ float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
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);
int32_t size = _input.getSize().x() * _input.getSize().y();
etk::Vector<short> xdist(size);
etk::Vector<short> ydist(size);
etk::Vector<double> gx(size);
etk::Vector<double> gy(size);
etk::Vector<double> data(size);
etk::Vector<double> outside(size);
etk::Vector<double> inside(size);
etk::Vector<short> xdist;
etk::Vector<short> ydist;
etk::Vector<double> gx;
etk::Vector<double> gy;
etk::Vector<double> data;
etk::Vector<double> outside;
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)
double img_min = 255, img_max = -255;
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;
}
}
// Compute outside = edtaa3(bitmap); % Transform background (0's)
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]);
@ -180,7 +211,6 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
outside[iii] = 0.0;
}
}
// Compute inside = edtaa3(1-bitmap); % Transform foreground (1's)
for(size_t iii = 0; iii < gx.size(); ++iii) {
gx[iii] = 0;
@ -198,7 +228,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
inside[iii] = 0.0;
}
}
EWOL_INFO(" _output=" << _output);
_output.resize(_input.getSize(), etk::Color<>(0));
_output.clear(etk::Color<>(0));
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));
}
}
EWOL_INFO(" _output=" << _output);
}
bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
@ -229,11 +260,11 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
GlyphProperty tmpchar;
tmpchar.m_UVal = _val;
egami::ImageMono imageGlyphRaw;
egami::Image imageGlyphDistanceField;
egami::Image imageGlyphDistanceField(ivec2(32,32), egami::colorType::RGBA8);
EWOL_DEBUG("Generate Glyph : " << _val);
if (m_font->getGlyphProperty(SIZE_GENERATION, tmpchar) == true) {
//EWOL_DEBUG("load char : '" << _val << "'=" << _val.get());
//EWOL_DEBUG("load char: '" << _val << "'=" << _val);
hasChange = true;
// change line if needed ...
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()) {
ivec2 size = m_data.getSize();
size.setY(size.y()*2);
EWOL_VERBOSE("resize " << m_data.getSize() << " => " << size);
m_data.resize(size, etk::Color<>(0));
// change the coordonate on the element in the texture
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);
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 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);
// set image position
@ -295,7 +328,9 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
}
if (hasChange == true) {
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;
}
@ -329,7 +364,7 @@ int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const char32_t& _charcode) {
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);
if( index < 0
|| (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_borderSize", ejson::Number(m_borderSize));
doc.add("m_textureBorderSize", ejson::String(m_textureBorderSize));
doc.store(m_fileName + ".json");
egami::store(m_data, m_fileName + ".bmp");
egami::store(m_data, m_fileName + ".png");
etk::Uri tmpUri = m_fileName;
tmpUri.setScheme("CACHE");
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() {
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:
etk::FSNode fileJSON(m_fileName + ".json");
etk::FSNode fileBMP(m_fileName + ".bmp");
if ( fileJSON.exist() == false
|| fileBMP.exist() == false) {
if ( etk::uri::exist(tmpUriJson) == false
|| etk::uri::exist(tmpUriBmp) == false) {
EWOL_DEBUG("Does not import file for distance field system");
return false;
}
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_lastGlyphPos = doc["m_lastGlyphPos"].toString().get("0,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);
m_listElement.pushBack(prop);
}
m_data = egami::load(m_fileName + ".bmp");
return m_data.exist();
}

View File

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

View File

@ -6,7 +6,6 @@
#include <etk/types.hpp>
#include <etk/Vector.hpp>
#include <etk/os/FSNode.hpp>
#include <gale/renderer/openGL/openGL.hpp>
@ -56,42 +55,30 @@ ewol::resource::FontFreeType::FontFreeType() {
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);
ewol::resource::FontBase::init(_fontName);
etk::FSNode myfile(_fontName);
if (myfile.exist() == false) {
EWOL_ERROR("File Does not exist : " << myfile);
ewol::resource::FontBase::init(_uri);
auto fileIO = etk::uri::get(_uri);
if (fileIO == null) {
EWOL_ERROR("File Does not exist : " << _uri);
return;
}
m_FileSize = myfile.fileSize();
if (m_FileSize == 0) {
EWOL_ERROR("This file is empty : " << myfile);
if (fileIO->open(etk::io::OpenMode::Read) == false) {
EWOL_ERROR("Can not open the file : " << _uri);
return;
}
if (myfile.fileOpenRead() == false) {
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);
m_FileBuffer = fileIO->readAll<FT_Byte>();
// close the file:
myfile.fileClose();
fileIO->close();
// 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) {
EWOL_ERROR("... the font file could be opened and read, but it appears ... that its font format is unsupported");
} 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...");
} else {
// 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;
//display();
}
@ -171,7 +158,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
ewol::GlyphProperty& _property,
int8_t _posInImage) {
ethread::RecursiveLock lock(m_mutex);
if(false == m_init) {
if(m_init == false) {
return false;
}
// 300dpi (hight quality) 96 dpi (normal quality)

View File

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

View File

@ -25,13 +25,13 @@ void ewol::resource::ImageDF::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);
ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size);
m_data = egami::load(_tmpfileName, _size);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size);
m_data = egami::load(_uri, _size);
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();
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) {
ethread::RecursiveLock lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y();
etk::Vector<short> xdist(size);
etk::Vector<short> ydist(size);
etk::Vector<double> gx(size);
etk::Vector<double> gy(size);
etk::Vector<double> data(size);
etk::Vector<double> outside(size);
etk::Vector<double> inside(size);
etk::Vector<short> xdist;
etk::Vector<short> ydist;
etk::Vector<double> gx;
etk::Vector<double> gy;
etk::Vector<double> data;
etk::Vector<double> outside;
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)
double img_min = 255, img_max = -255;
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) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size);
if (_filename == "") {
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, ivec2 _size) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size);
if (_uri.isEmpty() == true) {
ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF));
if (object == null) {
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);
//EWOL_ERROR("Error Request the image size.y() =0 ???");
}
etk::String TmpFilename = _filename;
if (etk::end_with(_filename, ".svg") == false) {
etk::Uri tmpFilename = _uri;
if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
_size = ivec2(-1,-1);
}
#ifdef __TARGET_OS__MacOs
@ -187,33 +194,31 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
#ifdef __TARGET_OS__Android
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif
TmpFilename += ":";
TmpFilename += etk::toString(_size.x());
TmpFilename += "x";
TmpFilename += etk::toString(_size.y());
tmpFilename.getQuery().set("x", etk::toString(_size.x()));
tmpFilename.getQuery().set("y", 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<gale::Resource> object2 = getManager().localKeep("DF__" + TmpFilename);
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + tmpFilename.getString());
if (object2 != null) {
object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2);
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;
}
}
if (object != null) {
return object;
}
EWOL_INFO("CREATE: ImageDF: '" << TmpFilename << "' size=" << _size);
EWOL_INFO("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size);
// need to crate a new one ...
object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF));
if (object == null) {
EWOL_ERROR("allocation error of a resource : " << _filename);
EWOL_ERROR("allocation error of a resource : " << _uri);
return null;
}
object->init("DF__" + TmpFilename, _filename, _size);
object->init("DF__" + tmpFilename.getString(), _uri, _size);
getManager().localAdd(object);
return object;
}

View File

@ -18,7 +18,7 @@ namespace ewol {
protected:
ImageDF();
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:
virtual ~ImageDF() { };
protected:
@ -40,7 +40,7 @@ namespace ewol {
* @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.
*/
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_lastTypeObject = typeObject;
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 {
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 :
// TODO : check error ???
@ -300,13 +300,13 @@ void ewol::resource::Texture::setImageSize(ivec2 _newSize) {
}
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);
if (_image.exist() == false) {
EWOL_ERROR("ERROR when loading the image : [raw data]");
return;
}
EWOL_WARNING(" size=" << _image.getSize());
EWOL_DEBUG(" size=" << _image.getSize());
etk::swap(m_data, _image);
ivec2 tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y());

View File

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

View File

@ -22,7 +22,7 @@ namespace ewol {
protected:
TextureFile();
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:
virtual ~TextureFile() { };
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 )
* @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 _sizeRegister=ewol::resource::TextureFile::sizeAuto);
};

View File

@ -5,7 +5,6 @@
*/
#include <etk/types.hpp>
#include <etk/os/FSNode.hpp>
#include <egami/egami.hpp>
#include <gale/resource/Manager.hpp>
@ -44,6 +43,26 @@ ewol::resource::TexturedFont::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) {
ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_fontName);
@ -76,98 +95,96 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
if (tmpPos == null) {
m_size = 1;
EWOL_CRITICAL("Can not parse the font name : '" << _fontName << "' ??? ':' " );
EWOL_CRITICAL("Can not parse the font name: '" << _fontName << "' ??? ':' " );
return;
} else {
if (sscanf(tmpPos+1, "%d", &tmpSize)!=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;
}
}
etk::String localName(_fontName, 0, (tmpPos - tmpData));
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;
}
m_size = tmpSize;
etk::Vector<etk::String> folderList;
etk::Vector<etk::Uri> folderList;
if (ewol::getContext().getFontDefault().getUseExternal() == true) {
#if defined(__TARGET_OS__Android)
folderList.pushBack("ROOT:system/fonts");
folderList.pushBack(etk::Path("/system/fonts"));
#elif defined(__TARGET_OS__Linux)
folderList.pushBack("ROOT:usr/share/fonts");
folderList.pushBack(etk::Path("/usr/share/fonts"));
#endif
}
etk::String applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
etk::Vector<etk::String> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont);
for (auto &it : applicationBaseFontList) {
etk::Uri applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
for (auto &it : explodeMultiplePath(applicationBaseFont)) {
folderList.pushBack(it);
}
for (size_t folderID=0; folderID<folderList.size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]);
// find the real Font name :
etk::Vector<etk::String> output;
myFolder.folderGetRecursiveFiles(output);
for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
etk::Vector<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]);
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);
bool hasFindAFont = false;
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++) {
etk::String nameFolder = output[iii].getPath().getString();
//EWOL_DEBUG(" file : " << output[iii]);
if( etk::end_with(output[iii], split[jjj]+"-"+"bold"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"b"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"bd"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bold"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bd"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"b"+".ttf", false) == true) {
EWOL_INFO(" find Font [Bold] : " << output[iii]);
if( etk::end_with(nameFolder, split[jjj]+"-"+"bold"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"b"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"bd"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bold"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bd"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"b"+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Bold] : " << output[iii]);
m_fileName[ewol::font::Bold] = output[iii];
hasFindAFont = true;
} else if( etk::end_with(output[iii], split[jjj]+"-"+"oblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"italic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"Light"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"i"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"oblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"italic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"light"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"i"+".ttf", false) == true) {
EWOL_INFO(" find Font [Italic] : " << output[iii]);
} else if( etk::end_with(nameFolder, split[jjj]+"-"+"oblique"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"italic"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"Light"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"i"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"oblique"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"italic"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"light"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"i"+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Italic] : " << output[iii]);
m_fileName[ewol::font::Italic] = output[iii];
hasFindAFont = true;
} else if( etk::end_with(output[iii], split[jjj]+"-"+"bolditalic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"boldoblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"bi"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"z"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bolditalic"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"boldoblique"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"bi"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"z"+".ttf", false) == true) {
EWOL_INFO(" find Font [Bold-Italic] : " << output[iii]);
} else if( etk::end_with(nameFolder, split[jjj]+"-"+"bolditalic"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"boldoblique"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"bi"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"z"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bolditalic"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"boldoblique"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bi"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"z"+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Bold-Italic] : " << output[iii]);
m_fileName[ewol::font::BoldItalic] = output[iii];
hasFindAFont = true;
} else if( etk::end_with(output[iii], split[jjj]+"-"+"regular"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"-"+"r"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"regular"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+"r"+".ttf", false) == true
|| etk::end_with(output[iii], split[jjj]+".ttf", false) == true) {
EWOL_INFO(" find Font [Regular] : " << output[iii]);
} else if( etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"r"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Regular] : " << output[iii]);
m_fileName[ewol::font::Regular] = output[iii];
hasFindAFont = true;
}
}
if (hasFindAFont == true) {
EWOL_INFO(" find this font : '" << split[jjj] << "'");
EWOL_DEBUG(" find this font : '" << split[jjj] << "'");
break;
} 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) {
EWOL_INFO(" find this font : '" << folderList[folderID] << "'");
EWOL_DEBUG(" find this font : '" << folderList[folderID] << "'");
break;
} else if (folderID == folderList.size()-1) {
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 :
enum ewol::font::mode refMode = ewol::font::Regular;
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;
}
}
EWOL_DEBUG(" set reference mode : " << refMode);
// generate the wrapping on the preventing error
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;
} else {
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++) {
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 );
m_font[iiiFontId] = null;
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]);
if (m_font[iiiFontId] == null) {
EWOL_DEBUG("error in loading FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size );

View File

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

View File

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

View File

@ -24,7 +24,7 @@ ewol::widget::Button::Button() :
signalEnter(this, "enter", "The cursor enter inside the button"),
signalLeave(this, "leave", "the cursor leave the button"),
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),
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),
@ -129,10 +129,10 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
markToRedraw();
}
if(_event.getStatus() == gale::key::status::pressSingle) {
if( ( *propertyValue == true
&& *propertyLock == ewol::widget::Button::lockWhenPressed)
|| ( *propertyValue == false
&& *propertyLock == ewol::widget::Button::lockWhenReleased) ) {
if ( ( *propertyValue == true
&& *propertyLock == ewol::widget::Button::lockWhenPressed)
|| ( *propertyValue == false
&& *propertyLock == ewol::widget::Button::lockWhenReleased) ) {
// nothing to do : Lock mode ...
// user might set himself the new correct value with @ref setValue(xxx)
} else {

View File

@ -41,7 +41,7 @@ namespace ewol {
esignal::Signal<> signalLeave;
esignal::Signal<bool> signalValue;
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::List<enum buttonLock> propertyLock; //!< Current lock state of the button.
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() :
signalChange(this, "change", "Button color change value"),
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) {
addObjectType("ewol::widget::ButtonColor");
changeStatusIn(STATUS_UP);

View File

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

View File

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

View File

@ -27,7 +27,7 @@ namespace ewol {
esignal::Signal<bool> signalValue;
public: // propertie list
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:
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
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/widget/Composer.hpp>
#include <etk/os/FSNode.hpp>
#include <etk/uri/uri.hpp>
#include <ewol/widget/Manager.hpp>
#include <ewol/context/Context.hpp>
#include <etk/typeInfo.hpp>
@ -20,8 +20,12 @@ ewol::widget::Composer::Composer() :
// nothing to do ...
}
ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::String& _fileName, uint64_t _id) {
etk::String tmpData = etk::FSNodeReadAllData(_fileName);
ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::Uri& _uri, uint64_t _id) {
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);
}
@ -74,8 +78,12 @@ ewol::widget::Composer::~Composer() {
}
bool ewol::widget::Composer::loadFromFile(const etk::String& _fileName, uint64_t _id) {
etk::String tmpData = etk::FSNodeReadAllData(_fileName);
bool ewol::widget::Composer::loadFromFile(const etk::Uri& _uri, uint64_t _id) {
etk::String tmpData;
if (etk::uri::readAll(_uri, tmpData) == false) {
EWOL_ERROR("Can not read the file: " << _uri);
return false;
}
return loadFromString(tmpData, _id);
}

View File

@ -8,6 +8,7 @@
#include <etk/types.hpp>
#include <ewol/debug.hpp>
#include <ewol/widget/Container.hpp>
#include <etk/uri/uri.hpp>
namespace ewol {
namespace widget {
@ -21,7 +22,7 @@ namespace ewol {
class Composer : public ewol::widget::Container {
public:
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:
/**
* @brief Constructor
@ -35,12 +36,12 @@ namespace ewol {
virtual ~Composer();
/**
* @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)
* @return true == > all done OK
* @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
* @param[in] _composerXmlString xml to parse directly
@ -57,6 +58,6 @@ namespace ewol {
virtual void onChangePropertySubFile();
};
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():
propertyShape(this, "shape",
"{ewol}THEME:GUI:ContextMenu.json",
etk::Uri("THEME_GUI:///ContextMenu.json?lib=ewol"),
"the display name for config file",
&ewol::widget::ContextMenu::onChangePropertyShape),
propertyArrowPos(this, "arrow-position",

View File

@ -31,7 +31,7 @@ namespace ewol {
markNone
};
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::List<enum markPosition> propertyArrawBorder;
protected:

View File

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

View File

@ -38,7 +38,7 @@ namespace ewol {
esignal::Signal<etk::String> signalModify; //!< data change
public: // propertie list
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::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list
eproperty::Value<etk::String> propertyRegex; //!< regular expression value

View File

@ -28,7 +28,7 @@ ewol::widget::Image::Image() :
m_colorId(-1) {
addObjectType("ewol::widget::Image");
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) {
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) {
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
void ewol::widget::Image::set(const etk::Uri& _uri, const gale::Dimension& _border) {
EWOL_VERBOSE("Set Image : " << _uri << " border=" << _border);
propertyBorder.set(_border);
propertySource.set(_file);
propertySource.set(_uri);
}
void ewol::widget::Image::setCustumSource(const egami::Image& _image) {

View File

@ -25,7 +25,7 @@ namespace ewol {
public: // signals
esignal::Signal<> signalPressed;
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> propertyImageSize; //!< border to add at the image.
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::Value<bool> propertyDistanceFieldMode; //!< to have a parameter
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:
ewol::compositing::Image m_compositing; //!< compositing element of the image.
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property
@ -52,10 +52,10 @@ namespace ewol {
virtual ~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
*/
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
* @param[in] _image Image to set in the display

View File

@ -23,12 +23,16 @@ ewol::widget::Label::Label() :
"",
"displayed value string",
&ewol::widget::Label::onChangePropertyValue),
propertyFontSize(this, "font-size",
0,
"default font size (0=> system default)",
&ewol::widget::Label::onChangePropertyFontSize),
m_value(U""),
m_colorProperty(null),
m_colorDefaultFgText(-1),
m_colorDefaultBgText(-1){
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) {
m_colorDefaultFgText = m_colorProperty->request("foreground");
m_colorDefaultBgText = m_colorProperty->request("background");
@ -115,6 +119,9 @@ void ewol::widget::Label::onRegenerateDisplay() {
// clean the element
m_text.reset();
if (propertyFontSize.get() != 0) {
m_text.setFontSize(propertyFontSize.get());
}
if (m_colorProperty != null) {
m_text.setDefaultColorFg(m_colorProperty->get(m_colorDefaultFgText));
m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText));
@ -159,6 +166,10 @@ void ewol::widget::Label::onChangePropertyValue() {
requestUpdateSize();
}
void ewol::widget::Label::onChangePropertyFontSize() {
onChangePropertyValue();
}
void ewol::widget::Label::onChangePropertyAutoTranslate() {
onChangePropertyValue();
}

View File

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

View File

@ -29,16 +29,31 @@ ewol::widget::List::List() {
void ewol::widget::List::init() {
ewol::widget::WidgetScrolled::init();
addComposeElemnent("drawing", ememory::makeShared<ewol::compositing::Drawing>());
addComposeElemnent("text", ememory::makeShared<ewol::compositing::Text>());
}
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]);
m_listOObject[iii] = null;
}
void ewol::widget::List::addComposeElemnent(const etk::String& _name, const ememory::SharedPtr<ewol::Compositing>& _element) {
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) {
@ -79,27 +94,6 @@ void ewol::widget::List::calculateMinMaxSize() {
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() {
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
if (m_listOObject[iii] != null) {
@ -112,7 +106,7 @@ void ewol::widget::List::onDraw() {
void ewol::widget::List::onRegenerateDisplay() {
if (needRedraw() == true) {
// clean the object list ...
clearOObjectList();
clearComposeElemnent();
// -------------------------------------------------------
// -- Calculate the size of each element
// -------------------------------------------------------
@ -232,9 +226,9 @@ ivec2 ewol::widget::List::getMatrixSize() const {
}
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();
vec3 textSize = tmpText.calculateSize(myTextToWrite);
vec3 textSize = tmpText->calculateSize(myTextToWrite);
ivec2 count = getMatrixSize();
return vec2(textSize.x(),
textSize.y() + m_paddingSizeY*3
@ -242,9 +236,8 @@ vec2 ewol::widget::List::calculateElementSize(const ivec2& _pos) {
}
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) {
addOObject(BGOObjects);
etk::Color<> basicBG = getBasicBG();
BGOObjects->setColor(basicBG);
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);
if (backgroundVariant.isColor() == true) {
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) {
addOObject(BGOObjects);
BGOObjects->setColor(bg);
BGOObjects->setPos(vec3(_start.x(), _start.y(), 0) );
BGOObjects->rectangleWidth(_size);
}
}
if (myTextToWrite != "") {
ewol::compositing::Text * tmpText = ETK_NEW(ewol::compositing::Text);
auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
if (tmpText != null) {
addOObject(tmpText);
int32_t displayPositionY = _start.y() + m_paddingSizeY;
tmpText->setColor(fg);
tmpText->setPos(vec3(_start.x() + m_paddingSizeX, displayPositionY, 0) );

View File

@ -45,11 +45,16 @@ namespace ewol {
void calculateMinMaxSize() override;
// drawing capabilities ....
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_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:
void addOObject(ewol::Compositing* _newObject, int32_t _pos=-1);
void clearOObjectList();
// list properties ...
protected:

View File

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

View File

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

View File

@ -301,7 +301,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
etk::String widgetName = pNode.getValue();
EWOL_INFO("Get node : " << pNode);
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"]);
for (const auto nodeIt2 : pNode.nodes) {
@ -312,7 +312,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
}
etk::String widgetName2 = pNode2.getValue();
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"]);
} else if (widgetName2 == "separator") {
addSpacer(idMenu);

View File

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

View File

@ -23,7 +23,7 @@ namespace ewol {
*/
class PopUp : public ewol::widget::Container {
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<bool> propertyCloseOutEvent; //!< ratio progression of a sliding
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",
&ewol::widget::Scroll::onChangePropertyLimit),
propertyShapeVert(this, "shape-vert",
"{ewol}THEME:GUI:WidgetScrolled.json",
etk::Uri("THEME_GUI:///WidgetScrolled.json?lib=ewol"),
"shape for the vertical display",
&ewol::widget::Scroll::onChangePropertyShapeVert),
propertyShapeHori(this, "shape-hori",
"{ewol}THEME:GUI:WidgetScrolled.json",
etk::Uri("THEME_GUI:///WidgetScrolled.json?lib=ewol"),
"shape for the horizonal display",
&ewol::widget::Scroll::onChangePropertyShapeHori),
propertyHover(this, "hover",

View File

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

View File

@ -28,7 +28,7 @@ ewol::widget::Select::Select() :
&ewol::widget::Select::onChangePropertyValue) {
addObjectType("ewol::widget::Select");
// 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.changeDefault(ewol::widget::spinPosition_noneRight);
propertySpinMode.rename("none-none", "none");

View File

@ -38,7 +38,7 @@ ewol::widget::Spin::Spin() :
"fix-point mantis",
&ewol::widget::Spin::onChangePropertyMantis) {
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() {

View File

@ -17,7 +17,7 @@ ETK_DECLARE_TYPE(ewol::widget::TreeView);
ewol::widget::TreeView::TreeView():
ewol::widget::List(),
propertyOffsetTreeView(this, "offsetTreeView",
30,
15,
"Offset indentation for each node",
&ewol::widget::TreeView::onChangePropertyOffsetTreeView),
propertyIconTreeViewSize(this, "iconTreeViewSize",
@ -34,6 +34,8 @@ ewol::widget::TreeView::TreeView():
void ewol::widget::TreeView::init() {
ewol::widget::List::init();
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() {
@ -41,7 +43,7 @@ ewol::widget::TreeView::~TreeView() {
}
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();
float_t treeOffset = 0;
if (_pos.x() == 0) {
@ -65,9 +67,9 @@ vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) {
}
vec3 textSize;
if (propertyTextIsDecorated.get() == true) {
textSize = tmpText.calculateSizeDecorated(myTextToWrite);
textSize = tmpText->calculateSizeDecorated(myTextToWrite);
} else {
textSize = tmpText.calculateSize(myTextToWrite);
textSize = tmpText->calculateSize(myTextToWrite);
}
ivec2 count = getMatrixSize();
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();
bool haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean();
if (haveChild == true) {
ewol::compositing::Image * tmpImage = null;
ememory::SharedPtr<ewol::compositing::Image> tmpImage = null;
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 {
tmpImage = ETK_NEW(ewol::compositing::Image, "{ewol}THEME:GUI:ChevronMore.svg");
tmpImage = ememory::staticPointerCast<ewol::compositing::Image>(getComposeElemnent("image_ChevronMore"));
}
if (tmpImage != null) {
addOObject(tmpImage);
tmpImage->setColor(fg);
tmpImage->setPos(posStart);
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);
if (backgroundVariant.isColor() == true) {
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) {
addOObject(BGOObjects);
BGOObjects->setColor(bg);
BGOObjects->setPos(_start);
BGOObjects->rectangleWidth(_size);
@ -118,20 +118,20 @@ void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start,
}
posStart += vec2(m_paddingSizeX, m_paddingSizeY);
if (iconName != "") {
ewol::compositing::Image * tmpImage = ETK_NEW(ewol::compositing::Image, iconName);
auto tmpImage = ememory::staticPointerCast<ewol::compositing::Image>(getComposeElemnent(iconName));
if (tmpImage != null) {
addOObject(tmpImage);
tmpImage->setColor(fg);
tmpImage->setPos(posStart);
tmpImage->print(vec2(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get()));
} else {
EWOL_ERROR("can not get : " << iconName );
}
// move right
posStart.setX(posStart.x() + propertyIconTreeViewSize.get());
}
if (myTextToWrite != "") {
ewol::compositing::Text * tmpText = ETK_NEW(ewol::compositing::Text);
auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
if (tmpText != null) {
addOObject(tmpText);
tmpText->setColor(fg);
tmpText->setPos(posStart);
if (propertyTextIsDecorated.get() == true) {

View File

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

View File

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

View File

@ -18,8 +18,16 @@
ETK_DECLARE_TYPE(ewol::widget::Windows);
ewol::widget::Windows::Windows() :
propertyColorConfiguration(this, "file-color", "{ewol}THEME:COLOR:Windows.json", "color file link on the theme", &ewol::widget::Windows::onChangePropertyColor),
propertyTitle(this, "title", "No title", "Title of the windows", &ewol::widget::Windows::onChangePropertyTitle),
propertyColorConfiguration(this,
"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_colorBg(-1) {
addObjectType("ewol::widget::Windows");

View File

@ -21,7 +21,7 @@ namespace ewol {
*/
class Windows : public ewol::Widget {
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
protected:
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/tool.hpp>
#include <etk/os/FSNode.hpp>
#include <etk/path/fileSystem.hpp>
extern "C" {
// file browsing ...
@ -34,7 +34,7 @@ ewol::widget::FileChooser::FileChooser() :
signalCancel(this, "cancel", ""),
signalValidate(this, "validate", ""),
propertyPath(this, "path",
etk::getUserHomeFolder(),
etk::path::getHomePath(),
"",
&ewol::widget::FileChooser::onChangePropertyPath),
propertyFile(this, "file",
@ -59,7 +59,7 @@ ewol::widget::FileChooser::FileChooser() :
void ewol::widget::FileChooser::init() {
ewol::widget::Composer::init();
// 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
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:title-label", "value", propertyLabelTitle);
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", 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", 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);
//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);
@ -96,7 +96,7 @@ void ewol::widget::FileChooser::onChangePropertyPath() {
}
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();
}
@ -118,10 +118,10 @@ void ewol::widget::FileChooser::onCallbackEntryFolderChangeValue(const etk::Stri
}
void ewol::widget::FileChooser::onCallbackEntryFileChangeValue(const etk::String& _value) {
// == > change the file name
// == > change the file name.get(.get(
propertyFile.setDirect(_value);
// 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() {
@ -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 ...
EWOL_DEBUG(" old PATH: '" << *propertyPath << "' + '" << _value << "'");
propertyPath.setDirect(propertyPath.get() + _value);
EWOL_DEBUG(" old PATH: '" << *propertyPath << "' ==> '" << _value << "'");
propertyPath.setDirect(_value);
EWOL_DEBUG("new PATH: '" << *propertyPath << "'");
propertyPath.setDirect(etk::simplifyPath(*propertyPath));
propertyFile.setDirect("");
updateCurrentFolder();
}
void ewol::widget::FileChooser::onCallbackListFileSelectChange(const etk::String& _value) {
void ewol::widget::FileChooser::onCallbackListFileSelectChange(const etk::Path& _value) {
propertyFile.set(_value);
/*
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
propertyFile.set(_value);
EWOL_VERBOSE(" generate a fiel opening : '" << propertyPath << "' / '" << propertyFile << "'");
signalValidate.emit(getCompleateFileName());
EWOL_VERBOSE(" generate a fiel opening : '" << propertyFile << "'");
signalValidate.emit(_value);
autoDestroy();
}
void ewol::widget::FileChooser::onCallbackEntryFileChangeValidate(const etk::String& _value) {
onCallbackListFileValidate(_value);
}
void ewol::widget::FileChooser::onCallbackListValidate() {
if (propertyFile.get() == "") {
EWOL_WARNING(" Validate : '" << propertyPath << "' / '" << propertyFile << "' ==> error No name ...");
EWOL_WARNING(" Validate : '" << *propertyFile << "' ==> error No name ...");
return;
}
EWOL_DEBUG(" generate a file opening : '" << propertyPath << "' / '" << propertyFile << "'");
signalValidate.emit(getCompleateFileName());
EWOL_DEBUG(" generate a file opening : '" << *propertyFile << "'");
signalValidate.emit(*propertyFile);
autoDestroy();
}
void ewol::widget::FileChooser::onCallbackHomePressed() {
etk::String tmpUserFolder = etk::getUserHomeFolder();
EWOL_DEBUG("new PATH : \"" << tmpUserFolder << "\"");
propertyPath.setDirect(etk::simplifyPath(tmpUserFolder));
etk::Path tmpUserFolder = etk::path::getHomePath();
EWOL_DEBUG("new PATH: '" << tmpUserFolder << "'");
propertyPath.setDirect(tmpUserFolder);
propertyFile.setDirect("");
updateCurrentFolder();
}
void ewol::widget::FileChooser::updateCurrentFolder() {
if (*propertyPath != "") {
if (propertyPath.get()[propertyPath->size()-1] != '/') {
propertyPath.getDirect() += "/";
}
}
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);
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-files", "path", propertyPath.getString());
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:list-folder", "path", propertyPath.getString());
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]file-shooser:entry-folder", "value", propertyPath.getString());
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 {
public: // signals
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
eproperty::Value<etk::String> propertyPath; //!< Current path to explore
eproperty::Value<etk::String> propertyFile; //!< Selected file
eproperty::Value<etk::Path> propertyPath; //!< Current path to explore
eproperty::Value<etk::Path> propertyFile; //!< Selected file
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> propertyLabelCancel; //!< Label of cancel/close button of the pop-up (can use translation)
@ -80,7 +80,6 @@ namespace ewol {
DECLARE_WIDGET_FACTORY(FileChooser, "FileChooser");
virtual ~FileChooser();
private:
etk::String getCompleateFileName();
void updateCurrentFolder();
public:
void onGetFocus() override;
@ -88,11 +87,12 @@ namespace ewol {
// callback functions:
void onCallbackEntryFolderChangeValue(const etk::String& _value);
void onCallbackEntryFileChangeValue(const etk::String& _value);
void onCallbackEntryFileChangeValidate(const etk::String& _value);
void onCallbackButtonCancelPressed();
void onCallbackHidenFileChangeChangeValue(const bool& _value);
void onCallbackListFolderSelectChange(const etk::String& _value);
void onCallbackListFileSelectChange(const etk::String& _value);
void onCallbackListFileValidate(const etk::String& _value);
void onCallbackListFolderSelectChange(const etk::Path& _value);
void onCallbackListFileSelectChange(const etk::Path& _value);
void onCallbackListFileValidate(const etk::Path& _value);
void onCallbackListValidate();
void onCallbackHomePressed();
protected:

View File

@ -74,7 +74,7 @@ void ewol::widget::Parameter::init() {
} else {
tmpButton->setSubWidget(ewol::widget::composerGenerateString(
"<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"
"</sizer>\n"));
tmpButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Parameter::onCallbackParameterSave);
@ -96,7 +96,7 @@ void ewol::widget::Parameter::init() {
} else {
tmpButton->setSubWidget(ewol::widget::composerGenerateString(
"<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"
"</sizer>\n"));
tmpButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Parameter::onCallbackMenuclosed);

View File

@ -63,7 +63,7 @@ namespace ewol {
*/
class SpinBase : public ewol::widget::Sizer {
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
public:
UN_DECLARE_FACTORY(SpinBase);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ appl::WidgetDisplay::WidgetDisplay() {
void appl::WidgetDisplay::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);
for (int32_t iii=0; iii<250 ; ++iii) {
m_elements.pushBack(appl::WidgetDisplay::Element());

View File

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

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