diff --git a/sources/appl/Buffer.cpp b/sources/appl/Buffer.cpp index 1801fff..3fe92b9 100644 --- a/sources/appl/Buffer.cpp +++ b/sources/appl/Buffer.cpp @@ -871,7 +871,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos, } void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) { - if (nullptr == m_highlight) { + if (m_highlight == nullptr) { return; } //APPL_DEBUG("area : ("< std::string to_string>(const std::shared_ptr& _obj) { + template<> std::string to_string>(const ememory::SharedPtr& _obj) { if (_obj != nullptr) { return _obj->getFileName(); } return ""; } - template<> std::u32string to_u32string>(const std::shared_ptr& _obj) { + template<> std::u32string to_u32string>(const ememory::SharedPtr& _obj) { return etk::to_u32string(etk::to_string(_obj)); } - template<> bool from_string>(std::shared_ptr& _variableRet, const std::string& _value) { + template<> bool from_string>(ememory::SharedPtr& _variableRet, const std::string& _value) { if (_variableRet != nullptr) { _variableRet->loadFile(_value); return true; } return false; } - template<> bool from_string>(std::shared_ptr& _variableRet, const std::u32string& _value) { + template<> bool from_string>(ememory::SharedPtr& _variableRet, const std::u32string& _value) { return from_string(_variableRet, etk::to_string(_value)); } template<> std::string to_string(const appl::Buffer& _obj) { @@ -1046,7 +1046,7 @@ namespace etk { #include // declare for signal event -template class esignal::Signal>; -template class esignal::ISignal>; +template class esignal::Signal>; +template class esignal::ISignal>; diff --git a/sources/appl/Buffer.h b/sources/appl/Buffer.h index 4754717..ed1fe1c 100644 --- a/sources/appl/Buffer.h +++ b/sources/appl/Buffer.h @@ -337,7 +337,7 @@ namespace appl { * @breif get the status of file modification. * @return true if file is modify. */ - bool isModify() { + bool isModify() const { return m_isModify; } /** @@ -590,7 +590,7 @@ namespace appl { protected: std::string m_highlightType; //!< Name of the highlight type - std::shared_ptr m_highlight; //!< internal link with the Highlight system + ememory::SharedPtr m_highlight; //!< internal link with the Highlight system std::vector m_HLDataPass1; //!< colorisation position in the current buffer pass 1 public: /** diff --git a/sources/appl/BufferManager.cpp b/sources/appl/BufferManager.cpp index 7d71dd1..27d2fa1 100644 --- a/sources/appl/BufferManager.cpp +++ b/sources/appl/BufferManager.cpp @@ -26,13 +26,13 @@ appl::BufferManager::~BufferManager() { } -std::shared_ptr appl::BufferManager::createNewBuffer() { - std::shared_ptr tmp = appl::Buffer::create(); +ememory::SharedPtr appl::BufferManager::createNewBuffer() { + ememory::SharedPtr tmp = appl::Buffer::create(); if (tmp == nullptr) { APPL_ERROR("Can not allocate the Buffer (empty)."); return nullptr; } - tmp->setParent(ewol::Object::shared_from_this()); + tmp->setParent(ewol::Object::sharedFromThis()); m_list.push_back(tmp); APPL_INFO("Create a new Buffer"); signalNewBuffer.emit(tmp->getFileName()); @@ -43,7 +43,7 @@ std::shared_ptr appl::BufferManager::createNewBuffer() { return tmp; } -std::shared_ptr appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) { +ememory::SharedPtr appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) { APPL_INFO("get('" << _fileName << "'," << _createIfNeeded << ")"); for (auto &it : m_list) { if (it == nullptr) { @@ -59,12 +59,12 @@ std::shared_ptr appl::BufferManager::get(const std::string& _fileN APPL_CRITICAL("plop"); return nullptr; } - std::shared_ptr tmp = appl::Buffer::create(); + ememory::SharedPtr tmp = appl::Buffer::create(); if (tmp == nullptr) { APPL_ERROR("Can not allocate the Buffer class : " << _fileName); return nullptr; } - tmp->setParent(ewol::Object::shared_from_this()); + tmp->setParent(ewol::Object::sharedFromThis()); tmp->loadFile(_fileName); m_list.push_back(tmp); APPL_INFO("Creata a open Buffer"); @@ -75,7 +75,7 @@ std::shared_ptr appl::BufferManager::get(const std::string& _fileN return nullptr; } -void appl::BufferManager::setBufferSelected(std::shared_ptr _bufferSelected) { +void appl::BufferManager::setBufferSelected(ememory::SharedPtr _bufferSelected) { m_bufferSelected = _bufferSelected; if (m_bufferSelected == nullptr) { APPL_ERROR("select a NULL buffer ..."); @@ -88,7 +88,7 @@ void appl::BufferManager::setBufferSelected(std::shared_ptr _buffe APPL_INFO("Set buffer selected (done)"); } -std::shared_ptr appl::BufferManager::get(int32_t _id) { +ememory::SharedPtr appl::BufferManager::get(int32_t _id) { int32_t id = 0; for (auto &it : m_list) { if (id == _id) { @@ -126,7 +126,7 @@ void appl::BufferManager::open(const std::string& _fileName) { propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(_fileName)); } -void appl::BufferManager::requestDestroyFromChild(const std::shared_ptr& _child) { +void appl::BufferManager::requestDestroyFromChild(const ememory::SharedPtr& _child) { APPL_WARNING("Buffer request a close..."); bool find = false; int32_t newValue = -1; @@ -145,7 +145,7 @@ void appl::BufferManager::requestDestroyFromChild(const std::shared_ptr& ++it; } if (find == true) { - signalRemoveBuffer.emit(std::dynamic_pointer_cast(_child)); + signalRemoveBuffer.emit(ememory::dynamicPointerCast(_child)); } if (m_bufferSelected == _child) { if ( it != m_list.end() diff --git a/sources/appl/BufferManager.h b/sources/appl/BufferManager.h index 267e96d..bd494c2 100644 --- a/sources/appl/BufferManager.h +++ b/sources/appl/BufferManager.h @@ -21,14 +21,14 @@ namespace appl { esignal::ISignal signalNewBuffer; esignal::ISignal signalSelectFile; esignal::ISignal<> signalTextSelectionChange; - esignal::ISignal> signalRemoveBuffer; + esignal::ISignal> signalRemoveBuffer; protected: BufferManager(); public: DECLARE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???"); virtual ~BufferManager(); private: - std::list> m_list; // list of all buffer curently open + std::list> m_list; // list of all buffer curently open public: /** * @brief Get a specific buffer with his name (can create a new buffer). @@ -36,7 +36,7 @@ namespace appl { * @param[in] _createIfNeeded Create the buffer if not existed. * @return a pointer on the buffer */ - std::shared_ptr get(const std::string& _fileName, bool _createIfNeeded=false); + ememory::SharedPtr get(const std::string& _fileName, bool _createIfNeeded=false); /** * @brief Load a specific file, event if it not existed: * @param[in] _fileName Name of the file to open or create. @@ -60,35 +60,41 @@ namespace appl { * @param[in] _id Number of buffer * @return pointer on the buffer */ - std::shared_ptr get(int32_t _id); + ememory::SharedPtr get(int32_t _id); /** * @brief Create a new buffer empty. * @return Created buffer or nullptr. */ - std::shared_ptr createNewBuffer(); + ememory::SharedPtr createNewBuffer(); private: - std::shared_ptr m_bufferSelected; + ememory::SharedPtr m_bufferSelected; public: /** * @brief Set the current buffer selected * @param[in] _bufferSelected Pointer on the buffer selected */ - void setBufferSelected(std::shared_ptr _bufferSelected); + void setBufferSelected(ememory::SharedPtr _bufferSelected); /** * @brief Get the current buffer selected * @return Pointer on the buffer selected */ - std::shared_ptr getBufferSelected() { + ememory::SharedPtr getBufferSelected() { return m_bufferSelected; }; private: - void requestDestroyFromChild(const std::shared_ptr& _child); + void requestDestroyFromChild(const ememory::SharedPtr& _child); public: // generic iterators: - std::list>::const_iterator begin() const { + std::list>::const_iterator begin() const { return m_list.begin(); } - std::list>::const_iterator end() const { + std::list>::const_iterator end() const { + return m_list.end(); + } + std::list>::iterator begin() { + return m_list.begin(); + } + std::list>::iterator end() { return m_list.end(); } }; diff --git a/sources/appl/Gui/BufferView.cpp b/sources/appl/Gui/BufferView.cpp index a2b7c05..5404a85 100644 --- a/sources/appl/Gui/BufferView.cpp +++ b/sources/appl/Gui/BufferView.cpp @@ -50,9 +50,9 @@ void BufferView::init() { propertyHide.set(true); propertyCanFocus.set(true); if (m_bufferManager != nullptr) { - m_bufferManager->signalNewBuffer.connect(shared_from_this(), &BufferView::onCallbackNewBuffer); - m_bufferManager->signalSelectFile.connect(shared_from_this(), &BufferView::onCallbackselectNewFile); - m_bufferManager->signalRemoveBuffer.connect(shared_from_this(), &BufferView::onCallbackBufferRemoved); + m_bufferManager->signalNewBuffer.connect(sharedFromThis(), &BufferView::onCallbackNewBuffer); + m_bufferManager->signalSelectFile.connect(sharedFromThis(), &BufferView::onCallbackselectNewFile); + m_bufferManager->signalRemoveBuffer.connect(sharedFromThis(), &BufferView::onCallbackBufferRemoved); } } @@ -82,14 +82,14 @@ void BufferView::insertAlphabetic(const appl::dataBufferStruct& _dataStruct, boo } void BufferView::onCallbackNewBuffer(const std::string& _value) { - std::shared_ptr buffer = m_bufferManager->get(_value); + ememory::SharedPtr buffer = m_bufferManager->get(_value); if (buffer == nullptr) { APPL_ERROR("event on element nor exist : " << _value); return; } - buffer->signalIsSave.connect(shared_from_this(), &BufferView::onCallbackIsSave); - buffer->signalIsModify.connect(shared_from_this(), &BufferView::onCallbackIsModify); - buffer->signalChangeName.connect(shared_from_this(), &BufferView::onCallbackChangeName); + buffer->signalIsSave.connect(sharedFromThis(), &BufferView::onCallbackIsSave); + buffer->signalIsModify.connect(sharedFromThis(), &BufferView::onCallbackIsModify); + buffer->signalChangeName.connect(sharedFromThis(), &BufferView::onCallbackChangeName); appl::dataBufferStruct tmp(_value, buffer); if (m_openOrderMode == true) { m_list.push_back(tmp); @@ -138,7 +138,7 @@ void BufferView::onCallbackChangeName() { markToRedraw(); } -void BufferView::onCallbackBufferRemoved(const std::shared_ptr& _buffer) { +void BufferView::onCallbackBufferRemoved(const ememory::SharedPtr& _buffer) { APPL_ERROR("request remove buffer:"); auto it = m_list.begin(); while (it != m_list.end()) { diff --git a/sources/appl/Gui/BufferView.h b/sources/appl/Gui/BufferView.h index 7d1511c..275d8f4 100644 --- a/sources/appl/Gui/BufferView.h +++ b/sources/appl/Gui/BufferView.h @@ -15,8 +15,8 @@ namespace appl { class dataBufferStruct { public: etk::FSNode m_bufferName; - std::shared_ptr m_buffer; - dataBufferStruct(const std::string& _bufferName, const std::shared_ptr& _buffer) : + ememory::SharedPtr m_buffer; + dataBufferStruct(const std::string& _bufferName, const ememory::SharedPtr& _buffer) : m_bufferName(_bufferName), m_buffer(_buffer) { @@ -30,9 +30,9 @@ namespace appl { using BufferViewWeak = ememory::WeakPtr; class BufferView : public ewol::widget::List { private: - std::shared_ptr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager private: - std::shared_ptr m_paintingProperties; //!< element painting property + ememory::SharedPtr m_paintingProperties; //!< element painting property int32_t m_colorBackground1; int32_t m_colorBackground2; int32_t m_colorBackgroundSelect; @@ -72,6 +72,6 @@ class BufferView : public ewol::widget::List { void onCallbackIsModify(); void onCallbackNewBuffer(const std::string& _value); void onCallbackselectNewFile(const std::string& _value); - void onCallbackBufferRemoved(const std::shared_ptr& _buffer); + void onCallbackBufferRemoved(const ememory::SharedPtr& _buffer); }; diff --git a/sources/appl/Gui/MainWindows.cpp b/sources/appl/Gui/MainWindows.cpp index 574a162..f69892e 100644 --- a/sources/appl/Gui/MainWindows.cpp +++ b/sources/appl/Gui/MainWindows.cpp @@ -50,10 +50,10 @@ class ParameterAboutGui : public ewol::widget::Sizer { void init() { propertyMode.setDirectCheck(ewol::widget::Sizer::modeVert); ewol::widget::Sizer::init(); - std::shared_ptr mySpacer; + ememory::SharedPtr mySpacer; mySpacer = ewol::widget::Spacer::create(); - if (nullptr == mySpacer) { + if (mySpacer == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->propertyExpand.set(bvec2(true,true)); @@ -71,8 +71,8 @@ class ParameterAboutGui : public ewol::widget::Sizer { tmpLabel += " libPng, ogg-tremor, portaudio, libZip
"; tmpLabel += " tinyXml, freetype, agg2.4, etk
"; tmpLabel += ""; - std::shared_ptr myLabel = ewol::widget::Label::create(); - if (nullptr == myLabel) { + ememory::SharedPtr myLabel = ewol::widget::Label::create(); + if (myLabel == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { myLabel->propertyValue.set(tmpLabel); @@ -96,9 +96,9 @@ void MainWindows::init() { ewol::widget::SizerShared mySizerVert; ewol::widget::SizerShared mySizerVert2; ewol::widget::SizerShared mySizerHori; - std::shared_ptr myTextView; - std::shared_ptr myTextView2; - std::shared_ptr myBufferView; + ememory::SharedPtr myTextView; + ememory::SharedPtr myTextView2; + ememory::SharedPtr myBufferView; ewol::widget::MenuShared myMenu; // load buffer manager: @@ -204,7 +204,7 @@ void MainWindows::init() { myMenu->add(idMenugDisplay, "_T{Unsplit}", "", "menu:split:disable"); myMenu->add(idMenugDisplay, "_T{Vertical}", "", "menu:split:vert"); myMenu->add(idMenugDisplay, "_T{Horizontal}", "", "menu:split:hori"); - myMenu->signalSelect.connect(shared_from_this(), &MainWindows::onCallbackMenuEvent); + myMenu->signalSelect.connect(sharedFromThis(), &MainWindows::onCallbackMenuEvent); m_widgetLabelFileName = ewol::widget::Label::create(); m_widgetLabelFileName->propertyValue.set("FileName"); m_widgetLabelFileName->propertyName.set("appl-widget-display-name"); @@ -227,8 +227,8 @@ void MainWindows::init() { shortCutAdd("ctrl+f", "menu:search"); shortCutAdd("F12", "menu:reloade-shader"); // TODO : auto-connect on shortcut event ==> maybe do beter later ... - signalShortcut.connect(shared_from_this(), &MainWindows::onCallbackShortCut); - m_bufferManager->signalSelectFile.connect(shared_from_this(), &MainWindows::onCallbackselectNewFile); + signalShortcut.connect(sharedFromThis(), &MainWindows::onCallbackShortCut); + m_bufferManager->signalSelectFile.connect(sharedFromThis(), &MainWindows::onCallbackselectNewFile); } @@ -250,7 +250,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { } else if (_value == "menu:open") { displayOpen(); } else if (_value == "menu:close") { - std::shared_ptr worker = appl::WorkerCloseFile::create(); + ememory::SharedPtr worker = appl::WorkerCloseFile::create(); worker->startAction(""); } else if (_value == "menu:close-all") { appl::WorkerCloseAllFile::create(); @@ -273,7 +273,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { if (m_widgetSearch->isSelectSearch()) { m_widgetSearch->propertyHide.set(true); if (m_viewerManager != nullptr) { - std::shared_ptr tmp = m_viewerManager->getViewerSelected(); + ememory::SharedPtr tmp = m_viewerManager->getViewerSelected(); if (tmp != nullptr) { tmp->keepFocus(); } @@ -293,7 +293,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { if (m_widgetSearch->isSelectReplace()) { m_widgetSearch->propertyHide.set(true); if (m_viewerManager != nullptr) { - std::shared_ptr tmp = m_viewerManager->getViewerSelected(); + ememory::SharedPtr tmp = m_viewerManager->getViewerSelected(); if (tmp != nullptr) { tmp->keepFocus(); } @@ -350,7 +350,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); return; } - std::shared_ptr tmpBuffer = m_bufferManager->get(_msg.getData()); + ememory::SharedPtr tmpBuffer = m_bufferManager->get(_msg.getData()); if (tmpBuffer == nullptr) { APPL_ERROR("Error to get the buffer : " << _msg.getData()); return; @@ -369,7 +369,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); return; } - std::shared_ptr tmpBuffer = m_bufferManager->get(_msg.getData()); + ememory::SharedPtr tmpBuffer = m_bufferManager->get(_msg.getData()); if (tmpBuffer == nullptr) { APPL_ERROR("Error to get the buffer : " << _msg.getData()); return; @@ -380,7 +380,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); return; } - std::shared_ptr tmpBuffer = m_bufferManager->get(_msg.getData()); + ememory::SharedPtr tmpBuffer = m_bufferManager->get(_msg.getData()); if (tmpBuffer == nullptr) { APPL_ERROR("Error to get the buffer : " << _msg.getData()); return; @@ -392,7 +392,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) { */ void MainWindows::displayOpen() { - std::shared_ptr tmpWidget = ewol::widget::FileChooser::create(); + ememory::SharedPtr tmpWidget = ewol::widget::FileChooser::create(); if (tmpWidget == nullptr) { APPL_ERROR("Can not open File chooser !!! "); return; @@ -404,48 +404,48 @@ void MainWindows::displayOpen() { return; } // Get a ref on the buffer selected (if null, no buffer was selected ...) - std::shared_ptr tmpBuffer = m_bufferManager->getBufferSelected(); + ememory::SharedPtr tmpBuffer = m_bufferManager->getBufferSelected(); if (tmpBuffer != nullptr) { etk::FSNode tmpFile = tmpBuffer->getFileName(); tmpWidget->propertyPath.set(tmpFile.getNameFolder()); } // apply widget pop-up ... popUpWidgetPush(tmpWidget); - tmpWidget->signalValidate.connect(shared_from_this(), &MainWindows::onCallbackPopUpFileSelected); + tmpWidget->signalValidate.connect(sharedFromThis(), &MainWindows::onCallbackPopUpFileSelected); } void MainWindows::displayProperty() { // Request the parameter GUI - std::shared_ptr tmpWidget = ewol::widget::Parameter::create(); - if (nullptr == tmpWidget) { + ememory::SharedPtr tmpWidget = ewol::widget::Parameter::create(); + if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); - } else { - #if 0 - std::string menuDescription = "Properties\n"; - menuDescription += "\n"; - menuDescription += " \n"; - menuDescription += "\n"; - menuDescription += "\n"; - menuDescription += " \n"; - menuDescription += " \n"; - menuDescription += " \n"; - menuDescription += "\n"; - - tmpWidget->setMenu(menuDescription); - #else - tmpWidget->propertyLabelTitle.set("_T{Properties}"); - popUpWidgetPush(tmpWidget); - tmpWidget->menuAddGroup("_T{Editor}"); - std::shared_ptr tmpSubWidget = globals::ParameterGlobalsGui::create(); - tmpWidget->menuAdd("_T{Editor}", "", tmpSubWidget); - tmpWidget->menuAdd("_T{Font & Color}", "", nullptr); - tmpWidget->menuAdd("_T{Highlight}", "", nullptr); - tmpWidget->menuAddGroup("_T{General}"); - tmpWidget->menuAdd("_T{Display}", "", nullptr); - tmpSubWidget = ParameterAboutGui::create(); - tmpWidget->menuAdd("_T{About}", "", tmpSubWidget); - #endif + return; } + #if 0 + std::string menuDescription = "Properties\n"; + menuDescription += "\n"; + menuDescription += " \n"; + menuDescription += "\n"; + menuDescription += "\n"; + menuDescription += " \n"; + menuDescription += " \n"; + menuDescription += " \n"; + menuDescription += "\n"; + + tmpWidget->setMenu(menuDescription); + #else + tmpWidget->propertyLabelTitle.set("_T{Properties}"); + popUpWidgetPush(tmpWidget); + tmpWidget->menuAddGroup("_T{Editor}"); + ememory::SharedPtr tmpSubWidget = globals::ParameterGlobalsGui::create(); + tmpWidget->menuAdd("_T{Editor}", "", tmpSubWidget); + tmpWidget->menuAdd("_T{Font & Color}", "", nullptr); + tmpWidget->menuAdd("_T{Highlight}", "", nullptr); + tmpWidget->menuAddGroup("_T{General}"); + tmpWidget->menuAdd("_T{Display}", "", nullptr); + tmpSubWidget = ParameterAboutGui::create(); + tmpWidget->menuAdd("_T{About}", "", tmpSubWidget); + #endif } void MainWindows::onCallbackselectNewFile(const std::string& _value) { @@ -458,7 +458,7 @@ void MainWindows::onCallbackselectNewFile(const std::string& _value) { m_connectionModify.disconnect(); m_connectionSaveName.disconnect(); onCallbackTitleUpdate(); - std::shared_ptr tmpp = m_bufferManager->getBufferSelected(); + ememory::SharedPtr tmpp = m_bufferManager->getBufferSelected(); if (tmpp != nullptr) { m_connectionSave = tmpp->signalIsSave.connect(this, &MainWindows::onCallbackTitleUpdate); m_connectionModify = tmpp->signalIsModify.connect(this, &MainWindows::onCallbackTitleUpdate); @@ -479,7 +479,7 @@ void MainWindows::onCallbackTitleUpdate() { return; } // select a new Buffer ==> change title: - std::shared_ptr tmpp = m_bufferManager->getBufferSelected(); + ememory::SharedPtr tmpp = m_bufferManager->getBufferSelected(); if (tmpp == nullptr) { propertyTitle.set("Edn"); if (m_widgetLabelFileName != nullptr) { @@ -494,44 +494,44 @@ void MainWindows::onCallbackTitleUpdate() { } } -void MainWindows::saveAsPopUp(const std::shared_ptr& _buffer) { +void MainWindows::saveAsPopUp(const ememory::SharedPtr& _buffer) { if (_buffer == nullptr) { APPL_ERROR("Call With nullptr input..."); return; } - std::shared_ptr tmpObject = appl::WorkerSaveFile::create("buffer-name", _buffer->getFileName()); + ememory::SharedPtr tmpObject = appl::WorkerSaveFile::create("buffer-name", _buffer->getFileName()); } -void MainWindows::closeNotSavedFile(const std::shared_ptr& _buffer) { +void MainWindows::closeNotSavedFile(const ememory::SharedPtr& _buffer) { if (_buffer == nullptr) { APPL_ERROR("Call With nullptr input..."); return; } - std::shared_ptr tmpPopUp = ewol::widget::StdPopUp::create(); + ememory::SharedPtr tmpPopUp = ewol::widget::StdPopUp::create(); if (tmpPopUp == nullptr) { APPL_ERROR("Can not create a simple pop-up"); return; } tmpPopUp->propertyTitle.set("_T{Close un-saved file:}"); tmpPopUp->propertyComment.set("_T{The file named:} \"" + _buffer->getFileName() + "\" _T{is curently modify.}
_T{If you don't saves these modifications,
they will be definitly lost...}"); - std::shared_ptr bt = nullptr; + ememory::SharedPtr bt = nullptr; if (_buffer->hasFileName() == true) { bt = tmpPopUp->addButton("_T{Save}", true); if (bt != nullptr) { // TODO : The element is removed before beeing pressed - // TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestSaveFile, _buffer->getFileName()); - // TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); + // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFile, _buffer->getFileName()); + // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); } } bt = tmpPopUp->addButton("_T{Save As}", true); if (bt != nullptr) { - // TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestSaveFileAs, _buffer->getFileName()); - //bt->signalPressed.connect(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); + // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFileAs, _buffer->getFileName()); + //bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); // TODO : Request the close when saved ... } bt = tmpPopUp->addButton("_T{Close}", true); if (bt != nullptr) { - // TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); + // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); } tmpPopUp->addButton("_T{Cancel}", true); tmpPopUp->propertyCloseOutEvent.set(true); diff --git a/sources/appl/Gui/MainWindows.h b/sources/appl/Gui/MainWindows.h index 110e378..ea8f31a 100644 --- a/sources/appl/Gui/MainWindows.h +++ b/sources/appl/Gui/MainWindows.h @@ -29,18 +29,18 @@ class MainWindows : public ewol::widget::Windows { DECLARE_FACTORY(MainWindows); virtual ~MainWindows(); private: - std::shared_ptr m_bufferManager; //!< handle on the buffer manager - std::shared_ptr m_viewerManager; //!< handle on the buffer manager + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_viewerManager; //!< handle on the buffer manager /** * @brief Display a pop-up to the select the name of the file. * @param[in] _buffer Buffer that might be saved with a new name. */ - void saveAsPopUp(const std::shared_ptr& _buffer); + void saveAsPopUp(const ememory::SharedPtr& _buffer); /** * @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved. * @param[in] _buffer Buffer that might be close. */ - void closeNotSavedFile(const std::shared_ptr& _buffer); + void closeNotSavedFile(const ememory::SharedPtr& _buffer); void displayOpen(); void displayProperty(); private: diff --git a/sources/appl/Gui/Search.cpp b/sources/appl/Gui/Search.cpp index 7cb3b4e..3a35e9f 100644 --- a/sources/appl/Gui/Search.cpp +++ b/sources/appl/Gui/Search.cpp @@ -23,23 +23,23 @@ void appl::widget::Search::init() { loadFromFile("DATA:GUI-Search.xml"); m_viewerManager = appl::ViewerManager::create(); // link event - subBind(ewol::widget::Button, "SEARCH:close", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackHide); - subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackSearchValue); - subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackSearchEntryValidate); - subBind(ewol::widget::Button, "SEARCH:search", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackSearch); - subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackReplaceValue); - subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackReplaceEntryValidate); - subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackReplace); - subBind(ewol::widget::Button, "SEARCH:case", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackCase); - subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackWrap); - subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackForward); + subBind(ewol::widget::Button, "SEARCH:close", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackHide); + subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackSearchValue); + subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackSearchEntryValidate); + subBind(ewol::widget::Button, "SEARCH:search", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackSearch); + subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceValue); + subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceEntryValidate); + subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackReplace); + subBind(ewol::widget::Button, "SEARCH:case", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackCase); + subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap); + subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward); // set default properties propertySetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive)); propertySetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap)); propertySetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward)); // get widget - m_searchEntry = std::dynamic_pointer_cast(getSubObjectNamed("SEARCH:search-entry")); - m_replaceEntry = std::dynamic_pointer_cast(getSubObjectNamed("SEARCH:replace-entry")); + m_searchEntry = ememory::dynamicPointerCast(getSubObjectNamed("SEARCH:search-entry")); + m_replaceEntry = ememory::dynamicPointerCast(getSubObjectNamed("SEARCH:replace-entry")); // basicly hiden ... propertyHide.set(true); } @@ -53,7 +53,7 @@ void appl::widget::Search::find() { APPL_WARNING("No viewer manager selected!!!"); return; } - std::shared_ptr viewer = m_viewerManager->getViewerSelected(); + ememory::SharedPtr viewer = m_viewerManager->getViewerSelected(); if (viewer == nullptr) { APPL_INFO("No viewer selected!!!"); return; @@ -89,7 +89,7 @@ void appl::widget::Search::replace() { APPL_WARNING("No viewer manager selected!!!"); return; } - std::shared_ptr viewer = m_viewerManager->getViewerSelected(); + ememory::SharedPtr viewer = m_viewerManager->getViewerSelected(); if (viewer == nullptr) { APPL_INFO("No viewer selected!!!"); return; diff --git a/sources/appl/Gui/Search.h b/sources/appl/Gui/Search.h index c336702..d1c7d8f 100644 --- a/sources/appl/Gui/Search.h +++ b/sources/appl/Gui/Search.h @@ -16,12 +16,12 @@ namespace appl { using SearchWeak = ememory::WeakPtr; class Search : public ewol::widget::Composer { private: - std::shared_ptr m_viewerManager; //!< handle on the buffer manager + ememory::SharedPtr m_viewerManager; //!< handle on the buffer manager bool m_forward; bool m_caseSensitive; bool m_wrap; - std::shared_ptr m_searchEntry; - std::shared_ptr m_replaceEntry; + ememory::SharedPtr m_searchEntry; + ememory::SharedPtr m_replaceEntry; std::u32string m_searchData; std::u32string m_replaceData; protected: diff --git a/sources/appl/Gui/TagFileList.h b/sources/appl/Gui/TagFileList.h index d9c81c8..adecce4 100644 --- a/sources/appl/Gui/TagFileList.h +++ b/sources/appl/Gui/TagFileList.h @@ -31,7 +31,7 @@ namespace appl { int32_t m_selectedLine; std::vector m_list; protected: - std::shared_ptr m_colorProperty; //!< theme color property. + ememory::SharedPtr m_colorProperty; //!< theme color property. int32_t m_colorIdText; //!< Color of the text. int32_t m_colorIdBackground1; //!< Color of the Background. int32_t m_colorIdBackground2; //!< Color of the Background 2. diff --git a/sources/appl/Gui/TagFileSelection.cpp b/sources/appl/Gui/TagFileSelection.cpp index ae7c9b2..785e8f8 100644 --- a/sources/appl/Gui/TagFileSelection.cpp +++ b/sources/appl/Gui/TagFileSelection.cpp @@ -35,54 +35,54 @@ void appl::TagFileSelection::init() { #endif mySizerVert = ewol::widget::Sizer::create(); - if (nullptr == mySizerVert) { + if (mySizerVert == nullptr) { + EWOL_ERROR("Can not allocate widget == > display might be in error"); + return; + } + mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert); + mySizerVert->propertyLockExpand.set(bvec2(true,true)); + mySizerVert->propertyExpand.set(bvec2(true,true)); + // set it in the pop-up-system : + setSubWidget(mySizerVert); + ewol::WidgetShared compose = ewol::widget::composerGenerateString( + "\n" + " \n" + " \n" + " \n" + "\n"); + mySizerVert->subWidgetAdd(compose); + externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsSelection); + externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsCancel); + + m_listTag = appl::TagFileList::create(); + if (m_listTag == nullptr) { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { - mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert); - mySizerVert->propertyLockExpand.set(bvec2(true,true)); - mySizerVert->propertyExpand.set(bvec2(true,true)); - // set it in the pop-up-system : - setSubWidget(mySizerVert); - ewol::WidgetShared compose = ewol::widget::composerGenerateString( - "\n" - " \n" - " \n" - " \n" - "\n"); - mySizerVert->subWidgetAdd(compose); - externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsSelection); - externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsCancel); - - m_listTag = appl::TagFileList::create(); - if (m_listTag == nullptr) { - EWOL_ERROR("Can not allocate widget == > display might be in error"); - } else { - m_listTag->signalValidate.connect(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListValidate); - m_listTag->signalSelect.connect(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListSelect); - m_listTag->signalUnSelect.connect(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListUnSelect); - m_listTag->propertyExpand.set(bvec2(true,true)); - m_listTag->propertyFill.set(bvec2(true,true)); - mySizerVert->subWidgetAdd(m_listTag); - } - - ewol::widget::LabelShared myWidgetTitle = ewol::widget::Label::create(); - if (myWidgetTitle == nullptr) { - EWOL_ERROR("Can not allocate widget == > display might be in error"); - } else { - myWidgetTitle->propertyValue.set("Ctags Jump Selection ..."); - mySizerVert->subWidgetAdd(myWidgetTitle); - } + m_listTag->signalValidate.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListValidate); + m_listTag->signalSelect.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListSelect); + m_listTag->signalUnSelect.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListUnSelect); + m_listTag->propertyExpand.set(bvec2(true,true)); + m_listTag->propertyFill.set(bvec2(true,true)); + mySizerVert->subWidgetAdd(m_listTag); } + + ewol::widget::LabelShared myWidgetTitle = ewol::widget::Label::create(); + if (myWidgetTitle == nullptr) { + EWOL_ERROR("Can not allocate widget == > display might be in error"); + return; + } + myWidgetTitle->propertyValue.set("Ctags Jump Selection ..."); + mySizerVert->subWidgetAdd(myWidgetTitle); } diff --git a/sources/appl/Gui/TagFileSelection.h b/sources/appl/Gui/TagFileSelection.h index 0c8c030..4f24b1a 100644 --- a/sources/appl/Gui/TagFileSelection.h +++ b/sources/appl/Gui/TagFileSelection.h @@ -14,7 +14,7 @@ namespace appl { esignal::ISignal signalSelect; esignal::ISignal<> signalCancel; private: - std::shared_ptr m_listTag; + ememory::SharedPtr m_listTag; std::string m_eventNamed; public: TagFileSelection(); diff --git a/sources/appl/Gui/TextViewer.cpp b/sources/appl/Gui/TextViewer.cpp index 84357a1..6fdad55 100644 --- a/sources/appl/Gui/TextViewer.cpp +++ b/sources/appl/Gui/TextViewer.cpp @@ -55,7 +55,7 @@ void appl::TextViewer::init() { m_pluginManager->connect(*this); // last created has focus ... setCurrentSelect(); - signalShortcut.connect(shared_from_this(), &appl::TextViewer::onCallbackShortCut); + signalShortcut.connect(sharedFromThis(), &appl::TextViewer::onCallbackShortCut); /* registerMultiCast(ednMsgBufferId); @@ -65,7 +65,7 @@ void appl::TextViewer::init() { registerMultiCast(appl::MsgSelectGotoLineSelect); */ if (m_bufferManager != nullptr) { - m_bufferManager->signalSelectFile.connect(shared_from_this(), &appl::TextViewer::onCallbackselectNewFile); + m_bufferManager->signalSelectFile.connect(sharedFromThis(), &appl::TextViewer::onCallbackselectNewFile); } else { APPL_CRITICAL("Buffer manager has not been created at the init"); } @@ -90,11 +90,11 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) { // reset scroll: if (m_buffer != nullptr) { - m_buffer->signals.disconnect(shared_from_this()); + m_buffer->signals.disconnect(sharedFromThis()); bool needAdd = true; auto it = m_drawingRemenber.begin(); while (it != m_drawingRemenber.end()) { - std::shared_ptr tmpBuff = it->first.lock(); + ememory::SharedPtr tmpBuff = it->first.lock(); if (tmpBuff == nullptr) { it = m_drawingRemenber.erase(it); continue; @@ -108,7 +108,7 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) { ++it; } if (needAdd == true) { - m_drawingRemenber.push_back(std::make_pair(std::weak_ptr(m_buffer), m_originScrooled)); + m_drawingRemenber.push_back(std::make_pair(ememory::WeakPtr(m_buffer), m_originScrooled)); APPL_VERBOSE("Push origin : " << m_originScrooled); } } @@ -117,8 +117,8 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) { m_buffer = m_bufferManager->get(_value); m_bufferManager->setBufferSelected(m_buffer); if (m_buffer != nullptr) { - m_buffer->signalIsModify.connect(shared_from_this(), &appl::TextViewer::onCallbackIsModify); - m_buffer->signalSelectChange.connect(shared_from_this(), &appl::TextViewer::onCallbackSelectChange); + m_buffer->signalIsModify.connect(sharedFromThis(), &appl::TextViewer::onCallbackIsModify); + m_buffer->signalSelectChange.connect(sharedFromThis(), &appl::TextViewer::onCallbackSelectChange); for (auto element : m_drawingRemenber) { if (element.first.lock() == m_buffer) { m_originScrooled = element.second; @@ -979,13 +979,13 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo void appl::TextViewer::setCurrentSelect() { if (m_viewerManager != nullptr) { - m_viewerManager->setViewerSelected(std::dynamic_pointer_cast(shared_from_this()), m_buffer); + m_viewerManager->setViewerSelected(ememory::dynamicPointerCast(sharedFromThis()), m_buffer); } } bool appl::TextViewer::isSelectedLast() { if (m_viewerManager != nullptr) { - return m_viewerManager->isLastSelected(std::dynamic_pointer_cast(shared_from_this())); + return m_viewerManager->isLastSelected(ememory::dynamicPointerCast(sharedFromThis())); } return false; } diff --git a/sources/appl/Gui/TextViewer.h b/sources/appl/Gui/TextViewer.h index 9efcf8c..00284f5 100644 --- a/sources/appl/Gui/TextViewer.h +++ b/sources/appl/Gui/TextViewer.h @@ -26,7 +26,7 @@ namespace appl { eproperty::Value propertyFontName; //!< name of the font to display text. eproperty::Value propertyFontSize; //!< Size of the font to display text. - std::shared_ptr m_paintingProperties; //!< element painting property + ememory::SharedPtr m_paintingProperties; //!< element painting property int32_t m_colorBackground; int32_t m_colorSpace; int32_t m_colorTabulation; @@ -35,9 +35,9 @@ namespace appl { int32_t m_colorSelection; int32_t m_colorNormal; private: - std::shared_ptr m_bufferManager; //!< handle on the buffer manager - std::shared_ptr m_pluginManager; //!< Plugin manager interface - std::shared_ptr m_viewerManager; //!< handle on the buffer manager + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_pluginManager; //!< Plugin manager interface + ememory::SharedPtr m_viewerManager; //!< handle on the buffer manager protected: TextViewer(); void init(); @@ -45,19 +45,19 @@ namespace appl { DECLARE_FACTORY(TextViewer); virtual ~TextViewer(); private: - std::shared_ptr m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer) + ememory::SharedPtr m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer) public: /** * @brief Get the buffer property (only for the class : template class TextViewerPluginData) * @return pointer on buffer */ - std::shared_ptr internalGetBuffer() { + ememory::SharedPtr internalGetBuffer() { return m_buffer; } private: ewol::compositing::Text m_displayText; //!< Text display properties. ewol::compositing::Drawing m_displayDrawing; //!< Other display requested. - std::vector, vec2>> m_drawingRemenber; + std::vector, vec2>> m_drawingRemenber; public: virtual void onChangePropertyFontSize(); virtual void onChangePropertyFontName(); diff --git a/sources/appl/Gui/ViewerManager.cpp b/sources/appl/Gui/ViewerManager.cpp index 27a867c..2d3eb6c 100644 --- a/sources/appl/Gui/ViewerManager.cpp +++ b/sources/appl/Gui/ViewerManager.cpp @@ -21,11 +21,15 @@ appl::ViewerManager::~ViewerManager() { } -bool appl::ViewerManager::isLastSelected(const std::shared_ptr& _viewer) { +ememory::SharedPtr appl::ViewerManager::getViewerSelected() { + return m_viewer.lock(); +} + +bool appl::ViewerManager::isLastSelected(const ememory::SharedPtr& _viewer) { return m_viewer.lock() == _viewer; } -void appl::ViewerManager::setViewerSelected(const std::shared_ptr& _viewer, const std::shared_ptr& _buffer) { +void appl::ViewerManager::setViewerSelected(const ememory::SharedPtr& _viewer, const ememory::SharedPtr& _buffer) { if (m_viewer.lock() == _viewer) { return; } diff --git a/sources/appl/Gui/ViewerManager.h b/sources/appl/Gui/ViewerManager.h index 5cff31b..c18551b 100644 --- a/sources/appl/Gui/ViewerManager.h +++ b/sources/appl/Gui/ViewerManager.h @@ -22,26 +22,24 @@ namespace appl { DECLARE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???"); virtual ~ViewerManager(); private: - std::shared_ptr m_bufferManager; //!< handle on the buffer manager - std::weak_ptr m_viewer; + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager + ememory::WeakPtr m_viewer; public: /** * @brief Set the current buffer selected * @param[in] _viewer Pointer on the viewer selected */ - void setViewerSelected(const std::shared_ptr& _viewer, const std::shared_ptr& _buffer); + void setViewerSelected(const ememory::SharedPtr& _viewer, const ememory::SharedPtr& _buffer); /** * @brief Get the current buffer selected * @return Pointer on the buffer selected */ - std::shared_ptr getViewerSelected() { - return m_viewer.lock(); - }; + ememory::SharedPtr getViewerSelected(); /** * @breif Check if the element is the last request selection * @param[in] _viewer element selected. * @return true if the element is selected */ - bool isLastSelected(const std::shared_ptr& _viewer); + bool isLastSelected(const ememory::SharedPtr& _viewer); }; } diff --git a/sources/appl/Gui/WorkerCloseAllFile.cpp b/sources/appl/Gui/WorkerCloseAllFile.cpp index 87db59c..6449504 100644 --- a/sources/appl/Gui/WorkerCloseAllFile.cpp +++ b/sources/appl/Gui/WorkerCloseAllFile.cpp @@ -22,7 +22,7 @@ void appl::WorkerCloseAllFile::init() { } // List all current open file : for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) { - std::shared_ptr tmpBuffer = m_bufferManager->get(iii); + ememory::SharedPtr tmpBuffer = m_bufferManager->get(iii); if (tmpBuffer == nullptr) { continue; } @@ -40,7 +40,7 @@ void appl::WorkerCloseAllFile::init() { } // create the worker : m_worker = appl::WorkerCloseFile::create(); - m_worker->signalCloseDone.connect(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone); + m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone); m_worker->startAction(m_bufferNameList.front()); // remove first element : m_bufferNameList.erase(m_bufferNameList.begin()); @@ -65,7 +65,7 @@ void appl::WorkerCloseAllFile::onCallbackCloseDone() { } // create the worker : m_worker = appl::WorkerCloseFile::create(); - m_worker->signalCloseDone.connect(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone); + m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone); m_worker->startAction(m_bufferNameList.front()); // remove first element : m_bufferNameList.erase(m_bufferNameList.begin()); diff --git a/sources/appl/Gui/WorkerCloseAllFile.h b/sources/appl/Gui/WorkerCloseAllFile.h index 85d70d2..1cb2da4 100644 --- a/sources/appl/Gui/WorkerCloseAllFile.h +++ b/sources/appl/Gui/WorkerCloseAllFile.h @@ -18,8 +18,8 @@ namespace appl { virtual ~WorkerCloseAllFile(); private: std::vector m_bufferNameList; - std::shared_ptr m_worker; //! pop-up element that is open... - std::shared_ptr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_worker; //! pop-up element that is open... + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager public: // callback function void onCallbackCloseDone(); }; diff --git a/sources/appl/Gui/WorkerCloseFile.cpp b/sources/appl/Gui/WorkerCloseFile.cpp index 8a5203b..2c64ce3 100644 --- a/sources/appl/Gui/WorkerCloseFile.cpp +++ b/sources/appl/Gui/WorkerCloseFile.cpp @@ -33,7 +33,7 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) { } if (m_bufferName == "") { // need to find the curent file ... - std::shared_ptr tmpp = m_bufferManager->getBufferSelected(); + ememory::SharedPtr tmpp = m_bufferManager->getBufferSelected(); if (tmpp == nullptr) { APPL_ERROR("No selected buffer now ..."); destroy(); @@ -59,7 +59,7 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) { return; } - std::shared_ptr tmpPopUp = ewol::widget::StdPopUp::create(); + ememory::SharedPtr tmpPopUp = ewol::widget::StdPopUp::create(); if (tmpPopUp == nullptr) { APPL_ERROR("Can not create a simple pop-up"); destroy(); @@ -67,27 +67,27 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) { } tmpPopUp->propertyTitle.set("_T{Close un-saved file:}"); tmpPopUp->propertyComment.set("_T{The file named:} '" + m_buffer->getFileName() + "' _T{is curently modify.}
_T{If you don't saves these modifications,}
_T{they will be definitly lost...}"); - std::shared_ptr bt = nullptr; + ememory::SharedPtr bt = nullptr; if (m_buffer->hasFileName() == true) { bt = tmpPopUp->addButton("_T{Save}", true); if (bt != nullptr) { - bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveValidate); + bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveValidate); } } bt = tmpPopUp->addButton("_T{Save As}", true); if (bt != nullptr) { - bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveAsValidate); + bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveAsValidate); } bt = tmpPopUp->addButton("_T{Close}", true); if (bt != nullptr) { - bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose); + bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose); } bt = tmpPopUp->addButton("_T{Cancel}", true); if (bt != nullptr) { - bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel); + bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel); } tmpPopUp->propertyCloseOutEvent.set(true); - std::shared_ptr tmpWindows = ewol::getContext().getWindows(); + ememory::SharedPtr tmpWindows = ewol::getContext().getWindows(); if (tmpWindows == nullptr) { APPL_ERROR("Error to get the windows."); destroy(); @@ -113,8 +113,8 @@ void appl::WorkerCloseFile::onCallbackSaveAsValidate() { } m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferName); if (m_worker != nullptr) { - m_worker->signalSaveDone.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose); - m_worker->signalAbort.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel); + m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose); + m_worker->signalAbort.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel); } } diff --git a/sources/appl/Gui/WorkerCloseFile.h b/sources/appl/Gui/WorkerCloseFile.h index b572302..aab67a9 100644 --- a/sources/appl/Gui/WorkerCloseFile.h +++ b/sources/appl/Gui/WorkerCloseFile.h @@ -28,9 +28,9 @@ namespace appl { void startAction(const std::string& _bufferName); private: std::string m_bufferName; - std::shared_ptr m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer - std::shared_ptr m_worker; //! sub-worker element... - std::shared_ptr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer + ememory::SharedPtr m_worker; //! sub-worker element... + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager public: // callback Functions void onCallbackSaveAsValidate(); void onCallbackSaveValidate(); diff --git a/sources/appl/Gui/WorkerSaveAllFile.cpp b/sources/appl/Gui/WorkerSaveAllFile.cpp index b1a4e61..6944888 100644 --- a/sources/appl/Gui/WorkerSaveAllFile.cpp +++ b/sources/appl/Gui/WorkerSaveAllFile.cpp @@ -47,7 +47,7 @@ void appl::WorkerSaveAllFile::init() { destroy(); return; } - m_worker->signalSaveDone.connect(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone); + m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone); } appl::WorkerSaveAllFile::~WorkerSaveAllFile() { @@ -71,6 +71,6 @@ void appl::WorkerSaveAllFile::onCallbackSaveAsDone() { destroy(); return; } - m_worker->signalSaveDone.connect(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone); + m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone); } diff --git a/sources/appl/Gui/WorkerSaveAllFile.h b/sources/appl/Gui/WorkerSaveAllFile.h index 22a1f7d..641da05 100644 --- a/sources/appl/Gui/WorkerSaveAllFile.h +++ b/sources/appl/Gui/WorkerSaveAllFile.h @@ -18,8 +18,8 @@ namespace appl { virtual ~WorkerSaveAllFile(); private: std::vector m_bufferNameList; - std::shared_ptr m_worker; //! pop-up element that is open... - std::shared_ptr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_worker; //! pop-up element that is open... + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager public: // callback function void onCallbackSaveAsDone(); }; diff --git a/sources/appl/Gui/WorkerSaveFile.cpp b/sources/appl/Gui/WorkerSaveFile.cpp index 42787a7..64912bd 100644 --- a/sources/appl/Gui/WorkerSaveFile.cpp +++ b/sources/appl/Gui/WorkerSaveFile.cpp @@ -27,7 +27,7 @@ void appl::WorkerSaveFile::init() { } if (*propertyBufferName == "") { // need to find the curent file ... - std::shared_ptr tmpp = m_bufferManager->getBufferSelected(); + ememory::SharedPtr tmpp = m_bufferManager->getBufferSelected(); if (tmpp == nullptr) { APPL_ERROR("No selected buffer now ..."); destroy(); @@ -40,7 +40,7 @@ void appl::WorkerSaveFile::init() { destroy(); return; } - std::shared_ptr tmpBuffer = m_bufferManager->get(*propertyBufferName); + ememory::SharedPtr tmpBuffer = m_bufferManager->get(*propertyBufferName); if (tmpBuffer == nullptr) { APPL_ERROR("Error to get the buffer : " << *propertyBufferName); destroy(); @@ -55,7 +55,7 @@ void appl::WorkerSaveFile::init() { } } m_chooser = ewol::widget::FileChooser::create(); - if (nullptr == m_chooser) { + if (m_chooser == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); destroy(); return; @@ -65,15 +65,15 @@ void appl::WorkerSaveFile::init() { etk::FSNode tmpName(*propertyBufferName); m_chooser->propertyPath.set(tmpName.getNameFolder()); m_chooser->propertyFile.set(tmpName.getNameFile()); - std::shared_ptr tmpWindows = ewol::getContext().getWindows(); + ememory::SharedPtr tmpWindows = ewol::getContext().getWindows(); if (tmpWindows == nullptr) { APPL_ERROR("Error to get the windows."); destroy(); return; } tmpWindows->popUpWidgetPush(m_chooser); - m_chooser->signalValidate.connect(shared_from_this(), &appl::WorkerSaveFile::onCallbackSaveAsValidate); - m_chooser->signalCancel.connect(shared_from_this(), &appl::WorkerSaveFile::onCallbackCancel); + m_chooser->signalValidate.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackSaveAsValidate); + m_chooser->signalCancel.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackCancel); } appl::WorkerSaveFile::~WorkerSaveFile() { @@ -101,7 +101,7 @@ void appl::WorkerSaveFile::onCallbackSaveAsValidate(const std::string& _value) { destroy(); return; } - std::shared_ptr tmpBuffer = m_bufferManager->get(*propertyBufferName); + ememory::SharedPtr tmpBuffer = m_bufferManager->get(*propertyBufferName); if (tmpBuffer == nullptr) { APPL_ERROR("Error to get the buffer : " << *propertyBufferName); destroy(); diff --git a/sources/appl/Gui/WorkerSaveFile.h b/sources/appl/Gui/WorkerSaveFile.h index 7febd0d..57a131f 100644 --- a/sources/appl/Gui/WorkerSaveFile.h +++ b/sources/appl/Gui/WorkerSaveFile.h @@ -22,8 +22,8 @@ namespace appl { DECLARE_FACTORY(WorkerSaveFile); virtual ~WorkerSaveFile(); private: - std::shared_ptr m_chooser; //! pop-up element that is open... - std::shared_ptr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_chooser; //! pop-up element that is open... + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager public: // callback function void onCallbackSaveAsValidate(const std::string& _value); void onCallbackCancel(); diff --git a/sources/appl/Highlight.h b/sources/appl/Highlight.h index 5de4cfa..8d5580a 100644 --- a/sources/appl/Highlight.h +++ b/sources/appl/Highlight.h @@ -18,7 +18,7 @@ namespace appl { }; } -#include +#include #include #include #include @@ -27,7 +27,7 @@ namespace appl { namespace appl { class Highlight : public gale::Resource { private: - std::shared_ptr m_paintingProperties; + ememory::SharedPtr m_paintingProperties; public: // Constructeur Highlight(); diff --git a/sources/appl/HighlightManager.cpp b/sources/appl/HighlightManager.cpp index b47807f..43d4d80 100644 --- a/sources/appl/HighlightManager.cpp +++ b/sources/appl/HighlightManager.cpp @@ -12,14 +12,14 @@ // TODO : Review this in a generic unique resource ... -static std::vector>& s_list() { - static std::vector> list; +static std::vector>& s_list() { + static std::vector> list; return list; } void appl::highlightManager::init() { - std::vector>& hlList = s_list(); + std::vector>& hlList = s_list(); if (hlList.size() != 0) { APPL_ERROR("HighlightManager == > already exist, just unlink the previous ..."); hlList.clear(); @@ -37,7 +37,7 @@ void appl::highlightManager::init() { } std::string filename = it->getName() + "/highlight.xml"; APPL_DEBUG("Load xml name : " << filename); - std::shared_ptr myHightLine = appl::Highlight::create(filename); + ememory::SharedPtr myHightLine = appl::Highlight::create(filename); if (myHightLine != nullptr) { // Check if the language name already exist for (auto &it2 : hlList) { @@ -63,7 +63,7 @@ void appl::highlightManager::init() { } void appl::highlightManager::unInit() { - std::vector>& hlList = s_list(); + std::vector>& hlList = s_list(); if (hlList.size() == 0) { APPL_DEBUG("HighlightManager ==> no highlight"); hlList.clear(); @@ -77,7 +77,7 @@ std::string appl::highlightManager::getTypeFile(const std::string& _fileName) { return ""; } APPL_DEBUG("Try to find type for extention : '" << _fileName << "' in " << s_list().size() << " types"); - std::vector>& hlList = s_list(); + std::vector>& hlList = s_list(); for (auto &it : hlList) { if (it == nullptr) { continue; diff --git a/sources/appl/HighlightPattern.cpp b/sources/appl/HighlightPattern.cpp index 563c95b..be51597 100644 --- a/sources/appl/HighlightPattern.cpp +++ b/sources/appl/HighlightPattern.cpp @@ -7,7 +7,7 @@ #include #include -appl::HighlightPattern::HighlightPattern(const std::shared_ptr& _glyphPainting, const exml::Element& _child, int32_t _level) : +appl::HighlightPattern::HighlightPattern(const ememory::SharedPtr& _glyphPainting, const exml::Element& _child, int32_t _level) : m_glyphPainting(_glyphPainting), m_paternName(""), m_hasParsingError(true), diff --git a/sources/appl/HighlightPattern.h b/sources/appl/HighlightPattern.h index 9e5f5bf..01708fb 100644 --- a/sources/appl/HighlightPattern.h +++ b/sources/appl/HighlightPattern.h @@ -16,11 +16,11 @@ class HighlightPattern; namespace appl { class HighlightPattern { private: - std::shared_ptr m_glyphPainting; + ememory::SharedPtr m_glyphPainting; public: // Constructeur HighlightPattern(); - HighlightPattern(const std::shared_ptr& _glyphPainting, const exml::Element& _child, int32_t _level); + HighlightPattern(const ememory::SharedPtr& _glyphPainting, const exml::Element& _child, int32_t _level); virtual ~HighlightPattern(); private: std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") diff --git a/sources/appl/TextPlugin.cpp b/sources/appl/TextPlugin.cpp index 3973d79..b1c80ec 100644 --- a/sources/appl/TextPlugin.cpp +++ b/sources/appl/TextPlugin.cpp @@ -17,7 +17,7 @@ appl::TextViewerPlugin::TextViewerPlugin() : m_activateOnReceiveShortCut(false), m_activateOnCursorMove(false) { addObjectType("appl::TextViewerPlugin"); - m_menuInterface = std::dynamic_pointer_cast(getObjectNamed("appl-menu-interface")); + m_menuInterface = ememory::dynamicPointerCast(getObjectNamed("appl-menu-interface")); if (m_menuInterface.expired() == true) { APPL_ERROR("Can not acces to the Menu interface"); } diff --git a/sources/appl/TextPlugin.h b/sources/appl/TextPlugin.h index 42c7854..33103a7 100644 --- a/sources/appl/TextPlugin.h +++ b/sources/appl/TextPlugin.h @@ -18,7 +18,7 @@ namespace appl { class TextViewerPlugin : public ewol::Object { friend class appl::TextViewer; protected: - std::weak_ptr m_pluginManager; + ememory::WeakPtr m_pluginManager; protected: TextViewerPlugin(); public: diff --git a/sources/appl/TextPluginCopy.cpp b/sources/appl/TextPluginCopy.cpp index e8ceb4a..9d155b0 100644 --- a/sources/appl/TextPluginCopy.cpp +++ b/sources/appl/TextPluginCopy.cpp @@ -20,7 +20,7 @@ appl::TextPluginCopy::TextPluginCopy() : void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) { // add event : - std::shared_ptr menu = m_menuInterface.lock(); + ememory::SharedPtr menu = m_menuInterface.lock(); if (menu != nullptr) { m_menuIdTitle = menu->addTitle("Edit"); if (m_menuIdTitle != -1) { @@ -39,7 +39,7 @@ void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) { _textDrawer.ext_shortCutRm("appl::TextPluginCopy::cut"); _textDrawer.ext_shortCutRm("appl::TextPluginCopy::copy"); _textDrawer.ext_shortCutRm("appl::TextPluginCopy::Paste"); - std::shared_ptr menu = m_menuInterface.lock(); + ememory::SharedPtr menu = m_menuInterface.lock(); if (menu != nullptr) { menu->remove(m_menuIdRemove); menu->remove(m_menuIdPast); diff --git a/sources/appl/TextPluginCtags.cpp b/sources/appl/TextPluginCtags.cpp index fda40f2..a6078ea 100644 --- a/sources/appl/TextPluginCtags.cpp +++ b/sources/appl/TextPluginCtags.cpp @@ -59,8 +59,8 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) { if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) { APPL_INFO("Multiple file destination ..."); - std::shared_ptr tmpWidget = appl::TagFileSelection::create(); - if (nullptr == tmpWidget) { + ememory::SharedPtr tmpWidget = appl::TagFileSelection::create(); + if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); @@ -72,7 +72,7 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) { tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); } while (tagsFindNext (m_ctagFile, &entry) == TagSuccess); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); - tmpWidget->signalSelect.connect(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn); + tmpWidget->signalSelect.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn); } } else { jumpFile(myfile.getName(), lineID - 1); @@ -156,8 +156,8 @@ bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer, } if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") { APPL_INFO("Request opening ctag file"); - std::shared_ptr tmpWidget = ewol::widget::FileChooser::create(); - if (nullptr == tmpWidget) { + ememory::SharedPtr tmpWidget = ewol::widget::FileChooser::create(); + if (tmpWidget == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); return true; } @@ -170,7 +170,7 @@ bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer, tmpWidget->propertyPath.set(path); } ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); - tmpWidget->signalValidate.connect(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn); + tmpWidget->signalValidate.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn); return true; } else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") { if (_textDrawer.hasBuffer() == false) { diff --git a/sources/appl/TextPluginCtags.h b/sources/appl/TextPluginCtags.h index c2a44cb..4d3645f 100644 --- a/sources/appl/TextPluginCtags.h +++ b/sources/appl/TextPluginCtags.h @@ -28,7 +28,7 @@ namespace appl { void printTag(const tagEntry *_entry); void jumpTo(const std::string& _name); void jumpFile(const std::string& _filename, int64_t _lineId); - std::shared_ptr m_bufferManager; //!< handle on the buffer manager + ememory::SharedPtr m_bufferManager; //!< handle on the buffer manager protected: TextPluginCtags(); public: diff --git a/sources/appl/TextPluginData.h b/sources/appl/TextPluginData.h index 1a5cb0f..7476ce7 100644 --- a/sources/appl/TextPluginData.h +++ b/sources/appl/TextPluginData.h @@ -28,12 +28,12 @@ namespace appl { m_specificData.clear(); } private: - std::vector ,std::unique_ptr>> m_specificData; + std::vector ,std::unique_ptr>> m_specificData; protected: TYPE* getDataRef(appl::TextViewer& _textDrawer) { auto it = m_specificData.begin(); while(it != m_specificData.end()) { - std::shared_ptr buf = it->first.lock(); + ememory::SharedPtr buf = it->first.lock(); if (buf == nullptr) { it = m_specificData.erase(it); continue; diff --git a/sources/appl/TextPluginHistory.cpp b/sources/appl/TextPluginHistory.cpp index 0ef0f52..84a3b5f 100644 --- a/sources/appl/TextPluginHistory.cpp +++ b/sources/appl/TextPluginHistory.cpp @@ -20,7 +20,7 @@ appl::TextPluginHistory::TextPluginHistory() : void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) { - std::shared_ptr menu = m_menuInterface.lock(); + ememory::SharedPtr menu = m_menuInterface.lock(); if (menu != nullptr) { m_menuIdTitle = menu->addTitle("Edit"); if (m_menuIdTitle != -1) { @@ -36,7 +36,7 @@ void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) { _textDrawer.ext_shortCutRm("appl::TextPluginHistory::Undo"); _textDrawer.ext_shortCutRm("appl::TextPluginHistory::Redo"); - std::shared_ptr menu = m_menuInterface.lock(); + ememory::SharedPtr menu = m_menuInterface.lock(); if (menu != nullptr) { menu->remove(m_menuIdRedo); menu->remove(m_menuIdUndo); @@ -137,7 +137,7 @@ bool appl::TextPluginHistory::onDataWrite(appl::TextViewer& _textDrawer, clearRedo(_data); _data.m_undo.push_back(tmpElement); } - std::shared_ptr mng = m_pluginManager.lock(); + ememory::SharedPtr mng = m_pluginManager.lock(); if (mng!=nullptr) { mng->onCursorMove(_textDrawer, _textDrawer.cursor()); } @@ -165,7 +165,7 @@ bool appl::TextPluginHistory::onDataReplace(appl::TextViewer& _textDrawer, clearRedo(_data); _data.m_undo.push_back(tmpElement); } - std::shared_ptr mng = m_pluginManager.lock(); + ememory::SharedPtr mng = m_pluginManager.lock(); if (mng!=nullptr) { mng->onCursorMove(_textDrawer, _textDrawer.cursor()); } @@ -190,7 +190,7 @@ bool appl::TextPluginHistory::onDataRemove(appl::TextViewer& _textDrawer, _data.m_undo.push_back(tmpElement); } _textDrawer.removeDirect(); - std::shared_ptr mng = m_pluginManager.lock(); + ememory::SharedPtr mng = m_pluginManager.lock(); if (mng!=nullptr) { mng->onCursorMove(_textDrawer, _textDrawer.cursor()); } diff --git a/sources/appl/TextPluginManager.cpp b/sources/appl/TextPluginManager.cpp index 9a69c9a..ceb4206 100644 --- a/sources/appl/TextPluginManager.cpp +++ b/sources/appl/TextPluginManager.cpp @@ -30,7 +30,7 @@ void appl::textPluginManager::addDefaultPlugin() { appl::textPluginManager::addPlugin(appl::TextPluginCtags::create()); } -void appl::textPluginManager::addPlugin(const std::shared_ptr& _plugin) { +void appl::textPluginManager::addPlugin(ememory::SharedPtr _plugin) { if (_plugin == nullptr) { return; } @@ -57,14 +57,14 @@ void appl::textPluginManager::addPlugin(const std::shared_ptrisAvaillableOnCursorMove() == true) { m_listOnCursorMove.push_back(_plugin); } - std::shared_ptr viewer = m_currentViewer.lock(); + ememory::SharedPtr viewer = m_currentViewer.lock(); if (viewer != nullptr) { _plugin->onPluginEnable(*viewer); } } void appl::textPluginManager::connect(appl::TextViewer& _widget) { - m_currentViewer = std::dynamic_pointer_cast(_widget.shared_from_this()); + m_currentViewer = ememory::dynamicPointerCast(_widget.sharedFromThis()); for (auto &it : m_list) { if (it == nullptr) { continue; diff --git a/sources/appl/TextPluginManager.h b/sources/appl/TextPluginManager.h index 7fa33f2..7ceafae 100644 --- a/sources/appl/TextPluginManager.h +++ b/sources/appl/TextPluginManager.h @@ -13,15 +13,15 @@ namespace appl { class textPluginManager : public gale::Resource { private: - std::weak_ptr m_currentViewer; - std::list> m_list; - std::vector> m_listOnEventEntry; - std::vector> m_listOnEventInput; - std::vector> m_listOnWrite; - std::vector> m_listOnReplace; - std::vector> m_listOnRemove; - std::vector> m_listOnReceiveShortCutViewer; - std::vector> m_listOnCursorMove; + ememory::WeakPtr m_currentViewer; + std::list> m_list; + std::vector> m_listOnEventEntry; + std::vector> m_listOnEventInput; + std::vector> m_listOnWrite; + std::vector> m_listOnReplace; + std::vector> m_listOnRemove; + std::vector> m_listOnReceiveShortCutViewer; + std::vector> m_listOnCursorMove; protected: textPluginManager(); void init(const std::string& _name); @@ -36,7 +36,7 @@ namespace appl { * @brief Add a plugin. * @param[in] _plugin Plugin pointer to add. */ - void addPlugin(const std::shared_ptr& _plugin); + void addPlugin(ememory::SharedPtr _plugin); /** * @brief connect a new widget to the plugin. * @param[in] _widget Reference on the widget caller. diff --git a/sources/appl/TextPluginSelectAll.cpp b/sources/appl/TextPluginSelectAll.cpp index 38094e9..ec449e8 100644 --- a/sources/appl/TextPluginSelectAll.cpp +++ b/sources/appl/TextPluginSelectAll.cpp @@ -16,7 +16,7 @@ appl::TextPluginSelectAll::TextPluginSelectAll() : void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) { - std::shared_ptr menu = m_menuInterface.lock(); + ememory::SharedPtr menu = m_menuInterface.lock(); if (menu != nullptr) { m_menuIdTitle = menu->addTitle("Edit"); if (m_menuIdTitle != -1) { @@ -32,7 +32,7 @@ void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) { _textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::All"); _textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::None"); - std::shared_ptr menu = m_menuInterface.lock(); + ememory::SharedPtr menu = m_menuInterface.lock(); if (menu != nullptr) { menu->remove(m_menuIdSelectNone); menu->remove(m_menuIdSelectAll); diff --git a/sources/appl/global.cpp b/sources/appl/global.cpp index 7cd3425..ddac5dc 100644 --- a/sources/appl/global.cpp +++ b/sources/appl/global.cpp @@ -105,65 +105,65 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui() { void globals::ParameterGlobalsGui::init() { ewol::widget::Sizer::init(); propertyMode.set(ewol::widget::Sizer::modeVert); - std::shared_ptr myCheckbox; - std::shared_ptr mySpacer; + ememory::SharedPtr myCheckbox; + ememory::SharedPtr mySpacer; mySpacer = ewol::widget::Spacer::create(); - if (nullptr == mySpacer) { + if (mySpacer == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->propertyExpand.set(bvec2(true,true)); subWidgetAdd(mySpacer); } myCheckbox = ewol::widget::CheckBox::create(); - if (nullptr == myCheckbox) { + if (myCheckbox == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { //TODO : myCheckbox->propertyLabel.set("Automatic Indentation"); myCheckbox->propertyExpand.set(bvec2(true,false)); myCheckbox->propertyValue.set(isSetAutoIndent()); - myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackIndentation); + myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation); subWidgetAdd(myCheckbox); } myCheckbox = ewol::widget::CheckBox::create(); - if (nullptr == myCheckbox) { + if (myCheckbox == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { //TODO : myCheckbox->propertyLabel.set("Display space char (' ')"); myCheckbox->propertyExpand.set(bvec2(true,false)); myCheckbox->propertyValue.set(isSetDisplaySpaceChar()); - myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackSpace); + myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace); subWidgetAdd(myCheckbox); } myCheckbox = ewol::widget::CheckBox::create(); - if (nullptr == myCheckbox) { + if (myCheckbox == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { //TODO : myCheckbox->propertyLabel.set("Display tabulation char ('\\t')"); myCheckbox->propertyExpand.set(bvec2(true,false)); myCheckbox->propertyValue.set(isSetDisplayTabChar()); - myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackTabulation); + myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation); subWidgetAdd(myCheckbox); } myCheckbox = ewol::widget::CheckBox::create(); - if (nullptr == myCheckbox) { + if (myCheckbox == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { //TODO : myCheckbox->propertyLabel.set("Display end of line ('\\n')"); myCheckbox->propertyExpand.set(bvec2(true,false)); myCheckbox->propertyValue.set(isSetDisplayEndOfLine()); - myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackEndOfLine); + myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine); subWidgetAdd(myCheckbox); } myCheckbox = ewol::widget::CheckBox::create(); - if (nullptr == myCheckbox) { + if (myCheckbox == nullptr) { APPL_ERROR("Can not allocate widget == > display might be in error"); } else { //TODO : myCheckbox->propertyLabel.set("switch Rounded/default"); myCheckbox->propertyExpand.set(bvec2(true,false)); myCheckbox->propertyValue.set(isSetDisplayEndOfLine()); - myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackRounded); + myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded); subWidgetAdd(myCheckbox); } } diff --git a/sources/appl/init.cpp b/sources/appl/init.cpp index 3b7c242..f12e3d4 100644 --- a/sources/appl/init.cpp +++ b/sources/appl/init.cpp @@ -27,8 +27,8 @@ class MainApplication : public ewol::context::Application { private: - std::shared_ptr m_bufferManager; - std::shared_ptr m_pluginManager; + ememory::SharedPtr m_bufferManager; + ememory::SharedPtr m_pluginManager; public: virtual void onCreate(ewol::Context& _context) override { APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)"); @@ -82,7 +82,7 @@ class MainApplication : public ewol::context::Application { cCurrentPath[FILENAME_MAX - 1] = '\0'; //APPL_INFO("The current working directory is " << cCurrentPath); - std::shared_ptr basicWindows = MainWindows::create(); + ememory::SharedPtr basicWindows = MainWindows::create(); if (basicWindows == nullptr) { APPL_ERROR("Can not allocate the basic windows");