diff --git a/README.md b/README.md index 9f410c57..9dbb8e52 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,6 @@ Dependency packages # on 64 bits processor for compatibility sudo apt-get install ia32-libs -Copyright (c) -============= - -2011, Edouard DUPIN - License (APACHE v2.0) ===================== diff --git a/build b/build index 9d6418ee..db4a587a 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 9d6418eed9d24b85823aca4f3393e15a8edeb0cb +Subproject commit db4a587a44ee03fd3be36afadf5101e4993b1356 diff --git a/external/egami b/external/egami index 6a409ac8..fdeaf201 160000 --- a/external/egami +++ b/external/egami @@ -1 +1 @@ -Subproject commit 6a409ac838f57e14da5274ea8506c1129f7cf955 +Subproject commit fdeaf2015c079735f1674b97d196e0f9a0c94a2c diff --git a/external/ege b/external/ege index e555759d..36744f57 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit e555759d9ccf2bd1e6de7650f138623baf8a599e +Subproject commit 36744f57e56fd7c8fd3738f6489c3a091b0aa595 diff --git a/external/ejson b/external/ejson index b1004030..d9c98697 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit b10040303a4c1dc28ae0cd5d565965fffa90bd28 +Subproject commit d9c98697edabf3ded9a46bc1cc83c58b1ab9cd62 diff --git a/external/enet b/external/enet index 22baa22b..dd76dbf0 160000 --- a/external/enet +++ b/external/enet @@ -1 +1 @@ -Subproject commit 22baa22bc23e1202285de3e640911047ea7b395d +Subproject commit dd76dbf0fd4ad1b16fb7c7ca360cf5c1ad1f41be diff --git a/external/esvg b/external/esvg index ac34d1f5..738ee25f 160000 --- a/external/esvg +++ b/external/esvg @@ -1 +1 @@ -Subproject commit ac34d1f5317c3fd952b67d5c01ee4183914ae166 +Subproject commit 738ee25fb8016e9fd7a3d62ac28a85eb99b4f197 diff --git a/external/ewolsa b/external/ewolsa index 11788c2a..c25640d8 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit 11788c2afcb64a906a6a489d1ee96fbfbcdb832d +Subproject commit c25640d80e675d25660a78dc2dc0a4f20831d4e2 diff --git a/external/exml b/external/exml index 5b41f407..3ae5e16d 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit 5b41f40739e920276b382254d7d768beaf8237e4 +Subproject commit 3ae5e16d48318ebbd158a6a7f7936000ff64b83f diff --git a/monk b/monk index 895e1878..85ebc5ec 160000 --- a/monk +++ b/monk @@ -1 +1 @@ -Subproject commit 895e18786ce732e8cc1c282863677c21e1806062 +Subproject commit 85ebc5ec327c3920264de479c8b1049c1b81596c diff --git a/sources/ewol/object/Object.cpp b/sources/ewol/object/Object.cpp index 688e4d71..410ddfc2 100644 --- a/sources/ewol/object/Object.cpp +++ b/sources/ewol/object/Object.cpp @@ -50,6 +50,7 @@ void ewol::Object::removeParent() { ewol::Object::Object() : m_objectHasBeenInit(false), m_static(false), + m_name(*this, "name", ""), m_isResource(false) { // note this is nearly atomic ... (but it is enough) m_uniqueId = m_valUID++; @@ -67,6 +68,7 @@ ewol::Object::~Object() { void ewol::Object::init() { getObjectManager().add(shared_from_this()); + parameterDisplay(); m_objectHasBeenInit = true; } diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 69c6f084..19bc750e 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -29,6 +29,9 @@ namespace ewol { #include #include #include +#include +#include +#include #define DECLARE_FACTORY(className) \ template static std::shared_ptr create( T&& ... all ) { \ @@ -62,7 +65,7 @@ namespace ewol { * @brief Basic message classes for ewol system * this class mermit at every Object to communicate between them. */ - class Object : public std::enable_shared_from_this { + class Object : public std::enable_shared_from_this, public ewol::object::ParameterList { private: static size_t m_valUID; //!< stic used for the unique ID definition public: @@ -263,14 +266,14 @@ namespace ewol { std::string getConfig(const char* _config) const; std::string getConfig(const std::string& _config) const; // need search protected: - std::string m_name; //!< name of the element ... + ewol::object::Param m_name; //!< name of the element ... public: /** * @brief get the Object name * @return The requested name */ const std::string& getName() const { - return m_name; + return m_name.get(); }; /** * @brief get the Widget name diff --git a/sources/ewol/object/Param.cpp b/sources/ewol/object/Param.cpp new file mode 100644 index 00000000..52aa9f23 --- /dev/null +++ b/sources/ewol/object/Param.cpp @@ -0,0 +1,154 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include + +////////////////////////////////////////////////////////////////////////////////// +// int16_t +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "int16_t"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const int16_t& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stoi(_newVal)); +} + +////////////////////////////////////////////////////////////////////////////////// +// uint32_t +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "uint32_t"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const uint32_t& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stoul(_newVal)); +} + +////////////////////////////////////////////////////////////////////////////////// +// int32_t +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "int32_t"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const int32_t& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stol(_newVal)); +} + +////////////////////////////////////////////////////////////////////////////////// +// uint64_t +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "uint64_t"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const uint64_t& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stoull(_newVal)); +} + +////////////////////////////////////////////////////////////////////////////////// +// Int64_t +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "int64_t"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const int64_t& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stoll(_newVal)); +} + +////////////////////////////////////////////////////////////////////////////////// +// Float +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "float"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const float& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stof(_newVal)); +} + + +////////////////////////////////////////////////////////////////////////////////// +// Double +////////////////////////////////////////////////////////////////////////////////// +template<> std::string ewol::object::Param::getType() { + return "double"; +} + +template<> std::string ewol::object::Param::getValueSpecific(const double& _valueRequested) { + return std::to_string(_valueRequested); +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(std::stod(_newVal)); +} + + +////////////////////////////////////////////////////////////////////////////////// +// Boolean +////////////////////////////////////////////////////////////////////////////////// + +template<> std::string ewol::object::Param::getValueSpecific(const bool& _valueRequested) { + if (_valueRequested == true) { + return "true"; + } + return "false"; +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + if( std::tolower(_newVal) == "true" + || std::tolower(_newVal) == "enable" + || _newVal == "1") { + set(true); + } else { + set(false); + } +} + + +////////////////////////////////////////////////////////////////////////////////// +// string +////////////////////////////////////////////////////////////////////////////////// + + +template<> std::string ewol::object::Param::getValueSpecific(const std::string& _valueRequested) { + return _valueRequested; +} + +template<> void ewol::object::Param::setString(const std::string& _newVal) { + set(_newVal); +} + + diff --git a/sources/ewol/object/Param.h b/sources/ewol/object/Param.h new file mode 100644 index 00000000..c573692d --- /dev/null +++ b/sources/ewol/object/Param.h @@ -0,0 +1,169 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_PARAM_TYPE_H__ +#define __EWOL_PARAM_TYPE_H__ + +#include +#include +#include + + +namespace ewol { + namespace object { + template class Param : public Parameter { + private: + MY_TYPE m_value; //!< Current value. + MY_TYPE m_min; //!< Minimum value. + MY_TYPE m_max; //!< Maximum value. + MY_TYPE m_default; //!< Default value. + public: + /** + * @brief Create a parameter with a specific type. + * @param[in] blockLink Pointer on the reference block (must be define for upper class. + * @param[in] name Static name of the parameter. + * @param[in] defaultValue Default value of the parameter. + * @param[in] min Minumum value. + * @param[in] max Maximum value + */ + template::value + || std::is_same::value + || std::is_same::value + || std::is_same::value + || std::is_same::value + || std::is_same::value + || std::is_same::value + || std::is_same::value + || std::is_same::value + || std::is_same::value>::type> + Param(ewol::object::ParameterList& _objectLink, + const std::string& _name, + const TYPE& _defaultValue) : + Parameter(_objectLink, _name), + m_value(_defaultValue), + m_default(_defaultValue) { + + }; + template::value>::type> + Param(ewol::object::ParameterList& _objectLink, + const std::string& _name, + const TYPE& _defaultValue, + const TYPE& _min, + const TYPE& _max) : + Parameter(_objectLink, _name), + m_value(_defaultValue), + m_min(_min), + m_max(_max), + m_default(_defaultValue) { + + }; + /** + * @brief Destructor. + */ + virtual ~Param() { }; + // herited methode + virtual std::string getType(); + // herited methode + virtual std::string getString() { + return getValueSpecific(m_value); + }; + // herited methode + virtual std::string getDefault() { + return getValueSpecific(m_default); + }; + // herited methode + virtual void setString(const std::string& _newVal); + // herited methode + virtual std::string getInfo(); + // herited methode + virtual bool isDefault() { + return m_value == m_default; + } + // herited methode + virtual void setDefault() { + m_value = m_default; + } + public: + /** + * @brief Get the value of the current parameter. + * @note For performence, this function must be inline + * @return the Reference value + */ + const inline MY_TYPE& get() const { + return m_value; + }; + /** + * @brief Set a new value for this parameter + * @param[in] newVal New value to set (set the nearest value if range is set) + */ + void set(const MY_TYPE& _newVal); + private: + /** + * @brief Get the string of the specify value. + * @return convetion of the velue in string. + */ + std::string getValueSpecific(const MY_TYPE& _valueRequested); + public: + /** + * @brief assignement operator. + * @param[in] newVal The new value of the parameter. + */ + const Param& operator= (const MY_TYPE& _newVal) { + set(_newVal); + return *this; + }; + operator MY_TYPE() { + return m_value; + } + }; + template<> std::string Param::getType() { + return "bool"; + } + template<> std::string Param::getType() { + return "string"; + } + template<> + std::string Param::getInfo() { + return getType() + " default=" + (m_default?"true":"false"); + } + template<> + std::string Param::getInfo() { + return getType() + " default=" + m_default; + } + template + std::string Param::getInfo() { + return getType() + " default= (heterogen type)"; + /* + if (m_min == m_max) { + return getType() + " default=" + std::to_string(m_default); + } + return getType() + " [" + std::to_string(m_min) + ".." + std::to_string(m_max) + "] default=" + std::to_string(m_default); + */ + } + + template<> + void Param::set(const std::string& _newVal) { + m_value = _newVal; + }; + template + void Param::set(const MY_TYPE& _newVal) { + if (m_min == m_max) { + m_value = _newVal; + } else { + m_value = std::avg(m_min, _newVal, m_max); + } + }; + + template std::ostream& operator <<(std::ostream& _os, const ewol::object::Param& _obj) { + _os << _obj.get(); + return _os; + } + }; +}; +#endif diff --git a/sources/ewol/object/ParamList.cpp b/sources/ewol/object/ParamList.cpp new file mode 100644 index 00000000..9276590e --- /dev/null +++ b/sources/ewol/object/ParamList.cpp @@ -0,0 +1,70 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include + +void ewol::object::ParamList::add(int64_t _value, const std::string& _name, const std::string& _description) { + auto it = m_list.find(_name); + if (it != m_list.end()) { + it->second = _value; + return; + } + m_list.insert(std::make_pair(_name, _value)); +} + +std::string ewol::object::ParamList::getElement(int64_t _intValue) { + for (auto &it : m_list) { + if (it.second == _intValue) { + return it.first; + } + } + return "???"; +} + +std::string ewol::object::ParamList::getString() { + return getElement(m_value); +} + +std::string ewol::object::ParamList::getDefault() { + return getElement(m_default); +} + +std::string ewol::object::ParamList::getInfo() { + return "List default=" + getElement(m_default); +} + +void ewol::object::ParamList::setString(const std::string& _newVal) { + auto it = m_list.find(_newVal); + if (it != m_list.end()) { + m_value = it->second; + return; + } + EWOL_WARNING("paramList value='" << _newVal << "' is not un the list ... ==> no change"); + for (auto &it : m_list) { + EWOL_DEBUG(" element : " << it.first); + } +} + + +void ewol::object::ParamList::set(int64_t _newVal) { + for (auto &it : m_list) { + if (it.second == _newVal) { + m_value = it.second; + return; + } + } + EWOL_WARNING("paramList value=" << _newVal << " is not un the list ... ==> no change"); +} + + +std::ostream& ewol::object::operator <<(std::ostream& _os, const ewol::object::ParamList& _obj) { + _os << _obj.get(); + return _os; +} + diff --git a/sources/ewol/object/ParamList.h b/sources/ewol/object/ParamList.h new file mode 100644 index 00000000..3ded53f9 --- /dev/null +++ b/sources/ewol/object/ParamList.h @@ -0,0 +1,99 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_PARAM_LIST_H__ +#define __EWOL_PARAM_LIST_H__ + +#include +#include +#include + +namespace ewol { + namespace object { + class ParamList : public Parameter { + private: + int64_t m_value; //!< Element value ==> can be directly used. + int64_t m_default; //!< Default value. + std::map m_list; //!< pointer on the list of all elements. + public: + /** + * @brief Create a parameter with List of element parameter. + * @param[in] blockLink Pointer on the reference block (must be define for upper class). + * @param[in] name Static name of the parameter. + */ + ParamList(ewol::object::ParameterList& _objectLink, + const std::string& _name) : + Parameter(_objectLink, _name), + m_value(0), + m_default(0) { + + }; + /** + * @brief Destructor. + */ + virtual ~ParamList() { + + }; + void add(int64_t _value, const std::string& _name, const std::string& _description = ""); + // herited methode + virtual std::string getType() { + return "list"; + }; + // herited methode + virtual std::string getString(); + // herited methode + virtual std::string getDefault(); + // herited methode + virtual void setString(const std::string& _newVal); + // herited methode + virtual std::string getInfo(); + // herited methode + virtual bool isDefault() { + return m_value == m_default; + } + // herited methode + virtual void setDefault() { + m_value = m_default; + } + /** + * @brief Get the value of the current parameter. + * @return the Reference value + */ + const inline int64_t& get() const { + return m_value; + }; + /** + * @brief Set the value of the current parameter. + * @param[in] _newVal New value of the parameter. (not set if out of range) + */ + void set(int64_t _newVal); + private: + /** + * @brief Get the element description from real Value. + * @param[in] _intValue value that might be converted in string. + * @return the description string coresponding to this ID. + */ + std::string getElement(int64_t _intValue); + public: + /** + * @brief assignement operator. + * @param[in] newVal The new value of the parameter. + */ + const ParamList& operator= (int64_t _newVal) { + set(_newVal); + return *this; + } + operator int64_t() { + return m_value; + } + }; + std::ostream& operator <<(std::ostream& _os, const ewol::object::ParamList& _obj); + }; +}; +#endif + diff --git a/sources/ewol/object/Parameter.cpp b/sources/ewol/object/Parameter.cpp new file mode 100644 index 00000000..16789c9c --- /dev/null +++ b/sources/ewol/object/Parameter.cpp @@ -0,0 +1,19 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include + + +ewol::object::Parameter::Parameter(ewol::object::ParameterList& _objectLink, const std::string& _name) : + m_name(_name) { + // add a reference on the current parameter ... + _objectLink.parameterAdd(this); +} + diff --git a/sources/ewol/object/Parameter.h b/sources/ewol/object/Parameter.h new file mode 100644 index 00000000..894ca3ec --- /dev/null +++ b/sources/ewol/object/Parameter.h @@ -0,0 +1,69 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include + +#ifndef __EWOL_PARAMETER_H__ +#define __EWOL_PARAMETER_H__ + +#include + +namespace ewol { + namespace object { + class Parameter { + private: + std::string m_name; + public: + Parameter(ewol::object::ParameterList& _objectLink, const std::string& _name); + virtual ~Parameter() { }; + /** + * @brief Get the name of the parameter. + * @return The name of the parameter + */ + virtual std::string getName() { + return m_name; + }; + /** + * @brief Get the type of the parameter in string mode. + * @return The string type of the parameter. + */ + virtual std::string getType() = 0; + /** + * @brief Get the string of the current value of the parameter. + * @return The string description of the value. + */ + virtual std::string getString() = 0; + /** + * @brief Get the string of the default value of the parameter. + * @return the string decription of the default value. + */ + virtual std::string getDefault() = 0; + /** + * @brief Set a new value of the parameter (with string interface). + * @param[in] _newVal New value of the parameters. + */ + virtual void setString(const std::string& _newVal) = 0; + /** + * @brief Description of the parameters. + * @return Descriptive information of the parameter (for remote UI). + */ + virtual std::string getInfo() = 0; + /** + * @brief Check if the value is the default + * @return true : the vakue is the default one, false otherwise. + */ + virtual bool isDefault() = 0; + /** + * @brief Reset the value to the default value. + */ + virtual void setDefault() = 0; + }; + }; +}; + +#endif diff --git a/sources/ewol/object/ParameterList.cpp b/sources/ewol/object/ParameterList.cpp new file mode 100644 index 00000000..018527e7 --- /dev/null +++ b/sources/ewol/object/ParameterList.cpp @@ -0,0 +1,75 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include + +ewol::object::ParameterList::ParameterList() { + +} + +ewol::object::ParameterList::~ParameterList() { + parameterClean(); +} + +// note this pointer is not allocated and not free at the end of the class +void ewol::object::ParameterList::parameterAdd(Parameter* _pointerOnParameter) { + if (_pointerOnParameter == nullptr) { + EWOL_ERROR("Try to link a nullptr parameters"); + return; + } + m_list.push_back(_pointerOnParameter); +} + +void ewol::object::ParameterList::parameterClean() { + // remove all pointer on these parameters + m_list.clear(); +} + +// Note no lock is needed at this level, because the lock is done is the upper elements ... +// the parameter set might be done with a pool of parameter, allone, the overhed is bigger ... +bool ewol::object::ParameterList::parameterSet(const std::string& _parameter, const std::string& _value) { + for (auto &it : m_list) { + if( it != nullptr + && it->getName() == _parameter) { + it->setString(_value); + return true; + } + } + // can not find the parameters : + return false; +} + +std::string ewol::object::ParameterList::parameterGet(const std::string& _parameter) { + for (auto &it : m_list) { + if( it != nullptr + && it->getName() == _parameter) { + return it->getString(); + } + } + return "???"; +} + +void ewol::object::ParameterList::parameterDisplay(bool _changeOnly) { + EWOL_INFO(" Object parameters:"); + for (auto &it : m_list) { + if(it != nullptr) { + std::string paramName = it->getName(); + std::string paramVal = it->getString(); + std::string paramInfo = it->getInfo(); + if ( _changeOnly == false + || it->isDefault() == false) { + EWOL_INFO(" | param='" << paramName << "' value=" << paramVal << " (" << paramInfo << ")"); + } + } else { + EWOL_INFO(" | param=nullptr"); + } + } +} + diff --git a/sources/ewol/object/ParameterList.h b/sources/ewol/object/ParameterList.h new file mode 100644 index 00000000..1c883013 --- /dev/null +++ b/sources/ewol/object/ParameterList.h @@ -0,0 +1,65 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + + +#ifndef __EWOL_PARAMETER_LIST_H__ +#define __EWOL_PARAMETER_LIST_H__ + +#include + +namespace ewol { + namespace object { + class Parameter; + class ParameterList { + friend class ewol::object::Parameter; // to register parameter in the list. + private: + std::vector m_list; //!< list of availlable Parameters + public: + /** + * @brief Constructor. + */ + ParameterList(); + /** + * @brief Destructor. + */ + ~ParameterList(); + /** + * @brief Register a parameter class pointer in the List of parameters + * @note This class does not destroy the parameter pointer!!! + * @param[in] pointerOnParameter Pointer on the parameter that might be added. + */ + void parameterAdd(Parameter* _pointerOnParameter); + /** + * @brief Remove all the parameter reference in this class. + * @note no delete, just clean and inform that a parameter has not been removed. + */ + void parameterClean(); + /** + * @brief Set a specific value to the parameter reference name. + * @param[in] parameter The parameter string name. + * @param[in] value The new value of the parameter (string). + * @return true Parameter update. + * @return false Parameter not update. + */ + bool parameterSet(const std::string& _parameter, const std::string& _value); + /** + * @brief Get a specific value of the parameter reference name. + * @param[in] parameter The parameter string name. + * @return The value of the parameter (string). + */ + std::string parameterGet(const std::string& _parameter); + /** + * @brief Display all the parameter value with there name. + * @param[in] changeOnly check at true if the user want to display only parameter that are not at default value. + */ + void parameterDisplay(bool _changeOnly = false); + }; + }; +}; + +#endif diff --git a/sources/ewol/widget/ButtonColor.cpp b/sources/ewol/widget/ButtonColor.cpp index 59530475..5880d06c 100644 --- a/sources/ewol/widget/ButtonColor.cpp +++ b/sources/ewol/widget/ButtonColor.cpp @@ -96,12 +96,12 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() { (m_size.y() - m_minSize.y()) / 2.0, 0); - if (true == m_userFill.x()) { + if (true == m_userFill.get().x()) { localSize.setX(m_size.x()); tmpOrigin.setX(0); tmpTextOrigin.setX(0); } - if (true == m_userFill.y()) { + if (true == m_userFill.get().y()) { localSize.setY(m_size.y()); } tmpOrigin += vec3(padding.xLeft(), padding.yButtom(), 0); @@ -123,7 +123,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() { m_text.print(label); - if (true == m_userFill.y()) { + if (true == m_userFill.get().y()) { tmpOrigin.setY(padding.yButtom()); } diff --git a/sources/ewol/widget/ColorBar.cpp b/sources/ewol/widget/ColorBar.cpp index dae54d95..e9331f9f 100644 --- a/sources/ewol/widget/ColorBar.cpp +++ b/sources/ewol/widget/ColorBar.cpp @@ -80,11 +80,11 @@ void ewol::widget::ColorBar::onRegenerateDisplay() { int32_t tmpOriginX = (m_size.x() - m_minSize.x()) / 2; int32_t tmpOriginY = (m_size.y() - m_minSize.y()) / 2; - if (true == m_userFill.x()) { + if (true == m_userFill.get().x()) { tmpSizeX = m_size.x(); tmpOriginX = 0; } - if (true == m_userFill.y()) { + if (true == m_userFill.get().y()) { tmpSizeY = m_size.y(); tmpOriginY = 0; } diff --git a/sources/ewol/widget/Container2.cpp b/sources/ewol/widget/Container2.cpp index b33e70c5..3ea2c4c4 100644 --- a/sources/ewol/widget/Container2.cpp +++ b/sources/ewol/widget/Container2.cpp @@ -114,10 +114,10 @@ ewol::Padding ewol::widget::Container2::calculateSizePadded(const vec2& _availla } // Checkin the filling properties == > for the subElements: vec2 subElementSize = m_minSize; - if (m_userFill.x() == true) { + if (m_userFill.get().x() == true) { subElementSize.setX(m_size.x()); } - if (m_userFill.y() == true) { + if (m_userFill.get().y() == true) { subElementSize.setY(m_size.y()); } vec2 origin = (m_size - subElementSize)*0.5f + vec2(_padding.xLeft(), _padding.yButtom()); diff --git a/sources/ewol/widget/Entry.cpp b/sources/ewol/widget/Entry.cpp index 6033f4df..2232414a 100644 --- a/sources/ewol/widget/Entry.cpp +++ b/sources/ewol/widget/Entry.cpp @@ -146,10 +146,10 @@ void ewol::widget::Entry::onRegenerateDisplay() { ewol::Padding padding = m_shaper.getPadding(); vec2 tmpSizeShaper = m_minSize; - if (true == m_userFill.x()) { + if (true == m_userFill.get().x()) { tmpSizeShaper.setX(m_size.x()); } - if (true == m_userFill.y()) { + if (true == m_userFill.get().y()) { tmpSizeShaper.setY(m_size.y()); } @@ -508,7 +508,7 @@ void ewol::widget::Entry::updateTextPosition() { ewol::Padding padding = m_shaper.getPadding(); int32_t tmpSizeX = m_minSize.x(); - if (true == m_userFill.x()) { + if (true == m_userFill.get().x()) { tmpSizeX = m_size.x(); } int32_t tmpUserSize = tmpSizeX - padding.x(); diff --git a/sources/ewol/widget/Image.cpp b/sources/ewol/widget/Image.cpp index 24b58772..3a01e064 100644 --- a/sources/ewol/widget/Image.cpp +++ b/sources/ewol/widget/Image.cpp @@ -156,12 +156,12 @@ void ewol::widget::Image::onRegenerateDisplay() { vec2 ratioSizeDisplayRequested = m_posStop - m_posStart; //imageRealSizeMax *= ratioSizeDisplayRequested; - if (m_userFill.x() == true) { + if (m_userFill.get().x() == true) { imageRealSize.setX(imageRealSizeMax.x()); } else { origin.setX(origin.x() + (m_size.x()-m_minSize.x())*0.5f); } - if (m_userFill.y() == true) { + if (m_userFill.get().y() == true) { imageRealSize.setY(imageRealSizeMax.y()); } else { origin.setY(origin.y() + (m_size.y()-m_minSize.y())*0.5f); diff --git a/sources/ewol/widget/Label.cpp b/sources/ewol/widget/Label.cpp index 32189c3f..41382510 100644 --- a/sources/ewol/widget/Label.cpp +++ b/sources/ewol/widget/Label.cpp @@ -99,11 +99,11 @@ void ewol::widget::Label::onRegenerateDisplay() { (m_size.y() - m_minSize.y()) / 2.0, 0); - if (m_userFill.x() == true) { + if (m_userFill.get().x() == true) { localSize.setX(m_size.x()); tmpTextOrigin.setX(0); } - if (m_userFill.y() == true) { + if (m_userFill.get().y() == true) { localSize.setY(m_size.y()); tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y()); } diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index ba41ec92..62ccc320 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -114,7 +114,7 @@ ewol::Widget::Widget() : m_userMinSize(vec2(0,0),ewol::Dimension::Pixel), m_userMaxSize(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel), m_userExpand(false,false), - m_userFill(false,false), + m_userFill(*this, "fill", bvec2(false,false)), m_hide(false), m_gravity(ewol::gravityButtomLeft), m_hasFocus(false), @@ -509,8 +509,8 @@ bvec2 ewol::Widget::canExpand() { } void ewol::Widget::setFill(const bvec2& _newFill) { - if( m_userFill.x() != _newFill.x() - || m_userFill.y() != _newFill.y()) { + if( m_userFill.get().x() != _newFill.x() + || m_userFill.get().y() != _newFill.y()) { m_userFill = _newFill; requestUpdateSize(); markToRedraw(); @@ -518,7 +518,7 @@ void ewol::Widget::setFill(const bvec2& _newFill) { } const bvec2& ewol::Widget::canFill() { - return m_userFill; + return m_userFill.get(); } // ---------------------------------------------------------------------------------------------------------------- @@ -799,7 +799,7 @@ bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const return true; } if (_config == ewol::Widget::configFill) { - _result = m_userFill; + _result = m_userFill.get(); return true; } if (_config == ewol::Widget::configExpand) { diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index f154c692..e2db8c3a 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -311,7 +311,7 @@ namespace ewol { */ virtual bvec2 canExpand(); protected: - bvec2 m_userFill; + ewol::object::Param m_userFill; public: /** * @brief set the x&y filling capacity @@ -323,7 +323,7 @@ namespace ewol { * @return bvec2 repensent the capacity to x&y filling (set by the user) */ virtual const bvec2& getFill() { - return m_userFill; + return m_userFill.get(); }; /** * @brief get the filling capabilities x&y diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 26771850..d666a718 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -94,7 +94,11 @@ def create(target): 'ewol/object/Message.cpp', 'ewol/object/MultiCast.cpp', 'ewol/object/Object.cpp', - 'ewol/object/RemoveEvent.cpp' + 'ewol/object/RemoveEvent.cpp', + 'ewol/object/Parameter.cpp', + 'ewol/object/ParameterList.cpp', + 'ewol/object/ParamList.cpp', + 'ewol/object/Param.cpp' ]) # OpenGL interface :