From fe9649193ba6af6156ed7892a5dd282990120a1f Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 19 Aug 2014 21:47:33 +0200 Subject: [PATCH] [CLEAN] remove unneeded code --- external/eaudiofx | 2 +- external/ejson | 2 +- sources/ewol/object/Object.cpp | 10 +- sources/ewol/object/Object.h | 31 +----- sources/ewol/widget/ContextMenu.cpp | 70 -------------- sources/ewol/widget/Gird.cpp | 14 --- sources/ewol/widget/Scroll.cpp | 23 ----- sources/ewol/widget/Widget.cpp | 118 ----------------------- sources/ewol/widget/meta/FileChooser.cpp | 26 ++--- 9 files changed, 19 insertions(+), 277 deletions(-) diff --git a/external/eaudiofx b/external/eaudiofx index f0e325a8..69e1259b 160000 --- a/external/eaudiofx +++ b/external/eaudiofx @@ -1 +1 @@ -Subproject commit f0e325a853bca990a1e6eb329b20526a94712b6a +Subproject commit 69e1259b273a429e871e5c2e994dea5bb45aa5cf diff --git a/external/ejson b/external/ejson index 53e2f040..f93e3bd9 160000 --- a/external/ejson +++ b/external/ejson @@ -1 +1 @@ -Subproject commit 53e2f04072d64d4282bc542081312b545546837f +Subproject commit f93e3bd9bcf1232c5b9120e6d07ddf8da3bbb890 diff --git a/sources/ewol/object/Object.cpp b/sources/ewol/object/Object.cpp index 7f5881b5..66f5754a 100644 --- a/sources/ewol/object/Object.cpp +++ b/sources/ewol/object/Object.cpp @@ -293,18 +293,12 @@ bool ewol::Object::storeXML(exml::Element* _node) const { return errorOccured; } -void ewol::Object::onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) { - if (_paramPointer == m_name) { - EWOL_VERBOSE("[" << getId() << "] Parameter name change : " << m_name); - } -} - -bool ewol::Object::setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { +bool ewol::Object::parameterSetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { std::shared_ptr object = getObjectManager().get(_objectName); if (object == nullptr) { return false; } - return object->setConfig(_config, _value); + return object->parameterSet(_config, _value); } ewol::object::Manager& ewol::Object::getObjectManager() const { diff --git a/sources/ewol/object/Object.h b/sources/ewol/object/Object.h index 8f0552c3..0ee75c03 100644 --- a/sources/ewol/object/Object.h +++ b/sources/ewol/object/Object.h @@ -193,41 +193,14 @@ namespace ewol { */ void unRegisterOnEvent(const std::shared_ptr& _destinationObject, const char * _eventId = nullptr); - /** - * @brief Inform object that an other object is removed ... - * @note : Sub classes must call this class - */ - virtual void onObjectRemove(const std::shared_ptr& _object, bool _deprecated) { /* Deprecated */}; /** * @brief Receive a message from an other Object with a specific eventId and data * @param[in] _msg Message handle */ - virtual void onReceiveMessage(const ewol::object::Message& _msg) { - - }; + virtual void onReceiveMessage(const ewol::object::Message& _msg) { }; public: - /** - * @brief Configuration requested to the curent Object (systrem mode) - * @param[in] _conf Configuration handle. - * @return true if config set correctly... - */ - // TODO : Remove this function .... ==> parameterSet(_config, _value); - bool setConfig(const std::string& _config, const std::string& _value) { - return parameterSet(_config, _value); - } // TODO : Rework the position on this function ... - bool setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value); - /** - * @brief Configuration get from the curent Object (systrem mode) - * @param[in] _config Configuration name. - * @return the config properties - */ - // TODO : Remove this : - std::string getConfig(const std::string& _config) const { - return parameterGet(_config); - } - // herited function : - virtual void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer); + bool parameterSetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value); protected: ewol::object::Param m_name; //!< name of the element ... public: diff --git a/sources/ewol/widget/ContextMenu.cpp b/sources/ewol/widget/ContextMenu.cpp index 8a08ae74..9aea810a 100644 --- a/sources/ewol/widget/ContextMenu.cpp +++ b/sources/ewol/widget/ContextMenu.cpp @@ -236,73 +236,3 @@ void ewol::widget::ContextMenu::onParameterChangeValue(const ewol::object::Param markToRedraw(); } } -/* -bool ewol::widget::ContextMenu::onSetConfig(const ewol::object::Config& _conf) { - if (true == ewol::widget::Container::onSetConfig(_conf)) { - return true; - } - if (_conf.getConfig() == configArrowPosition) { - m_arrowPos = _conf.getData(); - return true; - } - if (_conf.getConfig() == configArrowMode) { - if(etk::compare_no_case(_conf.getData(), "top") == true) { - m_arrawBorder = markTop; - } else if(etk::compare_no_case(_conf.getData(), "right") == true) { - m_arrawBorder = markRight; - } else if(etk::compare_no_case(_conf.getData(), "buttom") == true) { - m_arrawBorder = markButtom; - } else if(etk::compare_no_case(_conf.getData(), "left") == true) { - m_arrawBorder = markLeft; - } else { - m_arrawBorder = markNone; - } - return true; - } - if (_conf.getConfig() == configShaper) { - setShaperName(_conf.getData()); - return true; - } - return false; -} - -bool ewol::widget::ContextMenu::onGetConfig(const char* _config, std::string& _result) const { - if (true == ewol::widget::Container::onGetConfig(_config, _result)) { - return true; - } - if (_config == configArrowPosition) { - _result = m_arrowPos; - return true; - } - if (_config == configArrowMode) { - switch(m_arrawBorder) { - case markTop: - _result = "top"; - break; - case markRight: - _result = "right"; - break; - case markButtom: - _result = "buttom"; - break; - case markLeft: - _result = "left"; - break; - default: - case markNone: - _result = "none"; - break; - } - return true; - } - if (_config == configShaper) { - _result = m_shaper.getSource();; - return true; - } - return false; -} -*/ - - - - diff --git a/sources/ewol/widget/Gird.cpp b/sources/ewol/widget/Gird.cpp index 030d3a3c..e1ae0495 100644 --- a/sources/ewol/widget/Gird.cpp +++ b/sources/ewol/widget/Gird.cpp @@ -192,20 +192,6 @@ int32_t ewol::widget::Gird::getRowSize() { void ewol::widget::Gird::subWidgetRemoveAll() { size_t errorControl = m_subWidget.size(); - // the size automaticly decrement with the auto call of the onObjectRemove function - while (m_subWidget.size() > 0 ) { - if (nullptr != m_subWidget[0].widget) { - m_subWidget[0].widget.reset(); - // no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ... - if (errorControl == m_subWidget.size()) { - EWOL_CRITICAL("[" << getId() << "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); - } - } else { - EWOL_WARNING("[" << getId() << "] Must not have null pointer on the subWidget list ..."); - m_subWidget.erase(m_subWidget.begin()); - } - errorControl = m_subWidget.size(); - } m_subWidget.clear(); } diff --git a/sources/ewol/widget/Scroll.cpp b/sources/ewol/widget/Scroll.cpp index 504314df..f465a905 100644 --- a/sources/ewol/widget/Scroll.cpp +++ b/sources/ewol/widget/Scroll.cpp @@ -356,27 +356,4 @@ void ewol::widget::Scroll::onParameterChangeValue(const ewol::object::ParameterR } } -/* -bool ewol::widget::Scroll::onSetConfig(const ewol::object::Config& _conf) { - if (true == ewol::widget::Container::onSetConfig(_conf)) { - return true; - } - if (_conf.getConfig() == configLimit) { - setLimit(_conf.getData()); - return true; - } - return false; -} - -bool ewol::widget::Scroll::onGetConfig(const char* _config, std::string& _result) const { - if (true == ewol::widget::Container::onGetConfig(_config, _result)) { - return true; - } - if (_config == configLimit) { - _result = getLimit(); - return true; - } - return false; -} -*/ diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 11865c1a..ef20011c 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -696,124 +696,6 @@ void ewol::Widget::onParameterChangeValue(const ewol::object::ParameterRef& _par } } -/* -bool ewol::Widget::onSetConfig(const ewol::object::Config& _conf) { - if (true == ewol::Object::onSetConfig(_conf)) { - return true; - } - if (_conf.getConfig() == ewol::Widget::configFill) { - setFill(_conf.getData()); - return true; - } - if (_conf.getConfig() == ewol::Widget::configExpand) { - setExpand(_conf.getData()); - return true; - } - if (_conf.getConfig() == ewol::Widget::configHide) { - if(true == etk::string_to_bool(_conf.getData())) { - hide(); - } else { - show(); - } - return true; - } - if (_conf.getConfig() == ewol::Widget::configFocus) { - if(true == etk::string_to_bool(_conf.getData())) { - keepFocus(); - } else { - //nothing to do ... - } - return true; - } - if (_conf.getConfig() == ewol::Widget::configMinSize) { - m_userMinSize = _conf.getData(); - return true; - } - if (_conf.getConfig() == ewol::Widget::configMaxSize) { - m_userMaxSize = _conf.getData(); - return true; - } - if (_conf.getConfig() == ewol::Widget::configGravity) { - m_gravity = stringToGravity(_conf.getData()); - return true; - } - if (_conf.getConfig() == ewol::Widget::configAnnimationAddType) { - setAnnimationType(ewol::Widget::annimationModeEnableAdd, _conf.getData()); - return true; - } - if (_conf.getConfig() == ewol::Widget::configAnnimationAddTime) { - setAnnimationTime(ewol::Widget::annimationModeEnableAdd, etk::string_to_float(_conf.getData())); - return true; - } - if (_conf.getConfig() == ewol::Widget::configAnnimationRemoveType) { - setAnnimationType(ewol::Widget::annimationModeEnableRemove, _conf.getData()); - return true; - } - if (_conf.getConfig() == ewol::Widget::configAnnimationRemoveTime) { - setAnnimationTime(ewol::Widget::annimationModeEnableRemove, etk::string_to_float(_conf.getData())); - return true; - } - return false; -} - -bool ewol::Widget::onGetConfig(const char* _config, std::string& _result) const { - if (true == ewol::Object::onGetConfig(_config, _result)) { - return true; - } - if (_config == ewol::Widget::configFill) { - _result = m_userFill; - return true; - } - if (_config == ewol::Widget::configExpand) { - _result = m_userExpand; - return true; - } - if (_config == ewol::Widget::configHide) { - _result = etk::to_string(m_hide); - return true; - } - if (_config == ewol::Widget::configMinSize) { - _result = m_userMinSize; - return true; - } - if (_config == ewol::Widget::configMaxSize) { - _result = m_userMaxSize; - return true; - } - if (_config == ewol::Widget::configGravity) { - _result = gravityToString(m_gravity); - return true; - } - if (_config == ewol::Widget::configAnnimationAddType) { - const char* type = m_annimationType[ewol::Widget::annimationModeEnableAdd]; - if (type == nullptr) { - _result = ""; - } else { - _result = type; - } - return true; - } - if (_config == ewol::Widget::configAnnimationAddTime) { - _result = etk::to_string(m_annimationType[ewol::Widget::annimationModeEnableAdd]); - return true; - } - if (_config == ewol::Widget::configAnnimationRemoveType) { - const char* type = m_annimationType[ewol::Widget::annimationModeEnableRemove]; - if (type == nullptr) { - _result = ""; - } else { - _result = type; - } - return true; - } - if (_config == ewol::Widget::configAnnimationRemoveTime) { - _result = etk::to_string(m_annimationType[ewol::Widget::annimationModeEnableRemove]); - return true; - } - return false; -} -*/ - void ewol::Widget::requestUpdateSize() { getContext().requestUpdateSize(); } diff --git a/sources/ewol/widget/meta/FileChooser.cpp b/sources/ewol/widget/meta/FileChooser.cpp index 1c263aac..d716c73b 100644 --- a/sources/ewol/widget/meta/FileChooser.cpp +++ b/sources/ewol/widget/meta/FileChooser.cpp @@ -124,7 +124,7 @@ void ewol::widget::FileChooser::init() { void ewol::widget::FileChooser::onGetFocus() { // transfert focus on a specific widget... - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "focus", "true"); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "focus", "true"); } ewol::widget::FileChooser::~FileChooser() { @@ -132,15 +132,15 @@ ewol::widget::FileChooser::~FileChooser() { } void ewol::widget::FileChooser::setTitle(const std::string& _label) { - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:title-label", "value", _label); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:title-label", "value", _label); } void ewol::widget::FileChooser::setValidateLabel(const std::string& _label) { - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:validate-label", "value", _label); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:validate-label", "value", _label); } void ewol::widget::FileChooser::setCancelLabel(const std::string& _label) { - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:cancel-label", "value", _label); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:cancel-label", "value", _label); } void ewol::widget::FileChooser::setFolder(const std::string& _folder) { @@ -150,7 +150,7 @@ void ewol::widget::FileChooser::setFolder(const std::string& _folder) { void ewol::widget::FileChooser::setFileName(const std::string& _filename) { m_file = _filename; - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "value", _filename); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-file", "value", _filename); } void ewol::widget::FileChooser::onReceiveMessage(const ewol::object::Message& _msg) { @@ -162,18 +162,18 @@ void ewol::widget::FileChooser::onReceiveMessage(const ewol::object::Message& _m // == > change the file name m_file = _msg.getData(); // update the selected file in the list : - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "select", m_file); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "select", m_file); } else if (eventCancel == _msg.getMessage()) { // == > Auto remove ... generateEventId(_msg.getMessage()); autoDestroy(); } else if (_msg.getMessage() == ewolEventFileChooserHidenFileChange) { if (_msg.getData() == "true") { - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "true"); - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "true"); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "true"); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "true"); } else { - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "false"); - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "false"); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "show-hidden", "false"); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "show-hidden", "false"); } } else if (_msg.getMessage() == ewolEventFileChooserListFolder) { // == > this is an internal event ... @@ -216,9 +216,9 @@ void ewol::widget::FileChooser::updateCurrentFolder() { m_folder += "/"; } } - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "path", m_folder); - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "path", m_folder); - setConfigNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-folder", "value", m_folder); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-files", "path", m_folder); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:list-folder", "path", m_folder); + parameterSetOnWidgetNamed("[" + etk::to_string(getId()) + "]file-shooser:entry-folder", "value", m_folder); markToRedraw(); }