From 03213d9f04b5f5db7f22f90e8505fe25109c0d5b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 18 Oct 2014 08:30:32 +0200 Subject: [PATCH 01/57] [TAG] Update version tag : 0.9.4-dev --- sources/tag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tag b/sources/tag index fba5459b..7d13f837 100644 --- a/sources/tag +++ b/sources/tag @@ -1 +1 @@ -0.9.3-dev \ No newline at end of file +0.9.4-dev \ No newline at end of file From 4fde0a846276d3d3165c63ecd9687616b4c6e9b1 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 19 Oct 2014 23:02:44 +0200 Subject: [PATCH 02/57] [DEV] add bind1 (not work) --- sources/ewol/object/Object.h | 8 ++++++++ sources/ewol/object/Signal.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 836d17e6..f49f5a90 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -230,6 +230,14 @@ namespace ewol { EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ } \ } while (false) + #define subBind1(_type, _name, _event, _obj, _func, _param1) do {\ + std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \ + if (myObject != nullptr) { \ + myObject->_event.bind1(_obj, _func, _param1); \ + } else { \ + EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ + } \ + } while (false) /* template void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); diff --git a/sources/ewol/object/Signal.h b/sources/ewol/object/Signal.h index 76bfef3e..412cc003 100644 --- a/sources/ewol/object/Signal.h +++ b/sources/ewol/object/Signal.h @@ -58,6 +58,14 @@ namespace ewol { } m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); } + template void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const T&,const TYPE2&), TYPE2 _param1) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); + } /** * @brief Advanced binding a callback function to the current signal. * @param[in] _obj Shared pointer on the caller object @@ -153,6 +161,14 @@ namespace ewol { } m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); } + template void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const TYPE2&), const TYPE2& _param1) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); + } /** * @brief Advanced binding a callback function to the current signal. * @param[in] _obj Shared pointer on the caller object From 06521163f61a136c12699ecb6c3926f3c89eebbe Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 19 Oct 2014 23:03:08 +0200 Subject: [PATCH 03/57] [STYLE] some style --- sources/ewol/widget/Scroll.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sources/ewol/widget/Scroll.h b/sources/ewol/widget/Scroll.h index d398b1a6..0b3d335e 100644 --- a/sources/ewol/widget/Scroll.h +++ b/sources/ewol/widget/Scroll.h @@ -18,9 +18,6 @@ namespace ewol { namespace widget { - /** - * @ingroup ewolWidgetGroup - */ class Scroll : public ewol::widget::Container { public: enum highSpeedMode { @@ -58,7 +55,9 @@ namespace ewol { * @brief get the limit of scrolling * @return scrolling limit */ - const vec2& getLimit() const { return m_limit; }; + const vec2& getLimit() const { + return m_limit; + }; public: // Derived function void calculateMinMaxSize(); From 36495518ac56971e044c020d672fdc1f5c05637b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 19 Oct 2014 23:04:27 +0200 Subject: [PATCH 04/57] [DEV] change slider signal value type int32_t ==> float --- sources/ewol/widget/Slider.cpp | 6 +++--- sources/ewol/widget/Slider.h | 2 +- sources/ewol/widget/meta/ColorChooser.cpp | 8 ++++---- sources/ewol/widget/meta/ColorChooser.h | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sources/ewol/widget/Slider.cpp b/sources/ewol/widget/Slider.cpp index f92c77d5..d9b4507e 100644 --- a/sources/ewol/widget/Slider.cpp +++ b/sources/ewol/widget/Slider.cpp @@ -75,16 +75,16 @@ void ewol::widget::Slider::onRegenerateDisplay() { bool ewol::widget::Slider::onEventInput(const ewol::event::Input& _event) { vec2 relativePos = relativePosition(_event.getPos()); - EWOL_ERROR("Event on Slider ..." << _event); + //EWOL_DEBUG("Event on Slider ..." << _event); if (1 == _event.getId()) { if( ewol::key::statusSingle == _event.getStatus() || ewol::key::statusMove == _event.getStatus()) { // get the new position : - EWOL_INFO("Event on Slider (" << relativePos.x() << "," << relativePos.y() << ")"); + EWOL_VERBOSE("Event on Slider (" << relativePos.x() << "," << relativePos.y() << ")"); float oldValue = m_value.get(); updateValue(m_min + (float)(relativePos.x() - dotRadius) / (m_size.x()-2*dotRadius) * (m_max-m_min)); if (oldValue != m_value) { - EWOL_DEBUG(" new value : " << m_value << " in [" << m_min << ".." << m_max << "]"); + EWOL_VERBOSE(" new value : " << m_value << " in [" << m_min << ".." << m_max << "]"); signalChange.emit(m_value); } return true; diff --git a/sources/ewol/widget/Slider.h b/sources/ewol/widget/Slider.h index 4575b505..6155d5c6 100644 --- a/sources/ewol/widget/Slider.h +++ b/sources/ewol/widget/Slider.h @@ -24,7 +24,7 @@ namespace ewol { class Slider : public ewol::Widget { public: // Event list of properties - ewol::object::Signal signalChange; + ewol::object::Signal signalChange; protected: Slider(); void init(); diff --git a/sources/ewol/widget/meta/ColorChooser.cpp b/sources/ewol/widget/meta/ColorChooser.cpp index f954d59b..b7ec2ea1 100644 --- a/sources/ewol/widget/meta/ColorChooser.cpp +++ b/sources/ewol/widget/meta/ColorChooser.cpp @@ -109,28 +109,28 @@ etk::Color<> ewol::widget::ColorChooser::getColor() { return m_currentColor; } -void ewol::widget::ColorChooser::onCallbackColorChangeRed(const int32_t& _newColor) { +void ewol::widget::ColorChooser::onCallbackColorChangeRed(const float& _newColor) { m_currentColor.setR(_newColor); if (nullptr != m_widgetColorBar) { m_widgetColorBar->setCurrentColor(m_currentColor); } signalChange.emit(m_currentColor); } -void ewol::widget::ColorChooser::onCallbackColorChangeGreen(const int32_t& _newColor) { +void ewol::widget::ColorChooser::onCallbackColorChangeGreen(const float& _newColor) { m_currentColor.setG(_newColor); if (nullptr != m_widgetColorBar) { m_widgetColorBar->setCurrentColor(m_currentColor); } signalChange.emit(m_currentColor); } -void ewol::widget::ColorChooser::onCallbackColorChangeBlue(const int32_t& _newColor) { +void ewol::widget::ColorChooser::onCallbackColorChangeBlue(const float& _newColor) { m_currentColor.setB(_newColor); if (nullptr != m_widgetColorBar) { m_widgetColorBar->setCurrentColor(m_currentColor); } signalChange.emit(m_currentColor); } -void ewol::widget::ColorChooser::onCallbackColorChangeAlpha(const int32_t& _newColor) { +void ewol::widget::ColorChooser::onCallbackColorChangeAlpha(const float& _newColor) { m_currentColor.setA(_newColor); if (nullptr != m_widgetColorBar) { m_widgetColorBar->setCurrentColor(m_currentColor); diff --git a/sources/ewol/widget/meta/ColorChooser.h b/sources/ewol/widget/meta/ColorChooser.h index c3044ece..03833888 100644 --- a/sources/ewol/widget/meta/ColorChooser.h +++ b/sources/ewol/widget/meta/ColorChooser.h @@ -45,10 +45,10 @@ namespace ewol { std::shared_ptr m_widgetBlue; std::shared_ptr m_widgetAlpha; etk::Color<> m_currentColor; - void onCallbackColorChangeRed(const int32_t& _newColor); - void onCallbackColorChangeGreen(const int32_t& _newColor); - void onCallbackColorChangeBlue(const int32_t& _newColor); - void onCallbackColorChangeAlpha(const int32_t& _newColor); + void onCallbackColorChangeRed(const float& _newColor); + void onCallbackColorChangeGreen(const float& _newColor); + void onCallbackColorChangeBlue(const float& _newColor); + void onCallbackColorChangeAlpha(const float& _newColor); void onCallbackColorChange(const etk::Color<>& _newColor); }; }; From d8d02254cac1ec9275815afa3ffc38bcfd21f577 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 19 Oct 2014 23:04:54 +0200 Subject: [PATCH 05/57] [DEV] remove deprecated API --- sources/ewol/widget/Windows.cpp | 1 - sources/ewol/widget/Windows.h | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/sources/ewol/widget/Windows.cpp b/sources/ewol/widget/Windows.cpp index f8eda025..67ad716a 100644 --- a/sources/ewol/widget/Windows.cpp +++ b/sources/ewol/widget/Windows.cpp @@ -28,7 +28,6 @@ ewol::widget::Windows::Windows() : m_colorBg(-1) { addObjectType("ewol::widget::Windows"); setCanHaveFocus(true); - setDecorationDisable(); m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:Windows.json"); if (m_colorProperty != nullptr) { m_colorBg = m_colorProperty->request("background"); diff --git a/sources/ewol/widget/Windows.h b/sources/ewol/widget/Windows.h index a2b036f2..abe01766 100644 --- a/sources/ewol/widget/Windows.h +++ b/sources/ewol/widget/Windows.h @@ -49,17 +49,6 @@ namespace ewol { virtual void onStateForeground() {}; virtual void onStateSuspend() {}; virtual void onStateResume() {}; - virtual void on() { }; - private: - bool m_hasDecoration; - public: - void setDecorationDisable() { - m_hasDecoration = false; - } - - void setDecorationEnable() { - m_hasDecoration = true; - } private: std::shared_ptr m_subWidget; std::list> m_popUpWidgetList; From 499806edc5813a59cf17cace512a2018adb42c31 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 19 Oct 2014 23:05:24 +0200 Subject: [PATCH 06/57] [DEV] remove compilation warning --- sources/ewol/widget/WSlider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/ewol/widget/WSlider.cpp b/sources/ewol/widget/WSlider.cpp index 76aa3b82..ed00002b 100644 --- a/sources/ewol/widget/WSlider.cpp +++ b/sources/ewol/widget/WSlider.cpp @@ -108,7 +108,7 @@ void ewol::widget::WSlider::subWidgetSelectSetVectorId(int32_t _id) { } void ewol::widget::WSlider::subWidgetSelectSet(int32_t _id) { - int32_t elementID = 0; + size_t elementID = 0; // search element in the list : for (auto &it : m_subWidget) { elementID ++; From 21435b99615398e8a491ab0b80b0d9ec9132cd05 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 20 Oct 2014 21:28:23 +0200 Subject: [PATCH 07/57] [DEV] add subElement bind with multiple argument (TODO: better with template) --- external/egami | 2 +- sources/ewol/object/Object.h | 8 +++++++ sources/ewol/object/Signal.h | 42 ++++++++++++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/external/egami b/external/egami index e07648a3..aa66ac17 160000 --- a/external/egami +++ b/external/egami @@ -1 +1 @@ -Subproject commit e07648a33c85a8886c0e9dfb806ed8585c4d7553 +Subproject commit aa66ac176f625abf61122e0a71a608adab43fca2 diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index f49f5a90..223cd9bb 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -238,6 +238,14 @@ namespace ewol { EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ } \ } while (false) + #define subBind2(_type, _name, _event, _obj, _func, _param1, _param2) do {\ + std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \ + if (myObject != nullptr) { \ + myObject->_event.bind2(_obj, _func, _param1, _param2); \ + } else { \ + EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ + } \ + } while (false) /* template void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); diff --git a/sources/ewol/object/Signal.h b/sources/ewol/object/Signal.h index 412cc003..638ea87d 100644 --- a/sources/ewol/object/Signal.h +++ b/sources/ewol/object/Signal.h @@ -50,7 +50,19 @@ namespace ewol { * @param[in] _func Link on the fuction that might be called (inside a class) * @example signalXXXX.bind(shared_from_this(), &ClassName::onCallbackXXX); */ - template void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&)) { + /* Maybe later : + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&, TArgs...), TArgs... args2) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, args2))); + } + */ + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&)) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); @@ -58,7 +70,9 @@ namespace ewol { } m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); } - template void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const T&,const TYPE2&), TYPE2 _param1) { + // TODO : Rework this when I understand the use of variadic template with std::function + template + void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&), TYPE2 _param1) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); @@ -66,6 +80,15 @@ namespace ewol { } m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); } + template + void bind2(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&, const TYPE3&), TYPE2 _param1, TYPE3 _param2) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); + } /** * @brief Advanced binding a callback function to the current signal. * @param[in] _obj Shared pointer on the caller object @@ -153,7 +176,8 @@ namespace ewol { * @param[in] _func Link on the fuction that might be called (inside a class) * @example signalXXXX.connect(shared_from_this(), &ClassName::onCallbackXXX); */ - template void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); @@ -161,7 +185,8 @@ namespace ewol { } m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); } - template void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const TYPE2&), const TYPE2& _param1) { + template + void bind1(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2), TYPE2 _param1) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); @@ -169,6 +194,15 @@ namespace ewol { } m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); } + template + void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE2), TYPE2 _param1, TYPE3 _param2) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); + } /** * @brief Advanced binding a callback function to the current signal. * @param[in] _obj Shared pointer on the caller object From 5024c51379a143e78866a1c15299cab7194c4a15 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 23 Oct 2014 22:17:39 +0200 Subject: [PATCH 08/57] [DEBUG] signal error when removing signal in signal calling --- build | 2 +- external/egami | 2 +- external/ejson | 2 +- external/etk | 2 +- external/exml | 2 +- sources/ewol/object/Signal.h | 181 +++++++++++++++++++++++++---- sources/ewol/object/SignalBase.cpp | 13 ++- sources/ewol/object/SignalBase.h | 6 +- 8 files changed, 179 insertions(+), 31 deletions(-) diff --git a/build b/build index dd03e468..288207e4 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit dd03e468326f087e3becf1f497ca7aa87d3c521b +Subproject commit 288207e4e1fdcee746b587a9ac644cfdf6ed17f5 diff --git a/external/egami b/external/egami index aa66ac17..ff1239ee 160000 --- a/external/egami +++ b/external/egami @@ -1 +1 @@ -Subproject commit aa66ac176f625abf61122e0a71a608adab43fca2 +Subproject commit ff1239ee266d14d380d53cc7407d4e60c75b0db2 diff --git a/external/ejson b/external/ejson index ad2d06e4..226d9513 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit ad2d06e4361d9b37074433e5da1481237049c105 +Subproject commit 226d95135ccb49de2427a38256212b5020a090d1 diff --git a/external/etk b/external/etk index 63c9ff74..45c4fbb9 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 63c9ff74c23a52aa8fd718a0c6d26fc6c88fab01 +Subproject commit 45c4fbb98db6b5b50599dfaef5903d3a78e63f08 diff --git a/external/exml b/external/exml index a4c544e9..479921d3 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit a4c544e916ed9d9519adedeb53d2f023e53aa360 +Subproject commit 479921d3475fe3fd7a72bbd9e1772f70d284f774 diff --git a/sources/ewol/object/Signal.h b/sources/ewol/object/Signal.h index 638ea87d..836bd61b 100644 --- a/sources/ewol/object/Signal.h +++ b/sources/ewol/object/Signal.h @@ -23,7 +23,9 @@ namespace ewol { template class Signal : public SignalBase { private: std::vector, - std::function>> m_callerList; + std::function>> m_callerList; // current list of binded element + std::vector, + std::function>> m_callerListInCallback; // temporaty list (when add one in call process) public: /** * @brief Create a parameter with a specific type. @@ -68,7 +70,11 @@ namespace ewol { EWOL_ERROR("Can not bind signal ..."); return; } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); + } } // TODO : Rework this when I understand the use of variadic template with std::function template @@ -78,7 +84,11 @@ namespace ewol { EWOL_ERROR("Can not bind signal ..."); return; } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); + } } template void bind2(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&, const TYPE3&), TYPE2 _param1, TYPE3 _param2) { @@ -87,7 +97,11 @@ namespace ewol { EWOL_ERROR("Can not bind signal ..."); return; } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); + } } /** * @brief Advanced binding a callback function to the current signal. @@ -96,17 +110,44 @@ namespace ewol { * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); */ void connect(std::shared_ptr _obj, std::function _function ) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + } } /** * @brief remove link on the signal. * @param[in] _obj shared pointer on the removing object */ void release(std::shared_ptr _obj) { - auto it(m_callerList.begin()); - while(it != m_callerList.end()) { + if (m_callInProgress == 0) { + // Remove from the list : + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + it = m_callerList.erase(it); + } else { + ++it; + } + } + } else { + // just remove weak poointer + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + it->first.reset(); + } else { + ++it; + } + } + m_someOneRemoveInCall = true; + } + // remove from add list in callback progress + auto it = m_callerListInCallback.begin(); + while(it != m_callerListInCallback.end()) { if (it->first.lock() == _obj) { - it = m_callerList.erase(it); + it = m_callerListInCallback.erase(it); } else { ++it; } @@ -117,31 +158,55 @@ namespace ewol { * @param[in] _data data to emit */ void emit(const T& _data) { + m_signalCallLeval++; + m_callInProgress++; #ifdef DEBUG int32_t tmpID = m_uidSignal++; ewol::Object* srcObject = dynamic_cast(&m_objectLink); if (srcObject != nullptr) { - EWOL_VERBOSE("emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' data='" << etk::to_string(_data) << "' to:"); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' data='" << etk::to_string(_data) << "' to: " << m_callerList.size() << " element(s)"); } else { - EWOL_VERBOSE("emit signal{" << tmpID << "} : signal='" << m_name << "' data='" << etk::to_string(_data) << "' to:"); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : signal='" << m_name << "' data='" << etk::to_string(_data) << "' to: " << m_callerList.size() << " element(s)"); } #endif for (auto &it : m_callerList) { std::shared_ptr destObject = it.first.lock(); if (destObject == nullptr) { // TODO : Remove instance ... - EWOL_VERBOSE(" nullptr dest"); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " nullptr dest"); continue; } #ifdef DEBUG if (srcObject != nullptr) { - EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); } else { - EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); } #endif it.second(_data); } + m_callInProgress--; + m_signalCallLeval--; + // Remove element in call phase: + if (m_someOneRemoveInCall == true) { + m_someOneRemoveInCall = false; + // Remove from the list : + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.expired() == true) { + it = m_callerList.erase(it); + } else { + ++it; + } + } + } + // add element in call phase: + if (m_callerListInCallback.size() > 0) { + for (auto &it : m_callerListInCallback) { + m_callerList.push_back(it); + } + m_callerListInCallback.clear(); + } } }; #undef __class__ @@ -149,6 +214,7 @@ namespace ewol { template<> class Signal : public SignalBase { private: std::vector, std::function>> m_callerList; + std::vector, std::function>> m_callerListInCallback; public: /** * @brief Create a parameter with a specific type. @@ -183,7 +249,11 @@ namespace ewol { EWOL_ERROR("Can not bind signal ..."); return; } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); + } } template void bind1(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2), TYPE2 _param1) { @@ -192,7 +262,11 @@ namespace ewol { EWOL_ERROR("Can not bind signal ..."); return; } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); + } } template void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE2), TYPE2 _param1, TYPE3 _param2) { @@ -201,7 +275,11 @@ namespace ewol { EWOL_ERROR("Can not bind signal ..."); return; } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); + } } /** * @brief Advanced binding a callback function to the current signal. @@ -210,7 +288,11 @@ namespace ewol { * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); */ void connect(std::shared_ptr _obj, std::function _function ) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + } } /** * @brief remove link on the signal. @@ -218,40 +300,91 @@ namespace ewol { */ void release(std::shared_ptr _obj) { auto it(m_callerList.begin()); - while(it != m_callerList.end()) { + if (m_callInProgress == 0) { + // Remove from the list : + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "'"); + it = m_callerList.erase(it); + } else { + ++it; + } + } + } else { + // just remove weak poointer + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (delayed)"); + it->first.reset(); + } else { + ++it; + } + } + m_someOneRemoveInCall = true; + } + // remove from add list in callback progress + it = m_callerListInCallback.begin(); + while(it != m_callerListInCallback.end()) { if (it->first.lock() == _obj) { - it = m_callerList.erase(it); + EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (notActive)"); + it = m_callerListInCallback.erase(it); } else { ++it; } } } void emit() { + m_callInProgress++; + m_signalCallLeval++; #ifdef DEBUG int32_t tmpID = m_uidSignal++; ewol::Object* srcObject = dynamic_cast(&m_objectLink); if (srcObject != nullptr) { - EWOL_VERBOSE("emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' BANG!!! to:"); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' BANG!!! to: " << m_callerList.size() << " element(s)"); } else { - EWOL_VERBOSE("emit signal{" << tmpID << "} : signal='" << m_name << "' to:"); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : signal='" << m_name << "' to: " << m_callerList.size() << " element(s)"); } #endif for (auto &it : m_callerList) { std::shared_ptr destObject = it.first.lock(); if (destObject == nullptr) { // TODO : Remove instance ... - EWOL_VERBOSE(" nullptr dest"); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " nullptr dest"); continue; } #ifdef DEBUG if (srcObject != nullptr) { - EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); } else { - EWOL_VERBOSE(" signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); + EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); } #endif it.second(); } + m_callInProgress--; + m_signalCallLeval--; + // Remove element in call phase: + if (m_someOneRemoveInCall == true) { + m_someOneRemoveInCall = false; + // Remove from the list : + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.expired() == true) { + it = m_callerList.erase(it); + } else { + ++it; + } + } + } + // add element in call phase: + if (m_callerListInCallback.size() > 0) { + for (auto &it : m_callerListInCallback) { + if (it.first.expired() == false) { + m_callerList.push_back(it); + } + } + m_callerListInCallback.clear(); + } } }; #undef __class__ diff --git a/sources/ewol/object/SignalBase.cpp b/sources/ewol/object/SignalBase.cpp index 87b1b101..90e1e821 100644 --- a/sources/ewol/object/SignalBase.cpp +++ b/sources/ewol/object/SignalBase.cpp @@ -13,12 +13,15 @@ #include int32_t ewol::object::SignalBase::m_uidSignal = 0; +int32_t ewol::object::SignalBase::m_signalCallLeval = 0; ewol::object::SignalBase::SignalBase(ewol::object::SignalList& _objectLink, const std::string& _name, const std::string& _description) : m_objectLink(_objectLink), m_name(_name), - m_description(_description) { + m_description(_description), + m_callInProgress(0), + m_someOneRemoveInCall(false) { // add a reference on the current signal ... m_objectLink.signalAdd(this); } @@ -28,3 +31,11 @@ std::ostream& ewol::object::operator <<(std::ostream& _os, const ewol::object::S return _os; } + +const char* ewol::object::logIndent(int32_t _iii) { + static const char g_val[] = " "; + if (_iii > 5) { + return g_val; + } + return g_val + (5-_iii)*4; +} \ No newline at end of file diff --git a/sources/ewol/object/SignalBase.h b/sources/ewol/object/SignalBase.h index 5e60ddea..ed277468 100644 --- a/sources/ewol/object/SignalBase.h +++ b/sources/ewol/object/SignalBase.h @@ -18,10 +18,13 @@ namespace ewol { namespace object { class SignalBase { protected: + static int32_t m_uidSignal; + static int32_t m_signalCallLeval; ewol::object::SignalList& m_objectLink; std::string m_name; std::string m_description; - static int32_t m_uidSignal; + int32_t m_callInProgress; + bool m_someOneRemoveInCall; public: /** * @brief Create a parameter with a specific type. @@ -46,6 +49,7 @@ namespace ewol { virtual void release(std::shared_ptr _obj) = 0; }; std::ostream& operator <<(std::ostream& _os, const SignalBase& _obj); + const char* logIndent(int32_t _iii); }; }; #endif From 9cc1b47a2a651e38e31972748452221e2226e2c4 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 28 Oct 2014 21:01:44 +0100 Subject: [PATCH 09/57] [DEV] change periodic call ==> remove from widget manager to Object manager and set signal instead of virtual function --- sources/ewol/context/Context.cpp | 4 +-- sources/ewol/event/Time.cpp | 10 ++++++ sources/ewol/object/Manager.cpp | 29 +++++++++++++-- sources/ewol/object/Manager.h | 26 +++++++++++++- sources/ewol/object/Signal.h | 8 ++++- sources/ewol/widget/Button.cpp | 1 + sources/ewol/widget/Manager.cpp | 60 ++------------------------------ sources/ewol/widget/Manager.h | 9 ----- sources/ewol/widget/Widget.cpp | 16 ++------- sources/ewol/widget/Widget.h | 28 ++------------- 10 files changed, 80 insertions(+), 111 deletions(-) diff --git a/sources/ewol/context/Context.cpp b/sources/ewol/context/Context.cpp index 7f2e31b4..dbbd4d19 100644 --- a/sources/ewol/context/Context.cpp +++ b/sources/ewol/context/Context.cpp @@ -592,7 +592,7 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) { } } // call all the widget that neded to do something periodicly - m_widgetManager.periodicCall(currentTime); + m_objectManager.timeCall(currentTime); // check if the user selected a windows if (nullptr != m_windowsCurrent) { // Redraw all needed elements @@ -731,7 +731,7 @@ void ewol::Context::OS_Resume() { lockContext(); EWOL_INFO("OS_Resume..."); m_previousDisplayTime = ewol::getTime(); - m_widgetManager.periodicCallResume(m_previousDisplayTime); + m_objectManager.timeCallResume(m_previousDisplayTime); if (m_windowsCurrent != nullptr) { m_windowsCurrent->onStateResume(); } diff --git a/sources/ewol/event/Time.cpp b/sources/ewol/event/Time.cpp index 1194f065..14f4952a 100644 --- a/sources/ewol/event/Time.cpp +++ b/sources/ewol/event/Time.cpp @@ -19,3 +19,13 @@ std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Tim _os << "}"; return _os; } + +template<> std::string etk::to_string(ewol::event::Time const& _obj) { + std::string out; + out = "{[ewol::event::Time]time=" + etk::to_string(_obj.getTime()); + out += ";uptime=" + etk::to_string(_obj.getApplUpTime()); + out += ";delta=" + etk::to_string(_obj.getDelta()); + out += ";deltaCall=" + etk::to_string(_obj.getDeltaCall()); + out += "}"; + return out; +} \ No newline at end of file diff --git a/sources/ewol/object/Manager.cpp b/sources/ewol/object/Manager.cpp index 79d35c3b..26342d37 100644 --- a/sources/ewol/object/Manager.cpp +++ b/sources/ewol/object/Manager.cpp @@ -16,8 +16,14 @@ #define __class__ "ewol::object::Manager" ewol::object::Manager::Manager(ewol::Context& _context) : - m_context(_context) { + m_context(_context), + periodicCall(*this, "periodic", "Call every time system render"), + m_applWakeUpTime(0), + m_lastPeriodicCallTime(0) { EWOL_DEBUG(" == > init Object-Manager"); + // set the basic time properties : + m_applWakeUpTime = ewol::getTime(); + m_lastPeriodicCallTime = ewol::getTime(); } ewol::object::Manager::~Manager() { @@ -122,4 +128,23 @@ void ewol::object::Manager::workerRemove(const std::shared_ptr& _w ++it; } } -} \ No newline at end of file +} + +void ewol::object::Manager::timeCall(int64_t _localTime) { + int64_t previousTime = m_lastPeriodicCallTime; + m_lastPeriodicCallTime = _localTime; + if (periodicCall.getNumberConnected() <= 0) { + return; + } + float deltaTime = (float)(_localTime - previousTime)/1000000.0; + ewol::event::Time myTime(_localTime, m_applWakeUpTime, deltaTime, deltaTime); + periodicCall.emit(myTime); +} + +void ewol::object::Manager::timeCallResume(int64_t _localTime) { + m_lastPeriodicCallTime = _localTime; +} + +bool ewol::object::Manager::timeCallHave() { + return periodicCall.getNumberConnected() > 0; +} diff --git a/sources/ewol/object/Manager.h b/sources/ewol/object/Manager.h index 046dd6cc..21dc98b8 100644 --- a/sources/ewol/object/Manager.h +++ b/sources/ewol/object/Manager.h @@ -11,11 +11,13 @@ #include #include +#include +#include namespace ewol { class Context; namespace object { - class Manager { + class Manager : public ewol::object::SignalList { private: std::vector> m_eObjectList; // all widget allocated == > all time increment ... never removed ... Context& m_context; @@ -75,6 +77,28 @@ namespace ewol { * @param[in] _worker Worker to add in the list. */ void workerRemove(const std::shared_ptr& _worker); + public: + ewol::object::Signal periodicCall; + private: + int64_t m_applWakeUpTime; //!< Time of the application initialize + int64_t m_lastPeriodicCallTime; //!< last call time ... + public: // ewol system internal : + /** + * @brief Call every time we can with the current time + * @param[in] _localTime Current system Time. + */ + void timeCall(int64_t _localTime); + /** + * @brief If the application is suspended The Ewol Object manager does not know it, just call this to update delta call + * @param[in] _localTime Current system Time. + */ + void timeCallResume(int64_t _localTime); + /** + * @breif check if the Interface have some user that request a periodic call + * @return true, have some periodic event... + */ + bool timeCallHave(); + }; }; }; diff --git a/sources/ewol/object/Signal.h b/sources/ewol/object/Signal.h index 836bd61b..69dfd063 100644 --- a/sources/ewol/object/Signal.h +++ b/sources/ewol/object/Signal.h @@ -208,6 +208,9 @@ namespace ewol { m_callerListInCallback.clear(); } } + size_t getNumberConnected() { + return m_callerList.size(); + } }; #undef __class__ #define __class__ "object::Signal" @@ -269,7 +272,7 @@ namespace ewol { } } template - void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE2), TYPE2 _param1, TYPE3 _param2) { + void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE3), TYPE2 _param1, TYPE3 _param2) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); @@ -386,6 +389,9 @@ namespace ewol { m_callerListInCallback.clear(); } } + size_t getNumberConnected() { + return m_callerList.size(); + } }; #undef __class__ #define __class__ nullptr diff --git a/sources/ewol/widget/Button.cpp b/sources/ewol/widget/Button.cpp index bbd0371f..511d4e69 100644 --- a/sources/ewol/widget/Button.cpp +++ b/sources/ewol/widget/Button.cpp @@ -92,6 +92,7 @@ void ewol::widget::Button::onRegenerateDisplay() { m_size, vec2ClipInt32(m_selectableAreaPos+vec2(padding.xLeft(),padding.yButtom()) ), vec2ClipInt32(m_selectableAreaSize-vec2(padding.x(),padding.y()) ) ); + //EWOL_ERROR("pos=" << m_origin << " size=" << m_size); } bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) { diff --git a/sources/ewol/widget/Manager.cpp b/sources/ewol/widget/Manager.cpp index a385691b..dbd45161 100644 --- a/sources/ewol/widget/Manager.cpp +++ b/sources/ewol/widget/Manager.cpp @@ -34,13 +34,8 @@ ewol::widget::Manager::Manager() : m_havePeriodic(false), - m_haveRedraw(true), - m_applWakeUpTime(0), - m_lastPeriodicCallTime(0) { + m_haveRedraw(true) { EWOL_DEBUG(" == > init Widget-Manager"); - // set the basic time properties : - m_applWakeUpTime = ewol::getTime(); - m_lastPeriodicCallTime = ewol::getTime(); ewol::widget::Button::createManagerWidget(*this); ewol::widget::ButtonColor::createManagerWidget(*this); @@ -68,7 +63,6 @@ ewol::widget::Manager::~Manager() { focusSetDefault(nullptr); focusRelease(); - m_listOfPeriodicWidget.clear(); m_creatorList.clear(); } @@ -163,53 +157,7 @@ void ewol::widget::Manager::focusRemoveIfRemove(const std::shared_ptr& _pWidget) { - if (_pWidget == nullptr) { - return; - } - m_havePeriodic = true; - for (auto &it : m_listOfPeriodicWidget) { - if (it.lock() == _pWidget) { - return; - } - } - for (auto &it : m_listOfPeriodicWidget) { - if (it.expired() == true) { - it = _pWidget; - return; - } - } - m_listOfPeriodicWidget.push_back(_pWidget); -} - -void ewol::widget::Manager::periodicCallRm(const std::shared_ptr& _pWidget) { - for (auto &it : m_listOfPeriodicWidget) { - if (it.lock() == _pWidget) { - it.reset(); - } - } - periodicCallUpdateCount(); -} - -void ewol::widget::Manager::periodicCallUpdateCount() { - int32_t nbElement = 0; - for (auto &it : m_listOfPeriodicWidget) { - if (it.expired() == false) { - nbElement++; - } - } - if (0 == nbElement) { - m_havePeriodic = false; - } else { - m_havePeriodic = true; - } -} - - -void ewol::widget::Manager::periodicCallResume(int64_t _localTime) { - m_lastPeriodicCallTime = _localTime; -} - +/* void ewol::widget::Manager::periodicCall(int64_t _localTime) { int64_t previousTime = m_lastPeriodicCallTime; m_lastPeriodicCallTime = _localTime; @@ -246,10 +194,8 @@ void ewol::widget::Manager::periodicCall(int64_t _localTime) { } } } +*/ -bool ewol::widget::Manager::periodicCallHave() { - return m_havePeriodic; -} void ewol::widget::Manager::markDrawingIsNeeded() { m_haveRedraw = true; diff --git a/sources/ewol/widget/Manager.h b/sources/ewol/widget/Manager.h index 1e8fce03..f3bcea8b 100644 --- a/sources/ewol/widget/Manager.h +++ b/sources/ewol/widget/Manager.h @@ -24,12 +24,9 @@ namespace ewol { // For the focus Management std::weak_ptr m_focusWidgetDefault; std::weak_ptr m_focusWidgetCurrent; - std::vector> m_listOfPeriodicWidget; bool m_havePeriodic; bool m_haveRedraw; etk::Hash m_creatorList; - int64_t m_applWakeUpTime; //!< Time of the application initialize - int64_t m_lastPeriodicCallTime; //!< last call time ... public: Manager(); virtual ~Manager(); @@ -40,12 +37,6 @@ namespace ewol { std::shared_ptr focusGet(); void focusRemoveIfRemove(const std::shared_ptr& _newWidget); - void periodicCallAdd(const std::shared_ptr& _pWidget); - void periodicCallRm(const std::shared_ptr& _pWidget); - void periodicCall(int64_t _localTime); - void periodicCallResume(int64_t _localTime); - bool periodicCallHave(); - void markDrawingIsNeeded(); bool isDrawingNeeded(); diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 3899aa64..23e5b6a8 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -103,8 +103,6 @@ ewol::Widget::Widget() : m_canFocus(*this, "focus", false, "enable the widget to have the focus capacity"), // TODO : je pense que c'est une erreur, c'st surement un event to get the cocus ... m_limitMouseEvent(3), m_allowRepeateKeyboardEvent(true), - m_periodicCallDeltaTime(-1), - m_periodicCallTime(0), signalShortcut(*this, "shortcut"), m_needRegenerateDisplay(true), m_grabCursor(false), @@ -310,19 +308,11 @@ void ewol::Widget::systemDraw(const ewol::DrawProperty& _displayProp) { } void ewol::Widget::periodicCallDisable() { - m_periodicCallDeltaTime=0; - m_periodicCallTime=-1; - getWidgetManager().periodicCallRm(std::dynamic_pointer_cast(shared_from_this())); + getObjectManager().periodicCall.release(shared_from_this()); } -void ewol::Widget::periodicCallEnable(float _callInSecond) { - if (_callInSecond < 0) { - periodicCallDisable(); - } else { - getWidgetManager().periodicCallAdd(std::dynamic_pointer_cast(shared_from_this())); - m_periodicCallDeltaTime = _callInSecond*1000000.0; - m_periodicCallTime = ewol::getTime(); - } +void ewol::Widget::periodicCallEnable() { + getObjectManager().periodicCall.bind(shared_from_this(), &ewol::Widget::periodicCall); } void ewol::Widget::markToRedraw() { diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index 800f28cd..ca0190ab 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -472,41 +472,17 @@ namespace ewol { // ---------------------------------------------------------------------------------------------------------------- // -- periodic call Area // ---------------------------------------------------------------------------------------------------------------- - private: - int64_t m_periodicCallDeltaTime; //!< -1 : disable / 0 : every time / else in US - int64_t m_periodicCallTime; //!< Last call time protected: + // TODO : Remove this API ==> deprecated since 28/10/2014 /** * @brief disable the periodic call. */ void periodicCallDisable(); /** * @brief disable the periodic call. - * @param[in] _callInSecond periodic call in second (float) */ - void periodicCallEnable(float _callInSecond=0); + void periodicCallEnable(); public: - /** - * @brief {SYSTEM} get a reference of the periodic call delta time - * @return the perodic time delta call -1 : disable / 0 : every time / else in US - */ - int64_t systemGetCallDeltaTime() const { - return m_periodicCallDeltaTime; - }; - /** - * @brief {SYSTEM} get a reference of the periodic call time - * @return Last call from the periodic call - */ - int64_t systemGetLastCallTime() const { - return m_periodicCallTime; - }; - /** - * @brief {SYSTEM} get a reference of the periodic call time - * @return Last call from the periodic call - */ - void systemSetLastCallTime(int64_t _time) { - m_periodicCallTime=_time; - }; /** * @brief periodic call of this widget * @param _event Current time property From dbecf900be607a51139ae13f4eacd728fb17772b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 28 Oct 2014 22:04:32 +0100 Subject: [PATCH 10/57] [DEBUG] gcc build error --- external/ege | 2 +- sources/ewol/event/Time.cpp | 21 ++++++----- sources/ewol/openGL/openGL.cpp | 67 ++++++++++++++++++++++++++++++++-- sources/ewol/openGL/openGL.h | 2 + 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/external/ege b/external/ege index 9930ce56..e9483bd0 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 9930ce56c42052db422eef3de0d5494d3ccd3f10 +Subproject commit e9483bd0caaa64a7c9d72a5807d05f8663bc3e17 diff --git a/sources/ewol/event/Time.cpp b/sources/ewol/event/Time.cpp index 14f4952a..e352e26d 100644 --- a/sources/ewol/event/Time.cpp +++ b/sources/ewol/event/Time.cpp @@ -20,12 +20,15 @@ std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Tim return _os; } -template<> std::string etk::to_string(ewol::event::Time const& _obj) { - std::string out; - out = "{[ewol::event::Time]time=" + etk::to_string(_obj.getTime()); - out += ";uptime=" + etk::to_string(_obj.getApplUpTime()); - out += ";delta=" + etk::to_string(_obj.getDelta()); - out += ";deltaCall=" + etk::to_string(_obj.getDeltaCall()); - out += "}"; - return out; -} \ No newline at end of file +namespace etk { + template<> std::string to_string(ewol::event::Time const& _obj) { + std::string out; + out = "{[ewol::event::Time]time=" + etk::to_string(_obj.getTime()); + out += ";uptime=" + etk::to_string(_obj.getApplUpTime()); + out += ";delta=" + etk::to_string(_obj.getDelta()); + out += ";deltaCall=" + etk::to_string(_obj.getDeltaCall()); + out += "}"; + return out; + } +} + diff --git a/sources/ewol/openGL/openGL.cpp b/sources/ewol/openGL/openGL.cpp index 4c5dc3da..a8ee220a 100644 --- a/sources/ewol/openGL/openGL.cpp +++ b/sources/ewol/openGL/openGL.cpp @@ -10,7 +10,7 @@ #include #include #include - +//#define DIRECT_MODE /** * @brief get the draw mutex (ewol render). * @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time. @@ -117,7 +117,53 @@ void ewol::openGL::swap() { } -//#define DIRECT_MODE + +std::ostream& ewol::operator <<(std::ostream& _os, const enum openGL::openGlFlags& _obj) { + static std::vector> list = { + std::make_pair(openGL::FLAG_BLEND, "FLAG_BLEND"), + std::make_pair(openGL::FLAG_CLIP_DISTANCE_I, "FLAG_CLIP_DISTANCE_I"), + std::make_pair(openGL::FLAG_COLOR_LOGIC_OP, "FLAG_COLOR_LOGIC_OP"), + std::make_pair(openGL::FLAG_CULL_FACE, "FLAG_CULL_FACE"), + std::make_pair(openGL::FLAG_DEBUG_OUTPUT, "FLAG_DEBUG_OUTPUT"), + std::make_pair(openGL::FLAG_DEBUG_OUTPUT_SYNCHRONOUS, "FLAG_DEBUG_OUTPUT_SYNCHRONOUS"), + std::make_pair(openGL::FLAG_DEPTH_CLAMP, "FLAG_DEPTH_CLAMP"), + std::make_pair(openGL::FLAG_DEPTH_TEST, "FLAG_DEPTH_TEST"), + std::make_pair(openGL::FLAG_DITHER, "FLAG_DITHER"), + std::make_pair(openGL::FLAG_FRAMEBUFFER_SRGB, "FLAG_FRAMEBUFFER_SRGB"), + std::make_pair(openGL::FLAG_LINE_SMOOTH, "FLAG_LINE_SMOOTH"), + std::make_pair(openGL::FLAG_MULTISAMPLE, "FLAG_MULTISAMPLE"), + std::make_pair(openGL::FLAG_POLYGON_OFFSET_FILL, "FLAG_POLYGON_OFFSET_FILL"), + std::make_pair(openGL::FLAG_POLYGON_OFFSET_LINE, "FLAG_POLYGON_OFFSET_LINE"), + std::make_pair(openGL::FLAG_POLYGON_OFFSET_POINT, "FLAG_POLYGON_OFFSET_POINT"), + std::make_pair(openGL::FLAG_POLYGON_SMOOTH, "FLAG_POLYGON_SMOOTH"), + std::make_pair(openGL::FLAG_PRIMITIVE_RESTART, "FLAG_PRIMITIVE_RESTART"), + std::make_pair(openGL::FLAG_PRIMITIVE_RESTART_FIXED_INDEX, "FLAG_PRIMITIVE_RESTART_FIXED_INDEX"), + std::make_pair(openGL::FLAG_SAMPLE_ALPHA_TO_COVERAGE, "FLAG_SAMPLE_ALPHA_TO_COVERAGE"), + std::make_pair(openGL::FLAG_SAMPLE_ALPHA_TO_ONE, "FLAG_SAMPLE_ALPHA_TO_ONE"), + std::make_pair(openGL::FLAG_SAMPLE_COVERAGE, "FLAG_SAMPLE_COVERAGE"), + std::make_pair(openGL::FLAG_SAMPLE_SHADING, "FLAG_SAMPLE_SHADING"), + std::make_pair(openGL::FLAG_SAMPLE_MASK, "FLAG_SAMPLE_MASK"), + std::make_pair(openGL::FLAG_SCISSOR_TEST, "FLAG_SCISSOR_TEST"), + std::make_pair(openGL::FLAG_STENCIL_TEST, "FLAG_STENCIL_TEST"), + std::make_pair(openGL::FLAG_PROGRAM_POINT_SIZE, "FLAG_PROGRAM_POINT_SIZE"), + std::make_pair(openGL::FLAG_TEXTURE_2D, "FLAG_TEXTURE_2D"), + std::make_pair(openGL::FLAG_ALPHA_TEST, "FLAG_ALPHA_TEST"), + std::make_pair(openGL::FLAG_FOG, "FLAG_FOG") + }; + _os << "{"; + bool hasOne = false; + for (auto &it : list) { + if ((_obj & it.first) != 0) { + if (hasOne==true) { + _os << ","; + } + _os << it.second; + hasOne = true; + } + } + _os << "}"; + return _os; +} typedef struct { uint32_t curentFlag; @@ -182,8 +228,19 @@ static correspondenceTable_ts basicFlag[] = { }; static int32_t basicFlagCount = sizeof(basicFlag) / sizeof(correspondenceTable_ts); +void ewol::openGL::reset() { + #ifdef DIRECT_MODE + EWOL_TODO("..."); + #else + l_flagsMustBeSet = 0; + l_programId = -1; + l_textureflags = 0; + updateAllFlags(); + #endif +} void ewol::openGL::enable(enum ewol::openGL::openGlFlags _flagID) { + //EWOL_INFO("Enable : " << _flagID); #ifdef DIRECT_MODE for (int32_t iii=0; iii" << l_flagsMustBeSet); + //EWOL_INFO("real flag set : " << l_flagsMustBeSet); for (int32_t iii=0; iii Date: Tue, 28 Oct 2014 23:13:38 +0100 Subject: [PATCH 11/57] [DEV] remove specificity of signal to Object to shared_ptr --- sources/ewol/object/Signal.h | 90 +++++++++++++++--------------- sources/ewol/object/SignalBase.h | 2 +- sources/ewol/object/SignalList.cpp | 2 +- sources/ewol/object/SignalList.h | 2 +- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/sources/ewol/object/Signal.h b/sources/ewol/object/Signal.h index 69dfd063..912fb3e9 100644 --- a/sources/ewol/object/Signal.h +++ b/sources/ewol/object/Signal.h @@ -22,9 +22,9 @@ namespace ewol { #define __class__ "object::Signal" template class Signal : public SignalBase { private: - std::vector, + std::vector, std::function>> m_callerList; // current list of binded element - std::vector, + std::vector, std::function>> m_callerListInCallback; // temporaty list (when add one in call process) public: /** @@ -63,44 +63,44 @@ namespace ewol { m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, args2))); } */ - template - void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&)) { + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&)) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); return; } if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); } } // TODO : Rework this when I understand the use of variadic template with std::function - template - void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&), TYPE2 _param1) { + template + void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&), TYPE2 _param1) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); return; } if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); } } - template - void bind2(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&, const TYPE3&), TYPE2 _param1, TYPE3 _param2) { + template + void bind2(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&, const TYPE3&), TYPE2 _param1, TYPE3 _param2) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); return; } if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); } } /** @@ -109,18 +109,18 @@ namespace ewol { * @param[in] _func functor to call (do it yourself) * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); */ - void connect(std::shared_ptr _obj, std::function _function ) { + void connect(std::shared_ptr _obj, std::function _function ) { if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); } } /** * @brief remove link on the signal. * @param[in] _obj shared pointer on the removing object */ - void release(std::shared_ptr _obj) { + void release(std::shared_ptr _obj) { if (m_callInProgress == 0) { // Remove from the list : auto it(m_callerList.begin()); @@ -160,7 +160,7 @@ namespace ewol { void emit(const T& _data) { m_signalCallLeval++; m_callInProgress++; - #ifdef DEBUG + #if 0 int32_t tmpID = m_uidSignal++; ewol::Object* srcObject = dynamic_cast(&m_objectLink); if (srcObject != nullptr) { @@ -170,13 +170,13 @@ namespace ewol { } #endif for (auto &it : m_callerList) { - std::shared_ptr destObject = it.first.lock(); + std::shared_ptr destObject = it.first.lock(); if (destObject == nullptr) { // TODO : Remove instance ... EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " nullptr dest"); continue; } - #ifdef DEBUG + #if 0 if (srcObject != nullptr) { EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); } else { @@ -216,8 +216,8 @@ namespace ewol { #define __class__ "object::Signal" template<> class Signal : public SignalBase { private: - std::vector, std::function>> m_callerList; - std::vector, std::function>> m_callerListInCallback; + std::vector, std::function>> m_callerList; + std::vector, std::function>> m_callerListInCallback; public: /** * @brief Create a parameter with a specific type. @@ -245,43 +245,43 @@ namespace ewol { * @param[in] _func Link on the fuction that might be called (inside a class) * @example signalXXXX.connect(shared_from_this(), &ClassName::onCallbackXXX); */ - template - void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); return; } if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); } } - template - void bind1(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2), TYPE2 _param1) { + template + void bind1(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2), TYPE2 _param1) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); return; } if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); } } - template - void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE3), TYPE2 _param1, TYPE3 _param2) { + template + void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE3), TYPE2 _param1, TYPE3 _param2) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); return; } if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); } } /** @@ -290,24 +290,24 @@ namespace ewol { * @param[in] _func functor to call (do it yourself) * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); */ - void connect(std::shared_ptr _obj, std::function _function ) { + void connect(std::shared_ptr _obj, std::function _function ) { if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); } } /** * @brief remove link on the signal. * @param[in] _obj shared pointer on the removing object */ - void release(std::shared_ptr _obj) { + void release(std::shared_ptr _obj) { auto it(m_callerList.begin()); if (m_callInProgress == 0) { // Remove from the list : while(it != m_callerList.end()) { if (it->first.lock() == _obj) { - EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "'"); + //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "'"); it = m_callerList.erase(it); } else { ++it; @@ -317,7 +317,7 @@ namespace ewol { // just remove weak poointer while(it != m_callerList.end()) { if (it->first.lock() == _obj) { - EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (delayed)"); + //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (delayed)"); it->first.reset(); } else { ++it; @@ -329,7 +329,7 @@ namespace ewol { it = m_callerListInCallback.begin(); while(it != m_callerListInCallback.end()) { if (it->first.lock() == _obj) { - EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (notActive)"); + //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (notActive)"); it = m_callerListInCallback.erase(it); } else { ++it; @@ -339,7 +339,7 @@ namespace ewol { void emit() { m_callInProgress++; m_signalCallLeval++; - #ifdef DEBUG + #if 0 int32_t tmpID = m_uidSignal++; ewol::Object* srcObject = dynamic_cast(&m_objectLink); if (srcObject != nullptr) { @@ -349,13 +349,13 @@ namespace ewol { } #endif for (auto &it : m_callerList) { - std::shared_ptr destObject = it.first.lock(); + std::shared_ptr destObject = it.first.lock(); if (destObject == nullptr) { // TODO : Remove instance ... EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " nullptr dest"); continue; } - #ifdef DEBUG + #if 0 if (srcObject != nullptr) { EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); } else { diff --git a/sources/ewol/object/SignalBase.h b/sources/ewol/object/SignalBase.h index ed277468..637afd19 100644 --- a/sources/ewol/object/SignalBase.h +++ b/sources/ewol/object/SignalBase.h @@ -46,7 +46,7 @@ namespace ewol { const std::string& getDescription() const { return m_description; } - virtual void release(std::shared_ptr _obj) = 0; + virtual void release(std::shared_ptr _obj) = 0; }; std::ostream& operator <<(std::ostream& _os, const SignalBase& _obj); const char* logIndent(int32_t _iii); diff --git a/sources/ewol/object/SignalList.cpp b/sources/ewol/object/SignalList.cpp index d34e378b..7b69c6ae 100644 --- a/sources/ewol/object/SignalList.cpp +++ b/sources/ewol/object/SignalList.cpp @@ -40,7 +40,7 @@ std::vector ewol::object::SignalList::signalGetAll() const { return out; } -void ewol::object::SignalList::unBindAll(const std::shared_ptr& _object) { +void ewol::object::SignalList::unBindAll(const std::shared_ptr& _object) { if (_object == nullptr) { EWOL_ERROR("Input ERROR nullptr pointer Object ..."); return; diff --git a/sources/ewol/object/SignalList.h b/sources/ewol/object/SignalList.h index bac84c74..1d473ce8 100644 --- a/sources/ewol/object/SignalList.h +++ b/sources/ewol/object/SignalList.h @@ -44,7 +44,7 @@ namespace ewol { * @brief Remove binding on all event class. * @param[in] _object Object to unlink. */ - void unBindAll(const std::shared_ptr& _object); + void unBindAll(const std::shared_ptr& _object); }; }; }; From 656fe783d438895084b264ec28ac99bce7f420d3 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 29 Oct 2014 21:05:49 +0100 Subject: [PATCH 12/57] [DEV] set signal agnostic from other API just depend on shared_ptr --- sources/ewol/object/Manager.h | 6 +- sources/ewol/object/Object.h | 36 +- sources/ewol/object/Signal.h | 400 ------------------ sources/ewol/object/SignalBase.cpp | 41 -- sources/ewol/signal/Base.cpp | 43 ++ .../{object/SignalBase.h => signal/Base.h} | 24 +- .../SignalList.cpp => signal/List.cpp} | 16 +- .../{object/SignalList.h => signal/List.h} | 20 +- sources/ewol/signal/Signal.h | 303 +++++++++++++ sources/ewol/widget/Button.h | 14 +- sources/ewol/widget/ButtonColor.h | 4 +- sources/ewol/widget/CheckBox.h | 12 +- sources/ewol/widget/ColorBar.h | 4 +- sources/ewol/widget/Entry.h | 8 +- sources/ewol/widget/Image.h | 4 +- sources/ewol/widget/Joystick.h | 8 +- sources/ewol/widget/Label.h | 4 +- sources/ewol/widget/ListFileSystem.h | 10 +- sources/ewol/widget/Menu.cpp | 4 +- sources/ewol/widget/Menu.h | 2 +- sources/ewol/widget/Slider.h | 4 +- sources/ewol/widget/WSlider.h | 6 +- sources/ewol/widget/Widget.h | 10 +- sources/ewol/widget/meta/ColorChooser.h | 4 +- sources/ewol/widget/meta/FileChooser.h | 6 +- sources/ewol/widget/meta/Parameter.h | 2 +- sources/ewol/widget/meta/ParameterList.h | 2 +- sources/lutin_ewol.py | 9 +- 28 files changed, 448 insertions(+), 558 deletions(-) delete mode 100644 sources/ewol/object/Signal.h delete mode 100644 sources/ewol/object/SignalBase.cpp create mode 100644 sources/ewol/signal/Base.cpp rename sources/ewol/{object/SignalBase.h => signal/Base.h} (66%) rename sources/ewol/{object/SignalList.cpp => signal/List.cpp} (63%) rename sources/ewol/{object/SignalList.h => signal/List.h} (66%) create mode 100644 sources/ewol/signal/Signal.h diff --git a/sources/ewol/object/Manager.h b/sources/ewol/object/Manager.h index 21dc98b8..fd4ee3c4 100644 --- a/sources/ewol/object/Manager.h +++ b/sources/ewol/object/Manager.h @@ -11,13 +11,13 @@ #include #include -#include +#include #include namespace ewol { class Context; namespace object { - class Manager : public ewol::object::SignalList { + class Manager : public ewol::signal::List { private: std::vector> m_eObjectList; // all widget allocated == > all time increment ... never removed ... Context& m_context; @@ -78,7 +78,7 @@ namespace ewol { */ void workerRemove(const std::shared_ptr& _worker); public: - ewol::object::Signal periodicCall; + ewol::Signal periodicCall; private: int64_t m_applWakeUpTime; //!< Time of the application initialize int64_t m_lastPeriodicCallTime; //!< last call time ... diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 223cd9bb..6947c3a0 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -29,7 +29,7 @@ namespace ewol { #include #include #include -#include +#include #define DECLARE_FACTORY(className) \ template static std::shared_ptr create( T&& ... all ) { \ @@ -52,7 +52,7 @@ namespace ewol { */ class Object : public std::enable_shared_from_this, public ewol::object::ParameterList, - public ewol::object::SignalList { + public ewol::signal::List { private: static size_t m_valUID; //!< Static used for the unique ID definition private: @@ -222,32 +222,16 @@ namespace ewol { /** * @brief link on an signal in the subwiget with his name */ - #define subBind(_type, _name, _event, _obj, _func) do {\ + #define subBind(_type, _name, _event, _shared_ptr, _func, ...) do {\ std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \ if (myObject != nullptr) { \ - myObject->_event.bind(_obj, _func); \ - } else { \ - EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ - } \ - } while (false) - #define subBind1(_type, _name, _event, _obj, _func, _param1) do {\ - std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \ - if (myObject != nullptr) { \ - myObject->_event.bind1(_obj, _func, _param1); \ - } else { \ - EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ - } \ - } while (false) - #define subBind2(_type, _name, _event, _obj, _func, _param1, _param2) do {\ - std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(getSubObjectNamed(_name)); \ - if (myObject != nullptr) { \ - myObject->_event.bind2(_obj, _func, _param1, _param2); \ + myObject->_event.bind(_shared_ptr, _func, ##__VA_ARGS__); \ } else { \ EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ } \ } while (false) /* - template void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { + template void subBind(std::shared_ptr _obj, void (TYPE::*_func)()) { std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); if (obj2 == nullptr) { EWOL_ERROR("Can not bind signal ..."); @@ -263,10 +247,10 @@ namespace ewol { /** * @brief link on an signal in the global object list with his name */ -#define globalBind(_type, _name, _event, _obj, _func) do {\ +#define globalBind(_type, _name, _event, _obj, _func, ...) do {\ std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(ewol::getContext().getEObjectManager().getObjectNamed(_name)); \ if (myObject != nullptr) { \ - myObject->_event.bind(_obj, _func); \ + myObject->_event.bind(_obj, _func, ##__VA_ARGS__); \ } else { \ EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ } \ @@ -275,15 +259,15 @@ namespace ewol { /** * @brief link on an signal in the subWidget of an object with his name */ -#define externSubBind(_object, _type, _name, _event, _obj, _func) do {\ +#define externSubBind(_object, _type, _name, _event, _obj, _func, ...) do {\ std::shared_ptr<_type> myObject = std::dynamic_pointer_cast<_type>(_object->getObjectNamed(_name)); \ if (myObject != nullptr) { \ - myObject->_event.bind(_obj, _func); \ + myObject->_event.bind(_obj, _func, ##__VA_ARGS__); \ } else { \ EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ } \ } while (false) -//#include +//#include #endif diff --git a/sources/ewol/object/Signal.h b/sources/ewol/object/Signal.h deleted file mode 100644 index 912fb3e9..00000000 --- a/sources/ewol/object/Signal.h +++ /dev/null @@ -1,400 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - -#ifndef __EWOL_SIGNAL_H__ -#define __EWOL_SIGNAL_H__ - -#include -#include -#include -#include - -namespace ewol { - namespace object { - #undef __class__ - #define __class__ "object::Signal" - template class Signal : public SignalBase { - private: - std::vector, - std::function>> m_callerList; // current list of binded element - std::vector, - std::function>> m_callerListInCallback; // temporaty list (when add one in call process) - public: - /** - * @brief Create a parameter with a specific type. - * @param[in] _objectLink reference on the parameter lister. - * @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. - * @param[in] _description description of the parameter. - */ - Signal(ewol::object::SignalList& _objectLink, - const std::string& _name, - const std::string& _description = "") : - SignalBase(_objectLink, _name, _description) { - - }; - /** - * @brief Destructor. - */ - virtual ~Signal() { }; - /** - * @brief Bind a callback function to the current signal (generic methis (simplest)) - * @param[in] _obj Shared pointer on the caller object - * @param[in] _func Link on the fuction that might be called (inside a class) - * @example signalXXXX.bind(shared_from_this(), &ClassName::onCallbackXXX); - */ - /* Maybe later : - template - void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&, TArgs...), TArgs... args2) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, args2))); - } - */ - template - void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&)) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1))); - } - } - // TODO : Rework this when I understand the use of variadic template with std::function - template - void bind1(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&), TYPE2 _param1) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1))); - } - } - template - void bind2(std::shared_ptr _obj, void (TYPE::*_func)(const T&, const TYPE2&, const TYPE3&), TYPE2 _param1, TYPE3 _param2) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, _param1, _param2))); - } - } - /** - * @brief Advanced binding a callback function to the current signal. - * @param[in] _obj Shared pointer on the caller object - * @param[in] _func functor to call (do it yourself) - * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); - */ - void connect(std::shared_ptr _obj, std::function _function ) { - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); - } - } - /** - * @brief remove link on the signal. - * @param[in] _obj shared pointer on the removing object - */ - void release(std::shared_ptr _obj) { - if (m_callInProgress == 0) { - // Remove from the list : - auto it(m_callerList.begin()); - while(it != m_callerList.end()) { - if (it->first.lock() == _obj) { - it = m_callerList.erase(it); - } else { - ++it; - } - } - } else { - // just remove weak poointer - auto it(m_callerList.begin()); - while(it != m_callerList.end()) { - if (it->first.lock() == _obj) { - it->first.reset(); - } else { - ++it; - } - } - m_someOneRemoveInCall = true; - } - // remove from add list in callback progress - auto it = m_callerListInCallback.begin(); - while(it != m_callerListInCallback.end()) { - if (it->first.lock() == _obj) { - it = m_callerListInCallback.erase(it); - } else { - ++it; - } - } - } - /** - * @brief Generate a signal on all interface listening. - * @param[in] _data data to emit - */ - void emit(const T& _data) { - m_signalCallLeval++; - m_callInProgress++; - #if 0 - int32_t tmpID = m_uidSignal++; - ewol::Object* srcObject = dynamic_cast(&m_objectLink); - if (srcObject != nullptr) { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' data='" << etk::to_string(_data) << "' to: " << m_callerList.size() << " element(s)"); - } else { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : signal='" << m_name << "' data='" << etk::to_string(_data) << "' to: " << m_callerList.size() << " element(s)"); - } - #endif - for (auto &it : m_callerList) { - std::shared_ptr destObject = it.first.lock(); - if (destObject == nullptr) { - // TODO : Remove instance ... - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " nullptr dest"); - continue; - } - #if 0 - if (srcObject != nullptr) { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); - } else { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); - } - #endif - it.second(_data); - } - m_callInProgress--; - m_signalCallLeval--; - // Remove element in call phase: - if (m_someOneRemoveInCall == true) { - m_someOneRemoveInCall = false; - // Remove from the list : - auto it(m_callerList.begin()); - while(it != m_callerList.end()) { - if (it->first.expired() == true) { - it = m_callerList.erase(it); - } else { - ++it; - } - } - } - // add element in call phase: - if (m_callerListInCallback.size() > 0) { - for (auto &it : m_callerListInCallback) { - m_callerList.push_back(it); - } - m_callerListInCallback.clear(); - } - } - size_t getNumberConnected() { - return m_callerList.size(); - } - }; - #undef __class__ - #define __class__ "object::Signal" - template<> class Signal : public SignalBase { - private: - std::vector, std::function>> m_callerList; - std::vector, std::function>> m_callerListInCallback; - public: - /** - * @brief Create a parameter with a specific type. - * @param[in] _objectLink reference on the parameter lister. - * @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. - * @param[in] _description description of the parameter. - */ - Signal(ewol::object::SignalList& _objectLink, - const std::string& _name, - const std::string& _description = "") : - SignalBase(_objectLink, _name, _description) { - - }; - /** - * @brief Destructor. - */ - virtual ~Signal() { }; - - /** - * @brief Bind a callback function to the current signal (generic methis (simplest)) - * @param[in] _obj Shared pointer on the caller object - * @param[in] _func Link on the fuction that might be called (inside a class) - * @example signalXXXX.connect(shared_from_this(), &ClassName::onCallbackXXX); - */ - template - void bind(std::shared_ptr _obj, void (TYPE::*_func)()) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get()))); - } - } - template - void bind1(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2), TYPE2 _param1) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1))); - } - } - template - void bind2(std::shared_ptr _obj, void (TYPE::*_func)(TYPE2, TYPE3), TYPE2 _param1, TYPE3 _param2) { - std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); - if (obj2 == nullptr) { - EWOL_ERROR("Can not bind signal ..."); - return; - } - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), _param1, _param2))); - } - } - /** - * @brief Advanced binding a callback function to the current signal. - * @param[in] _obj Shared pointer on the caller object - * @param[in] _func functor to call (do it yourself) - * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); - */ - void connect(std::shared_ptr _obj, std::function _function ) { - if (m_callInProgress == 0) { - m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); - } else { - m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); - } - } - /** - * @brief remove link on the signal. - * @param[in] _obj shared pointer on the removing object - */ - void release(std::shared_ptr _obj) { - auto it(m_callerList.begin()); - if (m_callInProgress == 0) { - // Remove from the list : - while(it != m_callerList.end()) { - if (it->first.lock() == _obj) { - //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "'"); - it = m_callerList.erase(it); - } else { - ++it; - } - } - } else { - // just remove weak poointer - while(it != m_callerList.end()) { - if (it->first.lock() == _obj) { - //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (delayed)"); - it->first.reset(); - } else { - ++it; - } - } - m_someOneRemoveInCall = true; - } - // remove from add list in callback progress - it = m_callerListInCallback.begin(); - while(it != m_callerListInCallback.end()) { - if (it->first.lock() == _obj) { - //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (notActive)"); - it = m_callerListInCallback.erase(it); - } else { - ++it; - } - } - } - void emit() { - m_callInProgress++; - m_signalCallLeval++; - #if 0 - int32_t tmpID = m_uidSignal++; - ewol::Object* srcObject = dynamic_cast(&m_objectLink); - if (srcObject != nullptr) { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : " << srcObject->getObjectType() << " signal='" << m_name << "' BANG!!! to: " << m_callerList.size() << " element(s)"); - } else { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << "emit signal{" << tmpID << "} : signal='" << m_name << "' to: " << m_callerList.size() << " element(s)"); - } - #endif - for (auto &it : m_callerList) { - std::shared_ptr destObject = it.first.lock(); - if (destObject == nullptr) { - // TODO : Remove instance ... - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " nullptr dest"); - continue; - } - #if 0 - if (srcObject != nullptr) { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); - } else { - EWOL_DEBUG(ewol::object::logIndent(m_signalCallLeval-1) << " signal{" << tmpID << "} : [" << destObject->getId() << "]" << destObject->getObjectType()); - } - #endif - it.second(); - } - m_callInProgress--; - m_signalCallLeval--; - // Remove element in call phase: - if (m_someOneRemoveInCall == true) { - m_someOneRemoveInCall = false; - // Remove from the list : - auto it(m_callerList.begin()); - while(it != m_callerList.end()) { - if (it->first.expired() == true) { - it = m_callerList.erase(it); - } else { - ++it; - } - } - } - // add element in call phase: - if (m_callerListInCallback.size() > 0) { - for (auto &it : m_callerListInCallback) { - if (it.first.expired() == false) { - m_callerList.push_back(it); - } - } - m_callerListInCallback.clear(); - } - } - size_t getNumberConnected() { - return m_callerList.size(); - } - }; - #undef __class__ - #define __class__ nullptr - }; -}; -#endif diff --git a/sources/ewol/object/SignalBase.cpp b/sources/ewol/object/SignalBase.cpp deleted file mode 100644 index 90e1e821..00000000 --- a/sources/ewol/object/SignalBase.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include -#include -#include -#include - -int32_t ewol::object::SignalBase::m_uidSignal = 0; -int32_t ewol::object::SignalBase::m_signalCallLeval = 0; -ewol::object::SignalBase::SignalBase(ewol::object::SignalList& _objectLink, - const std::string& _name, - const std::string& _description) : - m_objectLink(_objectLink), - m_name(_name), - m_description(_description), - m_callInProgress(0), - m_someOneRemoveInCall(false) { - // add a reference on the current signal ... - m_objectLink.signalAdd(this); -} - -std::ostream& ewol::object::operator <<(std::ostream& _os, const ewol::object::SignalBase& _obj) { - _os << _obj.getName(); - return _os; -} - - -const char* ewol::object::logIndent(int32_t _iii) { - static const char g_val[] = " "; - if (_iii > 5) { - return g_val; - } - return g_val + (5-_iii)*4; -} \ No newline at end of file diff --git a/sources/ewol/signal/Base.cpp b/sources/ewol/signal/Base.cpp new file mode 100644 index 00000000..e05872de --- /dev/null +++ b/sources/ewol/signal/Base.cpp @@ -0,0 +1,43 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include +#include + +#ifdef DEBUG + int32_t ewol::signal::Base::m_uidSignal = 0; + int32_t ewol::signal::Base::m_signalCallLevel = 0; +#endif + +ewol::signal::Base::Base(ewol::signal::List& _signalLink, + const std::string& _name, + const std::string& _description) : + m_signalLink(_signalLink), + m_name(_name), + m_description(_description), + m_callInProgress(0), + m_someOneRemoveInCall(false) { + // add a reference on the current signal ... + m_signalLink.signalAdd(this); +} + +std::ostream& ewol::signal::operator <<(std::ostream& _os, const ewol::signal::Base& _obj) { + _os << _obj.getName(); + return _os; +} + + +const char* ewol::signal::logIndent(int32_t _iii) { + static const char g_val[] = " "; + if (_iii > 5) { + return g_val; + } + return g_val + (5-_iii)*4; +} \ No newline at end of file diff --git a/sources/ewol/object/SignalBase.h b/sources/ewol/signal/Base.h similarity index 66% rename from sources/ewol/object/SignalBase.h rename to sources/ewol/signal/Base.h index 637afd19..5d26b29a 100644 --- a/sources/ewol/object/SignalBase.h +++ b/sources/ewol/signal/Base.h @@ -9,18 +9,18 @@ #ifndef __EWOL_SIGNAL_BASE_H__ #define __EWOL_SIGNAL_BASE_H__ -#include -#include -#include +#include namespace ewol { - namespace object { - class SignalBase { + namespace signal { + class Base { protected: - static int32_t m_uidSignal; - static int32_t m_signalCallLeval; - ewol::object::SignalList& m_objectLink; + #ifdef DEBUG + static int32_t m_uidSignal; + static int32_t m_signalCallLevel; + #endif + ewol::signal::List& m_signalLink; std::string m_name; std::string m_description; int32_t m_callInProgress; @@ -28,17 +28,17 @@ namespace ewol { public: /** * @brief Create a parameter with a specific type. - * @param[in] _objectLink reference on the parameter lister. + * @param[in] _signalListLink reference on the signal list. * @param[in] _name Static name of the parameter. * @param[in] _description description of the parameter. */ - SignalBase(ewol::object::SignalList& _objectLink, + Base(ewol::signal::List& _signalListLink, const std::string& _name, const std::string& _description = ""); /** * @brief Destructor. */ - virtual ~SignalBase() { }; + virtual ~Base() { }; const std::string& getName() const { return m_name; @@ -48,7 +48,7 @@ namespace ewol { } virtual void release(std::shared_ptr _obj) = 0; }; - std::ostream& operator <<(std::ostream& _os, const SignalBase& _obj); + std::ostream& operator <<(std::ostream& _os, const ewol::signal::Base& _obj); const char* logIndent(int32_t _iii); }; }; diff --git a/sources/ewol/object/SignalList.cpp b/sources/ewol/signal/List.cpp similarity index 63% rename from sources/ewol/object/SignalList.cpp rename to sources/ewol/signal/List.cpp index 7b69c6ae..e0875547 100644 --- a/sources/ewol/object/SignalList.cpp +++ b/sources/ewol/signal/List.cpp @@ -8,21 +8,19 @@ #include #include -#include -#include -#include -#include +#include +#include -ewol::object::SignalList::SignalList() { +ewol::signal::List::List() { } -ewol::object::SignalList::~SignalList() { +ewol::signal::List::~List() { m_list.clear(); } // note this pointer is not allocated and not free at the end of the class -void ewol::object::SignalList::signalAdd(SignalBase* _pointerOnSignal) { +void ewol::signal::List::signalAdd(ewol::signal::Base* _pointerOnSignal) { if (_pointerOnSignal == nullptr) { EWOL_ERROR("Try to link a nullptr parameters"); return; @@ -30,7 +28,7 @@ void ewol::object::SignalList::signalAdd(SignalBase* _pointerOnSignal) { m_list.push_back(_pointerOnSignal); } -std::vector ewol::object::SignalList::signalGetAll() const { +std::vector ewol::signal::List::signalGetAll() const { std::vector out; for (auto &it : m_list) { if(it != nullptr) { @@ -40,7 +38,7 @@ std::vector ewol::object::SignalList::signalGetAll() const { return out; } -void ewol::object::SignalList::unBindAll(const std::shared_ptr& _object) { +void ewol::signal::List::signalUnBindAll(const std::shared_ptr& _object) { if (_object == nullptr) { EWOL_ERROR("Input ERROR nullptr pointer Object ..."); return; diff --git a/sources/ewol/object/SignalList.h b/sources/ewol/signal/List.h similarity index 66% rename from sources/ewol/object/SignalList.h rename to sources/ewol/signal/List.h index 1d473ce8..0adab4f5 100644 --- a/sources/ewol/object/SignalList.h +++ b/sources/ewol/signal/List.h @@ -14,27 +14,27 @@ #include namespace ewol { - namespace object { - class SignalBase; - class SignalList { - friend class ewol::object::SignalBase; // to register parameter in the list. + namespace signal { + class Base; + class List { + friend class ewol::signal::Base; // to register parameter in the list. private: - std::vector m_list; //!< list of availlable Parameters + std::vector m_list; //!< list of availlable Parameters public: /** * @brief Constructor. */ - SignalList(); + List(); /** * @brief Destructor. */ - virtual ~SignalList(); + ~List(); /** * @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 signalAdd(SignalBase* _pointerOnParameter); + void signalAdd(ewol::signal::Base* _pointerOnParameter); /** * @brief Get All the signal list: * @return vector on all the signals names @@ -42,9 +42,9 @@ namespace ewol { std::vector signalGetAll() const; /** * @brief Remove binding on all event class. - * @param[in] _object Object to unlink. + * @param[in] _sharedPtr sharedPtr to unlink (no type needed ...). */ - void unBindAll(const std::shared_ptr& _object); + void signalUnBindAll(const std::shared_ptr& _sharedPtr); }; }; }; diff --git a/sources/ewol/signal/Signal.h b/sources/ewol/signal/Signal.h new file mode 100644 index 00000000..579d246d --- /dev/null +++ b/sources/ewol/signal/Signal.h @@ -0,0 +1,303 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_SIGNAL_H__ +#define __EWOL_SIGNAL_H__ + +#include +#include + +namespace ewol { + #undef __class__ + #define __class__ "Signal" + template class Signal : public signal::Base { + private: + std::vector, + std::function>> m_callerList; // current list of binded element + std::vector, + std::function>> m_callerListInCallback; // temporaty list (when add one in call process) + public: + /** + * @brief Create a parameter with a specific type. + * @param[in] _objectLink reference on the parameter lister. + * @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. + * @param[in] _description description of the parameter. + */ + Signal(ewol::signal::List& _objectLink, + const std::string& _name, + const std::string& _description = "") : + signal::Base(_objectLink, _name, _description) { + + }; + /** + * @brief Destructor. + */ + virtual ~Signal() { }; + /** + * @brief Bind a callback function to the current signal (generic methis (simplest)) + * @param[in] _obj Shared pointer on the caller object + * @param[in] _func Link on the fuction that might be called (inside a class) + * @example signalXXXX.bind(shared_from_this(), &ClassName::onCallbackXXX); + */ + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)(const T&, TArgs...), TArgs... args2) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, std::forward(args2)...))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::placeholders::_1, std::forward(args2)...))); + } + } + /** + * @brief Advanced binding a callback function to the current signal. + * @param[in] _obj Shared pointer on the caller object + * @param[in] _func functor to call (do it yourself) + * @example signalXXXX.connect(shared_from_this(), std::bind(&ClassName::onCallbackXXX, this, std::placeholders::_1)); + */ + void connect(std::shared_ptr _obj, std::function _function ) { + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), _function)); + } + } + /** + * @brief remove link on the signal. + * @param[in] _obj shared pointer on the removing object + */ + void release(std::shared_ptr _obj) { + if (m_callInProgress == 0) { + // Remove from the list : + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + it = m_callerList.erase(it); + } else { + ++it; + } + } + } else { + // just remove weak poointer + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + it->first.reset(); + } else { + ++it; + } + } + m_someOneRemoveInCall = true; + } + // remove from add list in callback progress + auto it = m_callerListInCallback.begin(); + while(it != m_callerListInCallback.end()) { + if (it->first.lock() == _obj) { + it = m_callerListInCallback.erase(it); + } else { + ++it; + } + } + } + /** + * @brief Generate a signal on all interface listening. + * @param[in] _data data to emit + */ + void emit(const T& _data) { + #ifdef DEBUG + m_signalCallLevel++; + int32_t tmpID = m_uidSignal++; + #endif + m_callInProgress++; + EWOL_DEBUG(ewol::signal::logIndent(m_signalCallLevel-1) << "emit signal{" << tmpID << "} : signal='" << m_name << "' data='" << etk::to_string(_data) << "' to: " << m_callerList.size() << " element(s)"); + auto it(m_callerList.begin()); + while (it != m_callerList.end()) { + std::shared_ptr destObject = it->first.lock(); + if (destObject == nullptr) { + it = m_callerList.erase(it); + EWOL_DEBUG(ewol::signal::logIndent(m_signalCallLevel-1) << " nullptr dest"); + continue; + } + EWOL_DEBUG(ewol::signal::logIndent(m_signalCallLevel-1) << " signal{" << tmpID << "} :");// [" << destObject->getId() << "]" << destObject->getObjectType()); + it->second(_data); + ++it; + } + m_callInProgress--; + #ifdef DEBUG + m_signalCallLevel--; + #endif + // Remove element in call phase: + if (m_someOneRemoveInCall == true) { + m_someOneRemoveInCall = false; + // Remove from the list : + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.expired() == true) { + it = m_callerList.erase(it); + } else { + ++it; + } + } + } + // add element in call phase: + if (m_callerListInCallback.size() > 0) { + for (auto &it : m_callerListInCallback) { + m_callerList.push_back(it); + } + m_callerListInCallback.clear(); + } + } + size_t getNumberConnected() { + return m_callerList.size(); + } + }; + #undef __class__ + #define __class__ "Signal" + template<> class Signal : public signal::Base { + private: + std::vector, std::function>> m_callerList; + std::vector, std::function>> m_callerListInCallback; + public: + /** + * @brief Create a parameter with a specific type. + * @param[in] _objectLink reference on the parameter lister. + * @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. + * @param[in] _description description of the parameter. + */ + Signal(ewol::signal::List& _objectLink, + const std::string& _name, + const std::string& _description = "") : + signal::Base(_objectLink, _name, _description) { + + }; + /** + * @brief Destructor. + */ + virtual ~Signal() { }; + + /** + * @brief Bind a callback function to the current signal (generic methis (simplest)) + * @param[in] _obj Shared pointer on the caller object + * @param[in] _func Link on the fuction that might be called (inside a class) + * @example signalXXXX.connect(shared_from_this(), &ClassName::onCallbackXXX); + */ + template + void bind(std::shared_ptr _obj, void (TYPE::*_func)(TArgs...), TArgs... args2) { + std::shared_ptr obj2 = std::dynamic_pointer_cast(_obj); + if (obj2 == nullptr) { + EWOL_ERROR("Can not bind signal ..."); + return; + } + if (m_callInProgress == 0) { + m_callerList.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::forward(args2)...))); + } else { + m_callerListInCallback.push_back(std::make_pair(std::weak_ptr(_obj), std::bind(_func, obj2.get(), std::forward(args2)...))); + } + } + /** + * @brief remove link on the signal. + * @param[in] _obj shared pointer on the removing object + */ + void release(std::shared_ptr _obj) { + auto it(m_callerList.begin()); + if (m_callInProgress == 0) { + // Remove from the list : + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "'"); + it = m_callerList.erase(it); + } else { + ++it; + } + } + } else { + // just remove weak poointer + while(it != m_callerList.end()) { + if (it->first.lock() == _obj) { + //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (delayed)"); + it->first.reset(); + } else { + ++it; + } + } + m_someOneRemoveInCall = true; + } + // remove from add list in callback progress + it = m_callerListInCallback.begin(); + while(it != m_callerListInCallback.end()) { + if (it->first.lock() == _obj) { + //EWOL_DEBUG(" unbind : " << _obj->getObjectType() << " signal='" << m_name << "' (notActive)"); + it = m_callerListInCallback.erase(it); + } else { + ++it; + } + } + } + void emit() { + #ifdef DEBUG + m_signalCallLevel++; + int32_t tmpID = m_uidSignal++; + #endif + m_callInProgress++; + EWOL_DEBUG(ewol::signal::logIndent(m_signalCallLevel-1) << "emit signal{" << tmpID << "} : signal='" << m_name << "' to: " << m_callerList.size() << " element(s)"); + auto it(m_callerList.begin()); + while (it != m_callerList.end()) { + std::shared_ptr destObject = it->first.lock(); + if (destObject == nullptr) { + it = m_callerList.erase(it); + EWOL_DEBUG(ewol::signal::logIndent(m_signalCallLevel-1) << " nullptr dest"); + continue; + } + EWOL_DEBUG(ewol::signal::logIndent(m_signalCallLevel-1) << " signal{" << tmpID << "} :");// [" << destObject->getId() << "]" << destObject->getObjectType()); + it->second(); + ++it; + } + m_callInProgress--; + #ifdef DEBUG + m_signalCallLevel--; + #endif + // Remove element in call phase: + if (m_someOneRemoveInCall == true) { + m_someOneRemoveInCall = false; + // Remove from the list : + auto it(m_callerList.begin()); + while(it != m_callerList.end()) { + if (it->first.expired() == true) { + it = m_callerList.erase(it); + } else { + ++it; + } + } + } + // add element in call phase: + if (m_callerListInCallback.size() > 0) { + for (auto &it : m_callerListInCallback) { + if (it.first.expired() == false) { + m_callerList.push_back(it); + } + } + m_callerListInCallback.clear(); + } + } + size_t getNumberConnected() { + return m_callerList.size(); + } + }; + #undef __class__ + #define __class__ nullptr +}; +#endif diff --git a/sources/ewol/widget/Button.h b/sources/ewol/widget/Button.h index 8a06404b..2fde7775 100644 --- a/sources/ewol/widget/Button.h +++ b/sources/ewol/widget/Button.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include @@ -30,12 +30,12 @@ namespace ewol { class Button : public ewol::widget::Container2 { public: // Event list of properties - ewol::object::Signal signalPressed; - ewol::object::Signal signalDown; - ewol::object::Signal signalUp; - ewol::object::Signal signalEnter; - ewol::object::Signal signalLeave; - ewol::object::Signal signalValue; + ewol::Signal signalPressed; + ewol::Signal signalDown; + ewol::Signal signalUp; + ewol::Signal signalEnter; + ewol::Signal signalLeave; + ewol::Signal signalValue; enum buttonLock{ lockNone, //!< normal status of the button lockWhenPressed, //!< When the state is set in pressed, the status stay in this one diff --git a/sources/ewol/widget/ButtonColor.h b/sources/ewol/widget/ButtonColor.h index 1f355b5d..ec527a27 100644 --- a/sources/ewol/widget/ButtonColor.h +++ b/sources/ewol/widget/ButtonColor.h @@ -17,14 +17,14 @@ #include #include #include -#include +#include namespace ewol { namespace widget { class ButtonColor : public ewol::Widget { public: // Event list of properties - ewol::object::Signal> signalChange; + ewol::Signal> signalChange; private: ewol::compositing::Shaper m_shaper; //!< Compositing theme. ewol::compositing::Text m_text; //!< Compositing Test display. diff --git a/sources/ewol/widget/CheckBox.h b/sources/ewol/widget/CheckBox.h index 20cbfeee..7bdd7d33 100644 --- a/sources/ewol/widget/CheckBox.h +++ b/sources/ewol/widget/CheckBox.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace ewol { @@ -22,11 +22,11 @@ namespace ewol { class CheckBox : public ewol::widget::Container2 { public: // Event list of properties - ewol::object::Signal signalPressed; - ewol::object::Signal signalDown; - ewol::object::Signal signalUp; - ewol::object::Signal signalEnter; - ewol::object::Signal signalValue; + ewol::Signal signalPressed; + ewol::Signal signalDown; + ewol::Signal signalUp; + ewol::Signal signalEnter; + ewol::Signal signalValue; private: ewol::object::Param m_shaper; //!< Compositing theme. bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). diff --git a/sources/ewol/widget/ColorBar.h b/sources/ewol/widget/ColorBar.h index 98a1f7ab..65bf3d2c 100644 --- a/sources/ewol/widget/ColorBar.h +++ b/sources/ewol/widget/ColorBar.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace ewol { @@ -22,7 +22,7 @@ namespace ewol { class ColorBar : public ewol::Widget { public: // Event list of properties - ewol::object::Signal> signalChange; + ewol::Signal> signalChange; protected: ColorBar(); void init(); diff --git a/sources/ewol/widget/Entry.h b/sources/ewol/widget/Entry.h index 19c30e60..67793fd0 100644 --- a/sources/ewol/widget/Entry.h +++ b/sources/ewol/widget/Entry.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -34,9 +34,9 @@ namespace ewol { */ class Entry : public ewol::Widget { public: - ewol::object::Signal signalClick; //!< bang on click the entry box - ewol::object::Signal signalEnter; //!< Enter key is pressed - ewol::object::Signal signalModify; //!< data change + ewol::Signal signalClick; //!< bang on click the entry box + ewol::Signal signalEnter; //!< Enter key is pressed + ewol::Signal signalModify; //!< data change private: ewol::object::Param m_shaper; int32_t m_colorIdTextFg; //!< color property of the text foreground diff --git a/sources/ewol/widget/Image.h b/sources/ewol/widget/Image.h index 0954722e..e9d9e538 100644 --- a/sources/ewol/widget/Image.h +++ b/sources/ewol/widget/Image.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -26,7 +26,7 @@ namespace ewol { class Image :public ewol::Widget { public: // Event list of properties - ewol::object::Signal signalPressed; + ewol::Signal signalPressed; protected: ewol::compositing::Image m_compositing; //!< compositing element of the image. std::shared_ptr m_colorProperty; //!< theme color property diff --git a/sources/ewol/widget/Joystick.h b/sources/ewol/widget/Joystick.h index a5cbff2d..9d0a0345 100644 --- a/sources/ewol/widget/Joystick.h +++ b/sources/ewol/widget/Joystick.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace ewol { @@ -24,9 +24,9 @@ namespace ewol { class Joystick :public ewol::Widget { public: // Event list of properties - ewol::object::Signal signalEnable; - ewol::object::Signal signalDisable; - ewol::object::Signal signalMove; + ewol::Signal signalEnable; + ewol::Signal signalDisable; + ewol::Signal signalMove; public: enum joystickMode { modeNormal, diff --git a/sources/ewol/widget/Label.h b/sources/ewol/widget/Label.h index 3ee63a80..8f19242e 100644 --- a/sources/ewol/widget/Label.h +++ b/sources/ewol/widget/Label.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -25,7 +25,7 @@ namespace ewol { class Label : public ewol::Widget { public: // Event list of properties - ewol::object::Signal signalPressed; + ewol::Signal signalPressed; private: ewol::compositing::Text m_text; //!< Compositing text element. ewol::object::Param m_label; //!< decorated text to display. diff --git a/sources/ewol/widget/ListFileSystem.h b/sources/ewol/widget/ListFileSystem.h index 49ce10f5..3d3bb1bd 100644 --- a/sources/ewol/widget/ListFileSystem.h +++ b/sources/ewol/widget/ListFileSystem.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -22,10 +22,10 @@ namespace ewol { class ListFileSystem : public ewol::widget::List { public: // Event list of properties - ewol::object::Signal signalFileSelect; //!< @event "file-select" Generated when a file is selected. - ewol::object::Signal signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element - ewol::object::Signal signalFolderSelect; - ewol::object::Signal signalFolderValidate; + ewol::Signal signalFileSelect; //!< @event "file-select" Generated when a file is selected. + ewol::Signal signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element + ewol::Signal signalFolderSelect; + ewol::Signal signalFolderValidate; protected: ListFileSystem(); void init(); diff --git a/sources/ewol/widget/Menu.cpp b/sources/ewol/widget/Menu.cpp index b1cb7936..fedbae6b 100644 --- a/sources/ewol/widget/Menu.cpp +++ b/sources/ewol/widget/Menu.cpp @@ -108,7 +108,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent, // add it in the widget list ewol::widget::Sizer::subWidgetAdd(myButton); // keep the specific event ... - myButton->signalPressed.connect(shared_from_this(), std::bind(&ewol::widget::Menu::onButtonPressed, this, std::weak_ptr(myButton))); + myButton->signalPressed.bind(shared_from_this(), &ewol::widget::Menu::onButtonPressed, std::weak_ptr(myButton)); tmpObject.m_widgetPointer = myButton; } m_listElement.push_back(tmpObject); @@ -231,7 +231,7 @@ void ewol::widget::Menu::onButtonPressed(std::weak_ptr _bu } // set the image if one is present ... //myButton->registerOnEvent(shared_from_this(), "pressed", eventButtonPressed); - myButton->signalPressed.connect(shared_from_this(), std::bind(&ewol::widget::Menu::onButtonPressed, this, std::weak_ptr(myButton))); + myButton->signalPressed.bind(shared_from_this(), &ewol::widget::Menu::onButtonPressed, std::weak_ptr(myButton)); myButton->setExpand(bvec2(true,false)); myButton->setFill(bvec2(true,false)); // add it in the widget list diff --git a/sources/ewol/widget/Menu.h b/sources/ewol/widget/Menu.h index b0fce18e..111e0723 100644 --- a/sources/ewol/widget/Menu.h +++ b/sources/ewol/widget/Menu.h @@ -34,7 +34,7 @@ namespace ewol { */ class Menu :public ewol::widget::Sizer { public: - ewol::object::Signal signalSelect; // event on a menu button or ... + ewol::Signal signalSelect; // event on a menu button or ... protected: Menu(); void init(); diff --git a/sources/ewol/widget/Slider.h b/sources/ewol/widget/Slider.h index 6155d5c6..744554c2 100644 --- a/sources/ewol/widget/Slider.h +++ b/sources/ewol/widget/Slider.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -24,7 +24,7 @@ namespace ewol { class Slider : public ewol::Widget { public: // Event list of properties - ewol::object::Signal signalChange; + ewol::Signal signalChange; protected: Slider(); void init(); diff --git a/sources/ewol/widget/WSlider.h b/sources/ewol/widget/WSlider.h index 1deec94d..a69288e2 100644 --- a/sources/ewol/widget/WSlider.h +++ b/sources/ewol/widget/WSlider.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -23,8 +23,8 @@ namespace ewol { class WSlider :public ewol::widget::ContainerN { public: // Event list of properties - ewol::object::Signal signalStartSlide; - ewol::object::Signal signalStopSlide; + ewol::Signal signalStartSlide; + ewol::Signal signalStopSlide; enum sladingMode { sladingTransitionVert, sladingTransitionHori, diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index ca0190ab..2630d8c6 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -31,7 +31,7 @@ namespace ewol { #include #include #include -#include +#include #define ULTIMATE_MAX_SIZE (99999999) @@ -558,7 +558,7 @@ namespace ewol { // -- Shortcut : management of the shortcut // ---------------------------------------------------------------------------------------------------------------- public: - ewol::object::Signal signalShortcut; //!< signal handle of the message + ewol::Signal signalShortcut; //!< signal handle of the message private: std::vector m_localShortcut; //!< list of all shortcut in the widget protected: @@ -684,9 +684,9 @@ namespace ewol { */ public: // event generated : - ewol::object::Signal signalAnnimationStart; //!< event when start annimation - ewol::object::Signal signalAnnimationRatio; //!< event when % of annimation change (integer) - ewol::object::Signal signalAnnimationStop; //!< event when stop annimation + ewol::Signal signalAnnimationStart; //!< event when start annimation + ewol::Signal signalAnnimationRatio; //!< event when % of annimation change (integer) + ewol::Signal signalAnnimationStop; //!< event when stop annimation protected: enum annimationMode { annimationModeEnableAdd, diff --git a/sources/ewol/widget/meta/ColorChooser.h b/sources/ewol/widget/meta/ColorChooser.h index 03833888..c8307028 100644 --- a/sources/ewol/widget/meta/ColorChooser.h +++ b/sources/ewol/widget/meta/ColorChooser.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -28,7 +28,7 @@ namespace ewol { class ColorChooser : public ewol::widget::Sizer { public: // Event list of properties - ewol::object::Signal> signalChange; + ewol::Signal> signalChange; protected: ColorChooser(); void init(); diff --git a/sources/ewol/widget/meta/FileChooser.h b/sources/ewol/widget/meta/FileChooser.h index 838c6a8c..efb9ccbf 100644 --- a/sources/ewol/widget/meta/FileChooser.h +++ b/sources/ewol/widget/meta/FileChooser.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace ewol { namespace widget { @@ -67,8 +67,8 @@ namespace ewol { class FileChooser : public ewol::widget::Composer { public: // Event list of properties - ewol::object::Signal signalCancel; - ewol::object::Signal signalValidate; + ewol::Signal signalCancel; + ewol::Signal signalValidate; protected: FileChooser(); void init(); diff --git a/sources/ewol/widget/meta/Parameter.h b/sources/ewol/widget/meta/Parameter.h index a9e5b703..4a9f9eee 100644 --- a/sources/ewol/widget/meta/Parameter.h +++ b/sources/ewol/widget/meta/Parameter.h @@ -29,7 +29,7 @@ namespace ewol { class Parameter : public ewol::widget::PopUp { public: // Event list of properties - ewol::object::Signal signalClose; + ewol::Signal signalClose; protected: Parameter(); void init(); diff --git a/sources/ewol/widget/meta/ParameterList.h b/sources/ewol/widget/meta/ParameterList.h index df6d026b..5e88a2b2 100644 --- a/sources/ewol/widget/meta/ParameterList.h +++ b/sources/ewol/widget/meta/ParameterList.h @@ -39,7 +39,7 @@ namespace ewol { class ParameterList :public ewol::widget::WidgetScrolled { public: // Event list of properties - ewol::object::Signal signalSelect; + ewol::Signal signalSelect; private: int32_t m_idSelected; std::vector m_list; diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 1fbd2d3b..e2dcdc8e 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -93,9 +93,12 @@ def create(target): 'ewol/object/Worker.cpp', 'ewol/object/Parameter.cpp', 'ewol/object/ParameterList.cpp', - 'ewol/object/ParamList.cpp', - 'ewol/object/SignalList.cpp', - 'ewol/object/SignalBase.cpp' + 'ewol/object/ParamList.cpp' + ]) + # object : + myModule.add_src_file([ + 'ewol/signal/List.cpp', + 'ewol/signal/Base.cpp' ]) # OpenGL interface : From 61afe48646a717af105a382c6d38aa4ede46f2ef Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 29 Oct 2014 22:34:06 +0100 Subject: [PATCH 13/57] [DEV] set Parameter agnostic from Object --- external/ege | 2 +- sources/ewol/object/Object.h | 18 +++++------ sources/ewol/object/ParamList.cpp | 10 ------- sources/ewol/object/Parameter.cpp | 30 ------------------- .../Interface.cpp} | 20 ++++++------- .../ParameterList.h => parameter/Interface.h} | 20 ++++++------- .../{object/ParamList.h => parameter/List.h} | 28 ++++++++--------- sources/ewol/parameter/Parameter.cpp | 30 +++++++++++++++++++ .../ewol/{object => parameter}/Parameter.h | 18 +++++------ .../ParamRange.h => parameter/Range.h} | 22 +++++++------- .../{object/Param.h => parameter/Value.h} | 26 ++++++++-------- sources/ewol/widget/Button.cpp | 2 +- sources/ewol/widget/Button.h | 12 ++++---- sources/ewol/widget/ButtonColor.cpp | 2 +- sources/ewol/widget/ButtonColor.h | 4 +-- sources/ewol/widget/CheckBox.cpp | 2 +- sources/ewol/widget/CheckBox.h | 6 ++-- sources/ewol/widget/ContextMenu.cpp | 2 +- sources/ewol/widget/ContextMenu.h | 8 ++--- sources/ewol/widget/Entry.cpp | 2 +- sources/ewol/widget/Entry.h | 12 ++++---- sources/ewol/widget/Image.cpp | 2 +- sources/ewol/widget/Image.h | 16 +++++----- sources/ewol/widget/Label.cpp | 2 +- sources/ewol/widget/Label.h | 4 +-- sources/ewol/widget/ListFileSystem.cpp | 2 +- sources/ewol/widget/ListFileSystem.h | 14 ++++----- sources/ewol/widget/PopUp.cpp | 2 +- sources/ewol/widget/PopUp.h | 8 ++--- sources/ewol/widget/ProgressBar.cpp | 2 +- sources/ewol/widget/ProgressBar.h | 10 +++---- sources/ewol/widget/Scroll.cpp | 2 +- sources/ewol/widget/Scroll.h | 4 +-- sources/ewol/widget/Sizer.cpp | 2 +- sources/ewol/widget/Sizer.h | 6 ++-- sources/ewol/widget/Slider.cpp | 2 +- sources/ewol/widget/Slider.h | 10 +++---- sources/ewol/widget/Spacer.cpp | 2 +- sources/ewol/widget/Spacer.h | 4 +-- sources/ewol/widget/WSlider.cpp | 2 +- sources/ewol/widget/WSlider.h | 8 ++--- sources/ewol/widget/Widget.cpp | 2 +- sources/ewol/widget/Widget.h | 24 +++++++-------- sources/lutin_ewol.py | 12 ++++---- 44 files changed, 205 insertions(+), 213 deletions(-) delete mode 100644 sources/ewol/object/ParamList.cpp delete mode 100644 sources/ewol/object/Parameter.cpp rename sources/ewol/{object/ParameterList.cpp => parameter/Interface.cpp} (72%) rename sources/ewol/{object/ParameterList.h => parameter/Interface.h} (81%) rename sources/ewol/{object/ParamList.h => parameter/List.h} (88%) create mode 100644 sources/ewol/parameter/Parameter.cpp rename sources/ewol/{object => parameter}/Parameter.h (81%) rename sources/ewol/{object/ParamRange.h => parameter/Range.h} (89%) rename sources/ewol/{object/Param.h => parameter/Value.h} (85%) diff --git a/external/ege b/external/ege index e9483bd0..343021de 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit e9483bd0caaa64a7c9d72a5807d05f8663bc3e17 +Subproject commit 343021de91b1662da5dafe9ae9b6a089bb5edcfc diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 6947c3a0..d39fcd9a 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -15,6 +15,13 @@ #include #include +#include +#include +#include +#include +#include +#include + namespace ewol { // some class need to define element befor other ... class Object; @@ -24,13 +31,6 @@ namespace ewol { class Context; }; -#include -#include -#include -#include -#include -#include - #define DECLARE_FACTORY(className) \ template static std::shared_ptr create( T&& ... all ) { \ std::shared_ptr object(new className()); \ @@ -51,7 +51,7 @@ namespace ewol { * this class mermit at every Object to communicate between them. */ class Object : public std::enable_shared_from_this, - public ewol::object::ParameterList, + public ewol::parameter::Interface, public ewol::signal::List { private: static size_t m_valUID; //!< Static used for the unique ID definition @@ -145,7 +145,7 @@ namespace ewol { // TODO : Rework the position on this function ... This is a convignent function ... bool parameterSetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value); protected: - ewol::object::Param m_name; //!< name of the element ... + ewol::parameter::Value m_name; //!< name of the element ... public: /** * @brief get the Object name diff --git a/sources/ewol/object/ParamList.cpp b/sources/ewol/object/ParamList.cpp deleted file mode 100644 index ec642804..00000000 --- a/sources/ewol/object/ParamList.cpp +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include diff --git a/sources/ewol/object/Parameter.cpp b/sources/ewol/object/Parameter.cpp deleted file mode 100644 index 6b42e3b5..00000000 --- a/sources/ewol/object/Parameter.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @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_objectLink(_objectLink), - m_name(_name) { - // add a reference on the current parameter ... - _objectLink.parameterAdd(this); -} - -void ewol::object::Parameter::notifyChange() const { - m_objectLink.onParameterChangeValue(ewol::object::ParameterRef(this)); -} - -bool ewol::object::operator==(const ParameterRef& _obj, const Parameter& _obj2) noexcept { - return &_obj2 == _obj.m_ref; -} -bool ewol::object::operator==(const Parameter& _obj2, const ParameterRef& _obj) noexcept { - return &_obj2 == _obj.m_ref; -} \ No newline at end of file diff --git a/sources/ewol/object/ParameterList.cpp b/sources/ewol/parameter/Interface.cpp similarity index 72% rename from sources/ewol/object/ParameterList.cpp rename to sources/ewol/parameter/Interface.cpp index 26353237..831a7b92 100644 --- a/sources/ewol/object/ParameterList.cpp +++ b/sources/ewol/parameter/Interface.cpp @@ -7,19 +7,19 @@ */ #include -#include -#include +#include +#include -ewol::object::ParameterList::ParameterList() { +ewol::parameter::Interface::Interface() { } -ewol::object::ParameterList::~ParameterList() { +ewol::parameter::Interface::~Interface() { parameterClean(); } // note this pointer is not allocated and not free at the end of the class -void ewol::object::ParameterList::parameterAdd(Parameter* _pointerOnParameter) { +void ewol::parameter::Interface::parameterAdd(ewol::parameter::Parameter* _pointerOnParameter) { if (_pointerOnParameter == nullptr) { EWOL_ERROR("Try to link a nullptr parameters"); return; @@ -27,14 +27,14 @@ void ewol::object::ParameterList::parameterAdd(Parameter* _pointerOnParameter) { m_list.push_back(_pointerOnParameter); } -void ewol::object::ParameterList::parameterClean() { +void ewol::parameter::Interface::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) { +bool ewol::parameter::Interface::parameterSet(const std::string& _parameter, const std::string& _value) { for (auto &it : m_list) { if( it != nullptr && it->getName() == _parameter) { @@ -46,7 +46,7 @@ bool ewol::object::ParameterList::parameterSet(const std::string& _parameter, co return false; } -std::string ewol::object::ParameterList::parameterGet(const std::string& _parameter) const { +std::string ewol::parameter::Interface::parameterGet(const std::string& _parameter) const { for (auto &it : m_list) { if( it != nullptr && it->getName() == _parameter) { @@ -56,7 +56,7 @@ std::string ewol::object::ParameterList::parameterGet(const std::string& _parame return "???"; } -void ewol::object::ParameterList::parameterDisplay(bool _changeOnly) const { +void ewol::parameter::Interface::parameterDisplay(bool _changeOnly) const { EWOL_INFO(" Object parameters:"); for (auto &it : m_list) { if(it != nullptr) { @@ -73,7 +73,7 @@ void ewol::object::ParameterList::parameterDisplay(bool _changeOnly) const { } } -std::map ewol::object::ParameterList::parameterGetAll(bool _notIfDefault) const { +std::map ewol::parameter::Interface::parameterGetAll(bool _notIfDefault) const { std::map out; for (auto &it : m_list) { if(it != nullptr) { diff --git a/sources/ewol/object/ParameterList.h b/sources/ewol/parameter/Interface.h similarity index 81% rename from sources/ewol/object/ParameterList.h rename to sources/ewol/parameter/Interface.h index db84f3b9..38e7b975 100644 --- a/sources/ewol/object/ParameterList.h +++ b/sources/ewol/parameter/Interface.h @@ -7,29 +7,29 @@ */ -#ifndef __EWOL_PARAMETER_LIST_H__ -#define __EWOL_PARAMETER_LIST_H__ +#ifndef __EWOL_PARAMETER_INTERFACE_H__ +#define __EWOL_PARAMETER_INTERFACE_H__ #include #include namespace ewol { - namespace object { + namespace parameter { class Parameter; - class ParameterRef; - class ParameterList { - friend class ewol::object::Parameter; // to register parameter in the list. + class Ref; + class Interface { + friend class ewol::parameter::Parameter; // to register parameter in the list. private: - std::vector m_list; //!< list of availlable Parameters + std::vector m_list; //!< list of availlable Parameters (no need to free) public: /** * @brief Constructor. */ - ParameterList(); + Interface(); /** * @brief Destructor. */ - virtual ~ParameterList(); + virtual ~Interface(); /** * @brief Register a parameter class pointer in the List of parameters * @note This class does not destroy the parameter pointer!!! @@ -64,7 +64,7 @@ namespace ewol { * @brief Called when a parameter change value. * @param[in] _paramPointer Pointer on the parameter (to know which parameter have change); */ - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { }; + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { }; /** * @brief Get All the parameter configuration: * @return map on the parameters diff --git a/sources/ewol/object/ParamList.h b/sources/ewol/parameter/List.h similarity index 88% rename from sources/ewol/object/ParamList.h rename to sources/ewol/parameter/List.h index b51738e5..2516e310 100644 --- a/sources/ewol/object/ParamList.h +++ b/sources/ewol/parameter/List.h @@ -6,17 +6,17 @@ * @license APACHE v2.0 (see license file) */ -#ifndef __EWOL_PARAM_LIST_H__ -#define __EWOL_PARAM_LIST_H__ +#ifndef __EWOL_PARAMETER_LIST_H__ +#define __EWOL_PARAMETER_LIST_H__ -#include -#include +#include +#include #include #include namespace ewol { - namespace object { - template class ParamList : public Parameter { + namespace parameter { + template class List : public Parameter { private: MY_TYPE m_value; //!< Element value ==> can be directly used. MY_TYPE m_default; //!< Default value. @@ -28,11 +28,11 @@ namespace ewol { * @param[in] _name Static name of the parameter. * @param[in] _description description of the parameter. */ - ParamList(ewol::object::ParameterList& _objectLink, - const std::string& _name, - const MY_TYPE& _defaultValue, - const std::string& _description="") : - Parameter(_objectLink, _name), + List(ewol::parameter::Interface& _paramInterfaceLink, + const std::string& _name, + const MY_TYPE& _defaultValue, + const std::string& _description="") : + Parameter(_paramInterfaceLink, _name), m_value(_defaultValue), m_default(_defaultValue) { @@ -40,7 +40,7 @@ namespace ewol { /** * @brief Destructor. */ - virtual ~ParamList() { + virtual ~List() { }; void add(const MY_TYPE& _value, const std::string& _name, const std::string& _description = "") { @@ -143,7 +143,7 @@ namespace ewol { * @brief assignement operator. * @param[in] newVal The new value of the parameter. */ - const ParamList& operator= (MY_TYPE _newVal) { + const List& operator= (MY_TYPE _newVal) { set(_newVal); return *this; } @@ -160,7 +160,7 @@ namespace ewol { return &m_value; } }; - template std::ostream& operator <<(std::ostream& _os, const ewol::object::ParamList& _obj) { + template std::ostream& operator <<(std::ostream& _os, const ewol::parameter::List& _obj) { _os << _obj.get(); return _os; } diff --git a/sources/ewol/parameter/Parameter.cpp b/sources/ewol/parameter/Parameter.cpp new file mode 100644 index 00000000..c788d481 --- /dev/null +++ b/sources/ewol/parameter/Parameter.cpp @@ -0,0 +1,30 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include + + +ewol::parameter::Parameter::Parameter(ewol::parameter::Interface& _paramInterfaceLink, const std::string& _name) : + m_interfaceLink(_paramInterfaceLink), + m_name(_name) { + // add a reference on the current parameter ... + m_interfaceLink.parameterAdd(this); +} + +void ewol::parameter::Parameter::notifyChange() const { + m_interfaceLink.onParameterChangeValue(ewol::parameter::Ref(this)); +} + +bool ewol::parameter::operator==(const Ref& _obj, const Parameter& _obj2) noexcept { + return &_obj2 == _obj.m_ref; +} +bool ewol::parameter::operator==(const Parameter& _obj2, const Ref& _obj) noexcept { + return &_obj2 == _obj.m_ref; +} \ No newline at end of file diff --git a/sources/ewol/object/Parameter.h b/sources/ewol/parameter/Parameter.h similarity index 81% rename from sources/ewol/object/Parameter.h rename to sources/ewol/parameter/Parameter.h index 37ea788b..bed366fe 100644 --- a/sources/ewol/object/Parameter.h +++ b/sources/ewol/parameter/Parameter.h @@ -6,7 +6,7 @@ * @license APACHE v2.0 (see license file) */ -#include +#include #ifndef __EWOL_PARAMETER_H__ #define __EWOL_PARAMETER_H__ @@ -15,14 +15,14 @@ #include namespace ewol { - namespace object { - class ParameterRef; + namespace parameter { + class Ref; class Parameter { private: - ewol::object::ParameterList& m_objectLink; + ewol::parameter::Interface& m_interfaceLink; std::string m_name; public: - Parameter(ewol::object::ParameterList& _objectLink, const std::string& _name); + Parameter(ewol::parameter::Interface& _paramInterfaceLink, const std::string& _name); virtual ~Parameter() { }; /** * @brief call main class that parameterChange @@ -70,16 +70,16 @@ namespace ewol { */ virtual void setDefault() = 0; }; - class ParameterRef { + class Ref { public: const Parameter* m_ref; - ParameterRef(const Parameter* _ref) : + Ref(const Parameter* _ref) : m_ref(_ref) { // nothing to do ... } }; - bool operator==(const ParameterRef& _obj, const Parameter& _obj2) noexcept; - bool operator==(const Parameter& _obj2, const ParameterRef& _obj) noexcept; + bool operator==(const Ref& _obj, const Parameter& _obj2) noexcept; + bool operator==(const Parameter& _obj2, const Ref& _obj) noexcept; }; }; diff --git a/sources/ewol/object/ParamRange.h b/sources/ewol/parameter/Range.h similarity index 89% rename from sources/ewol/object/ParamRange.h rename to sources/ewol/parameter/Range.h index 0d31ccd9..61ecc95e 100644 --- a/sources/ewol/object/ParamRange.h +++ b/sources/ewol/parameter/Range.h @@ -6,17 +6,17 @@ * @license APACHE v2.0 (see license file) */ -#ifndef __EWOL_PARAM_RANGE_H__ -#define __EWOL_PARAM_RANGE_H__ +#ifndef __EWOL_PARAMETER_RANGE_H__ +#define __EWOL_PARAMETER_RANGE_H__ -#include -#include +#include +#include #include #include namespace ewol { - namespace object { - template class ParamRange : public Parameter { + namespace parameter { + template class Range : public Parameter { private: MY_TYPE m_value; //!< Current value. MY_TYPE m_min; //!< Minimum value. @@ -32,13 +32,13 @@ namespace ewol { * @param[in] _max Maximum value. * @param[in] _description description of the parameter. */ - ParamRange(ewol::object::ParameterList& _objectLink, + Range(ewol::parameter::Interface& _paramInterfaceLink, const std::string& _name, const MY_TYPE& _defaultValue, const MY_TYPE& _min, const MY_TYPE& _max, const std::string& _description = "") : - Parameter(_objectLink, _name), + Parameter(_paramInterfaceLink, _name), m_value(_defaultValue), m_min(_min), m_max(_max), @@ -48,7 +48,7 @@ namespace ewol { /** * @brief Destructor. */ - virtual ~ParamRange() { }; + virtual ~Range() { }; // herited methode virtual std::string getType() const { return typeid(MY_TYPE).name(); @@ -123,7 +123,7 @@ namespace ewol { * @brief assignement operator. * @param[in] newVal The new value of the parameter. */ - const Param& operator= (const MY_TYPE& _newVal) { + const Range& operator= (const MY_TYPE& _newVal) { set(_newVal); return *this; }; @@ -141,7 +141,7 @@ namespace ewol { } }; - template std::ostream& operator <<(std::ostream& _os, const ewol::object::ParamRange& _obj) { + template std::ostream& operator <<(std::ostream& _os, const ewol::parameter::Range& _obj) { _os << _obj.get(); return _os; } diff --git a/sources/ewol/object/Param.h b/sources/ewol/parameter/Value.h similarity index 85% rename from sources/ewol/object/Param.h rename to sources/ewol/parameter/Value.h index 77bcee18..263a72a1 100644 --- a/sources/ewol/object/Param.h +++ b/sources/ewol/parameter/Value.h @@ -6,17 +6,17 @@ * @license APACHE v2.0 (see license file) */ -#ifndef __EWOL_PARAM_H__ -#define __EWOL_PARAM_H__ +#ifndef __EWOL_PARAMETER_VALUE_H__ +#define __EWOL_PARAMETER_VALUE_H__ -#include -#include +#include +#include #include namespace ewol { - namespace object { - template class Param : public Parameter { + namespace parameter { + template class Value : public Parameter { private: MY_TYPE m_value; //!< Current value. MY_TYPE m_default; //!< Default value. @@ -30,19 +30,19 @@ namespace ewol { * @param[in] _max Maximum value. * @param[in] _description description of the parameter. */ - Param(ewol::object::ParameterList& _objectLink, + Value(ewol::parameter::Interface& _paramInterfaceLink, const std::string& _name, const MY_TYPE& _defaultValue, const std::string& _description = "") : - Parameter(_objectLink, _name), + Parameter(_paramInterfaceLink, _name), m_value(_defaultValue), m_default(_defaultValue) { }; - Param(ewol::object::ParameterList& _objectLink, + Value(ewol::parameter::Interface& _paramListLink, const std::string& _name, const std::string& _description = "") : - Parameter(_objectLink, _name), + Parameter(_paramListLink, _name), m_value(), m_default() { @@ -50,7 +50,7 @@ namespace ewol { /** * @brief Destructor. */ - virtual ~Param() { }; + virtual ~Value() { }; // herited methode virtual std::string getType() const { return typeid(MY_TYPE).name(); @@ -117,7 +117,7 @@ namespace ewol { * @brief assignement operator. * @param[in] newVal The new value of the parameter. */ - const Param& operator= (const MY_TYPE& _newVal) { + const Value& operator= (const MY_TYPE& _newVal) { set(_newVal); return *this; }; @@ -135,7 +135,7 @@ namespace ewol { } }; - template std::ostream& operator <<(std::ostream& _os, const ewol::object::Param& _obj) { + template std::ostream& operator <<(std::ostream& _os, const ewol::parameter::Value& _obj) { _os << _obj.get(); return _os; } diff --git a/sources/ewol/widget/Button.cpp b/sources/ewol/widget/Button.cpp index 511d4e69..d6821ce0 100644 --- a/sources/ewol/widget/Button.cpp +++ b/sources/ewol/widget/Button.cpp @@ -211,7 +211,7 @@ void ewol::widget::Button::periodicCall(const ewol::event::Time& _event) { markToRedraw(); } -void ewol::widget::Button::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Button::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::Container2::onParameterChangeValue(_paramPointer); if (_paramPointer == m_shaper) { markToRedraw(); diff --git a/sources/ewol/widget/Button.h b/sources/ewol/widget/Button.h index 2fde7775..03b00be1 100644 --- a/sources/ewol/widget/Button.h +++ b/sources/ewol/widget/Button.h @@ -43,7 +43,7 @@ namespace ewol { lockAccess, //!< all event are trashed == > acctivity of the button is disable }; private: - ewol::object::Param m_shaper; //!< Compositing theme. + ewol::parameter::Value m_shaper; //!< Compositing theme. protected: /** * @brief Constructor @@ -65,7 +65,7 @@ namespace ewol { m_shaper.setString(_shaperName); } protected: - ewol::object::Param m_value; //!< Current state of the button. + ewol::parameter::Value m_value; //!< Current state of the button. public: /** * @brief set the currentValue of the Button (pressed or not) @@ -84,7 +84,7 @@ namespace ewol { return m_value; }; protected: - ewol::object::ParamList m_lock; //!< Current lock state of the button. + ewol::parameter::List m_lock; //!< Current lock state of the button. public: /** * @brief set the button lock state. @@ -101,7 +101,7 @@ namespace ewol { return m_lock; }; protected: - ewol::object::Param m_toggleMode; //!< The button is able to toggle. + ewol::parameter::Value m_toggleMode; //!< The button is able to toggle. public: /** * @brief change the toggle mode. @@ -118,7 +118,7 @@ namespace ewol { return m_toggleMode; }; protected: - ewol::object::Param m_enableSingle; //!< When a single subwidget is set display all time it. + ewol::parameter::Value m_enableSingle; //!< When a single subwidget is set display all time it. public: /** * @brief Chane the display single widget mode availlable. @@ -152,7 +152,7 @@ namespace ewol { void CheckStatus(); protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void calculateMinMaxSize(); virtual void calculateSize(const vec2& _availlable); diff --git a/sources/ewol/widget/ButtonColor.cpp b/sources/ewol/widget/ButtonColor.cpp index 871237bd..d0ad664f 100644 --- a/sources/ewol/widget/ButtonColor.cpp +++ b/sources/ewol/widget/ButtonColor.cpp @@ -228,7 +228,7 @@ void ewol::widget::ButtonColor::periodicCall(const ewol::event::Time& _event) { } -void ewol::widget::ButtonColor::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::ButtonColor::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if (_paramPointer == m_textColorFg) { signalChange.emit(m_textColorFg); diff --git a/sources/ewol/widget/ButtonColor.h b/sources/ewol/widget/ButtonColor.h index ec527a27..dca4ac19 100644 --- a/sources/ewol/widget/ButtonColor.h +++ b/sources/ewol/widget/ButtonColor.h @@ -54,7 +54,7 @@ namespace ewol { */ void setShaperName(std::string _shaperName); protected: - ewol::object::Param> m_textColorFg; //!< Current color. + ewol::parameter::Value> m_textColorFg; //!< Current color. public: /** * @brief get the current color of the color selection widget @@ -76,7 +76,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); private: /** * @brief internal system to change the property of the current status diff --git a/sources/ewol/widget/CheckBox.cpp b/sources/ewol/widget/CheckBox.cpp index 56d3e05d..f4a191ce 100644 --- a/sources/ewol/widget/CheckBox.cpp +++ b/sources/ewol/widget/CheckBox.cpp @@ -195,7 +195,7 @@ void ewol::widget::CheckBox::periodicCall(const ewol::event::Time& _event) { markToRedraw(); } -void ewol::widget::CheckBox::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::CheckBox::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::Container2::onParameterChangeValue(_paramPointer); if (_paramPointer == m_shaper) { markToRedraw(); diff --git a/sources/ewol/widget/CheckBox.h b/sources/ewol/widget/CheckBox.h index 7bdd7d33..7e606a76 100644 --- a/sources/ewol/widget/CheckBox.h +++ b/sources/ewol/widget/CheckBox.h @@ -28,7 +28,7 @@ namespace ewol { ewol::Signal signalEnter; ewol::Signal signalValue; private: - ewol::object::Param m_shaper; //!< Compositing theme. + ewol::parameter::Value m_shaper; //!< Compositing theme. bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_buttonPressed; //!< Flag to know if the button is curently pressed. // hover area : @@ -58,7 +58,7 @@ namespace ewol { m_shaper.set(_shaperName); } protected: - ewol::object::Param m_value; //!< Current state of the checkbox. + ewol::parameter::Value m_value; //!< Current state of the checkbox. public: /** * @brief set the current value of the checkbox (check or not) @@ -87,7 +87,7 @@ namespace ewol { void CheckStatus(); protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void calculateMinMaxSize(); virtual void calculateSize(const vec2& _availlable); diff --git a/sources/ewol/widget/ContextMenu.cpp b/sources/ewol/widget/ContextMenu.cpp index 9aea810a..061181a1 100644 --- a/sources/ewol/widget/ContextMenu.cpp +++ b/sources/ewol/widget/ContextMenu.cpp @@ -226,7 +226,7 @@ std::shared_ptr ewol::widget::ContextMenu::getWidgetAtPos(const ve return std::dynamic_pointer_cast(shared_from_this()); } -void ewol::widget::ContextMenu::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::ContextMenu::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::Container::onParameterChangeValue(_paramPointer); if (_paramPointer == m_shaper) { markToRedraw(); diff --git a/sources/ewol/widget/ContextMenu.h b/sources/ewol/widget/ContextMenu.h index d18485f2..b250f8c8 100644 --- a/sources/ewol/widget/ContextMenu.h +++ b/sources/ewol/widget/ContextMenu.h @@ -38,7 +38,7 @@ namespace ewol { DECLARE_WIDGET_FACTORY(ContextMenu, "ContextMenu"); virtual ~ContextMenu(); private: - ewol::object::Param m_shaper; //!< Compositing theme. + ewol::parameter::Value m_shaper; //!< Compositing theme. public: /** * @brief set the shaper name (use the contructer one this permit to not noad unused shaper) @@ -54,8 +54,8 @@ namespace ewol { etk::Color<> m_colorBorder; float m_offset; private: - ewol::object::Param m_arrowPos; - ewol::object::ParamList m_arrawBorder; + ewol::parameter::Value m_arrowPos; + ewol::parameter::List m_arrawBorder; public: void setPositionMark(enum markPosition _position, const vec2& _arrowPos) { m_arrawBorder.set(_position); @@ -63,7 +63,7 @@ namespace ewol { } protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); diff --git a/sources/ewol/widget/Entry.cpp b/sources/ewol/widget/Entry.cpp index 571810b0..09029652 100644 --- a/sources/ewol/widget/Entry.cpp +++ b/sources/ewol/widget/Entry.cpp @@ -559,7 +559,7 @@ void ewol::widget::Entry::periodicCall(const ewol::event::Time& _event) { markToRedraw(); } -void ewol::widget::Entry::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Entry::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if (_paramPointer == m_shaper) { m_colorIdTextFg = m_shaper->requestColor("text-foreground"); diff --git a/sources/ewol/widget/Entry.h b/sources/ewol/widget/Entry.h index 67793fd0..f5e88760 100644 --- a/sources/ewol/widget/Entry.h +++ b/sources/ewol/widget/Entry.h @@ -38,7 +38,7 @@ namespace ewol { ewol::Signal signalEnter; //!< Enter key is pressed ewol::Signal signalModify; //!< data change private: - ewol::object::Param m_shaper; + ewol::parameter::Value m_shaper; int32_t m_colorIdTextFg; //!< color property of the text foreground int32_t m_colorIdTextBg; //!< color property of the text background int32_t m_colorIdCursor; //!< color property of the text cursor @@ -58,7 +58,7 @@ namespace ewol { */ virtual ~Entry(); private: - ewol::object::Param m_data; //!< sting that must be displayed + ewol::parameter::Value m_data; //!< sting that must be displayed protected: /** * @brief internal check the value with RegExp checking @@ -79,7 +79,7 @@ namespace ewol { return m_data; }; private: - ewol::object::ParamRange m_maxCharacter; //!< number max of xharacter in the list + ewol::parameter::Range m_maxCharacter; //!< number max of xharacter in the list public: /** * @brief Limit the number of Unicode character in the entry @@ -96,7 +96,7 @@ namespace ewol { return m_maxCharacter; }; private: - ewol::object::Param m_regexValue; //!< regular expression value + ewol::parameter::Value m_regexValue; //!< regular expression value std::regex m_regex; //!< regular expression to check content public: /** @@ -147,7 +147,7 @@ namespace ewol { */ virtual void removeSelected(); private: - ewol::object::Param m_textWhenNothing; //!< Text to display when nothing in in the entry (decorated text...) + ewol::parameter::Value m_textWhenNothing; //!< Text to display when nothing in in the entry (decorated text...) public: /** * @brief set The text displayed when nothing is in the entry. @@ -175,7 +175,7 @@ namespace ewol { virtual void onLostFocus(); virtual void changeStatusIn(int32_t _newStatusId); virtual void periodicCall(const ewol::event::Time& _event); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); private: // callback functions void onCallbackShortCut(const std::string& _value); void onCallbackEntryClean(); diff --git a/sources/ewol/widget/Image.cpp b/sources/ewol/widget/Image.cpp index 919dd241..5e2e0bfc 100644 --- a/sources/ewol/widget/Image.cpp +++ b/sources/ewol/widget/Image.cpp @@ -179,7 +179,7 @@ bool ewol::widget::Image::loadXML(exml::Element* _node) { return true; } -void ewol::widget::Image::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Image::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if ( _paramPointer == m_fileName || _paramPointer == m_imageSize) { diff --git a/sources/ewol/widget/Image.h b/sources/ewol/widget/Image.h index e9d9e538..1fef548a 100644 --- a/sources/ewol/widget/Image.h +++ b/sources/ewol/widget/Image.h @@ -51,7 +51,7 @@ namespace ewol { */ void set(const std::string& _file, const ewol::Dimension& _border); protected: - ewol::object::Param m_fileName; //!< file name of the image. + ewol::parameter::Value m_fileName; //!< file name of the image. public: /** * @brief set the new filename @@ -68,7 +68,7 @@ namespace ewol { return m_fileName; }; protected: - ewol::object::Param m_border; //!< border to add at the image. + ewol::parameter::Value m_border; //!< border to add at the image. public: /** * @brief set tge Border size around the image @@ -83,7 +83,7 @@ namespace ewol { return m_border; }; protected: - ewol::object::Param m_imageSize; //!< border to add at the image. + ewol::parameter::Value m_imageSize; //!< border to add at the image. public: /** * @brief set tge Border size around the image @@ -98,7 +98,7 @@ namespace ewol { return m_imageSize; }; protected: - ewol::object::Param m_keepRatio; //!< keep the image ratio between width and hight + ewol::parameter::Value m_keepRatio; //!< keep the image ratio between width and hight public: /** * @brief set the current status of keeping ratio. @@ -113,7 +113,7 @@ namespace ewol { return m_keepRatio; }; protected: - ewol::object::ParamRange m_posStart; //!< position in the image to start the sisplay (when we want not to display all the image) + ewol::parameter::Range m_posStart; //!< position in the image to start the sisplay (when we want not to display all the image) public: /** * @brief set the current 'start' position in the image to display. @@ -128,7 +128,7 @@ namespace ewol { return m_posStart; }; protected: - ewol::object::ParamRange m_posStop; //!< position in the image to start the sisplay (when we want not to display all the image) + ewol::parameter::Range m_posStop; //!< position in the image to start the sisplay (when we want not to display all the image) public: /** * @brief set the current 'stop' position in the image to display. @@ -143,7 +143,7 @@ namespace ewol { return m_posStop; }; public: - ewol::object::Param m_distanceFieldMode; //!< to have a parameter + ewol::parameter::Value m_distanceFieldMode; //!< to have a parameter public: /** * @brief Set distance field rendering mode @@ -161,7 +161,7 @@ namespace ewol { } protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); diff --git a/sources/ewol/widget/Label.cpp b/sources/ewol/widget/Label.cpp index c0e14fa9..4c654a4f 100644 --- a/sources/ewol/widget/Label.cpp +++ b/sources/ewol/widget/Label.cpp @@ -142,7 +142,7 @@ bool ewol::widget::Label::loadXML(exml::Element* _node) { return true; } -void ewol::widget::Label::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Label::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if (_paramPointer == m_label) { markToRedraw(); diff --git a/sources/ewol/widget/Label.h b/sources/ewol/widget/Label.h index 8f19242e..432537d1 100644 --- a/sources/ewol/widget/Label.h +++ b/sources/ewol/widget/Label.h @@ -28,7 +28,7 @@ namespace ewol { ewol::Signal signalPressed; private: ewol::compositing::Text m_text; //!< Compositing text element. - ewol::object::Param m_label; //!< decorated text to display. + ewol::parameter::Value m_label; //!< decorated text to display. std::shared_ptr m_colorProperty; //!< theme color property int32_t m_colorDefaultFgText; //!< Default color of the text int32_t m_colorDefaultBgText; //!< Default Background color of the text @@ -69,7 +69,7 @@ namespace ewol { }; protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); diff --git a/sources/ewol/widget/ListFileSystem.cpp b/sources/ewol/widget/ListFileSystem.cpp index 61f60a41..b987d111 100644 --- a/sources/ewol/widget/ListFileSystem.cpp +++ b/sources/ewol/widget/ListFileSystem.cpp @@ -239,7 +239,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput, return false; } -void ewol::widget::ListFileSystem::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::ListFileSystem::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::List::onParameterChangeValue(_paramPointer); if (_paramPointer == m_folder) { regenerateView(); diff --git a/sources/ewol/widget/ListFileSystem.h b/sources/ewol/widget/ListFileSystem.h index 3d3bb1bd..f37bb22f 100644 --- a/sources/ewol/widget/ListFileSystem.h +++ b/sources/ewol/widget/ListFileSystem.h @@ -69,8 +69,8 @@ namespace ewol { */ std::string getSelect() const ; protected: - ewol::object::Param m_folder; //!< Current folder that display point on. - ewol::object::Param m_selectFile; //!< current selected file + ewol::parameter::Value m_folder; //!< Current folder that display point on. + ewol::parameter::Value m_selectFile; //!< current selected file public: /** * @brief Set a folder to display (might be a valid folder !!!) @@ -87,7 +87,7 @@ namespace ewol { return m_folder; }; protected: - ewol::object::Param m_showFile; //!< Show files elements + ewol::parameter::Value m_showFile; //!< Show files elements public: /** * @brief Set the status of the displaying files or Not. @@ -104,7 +104,7 @@ namespace ewol { return m_showFile; }; protected: - ewol::object::Param m_showFolder; //!< Display the folders elements + ewol::parameter::Value m_showFolder; //!< Display the folders elements public: /** * @brief Set the status of the displaying fodlers or Not. @@ -121,7 +121,7 @@ namespace ewol { return m_showFile; }; protected: - ewol::object::Param m_showHidden; //!< Display hidden elements + ewol::parameter::Value m_showHidden; //!< Display hidden elements public: /** * @brief Set the status of the displaying hidden files or folder or Not. @@ -138,7 +138,7 @@ namespace ewol { return m_showFile; }; protected: - ewol::object::Param m_showTemporaryFile; //!< show the temporary files elements (XXX~, XXX.bck, XXX.pyc ...) + ewol::parameter::Value m_showTemporaryFile; //!< show the temporary files elements (XXX~, XXX.bck, XXX.pyc ...) public: /** * @brief Set the status of the displaying temporary file (xxx~, xxx.bck, xxx.pyc) or Not. @@ -155,7 +155,7 @@ namespace ewol { return m_showFile; }; public: // glocal derived functions - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); }; }; }; diff --git a/sources/ewol/widget/PopUp.cpp b/sources/ewol/widget/PopUp.cpp index deffb0eb..8f900e96 100644 --- a/sources/ewol/widget/PopUp.cpp +++ b/sources/ewol/widget/PopUp.cpp @@ -134,7 +134,7 @@ std::shared_ptr ewol::widget::PopUp::getWidgetAtPos(const vec2& _p return std::dynamic_pointer_cast(shared_from_this()); } -void ewol::widget::PopUp::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::PopUp::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::Container::onParameterChangeValue(_paramPointer); if (_paramPointer == m_shaper) { markToRedraw(); diff --git a/sources/ewol/widget/PopUp.h b/sources/ewol/widget/PopUp.h index ad91f4f5..2739109d 100644 --- a/sources/ewol/widget/PopUp.h +++ b/sources/ewol/widget/PopUp.h @@ -24,7 +24,7 @@ namespace ewol { */ class PopUp : public ewol::widget::Container { protected: - ewol::object::Param m_shaper; //!< Compositing theme. + ewol::parameter::Value m_shaper; //!< Compositing theme. protected: /** * @brief Constructor @@ -44,7 +44,7 @@ namespace ewol { */ void setShaperName(const std::string& _shaperName); protected: - ewol::object::Param m_lockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget + ewol::parameter::Value m_lockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget public: /** * @brief Limit the expend properties to the current widget (no contamination) @@ -54,7 +54,7 @@ namespace ewol { m_lockExpand.set(_lockExpand); } private: - ewol::object::Param m_closeOutEvent; //!< ratio progression of a sliding + ewol::parameter::Value m_closeOutEvent; //!< ratio progression of a sliding public: /** * @brief Request the Auto-remove when the event input is set outside the widget @@ -72,7 +72,7 @@ namespace ewol { }; protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void periodicCall(const ewol::event::Time& _event); virtual void systemDraw(const ewol::DrawProperty& _displayProp); diff --git a/sources/ewol/widget/ProgressBar.cpp b/sources/ewol/widget/ProgressBar.cpp index e30a746d..1a8a2ed4 100644 --- a/sources/ewol/widget/ProgressBar.cpp +++ b/sources/ewol/widget/ProgressBar.cpp @@ -73,7 +73,7 @@ void ewol::widget::ProgressBar::onRegenerateDisplay() { } } -void ewol::widget::ProgressBar::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::ProgressBar::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if (_paramPointer == m_value) { markToRedraw(); diff --git a/sources/ewol/widget/ProgressBar.h b/sources/ewol/widget/ProgressBar.h index a393d793..8b50ec98 100644 --- a/sources/ewol/widget/ProgressBar.h +++ b/sources/ewol/widget/ProgressBar.h @@ -38,13 +38,13 @@ namespace ewol { m_textColorFg = _newColor; }; private: - ewol::object::Param m_value; //!< % used - ewol::object::Param> m_textColorFg; //!< forder bar color - ewol::object::Param> m_textColorBgOn; //!< bar color enable - ewol::object::Param> m_textColorBgOff; //!< bar color disable + ewol::parameter::Value m_value; //!< % used + ewol::parameter::Value> m_textColorFg; //!< forder bar color + ewol::parameter::Value> m_textColorBgOn; //!< bar color enable + ewol::parameter::Value> m_textColorBgOff; //!< bar color disable protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: // Derived function virtual void onRegenerateDisplay(); virtual void calculateMinMaxSize(); diff --git a/sources/ewol/widget/Scroll.cpp b/sources/ewol/widget/Scroll.cpp index f465a905..5edb9531 100644 --- a/sources/ewol/widget/Scroll.cpp +++ b/sources/ewol/widget/Scroll.cpp @@ -350,7 +350,7 @@ std::shared_ptr ewol::widget::Scroll::getWidgetAtPos(const vec2& _ } return std::dynamic_pointer_cast(shared_from_this());; } -void ewol::widget::Scroll::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Scroll::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::Container::onParameterChangeValue(_paramPointer); if (_paramPointer == m_limit) { diff --git a/sources/ewol/widget/Scroll.h b/sources/ewol/widget/Scroll.h index 0b3d335e..5b0c471f 100644 --- a/sources/ewol/widget/Scroll.h +++ b/sources/ewol/widget/Scroll.h @@ -32,7 +32,7 @@ namespace ewol { ewol::compositing::Shaper m_shaperH; //!< Compositing theme Horizontal. ewol::compositing::Shaper m_shaperV; //!< Compositing theme Vertical. protected: - ewol::object::ParamRange m_limit; + ewol::parameter::Range m_limit; private: float m_pixelScrolling; vec2 m_highSpeedStartPos; @@ -67,7 +67,7 @@ namespace ewol { virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); protected: // Derived function virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); }; }; }; diff --git a/sources/ewol/widget/Sizer.cpp b/sources/ewol/widget/Sizer.cpp index 5579aaae..70ab49b3 100644 --- a/sources/ewol/widget/Sizer.cpp +++ b/sources/ewol/widget/Sizer.cpp @@ -178,7 +178,7 @@ void ewol::widget::Sizer::subWidgetUnLink(std::shared_ptr _newWidg ewol::widget::ContainerN::subWidgetUnLink(_newWidget); } -void ewol::widget::Sizer::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Sizer::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::ContainerN::onParameterChangeValue(_paramPointer); if (_paramPointer == m_mode) { markToRedraw(); diff --git a/sources/ewol/widget/Sizer.h b/sources/ewol/widget/Sizer.h index 8103dce3..46968f41 100644 --- a/sources/ewol/widget/Sizer.h +++ b/sources/ewol/widget/Sizer.h @@ -31,7 +31,7 @@ namespace ewol { modeHori, //!< Horizontal mode }; private: - ewol::object::ParamList m_mode; //!< Methode to display the widget list (vert/hory ...) + ewol::parameter::List m_mode; //!< Methode to display the widget list (vert/hory ...) protected: /** * @brief Constructor @@ -60,7 +60,7 @@ namespace ewol { return m_mode; } private: - ewol::object::Param m_borderSize; //!< Border size needed for all the display + ewol::parameter::Value m_borderSize; //!< Border size needed for all the display public: /** * @brief set the current border size of the current element: @@ -127,7 +127,7 @@ namespace ewol { virtual int32_t subWidgetAddStart(std::shared_ptr _newWidget); virtual void subWidgetRemove(std::shared_ptr _newWidget); virtual void subWidgetUnLink(std::shared_ptr _newWidget); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); }; }; }; diff --git a/sources/ewol/widget/Slider.cpp b/sources/ewol/widget/Slider.cpp index d9b4507e..1e6e47ad 100644 --- a/sources/ewol/widget/Slider.cpp +++ b/sources/ewol/widget/Slider.cpp @@ -105,7 +105,7 @@ void ewol::widget::Slider::updateValue(float _newValue) { } // TODO : Review this really bad things ... -void ewol::widget::Slider::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Slider::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if (_paramPointer == m_value) { updateValue(m_value.get()); diff --git a/sources/ewol/widget/Slider.h b/sources/ewol/widget/Slider.h index 744554c2..a8981163 100644 --- a/sources/ewol/widget/Slider.h +++ b/sources/ewol/widget/Slider.h @@ -32,7 +32,7 @@ namespace ewol { DECLARE_WIDGET_FACTORY(Slider, "Slider"); virtual ~Slider(); protected: - ewol::object::Param m_value; //!< current value of the Slider + ewol::parameter::Value m_value; //!< current value of the Slider public: /** * @brief Set the value of the slider. @@ -49,7 +49,7 @@ namespace ewol { return m_value; } protected: - ewol::object::Param m_min; //!< minimum value of the slider + ewol::parameter::Value m_min; //!< minimum value of the slider public: /** * @brief Set the minumum value of the slider. @@ -66,7 +66,7 @@ namespace ewol { return m_min; } protected: - ewol::object::Param m_max; //!< maximum value of the slider + ewol::parameter::Value m_max; //!< maximum value of the slider public: /** * @brief Set the maximum value of the slider. @@ -83,7 +83,7 @@ namespace ewol { return m_max; } protected: - ewol::object::Param m_step; + ewol::parameter::Value m_step; public: /** * @brief Set the step value of the slider. @@ -114,7 +114,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); }; }; }; diff --git a/sources/ewol/widget/Spacer.cpp b/sources/ewol/widget/Spacer.cpp index e09b6415..fb43fe42 100644 --- a/sources/ewol/widget/Spacer.cpp +++ b/sources/ewol/widget/Spacer.cpp @@ -48,7 +48,7 @@ void ewol::widget::Spacer::onRegenerateDisplay() { m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) ); } -void ewol::widget::Spacer::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::Spacer::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Widget::onParameterChangeValue(_paramPointer); if (_paramPointer == m_color) { markToRedraw(); diff --git a/sources/ewol/widget/Spacer.h b/sources/ewol/widget/Spacer.h index 3049df17..62ed6919 100644 --- a/sources/ewol/widget/Spacer.h +++ b/sources/ewol/widget/Spacer.h @@ -37,7 +37,7 @@ namespace ewol { */ virtual ~Spacer(); protected: - ewol::object::Param> m_color; //!< Background color + ewol::parameter::Value> m_color; //!< Background color public: /** * @brief Spziby the background color (basicly transparent) @@ -51,7 +51,7 @@ namespace ewol { virtual std::shared_ptr getWidgetAtPos(const vec2& _pos) { return nullptr; }; virtual void onRegenerateDisplay(); virtual void onDraw(); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); }; }; }; diff --git a/sources/ewol/widget/WSlider.cpp b/sources/ewol/widget/WSlider.cpp index ed00002b..da8d8f9b 100644 --- a/sources/ewol/widget/WSlider.cpp +++ b/sources/ewol/widget/WSlider.cpp @@ -270,7 +270,7 @@ void ewol::widget::WSlider::onRegenerateDisplay() { } } } -void ewol::widget::WSlider::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::widget::WSlider::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::widget::ContainerN::onParameterChangeValue(_paramPointer); if (_paramPointer == m_selectNewWidget) { if (m_selectNewWidget.get() != "") { diff --git a/sources/ewol/widget/WSlider.h b/sources/ewol/widget/WSlider.h index a69288e2..f168e066 100644 --- a/sources/ewol/widget/WSlider.h +++ b/sources/ewol/widget/WSlider.h @@ -43,7 +43,7 @@ namespace ewol { int32_t m_windowsDestination; //!< widget destinated viewed int32_t m_windowsRequested; //!< widget destination requested when change in modification in progress float m_slidingProgress; //!< ratio progression of a sliding - ewol::object::Param m_selectNewWidget; // input config requesting + ewol::parameter::Value m_selectNewWidget; // input config requesting protected: /** * @brief Generate the move on the specific vector ID (This is not a public acces, because the vector can have some null pointer inside ...) @@ -67,7 +67,7 @@ namespace ewol { */ void subWidgetSelectSet(const std::string& _widgetName); private: - ewol::object::ParamRange m_transitionSpeed; //!< speed of the transition (default 1 == > 1s) + ewol::parameter::Range m_transitionSpeed; //!< speed of the transition (default 1 == > 1s) public: /** * @brief set transition speed element. @@ -84,7 +84,7 @@ namespace ewol { return m_transitionSpeed; }; private: - ewol::object::ParamList m_transitionSlide; //!< mode to slide the widgets + ewol::parameter::List m_transitionSlide; //!< mode to slide the widgets public: /** * @brief set a new mode of sliding element @@ -106,7 +106,7 @@ namespace ewol { virtual void onRegenerateDisplay(); virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual void periodicCall(const ewol::event::Time& _event); - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); }; }; std::ostream& operator <<(std::ostream& _os, const enum ewol::widget::WSlider::sladingMode _obj); diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 23e5b6a8..4af20b4f 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -613,7 +613,7 @@ bool ewol::Widget::systemEventInput(ewol::event::InputSystem& _event) { return onEventInput(_event.m_event); } -void ewol::Widget::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { +void ewol::Widget::onParameterChangeValue(const ewol::parameter::Ref& _paramPointer) { ewol::Object::onParameterChangeValue(_paramPointer); if (_paramPointer == m_canFocus) { if (m_hasFocus == true) { diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index 2630d8c6..44e900d9 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -228,7 +228,7 @@ namespace ewol { */ virtual vec2 getOrigin(); protected: - ewol::object::Param m_userMinSize; //!< user define the minimum size of the widget + ewol::parameter::Value m_userMinSize; //!< user define the minimum size of the widget public: /** * @brief User set the minimum size he want to set the display @@ -255,7 +255,7 @@ namespace ewol { */ virtual void checkMinSize(); protected: - ewol::object::Param m_userMaxSize; //!< user define the maximum size of the widget + ewol::parameter::Value m_userMaxSize; //!< user define the maximum size of the widget public: /** * @brief User set the maximum size he want to set the display @@ -282,7 +282,7 @@ namespace ewol { */ virtual void checkMaxSize(); protected: - ewol::object::Param m_userExpand; + ewol::parameter::Value m_userExpand; public: /** * @brief set the expend capabilities (x&y) @@ -305,7 +305,7 @@ namespace ewol { */ virtual bvec2 canExpand(); protected: - ewol::object::Param m_userFill; + ewol::parameter::Value m_userFill; public: /** * @brief set the x&y filling capacity @@ -328,7 +328,7 @@ namespace ewol { */ const bvec2& canFill(); protected: - ewol::object::Param m_hide; //!< hide a widget on the display + ewol::parameter::Value m_hide; //!< hide a widget on the display public: /** * @brief set the widget hidden @@ -351,7 +351,7 @@ namespace ewol { }; protected: - ewol::object::ParamList m_gravity; //!< Gravity of the widget + ewol::parameter::List m_gravity; //!< Gravity of the widget public: /** * @brief set the widget gravity @@ -372,7 +372,7 @@ namespace ewol { // ---------------------------------------------------------------------------------------------------------------- private: bool m_hasFocus; //!< set the focus on this widget - ewol::object::Param m_canFocus; //!< the focus can be done on this widget + ewol::parameter::Value m_canFocus; //!< the focus can be done on this widget public: /** * @brief get the focus state of the widget @@ -665,7 +665,7 @@ namespace ewol { public: // Derived function virtual bool loadXML(exml::Element* _node); protected: // Derived function - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: /** * @brief need to be call When the size of the current widget have change == > this force the system to recalculate all the widget positions @@ -696,10 +696,10 @@ namespace ewol { enum annimationMode m_annimationMode; //!< true when the annimation is started float m_annimationratio; //!< Ratio of the annimation [0..1] protected: - ewol::object::ParamList m_annimationTypeStart; //!< type of start annimation - ewol::object::ParamRange m_annimationTimeStart; //!< time to produce start annimation - ewol::object::ParamList m_annimationTypeStop; //!< type of start annimation - ewol::object::ParamRange m_annimationTimeStop; //!< time to produce start annimation + ewol::parameter::List m_annimationTypeStart; //!< type of start annimation + ewol::parameter::Range m_annimationTimeStart; //!< time to produce start annimation + ewol::parameter::List m_annimationTypeStop; //!< type of start annimation + ewol::parameter::Range m_annimationTimeStop; //!< time to produce start annimation protected: /** * @brief Add a annimation type capabilities of this widget. diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index e2dcdc8e..0ee69c7b 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -90,12 +90,14 @@ def create(target): myModule.add_src_file([ 'ewol/object/Manager.cpp', 'ewol/object/Object.cpp', - 'ewol/object/Worker.cpp', - 'ewol/object/Parameter.cpp', - 'ewol/object/ParameterList.cpp', - 'ewol/object/ParamList.cpp' + 'ewol/object/Worker.cpp' ]) - # object : + # parameter : + myModule.add_src_file([ + 'ewol/parameter/Parameter.cpp', + 'ewol/parameter/Interface.cpp', + ]) + # Signal : myModule.add_src_file([ 'ewol/signal/List.cpp', 'ewol/signal/Base.cpp' From ec3c7b2902894d825e117ae347eb68968f861777 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 30 Oct 2014 21:12:15 +0100 Subject: [PATCH 14/57] [DEV] change ewol::signal::List in ewol::signal::Interface --- external/ege | 2 +- sources/ewol/object/Manager.h | 2 +- sources/ewol/object/Object.h | 4 ++-- sources/ewol/signal/Base.cpp | 8 ++++---- sources/ewol/signal/Base.h | 8 ++++---- sources/ewol/signal/{List.cpp => Interface.cpp} | 12 ++++++------ sources/ewol/signal/{List.h => Interface.h} | 10 +++++----- sources/ewol/signal/Signal.h | 12 ++++++------ sources/lutin_ewol.py | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) rename sources/ewol/signal/{List.cpp => Interface.cpp} (68%) rename sources/ewol/signal/{List.h => Interface.h} (90%) diff --git a/external/ege b/external/ege index 343021de..6adec343 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 343021de91b1662da5dafe9ae9b6a089bb5edcfc +Subproject commit 6adec3434ea382c94554f5d8fac3b60573eae382 diff --git a/sources/ewol/object/Manager.h b/sources/ewol/object/Manager.h index fd4ee3c4..7d697a4f 100644 --- a/sources/ewol/object/Manager.h +++ b/sources/ewol/object/Manager.h @@ -17,7 +17,7 @@ namespace ewol { class Context; namespace object { - class Manager : public ewol::signal::List { + class Manager : public ewol::signal::Interface { private: std::vector> m_eObjectList; // all widget allocated == > all time increment ... never removed ... Context& m_context; diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index d39fcd9a..706bac91 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace ewol { // some class need to define element befor other ... @@ -52,7 +52,7 @@ namespace ewol { */ class Object : public std::enable_shared_from_this, public ewol::parameter::Interface, - public ewol::signal::List { + public ewol::signal::Interface { private: static size_t m_valUID; //!< Static used for the unique ID definition private: diff --git a/sources/ewol/signal/Base.cpp b/sources/ewol/signal/Base.cpp index e05872de..444ba2af 100644 --- a/sources/ewol/signal/Base.cpp +++ b/sources/ewol/signal/Base.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #ifdef DEBUG @@ -16,16 +16,16 @@ int32_t ewol::signal::Base::m_signalCallLevel = 0; #endif -ewol::signal::Base::Base(ewol::signal::List& _signalLink, +ewol::signal::Base::Base(ewol::signal::Interface& _signalInterfaceLink, const std::string& _name, const std::string& _description) : - m_signalLink(_signalLink), + m_signalInterfaceLink(_signalInterfaceLink), m_name(_name), m_description(_description), m_callInProgress(0), m_someOneRemoveInCall(false) { // add a reference on the current signal ... - m_signalLink.signalAdd(this); + m_signalInterfaceLink.signalAdd(this); } std::ostream& ewol::signal::operator <<(std::ostream& _os, const ewol::signal::Base& _obj) { diff --git a/sources/ewol/signal/Base.h b/sources/ewol/signal/Base.h index 5d26b29a..f2a3d60d 100644 --- a/sources/ewol/signal/Base.h +++ b/sources/ewol/signal/Base.h @@ -9,7 +9,7 @@ #ifndef __EWOL_SIGNAL_BASE_H__ #define __EWOL_SIGNAL_BASE_H__ -#include +#include namespace ewol { @@ -20,7 +20,7 @@ namespace ewol { static int32_t m_uidSignal; static int32_t m_signalCallLevel; #endif - ewol::signal::List& m_signalLink; + ewol::signal::Interface& m_signalInterfaceLink; std::string m_name; std::string m_description; int32_t m_callInProgress; @@ -28,11 +28,11 @@ namespace ewol { public: /** * @brief Create a parameter with a specific type. - * @param[in] _signalListLink reference on the signal list. + * @param[in] _signalInterfaceLink reference on the signal list. * @param[in] _name Static name of the parameter. * @param[in] _description description of the parameter. */ - Base(ewol::signal::List& _signalListLink, + Base(ewol::signal::Interface& _signalInterfaceLink, const std::string& _name, const std::string& _description = ""); /** diff --git a/sources/ewol/signal/List.cpp b/sources/ewol/signal/Interface.cpp similarity index 68% rename from sources/ewol/signal/List.cpp rename to sources/ewol/signal/Interface.cpp index e0875547..538dc29e 100644 --- a/sources/ewol/signal/List.cpp +++ b/sources/ewol/signal/Interface.cpp @@ -8,19 +8,19 @@ #include #include -#include +#include #include -ewol::signal::List::List() { +ewol::signal::Interface::Interface() { } -ewol::signal::List::~List() { +ewol::signal::Interface::~Interface() { m_list.clear(); } // note this pointer is not allocated and not free at the end of the class -void ewol::signal::List::signalAdd(ewol::signal::Base* _pointerOnSignal) { +void ewol::signal::Interface::signalAdd(ewol::signal::Base* _pointerOnSignal) { if (_pointerOnSignal == nullptr) { EWOL_ERROR("Try to link a nullptr parameters"); return; @@ -28,7 +28,7 @@ void ewol::signal::List::signalAdd(ewol::signal::Base* _pointerOnSignal) { m_list.push_back(_pointerOnSignal); } -std::vector ewol::signal::List::signalGetAll() const { +std::vector ewol::signal::Interface::signalGetAll() const { std::vector out; for (auto &it : m_list) { if(it != nullptr) { @@ -38,7 +38,7 @@ std::vector ewol::signal::List::signalGetAll() const { return out; } -void ewol::signal::List::signalUnBindAll(const std::shared_ptr& _object) { +void ewol::signal::Interface::signalUnBindAll(const std::shared_ptr& _object) { if (_object == nullptr) { EWOL_ERROR("Input ERROR nullptr pointer Object ..."); return; diff --git a/sources/ewol/signal/List.h b/sources/ewol/signal/Interface.h similarity index 90% rename from sources/ewol/signal/List.h rename to sources/ewol/signal/Interface.h index 0adab4f5..859f461d 100644 --- a/sources/ewol/signal/List.h +++ b/sources/ewol/signal/Interface.h @@ -7,8 +7,8 @@ */ -#ifndef __EWOL_SIGNAL_LIST_H__ -#define __EWOL_SIGNAL_LIST_H__ +#ifndef __EWOL_SIGNAL_INTERFACE_H__ +#define __EWOL_SIGNAL_INTERFACE_H__ #include #include @@ -16,7 +16,7 @@ namespace ewol { namespace signal { class Base; - class List { + class Interface { friend class ewol::signal::Base; // to register parameter in the list. private: std::vector m_list; //!< list of availlable Parameters @@ -24,11 +24,11 @@ namespace ewol { /** * @brief Constructor. */ - List(); + Interface(); /** * @brief Destructor. */ - ~List(); + ~Interface(); /** * @brief Register a parameter class pointer in the List of parameters * @note This class does not destroy the parameter pointer!!! diff --git a/sources/ewol/signal/Signal.h b/sources/ewol/signal/Signal.h index 579d246d..ecbd03c9 100644 --- a/sources/ewol/signal/Signal.h +++ b/sources/ewol/signal/Signal.h @@ -24,17 +24,17 @@ namespace ewol { public: /** * @brief Create a parameter with a specific type. - * @param[in] _objectLink reference on the parameter lister. + * @param[in] _signalInterfaceLink reference on the parameter lister. * @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. * @param[in] _description description of the parameter. */ - Signal(ewol::signal::List& _objectLink, + Signal(ewol::signal::Interface& _signalInterfaceLink, const std::string& _name, const std::string& _description = "") : - signal::Base(_objectLink, _name, _description) { + signal::Base(_signalInterfaceLink, _name, _description) { }; /** @@ -171,17 +171,17 @@ namespace ewol { public: /** * @brief Create a parameter with a specific type. - * @param[in] _objectLink reference on the parameter lister. + * @param[in] _signalInterfaceLink reference on the parameter lister. * @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. * @param[in] _description description of the parameter. */ - Signal(ewol::signal::List& _objectLink, + Signal(ewol::signal::Interface& _signalInterfaceLink, const std::string& _name, const std::string& _description = "") : - signal::Base(_objectLink, _name, _description) { + signal::Base(_signalInterfaceLink, _name, _description) { }; /** diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 0ee69c7b..100b01bd 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -99,7 +99,7 @@ def create(target): ]) # Signal : myModule.add_src_file([ - 'ewol/signal/List.cpp', + 'ewol/signal/Interface.cpp', 'ewol/signal/Base.cpp' ]) From 8ff2bfc20f307f51071eddc58cf30a7fd24d3688 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 6 Nov 2014 21:54:27 +0100 Subject: [PATCH 15/57] [DEV] simplify VBO & program API --- external/ege | 2 +- sources/ewol/resource/Program.cpp | 3 +- sources/ewol/resource/Program.h | 7 +- sources/ewol/resource/VirtualBufferObject.cpp | 72 +++++++++++++++++-- sources/ewol/resource/VirtualBufferObject.h | 54 ++++++++++---- 5 files changed, 115 insertions(+), 23 deletions(-) diff --git a/external/ege b/external/ege index 6adec343..eb762e5c 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 6adec3434ea382c94554f5d8fac3b60573eae382 +Subproject commit eb762e5c93b8e20ac862b32879da7fb3e55b6fce diff --git a/sources/ewol/resource/Program.cpp b/sources/ewol/resource/Program.cpp index 561f40d6..a89ed848 100644 --- a/sources/ewol/resource/Program.cpp +++ b/sources/ewol/resource/Program.cpp @@ -330,7 +330,6 @@ void ewol::resource::Program::sendAttribute(int32_t _idElem, } void ewol::resource::Program::sendAttributePointer(int32_t _idElem, - int32_t _nbElement, const std::shared_ptr& _vbo, int32_t _index, int32_t _jumpBetweenSample, @@ -347,7 +346,7 @@ void ewol::resource::Program::sendAttributePointer(int32_t _idElem, } glBindBuffer(GL_ARRAY_BUFFER, _vbo->getGL_ID(_index)); glVertexAttribPointer(m_elementList[_idElem].m_elementId, // attribute ID of openGL - _nbElement, // number of elements per vertex, here (r,g,b,a) + _vbo->getElementSize(_index), // number of elements per vertex, here (r,g,b,a) GL_FLOAT, // the type of each element GL_FALSE, // take our values as-is _jumpBetweenSample, // no extra data between each position diff --git a/sources/ewol/resource/Program.h b/sources/ewol/resource/Program.h index 8520c7ec..b13385df 100644 --- a/sources/ewol/resource/Program.h +++ b/sources/ewol/resource/Program.h @@ -87,18 +87,17 @@ namespace ewol { const void* _pointer, int32_t _jumpBetweenSample=0); void sendAttributePointer(int32_t _idElem, - int32_t _nbElement, const std::shared_ptr& _vbo, int32_t _index, int32_t _jumpBetweenSample=0, int32_t _offset=0); - inline void sendAttribute(int32_t _idElem, const std::vector& _data) { + inline void sendAttribute(int32_t _idElem, const std::vector& _data) { sendAttribute(_idElem, 2/*u,v / x,y*/, &_data[0]); } - inline void sendAttribute(int32_t _idElem, const std::vector& _data) { + inline void sendAttribute(int32_t _idElem, const std::vector& _data) { sendAttribute(_idElem, 3/*x,y,z,unused*/, &_data[0], 4*sizeof(btScalar)); } - inline void sendAttribute(int32_t _idElem, const std::vector >& _data) { + inline void sendAttribute(int32_t _idElem, const std::vector>& _data) { sendAttribute(_idElem, 4/*r,g,b,a*/, &_data[0]); } inline void sendAttribute(int32_t _idElem, const std::vector& _data) { diff --git a/sources/ewol/resource/VirtualBufferObject.cpp b/sources/ewol/resource/VirtualBufferObject.cpp index 5d0bb2d2..214abc17 100644 --- a/sources/ewol/resource/VirtualBufferObject.cpp +++ b/sources/ewol/resource/VirtualBufferObject.cpp @@ -20,6 +20,7 @@ void ewol::resource::VirtualBufferObject::init(int32_t _number) { for (size_t iii=0; iii TODO : Maybe update it"); + return; + } m_vboUsed[_id] = true; m_buffer[_id].push_back(_data.x()); m_buffer[_id].push_back(_data.y()); @@ -104,11 +111,20 @@ vec3 ewol::resource::VirtualBufferObject::getOnBufferVec3(int32_t _id, int32_t _ m_buffer[_id][3*_elementID+2]); } -int32_t ewol::resource::VirtualBufferObject::sizeOnBufferVec3(int32_t _id) { - return m_buffer[_id].size()/3; +int32_t ewol::resource::VirtualBufferObject::bufferSize(int32_t _id) { + return m_buffer[_id].size()/m_vboSizeDataOffset[_id]; +} +int32_t ewol::resource::VirtualBufferObject::getElementSize(int32_t _id) { + return m_vboSizeDataOffset[_id]; } void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec2& _data) { + if (m_vboSizeDataOffset[_id] == -1) { + m_vboSizeDataOffset[_id] = 2; + } else if (m_vboSizeDataOffset[_id] != 2) { + EWOL_WARNING("set multiType in VBO (Not supported ==> TODO : Maybe update it"); + return; + } m_vboUsed[_id] = true; m_buffer[_id].push_back(_data.x()); m_buffer[_id].push_back(_data.y()); @@ -122,6 +138,54 @@ vec2 ewol::resource::VirtualBufferObject::getOnBufferVec2(int32_t _id, int32_t _ m_buffer[_id][2*_elementID+1]); } -int32_t ewol::resource::VirtualBufferObject::sizeOnBufferVec2(int32_t _id) { - return m_buffer[_id].size()/2; + +void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color& _data) { + if (m_vboSizeDataOffset[_id] == -1) { + m_vboSizeDataOffset[_id] = 4; + } else if (m_vboSizeDataOffset[_id] != 4) { + EWOL_WARNING("set multiType in VBO (Not supported ==> TODO : Maybe update it"); + return; + } + m_vboUsed[_id] = true; + m_buffer[_id].push_back(_data.r()); + m_buffer[_id].push_back(_data.g()); + m_buffer[_id].push_back(_data.b()); + m_buffer[_id].push_back(_data.a()); } + +void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color& _data) { + if (m_vboSizeDataOffset[_id] == -1) { + m_vboSizeDataOffset[_id] = 3; + } else if (m_vboSizeDataOffset[_id] != 3) { + EWOL_WARNING("set multiType in VBO (Not supported ==> TODO : Maybe update it"); + return; + } + m_vboUsed[_id] = true; + m_buffer[_id].push_back(_data.r()); + m_buffer[_id].push_back(_data.g()); + m_buffer[_id].push_back(_data.b()); +} + +void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color& _data) { + if (m_vboSizeDataOffset[_id] == -1) { + m_vboSizeDataOffset[_id] = 2; + } else if (m_vboSizeDataOffset[_id] != 2) { + EWOL_WARNING("set multiType in VBO (Not supported ==> TODO : Maybe update it"); + return; + } + m_vboUsed[_id] = true; + m_buffer[_id].push_back(_data.r()); + m_buffer[_id].push_back(_data.g()); +} + +void ewol::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color& _data) { + if (m_vboSizeDataOffset[_id] == -1) { + m_vboSizeDataOffset[_id] = 1; + } else if (m_vboSizeDataOffset[_id] != 1) { + EWOL_WARNING("set multiType in VBO (Not supported ==> TODO : Maybe update it"); + return; + } + m_vboUsed[_id] = true; + m_buffer[_id].push_back(_data.r()); +} + diff --git a/sources/ewol/resource/VirtualBufferObject.h b/sources/ewol/resource/VirtualBufferObject.h index a90b8295..b6e1bf69 100644 --- a/sources/ewol/resource/VirtualBufferObject.h +++ b/sources/ewol/resource/VirtualBufferObject.h @@ -14,7 +14,9 @@ #include #include #include +#include +// TODO : Remove this ... #define NB_VBO_MAX (20) namespace ewol { @@ -29,6 +31,7 @@ namespace ewol { GLuint m_vbo[NB_VBO_MAX]; //!< openGl ID of this VBO bool m_vboUsed[NB_VBO_MAX]; //!< true if the VBO is allocated or used ... std::vector m_buffer[NB_VBO_MAX]; //!< data that is availlable in the VBO system ... + int8_t m_vboSizeDataOffset[NB_VBO_MAX]; //!< Internal size of the VBO (dynamicly set) protected: /** * @brief Constructor of this VBO. @@ -47,29 +50,56 @@ namespace ewol { * @brief get the real openGL ID. * @return the Ogl id reference of this VBO. */ - GLuint getGL_ID(int32_t id) { return m_vbo[id]; }; + GLuint getGL_ID(int32_t _id) { + return m_vbo[_id]; + }; /** * @brief get a reference on hte buffer data for this VBO. * @param[in] id Id of the buffer requested * @return A reference on the data. */ - std::vector& getRefBuffer(int32_t id) { m_vboUsed[id] = true; return m_buffer[id]; }; + std::vector& getRefBuffer(int32_t _id) { + m_vboUsed[_id] = true; + return m_buffer[_id]; + }; + /** + * @brief Get the buffer Number of element. + * @param[in] _id VBO Element + * @return Number of Float in the buffer. + */ + int32_t bufferSize(int32_t _id); + /** + * @brief Get the offset between element. + * @param[in] _id VBO Element + * @return Number of Float to jump between target. + */ + int32_t getElementSize(int32_t _id); /** * @brief push data on a buffer with a custum type : - * @param[in] id Id of the buffer requested. - * @param[in] data Direct data that might be set. + * @param[in] _id Id of the buffer requested. + * @param[in] _data Direct data that might be set. */ - void pushOnBuffer(int32_t id, const vec3& data); - vec3 getOnBufferVec3(int32_t id, int32_t elementID); - int32_t sizeOnBufferVec3(int32_t id); + void pushOnBuffer(int32_t _id, const vec3& _data); + vec3 getOnBufferVec3(int32_t _id, int32_t _elementID); /** * @brief push data on a buffer with a custum type : - * @param[in] id Id of the buffer requested. - * @param[in] data Direct data that might be set. + * @param[in] _id Id of the buffer requested. + * @param[in] _data Direct data that might be set. */ - void pushOnBuffer(int32_t id, const vec2& data); - vec2 getOnBufferVec2(int32_t id, int32_t elementID); - int32_t sizeOnBufferVec2(int32_t id); + void pushOnBuffer(int32_t _id, const vec2& _data); + vec2 getOnBufferVec2(int32_t _id, int32_t _elementID); + /** + * @brief push data on a buffer with a custum type : + * @param[in] _id Id of the buffer requested. + * @param[in] _data Direct data that might be set (Color). + */ + void pushOnBuffer(int32_t _id, const etk::Color& _data); + //! @previous + void pushOnBuffer(int32_t _id, const etk::Color& _data); + //! @previous + void pushOnBuffer(int32_t _id, const etk::Color& _data); + //! @previous + void pushOnBuffer(int32_t _id, const etk::Color& _data); /** * @brief get the data from the graphic card. */ From 627584f13d5bc368db2b5ae8d735497ba49e084e Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 7 Nov 2014 23:35:16 +0100 Subject: [PATCH 16/57] [DEV] update open GL interface --- external/etk | 2 +- sources/ewol/openGL/openGL.cpp | 54 ++++++++++++++++++++++++++++++++++ sources/ewol/openGL/openGL.h | 13 ++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/external/etk b/external/etk index 45c4fbb9..ceab3d4d 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 45c4fbb98db6b5b50599dfaef5903d3a78e63f08 +Subproject commit ceab3d4d7d578d818aa7fba11e86fa3557f14d36 diff --git a/sources/ewol/openGL/openGL.cpp b/sources/ewol/openGL/openGL.cpp index a8ee220a..9adcb4b0 100644 --- a/sources/ewol/openGL/openGL.cpp +++ b/sources/ewol/openGL/openGL.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include //#define DIRECT_MODE /** @@ -165,6 +166,59 @@ std::ostream& ewol::operator <<(std::ostream& _os, const enum openGL::openGlFlag return _os; } + +std::vector>& getListRenderMode() { + static std::vector> list = { + std::make_pair(ewol::openGL::renderPoint, "POINTS"), + std::make_pair(ewol::openGL::renderLine, "LINES"), + std::make_pair(ewol::openGL::renderLineStrip, "LINES_STRIP"), + std::make_pair(ewol::openGL::renderLineLoop, "LINE_LOOP"), + std::make_pair(ewol::openGL::renderTriangle, "TRIANGLE"), + std::make_pair(ewol::openGL::renderTriangleStrip, "TRIANGLE_STRIP"), + std::make_pair(ewol::openGL::renderTriangleFan, "TRIANGLE_FAN"), + std::make_pair(ewol::openGL::renderQuad, "QUAD"), + std::make_pair(ewol::openGL::renderQuadStrip, "QUAD_STRIP"), + std::make_pair(ewol::openGL::renderPolygon, "POLYGON"), + }; + return list; +} + + +namespace etk { + template<> std::string to_string(const ewol::openGL::renderMode& _obj) { + for (auto &it : getListRenderMode()) { + if (it.first == _obj) { + return it.second; + } + } + EWOL_ERROR("Can not convert : " << static_cast(_obj) << " return UNKNOW"); + return "UNKNOW"; + } + template<> std::u32string to_u32string(const ewol::openGL::renderMode& _obj) { + return etk::to_u32string(etk::to_string(_obj)); + } + template<> bool from_string(ewol::openGL::renderMode& _variableRet, const std::string& _value) { + for (auto &it : getListRenderMode()) { + if (it.second == _value) { + _variableRet = it.first; + return true; + } + } + EWOL_WARNING("Can not parse : '" << _value << "' set Triangle default value"); + _variableRet = ewol::openGL::renderTriangle; + return false; + } + template<> bool from_string(ewol::openGL::renderMode& _variableRet, const std::u32string& _value) { + return from_string(_variableRet, etk::to_string(_value)); + } +}; + +std::ostream& ewol::operator <<(std::ostream& _os, const enum openGL::renderMode& _obj) { + _os << etk::to_string(_obj); + return _os; +} + + typedef struct { uint32_t curentFlag; GLenum OGlFlag; diff --git a/sources/ewol/openGL/openGL.h b/sources/ewol/openGL/openGL.h index c59da45b..6a0e2bc2 100644 --- a/sources/ewol/openGL/openGL.h +++ b/sources/ewol/openGL/openGL.h @@ -141,6 +141,18 @@ namespace ewol { FLAG_ALPHA_TEST = 1<<27, //!< FLAG_FOG = 1<<28, //!< }; + enum renderMode { + renderPoint = GL_POINTS, + renderLine = GL_LINES, + renderLineStrip = GL_LINE_STRIP, //!< Not supported in EWOL (TODO : Later) + renderLineLoop = GL_LINE_LOOP, + renderTriangle = GL_TRIANGLES, + renderTriangleStrip = GL_TRIANGLE_STRIP, //!< Not supported in EWOL (TODO : Later) + renderTriangleFan = GL_TRIANGLE_FAN, //!< Not supported in EWOL (TODO : Later) + renderQuad = GL_QUADS, //!< Not supported in OpenGL-ES2 + renderQuadStrip = GL_QUAD_STRIP, //!< Not supported in OpenGL-ES2 + renderPolygon = GL_POLYGON //!< Not supported in OpenGL-ES2 + }; /** * @brief enable a flag on the system @@ -181,6 +193,7 @@ namespace ewol { void reset(); }; std::ostream& operator <<(std::ostream& _os, const enum openGL::openGlFlags& _obj); + std::ostream& operator <<(std::ostream& _os, const enum openGL::renderMode& _obj); }; From 1713685108ca9976ac638f861725e4997b88898a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 9 Nov 2014 22:56:47 +0100 Subject: [PATCH 17/57] [DEBUG] update area --- external/ege | 2 +- external/etk | 2 +- sources/ewol/compositing/Area.cpp | 2 +- sources/ewol/resource/Program.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/external/ege b/external/ege index eb762e5c..ca3ead0c 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit eb762e5c93b8e20ac862b32879da7fb3e55b6fce +Subproject commit ca3ead0c8ce3c24b8e0be38bbad853383a695f8b diff --git a/external/etk b/external/etk index ceab3d4d..f04c3dd2 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit ceab3d4d7d578d818aa7fba11e86fa3557f14d36 +Subproject commit f04c3dd23829c63e383d0b4988198e6db2847539 diff --git a/sources/ewol/compositing/Area.cpp b/sources/ewol/compositing/Area.cpp index b58c2e5c..7066b69d 100644 --- a/sources/ewol/compositing/Area.cpp +++ b/sources/ewol/compositing/Area.cpp @@ -61,7 +61,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) { // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix); // TextureID m_GLprogram->setTexture0(m_GLtexID, m_resource->getId()); // position : diff --git a/sources/ewol/resource/Program.h b/sources/ewol/resource/Program.h index b13385df..6b5837e1 100644 --- a/sources/ewol/resource/Program.h +++ b/sources/ewol/resource/Program.h @@ -117,7 +117,7 @@ namespace ewol { * @param[in] _pointer Pointer on the data that might be sended * @param[in] _transpose Transpose the matrix (needed all the taime in the normal openGl access (only not done in the openGL-ES2 due to the fact we must done it ourself) */ - void uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _pointer, bool _transpose=true); + void uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _matrix, bool _transpose=true); inline void uniform(int32_t _idElem, const etk::Color& _value) { uniform4f(_idElem, _value.r(), _value.g(), _value.b(), _value.a()); From e912cd44e3114651b1f69b8b028b89b805398d96 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 11 Nov 2014 23:12:08 +0100 Subject: [PATCH 18/57] [DEV] remove an unneeded widget update --- external/ege | 2 +- sources/ewol/widget/Widget.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/external/ege b/external/ege index ca3ead0c..13c661d2 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit ca3ead0c8ce3c24b8e0be38bbad853383a695f8b +Subproject commit 13c661d29fc3b5cb08f1478046a150f556257b97 diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 4af20b4f..2fe3cff2 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -146,8 +146,12 @@ ewol::Widget::~Widget() { } void ewol::Widget::calculateSize(const vec2& _available) { - m_size = _available; - m_size.setMax(m_minSize); + vec2 size = _available; + size.setMax(m_minSize); + if (m_size == size) { + return; + } + m_size = size; markToRedraw(); } From 4e88d081d8d8386842878e4cd1f4e5a0dc6f5bcc Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 13 Nov 2014 00:05:20 +0100 Subject: [PATCH 19/57] [DEBUG] missing translation matrix --- data/color3.vert | 3 ++- external/ege | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/color3.vert b/data/color3.vert index 76c3f049..10c287e0 100644 --- a/data/color3.vert +++ b/data/color3.vert @@ -7,12 +7,13 @@ precision mediump int; attribute vec3 EW_coord3d; attribute vec4 EW_color; uniform mat4 EW_MatrixTransformation; +uniform mat4 EW_MatrixPosition; // output : varying vec4 f_color; void main(void) { - gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0); + gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0); //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0); f_color = EW_color; } diff --git a/external/ege b/external/ege index 13c661d2..59a2162d 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 13c661d29fc3b5cb08f1478046a150f556257b97 +Subproject commit 59a2162deb1cf0e1cad78f11f2bc1ffe36619baf From 86fa583a5582faa847e4e13e85d4ad979995c771 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 13 Nov 2014 21:11:53 +0100 Subject: [PATCH 20/57] [DEV] normalize openGL interface for matrix --- external/ege | 2 +- sources/ewol/compositing/Area.cpp | 2 +- sources/ewol/compositing/Drawing.cpp | 10 +++++++--- sources/ewol/compositing/Drawing.h | 5 +++-- sources/ewol/compositing/Image.cpp | 2 +- sources/ewol/compositing/Shaper.cpp | 2 +- sources/ewol/compositing/Text.cpp | 4 ++-- sources/ewol/compositing/TextDF.cpp | 4 ++-- sources/ewol/resource/Colored3DObject.cpp | 6 +++--- sources/ewol/resource/Program.cpp | 9 ++++++--- sources/ewol/resource/Program.h | 5 ++--- 11 files changed, 29 insertions(+), 22 deletions(-) diff --git a/external/ege b/external/ege index 59a2162d..714662d7 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 59a2162deb1cf0e1cad78f11f2bc1ffe36619baf +Subproject commit 714662d7a923c7c451b1a02a636c8c0e3fefce5c diff --git a/sources/ewol/compositing/Area.cpp b/sources/ewol/compositing/Area.cpp index 7066b69d..e8bb6d75 100644 --- a/sources/ewol/compositing/Area.cpp +++ b/sources/ewol/compositing/Area.cpp @@ -61,7 +61,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) { // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // TextureID m_GLprogram->setTexture0(m_GLtexID, m_resource->getId()); // position : diff --git a/sources/ewol/compositing/Drawing.cpp b/sources/ewol/compositing/Drawing.cpp index 08f7d09d..8b0ef79b 100644 --- a/sources/ewol/compositing/Drawing.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -227,6 +227,7 @@ ewol::compositing::Drawing::Drawing() : m_GLprogram(nullptr), m_GLPosition(-1), m_GLMatrix(-1), + m_GLMatrixPosition(-1), m_GLColor(-1), m_thickness(0.0), m_triElement(0) { @@ -288,8 +289,9 @@ void ewol::compositing::Drawing::loadProgram() { // get the shader resource : if (nullptr != m_GLprogram ) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); - m_GLColor = m_GLprogram->getAttribute("EW_color"); - m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation"); + m_GLColor = m_GLprogram->getAttribute("EW_color"); + m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation"); + m_GLMatrixPosition = m_GLprogram->getUniform("EW_MatrixPosition"); } } @@ -306,7 +308,9 @@ void ewol::compositing::Drawing::draw(bool _disableDepthTest) { // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); + mat4 tmpMatrix2; + m_GLprogram->uniformMatrix(m_GLMatrixPosition, tmpMatrix2); // position : m_GLprogram->sendAttribute(m_GLPosition, m_coord); // color : diff --git a/sources/ewol/compositing/Drawing.h b/sources/ewol/compositing/Drawing.h index 69c26dc9..dfdff3a8 100644 --- a/sources/ewol/compositing/Drawing.h +++ b/sources/ewol/compositing/Drawing.h @@ -30,8 +30,9 @@ namespace ewol { private: std::shared_ptr m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) - int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) - int32_t m_GLColor; //!< openGL id on the element (color buffer) + int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) + int32_t m_GLMatrixPosition; //!< position matrix + int32_t m_GLColor; //!< openGL id on the element (color buffer) private: // Background Color (display only when needed) std::vector m_coord; //!< internal position for the text display std::vector > m_coordColor; //!< internal color of the background diff --git a/sources/ewol/compositing/Image.cpp b/sources/ewol/compositing/Image.cpp index a35b52fb..17a1711c 100644 --- a/sources/ewol/compositing/Image.cpp +++ b/sources/ewol/compositing/Image.cpp @@ -78,7 +78,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) { // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // TextureID if (m_resource != nullptr) { if (m_distanceFieldMode == true) { diff --git a/sources/ewol/compositing/Shaper.cpp b/sources/ewol/compositing/Shaper.cpp index 781f5c46..d06d3f34 100644 --- a/sources/ewol/compositing/Shaper.cpp +++ b/sources/ewol/compositing/Shaper.cpp @@ -184,7 +184,7 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) { m_GLprogram->use(); // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // position : m_GLprogram->sendAttribute(m_GLPosition, 2/*x,y*/, m_coord); // property diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index 94ba13c6..81882932 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -51,7 +51,7 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // Texture : m_GLprogram->setTexture0(m_GLtexID, m_font->getId()); m_GLprogram->uniform1i(m_GLtextWidth, m_font->getOpenGlSize().x()); @@ -90,7 +90,7 @@ void ewol::compositing::Text::drawD(bool _disableDepthTest) { // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // Texture : m_GLprogram->setTexture0(m_GLtexID, m_font->getId()); m_GLprogram->uniform1i(m_GLtextWidth, m_font->getOpenGlSize().x()); diff --git a/sources/ewol/compositing/TextDF.cpp b/sources/ewol/compositing/TextDF.cpp index 88ad96c6..16bfb9e4 100644 --- a/sources/ewol/compositing/TextDF.cpp +++ b/sources/ewol/compositing/TextDF.cpp @@ -62,7 +62,7 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _ mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // Texture : m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getId()); m_GLprogram->uniform1i(m_GLtextWidth, m_fontDF->getOpenGlSize().x()); @@ -100,7 +100,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) { // set Matrix : translation/positionMatrix mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply; m_GLprogram->use(); - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // Texture : m_GLprogram->setTexture0(m_GLtexID, m_fontDF->getId()); m_GLprogram->uniform1i(m_GLtextWidth, m_fontDF->getOpenGlSize().x()); diff --git a/sources/ewol/resource/Colored3DObject.cpp b/sources/ewol/resource/Colored3DObject.cpp index 321ff472..b1f7a084 100644 --- a/sources/ewol/resource/Colored3DObject.cpp +++ b/sources/ewol/resource/Colored3DObject.cpp @@ -59,7 +59,7 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, mat4 projMatrix = ewol::openGL::getMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix; - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // position : m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &_vertices[0], 4*sizeof(float)); // color : @@ -102,7 +102,7 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, mat4 projMatrix = ewol::openGL::getMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix; - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // position : m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float)); // color : @@ -142,7 +142,7 @@ void ewol::resource::Colored3DObject::drawLine(std::vector& _vertices, mat4 projMatrix = ewol::openGL::getMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix(); mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix; - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); + m_GLprogram->uniformMatrix(m_GLMatrix, tmpMatrix); // position : m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float)); // color : diff --git a/sources/ewol/resource/Program.cpp b/sources/ewol/resource/Program.cpp index a89ed848..d7638c01 100644 --- a/sources/ewol/resource/Program.cpp +++ b/sources/ewol/resource/Program.cpp @@ -358,7 +358,7 @@ void ewol::resource::Program::sendAttributePointer(int32_t _idElem, ////////////////////////////////////////////////////////////////////////////////////////////// -void ewol::resource::Program::uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _matrix, bool _transpose) { +void ewol::resource::Program::uniformMatrix(int32_t _idElem, const mat4& _matrix, bool _transpose) { if (0 == m_program) { return; } @@ -371,9 +371,12 @@ void ewol::resource::Program::uniformMatrix4fv(int32_t _idElem, int32_t _nbEleme } // note : Android des not supported the transposition of the matrix, then we will done it oursef: if (true == _transpose) { - _matrix.transpose(); + mat4 tmp = _matrix; + tmp.transpose(); + glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, tmp.m_mat); + } else { + glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, _matrix.m_mat); } - glUniformMatrix4fv(m_elementList[_idElem].m_elementId, _nbElement, GL_FALSE, _matrix.m_mat); //checkGlError("glUniformMatrix4fv", __LINE__); } diff --git a/sources/ewol/resource/Program.h b/sources/ewol/resource/Program.h index 6b5837e1..5d2c6372 100644 --- a/sources/ewol/resource/Program.h +++ b/sources/ewol/resource/Program.h @@ -113,11 +113,10 @@ namespace ewol { /** * @brief Send a uniform element to the spefified ID (not send if does not really exist in the openGL program) * @param[in] _idElem Id of the uniform that might be sended. - * @param[in] _nbElement Specifies the number of elements that are to be modified. This should be 1 if the targeted uniform variable is not an array, and 1 or more if it is an array. - * @param[in] _pointer Pointer on the data that might be sended + * @param[in] _matrix Matrix that might be sended. * @param[in] _transpose Transpose the matrix (needed all the taime in the normal openGl access (only not done in the openGL-ES2 due to the fact we must done it ourself) */ - void uniformMatrix4fv(int32_t _idElem, int32_t _nbElement, mat4 _matrix, bool _transpose=true); + void uniformMatrix(int32_t _idElem, const mat4& _matrix, bool _transpose=true); inline void uniform(int32_t _idElem, const etk::Color& _value) { uniform4f(_idElem, _value.r(), _value.g(), _value.b(), _value.a()); From 0d23654379473b9459f54e14930d2fe00cd86f06 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 21 Nov 2014 21:46:19 +0100 Subject: [PATCH 21/57] [DEBUG] add resource::Program id checker --- data/textured3D2.frag | 3 --- external/ege | 2 +- external/etk | 2 +- sources/ewol/openGL/openGL.cpp | 8 ++++---- sources/ewol/resource/Program.cpp | 8 ++++++++ sources/ewol/resource/Program.h | 6 ++++++ 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/data/textured3D2.frag b/data/textured3D2.frag index 65634b55..7ac89bc1 100644 --- a/data/textured3D2.frag +++ b/data/textured3D2.frag @@ -50,9 +50,6 @@ void main(void) { specularLight = pow(ecNormalDotLightHalfplane, EW_material.shininess) * EW_directionalLight.specularColor * EW_material.specularFactor; specularLight = EW_directionalLight.specularColor * EW_material.specularFactor; } - - vec4 light = ambientLight + diffuseLight + specularLight; - gl_FragColor = tmpElementColor * light; } diff --git a/external/ege b/external/ege index 714662d7..e0f0c1d6 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 714662d7a923c7c451b1a02a636c8c0e3fefce5c +Subproject commit e0f0c1d65b779382b3a3fd793fb074e377c9a5bc diff --git a/external/etk b/external/etk index f04c3dd2..4b3cdf01 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit f04c3dd23829c63e383d0b4988198e6db2847539 +Subproject commit 4b3cdf01560a946189388870242a86484144863d diff --git a/sources/ewol/openGL/openGL.cpp b/sources/ewol/openGL/openGL.cpp index 9adcb4b0..4bcc3a59 100644 --- a/sources/ewol/openGL/openGL.cpp +++ b/sources/ewol/openGL/openGL.cpp @@ -329,19 +329,19 @@ void ewol::openGL::updateAllFlags() { #endif // check if fhags has change : if (l_flagsMustBeSet == l_flagsCurrent ) { - //EWOL_INFO("real flag set : " << l_flagsMustBeSet << " " << l_flagsCurrent); + EWOL_INFO("OGL: current flag : " << (enum openGL::openGlFlags)l_flagsMustBeSet); return; } - //EWOL_INFO("real flag set : " << l_flagsMustBeSet); + EWOL_INFO("OGL: set new flag : " << (enum openGL::openGlFlags)l_flagsMustBeSet); for (int32_t iii=0; iii m_elementList.size()) { + return false; + } + return m_elementList[_idElem].m_isLinked; +} + int32_t ewol::resource::Program::getAttribute(std::string _elementName) { // check if it exist previously : for(size_t iii=0; iii Date: Mon, 24 Nov 2014 22:09:20 +0100 Subject: [PATCH 22/57] [DEV] start rework interface OpenGl ==> all must be called by ewol::openGL namespace --- data/color3.frag | 2 +- data/color3.vert | 1 - external/ege | 2 +- sources/ewol/context/Context.cpp | 2 +- sources/ewol/openGL/openGL.cpp | 71 +++++++++++++++++++ sources/ewol/openGL/openGL.h | 7 ++ sources/ewol/resource/Program.cpp | 50 +++++++++++-- sources/ewol/resource/Program.h | 4 ++ sources/ewol/resource/Shader.cpp | 15 ++-- sources/ewol/resource/VirtualBufferObject.cpp | 34 ++++----- sources/ewol/resource/VirtualBufferObject.h | 12 ++-- 11 files changed, 156 insertions(+), 44 deletions(-) diff --git a/data/color3.frag b/data/color3.frag index cb8e54cd..0d439173 100644 --- a/data/color3.frag +++ b/data/color3.frag @@ -6,5 +6,5 @@ precision mediump int; varying vec4 f_color; void main(void) { - gl_FragColor = f_color; + gl_FragColor = f_color; } diff --git a/data/color3.vert b/data/color3.vert index 10c287e0..d12c73b9 100644 --- a/data/color3.vert +++ b/data/color3.vert @@ -14,6 +14,5 @@ varying vec4 f_color; void main(void) { gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0); - //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0); f_color = EW_color; } diff --git a/external/ege b/external/ege index e0f0c1d6..c838fc6e 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit e0f0c1d65b779382b3a3fd793fb074e377c9a5bc +Subproject commit c838fc6e3e6bb6e0419d7e45a8cd15a1794e617c diff --git a/sources/ewol/context/Context.cpp b/sources/ewol/context/Context.cpp index dbbd4d19..88dec9d3 100644 --- a/sources/ewol/context/Context.cpp +++ b/sources/ewol/context/Context.cpp @@ -641,7 +641,7 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) { m_FpsFlush.tic(); m_FpsFlush.incrementCounter(); } - glFlush(); + ewol::openGL::flush(); //glFinish(); if (m_displayFps == true) { m_FpsFlush.toc(); diff --git a/sources/ewol/openGL/openGL.cpp b/sources/ewol/openGL/openGL.cpp index 4bcc3a59..4637cda6 100644 --- a/sources/ewol/openGL/openGL.cpp +++ b/sources/ewol/openGL/openGL.cpp @@ -12,6 +12,22 @@ #include #include //#define DIRECT_MODE + + +static void checkGlError(const char* _op, int32_t _localLine) { + bool isPresent = false; + for (GLint error = glGetError(); error; error = glGetError()) { + EWOL_ERROR("after " << _op << "():" << _localLine << " glError(" << error << ")"); + isPresent = true; + } + if (isPresent == true) { + EWOL_CRITICAL("plop"); + } +} + + + + /** * @brief get the draw mutex (ewol render). * @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time. @@ -112,6 +128,10 @@ void ewol::openGL::finish() { void ewol::openGL::flush() { l_programId = -1; l_textureflags = 0; + glFlush(); + EWOL_ERROR("========================" ); + EWOL_ERROR("== FLUSH OPEN GL ==" ); + EWOL_ERROR("========================"); } void ewol::openGL::swap() { @@ -415,3 +435,54 @@ void ewol::openGL::useProgram(int32_t _id) { } + + +bool ewol::openGL::genBuffers(std::vector& _buffers) { + if (_buffers.size() == 0) { + EWOL_WARNING("try to generate vector buffer with size 0"); + return true; + } + EWOL_VERBOSE("Create N=" << _buffers.size() << " Buffer"); + glGenBuffers(_buffers.size(), &_buffers[0]); + checkGlError("glGenBuffers", __LINE__); + bool hasError = false; + for (size_t iii=0; iii<_buffers.size(); iii++) { + if (_buffers[iii] == 0) { + EWOL_ERROR("[" << iii << "] error to create a buffer id=" << _buffers[iii]); + hasError = true; + } + } + return hasError; +} + +bool ewol::openGL::deleteBuffers(std::vector& _buffers) { + if (_buffers.size() == 0) { + EWOL_WARNING("try to delete vector buffer with size 0"); + return true; + } + glDeleteBuffers(_buffers.size(), &_buffers[0]); + checkGlError("glDeleteBuffers", __LINE__); + for (auto &it : _buffers) { + it = 0; + } + return true; +} + +bool ewol::openGL::bindBuffer(GLuint _bufferId) { + glBindBuffer(GL_ARRAY_BUFFER, _bufferId); + checkGlError("glBindBuffer", __LINE__); + return true; +} + +bool ewol::openGL::bufferData(size_t _size, const void* _data, GLenum _usage) { + glBufferData(GL_ARRAY_BUFFER, _size, _data, _usage); + checkGlError("glBufferData", __LINE__); + return true; +} + +bool ewol::openGL::unbindBuffer() { + glBindBuffer(GL_ARRAY_BUFFER, 0); + checkGlError("glBindBuffer(0)", __LINE__); + return true; +} + diff --git a/sources/ewol/openGL/openGL.h b/sources/ewol/openGL/openGL.h index 6a0e2bc2..48e73ad2 100644 --- a/sources/ewol/openGL/openGL.h +++ b/sources/ewol/openGL/openGL.h @@ -191,6 +191,13 @@ namespace ewol { */ void useProgram(int32_t _id); void reset(); + + + bool genBuffers(std::vector& _buffers); + bool deleteBuffers(std::vector& _buffers); + bool bindBuffer(GLuint _bufferId); + bool bufferData(size_t _size, const void* _data, GLenum _usage); + bool unbindBuffer(); }; std::ostream& operator <<(std::ostream& _os, const enum openGL::openGlFlags& _obj); std::ostream& operator <<(std::ostream& _os, const enum openGL::renderMode& _obj); diff --git a/sources/ewol/resource/Program.cpp b/sources/ewol/resource/Program.cpp index 554c082e..8f70a27c 100644 --- a/sources/ewol/resource/Program.cpp +++ b/sources/ewol/resource/Program.cpp @@ -107,9 +107,32 @@ ewol::resource::Program::~Program() { m_hasTexture1 = false; } +std::ostream& ewol::resource::operator <<(std::ostream& _os, const ewol::resource::progAttributeElement& _obj) { + _os << "{"; + _os << "[" << _obj.m_name << "] "; + _os << _obj.m_elementId << " "; + _os << _obj.m_isLinked; + _os << "}"; + return _os; +} + +std::ostream& ewol::resource::operator <<(std::ostream& _os, const std::vector& _obj){ + _os << "{"; + for (auto &it : _obj) { + _os << it; + } + _os << "}"; + return _os; +} + static void checkGlError(const char* _op, int32_t _localLine) { + bool isPresent = false; for (GLint error = glGetError(); error; error = glGetError()) { - EWOL_INFO("after " << _op << "():" << _localLine << " glError(" << error << ")"); + EWOL_ERROR("after " << _op << "():" << _localLine << " glError(" << error << ")"); + isPresent = true; + } + if (isPresent == true) { + EWOL_CRITICAL("plop"); } } @@ -138,8 +161,10 @@ int32_t ewol::resource::Program::getAttribute(std::string _elementName) { tmp.m_isLinked = true; if (tmp.m_elementId<0) { checkGlError("glGetAttribLocation", __LINE__); - EWOL_WARNING("glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); + EWOL_WARNING(" [" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); tmp.m_isLinked = false; + } else { + EWOL_INFO(" [" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); } m_elementList.push_back(tmp); return m_elementList.size()-1; @@ -159,8 +184,10 @@ int32_t ewol::resource::Program::getUniform(std::string _elementName) { tmp.m_isLinked = true; if (tmp.m_elementId<0) { checkGlError("glGetUniformLocation", __LINE__); - EWOL_WARNING("glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); + EWOL_WARNING(" [" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); tmp.m_isLinked = false; + } else { + EWOL_INFO(" [" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); } m_elementList.push_back(tmp); return m_elementList.size()-1; @@ -326,6 +353,7 @@ void ewol::resource::Program::sendAttribute(int32_t _idElem, if (m_elementList[_idElem].m_isLinked == false) { return; } + EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " element"); glVertexAttribPointer(m_elementList[_idElem].m_elementId, // attribute ID of openGL _nbElement, // number of elements per vertex, here (r,g,b,a) GL_FLOAT, // the type of each element @@ -352,16 +380,23 @@ void ewol::resource::Program::sendAttributePointer(int32_t _idElem, if (false == m_elementList[_idElem].m_isLinked) { return; } + EWOL_INFO(m_elementList); + EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _vbo->getElementSize(_index) << " element on oglID=" << _vbo->getGL_ID(_index) << " VBOindex=" << _index); glBindBuffer(GL_ARRAY_BUFFER, _vbo->getGL_ID(_index)); + checkGlError("glBindBuffer", __LINE__); + EWOL_ERROR(" id=" << m_elementList[_idElem].m_elementId); + EWOL_ERROR(" eleme size=" << _vbo->getElementSize(_index)); + EWOL_ERROR(" jump sample=" << _jumpBetweenSample); + EWOL_ERROR(" offset=" << _offset); glVertexAttribPointer(m_elementList[_idElem].m_elementId, // attribute ID of openGL _vbo->getElementSize(_index), // number of elements per vertex, here (r,g,b,a) GL_FLOAT, // the type of each element GL_FALSE, // take our values as-is _jumpBetweenSample, // no extra data between each position (GLvoid *)_offset); // Pointer on the buffer - //checkGlError("glVertexAttribPointer", __LINE__); + checkGlError("glVertexAttribPointer", __LINE__); glEnableVertexAttribArray(m_elementList[_idElem].m_elementId); - //checkGlError("glEnableVertexAttribArray", __LINE__); + checkGlError("glEnableVertexAttribArray", __LINE__); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -377,10 +412,12 @@ void ewol::resource::Program::uniformMatrix(int32_t _idElem, const mat4& _matrix if (false == m_elementList[_idElem].m_isLinked) { return; } + EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send 1 matrix"); // note : Android des not supported the transposition of the matrix, then we will done it oursef: if (true == _transpose) { mat4 tmp = _matrix; tmp.transpose(); + EWOL_ERROR("matrix:" << tmp); glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, tmp.m_mat); } else { glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, _matrix.m_mat); @@ -443,6 +480,7 @@ void ewol::resource::Program::uniform4f(int32_t _idElem, float _value1, float _v if (false == m_elementList[_idElem].m_isLinked) { return; } + EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send 4 values"); glUniform4f(m_elementList[_idElem].m_elementId, _value1, _value2, _value3, _value4); //checkGlError("glUniform4f", __LINE__); } @@ -572,6 +610,7 @@ void ewol::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, co EWOL_ERROR("nullptr Input pointer to send at open GL ..."); return; } + EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec3"); glUniform3fv(m_elementList[_idElem].m_elementId, _nbElement, _value); //checkGlError("glUniform3fv", __LINE__); } @@ -594,6 +633,7 @@ void ewol::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, co EWOL_ERROR("nullptr Input pointer to send at open GL ..."); return; } + EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec4"); glUniform4fv(m_elementList[_idElem].m_elementId, _nbElement, _value); //checkGlError("glUniform4fv", __LINE__); } diff --git a/sources/ewol/resource/Program.h b/sources/ewol/resource/Program.h index c2262324..b25d1bc9 100644 --- a/sources/ewol/resource/Program.h +++ b/sources/ewol/resource/Program.h @@ -33,6 +33,10 @@ namespace ewol { bool m_isAttribute; //!< true if it was an attribute element, otherwite it was an uniform bool m_isLinked; //!< if this element does not exist this is false }; + //! @not-in-doc + std::ostream& operator <<(std::ostream& _os, const ewol::resource::progAttributeElement& _obj); + //! @not-in-doc + std::ostream& operator <<(std::ostream& _os, const std::vector& _obj); /** * @brief Program is a compilation of some fragment Shader and vertex Shader. This construct automaticly this assiciation * The input file must have the form : "myFile.prog" diff --git a/sources/ewol/resource/Shader.cpp b/sources/ewol/resource/Shader.cpp index a93a320e..b7378bda 100644 --- a/sources/ewol/resource/Shader.cpp +++ b/sources/ewol/resource/Shader.cpp @@ -55,7 +55,7 @@ ewol::resource::Shader::~Shader() { static void checkGlError(const char* _op) { for (GLint error = glGetError(); error; error = glGetError()) { - EWOL_INFO("after " << _op << "() glError (" << error << ")"); + EWOL_ERROR("after " << _op << "() glError (" << error << ")"); } } #define LOG_OGL_INTERNAL_BUFFER_LEN (8192) @@ -70,13 +70,15 @@ void ewol::resource::Shader::updateContext() { m_shader = 0; return; } + EWOL_INFO("Create Shader : '" << m_name << "'"); m_shader = glCreateShader(m_type); if (!m_shader) { EWOL_ERROR("glCreateShader return error ..."); checkGlError("glCreateShader"); + EWOL_CRITICAL(" can not load shader"); return; } else { - //EWOL_INFO("Creater shader with GLID=" << m_shader); + EWOL_INFO("Compile shader with GLID=" << m_shader); glShaderSource(m_shader, 1, (const char**)&m_fileData, nullptr); glCompileShader(m_shader); GLint compiled = 0; @@ -95,6 +97,7 @@ void ewol::resource::Shader::updateContext() { for (size_t iii=0 ; iii #include -// TODO : Remove this ... -#define NB_VBO_MAX (20) - namespace ewol { namespace resource { /** @@ -26,12 +23,11 @@ namespace ewol { */ class VirtualBufferObject : public ewol::Resource { private : - size_t m_nbVBO; bool m_exist; //!< This data is availlable in the Graphic card - GLuint m_vbo[NB_VBO_MAX]; //!< openGl ID of this VBO - bool m_vboUsed[NB_VBO_MAX]; //!< true if the VBO is allocated or used ... - std::vector m_buffer[NB_VBO_MAX]; //!< data that is availlable in the VBO system ... - int8_t m_vboSizeDataOffset[NB_VBO_MAX]; //!< Internal size of the VBO (dynamicly set) + std::vector m_vbo; //!< openGl ID of this VBO + std::vector m_vboUsed; //!< true if the VBO is allocated or used ... + std::vector> m_buffer; //!< data that is availlable in the VBO system ... + std::vector m_vboSizeDataOffset; //!< Internal size of the VBO (dynamicly set) protected: /** * @brief Constructor of this VBO. From b9433d2cb78a101f462c7f90bb81d4d60511e15d Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 24 Nov 2014 22:30:12 +0100 Subject: [PATCH 23/57] [DEBUG] correst VBO offset error --- sources/ewol/resource/VirtualBufferObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/ewol/resource/VirtualBufferObject.cpp b/sources/ewol/resource/VirtualBufferObject.cpp index 38bd89b3..d54cedcf 100644 --- a/sources/ewol/resource/VirtualBufferObject.cpp +++ b/sources/ewol/resource/VirtualBufferObject.cpp @@ -19,7 +19,7 @@ void ewol::resource::VirtualBufferObject::init(int32_t _number) { m_vbo.resize(_number, 0); m_vboUsed.resize(_number, false); m_buffer.resize(_number); - m_vboSizeDataOffset.resize(_number, 0); + m_vboSizeDataOffset.resize(_number, -1); EWOL_DEBUG("OGL : load VBO count=\"" << _number << "\""); } From 3d0e63f5a682e41eeab65b28b2c14c9c15f73a59 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 24 Nov 2014 23:47:42 +0100 Subject: [PATCH 24/57] [DEV] remove some logs --- external/ege | 2 +- sources/ewol/openGL/openGL.cpp | 34 +++++++++++++++++++------------ sources/ewol/resource/Program.cpp | 20 +++++++++--------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/external/ege b/external/ege index c838fc6e..2ffa87dd 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit c838fc6e3e6bb6e0419d7e45a8cd15a1794e617c +Subproject commit 2ffa87dd73f54e2e431c2735d9145c280a57646f diff --git a/sources/ewol/openGL/openGL.cpp b/sources/ewol/openGL/openGL.cpp index 4637cda6..cc6d2306 100644 --- a/sources/ewol/openGL/openGL.cpp +++ b/sources/ewol/openGL/openGL.cpp @@ -13,19 +13,27 @@ #include //#define DIRECT_MODE +#define CHECK_ERROR_OPENGL static void checkGlError(const char* _op, int32_t _localLine) { - bool isPresent = false; + #ifdef CHECK_ERROR_OPENGL + bool hasError = false; for (GLint error = glGetError(); error; error = glGetError()) { EWOL_ERROR("after " << _op << "():" << _localLine << " glError(" << error << ")"); - isPresent = true; + hasError = true; } - if (isPresent == true) { + if (hasError == true) { EWOL_CRITICAL("plop"); } + #endif } - +#define OPENGL_ERROR(data) do { } while (false) +//#define OPENGL_ERROR(data) EWOL_ERROR(data) +#define OPENGL_WARNING(data) do { } while (false) +//#define OPENGL_WARNING(data) EWOL_WARNING(data) +#define OPENGL_INFO(data) do { } while (false) +//#define OPENGL_INFO(data) EWOL_INFO(data) /** @@ -129,9 +137,9 @@ void ewol::openGL::flush() { l_programId = -1; l_textureflags = 0; glFlush(); - EWOL_ERROR("========================" ); - EWOL_ERROR("== FLUSH OPEN GL ==" ); - EWOL_ERROR("========================"); + OPENGL_INFO("========================" ); + OPENGL_INFO("== FLUSH OPEN GL ==" ); + OPENGL_INFO("========================"); } void ewol::openGL::swap() { @@ -314,7 +322,7 @@ void ewol::openGL::reset() { } void ewol::openGL::enable(enum ewol::openGL::openGlFlags _flagID) { - //EWOL_INFO("Enable : " << _flagID); + //EWOL_INFO("Enable : " & _buffers) { EWOL_WARNING("try to generate vector buffer with size 0"); return true; } - EWOL_VERBOSE("Create N=" << _buffers.size() << " Buffer"); + OPENGL_INFO("Create N=" << _buffers.size() << " Buffer"); glGenBuffers(_buffers.size(), &_buffers[0]); checkGlError("glGenBuffers", __LINE__); bool hasError = false; diff --git a/sources/ewol/resource/Program.cpp b/sources/ewol/resource/Program.cpp index 8f70a27c..98836692 100644 --- a/sources/ewol/resource/Program.cpp +++ b/sources/ewol/resource/Program.cpp @@ -42,7 +42,7 @@ void ewol::resource::Program::init(const std::string& _filename) { tmpFilename.erase(tmpFilename.size()-4, 4); std::shared_ptr tmpShader = ewol::resource::Shader::create(tmpFilename+"vert"); if (nullptr == tmpShader) { - EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename); + EWOL_ERROR("Error while getting a specific shader filename : " << tmpFilename); return; } else { EWOL_DEBUG("Add shader on program : "<< tmpFilename << "vert"); @@ -50,7 +50,7 @@ void ewol::resource::Program::init(const std::string& _filename) { } tmpShader = ewol::resource::Shader::create(tmpFilename+"frag"); if (nullptr == tmpShader) { - EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename); + EWOL_ERROR("Error while getting a specific shader filename : " << tmpFilename); return; } else { EWOL_DEBUG("Add shader on program : "<< tmpFilename << "frag"); @@ -86,7 +86,7 @@ void ewol::resource::Program::init(const std::string& _filename) { std::string tmpFilename = file.getRelativeFolder() + tmpData; std::shared_ptr tmpShader = ewol::resource::Shader::create(tmpFilename); if (nullptr == tmpShader) { - EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename); + EWOL_ERROR("Error while getting a specific shader filename : " << tmpFilename); } else { EWOL_DEBUG("Add shader on program : "<< tmpFilename); m_shaderList.push_back(tmpShader); @@ -353,7 +353,7 @@ void ewol::resource::Program::sendAttribute(int32_t _idElem, if (m_elementList[_idElem].m_isLinked == false) { return; } - EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " element"); + //EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " element"); glVertexAttribPointer(m_elementList[_idElem].m_elementId, // attribute ID of openGL _nbElement, // number of elements per vertex, here (r,g,b,a) GL_FLOAT, // the type of each element @@ -380,14 +380,15 @@ void ewol::resource::Program::sendAttributePointer(int32_t _idElem, if (false == m_elementList[_idElem].m_isLinked) { return; } - EWOL_INFO(m_elementList); - EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _vbo->getElementSize(_index) << " element on oglID=" << _vbo->getGL_ID(_index) << " VBOindex=" << _index); + //EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _vbo->getElementSize(_index) << " element on oglID=" << _vbo->getGL_ID(_index) << " VBOindex=" << _index); glBindBuffer(GL_ARRAY_BUFFER, _vbo->getGL_ID(_index)); checkGlError("glBindBuffer", __LINE__); + /* EWOL_ERROR(" id=" << m_elementList[_idElem].m_elementId); EWOL_ERROR(" eleme size=" << _vbo->getElementSize(_index)); EWOL_ERROR(" jump sample=" << _jumpBetweenSample); EWOL_ERROR(" offset=" << _offset); + */ glVertexAttribPointer(m_elementList[_idElem].m_elementId, // attribute ID of openGL _vbo->getElementSize(_index), // number of elements per vertex, here (r,g,b,a) GL_FLOAT, // the type of each element @@ -412,12 +413,11 @@ void ewol::resource::Program::uniformMatrix(int32_t _idElem, const mat4& _matrix if (false == m_elementList[_idElem].m_isLinked) { return; } - EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send 1 matrix"); + //EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send 1 matrix"); // note : Android des not supported the transposition of the matrix, then we will done it oursef: if (true == _transpose) { mat4 tmp = _matrix; tmp.transpose(); - EWOL_ERROR("matrix:" << tmp); glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, tmp.m_mat); } else { glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, _matrix.m_mat); @@ -610,7 +610,7 @@ void ewol::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, co EWOL_ERROR("nullptr Input pointer to send at open GL ..."); return; } - EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec3"); + EWOL_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec3"); glUniform3fv(m_elementList[_idElem].m_elementId, _nbElement, _value); //checkGlError("glUniform3fv", __LINE__); } @@ -633,7 +633,7 @@ void ewol::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, co EWOL_ERROR("nullptr Input pointer to send at open GL ..."); return; } - EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec4"); + EWOL_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec4"); glUniform4fv(m_elementList[_idElem].m_elementId, _nbElement, _value); //checkGlError("glUniform4fv", __LINE__); } From 28b3d075f46a7c67cd71430afacf22c97453f98b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 25 Nov 2014 22:07:48 +0100 Subject: [PATCH 25/57] [EXTERNAL] add gtest --- .gitmodules | 3 +++ build | 2 +- external/ege | 2 +- external/etk | 2 +- external/gtest | 1 + sources/lutin_ewol.py | 3 ++- 6 files changed, 9 insertions(+), 4 deletions(-) create mode 160000 external/gtest diff --git a/.gitmodules b/.gitmodules index 8ef0dc25..7e4cfb31 100644 --- a/.gitmodules +++ b/.gitmodules @@ -68,3 +68,6 @@ [submodule "external/enet"] path = external/enet url = https://github.com/HeeroYui/enet.git +[submodule "external/gtest"] + path = external/gtest + url = https://github.com/HeeroYui/gtest diff --git a/build b/build index 288207e4..2a58657d 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 288207e4e1fdcee746b587a9ac644cfdf6ed17f5 +Subproject commit 2a58657df50abe5e69161e68c703cd9674c87a70 diff --git a/external/ege b/external/ege index 2ffa87dd..9fb437ed 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 2ffa87dd73f54e2e431c2735d9145c280a57646f +Subproject commit 9fb437ed21ce6a9c5fe2146b6f43f8cd1003b8a0 diff --git a/external/etk b/external/etk index 4b3cdf01..a91136a0 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 4b3cdf01560a946189388870242a86484144863d +Subproject commit a91136a0d8b7e1976681c95a968a6614a0698984 diff --git a/external/gtest b/external/gtest new file mode 160000 index 00000000..ce08156c --- /dev/null +++ b/external/gtest @@ -0,0 +1 @@ +Subproject commit ce08156cf70c62c8783e8cf7f1ddc90f5ceba94d diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 100b01bd..3ebba77a 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -7,7 +7,8 @@ import lutinMultiprocess def get_desc(): return "ewol is a main library to use widget in the openGl environement and manage all the wraping os" - +def get_license(): + return "APACHE v2.0" def create(target): # set the ewol folder for Android basic sources ... From d0e8e519a809927ddd08ba7318a83e75bd29cb77 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 28 Nov 2014 21:04:16 +0100 Subject: [PATCH 26/57] [DEV] travis update --- external/ege | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ege b/external/ege index 9fb437ed..8ec1d283 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 9fb437ed21ce6a9c5fe2146b6f43f8cd1003b8a0 +Subproject commit 8ec1d2833cbacba4ea4dec7819017a0e0a3a06f3 From 6e571ae74224f89a0519a7471e7cd948add8821a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 1 Dec 2014 22:03:39 +0100 Subject: [PATCH 27/57] [DEV] add tools function for resource colored 3d object --- external/ege | 2 +- sources/ewol/resource/Colored3DObject.cpp | 71 +++++++++++++++++++++++ sources/ewol/resource/Colored3DObject.h | 9 +++ sources/ewol/resource/Program.cpp | 12 ++-- 4 files changed, 86 insertions(+), 8 deletions(-) diff --git a/external/ege b/external/ege index 8ec1d283..fd45ef5f 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 8ec1d2833cbacba4ea4dec7819017a0e0a3a06f3 +Subproject commit fd45ef5f7766191491cb4f70f6b38a8c898548d7 diff --git a/sources/ewol/resource/Colored3DObject.cpp b/sources/ewol/resource/Colored3DObject.cpp index b1f7a084..d934aea0 100644 --- a/sources/ewol/resource/Colored3DObject.cpp +++ b/sources/ewol/resource/Colored3DObject.cpp @@ -158,3 +158,74 @@ void ewol::resource::Colored3DObject::drawLine(std::vector& _vertices, } } + +void ewol::resource::Colored3DObject::drawSphere(float _radius, + int _lats, + int _longs, + mat4& _transformationMatrix, + const etk::Color& _tmpColor) { + int i, j; + std::vector EwolVertices; + for(i = 0; i <= _lats; i++) { + btScalar lat0 = SIMD_PI * (-btScalar(0.5) + (btScalar) (i - 1) / _lats); + btScalar z0 = _radius*sin(lat0); + btScalar zr0 = _radius*cos(lat0); + + btScalar lat1 = SIMD_PI * (-btScalar(0.5) + (btScalar) i / _lats); + btScalar z1 = _radius*sin(lat1); + btScalar zr1 = _radius*cos(lat1); + + //glBegin(GL_QUAD_STRIP); + for(j = 0; j < _longs; j++) { + btScalar lng = 2 * SIMD_PI * (btScalar) (j - 1) / _longs; + btScalar x = cos(lng); + btScalar y = sin(lng); + vec3 v1 = vec3(x * zr1, y * zr1, z1); + vec3 v4 = vec3(x * zr0, y * zr0, z0); + + lng = 2 * SIMD_PI * (btScalar) (j) / _longs; + x = cos(lng); + y = sin(lng); + vec3 v2 = vec3(x * zr1, y * zr1, z1); + vec3 v3 = vec3(x * zr0, y * zr0, z0); + + EwolVertices.push_back(v1); + EwolVertices.push_back(v2); + EwolVertices.push_back(v3); + + EwolVertices.push_back(v1); + EwolVertices.push_back(v3); + EwolVertices.push_back(v4); + } + } + draw(EwolVertices, _tmpColor, _transformationMatrix); +} + +void ewol::resource::Colored3DObject::drawSquare(const vec3& _size, + mat4& _transformationMatrix, + const etk::Color& _tmpColor){ + std::vector tmpVertices; + static int indices[36] = { 0,1,2, 3,2,1, 4,0,6, + 6,0,2, 5,1,4, 4,1,0, + 7,3,1, 7,1,5, 5,4,7, + 7,4,6, 7,2,3, 7,6,2}; + vec3 vertices[8]={ vec3(_size[0],_size[1],_size[2]), + vec3(-_size[0],_size[1],_size[2]), + vec3(_size[0],-_size[1],_size[2]), + vec3(-_size[0],-_size[1],_size[2]), + vec3(_size[0],_size[1],-_size[2]), + vec3(-_size[0],_size[1],-_size[2]), + vec3(_size[0],-_size[1],-_size[2]), + vec3(-_size[0],-_size[1],-_size[2])}; + tmpVertices.clear(); + for (int32_t iii=0 ; iii<36 ; iii+=3) { + // normal calculation : + //btVector3 normal = (vertices[indices[iii+2]]-vertices[indices[iii]]).cross(vertices[indices[iii+1]]-vertices[indices[iii]]); + //normal.normalize (); + tmpVertices.push_back(vertices[indices[iii]]); + tmpVertices.push_back(vertices[indices[iii+1]]); + tmpVertices.push_back(vertices[indices[iii+2]]); + } + draw(tmpVertices, _tmpColor, _transformationMatrix); +} + diff --git a/sources/ewol/resource/Colored3DObject.h b/sources/ewol/resource/Colored3DObject.h index 5cd601e7..0b3e8627 100644 --- a/sources/ewol/resource/Colored3DObject.h +++ b/sources/ewol/resource/Colored3DObject.h @@ -44,6 +44,15 @@ namespace ewol { mat4& _transformationMatrix, bool _updateDepthBuffer=true, bool _depthtest=true); + public: + void drawSphere(float _radius, + int _lats, + int _longs, + mat4& _transformationMatrix, + const etk::Color& _tmpColor); + void drawSquare(const vec3& _size, // halph size + mat4& _transformationMatrix, + const etk::Color& _tmpColor); }; }; }; diff --git a/sources/ewol/resource/Program.cpp b/sources/ewol/resource/Program.cpp index 98836692..a82b7930 100644 --- a/sources/ewol/resource/Program.cpp +++ b/sources/ewol/resource/Program.cpp @@ -380,15 +380,13 @@ void ewol::resource::Program::sendAttributePointer(int32_t _idElem, if (false == m_elementList[_idElem].m_isLinked) { return; } - //EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send " << _vbo->getElementSize(_index) << " element on oglID=" << _vbo->getGL_ID(_index) << " VBOindex=" << _index); + EWOL_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _vbo->getElementSize(_index) << " element on oglID=" << _vbo->getGL_ID(_index) << " VBOindex=" << _index); glBindBuffer(GL_ARRAY_BUFFER, _vbo->getGL_ID(_index)); checkGlError("glBindBuffer", __LINE__); - /* - EWOL_ERROR(" id=" << m_elementList[_idElem].m_elementId); - EWOL_ERROR(" eleme size=" << _vbo->getElementSize(_index)); - EWOL_ERROR(" jump sample=" << _jumpBetweenSample); - EWOL_ERROR(" offset=" << _offset); - */ + EWOL_VERBOSE(" id=" << m_elementList[_idElem].m_elementId); + EWOL_VERBOSE(" eleme size=" << _vbo->getElementSize(_index)); + EWOL_VERBOSE(" jump sample=" << _jumpBetweenSample); + EWOL_VERBOSE(" offset=" << _offset); glVertexAttribPointer(m_elementList[_idElem].m_elementId, // attribute ID of openGL _vbo->getElementSize(_index), // number of elements per vertex, here (r,g,b,a) GL_FLOAT, // the type of each element From 6e6a9575bfe3f7daf6dd03625879aa4d233a7f7b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 4 Dec 2014 23:30:36 +0100 Subject: [PATCH 28/57] [SAMPLE] add basic sample in the repo --- external/ege | 2 +- sample/001_HelloWord/appl/Main.cpp | 57 +++++++++ sample/001_HelloWord/appl/Main.h | 14 +++ sample/001_HelloWord/appl/Windows.cpp | 32 +++++ sample/001_HelloWord/appl/Windows.h | 25 ++++ sample/001_HelloWord/appl/debug.cpp | 15 +++ sample/001_HelloWord/appl/debug.h | 52 ++++++++ sample/001_HelloWord/lutin_001_HelloWord.py | 32 +++++ sample/0XX_CustomWidgets/appl/Main.cpp | 57 +++++++++ sample/0XX_CustomWidgets/appl/Main.h | 14 +++ sample/0XX_CustomWidgets/appl/Windows.cpp | 74 +++++++++++ sample/0XX_CustomWidgets/appl/Windows.h | 31 +++++ sample/0XX_CustomWidgets/appl/debug.cpp | 15 +++ sample/0XX_CustomWidgets/appl/debug.h | 52 ++++++++ .../appl/widget/VectorDisplay.cpp | 92 ++++++++++++++ .../appl/widget/VectorDisplay.h | 48 ++++++++ .../lutin_0XX_customwidget.py | 34 +++++ sample/README.md | 52 ++++++++ sample/data/icon.png | Bin 0 -> 5084 bytes sample/examplewallpaper/appl/Main.cpp | 57 +++++++++ sample/examplewallpaper/appl/Main.h | 14 +++ .../examplewallpaper/appl/WidgetDisplay.cpp | 116 ++++++++++++++++++ sample/examplewallpaper/appl/WidgetDisplay.h | 49 ++++++++ sample/examplewallpaper/appl/Windows.cpp | 39 ++++++ sample/examplewallpaper/appl/Windows.h | 27 ++++ sample/examplewallpaper/appl/debug.cpp | 15 +++ sample/examplewallpaper/appl/debug.h | 52 ++++++++ sample/examplewallpaper/data/SnowFlake.svg | 5 + .../lutin_examplewallpaper.py | 61 +++++++++ sample/license.txt | 13 ++ 30 files changed, 1145 insertions(+), 1 deletion(-) create mode 100644 sample/001_HelloWord/appl/Main.cpp create mode 100644 sample/001_HelloWord/appl/Main.h create mode 100644 sample/001_HelloWord/appl/Windows.cpp create mode 100644 sample/001_HelloWord/appl/Windows.h create mode 100644 sample/001_HelloWord/appl/debug.cpp create mode 100644 sample/001_HelloWord/appl/debug.h create mode 100755 sample/001_HelloWord/lutin_001_HelloWord.py create mode 100644 sample/0XX_CustomWidgets/appl/Main.cpp create mode 100644 sample/0XX_CustomWidgets/appl/Main.h create mode 100644 sample/0XX_CustomWidgets/appl/Windows.cpp create mode 100644 sample/0XX_CustomWidgets/appl/Windows.h create mode 100644 sample/0XX_CustomWidgets/appl/debug.cpp create mode 100644 sample/0XX_CustomWidgets/appl/debug.h create mode 100644 sample/0XX_CustomWidgets/appl/widget/VectorDisplay.cpp create mode 100644 sample/0XX_CustomWidgets/appl/widget/VectorDisplay.h create mode 100755 sample/0XX_CustomWidgets/lutin_0XX_customwidget.py create mode 100644 sample/README.md create mode 100644 sample/data/icon.png create mode 100644 sample/examplewallpaper/appl/Main.cpp create mode 100644 sample/examplewallpaper/appl/Main.h create mode 100644 sample/examplewallpaper/appl/WidgetDisplay.cpp create mode 100644 sample/examplewallpaper/appl/WidgetDisplay.h create mode 100644 sample/examplewallpaper/appl/Windows.cpp create mode 100644 sample/examplewallpaper/appl/Windows.h create mode 100644 sample/examplewallpaper/appl/debug.cpp create mode 100644 sample/examplewallpaper/appl/debug.h create mode 100644 sample/examplewallpaper/data/SnowFlake.svg create mode 100755 sample/examplewallpaper/lutin_examplewallpaper.py create mode 100644 sample/license.txt diff --git a/external/ege b/external/ege index fd45ef5f..bc200958 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit fd45ef5f7766191491cb4f70f6b38a8c898548d7 +Subproject commit bc20095852db600eabef6ee13fae38f09c161d87 diff --git a/sample/001_HelloWord/appl/Main.cpp b/sample/001_HelloWord/appl/Main.cpp new file mode 100644 index 00000000..49b711c8 --- /dev/null +++ b/sample/001_HelloWord/appl/Main.cpp @@ -0,0 +1,57 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#include +#include +#include + +#include +#include +#include +#include +#include + + +class MainApplication : public ewol::context::Application { + public: + bool init(ewol::Context& _context, size_t _initId) { + APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); + + // TODO : Remove this : Move if in the windows properties + _context.setSize(vec2(800, 600)); + + // select internal data for font ... + _context.getFontDefault().setUseExternal(true); + _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); + + std::shared_ptr basicWindows = appl::Windows::create(); + // create the specific windows + _context.setWindows(basicWindows); + APPL_INFO("==> Init APPL (END)"); + return true; + } + + void unInit(ewol::Context& _context) { + APPL_INFO("==> Un-Init APPL (START)"); + // nothing to do ... + APPL_INFO("==> Un-Init APPL (END)"); + } +}; + +/** + * @brief Main of the program (This can be set in every case, but it is not used in Andoid...). + * @param std IO + * @return std IO + */ +int main(int _argc, const char *_argv[]) { + // second possibility + return ewol::run(new MainApplication(), _argc, _argv); +} + + diff --git a/sample/001_HelloWord/appl/Main.h b/sample/001_HelloWord/appl/Main.h new file mode 100644 index 00000000..8a45fb5e --- /dev/null +++ b/sample/001_HelloWord/appl/Main.h @@ -0,0 +1,14 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_MAIN_H__ +#define __APPL_MAIN_H__ + + +#endif + diff --git a/sample/001_HelloWord/appl/Windows.cpp b/sample/001_HelloWord/appl/Windows.cpp new file mode 100644 index 00000000..5d35ce31 --- /dev/null +++ b/sample/001_HelloWord/appl/Windows.cpp @@ -0,0 +1,32 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#include +#include +#include +#include + +#undef __class__ +#define __class__ "Windows" + +appl::Windows::Windows() { + addObjectType("appl::Windows"); +} +void appl::Windows::init() { + setTitle("example 001_HelloWord"); + std::shared_ptr tmpWidget = ewol::widget::Label::create(); + if (tmpWidget == nullptr) { + APPL_ERROR("Can not allocate widget ==> display might be in error"); + } else { + tmpWidget->setLabel("Hello Word"); + tmpWidget->setExpand(bvec2(true,true)); + setSubWidget(tmpWidget); + } +} + + diff --git a/sample/001_HelloWord/appl/Windows.h b/sample/001_HelloWord/appl/Windows.h new file mode 100644 index 00000000..92614217 --- /dev/null +++ b/sample/001_HelloWord/appl/Windows.h @@ -0,0 +1,25 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_WINDOWS_H__ +#define __APPL_WINDOWS_H__ + +#include + +namespace appl { + class Windows : public ewol::widget::Windows { + protected: + Windows(); + void init(); + public: + DECLARE_FACTORY(Windows); + }; +}; + + +#endif \ No newline at end of file diff --git a/sample/001_HelloWord/appl/debug.cpp b/sample/001_HelloWord/appl/debug.cpp new file mode 100644 index 00000000..d63981aa --- /dev/null +++ b/sample/001_HelloWord/appl/debug.cpp @@ -0,0 +1,15 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#include + +int32_t appl::getLogId() { + static int32_t g_val = etk::log::registerInstance("example"); + return g_val; +} diff --git a/sample/001_HelloWord/appl/debug.h b/sample/001_HelloWord/appl/debug.h new file mode 100644 index 00000000..cad939e5 --- /dev/null +++ b/sample/001_HelloWord/appl/debug.h @@ -0,0 +1,52 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#ifndef __APPL_DEBUG_H__ +#define __APPL_DEBUG_H__ + +#include + +namespace appl { + int32_t getLogId(); +}; +// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" +#define APPL_BASE(info,data) \ + do { \ + if (info <= etk::log::getLevel(appl::getLogId())) { \ + std::stringbuf sb; \ + std::ostream tmpStream(&sb); \ + tmpStream << data; \ + etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ + } \ + } while(0) + +#define APPL_CRITICAL(data) APPL_BASE(1, data) +#define APPL_ERROR(data) APPL_BASE(2, data) +#define APPL_WARNING(data) APPL_BASE(3, data) +#ifdef DEBUG + #define APPL_INFO(data) APPL_BASE(4, data) + #define APPL_DEBUG(data) APPL_BASE(5, data) + #define APPL_VERBOSE(data) APPL_BASE(6, data) + #define APPL_TODO(data) APPL_BASE(4, "TODO : " << data) +#else + #define APPL_INFO(data) do { } while(false) + #define APPL_DEBUG(data) do { } while(false) + #define APPL_VERBOSE(data) do { } while(false) + #define APPL_TODO(data) do { } while(false) +#endif + +#define APPL_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + APPL_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) + +#endif diff --git a/sample/001_HelloWord/lutin_001_HelloWord.py b/sample/001_HelloWord/lutin_001_HelloWord.py new file mode 100755 index 00000000..04064803 --- /dev/null +++ b/sample/001_HelloWord/lutin_001_HelloWord.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools + + +# optionnal : Describe in the "lutin.py --help" +def get_desc(): + return "Tutorial 001 : Hello Word" + +# Module creation instance (not optionnal) +def create(target): + # module name is '001_HelloWord' and type binary. + myModule = module.Module(__file__, '001_HelloWord', 'BINARY') + # add the file to compile: + myModule.add_src_file([ + 'appl/Main.cpp', + 'appl/debug.cpp', + 'appl/Windows.cpp', + ]) + # add Library dependency name + myModule.add_module_depend(['ewol']) + # add application C flags + myModule.compile_flags_CC([ + "-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""]) + # Add current include Path + myModule.add_path(tools.get_current_path(__file__)) + # return the created module + return myModule + + + + diff --git a/sample/0XX_CustomWidgets/appl/Main.cpp b/sample/0XX_CustomWidgets/appl/Main.cpp new file mode 100644 index 00000000..975e6c2a --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/Main.cpp @@ -0,0 +1,57 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +class MainApplication : public ewol::context::Application { + public: + bool init(ewol::Context& _context, size_t _initId) { + APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); + + // TODO : Remove this : Move if in the windows properties + _context.setSize(vec2(800, 600)); + + // select internal data for font ... + _context.getFontDefault().setUseExternal(true); + _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); + + appl::widget::VectorDisplay::createManagerWidget(_context.getWidgetManager()); + + std::shared_ptr basicWindows = appl::Windows::create(); + // create the specific windows + _context.setWindows(basicWindows); + APPL_INFO("==> Init APPL (END)"); + return true; + } + void unInit(ewol::Context& _context) { + APPL_INFO("==> Un-Init APPL (START)"); + // nothing to do... + APPL_INFO("==> Un-Init APPL (END)"); + } +}; + +/** + * @brief Main of the program (This can be set in every case, but it is not used in Andoid...). + * @param std IO + * @return std IO + */ +int main(int _argc, const char *_argv[]) { + // second possibility + return ewol::run(new MainApplication(), _argc, _argv); +} \ No newline at end of file diff --git a/sample/0XX_CustomWidgets/appl/Main.h b/sample/0XX_CustomWidgets/appl/Main.h new file mode 100644 index 00000000..992aac15 --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/Main.h @@ -0,0 +1,14 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + +#ifndef __APPL_MAIN_H__ +#define __APPL_MAIN_H__ + + +#endif + diff --git a/sample/0XX_CustomWidgets/appl/Windows.cpp b/sample/0XX_CustomWidgets/appl/Windows.cpp new file mode 100644 index 00000000..f17d1c44 --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/Windows.cpp @@ -0,0 +1,74 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + +#include +#include +#include +#include +#include +#include +#include + +#undef __class__ +#define __class__ "Windows" + +static const char* const g_eventChangeValues = "appl-change-value"; +static const char* const g_eventAutoMode = "appl-change-auto"; + +appl::Windows::Windows() : + m_composer(NULL) { + addObjectType("appl::Windows"); +} + +void appl::Windows::init() { + setTitle("example 001_HelloWord"); + std::string composition = std::string(""); + composition += "\n"; + composition += " \n"; + composition += " \n"; + composition += " \n"; + composition += " \n"; + composition += " \n"; + composition += "\n"; + + m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition); + if (m_composer == NULL) { + APPL_CRITICAL(" An error occured ... in the windows creatrion ..."); + return; + } + setSubWidget(m_composer); + subBind(ewol::widget::Button, "bt-change", signalPressed, shared_from_this(), &appl::Windows::onCallbackChangeValues); + subBind(ewol::widget::Button, "bt-auto", signalPressed, shared_from_this(), &appl::Windows::onCallbackAutoMode); +} + +void appl::Windows::onCallbackChangeValues() { + std::vector tmp; + for (int32_t iii=0; iii<2048; ++iii) { + tmp.push_back(etk::tool::frand(-1.0, 1.0)); + } + std::shared_ptr tmpDisp = std::dynamic_pointer_cast(getSubObjectNamed("displayer")); + if (tmpDisp != NULL) { + tmpDisp->setValue(tmp); + } +} + +void appl::Windows::onCallbackAutoMode() { + std::shared_ptr tmpDisp = std::dynamic_pointer_cast(getSubObjectNamed("displayer")); + if (tmpDisp != NULL) { + tmpDisp->ToggleAuto(); + } +} + diff --git a/sample/0XX_CustomWidgets/appl/Windows.h b/sample/0XX_CustomWidgets/appl/Windows.h new file mode 100644 index 00000000..f25ac1cc --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/Windows.h @@ -0,0 +1,31 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + +#ifndef __APPL_WINDOWS_H__ +#define __APPL_WINDOWS_H__ + +#include +#include + +namespace appl { + class Windows : public ewol::widget::Windows { + private: + std::shared_ptr m_composer; + protected: + Windows(); + void init(); + public: + DECLARE_FACTORY(Windows); + public: // callback functions + void onCallbackChangeValues(); + void onCallbackAutoMode(); + }; +}; + + +#endif \ No newline at end of file diff --git a/sample/0XX_CustomWidgets/appl/debug.cpp b/sample/0XX_CustomWidgets/appl/debug.cpp new file mode 100644 index 00000000..455bfe50 --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/debug.cpp @@ -0,0 +1,15 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + + +#include + +int32_t appl::getLogId() { + static int32_t g_val = etk::log::registerInstance("example"); + return g_val; +} diff --git a/sample/0XX_CustomWidgets/appl/debug.h b/sample/0XX_CustomWidgets/appl/debug.h new file mode 100644 index 00000000..969e3a0e --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/debug.h @@ -0,0 +1,52 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + +#ifndef __APPL_DEBUG_H__ +#define __APPL_DEBUG_H__ + +#include + +namespace appl { + int32_t getLogId(); +}; +// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" +#define APPL_BASE(info,data) \ + do { \ + if (info <= etk::log::getLevel(appl::getLogId())) { \ + std::stringbuf sb; \ + std::ostream tmpStream(&sb); \ + tmpStream << data; \ + etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ + } \ + } while(0) + +#define APPL_CRITICAL(data) APPL_BASE(1, data) +#define APPL_ERROR(data) APPL_BASE(2, data) +#define APPL_WARNING(data) APPL_BASE(3, data) +#ifdef DEBUG + #define APPL_INFO(data) APPL_BASE(4, data) + #define APPL_DEBUG(data) APPL_BASE(5, data) + #define APPL_VERBOSE(data) APPL_BASE(6, data) + #define APPL_TODO(data) APPL_BASE(4, "TODO : " << data) +#else + #define APPL_INFO(data) do { } while(false) + #define APPL_DEBUG(data) do { } while(false) + #define APPL_VERBOSE(data) do { } while(false) + #define APPL_TODO(data) do { } while(false) +#endif + +#define APPL_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + APPL_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) + +#endif + diff --git a/sample/0XX_CustomWidgets/appl/widget/VectorDisplay.cpp b/sample/0XX_CustomWidgets/appl/widget/VectorDisplay.cpp new file mode 100644 index 00000000..f1d2f224 --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/widget/VectorDisplay.cpp @@ -0,0 +1,92 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + +#include +#include +#include + +#undef __class__ +#define __class__ "VectorDisplay" + + +appl::widget::VectorDisplay::VectorDisplay() : + m_autoDisplay(false), + m_minVal(-1.0f), + m_maxVal(1.0f) { + addObjectType("appl::widget::VectorDisplay"); +} + +void appl::widget::VectorDisplay::init() { + ewol::Widget::init(); + markToRedraw(); +} + + +appl::widget::VectorDisplay::~VectorDisplay() { + +} + + +void appl::widget::VectorDisplay::setValue(const std::vector& _data) { + m_data = _data; + markToRedraw(); +} + +void appl::widget::VectorDisplay::ToggleAuto() { + if (m_autoDisplay == false) { + periodicCallEnable(); + m_autoDisplay = true; + } else { + periodicCallDisable(); + m_autoDisplay = false; + } +} + +void appl::widget::VectorDisplay::onDraw() { + m_draw.draw(); +} + + +void appl::widget::VectorDisplay::onRegenerateDisplay() { + //!< Check if we really need to redraw the display, if not needed, we redraw the previous data ... + if (needRedraw() == false) { + return; + } + // remove previous data + m_draw.clear(); + // set background + m_draw.setColor(etk::color::black); + m_draw.setPos(vec2(0,0)); + m_draw.rectangleWidth(m_size); + + if (m_data.size() == 0) { + return; + } + // set all the line: + m_draw.setColor(etk::color::white); + m_draw.setThickness(1); + float origin = m_size.y()*0.5f; + + float ratioY = m_size.y() / (m_maxVal - m_minVal); + float stepX = m_size.x() / (float)m_data.size(); + m_draw.setPos(vec2(0, origin + ratioY*m_data[0])); + float baseX = 0; + for (size_t iii=1; iii 50) { + m_data.erase(m_data.begin()); + } + m_data.push_back(etk::tool::frand(m_minVal, m_maxVal)); + } + markToRedraw(); +} diff --git a/sample/0XX_CustomWidgets/appl/widget/VectorDisplay.h b/sample/0XX_CustomWidgets/appl/widget/VectorDisplay.h new file mode 100644 index 00000000..3b67b534 --- /dev/null +++ b/sample/0XX_CustomWidgets/appl/widget/VectorDisplay.h @@ -0,0 +1,48 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license BSD 3 clauses (see license file) + */ + +#ifndef __APPL_WIDGET_VECTOR_DISPLAY_H__ +#define __APPL_WIDGET_VECTOR_DISPLAY_H__ + +#include +#include +#include + +namespace appl { + namespace widget { + class VectorDisplay : public ewol::Widget { + private: + ewol::compositing::Drawing m_draw; //!< drawing instance + protected: + //! @brief constructor + VectorDisplay(); + void init(); + public: + DECLARE_WIDGET_FACTORY(VectorDisplay, "VectorDisplay"); + //! @brief destructor + virtual ~VectorDisplay(); + private: + std::vector m_data; //!< data that might be displayed + public: + void setValue(const std::vector& _data); + private: + bool m_autoDisplay; + public: + void ToggleAuto(); + private: + float m_minVal; //!< display minimum value + float m_maxVal; //!< display maximum value + public: // herited function + virtual void onDraw(); + virtual void onRegenerateDisplay(); + virtual void periodicCall(const ewol::event::Time& _event); + }; + }; +}; + +#endif diff --git a/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py b/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py new file mode 100755 index 00000000..9824d353 --- /dev/null +++ b/sample/0XX_CustomWidgets/lutin_0XX_customwidget.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools + + +# optionnal : Describe in the "lutin.py --help" +def get_desc(): + return "Tutorial 0XX : Create custom Widget" + +# Module creation instance (not optionnal) +def create(target): + # module name is '001_HelloWord' and type binary. + myModule = module.Module(__file__, '0XX_customwidget', 'BINARY') + # add the file to compile: + myModule.add_src_file([ + 'appl/Main.cpp', + 'appl/debug.cpp', + 'appl/Windows.cpp', + 'appl/widget/VectorDisplay.cpp', + ]) + + # add Library dependency name + myModule.add_module_depend(['ewol']) + # add application C flags + myModule.compile_flags_CC([ + "-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""]) + # Add current include Path + myModule.add_path(tools.get_current_path(__file__)) + # return the created module + return myModule + + + + diff --git a/sample/README.md b/sample/README.md new file mode 100644 index 00000000..86e17274 --- /dev/null +++ b/sample/README.md @@ -0,0 +1,52 @@ +Ewol Samples +============ + +Ewol sample are a FREE software for learn use of ewol. + +Instructions +============ + +download the software : + + git clone git://github.com/HeeroYui/ewol.git + cd ewol + git submodule init + git submodule update + +Compile software and install : (build all binary and libs) + + ewol/build/lutin.py -j4 + +Dependency packages +=================== + + sudo apt-get install g++ libgl1-mesa-dev zlib1g-dev libasound2-dev + # if you want to compile with clang : + sudo apt-get install clang + # For andoid compilation (jdk 7 does not work...) + sudo apt-get install javacc openjdk-6-jdk + # if you want to compile for windows : + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install gcc-mingw-w64 + # on 64 bits processor for compatibility + sudo apt-get install ia32-libs + sudo apt-get install g++-multilib libc6-dev-i386 + +License (APACHE v2.0) +===================== + +Copyright ewol Edouard DUPIN + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/sample/data/icon.png b/sample/data/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..16d3d9e1e81626bd74d938133c81a93549adec0d GIT binary patch literal 5084 zcmV<26C>=2P)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{024$>L_t(|+U=ctj9k@y$3N%Z znccNLez4hHFKY~T@s0zwfl%m6sv9*ZEiNq)&=yr`9#tY*p-7cmszg8_qHSuFxFk|j zRSIsJsQeXLlpym@q^kQ*8*IwM7~8vk1Z=RqyWSVx=ggebKko0&+_`ff=gtiFVtl2m zxpQCV-rw*1zQ5o3p5Hkat}a)XtIO5pvMuUzKR`!E2TMy!gu9Wsni}y**{jCqSDS&O5wUL zot>RbPELM^EMTa5jsI&}*iMw$holU{PRs|dfFWF<6IcOs$+lbfAogV#z>(ji?Z%f~ z9%X1bZ&B6-`7LKvhO!X61LT2j;A6nGKrc`LI^<=7FQDZ&ydD0JTw4hUBzTSqJfjKy zznoz!dN&H&@01Z|^$T*~ph)b{PboxmNy4Zt;`7&r7_Hp-3? zl!<^3QXt_{ml3p*idez>Qu7CZwIWXqTwsWK8#v0PK+kI6I#IxH05=H~1)(RakgS56 zOAw(oQ-%pC;u?YF)$)HrEMP{gq}+-H2qY-YAxE zS`;yF6^f_8&uVeH1ETGYOVoB)u4SkQ`Q-$TS4ic|))tCVv8lI!^W8Vc{vM z4OiLFHYp&jmZ?zmszc^ya6o-^JI=iujdB#m7?e`B4{YiweS=z=qw>9D#{BcJf3)r# zwdG#S-OoXOrNJ0T?^`ep+un5sqv?I~DXuyB1A~+IC2j)u^q#4x7#<#ON&!v^1XU~} z1V1vUf7_fwJ-ij?{u@wEts|uAmXoW{`;KG2Hyrs?D_5>$i++v5=+EQ=!QEZJ|(LU|;~1>tNvES6FxA*^n@4P7zLy(H&1RGjI>+5*UL~ z$}@T6y;reV1Yl%jq;&`y931p-WJ2(wQexxUH93WPxaieby?Ql$eSOlG3^<+i9{n~>Wr2y}!&pL5jBOiCzQFn0{sEm| zP4~%tXs5Gk4JshFuthXw0V5+L{>_4MvJC`zp_&8gFN!!1Zbs#tMA#|M?{}o3w^~@% zK3ThEUsq+}C8zT22>R)_Vk)Vkudff+b*oiE0q8P4$DU!`iG6j#Y#NS~%h>kEnb`C> z5DN(2Gn^!_W5=z9Jrc@Iek8I%IWQ zH@u@*EP4?1MY@Dyy-5VJR?ZK{!_(3PKMI_7xBc?G!U}e}d3A)6p@&Can*L%-E zw#BJarH;v%D?qityiM90V}$CGM) z2>Mn?A49M7Hw?-z!Ya-K=R_IrOKUTB86F;Pc)+d2qNfO@fE@j=?#3xiFtz1Nt&y$D ziyKC_KMuOY+B5%&A;+R?jG$GGV-y+@v=l3T^hrazIkZ4-(x zfHI(RjBb7i=itAiwa%=@#^~aKpD{Bt6^HZf>NwF-%cq6P9ur3Ogsi7!-=v(gXxqUN z&UX3_Qqa6AVeS_}de*#@@-U?g=oV_o1iXv8M?WE#Sv@#Sv9j6)b}SmIT}1 z6R4RN$BXdneh<_8a<0x&`?nU0j0_JmI5=4INxpwlUVPDg{9gdP#v00A5x&KoKMXJa z5lp<*v^&WqP=qREB}rtQW2bM(AJ|0>ba{TiZvn1EI};KWAy70Xt7ic_vspk~Ycv?I zJ9>$pW8bCRaSbz@KkFUeTmK4bw`ml-QZW4scc2;S~D2>4?Tffo@KK5kVRt*m^=YL{X-ag)dB;PaUqvr z&L)Cxj#E&zs3gHxUwlOl=lN|$|K8!U2zg0<{f1#h_LYRut#X@p{h@)SGa}Xo7GG( zT=t`*SiHAsJ@<6Nd>Ljd&0BzJyi{8%I`v#*jK}By=oI>yBlTtNtXa|}OFZ%&vL78q zz0_{wDIlj{^ho^8R^@OW+kt-O2+YoAsv)_A^P(~!k}6=lu8pDmD=%e^=T#H6Us=5S zutZ0}=NpdV@&nP1`Qi2$2`bdz--h$)0rbA(ZFj=K)bk_=YH-v|G|1Z4$jE}xaV_^^ zvBt5cl_O+*&n%)DG#~S5Y$e|wHf&1&dm?iD?eRR3mEx@GvZ*5W0e0q6}8mjgq zJ2BCe3e}5nQdC^JNO)T-%Q93#8N&>Fw0`Yf%icQT{qBtJ#!-*%!2R^Kpi`LNtYK)# zbe#nF2~x`iyuJfJMFg3D(m)~?2FWvAQFsg=_H-T|q`GdPC-TI=PA959x{tVQ!nVqmrViqFoe!M zOawiWKd=jO3jJT_(7RvBM3XoP7-O55^^snx|wS$;I3uMi0G zb6jU744uI1kC+FvNg@ZeL2XzWeQZfL4MAZ`h&tx?>G~rEKkQD}&&D{3mu`Pn6jI6` z*wsL>l?~eqy03&QsUbEF%$uE<`~eU1W33+FVA6jPq9C@dj&nlobG! zZvII$RFsW91O=YTHZjXr!lE=*CQ}5Mgw09YwobPlWnh}@ht5i$=Pb{&Nz5`5s_8hW zP`f=CHhYz^fVsqN6|vt$z^974SBFA9c8hU$ZD<&4X49t;X9Zc6;3NQl+Y__QUZ)}N z=7Vn5MlOXM>WN!%@7;*e#!A>(_GeifmHzyh60_;l%AcQgP@ZGpm9J139TMQKWh@U{j65_pN(ywKn{a>T< zrT@+B3vvlwwylX-kyhagI=7PdzPV3Du&PE0*Ay3(m@Kg4cc5pe`DrPZs?$Xu7)L+; zTI_lL?7&&s(6%OK#b2r5GfD}4u|nwI?hqB6S2AI2ad5Dj$zU~cM2D(kKBj%JQx*Qp z{|_Vs3DX; z2F%*wK6VT4J=b9>>DSo6k1;jq)Cb4WUwaiMmtxN!9UB8+On$ALuxb=)=ESTF!uJR3 z^@z}K!keXWyKHZkV+9~T{QY5NRr^=vP>*bD%wA|Q!clnz(Y2>_k?dSvJ=trZ4 z-&8});&@tORxk?6Ivqf8q@+JxK|fxS*GAd)r!B}lV$wDtI1T@+4)^s5ujY>}v`w+L zGiIehkdbp0>dNRQ_VK?e{GX4bA9)3)OYLcqTUdZiVwP#}8Ky!8OYjvphsVQD;B|tW zmi3(M^K)~OW@RM*`aNxh9Dh)sJ~)p4n{?r~+XAx8m{q-I%{xD4X44;IIsR7Tb>K|n z<=*%X_iV@spORVmM_~3`wS0P1+PD0wQRpH!jBxTs&WeTx3}Tmb!}|4W7A#OU`a3E?Fs+o@z`jm zWkxom6HbGmsuOn5^c;JJwI_e*%`lY&M=uz^GyEc6x8^Clj_@~SJtF(Y<(yKGl2A|I zj(hipx@e~z6fsJ9H9tl8hV;zkc0f?38M6%F=n_50_5v{dOP{MF*CLhh8Rc7n->c?7 zmp?D_Qds!T)3@XP*7~+k$_-}u#)JnuF~T=(sQI=Klzql5sqJogj@~1CP+i~w2z$~@D<^!m;`8we@GjVmh!cd#UtT0!k zt5X3;DCd|meTV;!HK(7Kvm&OF^hcmiorD)3@P@6%(9iBC`%{G<_5-nfw^6=nx|A7e z6wP-MwVId}_5)6x6#zy#IF)(Uzwrc4d5)UJaCaA znct|TuPE6iX1PL=Z3KQ5Z+Oo_-~sc28WOBg;WmT`)x7Ze;cJ~`P)3E?q=NoeG|o#a zenJ$HI-7c~1*q~LWTgmxHQwxpNJ>_9mWEiIVmk1K^AxDhI*!8N^r_&ZBdoaEd^yYT744IWlR}>t0{*eg5OYbB zO{G~tIbdogB?@zi&bw486h@X@P?ljCMy!7gUWd^VUW)s9ybS9|0@2n9FABb;O_~?< z5ov=alFm_0oVOgxa0H6G@p|w4j-<0fu{6~X3zB4$qJ&HFeXkGW;`@o5K(eiGO;kWd zoXfj---ww^umlt1GmOQtc5PqIGIYQpU&NyG$OeMSBJ`8MVKFI}+Q&TI6wLjgzTvW* z%J7Bnf6(ncyir2_yr;7%(4DG)IjQ}x%DJ<6c{=N;Whgiiq+HzKyreG`nH0P=F;4Vy zmEp^1iP|)q$MNQuI7RK7YL(_GjiGAV$a=h)P`1kNwRoe+yAopTAdwerRq6Vs}}q~1_9&hHSR2jM5&;xrL#YSecf)5h<{U9;TEs05&BvDyH$B;>NQ yszb3uN3YZmwb_=@(g)qHE?1YU%hlyFEdLLJ^78t!t}qe+0000 +#include +#include + +#include +#include +#include +#include +#include + + +class MainApplication : public ewol::context::Application { + public: + bool init(ewol::Context& _context, size_t _initId) { + APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); + + // TODO : Remove this : Move if in the windows properties + _context.setSize(vec2(800, 600)); + + // select internal data for font ... + _context.getFontDefault().setUseExternal(true); + _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); + + std::shared_ptr basicWindows = appl::Windows::create(); + // create the specific windows + _context.setWindows(basicWindows); + APPL_INFO("==> Init APPL (END)"); + return true; + } + + void unInit(ewol::Context& _context) { + APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)"); + // nothing to do ... + APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)"); + } +}; + + + +/** + * @brief Main of the program (This can be set in every case, but it is not used in Andoid...). + * @param std IO + * @return std IO + */ +int main(int _argc, const char *_argv[]) { + // second possibility + return ewol::run(new MainApplication(), _argc, _argv); +} \ No newline at end of file diff --git a/sample/examplewallpaper/appl/Main.h b/sample/examplewallpaper/appl/Main.h new file mode 100644 index 00000000..8a45fb5e --- /dev/null +++ b/sample/examplewallpaper/appl/Main.h @@ -0,0 +1,14 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_MAIN_H__ +#define __APPL_MAIN_H__ + + +#endif + diff --git a/sample/examplewallpaper/appl/WidgetDisplay.cpp b/sample/examplewallpaper/appl/WidgetDisplay.cpp new file mode 100644 index 00000000..a8918c8a --- /dev/null +++ b/sample/examplewallpaper/appl/WidgetDisplay.cpp @@ -0,0 +1,116 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#include + +#include +#include + +#undef __class__ +#define __class__ "WidgetDisplay" + + + +appl::WidgetDisplay::WidgetDisplay() { + addObjectType("appl::WidgetDisplay"); +} + +void appl::WidgetDisplay::init() { + ewol::Widget::init(); + m_compositing.setSource("DATA:SnowFlake.svg", ivec2(128,128)); + setCanHaveFocus(true); + periodicCallEnable(); + for (int32_t iii=0; iii<250 ; ++iii) { + m_elements.push_back(appl::WidgetDisplay::Element()); + } +} + + +appl::WidgetDisplay::~WidgetDisplay() { + +} + +void appl::WidgetDisplay::onDraw() { + m_compositing.draw(); +} + +appl::WidgetDisplay::Element::Element() { + regenerate(vec2(1024,2048)); + m_lifeTime = etk::tool::frand(-4,4); + m_life = m_lifeTime; +} + +void appl::WidgetDisplay::Element::regenerate(const vec2& _size) { + float sizeDisplay=etk::tool::frand(10,64); + m_position = vec2(etk::tool::frand(0,_size.x()), + etk::tool::frand(_size.y(),_size.y()+64)); + m_size = vec2(sizeDisplay,sizeDisplay); + m_angle = etk::tool::frand(-3.1415952f,3.1415952f); + m_lifeTime = etk::tool::frand(1,10); + m_life = m_lifeTime; + m_lifeTime += 4; + m_angleAdd = etk::tool::frand(-0.05f,0.05f); + m_downSpeed = etk::tool::frand(0.5f,3.f); +} + +void appl::WidgetDisplay::Element::move(float _deltaTime) { + m_lifeTime -= _deltaTime; + m_position -= vec2(0, m_downSpeed); + m_angle += m_angleAdd; +} + +void appl::WidgetDisplay::onRegenerateDisplay() { + if (needRedraw() == false) { + return; + } + // remove data of the previous composition : + m_compositing.clear(); + for (int32_t iii=0; iii(0xFF, 0xFF, 0xFF, color)); + } else if (m_elements[iii].m_lifeTime > m_elements[iii].m_life) { + int32_t color = 0xFF*(1.0f-0.25*(m_elements[iii].m_lifeTime - m_elements[iii].m_life)); + m_compositing.setColor(etk::Color<>(0xFF, 0xFF, 0xFF, color)); + } else { + m_compositing.setColor(etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF)); + } + //3d7dab + m_compositing.setPos(m_elements[iii].m_position); + m_compositing.setAngle(m_elements[iii].m_angle); + m_compositing.print(m_elements[iii].m_size); + } +} + +void appl::WidgetDisplay::periodicCall(const ewol::event::Time& _event) { + float curentDelta=_event.getDeltaCall(); + // set the somposition properties : + for (int32_t iii=0; iii +#include +#include + +namespace appl { + class WidgetDisplay : public ewol::Widget { + private: + class Element { + public: + Element(); + vec2 m_position; + vec2 m_size; + float m_angle; + float m_lifeTime; + float m_life; + float m_angleAdd; + float m_downSpeed; + void regenerate(const vec2& _size); + void move(float _deltaTime); + }; + protected: + WidgetDisplay(); + void init(); + public: + DECLARE_FACTORY(WidgetDisplay); + virtual ~WidgetDisplay(); + ewol::compositing::Image m_compositing; + std::vector m_elements; + public: // Derived function + void onRegenerateDisplay(); + virtual void periodicCall(const ewol::event::Time& _event); + virtual bool onEventInput(const ewol::event::Input& _event); + virtual void onDraw(); + }; +}; + +#endif + diff --git a/sample/examplewallpaper/appl/Windows.cpp b/sample/examplewallpaper/appl/Windows.cpp new file mode 100644 index 00000000..55a381fd --- /dev/null +++ b/sample/examplewallpaper/appl/Windows.cpp @@ -0,0 +1,39 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#include +#include +#include +#include + +#undef __class__ +#define __class__ "Windows" + + +appl::Windows::Windows() { + addObjectType("appl::Windows"); +} + +void appl::Windows::init() { + ewol::widget::Windows::init(); + setTitle("example Wallpaper"); + std::shared_ptr tmpWidget = appl::WidgetDisplay::create(); + if (tmpWidget == nullptr) { + APPL_ERROR("Can not allocate widget ==> display might be in error"); + } else { + setSubWidget(tmpWidget); + tmpWidget->setExpand(bvec2(true,true)); + tmpWidget->setFill(bvec2(true,true)); + } + setBackgroundColor(etk::Color(0,0,0,0)); +} + +appl::Windows::~Windows() { + +} + diff --git a/sample/examplewallpaper/appl/Windows.h b/sample/examplewallpaper/appl/Windows.h new file mode 100644 index 00000000..e7e31fc4 --- /dev/null +++ b/sample/examplewallpaper/appl/Windows.h @@ -0,0 +1,27 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_WINDOWS_H__ +#define __APPL_WINDOWS_H__ + +#include +#include + +namespace appl { + class Windows : public ewol::widget::Windows { + protected: + Windows(); + void init(); + public: + DECLARE_FACTORY(Windows); + virtual ~Windows(); + }; +}; + + +#endif \ No newline at end of file diff --git a/sample/examplewallpaper/appl/debug.cpp b/sample/examplewallpaper/appl/debug.cpp new file mode 100644 index 00000000..d63981aa --- /dev/null +++ b/sample/examplewallpaper/appl/debug.cpp @@ -0,0 +1,15 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#include + +int32_t appl::getLogId() { + static int32_t g_val = etk::log::registerInstance("example"); + return g_val; +} diff --git a/sample/examplewallpaper/appl/debug.h b/sample/examplewallpaper/appl/debug.h new file mode 100644 index 00000000..fcafd52a --- /dev/null +++ b/sample/examplewallpaper/appl/debug.h @@ -0,0 +1,52 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_DEBUG_H__ +#define __APPL_DEBUG_H__ + +#include + +namespace appl { + int32_t getLogId(); +}; +// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" +#define APPL_BASE(info,data) \ + do { \ + if (info <= etk::log::getLevel(appl::getLogId())) { \ + std::stringbuf sb; \ + std::ostream tmpStream(&sb); \ + tmpStream << data; \ + etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ + } \ + } while(0) + +#define APPL_CRITICAL(data) APPL_BASE(1, data) +#define APPL_ERROR(data) APPL_BASE(2, data) +#define APPL_WARNING(data) APPL_BASE(3, data) +#ifdef DEBUG + #define APPL_INFO(data) APPL_BASE(4, data) + #define APPL_DEBUG(data) APPL_BASE(5, data) + #define APPL_VERBOSE(data) APPL_BASE(6, data) + #define APPL_TODO(data) APPL_BASE(4, "TODO : " << data) +#else + #define APPL_INFO(data) do { } while(false) + #define APPL_DEBUG(data) do { } while(false) + #define APPL_VERBOSE(data) do { } while(false) + #define APPL_TODO(data) do { } while(false) +#endif + +#define APPL_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + APPL_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) + +#endif + diff --git a/sample/examplewallpaper/data/SnowFlake.svg b/sample/examplewallpaper/data/SnowFlake.svg new file mode 100644 index 00000000..193ada30 --- /dev/null +++ b/sample/examplewallpaper/data/SnowFlake.svg @@ -0,0 +1,5 @@ + + + + diff --git a/sample/examplewallpaper/lutin_examplewallpaper.py b/sample/examplewallpaper/lutin_examplewallpaper.py new file mode 100755 index 00000000..757608e3 --- /dev/null +++ b/sample/examplewallpaper/lutin_examplewallpaper.py @@ -0,0 +1,61 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools +import datetime + +def get_desc(): + return "Tutorial xxx example wallpaper" + + +def create(target): + # module name is 'edn' and type binary. + myModule = module.Module(__file__, 'examplewallpaper', 'PACKAGE') + # add the file to compile: + myModule.add_src_file([ + 'appl/Main.cpp', + 'appl/debug.cpp', + 'appl/WidgetDisplay.cpp', + 'appl/Windows.cpp', + ]) + + myModule.add_module_depend(['ewol']) + + myModule.compile_flags_CC([ + "-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""]) + + myModule.copy_folder('data/SnowFlake.svg','') + + myModule.add_path(tools.get_current_path(__file__)) + + + now = datetime.datetime.now() + versionID=str(now.year-2013)+"."+str(now.month)+"."+str(now.day) + + # set the package properties : + myModule.pkg_set("VERSION", versionID) + myModule.pkg_set("COMPAGNY_TYPE", "org") + myModule.pkg_set("COMPAGNY_NAME", "EWOL") + myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard "]) + myModule.pkg_set("ICON", tools.get_current_path(__file__) + "/../data/icon.png") + myModule.pkg_set("SECTION", "example") + myModule.pkg_set("PRIORITY", "extra") + myModule.pkg_set("DESCRIPTION", "EWOL example for Wallpaper on Android") + myModule.pkg_set("NAME", "ewol Wallpaper ewample") + + myModule.pkg_set("ANDROID_APPL_TYPE", "WALLPAPER") + + #for the exemple : + myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", \ + [ ["key","value display"],\ + ["key2","value display 2"]\ + ] \ + ]) + myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]]) + + + # add the currrent module at the + return myModule + + + + diff --git a/sample/license.txt b/sample/license.txt new file mode 100644 index 00000000..4a60c3c7 --- /dev/null +++ b/sample/license.txt @@ -0,0 +1,13 @@ +Copyright ewol samples Edouard DUPIN + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file From c750b5fd53b18be773ef3bda6ee69da5efa4c38c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 5 Dec 2014 22:02:05 +0100 Subject: [PATCH 29/57] [DEV] add some debug in program for openGL and add object parameter set --- external/ege | 2 +- sources/ewol/object/Object.cpp | 8 +++ sources/ewol/object/Object.h | 2 +- sources/ewol/resource/Program.cpp | 103 ++++++++++++++++++------------ sources/ewol/resource/Program.h | 2 + 5 files changed, 73 insertions(+), 44 deletions(-) diff --git a/external/ege b/external/ege index bc200958..b2a3095a 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit bc20095852db600eabef6ee13fae38f09c161d87 +Subproject commit b2a3095a2edb8c6cde490a0c80de4973c22d432b diff --git a/sources/ewol/object/Object.cpp b/sources/ewol/object/Object.cpp index e97001e3..99f5e8bc 100644 --- a/sources/ewol/object/Object.cpp +++ b/sources/ewol/object/Object.cpp @@ -164,3 +164,11 @@ std::shared_ptr ewol::Object::getSubObjectNamed(const std::string& return nullptr; } + +bool ewol::parameterSetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { + std::shared_ptr object = ewol::getContext().getEObjectManager().get(_objectName); + if (object == nullptr) { + return false; + } + return object->parameterSet(_config, _value); +} \ No newline at end of file diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 706bac91..2a0cebdf 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -241,7 +241,7 @@ namespace ewol { } */ }; - + bool parameterSetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value); }; /** diff --git a/sources/ewol/resource/Program.cpp b/sources/ewol/resource/Program.cpp index a82b7930..473fa7e3 100644 --- a/sources/ewol/resource/Program.cpp +++ b/sources/ewol/resource/Program.cpp @@ -125,15 +125,29 @@ std::ostream& ewol::resource::operator <<(std::ostream& _os, const std::vectorgetElementSize(_index) <= 0) { + EWOL_ERROR("Can not bind a VBO Buffer with an element size of : " << _vbo->getElementSize(_index) << " named=" << _vbo->getName()); + return; + } + EWOL_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _vbo->getElementSize(_index) << " element on oglID=" << _vbo->getGL_ID(_index) << " VBOindex=" << _index); glBindBuffer(GL_ARRAY_BUFFER, _vbo->getGL_ID(_index)); - checkGlError("glBindBuffer", __LINE__); + checkGlError("glBindBuffer", __LINE__, _idElem); EWOL_VERBOSE(" id=" << m_elementList[_idElem].m_elementId); EWOL_VERBOSE(" eleme size=" << _vbo->getElementSize(_index)); EWOL_VERBOSE(" jump sample=" << _jumpBetweenSample); @@ -393,9 +413,9 @@ void ewol::resource::Program::sendAttributePointer(int32_t _idElem, GL_FALSE, // take our values as-is _jumpBetweenSample, // no extra data between each position (GLvoid *)_offset); // Pointer on the buffer - checkGlError("glVertexAttribPointer", __LINE__); + checkGlError("glVertexAttribPointer", __LINE__, _idElem); glEnableVertexAttribArray(m_elementList[_idElem].m_elementId); - checkGlError("glEnableVertexAttribArray", __LINE__); + checkGlError("glEnableVertexAttribArray", __LINE__, _idElem); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -420,7 +440,7 @@ void ewol::resource::Program::uniformMatrix(int32_t _idElem, const mat4& _matrix } else { glUniformMatrix4fv(m_elementList[_idElem].m_elementId, 1, GL_FALSE, _matrix.m_mat); } - //checkGlError("glUniformMatrix4fv", __LINE__); + checkGlError("glUniformMatrix4fv", __LINE__, _idElem); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -437,7 +457,7 @@ void ewol::resource::Program::uniform1f(int32_t _idElem, float _value1) { return; } glUniform1f(m_elementList[_idElem].m_elementId, _value1); - //checkGlError("glUniform1f", __LINE__); + checkGlError("glUniform1f", __LINE__, _idElem); } void ewol::resource::Program::uniform2f(int32_t _idElem, float _value1, float _value2) { if (0 == m_program) { @@ -451,7 +471,7 @@ void ewol::resource::Program::uniform2f(int32_t _idElem, float _value1, float _ return; } glUniform2f(m_elementList[_idElem].m_elementId, _value1, _value2); - //checkGlError("glUniform2f", __LINE__); + checkGlError("glUniform2f", __LINE__, _idElem); } void ewol::resource::Program::uniform3f(int32_t _idElem, float _value1, float _value2, float _value3) { if (0 == m_program) { @@ -465,7 +485,7 @@ void ewol::resource::Program::uniform3f(int32_t _idElem, float _value1, float _v return; } glUniform3f(m_elementList[_idElem].m_elementId, _value1, _value2, _value3); - //checkGlError("glUniform3f", __LINE__); + checkGlError("glUniform3f", __LINE__, _idElem); } void ewol::resource::Program::uniform4f(int32_t _idElem, float _value1, float _value2, float _value3, float _value4) { if (0 == m_program) { @@ -478,9 +498,8 @@ void ewol::resource::Program::uniform4f(int32_t _idElem, float _value1, float _v if (false == m_elementList[_idElem].m_isLinked) { return; } - EWOL_ERROR("[" << m_elementList[_idElem].m_name << "] send 4 values"); glUniform4f(m_elementList[_idElem].m_elementId, _value1, _value2, _value3, _value4); - //checkGlError("glUniform4f", __LINE__); + checkGlError("glUniform4f", __LINE__, _idElem); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -497,7 +516,7 @@ void ewol::resource::Program::uniform1i(int32_t _idElem, int32_t _value1) { return; } glUniform1i(m_elementList[_idElem].m_elementId, _value1); - //checkGlError("glUniform1i", __LINE__); + checkGlError("glUniform1i", __LINE__, _idElem); } void ewol::resource::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_t _value2) { if (0 == m_program) { @@ -511,7 +530,7 @@ void ewol::resource::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_ return; } glUniform2i(m_elementList[_idElem].m_elementId, _value1, _value2); - //checkGlError("glUniform2i", __LINE__); + checkGlError("glUniform2i", __LINE__, _idElem); } void ewol::resource::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3) { if (0 == m_program) { @@ -525,7 +544,7 @@ void ewol::resource::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_ return; } glUniform3i(m_elementList[_idElem].m_elementId, _value1, _value2, _value3); - //checkGlError("glUniform3i", __LINE__); + checkGlError("glUniform3i", __LINE__, _idElem); } void ewol::resource::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3, int32_t _value4) { if (0 == m_program) { @@ -539,7 +558,7 @@ void ewol::resource::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_ return; } glUniform4i(m_elementList[_idElem].m_elementId, _value1, _value2, _value3, _value4); - //checkGlError("glUniform4i", __LINE__); + checkGlError("glUniform4i", __LINE__, _idElem); } @@ -565,7 +584,7 @@ void ewol::resource::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, co return; } glUniform1fv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform1fv", __LINE__); + checkGlError("glUniform1fv", __LINE__, _idElem); } void ewol::resource::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, const float *_value) { if (0 == m_program) { @@ -587,7 +606,7 @@ void ewol::resource::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, co return; } glUniform2fv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform2fv", __LINE__); + checkGlError("glUniform2fv", __LINE__, _idElem); } void ewol::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, const float *_value) { if (0 == m_program) { @@ -610,7 +629,7 @@ void ewol::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, co } EWOL_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec3"); glUniform3fv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform3fv", __LINE__); + checkGlError("glUniform3fv", __LINE__, _idElem); } void ewol::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, const float *_value) { if (0 == m_program) { @@ -633,7 +652,7 @@ void ewol::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, co } EWOL_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec4"); glUniform4fv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform4fv", __LINE__); + checkGlError("glUniform4fv", __LINE__, _idElem); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -658,7 +677,7 @@ void ewol::resource::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, co return; } glUniform1iv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform1iv", __LINE__); + checkGlError("glUniform1iv", __LINE__, _idElem); } void ewol::resource::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { if (0 == m_program) { @@ -680,7 +699,7 @@ void ewol::resource::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, co return; } glUniform2iv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform2iv", __LINE__); + checkGlError("glUniform2iv", __LINE__, _idElem); } void ewol::resource::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { if (0 == m_program) { @@ -702,7 +721,7 @@ void ewol::resource::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, co return; } glUniform3iv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform3iv", __LINE__); + checkGlError("glUniform3iv", __LINE__, _idElem); } void ewol::resource::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { if (0 == m_program) { @@ -724,7 +743,7 @@ void ewol::resource::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, co return; } glUniform4iv(m_elementList[_idElem].m_elementId, _nbElement, _value); - //checkGlError("glUniform4iv", __LINE__); + checkGlError("glUniform4iv", __LINE__, _idElem); } //#define PROGRAM_DISPLAY_SPEED @@ -741,7 +760,7 @@ void ewol::resource::Program::use() { #endif // event if it was 0 == > set it to prevent other use of the previous shader display ... ewol::openGL::useProgram(m_program); - //checkGlError("glUseProgram", __LINE__); + checkGlError("glUseProgram", __LINE__); } @@ -760,13 +779,13 @@ void ewol::resource::Program::setTexture0(int32_t _idElem, GLint _textureOpenGlI checkGlError("glEnable", __LINE__); #endif ewol::openGL::activeTexture(GL_TEXTURE0); - //checkGlError("glActiveTexture", __LINE__); + checkGlError("glActiveTexture", __LINE__, _idElem); // set the textureID glBindTexture(GL_TEXTURE_2D, _textureOpenGlID); - //checkGlError("glBindTexture", __LINE__); + checkGlError("glBindTexture", __LINE__, _idElem); // set the texture on the uniform attribute glUniform1i(m_elementList[_idElem].m_elementId, /*GL_TEXTURE*/0); - //checkGlError("glUniform1i", __LINE__); + checkGlError("glUniform1i", __LINE__, _idElem); m_hasTexture = true; } @@ -785,13 +804,13 @@ void ewol::resource::Program::setTexture1(int32_t _idElem, GLint _textureOpenGlI checkGlError("glEnable", __LINE__); #endif ewol::openGL::activeTexture(GL_TEXTURE1); - //checkGlError("glActiveTexture", __LINE__); + checkGlError("glActiveTexture", __LINE__, _idElem); // set the textureID glBindTexture(GL_TEXTURE_2D, _textureOpenGlID); - //checkGlError("glBindTexture", __LINE__); + checkGlError("glBindTexture", __LINE__, _idElem); // set the texture on the uniform attribute glUniform1i(m_elementList[_idElem].m_elementId, /*GL_TEXTURE*/1); - //checkGlError("glUniform1i", __LINE__); + checkGlError("glUniform1i", __LINE__, _idElem); m_hasTexture1 = true; } @@ -818,6 +837,6 @@ void ewol::resource::Program::unUse() { EWOL_DEBUG(" prog : " << localTime << "ms resource=\"" << m_name << "\""); } #endif - //checkGlError("glUseProgram", __LINE__); + checkGlError("glUseProgram", __LINE__); } diff --git a/sources/ewol/resource/Program.h b/sources/ewol/resource/Program.h index b25d1bc9..3e4eb1aa 100644 --- a/sources/ewol/resource/Program.h +++ b/sources/ewol/resource/Program.h @@ -303,6 +303,8 @@ namespace ewol { * @note this is really usefull when we tested the new themes or shader developpements. */ void reload(); + private: + void checkGlError(const char* _op, int32_t _localLine, int32_t _idElem=-2); }; }; }; From c4379885b3339392334a94e55d6537a54fc16e38 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 8 Dec 2014 22:37:20 +0100 Subject: [PATCH 30/57] [REMOVE] blender export-import of emf file (move in ege) --- blender/io_scene_emf/__init__.py | 218 ---------- blender/io_scene_emf/export_emf.py | 661 ----------------------------- external/ege | 2 +- 3 files changed, 1 insertion(+), 880 deletions(-) delete mode 100644 blender/io_scene_emf/__init__.py delete mode 100644 blender/io_scene_emf/export_emf.py diff --git a/blender/io_scene_emf/__init__.py b/blender/io_scene_emf/__init__.py deleted file mode 100644 index 47a549fd..00000000 --- a/blender/io_scene_emf/__init__.py +++ /dev/null @@ -1,218 +0,0 @@ -# add this folder in ~/.config/blender/2.66/scripts/addons - - -bl_info = { - "name": "Ewol Mesh file format emf", - "author": "Edouard DUPIN", - "blender": (2, 53, 0), - "location": "File > Import-Export", - "description": "Import-Export emf, Import EMF mesh, UV's, materials and textures", - "warning": "", - "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/EwolMechFile_EMF", - "tracker_url": "", - "support": 'OFFICIAL', - "category": "Import-Export"} - -if "bpy" in locals(): - import imp - if "import_emf" in locals(): - imp.reload(import_emf) - if "export_emf" in locals(): - imp.reload(export_emf) - - -import bpy -from bpy.props import (BoolProperty, - FloatProperty, - StringProperty, - EnumProperty, - ) -from bpy_extras.io_utils import (ExportHelper, - ImportHelper, - path_reference_mode, - axis_conversion, - ) - - -class ImportEMF(bpy.types.Operator, ImportHelper): - """Load a Wavefront EMF File""" - bl_idname = "import_scene.emf" - bl_label = "Import EMF" - bl_options = {'PRESET', 'UNDO'} - - filename_ext = ".emf" - filter_glob = StringProperty( - default="*.emf", - options={'HIDDEN'}, - ) - - axis_forward = EnumProperty( - name="Forward", - items=(('X', "X Forward", ""), - ('Y', "Y Forward", ""), - ('Z', "Z Forward", ""), - ('-X', "-X Forward", ""), - ('-Y', "-Y Forward", ""), - ('-Z', "-Z Forward", ""), - ), - default='-X', - ) - - axis_up = EnumProperty( - name="Up", - items=(('X', "X Up", ""), - ('Y', "Y Up", ""), - ('Z', "Z Up", ""), - ('-X', "-X Up", ""), - ('-Y', "-Y Up", ""), - ('-Z', "-Z Up", ""), - ), - default='Z', - ) - - def execute(self, context): - # print("Selected: " + context.active_object.name) - from . import import_obj - - keywords = self.as_keywords(ignore=("axis_forward", - "axis_up", - "filter_glob", - "split_mode", - )) - - global_matrix = axis_conversion(from_forward=self.axis_forward, - from_up=self.axis_up, - ).to_4x4() - keywords["global_matrix"] = global_matrix - - return import_obj.load(self, context, **keywords) - - def draw(self, context): - layout = self.layout - - row = layout.row(align=True) - - row = layout.split(percentage=0.67) - row.prop(self, "global_clamp_size") - layout.prop(self, "axis_forward") - layout.prop(self, "axis_up") - - layout.prop(self, "use_image_search") - - -class ExportEMF(bpy.types.Operator, ExportHelper): - """Save a Wavefront EMF File""" - - bl_idname = "export_scene.emf" - bl_label = 'Export EMF' - bl_options = {'PRESET'} - - filename_ext = ".emf" - filter_glob = StringProperty( - default="*.emf", - options={'HIDDEN'}, - ) - - # context group - use_selection = BoolProperty( - name="Selection Only", - description="Export selected objects only", - default=True, - ) - # generate binary file - use_binary = BoolProperty( - name="Binary", - description="Export the filein binary mode", - default=False, - ) - - global_scale = FloatProperty( - name="Scale", - description="Scale all data", - min=0.01, max=1000.0, - soft_min=0.01, - soft_max=1000.0, - default=1.0, - ) - - collision_object_name = StringProperty( - name="Collision root name (strat with)", - description="The top-level name that will contain the physics shapes", - default="phys" - ) - - axis_forward = EnumProperty( - name="Forward", - items=(('X', "X Forward", ""), - ('Y', "Y Forward", ""), - ('Z', "Z Forward", ""), - ('-X', "-X Forward", ""), - ('-Y', "-Y Forward", ""), - ('-Z', "-Z Forward", ""), - ), - default='-Z', - ) - - axis_up = EnumProperty( - name="Up", - items=(('X', "X Up", ""), - ('Y', "Y Up", ""), - ('Z', "Z Up", ""), - ('-X', "-X Up", ""), - ('-Y', "-Y Up", ""), - ('-Z', "-Z Up", ""), - ), - default='Y', - ) - - path_mode = path_reference_mode - - check_extension = True - - def execute(self, context): - from . import export_emf - - from mathutils import Matrix - keywords = self.as_keywords(ignore=("axis_forward", - "axis_up", - "global_scale", - "check_existing", - "filter_glob", - )) - - global_matrix = Matrix() - - global_matrix[0][0] = \ - global_matrix[1][1] = \ - global_matrix[2][2] = self.global_scale - - global_matrix = (global_matrix * - axis_conversion(to_forward=self.axis_forward, - to_up=self.axis_up, - ).to_4x4()) - - keywords["global_matrix"] = global_matrix - return export_emf.save(self, context, **keywords) - - -def menu_func_import(self, context): - self.layout.operator(ImportEMF.bl_idname, text="Ewol mesh file (.emf)") - - -def menu_func_export(self, context): - self.layout.operator(ExportEMF.bl_idname, text="Ewol mesh File (.emf)") - - -def register(): - bpy.utils.register_module(__name__) - bpy.types.INFO_MT_file_import.append(menu_func_import) - bpy.types.INFO_MT_file_export.append(menu_func_export) - - -def unregister(): - bpy.utils.unregister_module(__name__) - bpy.types.INFO_MT_file_import.remove(menu_func_import) - bpy.types.INFO_MT_file_export.remove(menu_func_export) - -if __name__ == "__main__": - register() diff --git a/blender/io_scene_emf/export_emf.py b/blender/io_scene_emf/export_emf.py deleted file mode 100644 index 4e0907b7..00000000 --- a/blender/io_scene_emf/export_emf.py +++ /dev/null @@ -1,661 +0,0 @@ - -import os -import time - -import bpy -import mathutils -import bpy_extras.io_utils - -def getChildren(obj): - children = [] - for ob in bpy.data.objects: - if ob.parent == obj: - children.append(ob) - return children - - -import bpy -from bpy.props import * -import mathutils, math, struct -from mathutils import * -import os -from os import remove -import time -import bpy_extras -from bpy_extras.io_utils import ExportHelper -import time -import shutil - -""" -Usage Notes: -To create a compound physics collision shape for a mesh in blender: - -1. place the 3D cursor at the origin of the mesh object. -2. Add > Empty, name it "physics" -3. Create a physics shape with Add > Mesh > Cube, UV Sphere, Cylinder, Cone or create an arbitrary mesh for a ConvexHull shape. -4. Parent the new shape to the "physics" Empty. -5. The mesh name must start with: Box, Sphere, Cylinder, Cone, Capsule, or ConvexHull, depending on the shape you want. -6. Position and scale the shape object, but do not modify the internal vertices, unless it is a ConvexHull type. -7. Repeat step 3-6 until your shape is complete. Shapes can only be a 1-level deep hierarchy. -8. IMPORTANT: Select the empty object you named "physics" -9. Click File > Export > Physics Shapes (.yaml) -""" - -""" - use_y_up = BoolProperty(name="Convert To Y-Up", - description="Converts the values to a Y-Axis Up coordinate system", - default=True) -""" - -# Methods for writing point, scale, and quaternion types to a YAML file. -# This particular implementation converts values to a Y-up coordinate system. -def out_point3_y_up( v ): - return "%g %g %g" % ( v.x, v.z, -v.y ) -def out_scale3_y_up( s ): - return "%g %g %g" % ( s.x, s.z, s.y ) -def out_quaternion_y_up( q ): - return "%g %g %g %g" % ( q.w, q.x, q.z, -q.y ) -# This implementation maintains blender's Z-up coordinate system. -def out_point3_z_up( v ): - return "%g %g %g" % ( v.x, v.y, v.z ) -def out_scale3_z_up( s ): - return "%g %g %g" % ( s.x, s.y, s.z ) -def out_quaternion_z_up( q ): - return "%g %g %g %g" % ( q.w, q.x, q.y, q.z ) - - -def getPhysicsShape(obj, mainObjScale, use_y_up=False): - shape = "" - props = { } - name = obj.name.lower() - scale = Vector(( abs(obj.scale.x), abs(obj.scale.y), abs(obj.scale.z) )) - - if use_y_up: - out_point3 = out_point3_y_up - out_scale3 = out_scale3_y_up - out_quaternion = out_quaternion_y_up - else: - out_point3 = out_point3_z_up - out_scale3 = out_scale3_z_up - out_quaternion = out_quaternion_z_up - - # BOX - if name.startswith('box') \ - or name.startswith('cube'): - shape = "Box" - props["half-extents"] = out_scale3( scale ) - # SPHERE - elif name.startswith('sph'): - shape = "Sphere" - props["radius"] = obj.scale.x * mainObjScale.x - # CONE - elif name.startswith('cone'): - shape = "Cone" - props["radius"] = obj.scale.x - props["height"] = obj.scale.z * 2.0 - # CYLINDER - elif name.startswith('cyl'): - shape = "Cylinder" - props["half-extents"] = out_scale3( scale ) - # CAPSULE - elif name.startswith('cap'): - shape = "Capsule" - props["radius"] = obj.scale.x - props["height"] = obj.scale.z - # CONVEX-HULL - elif name.startswith('convex'): - shape = "ConvexHull" - mesh = obj.to_mesh( bpy.context.scene, True, 'PREVIEW' ) - props["points"] = "" - for v in mesh.vertices: - props["points"] += "" + out_point3( v.co ) + "|" - props["points"] = props["points"].rstrip("|") - if scale != Vector((1,1,1)): - props["scale"] = out_scale3( scale ) - # remove mesh - - print(" shape type : '%s' from element name : '%s'" % (shape, obj.name)) - - if obj.location != Vector((0,0,0)): - props["origin"] = out_point3( obj.location ) - - if obj.rotation_mode == 'QUATERNION': - qrot = obj.rotation_quaternion - else: - qrot = obj.matrix_local.to_quaternion() - - if qrot != Quaternion((1,0,0,0)): - props["rotate"] = out_quaternion( qrot ) - - return (shape, props) - - -def writeCollisionShape(object, file, mainObjScale): - if len(getChildren(object))==0: - # no phisical shape ... - return - fw = file.write - fw('\t\tPhysics : \n') - for subObj in getChildren(object): - print(" element='%s' type '%s'" % (subObj.name,str(subObj.type))) - if subObj.type != 'MESH': - continue - (shape, props) = getPhysicsShape(subObj, mainObjScale) - if shape=="": - print("error of shape detection type ..."); - continue - fw("\t\t\t" + shape + "\n" ) - for (k,v) in props.items(): - fw("\t\t\t\t%s : %s\n" % (k, v) ) - - - -def name_compat(name): - if name is None: - return 'None' - else: - return name.replace(' ', '_') - - -def mesh_triangulate(me): - import bmesh - bm = bmesh.new() - bm.from_mesh(me) - bmesh.ops.triangulate(bm, faces=bm.faces)#, use_beauty=False) - bm.to_mesh(me) - bm.free() - - -def write_mtl(scene, file, filepath, path_mode, copy_set, mtl_dict): - from mathutils import Color - world = scene.world - if world: - world_amb = world.ambient_color - else: - world_amb = Color((0.0, 0.0, 0.0)) - source_dir = os.path.dirname(bpy.data.filepath) - dest_dir = os.path.dirname(filepath) - fw = file.write - fw('\nMaterials : %i\n' % len(mtl_dict)) - mtl_dict_values = list(mtl_dict.values()) - mtl_dict_values.sort(key=lambda m: m[0]) - # Write material/image combinations we have used. - # Using mtl_dict.values() directly gives un-predictable order. - for mtl_mat_name, mat, face_img in mtl_dict_values: - # Get the Blender data for the material and the image. - # Having an image named None will make a bug, dont do it :) - fw('\t%s\n' % mtl_mat_name) # Define a new material: matname_imgname - if mat: - # convert from blenders spec to 0 - 1000 range. - if mat.specular_shader == 'WARDISO': - tspec = (0.4 - mat.specular_slope) / 0.0004 - else: - tspec = (mat.specular_hardness - 1) * 1.9607843137254901 - fw('\t\tNs %.6f\n' % tspec) - del tspec - fw('\t\tKa %.6f %.6f %.6f\n' % (mat.ambient * world_amb)[:]) # Ambient, uses mirror color, - fw('\t\tKd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:]) # Diffuse - fw('\t\tKs %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:]) # Specular - if hasattr(mat, "ior"): - fw('\t\tNi %.6f\n' % mat.ior) # Refraction index - else: - fw('\t\tNi %.6f\n' % 1.0) - fw('\t\td %.6f\n' % mat.alpha) # Alpha (obj uses 'd' for dissolve) - # 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting. - if mat.use_shadeless: - fw('\t\tillum 0\n') # ignore lighting - elif mat.specular_intensity == 0: - fw('\t\tillum 1\n') # no specular. - else: - fw('\t\tillum 2\n') # light normaly - else: - #write a dummy material here? - fw('\t\tNs 0\n') - fw('\t\tKa %.6f %.6f %.6f\n' % world_amb[:]) # Ambient, uses mirror color, - fw('\t\tKd 0.8 0.8 0.8\n') - fw('\t\tKs 0.8 0.8 0.8\n') - fw('\t\td 1\n') # No alpha - fw('\t\tillum 2\n') # light normaly - # Write images! - if face_img: # We have an image on the face! - filepath = face_img.filepath - if filepath: # may be '' for generated images - # write relative image path - filepath = bpy_extras.io_utils.path_reference(filepath, - source_dir, - dest_dir, - path_mode, - "", - copy_set, - face_img.library) - fw('\t\tmap_Kd %s\n' % filepath) # Diffuse mapping image - del filepath - else: - # so we write the materials image. - face_img = None - if mat: # No face image. if we havea material search for MTex image. - image_map = {} - # backwards so topmost are highest priority - for mtex in reversed(mat.texture_slots): - if mtex and mtex.texture and mtex.texture.type == 'IMAGE': - image = mtex.texture.image - if image: - # texface overrides others - if( mtex.use_map_color_diffuse - and (face_img is None) - and (mtex.use_map_warp is False) - and (mtex.texture_coords != 'REFLECTION') - ): - image_map["map_Kd"] = image - if mtex.use_map_ambient: - image_map["map_Ka"] = image - # this is the Spec intensity channel but Ks stands for specular Color - if mtex.use_map_color_spec: # specular color - image_map["map_Ks"] = image - if mtex.use_map_hardness: # specular hardness/glossiness - image_map["map_Ns"] = image - if mtex.use_map_alpha: - image_map["map_d"] = image - if mtex.use_map_translucency: - image_map["map_Tr"] = image - if mtex.use_map_normal and (mtex.texture.use_normal_map is True): - image_map["map_Bump"] = image - if mtex.use_map_normal and (mtex.texture.use_normal_map is False): - image_map["map_Disp"] = image - if mtex.use_map_color_diffuse and (mtex.texture_coords == 'REFLECTION'): - image_map["map_refl"] = image - if mtex.use_map_emit: - image_map["map_Ke"] = image - for key, image in image_map.items(): - filepath = bpy_extras.io_utils.path_reference(image.filepath, - source_dir, - dest_dir, - path_mode, - "", - copy_set, - image.library) - fw('\t\t%s %s\n' % (key, repr(filepath)[1:-1])) - - -""" - " @brief Basic write function. The context and options must be already set. -""" -def write_file(filepath, - objects, - scene, - EXPORT_GLOBAL_MATRIX=None, - EXPORT_PATH_MODE='AUTO', - EXPORT_BINARY_MODE=False, - EXPORT_COLLISION_NAME="" - ): - if EXPORT_GLOBAL_MATRIX is None: - EXPORT_GLOBAL_MATRIX = mathutils.Matrix() - - def veckey3d(v): - return round(v.x, 6), round(v.y, 6), round(v.z, 6) - - def veckey2d(v): - return round(v[0], 6), round(v[1], 6) - - print('EMF Export path: %r' % filepath) - - time1 = time.time() - - mtlfilepath = os.path.splitext(filepath)[0] + ".mtl" - - file = open(filepath, "w", encoding="utf8", newline="\n") - fw = file.write - - # Write Header - fw('EMF(STRING)\n') # if binary : fw('EMF(BINARY)\n') - fw('# Blender v%s EMF File: %r\n' % (bpy.app.version_string, os.path.basename(bpy.data.filepath))) - - # Initialize totals, these are updated each object - totverts = totuvco = totno = 1 - - face_vert_index = 1 - - globalNormals = {} - - # A Dict of Materials - # (material.name, image.name):matname_imagename # matname_imagename has gaps removed. - mtl_dict = {} - # Used to reduce the usage of matname_texname materials, which can become annoying in case of - # repeated exports/imports, yet keeping unique mat names per keys! - # mtl_name: (material.name, image.name) - mtl_rev_dict = {} - - copy_set = set() - - # Get all meshes - for ob_main in objects: - print("**************** '%s' *******************" % str(ob_main.name)) - if ob_main.type != 'MESH': - print(ob_main.name, 'is not a mesh type - ignoring') - fw('# can not export : "%s" : type="%s"\n' % (ob_main.name, str(ob_main.type))) - continue - #print("name : '%s'" % ob_main.name) - #for plop in ob_main.child: - # print(" child : '%s'" % plop.name) - # ignore dupli children - if ob_main.parent and ob_main.parent.dupli_type in {'VERTS', 'FACES'}: - # XXX - print(ob_main.name, 'is a dupli child - ignoring') - continue - obs = [] - if ob_main.dupli_type != 'NONE': - # XXX - print('creating dupli_list on', ob_main.name) - ob_main.dupli_list_create(scene) - obs = [(dob.object, dob.matrix) for dob in ob_main.dupli_list] - # XXX debug print - print(ob_main.name, 'has', len(obs), 'dupli children') - else: - obs = [(ob_main, ob_main.matrix_world)] - idMesh=0 - for ob, ob_mat in obs: - try: - # apply the mesh modifieur at the curent object : - me = ob.to_mesh(scene, True, 'PREVIEW', calc_tessface=False) - except RuntimeError: - me = None - if me is None: - continue - idMesh = idMesh+1; - fw('Mesh : %d\n' % idMesh) - me.transform(EXPORT_GLOBAL_MATRIX * ob_mat) - #print("ploppp : " + str(EXPORT_GLOBAL_MATRIX) ) - #print("ploppp : " + str(ob_mat) ) - # _must_ do this first since it re-allocs arrays - # triangulate all the mesh : - mesh_triangulate(me) - # calculated normals: - me.calc_normals() - # export UV mapping : - faceuv = len(me.uv_textures) > 0 - if faceuv: - uv_texture = me.uv_textures.active.data[:] - uv_layer = me.uv_layers.active.data[:] - me_verts = me.vertices[:] - # Make our own list so it can be sorted to reduce context switching - face_index_pairs = [(face, index) for index, face in enumerate(me.polygons)] - # faces = [ f for f in me.tessfaces ] - edges = me.edges - if not (len(face_index_pairs) + len(edges) + len(me.vertices)): # Make sure there is somthing to write - # clean up - bpy.data.meshes.remove(me) - continue # dont bother with this mesh. - - materials = me.materials[:] - material_names = [m.name if m else None for m in materials] - # avoid bad index errors - if not materials: - materials = [None] - material_names = [name_compat(None)] - # Sort by Material, then images - # so we dont over context switch in the obj file. - if faceuv: - face_index_pairs.sort(key=lambda a: (a[0].material_index, hash(uv_texture[a[1]].image), a[0].use_smooth)) - elif len(materials) > 1: - face_index_pairs.sort(key=lambda a: (a[0].material_index, a[0].use_smooth)) - else: - # no materials - face_index_pairs.sort(key=lambda a: a[0].use_smooth) - # Set the default mat to no material and no image. - contextMat = 0, 0 # Can never be this, so we will label a new material the first chance we get. - contextSmooth = None # Will either be true or false, set bad to force initialization switch. - # use : blen obs ??? what is this .... - if True: - name1 = ob.name - name2 = ob.data.name - if name1 == name2: - obnamestring = name_compat(name1) - else: - obnamestring = '%s_%s' % (name_compat(name1), name_compat(name2)) - fw('\t%s\n' % obnamestring) # Write Object name - ########################################################### - ## Vert - ########################################################### - fw('\t\tVertex : %d\n\t\t\t' % len(me_verts)) - for v in me_verts: - fw('%.6f %.6f %.6f|' % v.co[:]) - fw('\n') - ########################################################### - ## UV - ########################################################### - fw('\t\tUV-mapping :\n\t\t\t') - if faceuv: - # in case removing some of these dont get defined. - uv = uvkey = uv_dict = f_index = uv_index = None - uv_face_mapping = [None] * len(face_index_pairs) - uv_dict = {} # could use a set() here - for f, f_index in face_index_pairs: - uv_ls = uv_face_mapping[f_index] = [] - for uv_index, l_index in enumerate(f.loop_indices): - uv = uv_layer[l_index].uv - uvkey = veckey2d(uv) - try: - uv_k = uv_dict[uvkey] - except: - uv_k = uv_dict[uvkey] = len(uv_dict) - fw('%.6f %.6f|' % uv[:]) - uv_ls.append(uv_k) - uv_unique_count = len(uv_dict) - del uv, uvkey, uv_dict, f_index, uv_index, uv_ls, uv_k - # Only need uv_unique_count and uv_face_mapping - fw('\n') - ########################################################### - ## NORMAL - ########################################################### - if f.use_smooth: - localIsSmooth = 'vertex' - else: - localIsSmooth = 'face' - fw('\t\tNormal(%s) : %d\n\t\t\t' % (localIsSmooth, len(face_index_pairs)) ) - for f, f_index in face_index_pairs: - if f.use_smooth: - for v_idx in f.vertices: - v = me_verts[v_idx] - noKey = veckey3d(v.normal) - if noKey not in globalNormals: - globalNormals[noKey] = totno - totno += 1 - fw('%.6f %.6f %.6f|' % noKey) - else: - # Hard, 1 normal from the face. - noKey = veckey3d(f.normal) - if noKey not in globalNormals: - globalNormals[noKey] = totno - totno += 1 - fw('%.6f %.6f %.6f|' % noKey) - - fw('\n') - if not faceuv: - f_image = None - ########################################################### - ## faces - ########################################################### - fw('\t\tFace : %d' % len(face_index_pairs)) - for f, f_index in face_index_pairs: - f_smooth = f.use_smooth - f_mat = min(f.material_index, len(materials) - 1) - if faceuv: - tface = uv_texture[f_index] - f_image = tface.image - # MAKE KEY - if faceuv and f_image: # Object is always true. - key = material_names[f_mat], f_image.name - else: - key = material_names[f_mat], None # No image, use None instead. - # CHECK FOR CONTEXT SWITCH - if key == contextMat: - pass # Context already switched, dont do anything - else: - if key[0] is None and key[1] is None: - # inform the use of a material : - fw("\n\t\t\t---:") # mat, image - else: - mat_data = mtl_dict.get(key) - if not mat_data: - # First add to global dict so we can export to mtl - # Then write mtl - # Make a new names from the mat and image name, - # converting any spaces to underscores with name_compat. - # If none image dont bother adding it to the name - # Try to avoid as much as possible adding texname (or other things) - # to the mtl name (see [#32102])... - mtl_name = "%s" % name_compat(key[0]) - if mtl_rev_dict.get(mtl_name, None) not in {key, None}: - if key[1] is None: - tmp_ext = "_NONE" - else: - tmp_ext = "_%s" % name_compat(key[1]) - i = 0 - while mtl_rev_dict.get(mtl_name + tmp_ext, None) not in {key, None}: - i += 1 - tmp_ext = "_%3d" % i - mtl_name += tmp_ext - mat_data = mtl_dict[key] = mtl_name, materials[f_mat], f_image - mtl_rev_dict[mtl_name] = key - # set the use of a material : - fw("\n\t\t\t%s\n\t\t\t\t" % mat_data[0]) # can be mat_image or (null) - contextMat = key - f_v = [(vi, me_verts[v_idx]) for vi, v_idx in enumerate(f.vertices)] - if faceuv: - # export the normals : - if f_smooth: # Smoothed, use vertex normals - for vi, v in f_v: - fw(" %d/%d/%d" % - (v.index + totverts-1, - totuvco + uv_face_mapping[f_index][vi]-1, - globalNormals[veckey3d(v.normal)]-1, - )) # vert, uv, normal - else: # No smoothing, face normals - no = globalNormals[veckey3d(f.normal)] - for vi, v in f_v: - fw(" %d/%d/%d" % - (v.index + totverts-1, - totuvco + uv_face_mapping[f_index][vi]-1, - no-1, - )) # vert, uv, normal - face_vert_index += len(f_v) - else: # No UV's - # export the normals : - if f_smooth: # Smoothed, use vertex normals - for vi, v in f_v: - fw(" %d//%d" % ( - v.index + totverts-1, - globalNormals[veckey3d(v.normal)]-1, - )) - else: # No smoothing, face normals - no = globalNormals[veckey3d(f.normal)] - for vi, v in f_v: - fw(" %d//%d" % (v.index + totverts-1, no-1)) - fw('|') - fw('\n') - # Write edges. ==> did not know what it is ... - #fw('Faces : %d' % len(edges)) - #for ed in edges: - # if ed.is_loose: - # fw('%d %d\n' % (ed.vertices[0] + totverts, ed.vertices[1] + totverts)) - - # Make the indices global rather then per mesh - totverts += len(me_verts) - if faceuv: - totuvco += uv_unique_count - # clean up - bpy.data.meshes.remove(me) - if ob_main.dupli_type != 'NONE': - ob_main.dupli_list_clear() - ##################################################################### - ## Save collision shapes (for one object : - ##################################################################### - for subObj in getChildren(ob_main): - print(" child : '%s'" % (subObj.name)) - if subObj.name.lower().startswith(EXPORT_COLLISION_NAME): - print(" find physics : '%s'" % (subObj.name)) - writeCollisionShape(subObj, file, ob_main.scale) - - ##################################################################### - ## Now we have all our materials, save them in the material section - ##################################################################### - write_mtl(scene, file, mtlfilepath, EXPORT_PATH_MODE, copy_set, mtl_dict) - - ##################################################################### - ## End of the file generation: - ##################################################################### - file.close() - - # copy all collected files. - bpy_extras.io_utils.path_reference_copy(copy_set) - - print("EMF Export time: %.2f" % (time.time() - time1)) - - -""" - " @brief generate the requested object file ... with his material inside and ... - " -""" -def _write(context, - filepath, - EXPORT_SEL_ONLY, - EXPORT_GLOBAL_MATRIX, - EXPORT_PATH_MODE, - EXPORT_BINARY_MODE, - EXPORT_COLLISION_NAME, - ): - # - base_name, ext = os.path.splitext(filepath) - # create the output name : - context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension - # get the curent scene : - scene = context.scene - # Exit edit mode before exporting, so current object states are exported properly. - if bpy.ops.object.mode_set.poll(): - bpy.ops.object.mode_set(mode='OBJECT') - # get the curent frame selected : - frame = scene.frame_current - # Loop through all frames in the scene and export. - scene.frame_set(frame, 0.0) - # get only the object that are selected or all ... - if EXPORT_SEL_ONLY: - objects = context.selected_objects - else: - objects = scene.objects - - full_path = ''.join(context_name) - - write_file(full_path, - objects, - scene, - EXPORT_GLOBAL_MATRIX, - EXPORT_PATH_MODE, - EXPORT_BINARY_MODE, - EXPORT_COLLISION_NAME, - ) - - - -""" - " @brief Save the current element in the file requested. - " -""" -def save(operator, - context, - filepath="", - use_selection=True, - use_binary=False, - collision_object_name="", - global_matrix=None, - path_mode='AUTO' - ): - _write(context, - filepath, - EXPORT_SEL_ONLY=use_selection, - EXPORT_GLOBAL_MATRIX=global_matrix, - EXPORT_PATH_MODE=path_mode, - EXPORT_BINARY_MODE=use_binary, - EXPORT_COLLISION_NAME=collision_object_name, - ) - - return {'FINISHED'} diff --git a/external/ege b/external/ege index b2a3095a..a617216d 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit b2a3095a2edb8c6cde490a0c80de4973c22d432b +Subproject commit a617216d054368eb6ebeb8c6c248c07788ab1a69 From 429c0ae82f31e66a95e8866765017493dff832e8 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 13 Dec 2014 19:00:36 +0100 Subject: [PATCH 31/57] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 73d5f40d..8e3d5339 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://secure.travis-ci.org/HeeroYui/ewol.svg?branch=dev)](https://travis-ci.org/HeeroYui/ewol) + Ewol ==== From db62bf6714151161c411311833ed0caaffadf849 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 17 Dec 2014 22:12:32 +0100 Subject: [PATCH 32/57] [DEV] add lua wrapper --- .gitmodules | 3 +++ external/ege | 2 +- external/luaWrapper | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 external/luaWrapper diff --git a/.gitmodules b/.gitmodules index 7e4cfb31..cdef5a74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -71,3 +71,6 @@ [submodule "external/gtest"] path = external/gtest url = https://github.com/HeeroYui/gtest +[submodule "external/luaWrapper"] + path = external/luaWrapper + url = https://github.com/HeeroYui/luaWrapper.git diff --git a/external/ege b/external/ege index a617216d..673a7fba 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit a617216d054368eb6ebeb8c6c248c07788ab1a69 +Subproject commit 673a7fbade325a75a45aa574d33738498b74fa86 diff --git a/external/luaWrapper b/external/luaWrapper new file mode 160000 index 00000000..11bbc0e7 --- /dev/null +++ b/external/luaWrapper @@ -0,0 +1 @@ +Subproject commit 11bbc0e7a101c3473894cbf732ea361bec0b7609 From 5a98b86deaea5d93d01ce36bd171da12b0e27a2e Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 19 Dec 2014 23:51:41 +0100 Subject: [PATCH 33/57] [DEV] add luaWrapper --- external/luaWrapper | 2 +- sample/099_lua/appl/Main.cpp | 71 +++++++++++++++++++++++ sample/099_lua/appl/Main.h | 14 +++++ sample/099_lua/appl/Windows.cpp | 33 +++++++++++ sample/099_lua/appl/Windows.h | 25 ++++++++ sample/099_lua/appl/debug.cpp | 15 +++++ sample/099_lua/appl/debug.h | 52 +++++++++++++++++ sample/099_lua/lutin_099_lua.py | 32 ++++++++++ sources/wrapper/ewolLua/debug.cpp | 14 +++++ sources/wrapper/ewolLua/debug.h | 52 +++++++++++++++++ sources/wrapper/ewolLua/ewolLua.cpp | 18 ++++++ sources/wrapper/ewolLua/ewolLua.h | 20 +++++++ sources/wrapper/ewolLua/object.cpp | 35 +++++++++++ sources/wrapper/ewolLua/object.h | 20 +++++++ sources/wrapper/ewolLua/objectManager.cpp | 17 ++++++ sources/wrapper/ewolLua/objectManager.h | 20 +++++++ sources/wrapper/lutin_ewolLua.py | 33 +++++++++++ 17 files changed, 472 insertions(+), 1 deletion(-) create mode 100644 sample/099_lua/appl/Main.cpp create mode 100644 sample/099_lua/appl/Main.h create mode 100644 sample/099_lua/appl/Windows.cpp create mode 100644 sample/099_lua/appl/Windows.h create mode 100644 sample/099_lua/appl/debug.cpp create mode 100644 sample/099_lua/appl/debug.h create mode 100755 sample/099_lua/lutin_099_lua.py create mode 100644 sources/wrapper/ewolLua/debug.cpp create mode 100644 sources/wrapper/ewolLua/debug.h create mode 100644 sources/wrapper/ewolLua/ewolLua.cpp create mode 100644 sources/wrapper/ewolLua/ewolLua.h create mode 100644 sources/wrapper/ewolLua/object.cpp create mode 100644 sources/wrapper/ewolLua/object.h create mode 100644 sources/wrapper/ewolLua/objectManager.cpp create mode 100644 sources/wrapper/ewolLua/objectManager.h create mode 100644 sources/wrapper/lutin_ewolLua.py diff --git a/external/luaWrapper b/external/luaWrapper index 11bbc0e7..1c941a03 160000 --- a/external/luaWrapper +++ b/external/luaWrapper @@ -1 +1 @@ -Subproject commit 11bbc0e7a101c3473894cbf732ea361bec0b7609 +Subproject commit 1c941a031b9382b3c98f00a0fcf39dc20c135a24 diff --git a/sample/099_lua/appl/Main.cpp b/sample/099_lua/appl/Main.cpp new file mode 100644 index 00000000..a66c9ff6 --- /dev/null +++ b/sample/099_lua/appl/Main.cpp @@ -0,0 +1,71 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class MainApplication : public ewol::context::Application { + private: + lua_State* m_lua; + public: + bool init(ewol::Context& _context, size_t _initId) { + APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); + m_lua = luaL_newstate(); + // TODO : Remove this : Move if in the windows properties + _context.setSize(vec2(800, 600)); + luaL_openlibs(m_lua); + ewolLua::loadEwolLuaWrapper(m_lua); + // select internal data for font ... + _context.getFontDefault().setUseExternal(true); + _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); + + + if (luaL_dostring(m_lua, "")) { + std::cout << lua_tostring(m_lua, -1) << std::endl; + } + + std::shared_ptr basicWindows = appl::Windows::create(); + // create the specific windows + _context.setWindows(basicWindows); + APPL_INFO("==> Init APPL (END)"); + return true; + } + + void unInit(ewol::Context& _context) { + APPL_INFO("==> Un-Init APPL (START)"); + // nothing to do ... + lua_close(m_lua); + APPL_INFO("==> Un-Init APPL (END)"); + } +}; + + +/** + * @brief Main of the program (This can be set in every case, but it is not used in Andoid...). + * @param std IO + * @return std IO + */ +int main(int _argc, const char *_argv[]) { + // second possibility + return ewol::run(new MainApplication(), _argc, _argv); +} + + diff --git a/sample/099_lua/appl/Main.h b/sample/099_lua/appl/Main.h new file mode 100644 index 00000000..8a45fb5e --- /dev/null +++ b/sample/099_lua/appl/Main.h @@ -0,0 +1,14 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_MAIN_H__ +#define __APPL_MAIN_H__ + + +#endif + diff --git a/sample/099_lua/appl/Windows.cpp b/sample/099_lua/appl/Windows.cpp new file mode 100644 index 00000000..16d06399 --- /dev/null +++ b/sample/099_lua/appl/Windows.cpp @@ -0,0 +1,33 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#include +#include +#include +#include + +#undef __class__ +#define __class__ "Windows" + +appl::Windows::Windows() { + addObjectType("appl::Windows"); +} +void appl::Windows::init() { + ewol::widget::Windows::init(); + setTitle("example 001_HelloWord"); + std::shared_ptr tmpWidget = ewol::widget::Label::create(); + if (tmpWidget == nullptr) { + APPL_ERROR("Can not allocate widget ==> display might be in error"); + } else { + tmpWidget->setLabel("Hello Word"); + tmpWidget->setExpand(bvec2(true,true)); + setSubWidget(tmpWidget); + } +} + + diff --git a/sample/099_lua/appl/Windows.h b/sample/099_lua/appl/Windows.h new file mode 100644 index 00000000..92614217 --- /dev/null +++ b/sample/099_lua/appl/Windows.h @@ -0,0 +1,25 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __APPL_WINDOWS_H__ +#define __APPL_WINDOWS_H__ + +#include + +namespace appl { + class Windows : public ewol::widget::Windows { + protected: + Windows(); + void init(); + public: + DECLARE_FACTORY(Windows); + }; +}; + + +#endif \ No newline at end of file diff --git a/sample/099_lua/appl/debug.cpp b/sample/099_lua/appl/debug.cpp new file mode 100644 index 00000000..d63981aa --- /dev/null +++ b/sample/099_lua/appl/debug.cpp @@ -0,0 +1,15 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#include + +int32_t appl::getLogId() { + static int32_t g_val = etk::log::registerInstance("example"); + return g_val; +} diff --git a/sample/099_lua/appl/debug.h b/sample/099_lua/appl/debug.h new file mode 100644 index 00000000..cad939e5 --- /dev/null +++ b/sample/099_lua/appl/debug.h @@ -0,0 +1,52 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + + +#ifndef __APPL_DEBUG_H__ +#define __APPL_DEBUG_H__ + +#include + +namespace appl { + int32_t getLogId(); +}; +// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" +#define APPL_BASE(info,data) \ + do { \ + if (info <= etk::log::getLevel(appl::getLogId())) { \ + std::stringbuf sb; \ + std::ostream tmpStream(&sb); \ + tmpStream << data; \ + etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ + } \ + } while(0) + +#define APPL_CRITICAL(data) APPL_BASE(1, data) +#define APPL_ERROR(data) APPL_BASE(2, data) +#define APPL_WARNING(data) APPL_BASE(3, data) +#ifdef DEBUG + #define APPL_INFO(data) APPL_BASE(4, data) + #define APPL_DEBUG(data) APPL_BASE(5, data) + #define APPL_VERBOSE(data) APPL_BASE(6, data) + #define APPL_TODO(data) APPL_BASE(4, "TODO : " << data) +#else + #define APPL_INFO(data) do { } while(false) + #define APPL_DEBUG(data) do { } while(false) + #define APPL_VERBOSE(data) do { } while(false) + #define APPL_TODO(data) do { } while(false) +#endif + +#define APPL_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + APPL_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) + +#endif diff --git a/sample/099_lua/lutin_099_lua.py b/sample/099_lua/lutin_099_lua.py new file mode 100755 index 00000000..3f09cc8a --- /dev/null +++ b/sample/099_lua/lutin_099_lua.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools + + +# optionnal : Describe in the "lutin.py --help" +def get_desc(): + return "Tutorial 099 : lua example" + +# Module creation instance (not optionnal) +def create(target): + # module name is '001_HelloWord' and type binary. + myModule = module.Module(__file__, '099_lua', 'BINARY') + # add the file to compile: + myModule.add_src_file([ + 'appl/Main.cpp', + 'appl/debug.cpp', + 'appl/Windows.cpp', + ]) + # add Library dependency name + myModule.add_module_depend(['ewolLua']) + # add application C flags + myModule.compile_flags_CC([ + "-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""]) + # Add current include Path + myModule.add_path(tools.get_current_path(__file__)) + # return the created module + return myModule + + + + diff --git a/sources/wrapper/ewolLua/debug.cpp b/sources/wrapper/ewolLua/debug.cpp new file mode 100644 index 00000000..ebaf0775 --- /dev/null +++ b/sources/wrapper/ewolLua/debug.cpp @@ -0,0 +1,14 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include "debug.h" + +int32_t ewolLua::getLogId() { + static int32_t g_val = etk::log::registerInstance("ewolLua"); + return g_val; +} diff --git a/sources/wrapper/ewolLua/debug.h b/sources/wrapper/ewolLua/debug.h new file mode 100644 index 00000000..8089685c --- /dev/null +++ b/sources/wrapper/ewolLua/debug.h @@ -0,0 +1,52 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_LUA_DEBUG_H__ +#define __EWOL_LUA_DEBUG_H__ + +#include + +namespace ewolLua { + int32_t getLogId(); +}; +// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" +#define EWOLLUA_BASE(info,data) \ + do { \ + if (info <= etk::log::getLevel(ewolLua::getLogId())) { \ + std::stringbuf sb; \ + std::ostream tmpStream(&sb); \ + tmpStream << data; \ + etk::log::logStream(ewolLua::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ + } \ + } while(0) + +#define EWOLLUA_CRITICAL(data) EWOLLUA_BASE(1, data) +#define EWOLLUA_ERROR(data) EWOLLUA_BASE(2, data) +#define EWOLLUA_WARNING(data) EWOLLUA_BASE(3, data) +#ifdef DEBUG + #define EWOLLUA_INFO(data) EWOLLUA_BASE(4, data) + #define EWOLLUA_DEBUG(data) EWOLLUA_BASE(5, data) + #define EWOLLUA_VERBOSE(data) EWOLLUA_BASE(6, data) + #define EWOLLUA_TODO(data) EWOLLUA_BASE(4, "TODO : " << data) +#else + #define EWOLLUA_INFO(data) do { } while(false) + #define EWOLLUA_DEBUG(data) do { } while(false) + #define EWOLLUA_VERBOSE(data) do { } while(false) + #define EWOLLUA_TODO(data) do { } while(false) +#endif + +#define EWOLLUA_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + EWOLLUA_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) + +#endif + diff --git a/sources/wrapper/ewolLua/ewolLua.cpp b/sources/wrapper/ewolLua/ewolLua.cpp new file mode 100644 index 00000000..79a7137c --- /dev/null +++ b/sources/wrapper/ewolLua/ewolLua.cpp @@ -0,0 +1,18 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include "ewolLua.h" +#include "object.h" +#include "objectManager.h" + + +int32_t ewolLua::loadEwolLuaWrapper(lua_State* _L) { + loadObject(_L); + loadObjectManager(_L); + return 0; +} diff --git a/sources/wrapper/ewolLua/ewolLua.h b/sources/wrapper/ewolLua/ewolLua.h new file mode 100644 index 00000000..50de9a0f --- /dev/null +++ b/sources/wrapper/ewolLua/ewolLua.h @@ -0,0 +1,20 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_LUA_H__ +#define __EWOL_LUA_H__ + +#include + +struct lua_State; +namespace ewolLua { + int32_t loadEwolLuaWrapper(lua_State* _L); +}; + +#endif + diff --git a/sources/wrapper/ewolLua/object.cpp b/sources/wrapper/ewolLua/object.cpp new file mode 100644 index 00000000..2e1fc3e8 --- /dev/null +++ b/sources/wrapper/ewolLua/object.cpp @@ -0,0 +1,35 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include "object.h" +#include "debug.h" + + +std::shared_ptr ewolObjectNew(lua_State *_L) { + const char* name = luaL_checkstring(_L, 1); + return ewol::Object::create(name); +} + +static luaL_Reg s_metatable[] = { + //{ "getIdFunc", luaU_get }, + //{ "NameFunc", luaU_getset }, + + { "getObjectType", luaU_func(&ewol::Object::getObjectType) }, + { "getTypeDescription", luaU_func(&ewol::Object::getTypeDescription) }, + { "isTypeCompatible", luaU_func(&ewol::Object::isTypeCompatible) }, + //{ "addObjectType", luaU_func(&ewol::Object::addObjectType) }, + { "getStatic", luaU_func(&ewol::Object::getStatic) }, + { NULL, NULL } +}; + +int32_t ewolLua::loadObject(lua_State* _L) { + luaW_register(_L, "ewol__Object", NULL, s_metatable, ewolObjectNew); + return 0; +} diff --git a/sources/wrapper/ewolLua/object.h b/sources/wrapper/ewolLua/object.h new file mode 100644 index 00000000..a47ffcbf --- /dev/null +++ b/sources/wrapper/ewolLua/object.h @@ -0,0 +1,20 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_LUA_OBJECT_H__ +#define __EWOL_LUA_OBJECT_H__ + +#include + +struct lua_State; +namespace ewolLua { + int32_t loadObject(lua_State* _L); +}; + +#endif + diff --git a/sources/wrapper/ewolLua/objectManager.cpp b/sources/wrapper/ewolLua/objectManager.cpp new file mode 100644 index 00000000..fcb478d1 --- /dev/null +++ b/sources/wrapper/ewolLua/objectManager.cpp @@ -0,0 +1,17 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include "objectManager.h" +#include "debug.h" + + + +int32_t ewolLua::loadObjectManager(lua_State* _L) { + + return 0; +} diff --git a/sources/wrapper/ewolLua/objectManager.h b/sources/wrapper/ewolLua/objectManager.h new file mode 100644 index 00000000..6331ae51 --- /dev/null +++ b/sources/wrapper/ewolLua/objectManager.h @@ -0,0 +1,20 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#ifndef __EWOL_LUA_OBJECT_MANAGER_H__ +#define __EWOL_LUA_OBJECT_MANAGER_H__ + +#include + +struct lua_State; +namespace ewolLua { + int32_t loadObjectManager(lua_State* _L); +}; + +#endif + diff --git a/sources/wrapper/lutin_ewolLua.py b/sources/wrapper/lutin_ewolLua.py new file mode 100644 index 00000000..39f3f241 --- /dev/null +++ b/sources/wrapper/lutin_ewolLua.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools +import os +import lutinMultiprocess + +def get_desc(): + return "ewol lua Wrapper" + +def get_license(): + return "APACHE v2.0" + +def create(target): + # module name is 'edn' and type binary. + myModule = module.Module(__file__, 'ewolLua', 'LIBRARY') + + # add extra compilation flags : + myModule.add_extra_compile_flags() + # add the file to compile: + myModule.add_src_file([ + 'ewolLua/object.cpp', + 'ewolLua/objectManager.cpp', + 'ewolLua/ewolLua.cpp', + 'ewolLua/debug.cpp', + ]) + + # name of the dependency + myModule.add_module_depend(['ewol', 'luaWrapper']) + myModule.add_export_path(tools.get_current_path(__file__)) + + # add the currrent module at the + return myModule + From df2fbc04b977c43892e8ace65dc9d1434e984cbb Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 6 Jan 2015 22:28:26 +0100 Subject: [PATCH 34/57] [DEV] add speex enc/dec and speex DSP and some change --- .gitmodules | 6 ++++++ external/ege | 2 +- external/etk | 2 +- external/speex | 1 + external/speexdsp | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) create mode 160000 external/speex create mode 160000 external/speexdsp diff --git a/.gitmodules b/.gitmodules index cdef5a74..9da71999 100644 --- a/.gitmodules +++ b/.gitmodules @@ -74,3 +74,9 @@ [submodule "external/luaWrapper"] path = external/luaWrapper url = https://github.com/HeeroYui/luaWrapper.git +[submodule "external/speex"] + path = external/speex + url = https://github.com/HeeroYui/speex.git +[submodule "external/speexdsp"] + path = external/speexdsp + url = https://github.com/HeeroYui/speexdsp.git diff --git a/external/ege b/external/ege index 673a7fba..1cc5144a 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 673a7fbade325a75a45aa574d33738498b74fa86 +Subproject commit 1cc5144acc846170090b8ef57185d9bf65f38d66 diff --git a/external/etk b/external/etk index a91136a0..cc807465 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit a91136a0d8b7e1976681c95a968a6614a0698984 +Subproject commit cc807465f88a272d6e61a3c41c5f4e7277c5ee2f diff --git a/external/speex b/external/speex new file mode 160000 index 00000000..b34a74f4 --- /dev/null +++ b/external/speex @@ -0,0 +1 @@ +Subproject commit b34a74f479cce409bbe12b08b45df34eba816cd9 diff --git a/external/speexdsp b/external/speexdsp new file mode 160000 index 00000000..347b49d1 --- /dev/null +++ b/external/speexdsp @@ -0,0 +1 @@ +Subproject commit 347b49d19cb11e73c07693df0b14c342dc4c0105 From 673ccb37269c12e97393f35b0a26b6bd4d616264 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 8 Jan 2015 22:38:34 +0100 Subject: [PATCH 35/57] [DEV] update context code style --- external/airtaudio | 2 +- external/eaudiofx | 2 +- external/ejson | 2 +- sources/ewol/context/Context.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/external/airtaudio b/external/airtaudio index e15bfbe1..00af426a 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit e15bfbe18e883fe3170a49a03732ad5dfe389fa8 +Subproject commit 00af426a47d45a8111e60f0e8e690411dcad861f diff --git a/external/eaudiofx b/external/eaudiofx index 428e8dfe..79042c57 160000 --- a/external/eaudiofx +++ b/external/eaudiofx @@ -1 +1 @@ -Subproject commit 428e8dfe393b5609e21b78267356e30a026cb0ad +Subproject commit 79042c57e5f3306f1dcd576d47f7890e39769faf diff --git a/external/ejson b/external/ejson index 226d9513..bcab8b07 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit 226d95135ccb49de2427a38256212b5020a090d1 +Subproject commit bcab8b07067cc15a81e14234d302dc945b5b2471 diff --git a/sources/ewol/context/Context.cpp b/sources/ewol/context/Context.cpp index 88dec9d3..775f1194 100644 --- a/sources/ewol/context/Context.cpp +++ b/sources/ewol/context/Context.cpp @@ -112,11 +112,11 @@ namespace ewol { // generic dimentions vec2 dimention; // keyboard events : - bool repeateKey; //!< special flag for the repeating key on the PC interface - bool stateIsDown; - char32_t keyboardChar; + bool repeateKey; //!< special flag for the repeating key on the PC interface + bool stateIsDown; + char32_t keyboardChar; enum ewol::key::keyboard keyboardMove; - ewol::key::Special keyboardSpecial; + ewol::key::Special keyboardSpecial; eSystemMessage() : TypeMessage(msgNone), From 832d73d4da21f80e9cb15099f09df0520ed679c9 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 12 Jan 2015 22:14:36 +0100 Subject: [PATCH 36/57] [DEV] update the ejson interface --- .travis.yml | 16 +++++++++------- external/eaudiofx | 2 +- external/ejson | 2 +- external/etk | 2 +- sources/ewol/resource/ColorFile.cpp | 4 ++-- sources/ewol/resource/ConfigFile.cpp | 15 ++++----------- sources/ewol/resource/ConfigFile.h | 2 +- sources/ewol/resource/DistanceFieldFont.cpp | 8 ++++---- 8 files changed, 23 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index f5c2cec4..c52e8ecc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ # language type: -language: cpp +language: +- cpp +- Objective-c # compilator system: compiler: @@ -27,16 +29,16 @@ install: # build sequence with Lutin : script: - - if [ "$CXX" == "clang++" ]; then ./build/lutin.py -C -P -cclang -mdebug -p ewol etktest exmltest ejsontest enettest; fi - - if [ "$CXX" == "g++" ]; then ./build/lutin.py -C -P -cgcc -mdebug -p ewol etktest exmltest ejsontest enettest; fi + - if [ "$CXX" == "clang++" ]; then ./build/lutin.py -C -P -cclang -mdebug -p ewol etk_test exmltest ejson_test enettest; fi + - if [ "$CXX" == "g++" ]; then ./build/lutin.py -C -P -cgcc -mdebug -p ewol etk_test exmltest ejson_test enettest; fi after_script: - - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/etktest/usr/bin/etktest; fi + - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/etktest/usr/bin/etk_test; fi - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/exmltest/usr/bin/exmltest; fi - - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/ejsontest/usr/bin/ejsontest; fi - - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/etktest/usr/bin/etktest; fi + - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/ejsontest/usr/bin/ejson_test; fi + - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/etktest/usr/bin/etk_test; fi - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/exmltest/usr/bin/exmltest; fi - - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/ejsontest/usr/bin/ejsontest; fi + - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/ejsontest/usr/bin/ejson_test; fi #send e-mail on compilation result: notifications: diff --git a/external/eaudiofx b/external/eaudiofx index 79042c57..5b858de8 160000 --- a/external/eaudiofx +++ b/external/eaudiofx @@ -1 +1 @@ -Subproject commit 79042c57e5f3306f1dcd576d47f7890e39769faf +Subproject commit 5b858de808d471ac09d8fae20f6abc7d3acbe671 diff --git a/external/ejson b/external/ejson index bcab8b07..b3b7d90b 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit bcab8b07067cc15a81e14234d302dc945b5b2471 +Subproject commit b3b7d90b418241bf05b32df14c9262d8a3f1ccf4 diff --git a/external/etk b/external/etk index cc807465..b00b7aa7 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit cc807465f88a272d6e61a3c41c5f4e7277c5ee2f +Subproject commit b00b7aa7b37eb7baf4eda50ad447b3ee1d6fe94f diff --git a/sources/ewol/resource/ColorFile.cpp b/sources/ewol/resource/ColorFile.cpp index 6ac817c2..750b8450 100644 --- a/sources/ewol/resource/ColorFile.cpp +++ b/sources/ewol/resource/ColorFile.cpp @@ -47,13 +47,13 @@ void ewol::resource::ColorFile::reload() { EWOL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); return; } - ejson::Array* baseArray = doc.getArray("color"); + std::shared_ptr baseArray = doc.getArray("color"); if (baseArray == nullptr) { EWOL_ERROR("Can not get basic array : 'color'"); return; } for (size_t iii = 0; iii < baseArray->size(); ++iii) { - ejson::Object* tmpObj = baseArray->getObject(iii); + std::shared_ptr tmpObj = baseArray->getObject(iii); if (tmpObj == nullptr) { EWOL_DEBUG(" can not get object in 'color' id=" << iii); continue; diff --git a/sources/ewol/resource/ConfigFile.cpp b/sources/ewol/resource/ConfigFile.cpp index 1593a43f..fdf32f2c 100644 --- a/sources/ewol/resource/ConfigFile.cpp +++ b/sources/ewol/resource/ConfigFile.cpp @@ -16,7 +16,7 @@ #include #undef __class__ -#define __class__ "resource::ConfigFile" +#define __class__ "resource::ConfigFile" ewol::resource::ConfigFile::ConfigFile() : @@ -32,13 +32,6 @@ void ewol::resource::ConfigFile::init(const std::string& _filename) { ewol::resource::ConfigFile::~ConfigFile() { - // remove all element - for (int32_t iii=0; iiitoNumber(); + std::shared_ptr tmp = m_list[_id]->toNumber(); if (tmp == nullptr) { return 0.0; } @@ -89,7 +82,7 @@ const std::string& ewol::resource::ConfigFile::getString(int32_t _id) { || m_list[_id] == nullptr) { return errorString; } - ejson::String* tmp = m_list[_id]->toString(); + std::shared_ptr tmp = m_list[_id]->toString(); if (tmp == nullptr) { return errorString; } @@ -101,7 +94,7 @@ bool ewol::resource::ConfigFile::getBoolean(int32_t _id) { || m_list[_id] == nullptr) { return false; } - ejson::Boolean* tmp = m_list[_id]->toBoolean(); + std::shared_ptr tmp = m_list[_id]->toBoolean(); if (tmp == nullptr) { return false; } diff --git a/sources/ewol/resource/ConfigFile.h b/sources/ewol/resource/ConfigFile.h index 1ae206b8..a0bcb048 100644 --- a/sources/ewol/resource/ConfigFile.h +++ b/sources/ewol/resource/ConfigFile.h @@ -20,7 +20,7 @@ namespace ewol { class ConfigFile : public ewol::Resource { private: ejson::Document m_doc; - etk::Hash m_list; + etk::Hash> m_list; protected: ConfigFile(); void init(const std::string& _filename); diff --git a/sources/ewol/resource/DistanceFieldFont.cpp b/sources/ewol/resource/DistanceFieldFont.cpp index 66914be4..5cae8478 100644 --- a/sources/ewol/resource/DistanceFieldFont.cpp +++ b/sources/ewol/resource/DistanceFieldFont.cpp @@ -342,13 +342,13 @@ ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const ch void ewol::resource::DistanceFieldFont::exportOnFile() { EWOL_DEBUG("EXPORT: DistanceFieldFont : file : '" << m_fileName << ".json'"); ejson::Document doc; - ejson::Array* tmpList = new ejson::Array(); + std::shared_ptr tmpList = ejson::Array::create(); if (tmpList == nullptr) { EWOL_ERROR("nullptr pointer"); return; } for (size_t iii=0; iii tmpObj = ejson::Object::create(); if (tmpObj == nullptr) { continue; } @@ -391,14 +391,14 @@ bool ewol::resource::DistanceFieldFont::importFromFile() { m_lastRawHeigh = doc.getNumberValue("m_lastRawHeigh", 0); m_borderSize = doc.getNumberValue("m_borderSize", 2); m_textureBorderSize = doc.addString("m_textureBorderSize", "0,0"); - ejson::Array* tmpList = doc.getArray("m_listElement"); + std::shared_ptr tmpList = doc.getArray("m_listElement"); if (tmpList == nullptr) { EWOL_ERROR("nullptr pointer array"); return false; } m_listElement.clear(); for (size_t iii=0; iiisize(); ++iii) { - ejson::Object* tmpObj = tmpList->getObject(iii); + std::shared_ptr tmpObj = tmpList->getObject(iii); if (tmpObj == nullptr) { continue; } From 6caf433936a32dbcb0faad18dc16fec31475af74 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 14 Jan 2015 21:10:23 +0100 Subject: [PATCH 37/57] [DEV] update new exml interface --- .travis.yml | 16 ++++++---------- external/ege | 2 +- external/ejson | 2 +- external/esvg | 2 +- external/exml | 2 +- sources/ewol/compositing/TextBase.cpp | 16 ++++++++-------- sources/ewol/compositing/TextBase.h | 2 +- sources/ewol/object/Object.cpp | 6 +++--- sources/ewol/object/Object.h | 4 ++-- sources/ewol/widget/Composer.cpp | 16 ++++++++-------- sources/ewol/widget/Container.cpp | 7 +++---- sources/ewol/widget/Container.h | 2 +- sources/ewol/widget/Container2.cpp | 12 ++++++------ sources/ewol/widget/Container2.h | 2 +- sources/ewol/widget/ContainerN.cpp | 10 +++++----- sources/ewol/widget/ContainerN.h | 2 +- sources/ewol/widget/Image.cpp | 16 ++++++++-------- sources/ewol/widget/Image.h | 2 +- sources/ewol/widget/Label.cpp | 4 ++-- sources/ewol/widget/Label.h | 2 +- sources/ewol/widget/Widget.cpp | 2 +- sources/ewol/widget/Widget.h | 2 +- 22 files changed, 63 insertions(+), 68 deletions(-) diff --git a/.travis.yml b/.travis.yml index c52e8ecc..030cea52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,10 +18,12 @@ branches: before_script: - git submodule init - git submodule update + - if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update -qq + - sudo apt-get install -qq libstdc++-4.9-dev - sudo apt-get install -qq g++-4.8 - sudo rm /usr/bin/gcc /usr/bin/g++ - sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc @@ -29,16 +31,10 @@ install: # build sequence with Lutin : script: - - if [ "$CXX" == "clang++" ]; then ./build/lutin.py -C -P -cclang -mdebug -p ewol etk_test exmltest ejson_test enettest; fi - - if [ "$CXX" == "g++" ]; then ./build/lutin.py -C -P -cgcc -mdebug -p ewol etk_test exmltest ejson_test enettest; fi - -after_script: - - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/etktest/usr/bin/etk_test; fi - - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/exmltest/usr/bin/exmltest; fi - - if [ "$CXX" == "clang++" ]; then ./out/Linux_x86_64/debug/staging/clang/ejsontest/usr/bin/ejson_test; fi - - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/etktest/usr/bin/etk_test; fi - - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/exmltest/usr/bin/exmltest; fi - - if [ "$CXX" == "g++" ]; then ./out/Linux_x86_64/debug/staging/gcc/ejsontest/usr/bin/ejson_test; fi + - ./build/lutin.py -C -P -c$BUILDER -mdebug -p ewol etk_test exml_test ejson_test enettest + - ./out/Linux_x86_64/debug/staging/$BUILDER/etk_test/usr/bin/etk_test + - ./out/Linux_x86_64/debug/staging/$BUILDER/ejson_test/usr/bin/ejson_test + - ./out/Linux_x86_64/debug/staging/$BUILDER/exml_test/usr/bin/exml_test #send e-mail on compilation result: notifications: diff --git a/external/ege b/external/ege index 1cc5144a..be7abd40 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit 1cc5144acc846170090b8ef57185d9bf65f38d66 +Subproject commit be7abd40a14ac37ca2afc8e8e14bc7f6f2ce7ba5 diff --git a/external/ejson b/external/ejson index b3b7d90b..dd2c3b15 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit b3b7d90b418241bf05b32df14c9262d8a3f1ccf4 +Subproject commit dd2c3b15e9def7818acc5ab42c43ba1d3f5569c1 diff --git a/external/esvg b/external/esvg index 738ee25f..d61f0b96 160000 --- a/external/esvg +++ b/external/esvg @@ -1 +1 @@ -Subproject commit 738ee25fb8016e9fd7a3d62ac28a85eb99b4f197 +Subproject commit d61f0b9607fa31a0a817c350889b7259f4d1d516 diff --git a/external/exml b/external/exml index 479921d3..c3b20ceb 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit 479921d3475fe3fd7a72bbd9e1772f70d284f774 +Subproject commit c3b20ceb8f78516bd29dd3fa02c4c5428e7e7a78 diff --git a/sources/ewol/compositing/TextBase.cpp b/sources/ewol/compositing/TextBase.cpp index ccd27d60..9977d3c8 100644 --- a/sources/ewol/compositing/TextBase.cpp +++ b/sources/ewol/compositing/TextBase.cpp @@ -245,7 +245,7 @@ void ewol::compositing::TextBase::print(const std::string& _text) { } -void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) { +void ewol::compositing::TextBase::parseHtmlNode(const std::shared_ptr& _element) { // get the static real pointer if (_element == nullptr) { EWOL_ERROR( "Error Input node does not existed ..."); @@ -254,15 +254,15 @@ void ewol::compositing::TextBase::parseHtmlNode(exml::Element* _element) { if (_element->getType(iii) == exml::typeComment) { // nothing to do ... } else if (_element->getType(iii) == exml::typeText) { - exml::Node* child = _element->getNode(iii); + std::shared_ptr child = _element->getNode(iii); htmlAddData(etk::to_u32string(child->getValue())); EWOL_VERBOSE("XML add : " << child->getValue()); continue; - } else if (_element->getType(iii)!=exml::typeElement) { + } else if (_element->getType(iii) != exml::typeElement) { EWOL_ERROR("(l "<< _element->getNode(iii)->getPos() << ") node not suported type : " << _element->getType(iii) << " val=\""<< _element->getNode(iii)->getValue() << "\"" ); continue; } - exml::Element* elem = _element->getElement(iii); + std::shared_ptr elem = _element->getElement(iii); if (elem == nullptr) { EWOL_ERROR("Cast error ..."); continue; @@ -373,13 +373,13 @@ void ewol::compositing::TextBase::printHTML(const std::string& _text) { return; } - exml::Element* root = (exml::Element*)doc.getNamed( "html" ); + std::shared_ptr root = doc.getNamed( "html" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"html\""); doc.display(); return; } - exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" ); + std::shared_ptr bodyNode = root->getNamed( "body" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"body\""); return; @@ -401,13 +401,13 @@ void ewol::compositing::TextBase::printHTML(const std::u32string& _text) { return; } - exml::Element* root = (exml::Element*)doc.getNamed( "html" ); + std::shared_ptr root = doc.getNamed( "html" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"html\""); doc.display(); return; } - exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" ); + std::shared_ptr bodyNode = root->getNamed( "body" ); if (root == nullptr) { EWOL_ERROR( "can not load XML: main node not find: \"body\""); return; diff --git a/sources/ewol/compositing/TextBase.h b/sources/ewol/compositing/TextBase.h index 698fc5e5..57a89c7a 100644 --- a/sources/ewol/compositing/TextBase.h +++ b/sources/ewol/compositing/TextBase.h @@ -357,7 +357,7 @@ namespace ewol { * @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include). * @param[in] _element the exml element. */ - void parseHtmlNode(exml::Element* _element); + void parseHtmlNode(const std::shared_ptr& _element); public: /** * @brief This generate the possibility to generate the big text property diff --git a/sources/ewol/object/Object.cpp b/sources/ewol/object/Object.cpp index 99f5e8bc..baa5bc16 100644 --- a/sources/ewol/object/Object.cpp +++ b/sources/ewol/object/Object.cpp @@ -108,8 +108,8 @@ bool ewol::Object::isTypeCompatible(const std::string& _type) { return false; } -bool ewol::Object::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::Object::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } bool errorOccured = false; @@ -126,7 +126,7 @@ bool ewol::Object::loadXML(exml::Element* _node) { return errorOccured; } -bool ewol::Object::storeXML(exml::Element* _node) const { +bool ewol::Object::storeXML(const std::shared_ptr& _node) const { if (nullptr == _node) { return false; } diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 2a0cebdf..549edadf 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -168,14 +168,14 @@ namespace ewol { * @return true : All has been done corectly. * @return false : An error occured. */ - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); /** * @brief store properties in this XML node. * @param[in,out] _node Pointer on the tinyXML node. * @return true : All has been done corectly. * @return false : An error occured. */ - virtual bool storeXML(exml::Element* _node) const; + virtual bool storeXML(const std::shared_ptr& _node) const; public: /** * @breif get the current Object manager. diff --git a/sources/ewol/widget/Composer.cpp b/sources/ewol/widget/Composer.cpp index ec41cc39..6747bc52 100644 --- a/sources/ewol/widget/Composer.cpp +++ b/sources/ewol/widget/Composer.cpp @@ -40,15 +40,15 @@ ewol::widget::Composer::~Composer() { } bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) { - exml::Document doc; - if (doc.load(_fileName) == false) { + std::shared_ptr doc = exml::Document::create(); + if (doc->load(_fileName) == false) { EWOL_ERROR(" can not load file XML : " << _fileName); return false; } - exml::Element* root = (exml::Element*)doc.getNamed("composer"); + std::shared_ptr root = doc->getNamed("composer"); if (root == nullptr) { // Maybe a multiple node XML for internal config: - root = doc.toElement(); + root = doc->toElement(); if (root == nullptr) { EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"composer\" ..."); return false; @@ -65,15 +65,15 @@ bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) { } bool ewol::widget::Composer::loadFromString(const std::string& _composerXmlString) { - exml::Document doc; - if (doc.parse(_composerXmlString) == false) { + std::shared_ptr doc = exml::Document::create(); + if (doc->parse(_composerXmlString) == false) { EWOL_ERROR(" can not load file XML string..."); return false; } - exml::Element* root = (exml::Element*)doc.getNamed("composer"); + std::shared_ptr root = doc->getNamed("composer"); if (root == nullptr) { // Maybe a multiple node XML for internal config: - root = doc.toElement(); + root = doc->toElement(); if (root == nullptr) { EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"composer\" ..."); return false; diff --git a/sources/ewol/widget/Container.cpp b/sources/ewol/widget/Container.cpp index 957c766c..68c22dde 100644 --- a/sources/ewol/widget/Container.cpp +++ b/sources/ewol/widget/Container.cpp @@ -143,18 +143,17 @@ std::shared_ptr ewol::widget::Container::getWidgetAtPos(const vec2 }; -bool ewol::widget::Container::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Container::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } // parse generic properties : ewol::Widget::loadXML(_node); // remove previous element : subWidgetRemove(); - // parse all the elements : for(size_t iii=0; iii< _node->size(); iii++) { - exml::Element* pNode = _node->getElement(iii); + std::shared_ptr pNode = _node->getElement(iii); if (pNode == nullptr) { // trash here all that is not element continue; diff --git a/sources/ewol/widget/Container.h b/sources/ewol/widget/Container.h index 90045a79..6b7a1564 100644 --- a/sources/ewol/widget/Container.h +++ b/sources/ewol/widget/Container.h @@ -59,7 +59,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr getSubObjectNamed(const std::string& _objectName); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); virtual void setOffset(const vec2& _newVal); virtual void requestDestroyFromChild(const std::shared_ptr& _child); }; diff --git a/sources/ewol/widget/Container2.cpp b/sources/ewol/widget/Container2.cpp index 36f27270..e6d8afc5 100644 --- a/sources/ewol/widget/Container2.cpp +++ b/sources/ewol/widget/Container2.cpp @@ -176,8 +176,8 @@ std::shared_ptr ewol::widget::Container2::getWidgetAtPos(const vec } */ -bool ewol::widget::Container2::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Container2::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } // parse generic properties : @@ -187,7 +187,7 @@ bool ewol::widget::Container2::loadXML(exml::Element* _node) { // parse all the elements : for(size_t iii=0; iii< _node->size(); iii++) { - exml::Element* pNode = _node->getElement(iii); + std::shared_ptr pNode = _node->getElement(iii); if (pNode == nullptr) { // trash here all that is not element continue; @@ -198,9 +198,9 @@ bool ewol::widget::Container2::loadXML(exml::Element* _node) { continue; } bool toogleMode=false; - if (nullptr != getSubWidget()) { + if (getSubWidget() != nullptr) { toogleMode=true; - if (nullptr != getSubWidgetToggle()) { + if (getSubWidgetToggle() != nullptr) { EWOL_ERROR("(l "<getPos()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" ); continue; } @@ -217,7 +217,7 @@ bool ewol::widget::Container2::loadXML(exml::Element* _node) { } else { setSubWidgetToggle(tmpWidget); } - if (false == tmpWidget->loadXML(pNode)) { + if (tmpWidget->loadXML(pNode) == false) { EWOL_ERROR ("(l "<getPos()<<") can not load widget properties : \"" << widgetName << "\""); return false; } diff --git a/sources/ewol/widget/Container2.h b/sources/ewol/widget/Container2.h index 4930d5d4..ff02ceab 100644 --- a/sources/ewol/widget/Container2.h +++ b/sources/ewol/widget/Container2.h @@ -162,7 +162,7 @@ namespace ewol { } //virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr getSubObjectNamed(const std::string& _objectName); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); virtual void setOffset(const vec2& _newVal); virtual void requestDestroyFromChild(const std::shared_ptr& _child); }; diff --git a/sources/ewol/widget/ContainerN.cpp b/sources/ewol/widget/ContainerN.cpp index ef1452d3..40854c89 100644 --- a/sources/ewol/widget/ContainerN.cpp +++ b/sources/ewol/widget/ContainerN.cpp @@ -238,8 +238,8 @@ std::shared_ptr ewol::widget::ContainerN::getWidgetAtPos(const vec }; -bool ewol::widget::ContainerN::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::ContainerN::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } // parse generic properties : @@ -258,7 +258,7 @@ bool ewol::widget::ContainerN::loadXML(exml::Element* _node) { } // parse all the elements : for (size_t iii=0; iii < _node->size(); iii++) { - exml::Element* pNode = _node->getElement(iii); + std::shared_ptr pNode = _node->getElement(iii); if (pNode == nullptr) { // trash here all that is not element continue; @@ -275,12 +275,12 @@ bool ewol::widget::ContainerN::loadXML(exml::Element* _node) { continue; } // add sub element : - if (false == invertAdding) { + if (invertAdding == false) { subWidgetAdd(subWidget); } else { subWidgetAddStart(subWidget); } - if (false == subWidget->loadXML(pNode)) { + if (subWidget->loadXML(pNode) == false) { EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<getPos()<<") can not load widget properties : \"" << widgetName << "\""); return false; } diff --git a/sources/ewol/widget/ContainerN.h b/sources/ewol/widget/ContainerN.h index 2a7e6845..916d1b65 100644 --- a/sources/ewol/widget/ContainerN.h +++ b/sources/ewol/widget/ContainerN.h @@ -95,7 +95,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual std::shared_ptr getWidgetAtPos(const vec2& _pos); virtual std::shared_ptr getSubObjectNamed(const std::string& _objectName); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); virtual void setOffset(const vec2& _newVal); virtual void requestDestroyFromChild(const std::shared_ptr& _child); }; diff --git a/sources/ewol/widget/Image.cpp b/sources/ewol/widget/Image.cpp index 5e2e0bfc..9fa8a37d 100644 --- a/sources/ewol/widget/Image.cpp +++ b/sources/ewol/widget/Image.cpp @@ -131,7 +131,7 @@ void ewol::widget::Image::calculateMinMaxSize() { bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) { //EWOL_DEBUG("Event on BT ..."); - if (1 == _event.getId()) { + if (_event.getId() == 1) { if(ewol::key::statusSingle == _event.getStatus()) { signalPressed.emit(); return true; @@ -140,15 +140,15 @@ bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) { return false; } -bool ewol::widget::Image::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Image::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } ewol::Widget::loadXML(_node); // get internal data : std::string tmpAttributeValue = _node->getAttribute("ratio"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { if (etk::compare_no_case(tmpAttributeValue, "true") == true) { m_keepRatio = true; } else if (tmpAttributeValue == "1") { @@ -158,21 +158,21 @@ bool ewol::widget::Image::loadXML(exml::Element* _node) { } } tmpAttributeValue = _node->getAttribute("size"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { //EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue); m_imageSize = tmpAttributeValue; //EWOL_CRITICAL(" == > " << m_imageSize); } tmpAttributeValue = _node->getAttribute("border"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { m_border = tmpAttributeValue; } //EWOL_DEBUG("Load label:" << node->ToElement()->getText()); - if (_node->size()!=0) { + if (_node->size() != 0) { setFile(_node->getText()); } else { tmpAttributeValue = _node->getAttribute("src"); - if (tmpAttributeValue.size()!=0) { + if (tmpAttributeValue.size() != 0) { setFile(tmpAttributeValue); } } diff --git a/sources/ewol/widget/Image.h b/sources/ewol/widget/Image.h index 1fef548a..bede5c6d 100644 --- a/sources/ewol/widget/Image.h +++ b/sources/ewol/widget/Image.h @@ -166,7 +166,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); }; }; }; diff --git a/sources/ewol/widget/Label.cpp b/sources/ewol/widget/Label.cpp index 4c654a4f..c118c78c 100644 --- a/sources/ewol/widget/Label.cpp +++ b/sources/ewol/widget/Label.cpp @@ -131,8 +131,8 @@ bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) { return false; } -bool ewol::widget::Label::loadXML(exml::Element* _node) { - if (nullptr == _node) { +bool ewol::widget::Label::loadXML(const std::shared_ptr& _node) { + if (_node == nullptr) { return false; } ewol::Widget::loadXML(_node); diff --git a/sources/ewol/widget/Label.h b/sources/ewol/widget/Label.h index 432537d1..90013347 100644 --- a/sources/ewol/widget/Label.h +++ b/sources/ewol/widget/Label.h @@ -74,7 +74,7 @@ namespace ewol { virtual void calculateMinMaxSize(); virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); }; }; }; diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 2fe3cff2..af2ef2ec 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -591,7 +591,7 @@ enum ewol::context::cursorDisplay ewol::Widget::getCursor() { return m_cursorDisplay; } -bool ewol::Widget::loadXML(exml::Element* _node) { +bool ewol::Widget::loadXML(const std::shared_ptr& _node) { ewol::Object::loadXML(_node); markToRedraw(); return true; diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index 44e900d9..4fdb79aa 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -663,7 +663,7 @@ namespace ewol { */ virtual enum ewol::context::cursorDisplay getCursor(); public: // Derived function - virtual bool loadXML(exml::Element* _node); + virtual bool loadXML(const std::shared_ptr& _node); protected: // Derived function virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer); public: From 8a2211e5f65aa2d460db77fb1ca51de1fdbb0959 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 5 Feb 2015 22:23:15 +0100 Subject: [PATCH 38/57] [DEV] add subLibrary and update others --- .gitmodules | 9 +++++++++ build | 2 +- external/airtaudio | 2 +- external/audio | 1 + external/drain | 1 + external/eaudiofx | 2 +- external/ejson | 2 +- external/river | 1 + 8 files changed, 16 insertions(+), 4 deletions(-) create mode 160000 external/audio create mode 160000 external/drain create mode 160000 external/river diff --git a/.gitmodules b/.gitmodules index 9da71999..ff597ba8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -80,3 +80,12 @@ [submodule "external/speexdsp"] path = external/speexdsp url = https://github.com/HeeroYui/speexdsp.git +[submodule "external/audio"] + path = external/audio + url = https://github.com/HeeroYui/audio.git +[submodule "external/drain"] + path = external/drain + url = https://github.com/HeeroYui/drain.git +[submodule "external/river"] + path = external/river + url = https://github.com/HeeroYui/river.git diff --git a/build b/build index 2a58657d..134e0b52 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 2a58657df50abe5e69161e68c703cd9674c87a70 +Subproject commit 134e0b523e2ce75ab0007d509fed406d328b5b91 diff --git a/external/airtaudio b/external/airtaudio index 00af426a..6de9bac0 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 00af426a47d45a8111e60f0e8e690411dcad861f +Subproject commit 6de9bac0fc13222b1a0f1e23f6915f941161bef5 diff --git a/external/audio b/external/audio new file mode 160000 index 00000000..7f7a04f6 --- /dev/null +++ b/external/audio @@ -0,0 +1 @@ +Subproject commit 7f7a04f6365346746697735ccd0cc7d113f6f096 diff --git a/external/drain b/external/drain new file mode 160000 index 00000000..f2c587fe --- /dev/null +++ b/external/drain @@ -0,0 +1 @@ +Subproject commit f2c587fe8c54c31482974e9a675c4764ec945800 diff --git a/external/eaudiofx b/external/eaudiofx index 5b858de8..8cd0fe0b 160000 --- a/external/eaudiofx +++ b/external/eaudiofx @@ -1 +1 @@ -Subproject commit 5b858de808d471ac09d8fae20f6abc7d3acbe671 +Subproject commit 8cd0fe0b88e8a8838b30d2b5342e105aee842d51 diff --git a/external/ejson b/external/ejson index dd2c3b15..1028c4aa 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit dd2c3b15e9def7818acc5ab42c43ba1d3f5569c1 +Subproject commit 1028c4aad42319b1e2cb0a7a4a7512fcba6383bf diff --git a/external/river b/external/river new file mode 160000 index 00000000..c6aa75e0 --- /dev/null +++ b/external/river @@ -0,0 +1 @@ +Subproject commit c6aa75e02bf65b1473bc352e9c10843539f488bb From 8addc1a84e3cce8568f457544ffad445444d23d5 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 5 Feb 2015 23:34:39 +0100 Subject: [PATCH 39/57] [DEV] update new LOW level audio config for andoid --- external/airtaudio | 2 +- external/audio | 2 +- external/river | 2 +- sources/android/src/org/ewol/EwolActivity.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/external/airtaudio b/external/airtaudio index 6de9bac0..36298865 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 6de9bac0fc13222b1a0f1e23f6915f941161bef5 +Subproject commit 36298865902038e123352f49c66ee5587ac9c17b diff --git a/external/audio b/external/audio index 7f7a04f6..fe61e980 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit 7f7a04f6365346746697735ccd0cc7d113f6f096 +Subproject commit fe61e98059731704f4e06c7f5cf990917baa23d8 diff --git a/external/river b/external/river index c6aa75e0..bdb1102e 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit c6aa75e02bf65b1473bc352e9c10843539f488bb +Subproject commit bdb1102efa6ecc43ef12fc4050bd9d7ea7a874fb diff --git a/sources/android/src/org/ewol/EwolActivity.java b/sources/android/src/org/ewol/EwolActivity.java index ff0654a2..93651208 100644 --- a/sources/android/src/org/ewol/EwolActivity.java +++ b/sources/android/src/org/ewol/EwolActivity.java @@ -344,7 +344,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo public String audioGetDeviceProperty(int idDevice) { if (idDevice == 0) { - return "speaker:out:8000,16000,24000,32000,48000,96000:2:s16"; + return "speaker:out:8000,16000,24000,32000,48000,96000:2:int16"; } else { return "::::"; } From 8add5d9f1b3567e4c3cdb796ba10965442d3c550 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 7 Feb 2015 00:08:03 +0100 Subject: [PATCH 40/57] [DEV] update new sub libs --- build | 2 +- external/airtaudio | 2 +- external/river | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build b/build index 134e0b52..1ec26df8 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 134e0b523e2ce75ab0007d509fed406d328b5b91 +Subproject commit 1ec26df856d66a12aba603b57ac4fb40e5a2dac4 diff --git a/external/airtaudio b/external/airtaudio index 36298865..028279a7 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 36298865902038e123352f49c66ee5587ac9c17b +Subproject commit 028279a74f055d4dc9eeb351232d8bf494b88749 diff --git a/external/river b/external/river index bdb1102e..8ee3cc75 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit bdb1102efa6ecc43ef12fc4050bd9d7ea7a874fb +Subproject commit 8ee3cc75442f28d0c5e538b42af80a98bd0d41db From 865851578df9d14778002dd1fad783840a03c822 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 12 Feb 2015 23:23:32 +0100 Subject: [PATCH 41/57] [DEV] update sub libs --- build | 2 +- external/airtaudio | 2 +- external/audio | 2 +- external/drain | 2 +- external/etk | 2 +- external/ewolsa | 2 +- external/river | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build b/build index 1ec26df8..03e67ae8 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 1ec26df856d66a12aba603b57ac4fb40e5a2dac4 +Subproject commit 03e67ae8d6ab62536437c246548d047bbd2565a4 diff --git a/external/airtaudio b/external/airtaudio index 028279a7..650f24c2 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 028279a74f055d4dc9eeb351232d8bf494b88749 +Subproject commit 650f24c288d08db41ff8d4e4c2c64ccec7cde674 diff --git a/external/audio b/external/audio index fe61e980..2583e527 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit fe61e98059731704f4e06c7f5cf990917baa23d8 +Subproject commit 2583e527f161118f023dd1e9e8b591578e0430f2 diff --git a/external/drain b/external/drain index f2c587fe..adfb75d2 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit f2c587fe8c54c31482974e9a675c4764ec945800 +Subproject commit adfb75d258ef9927eacc7a580091e2fc760161d3 diff --git a/external/etk b/external/etk index b00b7aa7..b2288645 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit b00b7aa7b37eb7baf4eda50ad447b3ee1d6fe94f +Subproject commit b228864567c8102518a806b4dab6851748c78c6b diff --git a/external/ewolsa b/external/ewolsa index 8d9aef83..af355c40 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit 8d9aef8384ced7fc4a9b2761bf1966b4bdf5e231 +Subproject commit af355c40510498c052e9fab8b5f2ea134e752235 diff --git a/external/river b/external/river index 8ee3cc75..4879bd00 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit 8ee3cc75442f28d0c5e538b42af80a98bd0d41db +Subproject commit 4879bd00fb928ecd084d7fb26a289895d52bd214 From 15c176485415b136d9d034a758cce482e9a1d80f Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 13 Feb 2015 22:25:55 +0100 Subject: [PATCH 42/57] [DEV] change basic thread name --- external/airtaudio | 2 +- external/drain | 2 +- external/etk | 2 +- external/ewolsa | 2 +- external/river | 2 +- sources/ewol/context/Context.cpp | 2 ++ 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/external/airtaudio b/external/airtaudio index 650f24c2..d9453e6e 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 650f24c288d08db41ff8d4e4c2c64ccec7cde674 +Subproject commit d9453e6e7a880730115163a6af7238e4664774d1 diff --git a/external/drain b/external/drain index adfb75d2..c667f6c3 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit adfb75d258ef9927eacc7a580091e2fc760161d3 +Subproject commit c667f6c327000edafc7725089833055ef0f41902 diff --git a/external/etk b/external/etk index b2288645..44dd675e 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit b228864567c8102518a806b4dab6851748c78c6b +Subproject commit 44dd675eb8c2b2a635f3bd691b015b792b1be8bd diff --git a/external/ewolsa b/external/ewolsa index af355c40..23467923 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit af355c40510498c052e9fab8b5f2ea134e752235 +Subproject commit 23467923b4917aa7db24f262b3129ac5f58803c5 diff --git a/external/river b/external/river index 4879bd00..bc37e70e 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit 4879bd00fb928ecd084d7fb26a289895d52bd214 +Subproject commit bc37e70e1e56da2febaa9e58af1dda60f82eb134 diff --git a/sources/ewol/context/Context.cpp b/sources/ewol/context/Context.cpp index 775f1194..cd2c44e2 100644 --- a/sources/ewol/context/Context.cpp +++ b/sources/ewol/context/Context.cpp @@ -305,6 +305,8 @@ ewol::Context::Context(ewol::context::Application* _application, int32_t _argc, m_windowsCurrent(nullptr), m_windowsSize(320,480), m_initStepId(0) { + // set a basic + etk::log::setThreadName("ewol"); if (m_application == nullptr) { EWOL_CRITICAL("Can not start context with no Application ==> rtfm ..."); } From 7e2cae472ee7774c69e4ad0000bdb31dd3ef5036 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 15 Feb 2015 21:52:20 +0100 Subject: [PATCH 43/57] [DEV] set it work on MacOs & IOs again --- build | 2 +- external/etk | 2 +- external/ewolsa | 2 +- sources/ewol/context/IOs/Context.cpp | 12 +++++++----- sources/ewol/context/IOs/Interface.m | 6 ++++-- sources/ewol/context/IOs/OpenglView.h | 8 ++++---- sources/ewol/context/MacOs/Interface.h | 2 +- sources/ewol/context/MacOs/Interface.mm | 2 +- sources/ewol/context/MacOs/Windows.h | 2 +- sources/ewol/context/MacOs/Windows.mm | 2 +- sources/ewol/openGL/openGL.h | 12 +++++++++--- 11 files changed, 31 insertions(+), 21 deletions(-) diff --git a/build b/build index 03e67ae8..512651e7 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 03e67ae8d6ab62536437c246548d047bbd2565a4 +Subproject commit 512651e746dfe3318308ffae94aeca731078baff diff --git a/external/etk b/external/etk index 44dd675e..e6a829fd 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 44dd675eb8c2b2a635f3bd691b015b792b1be8bd +Subproject commit e6a829fd2aff0f55022c92192a95a35ff8993be1 diff --git a/external/ewolsa b/external/ewolsa index 23467923..af355c40 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit 23467923b4917aa7db24f262b3129ac5f58803c5 +Subproject commit af355c40510498c052e9fab8b5f2ea134e752235 diff --git a/sources/ewol/context/IOs/Context.cpp b/sources/ewol/context/IOs/Context.cpp index 60eb2702..f5eaaa02 100644 --- a/sources/ewol/context/IOs/Context.cpp +++ b/sources/ewol/context/IOs/Context.cpp @@ -232,6 +232,7 @@ void IOs::foreground() { static int l_argc = 0; static const char **l_argv = nullptr; +static ewol::context::Application* l_application; /** * @brief Main of the program * @param std IO @@ -240,14 +241,16 @@ static const char **l_argv = nullptr; int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { l_argc = _argc; l_argv = _argv; - return mm_main(_application, _argc, _argv); + l_application = _application; + return mm_main(_argc, _argv); } // Creat and relaese ewol::Context interface: void IOs::createInterface() { etk::setArgZero(l_argv[0]); EWOL_INFO("Create new interface"); - interface = new MacOSInterface(l_argc, l_argv); + interface = new MacOSInterface(l_application, l_argc, l_argv); + l_application = nullptr; if (nullptr == interface) { EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); return; @@ -255,10 +258,9 @@ void IOs::createInterface() { } void IOs::releaseInterface() { - if (interface == nullptr) { - return; + if (interface != nullptr) { + EWOL_INFO("Remove interface"); } - EWOL_INFO("Remove interface"); delete(interface); interface = nullptr; } diff --git a/sources/ewol/context/IOs/Interface.m b/sources/ewol/context/IOs/Interface.m index 0e3a9226..681e44c1 100644 --- a/sources/ewol/context/IOs/Interface.m +++ b/sources/ewol/context/IOs/Interface.m @@ -15,7 +15,8 @@ int mm_main(int argc, const char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, (char**)argv, nil, NSStringFromClass([AppDelegate class])); - } // return no error + } + // return no error return 0; } @@ -24,6 +25,7 @@ void mm_exit(void) { } void mm_openURL(const char *_url) { - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:_url]]; + NSString* url = [[NSString alloc] initWithUTF8String:_url]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; } diff --git a/sources/ewol/context/IOs/OpenglView.h b/sources/ewol/context/IOs/OpenglView.h index da41a096..2cf99c46 100644 --- a/sources/ewol/context/IOs/OpenglView.h +++ b/sources/ewol/context/IOs/OpenglView.h @@ -34,8 +34,8 @@ int deltaDisplay; int displayCounter; } -- ()stopDisplayLink; -- ()startDisplayLink; -- ()speedSlow; -- ()speedNormal; +- (void)stopDisplayLink; +- (void)startDisplayLink; +- (void)speedSlow; +- (void)speedNormal; @end diff --git a/sources/ewol/context/MacOs/Interface.h b/sources/ewol/context/MacOs/Interface.h index d3bb38e8..3a412b21 100644 --- a/sources/ewol/context/MacOs/Interface.h +++ b/sources/ewol/context/MacOs/Interface.h @@ -14,7 +14,7 @@ extern "C" { #endif int mm_main(int argc, const char *argv[]); -int mm_run(); +int mm_run(void); #ifdef __cplusplus } diff --git a/sources/ewol/context/MacOs/Interface.mm b/sources/ewol/context/MacOs/Interface.mm index 30af278a..5f0e855d 100644 --- a/sources/ewol/context/MacOs/Interface.mm +++ b/sources/ewol/context/MacOs/Interface.mm @@ -84,7 +84,7 @@ int mm_main(int argc, const char *argv[]) { //[window addChildWindow:view]; //[window makeKeyAndVisible]; - [window setDelegate:view]; + //[window setDelegate:view]; #else @autoreleasepool { diff --git a/sources/ewol/context/MacOs/Windows.h b/sources/ewol/context/MacOs/Windows.h index 63881597..43f9340f 100644 --- a/sources/ewol/context/MacOs/Windows.h +++ b/sources/ewol/context/MacOs/Windows.h @@ -13,7 +13,7 @@ } + (id)alloc; - (id)init; -+ ()dealloc; ++ (void)dealloc; @end diff --git a/sources/ewol/context/MacOs/Windows.mm b/sources/ewol/context/MacOs/Windows.mm index 50939ec1..0fb8a7a5 100644 --- a/sources/ewol/context/MacOs/Windows.mm +++ b/sources/ewol/context/MacOs/Windows.mm @@ -60,7 +60,7 @@ //[window addChildWindow:view]; //[window makeKeyAndVisible]; - [windowsID setDelegate:view]; + //[windowsID setDelegate:view]; EWOL_DEBUG("ALLOCATE ..."); return windowsID; } diff --git a/sources/ewol/openGL/openGL.h b/sources/ewol/openGL/openGL.h index 48e73ad2..5a880fd1 100644 --- a/sources/ewol/openGL/openGL.h +++ b/sources/ewol/openGL/openGL.h @@ -149,9 +149,15 @@ namespace ewol { renderTriangle = GL_TRIANGLES, renderTriangleStrip = GL_TRIANGLE_STRIP, //!< Not supported in EWOL (TODO : Later) renderTriangleFan = GL_TRIANGLE_FAN, //!< Not supported in EWOL (TODO : Later) - renderQuad = GL_QUADS, //!< Not supported in OpenGL-ES2 - renderQuadStrip = GL_QUAD_STRIP, //!< Not supported in OpenGL-ES2 - renderPolygon = GL_POLYGON //!< Not supported in OpenGL-ES2 + #if (!defined(__TARGET_OS__IOs) && !defined(__TARGET_OS__Android)) + renderQuad = GL_QUADS, //!< Not supported in OpenGL-ES2 + renderQuadStrip = GL_QUAD_STRIP, //!< Not supported in OpenGL-ES2 + renderPolygon = GL_POLYGON //!< Not supported in OpenGL-ES2 + #else + renderQuad, //!< Not supported in OpenGL-ES2 + renderQuadStrip, //!< Not supported in OpenGL-ES2 + renderPolygon //!< Not supported in OpenGL-ES2 + #endif }; /** From af24b335ac43b7e7034c161eda236a385b5dc4ec Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 16 Feb 2015 21:40:51 +0100 Subject: [PATCH 44/57] [DEBUG] correct android build --- build | 2 +- external/ewolsa | 2 +- sources/ewol/context/Android/Context.cpp | 4 ++-- sources/lutin_ewol.py | 15 +++++++++------ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/build b/build index 512651e7..95b2206d 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 512651e746dfe3318308ffae94aeca731078baff +Subproject commit 95b2206da682ad56fdcece7c7789f30a32a0c134 diff --git a/external/ewolsa b/external/ewolsa index af355c40..23467923 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit af355c40510498c052e9fab8b5f2ea134e752235 +Subproject commit 23467923b4917aa7db24f262b3129ac5f58803c5 diff --git a/sources/ewol/context/Android/Context.cpp b/sources/ewol/context/Android/Context.cpp index 4f5c2225..c105078a 100644 --- a/sources/ewol/context/Android/Context.cpp +++ b/sources/ewol/context/Android/Context.cpp @@ -647,7 +647,7 @@ extern "C" { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved) { // get the java virtual machine handle ... std::unique_lock lock(g_interfaceMutex); - std::unique_lock lock(g_interfaceAudioMutex); + std::unique_lock lockAudio(g_interfaceAudioMutex); g_JavaVM = _jvm; EWOL_DEBUG("JNI-> load the jvm ..." ); return JNI_VERSION_1_6; @@ -655,7 +655,7 @@ extern "C" { // JNI onUnLoad JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved) { std::unique_lock lock(g_interfaceMutex); - std::unique_lock lock(g_interfaceAudioMutex); + std::unique_lock lockAudio(g_interfaceAudioMutex); g_JavaVM = nullptr; EWOL_DEBUG("JNI-> Un-load the jvm ..." ); } diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 3ebba77a..2c7dafd8 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -1,6 +1,7 @@ #!/usr/bin/python import lutinModule as module import lutinTools as tools +import lutinDebug as debug import os import lutinMultiprocess @@ -217,12 +218,15 @@ def create(target): myModule.add_export_flag_LD("-ldl") myModule.add_export_flag_LD("-llog") myModule.add_export_flag_LD("-landroid") - java_tmp_dir = tools.get_current_path(__file__) + "/../../ewol/sources/android/src/" + java_tmp_dir = tools.get_current_path(__file__) + "/../sources/android/src/" cpp_tmp_dir = tools.get_current_path(__file__) + "/ewol/renderer/Android/" java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants" - lutinMultiprocess.run_command("javac " + java_tmp_src + ".java") - lutinMultiprocess.run_command("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants") - tools.copy_file(java_tmp_dir + "org_ewol_EwolConstants.h", cpp_tmp_dir + "org_ewol_EwolConstants.h", force=True) + # TODO : set the build directory in out/.build with option -d ... + debugCommand = "" + if debug.get_level() >= 4: + debugCommand = " -verbose " + lutinMultiprocess.run_command("javac " + debugCommand + java_tmp_src + ".java") + lutinMultiprocess.run_command("javah " + debugCommand + "-classpath " + java_tmp_dir + " -d " + cpp_tmp_dir + " org.ewol.EwolConstants") tools.remove_file(java_tmp_src + ".class") elif target.name=="Windows": myModule.add_module_depend("glew") @@ -240,7 +244,6 @@ def create(target): "-framework GLKit", "-framework Foundation", "-framework QuartzCore"]) - - # add the currrent module at the + return myModule From ef1eb80553223bd8131d6f63e4aa2abcbcdae01a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 17 Feb 2015 22:04:40 +0100 Subject: [PATCH 45/57] [TRAVIS] update g++ version --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 030cea52..7d1dbc82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,10 +24,10 @@ install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update -qq - sudo apt-get install -qq libstdc++-4.9-dev - - sudo apt-get install -qq g++-4.8 + - sudo apt-get install -qq g++-4.9 - sudo rm /usr/bin/gcc /usr/bin/g++ - - sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc - - sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++ + - sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc + - sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++ # build sequence with Lutin : script: From 032c9a5e9191ce55a5c41b5470370923de79b4f2 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 26 Feb 2015 21:44:16 +0100 Subject: [PATCH 46/57] [DEV] add C compilation of the Z interface on C99 --- build | 2 +- external/airtaudio | 2 +- external/audio | 2 +- external/drain | 2 +- external/ejson | 2 +- external/etk | 2 +- external/exml | 2 +- external/river | 2 +- external/z/lutin_minizip.py | 2 ++ external/z/lutin_z.py | 1 + 10 files changed, 11 insertions(+), 8 deletions(-) diff --git a/build b/build index 95b2206d..b0d300e3 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 95b2206da682ad56fdcece7c7789f30a32a0c134 +Subproject commit b0d300e3ff6326be56e79247335510549ef77eb4 diff --git a/external/airtaudio b/external/airtaudio index d9453e6e..4b30ecbf 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit d9453e6e7a880730115163a6af7238e4664774d1 +Subproject commit 4b30ecbfff50b5a7736a18a38cb465304969e6d0 diff --git a/external/audio b/external/audio index 2583e527..63b327cb 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit 2583e527f161118f023dd1e9e8b591578e0430f2 +Subproject commit 63b327cb6726c5f4f17dec6fbd1b927884c6ecb2 diff --git a/external/drain b/external/drain index c667f6c3..b401602e 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit c667f6c327000edafc7725089833055ef0f41902 +Subproject commit b401602ea454be43ca6a145d50b125b000062be6 diff --git a/external/ejson b/external/ejson index 1028c4aa..be1eeda5 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit 1028c4aad42319b1e2cb0a7a4a7512fcba6383bf +Subproject commit be1eeda5566b1ed60ef9a0e4a27e12e8762e4a18 diff --git a/external/etk b/external/etk index e6a829fd..a9aa042e 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit e6a829fd2aff0f55022c92192a95a35ff8993be1 +Subproject commit a9aa042ecd948d97c00b48dd03dc5d25c3c42f3d diff --git a/external/exml b/external/exml index c3b20ceb..a9ed10a8 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit c3b20ceb8f78516bd29dd3fa02c4c5428e7e7a78 +Subproject commit a9ed10a8f08ffd0e84decc70e8e16861b4dd76c4 diff --git a/external/river b/external/river index bc37e70e..ec75a597 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit bc37e70e1e56da2febaa9e58af1dda60f82eb134 +Subproject commit ec75a597207f8d1fa2d7be6beda56a9bffa2a5eb diff --git a/external/z/lutin_minizip.py b/external/z/lutin_minizip.py index 7ac96df8..c5df6729 100644 --- a/external/z/lutin_minizip.py +++ b/external/z/lutin_minizip.py @@ -18,6 +18,8 @@ def create(target): myModule.add_module_depend('z') + myModule.compile_version_CC(1999) + myModule.compile_flags_CC([ "-DNOCRYPT", "-DIOAPI_NO_64"]) diff --git a/external/z/lutin_z.py b/external/z/lutin_z.py index 0ab9d077..edcedd58 100644 --- a/external/z/lutin_z.py +++ b/external/z/lutin_z.py @@ -29,6 +29,7 @@ def create(target): myModule.add_export_path(tools.get_current_path(__file__)) myModule.add_export_path(tools.get_current_path(__file__) + "/zlib") + myModule.compile_flags_CC([ "-D_LARGEFILE64_SOURCE=1", "-DHAVE_HIDDEN"]) From b94e674a8fa7f68859538eb09009149a17c383f5 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 11 Mar 2015 21:26:07 +0100 Subject: [PATCH 47/57] [DEBUG] edtaa3 build error --- build | 2 +- external/airtaudio | 2 +- external/audio | 2 +- external/drain | 2 +- external/edtaa3/lutin_edtaa3.py | 2 ++ external/etk | 2 +- external/river | 2 +- external/speexdsp | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build b/build index b0d300e3..35d514e9 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit b0d300e3ff6326be56e79247335510549ef77eb4 +Subproject commit 35d514e9a928685798584e09ecbda3fc2a519eea diff --git a/external/airtaudio b/external/airtaudio index 4b30ecbf..36e5f26c 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 4b30ecbfff50b5a7736a18a38cb465304969e6d0 +Subproject commit 36e5f26cb43db3ab1da60662a0aff8b335f4bd72 diff --git a/external/audio b/external/audio index 63b327cb..d1cf2151 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit 63b327cb6726c5f4f17dec6fbd1b927884c6ecb2 +Subproject commit d1cf21511325622116c42188ef3b2e1e203d6b2d diff --git a/external/drain b/external/drain index b401602e..c209a900 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit b401602ea454be43ca6a145d50b125b000062be6 +Subproject commit c209a900cf83138abc8a09fd1bfd3a7b0505ed05 diff --git a/external/edtaa3/lutin_edtaa3.py b/external/edtaa3/lutin_edtaa3.py index b0bb0a2a..f9e20d98 100644 --- a/external/edtaa3/lutin_edtaa3.py +++ b/external/edtaa3/lutin_edtaa3.py @@ -15,6 +15,8 @@ def create(target): 'edtaa3/edtaa3func.c' ]) + myModule.compile_version_CC(1999) + myModule.add_export_path(tools.get_current_path(__file__)) # add the currrent module at the diff --git a/external/etk b/external/etk index a9aa042e..9ccf8eea 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit a9aa042ecd948d97c00b48dd03dc5d25c3c42f3d +Subproject commit 9ccf8eea8314a7f35f0da54b64529abf4272beec diff --git a/external/river b/external/river index ec75a597..893cf1d5 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit ec75a597207f8d1fa2d7be6beda56a9bffa2a5eb +Subproject commit 893cf1d5c02b54cd33063e914b78db8d19a893f0 diff --git a/external/speexdsp b/external/speexdsp index 347b49d1..06d4e5f1 160000 --- a/external/speexdsp +++ b/external/speexdsp @@ -1 +1 @@ -Subproject commit 347b49d19cb11e73c07693df0b14c342dc4c0105 +Subproject commit 06d4e5f1afaaed841ec37728217a87b92fec8bae From cdcfc201d4f8b5a5131240e005873f450247aa19 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 20 Mar 2015 22:18:52 +0100 Subject: [PATCH 48/57] [DEV] update libs and tools for thread --- external/airtaudio | 2 +- external/audio | 2 +- external/drain | 2 +- external/ejson | 2 +- external/etk | 2 +- external/river | 2 +- sources/ewol/context/Context.cpp | 3 ++- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/external/airtaudio b/external/airtaudio index 36e5f26c..102a4e5c 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 36e5f26cb43db3ab1da60662a0aff8b335f4bd72 +Subproject commit 102a4e5ca569052f624c3112f7f68afa48acecfe diff --git a/external/audio b/external/audio index d1cf2151..469a2650 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit d1cf21511325622116c42188ef3b2e1e203d6b2d +Subproject commit 469a2650649165367e9272103633d8c00262b488 diff --git a/external/drain b/external/drain index c209a900..2bbbad46 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit c209a900cf83138abc8a09fd1bfd3a7b0505ed05 +Subproject commit 2bbbad467f3f477bb8b41b7e370d5c1d1b9ca8ae diff --git a/external/ejson b/external/ejson index be1eeda5..f46eb52d 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit be1eeda5566b1ed60ef9a0e4a27e12e8762e4a18 +Subproject commit f46eb52d32cf855527a12a4a365e70ed537cc60c diff --git a/external/etk b/external/etk index 9ccf8eea..a84ec0fc 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 9ccf8eea8314a7f35f0da54b64529abf4272beec +Subproject commit a84ec0fcb11358c51bec545dce9c884cd69b13f5 diff --git a/external/river b/external/river index 893cf1d5..4c3fe665 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit 893cf1d5c02b54cd33063e914b78db8d19a893f0 +Subproject commit 4c3fe665cf788bde5919267de29dca8544c8f76f diff --git a/sources/ewol/context/Context.cpp b/sources/ewol/context/Context.cpp index cd2c44e2..2be4fb1b 100644 --- a/sources/ewol/context/Context.cpp +++ b/sources/ewol/context/Context.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -306,7 +307,7 @@ ewol::Context::Context(ewol::context::Application* _application, int32_t _argc, m_windowsSize(320,480), m_initStepId(0) { // set a basic - etk::log::setThreadName("ewol"); + etk::thread::setName("ewol"); if (m_application == nullptr) { EWOL_CRITICAL("Can not start context with no Application ==> rtfm ..."); } From 551846181cbf779b6313d87630c1aef6d4121e57 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 20 Mar 2015 23:18:16 +0100 Subject: [PATCH 49/57] [DEV] remove LUA and compilation update --- .gitmodules | 6 -- external/eaudiofx | 2 +- external/etk | 2 +- external/ewolsa | 2 +- external/lua | 1 - external/luaWrapper | 1 - external/ogg | 2 +- external/speex | 2 +- sample/099_lua/appl/Main.cpp | 71 ----------------------- sample/099_lua/appl/Main.h | 14 ----- sample/099_lua/appl/Windows.cpp | 33 ----------- sample/099_lua/appl/Windows.h | 25 -------- sample/099_lua/appl/debug.cpp | 15 ----- sample/099_lua/appl/debug.h | 52 ----------------- sample/099_lua/lutin_099_lua.py | 32 ---------- sources/wrapper/ewolLua/debug.cpp | 14 ----- sources/wrapper/ewolLua/debug.h | 52 ----------------- sources/wrapper/ewolLua/ewolLua.cpp | 18 ------ sources/wrapper/ewolLua/ewolLua.h | 20 ------- sources/wrapper/ewolLua/object.cpp | 35 ----------- sources/wrapper/ewolLua/object.h | 20 ------- sources/wrapper/ewolLua/objectManager.cpp | 17 ------ sources/wrapper/ewolLua/objectManager.h | 20 ------- sources/wrapper/lutin_ewolLua.py | 33 ----------- 24 files changed, 5 insertions(+), 484 deletions(-) delete mode 160000 external/lua delete mode 160000 external/luaWrapper delete mode 100644 sample/099_lua/appl/Main.cpp delete mode 100644 sample/099_lua/appl/Main.h delete mode 100644 sample/099_lua/appl/Windows.cpp delete mode 100644 sample/099_lua/appl/Windows.h delete mode 100644 sample/099_lua/appl/debug.cpp delete mode 100644 sample/099_lua/appl/debug.h delete mode 100755 sample/099_lua/lutin_099_lua.py delete mode 100644 sources/wrapper/ewolLua/debug.cpp delete mode 100644 sources/wrapper/ewolLua/debug.h delete mode 100644 sources/wrapper/ewolLua/ewolLua.cpp delete mode 100644 sources/wrapper/ewolLua/ewolLua.h delete mode 100644 sources/wrapper/ewolLua/object.cpp delete mode 100644 sources/wrapper/ewolLua/object.h delete mode 100644 sources/wrapper/ewolLua/objectManager.cpp delete mode 100644 sources/wrapper/ewolLua/objectManager.h delete mode 100644 sources/wrapper/lutin_ewolLua.py diff --git a/.gitmodules b/.gitmodules index ff597ba8..085a39a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,9 +23,6 @@ [submodule "external/ogg"] path = external/ogg url = https://github.com/HeeroYui/libogg.git -[submodule "external/lua"] - path = external/lua - url = https://github.com/HeeroYui/liblua.git [submodule "external/z/zlib"] path = external/z/zlib url = https://github.com/madler/zlib.git @@ -71,9 +68,6 @@ [submodule "external/gtest"] path = external/gtest url = https://github.com/HeeroYui/gtest -[submodule "external/luaWrapper"] - path = external/luaWrapper - url = https://github.com/HeeroYui/luaWrapper.git [submodule "external/speex"] path = external/speex url = https://github.com/HeeroYui/speex.git diff --git a/external/eaudiofx b/external/eaudiofx index 8cd0fe0b..6aac7ed0 160000 --- a/external/eaudiofx +++ b/external/eaudiofx @@ -1 +1 @@ -Subproject commit 8cd0fe0b88e8a8838b30d2b5342e105aee842d51 +Subproject commit 6aac7ed0bbb3bdfa099f99f71778f16b43507508 diff --git a/external/etk b/external/etk index a84ec0fc..bf74ba1a 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit a84ec0fcb11358c51bec545dce9c884cd69b13f5 +Subproject commit bf74ba1a02024183ab18e5b56782dcf745240c2c diff --git a/external/ewolsa b/external/ewolsa index 23467923..3c605926 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit 23467923b4917aa7db24f262b3129ac5f58803c5 +Subproject commit 3c60592630d0595840773328355c3b90697528b9 diff --git a/external/lua b/external/lua deleted file mode 160000 index a0505920..00000000 --- a/external/lua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a0505920fe022de956ef46c8a0be8263710105eb diff --git a/external/luaWrapper b/external/luaWrapper deleted file mode 160000 index 1c941a03..00000000 --- a/external/luaWrapper +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1c941a031b9382b3c98f00a0fcf39dc20c135a24 diff --git a/external/ogg b/external/ogg index fd44b865..4bbdfe1c 160000 --- a/external/ogg +++ b/external/ogg @@ -1 +1 @@ -Subproject commit fd44b865a3f42dbcae7c08888f2228c0644e980f +Subproject commit 4bbdfe1c53ec2368883b29f99b3635c36a87be48 diff --git a/external/speex b/external/speex index b34a74f4..b0cc582e 160000 --- a/external/speex +++ b/external/speex @@ -1 +1 @@ -Subproject commit b34a74f479cce409bbe12b08b45df34eba816cd9 +Subproject commit b0cc582eabc4eb2c8924fac517fe6a73e2d90193 diff --git a/sample/099_lua/appl/Main.cpp b/sample/099_lua/appl/Main.cpp deleted file mode 100644 index a66c9ff6..00000000 --- a/sample/099_lua/appl/Main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class MainApplication : public ewol::context::Application { - private: - lua_State* m_lua; - public: - bool init(ewol::Context& _context, size_t _initId) { - APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); - m_lua = luaL_newstate(); - // TODO : Remove this : Move if in the windows properties - _context.setSize(vec2(800, 600)); - luaL_openlibs(m_lua); - ewolLua::loadEwolLuaWrapper(m_lua); - // select internal data for font ... - _context.getFontDefault().setUseExternal(true); - _context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19); - - - if (luaL_dostring(m_lua, "")) { - std::cout << lua_tostring(m_lua, -1) << std::endl; - } - - std::shared_ptr basicWindows = appl::Windows::create(); - // create the specific windows - _context.setWindows(basicWindows); - APPL_INFO("==> Init APPL (END)"); - return true; - } - - void unInit(ewol::Context& _context) { - APPL_INFO("==> Un-Init APPL (START)"); - // nothing to do ... - lua_close(m_lua); - APPL_INFO("==> Un-Init APPL (END)"); - } -}; - - -/** - * @brief Main of the program (This can be set in every case, but it is not used in Andoid...). - * @param std IO - * @return std IO - */ -int main(int _argc, const char *_argv[]) { - // second possibility - return ewol::run(new MainApplication(), _argc, _argv); -} - - diff --git a/sample/099_lua/appl/Main.h b/sample/099_lua/appl/Main.h deleted file mode 100644 index 8a45fb5e..00000000 --- a/sample/099_lua/appl/Main.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - -#ifndef __APPL_MAIN_H__ -#define __APPL_MAIN_H__ - - -#endif - diff --git a/sample/099_lua/appl/Windows.cpp b/sample/099_lua/appl/Windows.cpp deleted file mode 100644 index 16d06399..00000000 --- a/sample/099_lua/appl/Windows.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - -#include -#include -#include -#include - -#undef __class__ -#define __class__ "Windows" - -appl::Windows::Windows() { - addObjectType("appl::Windows"); -} -void appl::Windows::init() { - ewol::widget::Windows::init(); - setTitle("example 001_HelloWord"); - std::shared_ptr tmpWidget = ewol::widget::Label::create(); - if (tmpWidget == nullptr) { - APPL_ERROR("Can not allocate widget ==> display might be in error"); - } else { - tmpWidget->setLabel("Hello Word"); - tmpWidget->setExpand(bvec2(true,true)); - setSubWidget(tmpWidget); - } -} - - diff --git a/sample/099_lua/appl/Windows.h b/sample/099_lua/appl/Windows.h deleted file mode 100644 index 92614217..00000000 --- a/sample/099_lua/appl/Windows.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - -#ifndef __APPL_WINDOWS_H__ -#define __APPL_WINDOWS_H__ - -#include - -namespace appl { - class Windows : public ewol::widget::Windows { - protected: - Windows(); - void init(); - public: - DECLARE_FACTORY(Windows); - }; -}; - - -#endif \ No newline at end of file diff --git a/sample/099_lua/appl/debug.cpp b/sample/099_lua/appl/debug.cpp deleted file mode 100644 index d63981aa..00000000 --- a/sample/099_lua/appl/debug.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - - -#include - -int32_t appl::getLogId() { - static int32_t g_val = etk::log::registerInstance("example"); - return g_val; -} diff --git a/sample/099_lua/appl/debug.h b/sample/099_lua/appl/debug.h deleted file mode 100644 index cad939e5..00000000 --- a/sample/099_lua/appl/debug.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - - -#ifndef __APPL_DEBUG_H__ -#define __APPL_DEBUG_H__ - -#include - -namespace appl { - int32_t getLogId(); -}; -// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" -#define APPL_BASE(info,data) \ - do { \ - if (info <= etk::log::getLevel(appl::getLogId())) { \ - std::stringbuf sb; \ - std::ostream tmpStream(&sb); \ - tmpStream << data; \ - etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ - } \ - } while(0) - -#define APPL_CRITICAL(data) APPL_BASE(1, data) -#define APPL_ERROR(data) APPL_BASE(2, data) -#define APPL_WARNING(data) APPL_BASE(3, data) -#ifdef DEBUG - #define APPL_INFO(data) APPL_BASE(4, data) - #define APPL_DEBUG(data) APPL_BASE(5, data) - #define APPL_VERBOSE(data) APPL_BASE(6, data) - #define APPL_TODO(data) APPL_BASE(4, "TODO : " << data) -#else - #define APPL_INFO(data) do { } while(false) - #define APPL_DEBUG(data) do { } while(false) - #define APPL_VERBOSE(data) do { } while(false) - #define APPL_TODO(data) do { } while(false) -#endif - -#define APPL_ASSERT(cond,data) \ - do { \ - if (!(cond)) { \ - APPL_CRITICAL(data); \ - assert(!#cond); \ - } \ - } while (0) - -#endif diff --git a/sample/099_lua/lutin_099_lua.py b/sample/099_lua/lutin_099_lua.py deleted file mode 100755 index 3f09cc8a..00000000 --- a/sample/099_lua/lutin_099_lua.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/python -import lutinModule as module -import lutinTools as tools - - -# optionnal : Describe in the "lutin.py --help" -def get_desc(): - return "Tutorial 099 : lua example" - -# Module creation instance (not optionnal) -def create(target): - # module name is '001_HelloWord' and type binary. - myModule = module.Module(__file__, '099_lua', 'BINARY') - # add the file to compile: - myModule.add_src_file([ - 'appl/Main.cpp', - 'appl/debug.cpp', - 'appl/Windows.cpp', - ]) - # add Library dependency name - myModule.add_module_depend(['ewolLua']) - # add application C flags - myModule.compile_flags_CC([ - "-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""]) - # Add current include Path - myModule.add_path(tools.get_current_path(__file__)) - # return the created module - return myModule - - - - diff --git a/sources/wrapper/ewolLua/debug.cpp b/sources/wrapper/ewolLua/debug.cpp deleted file mode 100644 index ebaf0775..00000000 --- a/sources/wrapper/ewolLua/debug.cpp +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include "debug.h" - -int32_t ewolLua::getLogId() { - static int32_t g_val = etk::log::registerInstance("ewolLua"); - return g_val; -} diff --git a/sources/wrapper/ewolLua/debug.h b/sources/wrapper/ewolLua/debug.h deleted file mode 100644 index 8089685c..00000000 --- a/sources/wrapper/ewolLua/debug.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_LUA_DEBUG_H__ -#define __EWOL_LUA_DEBUG_H__ - -#include - -namespace ewolLua { - int32_t getLogId(); -}; -// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" -#define EWOLLUA_BASE(info,data) \ - do { \ - if (info <= etk::log::getLevel(ewolLua::getLogId())) { \ - std::stringbuf sb; \ - std::ostream tmpStream(&sb); \ - tmpStream << data; \ - etk::log::logStream(ewolLua::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ - } \ - } while(0) - -#define EWOLLUA_CRITICAL(data) EWOLLUA_BASE(1, data) -#define EWOLLUA_ERROR(data) EWOLLUA_BASE(2, data) -#define EWOLLUA_WARNING(data) EWOLLUA_BASE(3, data) -#ifdef DEBUG - #define EWOLLUA_INFO(data) EWOLLUA_BASE(4, data) - #define EWOLLUA_DEBUG(data) EWOLLUA_BASE(5, data) - #define EWOLLUA_VERBOSE(data) EWOLLUA_BASE(6, data) - #define EWOLLUA_TODO(data) EWOLLUA_BASE(4, "TODO : " << data) -#else - #define EWOLLUA_INFO(data) do { } while(false) - #define EWOLLUA_DEBUG(data) do { } while(false) - #define EWOLLUA_VERBOSE(data) do { } while(false) - #define EWOLLUA_TODO(data) do { } while(false) -#endif - -#define EWOLLUA_ASSERT(cond,data) \ - do { \ - if (!(cond)) { \ - EWOLLUA_CRITICAL(data); \ - assert(!#cond); \ - } \ - } while (0) - -#endif - diff --git a/sources/wrapper/ewolLua/ewolLua.cpp b/sources/wrapper/ewolLua/ewolLua.cpp deleted file mode 100644 index 79a7137c..00000000 --- a/sources/wrapper/ewolLua/ewolLua.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include "ewolLua.h" -#include "object.h" -#include "objectManager.h" - - -int32_t ewolLua::loadEwolLuaWrapper(lua_State* _L) { - loadObject(_L); - loadObjectManager(_L); - return 0; -} diff --git a/sources/wrapper/ewolLua/ewolLua.h b/sources/wrapper/ewolLua/ewolLua.h deleted file mode 100644 index 50de9a0f..00000000 --- a/sources/wrapper/ewolLua/ewolLua.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_LUA_H__ -#define __EWOL_LUA_H__ - -#include - -struct lua_State; -namespace ewolLua { - int32_t loadEwolLuaWrapper(lua_State* _L); -}; - -#endif - diff --git a/sources/wrapper/ewolLua/object.cpp b/sources/wrapper/ewolLua/object.cpp deleted file mode 100644 index 2e1fc3e8..00000000 --- a/sources/wrapper/ewolLua/object.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include -#include "object.h" -#include "debug.h" - - -std::shared_ptr ewolObjectNew(lua_State *_L) { - const char* name = luaL_checkstring(_L, 1); - return ewol::Object::create(name); -} - -static luaL_Reg s_metatable[] = { - //{ "getIdFunc", luaU_get }, - //{ "NameFunc", luaU_getset }, - - { "getObjectType", luaU_func(&ewol::Object::getObjectType) }, - { "getTypeDescription", luaU_func(&ewol::Object::getTypeDescription) }, - { "isTypeCompatible", luaU_func(&ewol::Object::isTypeCompatible) }, - //{ "addObjectType", luaU_func(&ewol::Object::addObjectType) }, - { "getStatic", luaU_func(&ewol::Object::getStatic) }, - { NULL, NULL } -}; - -int32_t ewolLua::loadObject(lua_State* _L) { - luaW_register(_L, "ewol__Object", NULL, s_metatable, ewolObjectNew); - return 0; -} diff --git a/sources/wrapper/ewolLua/object.h b/sources/wrapper/ewolLua/object.h deleted file mode 100644 index a47ffcbf..00000000 --- a/sources/wrapper/ewolLua/object.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_LUA_OBJECT_H__ -#define __EWOL_LUA_OBJECT_H__ - -#include - -struct lua_State; -namespace ewolLua { - int32_t loadObject(lua_State* _L); -}; - -#endif - diff --git a/sources/wrapper/ewolLua/objectManager.cpp b/sources/wrapper/ewolLua/objectManager.cpp deleted file mode 100644 index fcb478d1..00000000 --- a/sources/wrapper/ewolLua/objectManager.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include "objectManager.h" -#include "debug.h" - - - -int32_t ewolLua::loadObjectManager(lua_State* _L) { - - return 0; -} diff --git a/sources/wrapper/ewolLua/objectManager.h b/sources/wrapper/ewolLua/objectManager.h deleted file mode 100644 index 6331ae51..00000000 --- a/sources/wrapper/ewolLua/objectManager.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_LUA_OBJECT_MANAGER_H__ -#define __EWOL_LUA_OBJECT_MANAGER_H__ - -#include - -struct lua_State; -namespace ewolLua { - int32_t loadObjectManager(lua_State* _L); -}; - -#endif - diff --git a/sources/wrapper/lutin_ewolLua.py b/sources/wrapper/lutin_ewolLua.py deleted file mode 100644 index 39f3f241..00000000 --- a/sources/wrapper/lutin_ewolLua.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python -import lutinModule as module -import lutinTools as tools -import os -import lutinMultiprocess - -def get_desc(): - return "ewol lua Wrapper" - -def get_license(): - return "APACHE v2.0" - -def create(target): - # module name is 'edn' and type binary. - myModule = module.Module(__file__, 'ewolLua', 'LIBRARY') - - # add extra compilation flags : - myModule.add_extra_compile_flags() - # add the file to compile: - myModule.add_src_file([ - 'ewolLua/object.cpp', - 'ewolLua/objectManager.cpp', - 'ewolLua/ewolLua.cpp', - 'ewolLua/debug.cpp', - ]) - - # name of the dependency - myModule.add_module_depend(['ewol', 'luaWrapper']) - myModule.add_export_path(tools.get_current_path(__file__)) - - # add the currrent module at the - return myModule - From 66364ff4ea3cdbc127f41fc777d769f488cc232a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 22 Mar 2015 20:45:50 +0100 Subject: [PATCH 50/57] [DOC] add worddown in the software list that use EWOL --- doc/index.bb | 1 + external/ejson | 2 +- external/etk | 2 +- external/river | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/index.bb b/doc/index.bb index fd1d8095..0187266d 100644 --- a/doc/index.bb +++ b/doc/index.bb @@ -86,6 +86,7 @@ limitations under the License. ===== Program Using EWOL ===== :** [b][lib[edn | edn]][/b] : (Application in GPLv3) Edn is the main application using this lib and designed for (in the first time). This is a "Code editor". +:** [b][[http://play.google.com/store/apps/details?id=com.edouarddupin.worddown | worddown]][/b] : (Proprietary) Worddown is a simple word game. == Main documentation: == diff --git a/external/ejson b/external/ejson index f46eb52d..1fbbe9c3 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit f46eb52d32cf855527a12a4a365e70ed537cc60c +Subproject commit 1fbbe9c39c4642246dfe6d3dd8441e3fc58d8599 diff --git a/external/etk b/external/etk index bf74ba1a..d0653f8e 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit bf74ba1a02024183ab18e5b56782dcf745240c2c +Subproject commit d0653f8e2516f645aba88fd4b6aa6df3f29d488e diff --git a/external/river b/external/river index 4c3fe665..1c34c157 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit 4c3fe665cf788bde5919267de29dca8544c8f76f +Subproject commit 1c34c157ab4d8419bd8416fbb2896fb6dec0c74d From 9bd62966cacd53d017cf9b8a2d858e0ac726658b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 25 Mar 2015 21:14:12 +0100 Subject: [PATCH 51/57] [DEV] update Log interafce --- external/agg | 2 +- external/airtaudio | 2 +- external/audio | 2 +- external/drain | 2 +- external/eaudiofx | 2 +- external/egami | 2 +- external/ege | 2 +- external/ejson | 2 +- external/enet | 2 +- external/esvg | 2 +- external/etk | 2 +- external/ewolsa | 2 +- external/exml | 2 +- external/river | 2 +- monk | 2 +- sample/001_HelloWord/appl/debug.h | 11 +---------- sample/0XX_CustomWidgets/appl/debug.h | 11 +---------- sample/examplewallpaper/appl/debug.h | 11 +---------- sources/ewol/debug.h | 11 +---------- 19 files changed, 19 insertions(+), 55 deletions(-) diff --git a/external/agg b/external/agg index f2a9ffcd..af62bc41 160000 --- a/external/agg +++ b/external/agg @@ -1 +1 @@ -Subproject commit f2a9ffcdb201285f6d449f573a8c58e130d09b0b +Subproject commit af62bc418a88687a8a14f768d7936c5b104d085f diff --git a/external/airtaudio b/external/airtaudio index 102a4e5c..d4c53a53 160000 --- a/external/airtaudio +++ b/external/airtaudio @@ -1 +1 @@ -Subproject commit 102a4e5ca569052f624c3112f7f68afa48acecfe +Subproject commit d4c53a53bf3faec2ba56bb126f01f8e253e446ed diff --git a/external/audio b/external/audio index 469a2650..ea6d4e7d 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit 469a2650649165367e9272103633d8c00262b488 +Subproject commit ea6d4e7d58319551508e937973925e7430b7ca57 diff --git a/external/drain b/external/drain index 2bbbad46..5dff6c1e 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit 2bbbad467f3f477bb8b41b7e370d5c1d1b9ca8ae +Subproject commit 5dff6c1e8ece1e6923d30a1aaaca5c85e1e09e9a diff --git a/external/eaudiofx b/external/eaudiofx index 6aac7ed0..fefcb647 160000 --- a/external/eaudiofx +++ b/external/eaudiofx @@ -1 +1 @@ -Subproject commit 6aac7ed0bbb3bdfa099f99f71778f16b43507508 +Subproject commit fefcb6479887fa133a1f97ecfe2c11b69d5b1004 diff --git a/external/egami b/external/egami index ff1239ee..28a67a89 160000 --- a/external/egami +++ b/external/egami @@ -1 +1 @@ -Subproject commit ff1239ee266d14d380d53cc7407d4e60c75b0db2 +Subproject commit 28a67a895c6ed998be2463d1a1bfcfbde4fce559 diff --git a/external/ege b/external/ege index be7abd40..a6fba88a 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit be7abd40a14ac37ca2afc8e8e14bc7f6f2ce7ba5 +Subproject commit a6fba88a18190cb28ee747ffe30a8af7f615e503 diff --git a/external/ejson b/external/ejson index 1fbbe9c3..82670a79 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit 1fbbe9c39c4642246dfe6d3dd8441e3fc58d8599 +Subproject commit 82670a7954dc6c8e9f38f0feb74495ef9817f1b2 diff --git a/external/enet b/external/enet index 5a108ecd..b1ad254e 160000 --- a/external/enet +++ b/external/enet @@ -1 +1 @@ -Subproject commit 5a108ecdac60de39af102d9c158a87ab1c9ee6b2 +Subproject commit b1ad254e0e8bf83dcae13cc0187151178eaf9f4e diff --git a/external/esvg b/external/esvg index d61f0b96..6c65d740 160000 --- a/external/esvg +++ b/external/esvg @@ -1 +1 @@ -Subproject commit d61f0b9607fa31a0a817c350889b7259f4d1d516 +Subproject commit 6c65d74094684130d4ffb438b6be96a6919257b0 diff --git a/external/etk b/external/etk index d0653f8e..10d51168 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit d0653f8e2516f645aba88fd4b6aa6df3f29d488e +Subproject commit 10d5116851d51facbae446ad00b7de535c3b58ef diff --git a/external/ewolsa b/external/ewolsa index 3c605926..b45894a4 160000 --- a/external/ewolsa +++ b/external/ewolsa @@ -1 +1 @@ -Subproject commit 3c60592630d0595840773328355c3b90697528b9 +Subproject commit b45894a4f1ae8dc18ad7d8ac44a4897f80a2c4e1 diff --git a/external/exml b/external/exml index a9ed10a8..13d741b7 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit a9ed10a8f08ffd0e84decc70e8e16861b4dd76c4 +Subproject commit 13d741b770f0b802cbfdecf132fddc099b087bf7 diff --git a/external/river b/external/river index 1c34c157..6622cd82 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit 1c34c157ab4d8419bd8416fbb2896fb6dec0c74d +Subproject commit 6622cd823789eea38b88bae2bcf0ce1c6280df9a diff --git a/monk b/monk index 71ded394..2ff7730c 160000 --- a/monk +++ b/monk @@ -1 +1 @@ -Subproject commit 71ded394c57b4ed8954643eacde359c1a9bab52c +Subproject commit 2ff7730ca8a6ecf70fbd4bdd56cc500ba0292e9f diff --git a/sample/001_HelloWord/appl/debug.h b/sample/001_HelloWord/appl/debug.h index cad939e5..75fb1ca2 100644 --- a/sample/001_HelloWord/appl/debug.h +++ b/sample/001_HelloWord/appl/debug.h @@ -15,16 +15,7 @@ namespace appl { int32_t getLogId(); }; -// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" -#define APPL_BASE(info,data) \ - do { \ - if (info <= etk::log::getLevel(appl::getLogId())) { \ - std::stringbuf sb; \ - std::ostream tmpStream(&sb); \ - tmpStream << data; \ - etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ - } \ - } while(0) +#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data) #define APPL_CRITICAL(data) APPL_BASE(1, data) #define APPL_ERROR(data) APPL_BASE(2, data) diff --git a/sample/0XX_CustomWidgets/appl/debug.h b/sample/0XX_CustomWidgets/appl/debug.h index 969e3a0e..06c068ec 100644 --- a/sample/0XX_CustomWidgets/appl/debug.h +++ b/sample/0XX_CustomWidgets/appl/debug.h @@ -14,16 +14,7 @@ namespace appl { int32_t getLogId(); }; -// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" -#define APPL_BASE(info,data) \ - do { \ - if (info <= etk::log::getLevel(appl::getLogId())) { \ - std::stringbuf sb; \ - std::ostream tmpStream(&sb); \ - tmpStream << data; \ - etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ - } \ - } while(0) +#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data) #define APPL_CRITICAL(data) APPL_BASE(1, data) #define APPL_ERROR(data) APPL_BASE(2, data) diff --git a/sample/examplewallpaper/appl/debug.h b/sample/examplewallpaper/appl/debug.h index fcafd52a..1596a606 100644 --- a/sample/examplewallpaper/appl/debug.h +++ b/sample/examplewallpaper/appl/debug.h @@ -14,16 +14,7 @@ namespace appl { int32_t getLogId(); }; -// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" -#define APPL_BASE(info,data) \ - do { \ - if (info <= etk::log::getLevel(appl::getLogId())) { \ - std::stringbuf sb; \ - std::ostream tmpStream(&sb); \ - tmpStream << data; \ - etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ - } \ - } while(0) +#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data) #define APPL_CRITICAL(data) APPL_BASE(1, data) #define APPL_ERROR(data) APPL_BASE(2, data) diff --git a/sources/ewol/debug.h b/sources/ewol/debug.h index 32c1c33e..45064bc2 100644 --- a/sources/ewol/debug.h +++ b/sources/ewol/debug.h @@ -14,16 +14,7 @@ namespace ewol { int32_t getLogId(); }; -// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" -#define EWOL_BASE(info,data) \ - do { \ - if (info <= etk::log::getLevel(ewol::getLogId())) { \ - std::stringbuf sb; \ - std::ostream tmpStream(&sb); \ - tmpStream << data; \ - etk::log::logStream(ewol::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \ - } \ - } while(0) +#define EWOL_BASE(info,data) TK_LOG_BASE(ewol::getLogId(),info,data) #define EWOL_CRITICAL(data) EWOL_BASE(1, data) #define EWOL_ERROR(data) EWOL_BASE(2, data) From ce00a23475079f4575db54992cea4108d7583cdc Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 26 Mar 2015 21:21:38 +0100 Subject: [PATCH 52/57] [DEV] update the etk init --- external/etk | 2 +- sources/ewol/context/IOs/Context.cpp | 2 +- sources/ewol/context/MacOs/Context.cpp | 2 +- sources/ewol/context/Windows/Context.cpp | 2 +- sources/ewol/context/X11/Context.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/external/etk b/external/etk index 10d51168..a06aee64 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 10d5116851d51facbae446ad00b7de535c3b58ef +Subproject commit a06aee64cc8f05ee33e51f9299c66f17960ff121 diff --git a/sources/ewol/context/IOs/Context.cpp b/sources/ewol/context/IOs/Context.cpp index f5eaaa02..90f9278e 100644 --- a/sources/ewol/context/IOs/Context.cpp +++ b/sources/ewol/context/IOs/Context.cpp @@ -247,7 +247,7 @@ int ewol::run(ewol::context::Application* _application, int _argc, const char *_ // Creat and relaese ewol::Context interface: void IOs::createInterface() { - etk::setArgZero(l_argv[0]); + etk::init(l_argc, l_argv); EWOL_INFO("Create new interface"); interface = new MacOSInterface(l_application, l_argc, l_argv); l_application = nullptr; diff --git a/sources/ewol/context/MacOs/Context.cpp b/sources/ewol/context/MacOs/Context.cpp index c11d8de9..bf1c863f 100644 --- a/sources/ewol/context/MacOs/Context.cpp +++ b/sources/ewol/context/MacOs/Context.cpp @@ -173,7 +173,7 @@ void MacOs::setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::k * @return std IO */ int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { - etk::setArgZero(_argv[0]); + etk::init(_argc, _argv); interface = new MacOSInterface(_application, _argc, _argv); if (nullptr == interface) { EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); diff --git a/sources/ewol/context/Windows/Context.cpp b/sources/ewol/context/Windows/Context.cpp index 6a207824..c725b89e 100644 --- a/sources/ewol/context/Windows/Context.cpp +++ b/sources/ewol/context/Windows/Context.cpp @@ -478,7 +478,7 @@ class WindowsContext : public ewol::Context { * @return std IO */ int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { - etk::setArgZero(_argv[0]); + etk::init(_argc, _argv); GLenum err = glewInit(); if (GLEW_OK != err) { // Problem: glewInit failed, something is seriously wrong. diff --git a/sources/ewol/context/X11/Context.cpp b/sources/ewol/context/X11/Context.cpp index 15139f20..d45cb3cf 100644 --- a/sources/ewol/context/X11/Context.cpp +++ b/sources/ewol/context/X11/Context.cpp @@ -1323,7 +1323,7 @@ class X11Interface : public ewol::Context { * @return std IO */ int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { - etk::setArgZero(_argv[0]); + etk::init(_argc, _argv); X11Interface* interface = new X11Interface(_application, _argc, _argv); if (interface == nullptr) { EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); From bf8a93d1ea643111bf20763bd288165461cd46d9 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 26 Mar 2015 22:12:55 +0100 Subject: [PATCH 53/57] [DEV] update init --- external/drain | 2 +- external/etk | 2 +- sources/ewol/context/IOs/Context.cpp | 1 + sources/ewol/context/MacOs/Context.cpp | 1 + sources/ewol/context/Windows/Context.cpp | 1 + sources/ewol/context/X11/Context.cpp | 1 + 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/external/drain b/external/drain index 5dff6c1e..fa6cc4fa 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit 5dff6c1e8ece1e6923d30a1aaaca5c85e1e09e9a +Subproject commit fa6cc4fa5ce3ac492fc13481a2859c2544d1d410 diff --git a/external/etk b/external/etk index a06aee64..0938f7f8 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit a06aee64cc8f05ee33e51f9299c66f17960ff121 +Subproject commit 0938f7f8a5d9dc6f9cab0150012c605ad8d89bb0 diff --git a/sources/ewol/context/IOs/Context.cpp b/sources/ewol/context/IOs/Context.cpp index 90f9278e..0b5a7b66 100644 --- a/sources/ewol/context/IOs/Context.cpp +++ b/sources/ewol/context/IOs/Context.cpp @@ -29,6 +29,7 @@ #include #include #include +#include int64_t ewol::getTime() { diff --git a/sources/ewol/context/MacOs/Context.cpp b/sources/ewol/context/MacOs/Context.cpp index bf1c863f..e0385f36 100644 --- a/sources/ewol/context/MacOs/Context.cpp +++ b/sources/ewol/context/MacOs/Context.cpp @@ -29,6 +29,7 @@ #include #include #include +#include int64_t ewol::getTime() { diff --git a/sources/ewol/context/Windows/Context.cpp b/sources/ewol/context/Windows/Context.cpp index c725b89e..75798f46 100644 --- a/sources/ewol/context/Windows/Context.cpp +++ b/sources/ewol/context/Windows/Context.cpp @@ -24,6 +24,7 @@ #include #include #include +#include diff --git a/sources/ewol/context/X11/Context.cpp b/sources/ewol/context/X11/Context.cpp index d45cb3cf..54d306de 100644 --- a/sources/ewol/context/X11/Context.cpp +++ b/sources/ewol/context/X11/Context.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #if defined(__TARGET_OS__Linux) From 915c4088e790174dcb8c825bed488a17dfd25045 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 2 Apr 2015 22:00:29 +0200 Subject: [PATCH 54/57] [DEV] remove build system and add audioAlgo --- .gitmodules | 6 +++--- .travis.yml | 3 ++- README.md | 1 + build | 1 - external/audio-algo-aec | 1 + external/drain | 2 +- external/exml | 2 +- external/river | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) delete mode 160000 build create mode 160000 external/audio-algo-aec diff --git a/.gitmodules b/.gitmodules index 085a39a5..60a1dc27 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,9 +2,6 @@ [submodule "external/glew/glew"] path = external/glew/glew url = https://github.com/HeeroYui/glew.git -[submodule "build"] - path = build - url = https://github.com/HeeroYui/Build.git [submodule "external/etk"] path = external/etk url = https://github.com/HeeroYui/etk.git @@ -83,3 +80,6 @@ [submodule "external/river"] path = external/river url = https://github.com/HeeroYui/river.git +[submodule "external/audio-algo-aec"] + path = external/audio-algo-aec + url = https://github.com/HeeroYui/audio-algo-aec.git diff --git a/.travis.yml b/.travis.yml index 7d1dbc82..72593e57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ branches: # previous actions: before_script: + - git clone git://github.com/HeeroYui/lutin.git - git submodule init - git submodule update - if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi @@ -31,7 +32,7 @@ install: # build sequence with Lutin : script: - - ./build/lutin.py -C -P -c$BUILDER -mdebug -p ewol etk_test exml_test ejson_test enettest + - ./lutin/lutin.py -C -P -c$BUILDER -mdebug -p ewol etk_test exml_test ejson_test enettest - ./out/Linux_x86_64/debug/staging/$BUILDER/etk_test/usr/bin/etk_test - ./out/Linux_x86_64/debug/staging/$BUILDER/ejson_test/usr/bin/ejson_test - ./out/Linux_x86_64/debug/staging/$BUILDER/exml_test/usr/bin/exml_test diff --git a/README.md b/README.md index 8e3d5339..c26884a7 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Instructions download the software : + git clone git://github.com/HeeroYui/lutin.git git clone git://github.com/HeeroYui/ewol.git cd ewol git submodule init diff --git a/build b/build deleted file mode 160000 index 35d514e9..00000000 --- a/build +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 35d514e9a928685798584e09ecbda3fc2a519eea diff --git a/external/audio-algo-aec b/external/audio-algo-aec new file mode 160000 index 00000000..f5f7c80b --- /dev/null +++ b/external/audio-algo-aec @@ -0,0 +1 @@ +Subproject commit f5f7c80b0c65fc2ba78395bc100d903184090012 diff --git a/external/drain b/external/drain index fa6cc4fa..98cbaedc 160000 --- a/external/drain +++ b/external/drain @@ -1 +1 @@ -Subproject commit fa6cc4fa5ce3ac492fc13481a2859c2544d1d410 +Subproject commit 98cbaedc2c62a73be4b97a69bb4147c2246aa9a9 diff --git a/external/exml b/external/exml index 13d741b7..e64954b1 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit 13d741b770f0b802cbfdecf132fddc099b087bf7 +Subproject commit e64954b1a1022183831c8f495d0fafa914205284 diff --git a/external/river b/external/river index 6622cd82..bf05f46f 160000 --- a/external/river +++ b/external/river @@ -1 +1 @@ -Subproject commit 6622cd823789eea38b88bae2bcf0ce1c6280df9a +Subproject commit bf05f46f24e5d9acca927e68a31fb7d3485542b0 From 1b441ad65d85500567b69d0de867c858d3028028 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 10 Apr 2015 22:49:38 +0200 Subject: [PATCH 55/57] [DEV] rework tree and submodules --- .gitmodules | 39 +++++++++++------------- external/audio | 2 +- external/audio-algo-aec | 2 +- external/audio-algo-drain | 1 + external/{airtaudio => audio-backend} | 0 external/{eaudiofx => audio-blockEngine} | 0 external/{drain => audio-drain} | 0 external/{ewolsa => audio-ess} | 0 external/audio-orchestra | 1 + external/{river => audio-river} | 0 external/etk | 2 +- monk | 1 - 12 files changed, 23 insertions(+), 25 deletions(-) create mode 160000 external/audio-algo-drain rename external/{airtaudio => audio-backend} (100%) rename external/{eaudiofx => audio-blockEngine} (100%) rename external/{drain => audio-drain} (100%) rename external/{ewolsa => audio-ess} (100%) create mode 160000 external/audio-orchestra rename external/{river => audio-river} (100%) delete mode 160000 monk diff --git a/.gitmodules b/.gitmodules index 60a1dc27..d49e5013 100644 --- a/.gitmodules +++ b/.gitmodules @@ -41,21 +41,6 @@ [submodule "external/ege"] path = external/ege url = https://github.com/HeeroYui/ege.git -[submodule "monk"] - path = monk - url = https://github.com/HeeroYui/monk.git -[submodule "external/rtaudio/rtaudio"] - path = external/rtaudio/rtaudio - url = https://github.com/HeeroYui/rtaudio.git -[submodule "external/eaudiofx"] - path = external/eaudiofx - url = https://github.com/HeeroYui/eaudiofx.git -[submodule "external/airtaudio"] - path = external/airtaudio - url = https://github.com/HeeroYui/AirTAudio.git -[submodule "external/ewolsa"] - path = external/ewolsa - url = https://github.com/HeeroYui/ewolsa.git [submodule "ios-deploy"] path = ios-deploy url = https://github.com/HeeroYui/ios-deploy.git @@ -74,12 +59,24 @@ [submodule "external/audio"] path = external/audio url = https://github.com/HeeroYui/audio.git -[submodule "external/drain"] - path = external/drain - url = https://github.com/HeeroYui/drain.git -[submodule "external/river"] - path = external/river - url = https://github.com/HeeroYui/river.git [submodule "external/audio-algo-aec"] path = external/audio-algo-aec url = https://github.com/HeeroYui/audio-algo-aec.git +[submodule "external/audio-algo-drain"] + path = external/audio-algo-drain + url = https://github.com/HeeroYui/audio-algo-drain.git +[submodule "external/audio-drain"] + path = external/audio-drain + url = https://github.com/HeeroYui/audio-drain.git +[submodule "external/audio-river"] + path = external/audio-river + url = https://github.com/HeeroYui/audio-river.git +[submodule "external/audio-ess"] + path = external/audio-ess + url = https://github.com/HeeroYui/audio-ess.git +[submodule "external/audio-blockEngine"] + path = external/audio-blockEngine + url = https://github.com/HeeroYui/audio-blockEngine.git +[submodule "external/audio-orchestra"] + path = external/audio-orchestra + url = https://github.com/HeeroYui/audio-orchestra.git diff --git a/external/audio b/external/audio index ea6d4e7d..61d33fa5 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit ea6d4e7d58319551508e937973925e7430b7ca57 +Subproject commit 61d33fa59f148568a5583e242731d5391d0616f6 diff --git a/external/audio-algo-aec b/external/audio-algo-aec index f5f7c80b..848b8a45 160000 --- a/external/audio-algo-aec +++ b/external/audio-algo-aec @@ -1 +1 @@ -Subproject commit f5f7c80b0c65fc2ba78395bc100d903184090012 +Subproject commit 848b8a454a412c2885d7185fb9b89bcdd388eaac diff --git a/external/audio-algo-drain b/external/audio-algo-drain new file mode 160000 index 00000000..68c2174f --- /dev/null +++ b/external/audio-algo-drain @@ -0,0 +1 @@ +Subproject commit 68c2174fb00820b8f5c2c22113e36fab50fa12ae diff --git a/external/airtaudio b/external/audio-backend similarity index 100% rename from external/airtaudio rename to external/audio-backend diff --git a/external/eaudiofx b/external/audio-blockEngine similarity index 100% rename from external/eaudiofx rename to external/audio-blockEngine diff --git a/external/drain b/external/audio-drain similarity index 100% rename from external/drain rename to external/audio-drain diff --git a/external/ewolsa b/external/audio-ess similarity index 100% rename from external/ewolsa rename to external/audio-ess diff --git a/external/audio-orchestra b/external/audio-orchestra new file mode 160000 index 00000000..f5c3affc --- /dev/null +++ b/external/audio-orchestra @@ -0,0 +1 @@ +Subproject commit f5c3affccb24684eb34f19b6961b3e1a7a57d1d9 diff --git a/external/river b/external/audio-river similarity index 100% rename from external/river rename to external/audio-river diff --git a/external/etk b/external/etk index 0938f7f8..b16d915a 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 0938f7f8a5d9dc6f9cab0150012c605ad8d89bb0 +Subproject commit b16d915a453b40dd2540608a6d93830c53ed725c diff --git a/monk b/monk deleted file mode 160000 index 2ff7730c..00000000 --- a/monk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2ff7730ca8a6ecf70fbd4bdd56cc500ba0292e9f From af4410a16a3d32bd147b37b3364eb05cbb09ce3c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 11 Apr 2015 13:22:12 +0200 Subject: [PATCH 56/57] [DEV] workspace is back correct --- external/audio-backend | 1 - external/audio-blockEngine | 2 +- external/audio-drain | 2 +- external/audio-ess | 2 +- external/audio-river | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) delete mode 160000 external/audio-backend diff --git a/external/audio-backend b/external/audio-backend deleted file mode 160000 index d4c53a53..00000000 --- a/external/audio-backend +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d4c53a53bf3faec2ba56bb126f01f8e253e446ed diff --git a/external/audio-blockEngine b/external/audio-blockEngine index fefcb647..2f3a2c59 160000 --- a/external/audio-blockEngine +++ b/external/audio-blockEngine @@ -1 +1 @@ -Subproject commit fefcb6479887fa133a1f97ecfe2c11b69d5b1004 +Subproject commit 2f3a2c597676e6aec12319aa0c7f86f4b39242b2 diff --git a/external/audio-drain b/external/audio-drain index 98cbaedc..75e0396b 160000 --- a/external/audio-drain +++ b/external/audio-drain @@ -1 +1 @@ -Subproject commit 98cbaedc2c62a73be4b97a69bb4147c2246aa9a9 +Subproject commit 75e0396bc1d8b433a920a99c3d6108cf46c39fd8 diff --git a/external/audio-ess b/external/audio-ess index b45894a4..af8f9538 160000 --- a/external/audio-ess +++ b/external/audio-ess @@ -1 +1 @@ -Subproject commit b45894a4f1ae8dc18ad7d8ac44a4897f80a2c4e1 +Subproject commit af8f95386743dcdae2783dd8ad024d8a6bb4e286 diff --git a/external/audio-river b/external/audio-river index bf05f46f..8daa32a2 160000 --- a/external/audio-river +++ b/external/audio-river @@ -1 +1 @@ -Subproject commit bf05f46f24e5d9acca927e68a31fb7d3485542b0 +Subproject commit 8daa32a2f773bb2baac8e45bd4bf3758ffc4f93f From d00ec173afc040a628e01b4b01f139baa3bed45c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 21 Apr 2015 23:02:49 +0200 Subject: [PATCH 57/57] [DEV] update library dependency repository --- .gitmodules | 55 +++++++++++++++++++-------------------- external/audio | 2 +- external/audio-algo-aec | 2 +- external/audio-algo-drain | 2 +- external/audio-drain | 2 +- external/audio-ess | 2 +- external/audio-orchestra | 2 +- external/audio-river | 2 +- external/etk | 2 +- external/exml | 2 +- 10 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.gitmodules b/.gitmodules index d49e5013..e63038f9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,18 +8,12 @@ [submodule "external/agg"] path = external/agg url = https://github.com/HeeroYui/libagg.git -[submodule "external/portaudio"] - path = external/portaudio - url = https://github.com/HeeroYui/libportaudio.git [submodule "external/freetype"] path = external/freetype url = https://github.com/HeeroYui/libfreetype.git [submodule "external/png"] path = external/png url = https://github.com/HeeroYui/libpng.git -[submodule "external/ogg"] - path = external/ogg - url = https://github.com/HeeroYui/libogg.git [submodule "external/z/zlib"] path = external/z/zlib url = https://github.com/madler/zlib.git @@ -50,33 +44,38 @@ [submodule "external/gtest"] path = external/gtest url = https://github.com/HeeroYui/gtest -[submodule "external/speex"] - path = external/speex - url = https://github.com/HeeroYui/speex.git -[submodule "external/speexdsp"] - path = external/speexdsp - url = https://github.com/HeeroYui/speexdsp.git -[submodule "external/audio"] - path = external/audio - url = https://github.com/HeeroYui/audio.git -[submodule "external/audio-algo-aec"] - path = external/audio-algo-aec - url = https://github.com/HeeroYui/audio-algo-aec.git -[submodule "external/audio-algo-drain"] - path = external/audio-algo-drain - url = https://github.com/HeeroYui/audio-algo-drain.git -[submodule "external/audio-drain"] - path = external/audio-drain - url = https://github.com/HeeroYui/audio-drain.git -[submodule "external/audio-river"] - path = external/audio-river - url = https://github.com/HeeroYui/audio-river.git + [submodule "external/audio-ess"] path = external/audio-ess url = https://github.com/HeeroYui/audio-ess.git [submodule "external/audio-blockEngine"] path = external/audio-blockEngine url = https://github.com/HeeroYui/audio-blockEngine.git + +[submodule "external/ogg"] + path = external/ogg + url = https://github.com/musicdsp/ogg.git +[submodule "external/speex"] + path = external/speex + url = https://github.com/musicdsp/speex.git +[submodule "external/speexdsp"] + path = external/speexdsp + url = https://github.com/musicdsp/speexdsp.git +[submodule "external/audio"] + path = external/audio + url = https://github.com/musicdsp/audio.git +[submodule "external/audio-algo-aec"] + path = external/audio-algo-aec + url = https://github.com/musicdsp/audio-algo-aec.git +[submodule "external/audio-algo-drain"] + path = external/audio-algo-drain + url = https://github.com/musicdsp/audio-algo-drain.git +[submodule "external/audio-drain"] + path = external/audio-drain + url = https://github.com/musicdsp/audio-drain.git +[submodule "external/audio-river"] + path = external/audio-river + url = https://github.com/musicdsp/audio-river.git [submodule "external/audio-orchestra"] path = external/audio-orchestra - url = https://github.com/HeeroYui/audio-orchestra.git + url = https://github.com/musicdsp/audio-orchestra.git diff --git a/external/audio b/external/audio index 61d33fa5..d8867378 160000 --- a/external/audio +++ b/external/audio @@ -1 +1 @@ -Subproject commit 61d33fa59f148568a5583e242731d5391d0616f6 +Subproject commit d8867378cea891fd1dfb5939cd319c7d98b075da diff --git a/external/audio-algo-aec b/external/audio-algo-aec index 848b8a45..cb12079d 160000 --- a/external/audio-algo-aec +++ b/external/audio-algo-aec @@ -1 +1 @@ -Subproject commit 848b8a454a412c2885d7185fb9b89bcdd388eaac +Subproject commit cb12079db1986f2c677048942e4f4355d7cbb2ab diff --git a/external/audio-algo-drain b/external/audio-algo-drain index 68c2174f..e3e048f6 160000 --- a/external/audio-algo-drain +++ b/external/audio-algo-drain @@ -1 +1 @@ -Subproject commit 68c2174fb00820b8f5c2c22113e36fab50fa12ae +Subproject commit e3e048f68a766e9236ea27fb0ee362e0ab6c2770 diff --git a/external/audio-drain b/external/audio-drain index 75e0396b..154d03e8 160000 --- a/external/audio-drain +++ b/external/audio-drain @@ -1 +1 @@ -Subproject commit 75e0396bc1d8b433a920a99c3d6108cf46c39fd8 +Subproject commit 154d03e8bd80bb2e70b6abb4e2675aed9f300bdf diff --git a/external/audio-ess b/external/audio-ess index af8f9538..b3194c0b 160000 --- a/external/audio-ess +++ b/external/audio-ess @@ -1 +1 @@ -Subproject commit af8f95386743dcdae2783dd8ad024d8a6bb4e286 +Subproject commit b3194c0bd9e1ae7306a5a0f764415be191444fb0 diff --git a/external/audio-orchestra b/external/audio-orchestra index f5c3affc..32c0784d 160000 --- a/external/audio-orchestra +++ b/external/audio-orchestra @@ -1 +1 @@ -Subproject commit f5c3affccb24684eb34f19b6961b3e1a7a57d1d9 +Subproject commit 32c0784d3b6b0bd55b7e2d3a5bb85ea77d53247d diff --git a/external/audio-river b/external/audio-river index 8daa32a2..4ba07ac0 160000 --- a/external/audio-river +++ b/external/audio-river @@ -1 +1 @@ -Subproject commit 8daa32a2f773bb2baac8e45bd4bf3758ffc4f93f +Subproject commit 4ba07ac08748695dab4f5b6c9cdb6b19f2769e18 diff --git a/external/etk b/external/etk index b16d915a..e9583aa3 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit b16d915a453b40dd2540608a6d93830c53ed725c +Subproject commit e9583aa3117523378aa660a88434f994a70409ca diff --git a/external/exml b/external/exml index e64954b1..a249eb56 160000 --- a/external/exml +++ b/external/exml @@ -1 +1 @@ -Subproject commit e64954b1a1022183831c8f495d0fafa914205284 +Subproject commit a249eb5699dbd79c22f6e71ac38a671592f539af