Update version tag: 1.2.0

This commit is contained in:
Edouard DUPIN 2014-06-03 22:27:31 +02:00
commit 440f4c7093
59 changed files with 504 additions and 595 deletions

0
data/lang/EN.json Normal file
View File

0
data/lang/FR.json Normal file
View File

View File

@ -139,9 +139,7 @@ appl::Buffer::Buffer() :
} }
appl::Buffer::~Buffer() { appl::Buffer::~Buffer() {
if (m_highlight == NULL) {
appl::Highlight::release(m_highlight);
}
} }
bool appl::Buffer::loadFile(const std::string& _name) { bool appl::Buffer::loadFile(const std::string& _name) {
@ -301,7 +299,7 @@ bool appl::Buffer::search(const appl::Buffer::Iterator& _pos,
for (Iterator it = _pos; for (Iterator it = _pos;
(bool)it == true; (bool)it == true;
++it) { ++it) {
if (tolower(*it) == firstElement) { if ((char32_t)tolower(*it) == firstElement) {
// find the first char ==> check next... // find the first char ==> check next...
bool find = true; bool find = true;
Iterator tmp = it; Iterator tmp = it;
@ -373,7 +371,7 @@ bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos,
(bool)it == true; (bool)it == true;
--it) { --it) {
//APPL_DEBUG("compare : " << *it << " ?= " << _search); //APPL_DEBUG("compare : " << *it << " ?= " << _search);
if (tolower(*it) == lastElement) { if ((char32_t)tolower(*it) == lastElement) {
// find the last char ==> check previous... // find the last char ==> check previous...
bool find = true; bool find = true;
_result = it; _result = it;
@ -694,9 +692,7 @@ void appl::Buffer::tryFindHighlightType() {
void appl::Buffer::setHighlightType(const std::string& _type) { void appl::Buffer::setHighlightType(const std::string& _type) {
m_highlightType = ""; m_highlightType = "";
cleanHighLight(); cleanHighLight();
if (m_highlight == NULL) { m_highlight.reset();
appl::Highlight::release(m_highlight);
}
std::string resourceName = appl::highlightManager::getFileWithTypeType(_type); std::string resourceName = appl::highlightManager::getFileWithTypeType(_type);
if (resourceName == "") { if (resourceName == "") {
return; return;
@ -763,12 +759,12 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
} else { } else {
elemStart = startId+1; elemStart = startId+1;
} }
for (int64_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { for (auto it(m_HLDataPass1.begin()+elemStart); it != m_HLDataPass1.end(); ++it) {
//APPL_DEBUG("move element=" << i); //APPL_DEBUG("move element=" << i);
m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted; it->beginStart += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted; it->beginStop += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].endStart += _nbAdded - _nbDeleted; it->endStart += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].endStop += _nbAdded - _nbDeleted; it->endStop += _nbAdded - _nbDeleted;
} }
//Regenerate Element inside range //Regenerate Element inside range
if ( startId == -1 if ( startId == -1
@ -831,7 +827,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
------------ ------------- ---------- ------------ ------------- ----------
S=-1 *************** E S=-1 *************** E
*/ */
for (int32_t iii = 0; iii < m_HLDataPass1.size(); ++iii) { for (size_t iii = 0; iii < m_HLDataPass1.size(); ++iii) {
if (m_HLDataPass1[iii].endStop > _startPos) { if (m_HLDataPass1[iii].endStop > _startPos) {
break; break;
} }
@ -852,7 +848,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
} else { } else {
elemStart = _startId+1; elemStart = _startId+1;
} }
for (int32_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { for (size_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
if (m_HLDataPass1[iii].beginStart > _endPos) { if (m_HLDataPass1[iii].beginStart > _endPos) {
_stopId = iii; _stopId = iii;
break; break;
@ -876,7 +872,7 @@ void appl::Buffer::cleanHighLight() {
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) { appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
int32_t start = etk_max(0, _starPos-1); int32_t start = etk_max(0, _starPos-1);
for (int32_t iii = start; iii < m_HLDataPass1.size(); ++iii) { for (size_t iii = start; iii < m_HLDataPass1.size(); ++iii) {
_starPos = iii; _starPos = iii;
if ( m_HLDataPass1[iii].beginStart <= _pos if ( m_HLDataPass1[iii].beginStart <= _pos
&& m_HLDataPass1[iii].endStop > _pos) { && m_HLDataPass1[iii].endStop > _pos) {

View File

@ -68,7 +68,7 @@ namespace appl {
/** /**
* @brief Basic destructor * @brief Basic destructor
*/ */
~Iterator() { virtual ~Iterator() {
m_current = 0; m_current = 0;
m_data = NULL; m_data = NULL;
m_value = u32char::Null; m_value = u32char::Null;
@ -248,7 +248,7 @@ namespace appl {
}; };
Iterator operator+ (const size_t _val) const { Iterator operator+ (const size_t _val) const {
Iterator tmpp(*this); Iterator tmpp(*this);
for (int64_t iii=0; iii<_val; ++iii) { for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
++tmpp; ++tmpp;
} }
return tmpp; return tmpp;
@ -273,7 +273,7 @@ namespace appl {
}; };
Iterator operator- (const size_t _val) const { Iterator operator- (const size_t _val) const {
Iterator tmpp(*this); Iterator tmpp(*this);
for (int64_t iii=0; iii<_val; ++iii) { for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
--tmpp; --tmpp;
} }
return tmpp; return tmpp;
@ -294,7 +294,7 @@ namespace appl {
static const char* const eventChangeName; static const char* const eventChangeName;
public: public:
Buffer(); Buffer();
~Buffer(); virtual ~Buffer();
private: private:
bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ... bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ...
std::string m_fileName; //!< name of the file (with his path) std::string m_fileName; //!< name of the file (with his path)
@ -588,7 +588,7 @@ namespace appl {
protected: protected:
std::string m_highlightType; //!< Name of the highlight type std::string m_highlightType; //!< Name of the highlight type
appl::Highlight* m_highlight; //!< internal link with the Highlight system ewol::object::Shared<appl::Highlight> m_highlight; //!< internal link with the Highlight system
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1 std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
public: public:
/** /**

View File

@ -25,23 +25,12 @@ appl::BufferManager::BufferManager() :
} }
appl::BufferManager::~BufferManager() { appl::BufferManager::~BufferManager() {
int32_t previousCount = m_list.size();
for (int32_t iii = m_list.size()-1; iii >= 0 ; --iii) {
if (m_list[iii] == NULL) {
continue;
}
delete(m_list[iii]);
if (previousCount == m_list.size()) {
APPL_ERROR("Error in removing buffer !! ");
}
previousCount = m_list.size();
}
m_list.clear(); m_list.clear();
} }
appl::Buffer* appl::BufferManager::createNewBuffer() { ewol::object::Shared<appl::Buffer> appl::BufferManager::createNewBuffer() {
appl::Buffer* tmp = new appl::Buffer(); ewol::object::Shared<appl::Buffer> tmp = ewol::object::makeShared(new appl::Buffer());
if (tmp == NULL) { if (tmp == NULL) {
APPL_ERROR("Can not allocate the Buffer (empty)."); APPL_ERROR("Can not allocate the Buffer (empty).");
return NULL; return NULL;
@ -51,14 +40,14 @@ appl::Buffer* appl::BufferManager::createNewBuffer() {
return tmp; return tmp;
} }
appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) { ewol::object::Shared<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")"); APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")");
for (int32_t iii = 0; iii < m_list.size(); ++iii) { for (auto &it : m_list) {
if (m_list[iii] == NULL) { if (it == NULL) {
continue; continue;
} }
if (m_list[iii]->getFileName() == _fileName) { if (it->getFileName() == _fileName) {
return m_list[iii]; return it;
} }
} }
if (_createIfNeeded == true) { if (_createIfNeeded == true) {
@ -67,7 +56,7 @@ appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _creat
APPL_CRITICAL("plop"); APPL_CRITICAL("plop");
return NULL; return NULL;
} }
appl::Buffer* tmp = new appl::Buffer(); ewol::object::Shared<appl::Buffer> tmp = ewol::object::makeShared(new appl::Buffer());
if (tmp == NULL) { if (tmp == NULL) {
APPL_ERROR("Can not allocate the Buffer class : " << _fileName); APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
return NULL; return NULL;
@ -78,31 +67,42 @@ appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _creat
} }
return NULL; return NULL;
} }
void appl::BufferManager::setBufferSelected(appl::Buffer* _bufferSelected) { void appl::BufferManager::setBufferSelected(ewol::object::Shared<appl::Buffer> _bufferSelected) {
m_bufferSelected = _bufferSelected; m_bufferSelected = _bufferSelected;
sendMultiCast(appl::MsgSelectChange, ""); sendMultiCast(appl::MsgSelectChange, "");
} }
void appl::BufferManager::onObjectRemove(ewol::Object * _removeObject) { void appl::BufferManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
if (m_bufferSelected == _removeObject) { ewol::Resource::onObjectRemove(_object);
if (m_bufferSelected == _object) {
setBufferSelected(NULL); setBufferSelected(NULL);
} }
for (int32_t iii = 0; iii < m_list.size(); ++iii) { for (auto it(m_list.begin()); it!=m_list.end(); ++it) {
if (m_list[iii] != _removeObject) { if (*it != _object) {
continue; continue;
} }
m_list[iii] = NULL; m_list.erase(it);
m_list.erase(m_list.begin()+iii); it = m_list.begin();
return;
} }
} }
ewol::object::Shared<appl::Buffer> appl::BufferManager::get(int32_t _id) {
int32_t id = 0;
for (auto &it : m_list) {
if (id == _id) {
return it;
}
id++;
}
return m_list.back();
}
bool appl::BufferManager::exist(const std::string& _fileName) { bool appl::BufferManager::exist(const std::string& _fileName) {
for (int32_t iii = 0; iii < m_list.size(); ++iii) { for (auto &it : m_list) {
if (m_list[iii] == NULL) { if (it == nullptr) {
continue; continue;
} }
if (m_list[iii]->getFileName() == _fileName) { if (it->getFileName() == _fileName) {
return true; return true;
} }
} }
@ -123,15 +123,14 @@ void appl::BufferManager::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_DEBUG("receive message !!! " << _msg); APPL_DEBUG("receive message !!! " << _msg);
} }
appl::BufferManager* appl::BufferManager::keep() { ewol::object::Shared<appl::BufferManager> appl::BufferManager::keep() {
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\""); ewol::object::Shared<appl::BufferManager> object = ewol::dynamic_pointer_cast<appl::BufferManager>(getManager().localKeep("???BufferManager???"));
appl::BufferManager* object = static_cast<appl::BufferManager*>(getManager().localKeep("???BufferManager???"));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
// this element create a new one every time .... // this element create a new one every time ....
EWOL_INFO("CREATE : appl::BufferManager: ???BufferManager???"); EWOL_INFO("CREATE : appl::BufferManager: ???BufferManager???");
object = new appl::BufferManager(); object = ewol::object::makeShared(new appl::BufferManager());
if (NULL == object) { if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ???BufferManager???"); EWOL_ERROR("allocation error of a resource : ???BufferManager???");
return NULL; return NULL;
@ -140,11 +139,3 @@ appl::BufferManager* appl::BufferManager::keep() {
return object; return object;
} }
void appl::BufferManager::release(appl::BufferManager*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@ -9,6 +9,7 @@
#ifndef __BUFFER_MANAGER_H__ #ifndef __BUFFER_MANAGER_H__
#define __BUFFER_MANAGER_H__ #define __BUFFER_MANAGER_H__
#include <list>
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
@ -18,9 +19,10 @@ namespace appl {
class BufferManager : public ewol::Resource { class BufferManager : public ewol::Resource {
protected: protected:
BufferManager(); BufferManager();
~BufferManager(); public:
virtual ~BufferManager();
private: private:
std::vector<appl::Buffer*> m_list; // list of all buffer curently open std::list<ewol::object::Owner<appl::Buffer>> m_list; // list of all buffer curently open
public: public:
/** /**
* @brief Get a specific buffer with his name (can create a new buffer). * @brief Get a specific buffer with his name (can create a new buffer).
@ -28,7 +30,7 @@ namespace appl {
* @param[in] _createIfNeeded Create the buffer if not existed. * @param[in] _createIfNeeded Create the buffer if not existed.
* @return a pointer on the buffer * @return a pointer on the buffer
*/ */
appl::Buffer* get(const std::string& _fileName, bool _createIfNeeded=false); ewol::object::Shared<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
/** /**
* @brief Load a specific file, event if it not existed: * @brief Load a specific file, event if it not existed:
* @param[in] _fileName Name of the file to open or create. * @param[in] _fileName Name of the file to open or create.
@ -52,32 +54,30 @@ namespace appl {
* @param[in] _id Number of buffer * @param[in] _id Number of buffer
* @return pointer on the buffer * @return pointer on the buffer
*/ */
appl::Buffer* get(int32_t _id) { ewol::object::Shared<appl::Buffer> get(int32_t _id);
return m_list[_id];
}
/** /**
* @brief Create a new buffer empty. * @brief Create a new buffer empty.
* @return Created buffer or NULL. * @return Created buffer or NULL.
*/ */
appl::Buffer* createNewBuffer(); ewol::object::Shared<appl::Buffer> createNewBuffer();
private: private:
appl::Buffer* m_bufferSelected; ewol::object::Shared<appl::Buffer> m_bufferSelected;
public: public:
/** /**
* @brief Set the current buffer selected * @brief Set the current buffer selected
* @param[in] _bufferSelected Pointer on the buffer selected * @param[in] _bufferSelected Pointer on the buffer selected
*/ */
void setBufferSelected(appl::Buffer* _bufferSelected); void setBufferSelected(ewol::object::Shared<appl::Buffer> _bufferSelected);
/** /**
* @brief Get the current buffer selected * @brief Get the current buffer selected
* @return Pointer on the buffer selected * @return Pointer on the buffer selected
*/ */
appl::Buffer* getBufferSelected() { ewol::object::Shared<appl::Buffer> getBufferSelected() {
return m_bufferSelected; return m_bufferSelected;
}; };
public: // herited function public: // herited function
void onReceiveMessage(const ewol::object::Message& _msg); void onReceiveMessage(const ewol::object::Message& _msg);
void onObjectRemove(ewol::Object * _removeObject); void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
public: // resource manager public: // resource manager
/** /**
* @brief keep the resource pointer. * @brief keep the resource pointer.
@ -85,12 +85,7 @@ namespace appl {
* @param[in] _filename Name of the configuration file. * @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static appl::BufferManager* keep(); static ewol::object::Shared<appl::BufferManager> keep();
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::BufferManager*& _object);
}; };
}; };

View File

@ -17,7 +17,7 @@ namespace appl {
public: public:
// Constructeur // Constructeur
GlyphDecoration(const std::string& _newColorName = "no_name"); GlyphDecoration(const std::string& _newColorName = "no_name");
~GlyphDecoration() { virtual ~GlyphDecoration() {
// nothing to do ... // nothing to do ...
}; };
private: private:

View File

@ -47,7 +47,7 @@ void appl::GlyphPainting::reload() {
APPL_ERROR("Can not get basic array : 'ednColor'"); APPL_ERROR("Can not get basic array : 'ednColor'");
return; return;
} }
for (int32_t iii = 0; iii < baseArray->size(); ++iii) { for (size_t iii = 0; iii < baseArray->size(); ++iii) {
ejson::Object* tmpObj = baseArray->getObject(iii); ejson::Object* tmpObj = baseArray->getObject(iii);
if (tmpObj == NULL) { if (tmpObj == NULL) {
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii); APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
@ -60,7 +60,7 @@ void appl::GlyphPainting::reload() {
bool bold = tmpObj->getBooleanValue("bold", false); bool bold = tmpObj->getBooleanValue("bold", false);
APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'"); APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'");
bool findElement = false; bool findElement = false;
for (int32_t jjj=0; jjj<m_list.size(); ++jjj) { for (size_t jjj=0; jjj<m_list.size(); ++jjj) {
if (m_list[jjj].getName() != name) { if (m_list[jjj].getName() != name) {
continue; continue;
} }
@ -84,7 +84,7 @@ void appl::GlyphPainting::reload() {
int32_t appl::GlyphPainting::request(const std::string& _name) { int32_t appl::GlyphPainting::request(const std::string& _name) {
for (int32_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
if (m_list[iii].getName() == _name) { if (m_list[iii].getName() == _name) {
return iii; return iii;
} }
@ -95,15 +95,15 @@ int32_t appl::GlyphPainting::request(const std::string& _name) {
return m_list.size()-1; return m_list.size()-1;
} }
appl::GlyphPainting* appl::GlyphPainting::keep(const std::string& _filename) { ewol::object::Shared<appl::GlyphPainting> appl::GlyphPainting::keep(const std::string& _filename) {
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\""); //EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
appl::GlyphPainting* object = static_cast<appl::GlyphPainting*>(getManager().localKeep(_filename)); ewol::object::Shared<appl::GlyphPainting> object = ewol::dynamic_pointer_cast<appl::GlyphPainting>(getManager().localKeep(_filename));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
// this element create a new one every time .... // this element create a new one every time ....
EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\""); EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\"");
object = new appl::GlyphPainting(_filename); object = ewol::object::makeShared(new appl::GlyphPainting(_filename));
if (NULL == object) { if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ??GlyphPainting??"); EWOL_ERROR("allocation error of a resource : ??GlyphPainting??");
return NULL; return NULL;
@ -111,13 +111,3 @@ appl::GlyphPainting* appl::GlyphPainting::keep(const std::string& _filename) {
getManager().localAdd(object); getManager().localAdd(object);
return object; return object;
} }
void appl::GlyphPainting::release(appl::GlyphPainting*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@ -20,6 +20,7 @@ namespace appl {
std::vector<appl::GlyphDecoration> m_list; std::vector<appl::GlyphDecoration> m_list;
protected: protected:
GlyphPainting(const std::string& _filename); GlyphPainting(const std::string& _filename);
public:
virtual ~GlyphPainting(); virtual ~GlyphPainting();
public: public:
/** /**
@ -55,12 +56,7 @@ namespace appl {
* @param[in] _filename Name of the configuration file. * @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static appl::GlyphPainting* keep(const std::string& _filename); static ewol::object::Shared<appl::GlyphPainting> keep(const std::string& _filename);
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::GlyphPainting*& _object);
}; };
}; };

View File

@ -20,12 +20,12 @@
static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) { static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
std::vector<appl::dataBufferStruct *> tmpList = _list; std::vector<appl::dataBufferStruct *> tmpList = _list;
_list.clear(); _list.clear();
for(int32_t iii=0; iii<tmpList.size(); iii++) { for(size_t iii=0; iii<tmpList.size(); iii++) {
if (NULL == tmpList[iii]) { if (NULL == tmpList[iii]) {
continue; continue;
} }
int32_t findPos = 0; size_t findPos = 0;
for(int32_t jjj=0; jjj<_list.size(); jjj++) { for(size_t jjj=0; jjj<_list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\""); //EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (_list[jjj] == NULL) { if (_list[jjj] == NULL) {
continue; continue;
@ -68,16 +68,11 @@ BufferView::~BufferView() {
} }
void BufferView::removeAllElement() { void BufferView::removeAllElement() {
for(int32_t iii=0; iii<m_list.size(); iii++) { for(auto &it : m_list) {
if (NULL!=m_list[iii]) { delete(it);
delete(m_list[iii]); it = NULL;
m_list[iii] = NULL;
}
} }
m_list.clear(); m_list.clear();
if (m_bufferManager != NULL) {
appl::BufferManager::release(m_bufferManager);
}
} }
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) { void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) {
@ -110,7 +105,7 @@ void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _sel
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) { void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::List::onReceiveMessage(_msg); ewol::widget::List::onReceiveMessage(_msg);
if (_msg.getMessage() == appl::MsgSelectNewFile) { if (_msg.getMessage() == appl::MsgSelectNewFile) {
appl::Buffer* buffer = m_bufferManager->get(_msg.getData()); ewol::object::Shared<appl::Buffer> buffer = m_bufferManager->get(_msg.getData());
if (buffer == NULL) { if (buffer == NULL) {
APPL_ERROR("event on element nor exist : " << _msg.getData()); APPL_ERROR("event on element nor exist : " << _msg.getData());
return; return;
@ -143,7 +138,7 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
appl::dataBufferStruct* tmp = m_list[iii]; appl::dataBufferStruct* tmp = m_list[iii];
m_list[iii] = NULL; m_list[iii] = NULL;
m_list.erase(m_list.begin() + iii); m_list.erase(m_list.begin() + iii);
insertAlphabetic(tmp, (iii == m_selectedID)); insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
break; break;
} }
} }
@ -162,12 +157,12 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_DEBUG("message : " << _msg); APPL_DEBUG("message : " << _msg);
if (_msg.getMessage() == appl::MsgSelectChange) { if (_msg.getMessage() == appl::MsgSelectChange) {
m_selectedID = -1; m_selectedID = -1;
appl::Buffer* tmpBuffer = NULL; ewol::object::Shared<appl::Buffer> tmpBuffer;
if (m_bufferManager != NULL) { if (m_bufferManager != NULL) {
tmpBuffer = m_bufferManager->getBufferSelected(); tmpBuffer = m_bufferManager->getBufferSelected();
} }
if (tmpBuffer != NULL) { if (tmpBuffer != NULL) {
for (int32_t iii=0; iii<m_list.size(); iii++) { for (size_t iii=0; iii<m_list.size(); iii++) {
if (m_list[iii] == NULL) { if (m_list[iii] == NULL) {
continue; continue;
} }
@ -185,8 +180,8 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
// clean The list // clean The list
removeAllElement(); removeAllElement();
// get all the buffer name and properties: // get all the buffer name and properties:
int32_t nbBufferOpen = 0; // BufferManager::size(); size_t nbBufferOpen = 0; // BufferManager::size();
for (int32_t iii=0; iii<nbBufferOpen; iii++) { for (size_t iii=0; iii<nbBufferOpen; iii++) {
/* /*
if (BufferManager::exist(iii)) { if (BufferManager::exist(iii)) {
BufferText* tmpBuffer = BufferManager::get(iii); BufferText* tmpBuffer = BufferManager::get(iii);
@ -212,27 +207,30 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
markToRedraw(); markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferState) { }else if (_msg.getMessage() == ednMsgBufferState) {
// update list of modify section ... // update list of modify section ...
for (int32_t iii=0; iii<m_list.size(); iii++) { for (auto &it : m_list) {
if (NULL!=m_list[iii]) { if (it != nullptr) {
//m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify(); //it->m_isModify = BufferManager::get(it->m_bufferID)->isModify();
} }
} }
markToRedraw(); markToRedraw();
} }
} }
void BufferView::onObjectRemove(ewol::Object* _removeObject) { void BufferView::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
ewol::widget::List::onObjectRemove(_removeObject); ewol::widget::List::onObjectRemove(_object);
for (int32_t iii=0; iii<m_list.size(); iii++) { auto it(m_list.begin());
if (m_list[iii] == NULL) { while (it != m_list.end()) {
continue; if ( *it != nullptr
} && (*it)->m_buffer == _object) {
if (m_list[iii]->m_buffer != _removeObject) { m_list.erase(it);
continue;
}
m_list.erase(m_list.begin()+iii);
markToRedraw(); markToRedraw();
return; it = m_list.begin();
} else {
++it;
}
}
if (m_bufferManager == _object) {
m_bufferManager.reset();
} }
} }
@ -256,8 +254,8 @@ uint32_t BufferView::getNuberOfRaw() {
bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
if( _raw >= 0 if( _raw >= 0
&& _raw<m_list.size() && _raw<(int64_t)m_list.size()
&& NULL != m_list[_raw]) { && m_list[_raw] != nullptr) {
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile(); _myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
if ( m_list[_raw]->m_buffer != NULL if ( m_list[_raw]->m_buffer != NULL
@ -286,7 +284,7 @@ bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent
if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) { if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) {
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw ); APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
if( _raw >= 0 if( _raw >= 0
&& _raw<m_list.size() && _raw<(int64_t)m_list.size()
&& NULL != m_list[_raw]) { && NULL != m_list[_raw]) {
if (m_list[_raw]->m_buffer != NULL) { if (m_list[_raw]->m_buffer != NULL) {
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName()); sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName());

View File

@ -15,28 +15,25 @@
#include <ewol/widget/List.h> #include <ewol/widget/List.h>
#include <ewol/widget/Windows.h> #include <ewol/widget/Windows.h>
namespace appl namespace appl {
{ class dataBufferStruct {
class dataBufferStruct
{
public: public:
etk::FSNode m_bufferName; etk::FSNode m_bufferName;
appl::Buffer* m_buffer; ewol::object::Shared<appl::Buffer> m_buffer;
dataBufferStruct(const std::string& _bufferName, appl::Buffer* _buffer) : dataBufferStruct(const std::string& _bufferName, const ewol::object::Shared<appl::Buffer>& _buffer) :
m_bufferName(_bufferName), m_bufferName(_bufferName),
m_buffer(_buffer) { m_buffer(_buffer) {
}; };
~dataBufferStruct() { }; virtual ~dataBufferStruct() { };
}; };
}; };
class BufferView : public ewol::widget::List class BufferView : public ewol::widget::List {
{
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
private: private:
appl::GlyphPainting* m_paintingProperties; //!< element painting property ewol::object::Shared<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground1; int32_t m_colorBackground1;
int32_t m_colorBackground2; int32_t m_colorBackground2;
int32_t m_colorBackgroundSelect; int32_t m_colorBackgroundSelect;
@ -54,10 +51,10 @@ class BufferView : public ewol::widget::List
public: public:
// Constructeur // Constructeur
BufferView(); BufferView();
~BufferView(); virtual ~BufferView();
// Derived function // Derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object* _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
private: private:
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
protected: protected:

View File

@ -61,9 +61,9 @@ class ParameterAboutGui : public ewol::widget::Sizer {
public : public :
ParameterAboutGui() : ParameterAboutGui() :
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) { ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
ewol::widget::Spacer* mySpacer = NULL; ewol::object::Shared<ewol::widget::Spacer> mySpacer = NULL;
mySpacer = new ewol::widget::Spacer(); mySpacer = ewol::object::makeShared(new ewol::widget::Spacer());
if (NULL == mySpacer) { if (NULL == mySpacer) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -93,7 +93,7 @@ class ParameterAboutGui : public ewol::widget::Sizer {
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>"; tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>"; tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
tmpLabel += "</left>"; tmpLabel += "</left>";
ewol::widget::Label* myLabel = new ewol::widget::Label(tmpLabel); ewol::object::Shared<ewol::widget::Label> myLabel = ewol::object::makeShared(new ewol::widget::Label(tmpLabel));
if (NULL == myLabel) { if (NULL == myLabel) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -122,35 +122,37 @@ const char* l_smoothMax = "tmpEvent_maxChange";
MainWindows::MainWindows() { MainWindows::MainWindows() {
addObjectType("appl::MainWindows"); addObjectType("appl::MainWindows");
APPL_DEBUG("CREATE WINDOWS ... "); APPL_DEBUG("CREATE WINDOWS ... ");
ewol::widget::Sizer * mySizerVert = NULL; ewol::object::Shared<ewol::widget::Sizer> mySizerVert = NULL;
ewol::widget::Sizer * mySizerVert2 = NULL; ewol::object::Shared<ewol::widget::Sizer> mySizerVert2 = NULL;
ewol::widget::Sizer * mySizerHori = NULL; ewol::object::Shared<ewol::widget::Sizer> mySizerHori = NULL;
//ewol::Button * myButton = NULL; ewol::object::Shared<appl::TextViewer> myTextView = NULL;
appl::TextViewer * myTextView = NULL; ewol::object::Shared<BufferView> myBufferView = NULL;
BufferView * myBufferView = NULL; ewol::object::Shared<ewol::widget::Menu> myMenu = NULL;
ewol::widget::Menu * myMenu = NULL;
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::keep();
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert); mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
mySizerVert->setName("plop 1111111");
setSubWidget(mySizerVert); setSubWidget(mySizerVert);
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori); mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
mySizerHori->setName("plop 222222222");
mySizerVert->subWidgetAdd(mySizerHori); mySizerVert->subWidgetAdd(mySizerHori);
myBufferView = new BufferView(); myBufferView = ewol::object::makeShared(new BufferView());
myBufferView->setName("plop 3333333");
myBufferView->setExpand(bvec2(false,true)); myBufferView->setExpand(bvec2(false,true));
myBufferView->setFill(bvec2(true,true)); myBufferView->setFill(bvec2(true,true));
mySizerHori->subWidgetAdd(myBufferView); mySizerHori->subWidgetAdd(myBufferView);
mySizerVert2 = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert); mySizerVert2 = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
mySizerHori->subWidgetAdd(mySizerVert2); mySizerHori->subWidgetAdd(mySizerVert2);
mySizerVert2->setName("plop 4444444");
// main buffer Area : // main buffer Area :
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16); myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16));
#else #else
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11); myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11));
#endif #endif
myTextView->setName("appl-text-viewer"); myTextView->setName("appl-text-viewer");
myTextView->setExpand(bvec2(true,true)); myTextView->setExpand(bvec2(true,true));
@ -163,13 +165,14 @@ MainWindows::MainWindows() {
mySizerVert2->subWidgetAdd(myTextView); mySizerVert2->subWidgetAdd(myTextView);
*/ */
// search area : // search area :
Search * mySearch = new Search(); ewol::object::Shared<appl::widget::Search> mySearch = ewol::object::makeShared(new appl::widget::Search());
mySizerVert2->subWidgetAdd(mySearch); mySizerVert2->subWidgetAdd(mySearch);
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori); mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
mySizerHori->setName("plop 555555");
mySizerVert->subWidgetAdd(mySizerHori); mySizerVert->subWidgetAdd(mySizerHori);
myMenu = new ewol::widget::Menu(); myMenu = ewol::object::makeShared(new ewol::widget::Menu());
mySizerHori->subWidgetAdd(myMenu); mySizerHori->subWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->addTitle("File"); int32_t idMenuFile = myMenu->addTitle("File");
myMenu->add(idMenuFile, "New", "", ednMsgGuiNew); myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
@ -218,7 +221,7 @@ MainWindows::MainWindows() {
myMenu->addSpacer(); myMenu->addSpacer();
myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader); myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
m_widgetLabelFileName = new ewol::widget::Label("FileName"); m_widgetLabelFileName = ewol::object::makeShared(new ewol::widget::Label("FileName"));
m_widgetLabelFileName->setExpand(bvec2(true,false)); m_widgetLabelFileName->setExpand(bvec2(true,false));
m_widgetLabelFileName->setFill(bvec2(true,false));; m_widgetLabelFileName->setFill(bvec2(true,false));;
mySizerHori->subWidgetAdd(m_widgetLabelFileName); mySizerHori->subWidgetAdd(m_widgetLabelFileName);
@ -265,7 +268,7 @@ MainWindows::MainWindows() {
MainWindows::~MainWindows() { MainWindows::~MainWindows() {
appl::BufferManager::release(m_bufferManager);
} }
@ -291,7 +294,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
return; return;
} }
// Get a ref on the buffer selected (if null, no buffer was selected ...) // Get a ref on the buffer selected (if null, no buffer was selected ...)
appl::Buffer* tmpBuffer = m_bufferManager->getBufferSelected(); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != NULL) { if (tmpBuffer != NULL) {
etk::FSNode tmpFile = tmpBuffer->getFileName(); etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->setFolder(tmpFile.getNameFolder()); tmpWidget->setFolder(tmpFile.getNameFolder());
@ -301,7 +304,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
tmpWidget->registerOnEvent(this, "validate", ednEventPopUpFileSelected); tmpWidget->registerOnEvent(this, "validate", ednEventPopUpFileSelected);
} else if (_msg.getMessage() == ednMsgProperties) { } else if (_msg.getMessage() == ednMsgProperties) {
// Request the parameter GUI // Request the parameter GUI
ewol::widget::Parameter* tmpWidget = new ewol::widget::Parameter(); ewol::object::Shared<ewol::widget::Parameter> tmpWidget = ewol::object::makeShared(new ewol::widget::Parameter());
if (NULL == tmpWidget) { if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -339,13 +342,13 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
tmpWidget->setTitle("Properties"); tmpWidget->setTitle("Properties");
popUpWidgetPush(tmpWidget); popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("Editor"); tmpWidget->menuAddGroup("Editor");
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui(); ewol::object::Shared<ewol::Widget> tmpSubWidget = ewol::object::makeShared(new globals::ParameterGlobalsGui());
tmpWidget->menuAdd("Editor", "", tmpSubWidget); tmpWidget->menuAdd("Editor", "", tmpSubWidget);
tmpWidget->menuAdd("Font & Color", "", NULL); tmpWidget->menuAdd("Font & Color", "", NULL);
tmpWidget->menuAdd("Highlight", "", NULL); tmpWidget->menuAdd("Highlight", "", NULL);
tmpWidget->menuAddGroup("General"); tmpWidget->menuAddGroup("General");
tmpWidget->menuAdd("Display", "", NULL); tmpWidget->menuAdd("Display", "", NULL);
tmpSubWidget = new ParameterAboutGui(); tmpSubWidget = ewol::object::makeShared(new ParameterAboutGui());
tmpWidget->menuAdd("About", "", tmpSubWidget); tmpWidget->menuAdd("About", "", tmpSubWidget);
} }
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) { } else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
@ -372,7 +375,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|| _msg.getMessage() == appl::Buffer::eventIsSave || _msg.getMessage() == appl::Buffer::eventIsSave
|| _msg.getMessage() == appl::Buffer::eventChangeName) { || _msg.getMessage() == appl::Buffer::eventChangeName) {
// select a new Buffer ==> change title: // select a new Buffer ==> change title:
appl::Buffer* tmpp = m_bufferManager->getBufferSelected(); ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) { if (tmpp == NULL) {
setTitle("Edn"); setTitle("Edn");
if (m_widgetLabelFileName != NULL) { if (m_widgetLabelFileName != NULL) {
@ -422,7 +425,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData()); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
APPL_ERROR("Error to get the buffer : " << _msg.getData()); APPL_ERROR("Error to get the buffer : " << _msg.getData());
return; return;
@ -441,7 +444,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData()); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
APPL_ERROR("Error to get the buffer : " << _msg.getData()); APPL_ERROR("Error to get the buffer : " << _msg.getData());
return; return;
@ -452,7 +455,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData()); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
APPL_ERROR("Error to get the buffer : " << _msg.getData()); APPL_ERROR("Error to get the buffer : " << _msg.getData());
return; return;
@ -463,7 +466,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
return; return;
} }
void MainWindows::saveAsPopUp(appl::Buffer* _buffer) { void MainWindows::saveAsPopUp(const ewol::object::Shared<appl::Buffer>& _buffer) {
if (_buffer == NULL) { if (_buffer == NULL) {
APPL_ERROR("Call With NULL input..."); APPL_ERROR("Call With NULL input...");
return; return;
@ -471,19 +474,19 @@ void MainWindows::saveAsPopUp(appl::Buffer* _buffer) {
appl::WorkerSaveFile* tmpObject = new appl::WorkerSaveFile(_buffer->getFileName()); appl::WorkerSaveFile* tmpObject = new appl::WorkerSaveFile(_buffer->getFileName());
} }
void MainWindows::closeNotSavedFile(appl::Buffer* _buffer) { void MainWindows::closeNotSavedFile(const ewol::object::Shared<appl::Buffer>& _buffer) {
if (_buffer == NULL) { if (_buffer == NULL) {
APPL_ERROR("Call With NULL input..."); APPL_ERROR("Call With NULL input...");
return; return;
} }
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp(); ewol::object::Shared<ewol::widget::StdPopUp> tmpPopUp = ewol::object::makeShared(new ewol::widget::StdPopUp());
if (tmpPopUp == NULL) { if (tmpPopUp == NULL) {
APPL_ERROR("Can not create a simple pop-up"); APPL_ERROR("Can not create a simple pop-up");
return; return;
} }
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>"); tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
tmpPopUp->setComment("The file named : <i>\"" + _buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost..."); tmpPopUp->setComment("The file named : <i>\"" + _buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
ewol::Widget* bt = NULL; ewol::object::Shared<ewol::Widget> bt = NULL;
if (_buffer->hasFileName() == true) { if (_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true); bt = tmpPopUp->addButton("Save", true);
if (bt != NULL) { if (bt != NULL) {
@ -507,7 +510,7 @@ void MainWindows::closeNotSavedFile(appl::Buffer* _buffer) {
popUpWidgetPush(tmpPopUp); popUpWidgetPush(tmpPopUp);
} }
void MainWindows::onObjectRemove(ewol::Object* _removeObject) { void MainWindows::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
ewol::widget::Windows::onObjectRemove(_removeObject); ewol::widget::Windows::onObjectRemove(_removeObject);
if (m_widgetLabelFileName == _removeObject) { if (m_widgetLabelFileName == _removeObject) {
m_widgetLabelFileName = NULL; m_widgetLabelFileName = NULL;

View File

@ -19,26 +19,26 @@
class MainWindows : public ewol::widget::Windows { class MainWindows : public ewol::widget::Windows {
private: private:
ewol::widget::Label* m_widgetLabelFileName; ewol::object::Shared<ewol::widget::Label> m_widgetLabelFileName;
public: public:
// Constructeur // Constructeur
MainWindows(); MainWindows();
~MainWindows(); virtual ~MainWindows();
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
/** /**
* @brief Display a pop-up to the select the name of the file. * @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. * @param[in] _buffer Buffer that might be saved with a new name.
*/ */
void saveAsPopUp(appl::Buffer* _buffer); void saveAsPopUp(const ewol::object::Shared<appl::Buffer>& _buffer);
/** /**
* @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved. * @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. * @param[in] _buffer Buffer that might be close.
*/ */
void closeNotSavedFile(appl::Buffer* _buffer); void closeNotSavedFile(const ewol::object::Shared<appl::Buffer>& _buffer);
public: // Derived function public: // Derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object * _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
}; };

View File

@ -28,7 +28,7 @@ const char* const l_eventWrapCb = "appl-wrap-CheckBox";
const char* const l_eventForwardCb = "appl-forward-CheckBox"; const char* const l_eventForwardCb = "appl-forward-CheckBox";
const char* const l_eventHideBt = "appl-hide-button"; const char* const l_eventHideBt = "appl-hide-button";
Search::Search() : appl::widget::Search::Search() :
ewol::widget::Composer(ewol::widget::Composer::file, "DATA:GUI-Search.xml"), ewol::widget::Composer(ewol::widget::Composer::file, "DATA:GUI-Search.xml"),
m_viewerManager(NULL), m_viewerManager(NULL),
m_forward(true), m_forward(true),
@ -36,8 +36,8 @@ Search::Search() :
m_wrap(true), m_wrap(true),
m_searchEntry(NULL), m_searchEntry(NULL),
m_replaceEntry(NULL) { m_replaceEntry(NULL) {
addObjectType("appl::Search"); addObjectType("appl::widget::Search");
// load buffer manager: // load buffer manager:onObjectRemove
m_viewerManager = appl::ViewerManager::keep(); m_viewerManager = appl::ViewerManager::keep();
// link event // link event
registerOnEventNameWidget(this, "SEARCH:close", "pressed", l_eventHideBt); registerOnEventNameWidget(this, "SEARCH:close", "pressed", l_eventHideBt);
@ -55,24 +55,24 @@ Search::Search() :
setConfigNamed("SEARCH:wrap", "value", std::to_string(m_wrap)); setConfigNamed("SEARCH:wrap", "value", std::to_string(m_wrap));
setConfigNamed("SEARCH:up-down", "value", std::to_string(m_forward)); setConfigNamed("SEARCH:up-down", "value", std::to_string(m_forward));
// get widget // get widget
m_searchEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:search-entry")); m_searchEntry = ewol::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:search-entry"));
m_replaceEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:replace-entry")); m_replaceEntry = ewol::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:replace-entry"));
// Display and hide event: // Display and hide event:
registerMultiCast(ednMsgGuiSearch); registerMultiCast(ednMsgGuiSearch);
// basicly hiden ... // basicly hiden ...
hide(); hide();
} }
Search::~Search() { appl::widget::Search::~Search() {
appl::ViewerManager::release(m_viewerManager);
} }
void Search::find() { void appl::widget::Search::find() {
if (m_viewerManager == NULL) { if (m_viewerManager == NULL) {
APPL_WARNING("No viewer manager selected!!!"); APPL_WARNING("No viewer manager selected!!!");
return; return;
} }
appl::TextViewer* viewer = m_viewerManager->getViewerSelected(); ewol::object::Shared<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == NULL) { if (viewer == NULL) {
APPL_INFO("No viewer selected!!!"); APPL_INFO("No viewer selected!!!");
return; return;
@ -103,12 +103,12 @@ void Search::find() {
} }
} }
void Search::replace() { void appl::widget::Search::replace() {
if (m_viewerManager == NULL) { if (m_viewerManager == NULL) {
APPL_WARNING("No viewer manager selected!!!"); APPL_WARNING("No viewer manager selected!!!");
return; return;
} }
appl::TextViewer* viewer = m_viewerManager->getViewerSelected(); ewol::object::Shared<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == NULL) { if (viewer == NULL) {
APPL_INFO("No viewer selected!!!"); APPL_INFO("No viewer selected!!!");
return; return;
@ -121,7 +121,7 @@ void Search::replace() {
} }
void Search::onReceiveMessage(const ewol::object::Message& _msg) { void appl::widget::Search::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::Composer::onReceiveMessage(_msg); ewol::widget::Composer::onReceiveMessage(_msg);
APPL_INFO("Search receive message : " << _msg); APPL_INFO("Search receive message : " << _msg);
if ( _msg.getMessage() == l_eventSearchEntry) { if ( _msg.getMessage() == l_eventSearchEntry) {
@ -162,16 +162,16 @@ void Search::onReceiveMessage(const ewol::object::Message& _msg) {
} }
} }
void Search::onObjectRemove(ewol::Object * _removeObject) { void appl::widget::Search::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
ewol::widget::Composer::onObjectRemove(_removeObject); ewol::widget::Composer::onObjectRemove(_object);
if (_removeObject == m_searchEntry) { if (_object == m_searchEntry) {
m_searchEntry = NULL; m_searchEntry.reset();
} }
if (_removeObject == m_replaceEntry) { if (_object == m_replaceEntry) {
m_replaceEntry = NULL; m_replaceEntry.reset();
} }
if (_removeObject == m_viewerManager) { if (_object == m_viewerManager) {
m_viewerManager = NULL; m_viewerManager.reset();
} }
} }

View File

@ -14,21 +14,22 @@
#include <ewol/widget/Entry.h> #include <ewol/widget/Entry.h>
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/Gui/ViewerManager.h> #include <appl/Gui/ViewerManager.h>
namespace appl {
class Search : public ewol::widget::Composer { namespace widget {
class Search : public ewol::widget::Composer {
private: private:
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager ewol::object::Shared<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
bool m_forward; bool m_forward;
bool m_caseSensitive; bool m_caseSensitive;
bool m_wrap; bool m_wrap;
ewol::widget::Entry* m_searchEntry; ewol::object::Shared<ewol::widget::Entry> m_searchEntry;
ewol::widget::Entry* m_replaceEntry; ewol::object::Shared<ewol::widget::Entry> m_replaceEntry;
std::u32string m_searchData; std::u32string m_searchData;
std::u32string m_replaceData; std::u32string m_replaceData;
public: public:
// Constructeur // Constructeur
Search(); Search();
~Search(); virtual ~Search();
private: private:
/** /**
* @brief Find the next element that corespond at the search * @brief Find the next element that corespond at the search
@ -40,9 +41,10 @@ class Search : public ewol::widget::Composer {
void replace(); void replace();
public: // derived function public: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object * _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
};
};
}; };
#endif #endif

View File

@ -34,11 +34,10 @@ appl::TagFileList::TagFileList() {
appl::TagFileList::~TagFileList() { appl::TagFileList::~TagFileList() {
for (int32_t iii=0; iii<m_list.size(); iii++) { for (auto &it : m_list) {
delete(m_list[iii]); delete(it);
m_list[iii] = NULL; it = NULL;
} }
ewol::resource::ColorFile::release(m_colorProperty);
} }
etk::Color<> appl::TagFileList::getBasicBG() { etk::Color<> appl::TagFileList::getBasicBG() {
@ -59,7 +58,7 @@ uint32_t appl::TagFileList::getNuberOfRaw() {
} }
bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
if (_raw >= 0 && _raw < m_list.size() && NULL != m_list[_raw]) { if (_raw >= 0 && (size_t)_raw < m_list.size() && NULL != m_list[_raw]) {
if (0 == _colomn) { if (0 == _colomn) {
_myTextToWrite = std::to_string(m_list[_raw]->fileLine); _myTextToWrite = std::to_string(m_list[_raw]->fileLine);
} else { } else {
@ -86,7 +85,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw ); EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
if (_IdInput == 1) { if (_IdInput == 1) {
int32_t previousRaw = m_selectedLine; int32_t previousRaw = m_selectedLine;
if (_raw > m_list.size() ) { if (_raw > (int64_t)m_list.size() ) {
m_selectedLine = -1; m_selectedLine = -1;
} else { } else {
m_selectedLine = _raw; m_selectedLine = _raw;
@ -96,7 +95,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
event = applEventCtagsListSelect; event = applEventCtagsListSelect;
} }
if( m_selectedLine >= 0 if( m_selectedLine >= 0
&& m_selectedLine < m_list.size() && m_selectedLine < (int64_t)m_list.size()
&& NULL != m_list[m_selectedLine] ) { && NULL != m_list[m_selectedLine] ) {
generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename); generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
} else { } else {

View File

@ -28,7 +28,7 @@ namespace appl {
fileLine(_line) { fileLine(_line) {
}; };
~TagListElement() { virtual ~TagListElement() {
}; };
}; };
@ -37,14 +37,14 @@ namespace appl {
int32_t m_selectedLine; int32_t m_selectedLine;
std::vector<appl::TagListElement*> m_list; std::vector<appl::TagListElement*> m_list;
protected: protected:
ewol::resource::ColorFile* m_colorProperty; //!< theme color property. ewol::object::Shared<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
int32_t m_colorIdText; //!< Color of the text. int32_t m_colorIdText; //!< Color of the text.
int32_t m_colorIdBackground1; //!< Color of the Background. int32_t m_colorIdBackground1; //!< Color of the Background.
int32_t m_colorIdBackground2; //!< Color of the Background 2. int32_t m_colorIdBackground2; //!< Color of the Background 2.
int32_t m_colorIdBackgroundSelected; //!< Color of line selected. int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
public: public:
TagFileList(); TagFileList();
~TagFileList(); virtual ~TagFileList();
// display API : // display API :
virtual etk::Color<> getBasicBG(); virtual etk::Color<> getBasicBG();
uint32_t getNuberOfColomn(); uint32_t getNuberOfColomn();

View File

@ -35,9 +35,9 @@ appl::TagFileSelection::TagFileSelection() {
addEventId(applEventctagsSelection); addEventId(applEventctagsSelection);
addEventId(applEventctagsCancel); addEventId(applEventctagsCancel);
ewol::widget::Label* myWidgetTitle = NULL; ewol::object::Shared<ewol::widget::Label> myWidgetTitle;
ewol::widget::Sizer * mySizerVert = NULL; ewol::object::Shared<ewol::widget::Sizer> mySizerVert;
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent)); setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
#elif defined(__TARGET_OS__Windows) #elif defined(__TARGET_OS__Windows)
@ -46,7 +46,7 @@ appl::TagFileSelection::TagFileSelection() {
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent)); setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#endif #endif
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert); mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
if (NULL == mySizerVert) { if (NULL == mySizerVert) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -54,7 +54,7 @@ appl::TagFileSelection::TagFileSelection() {
mySizerVert->setExpand(bvec2(true,true)); mySizerVert->setExpand(bvec2(true,true));
// set it in the pop-up-system : // set it in the pop-up-system :
setSubWidget(mySizerVert); setSubWidget(mySizerVert);
ewol::widget::Composer* compose = new ewol::widget::Composer(ewol::widget::Composer::String, ewol::object::Shared<ewol::widget::Composer> compose = ewol::object::makeShared(new ewol::widget::Composer(ewol::widget::Composer::String,
"<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n" "<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n"
" <spacer expand=\"true,false\"/>\n" " <spacer expand=\"true,false\"/>\n"
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">" " <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
@ -69,14 +69,14 @@ appl::TagFileSelection::TagFileSelection() {
" <label>Cancel</label>\n" " <label>Cancel</label>\n"
" </sizer>\n" " </sizer>\n"
" </button>\n" " </button>\n"
"</sizer>\n"); "</sizer>\n"));
compose->setExpand(bvec2(true,false)); compose->setExpand(bvec2(true,false));
compose->setFill(bvec2(true,true)); compose->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(compose); mySizerVert->subWidgetAdd(compose);
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection); compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel); compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
m_listTag = new appl::TagFileList(); m_listTag = ewol::object::makeShared(new appl::TagFileList());
if (NULL == m_listTag) { if (NULL == m_listTag) {
EWOL_ERROR("Can not allocate widget == > display might be in error"); EWOL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -139,7 +139,7 @@ void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) {
} }
} }
void appl::TagFileSelection::onObjectRemove(ewol::Object * _removeObject) { void appl::TagFileSelection::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
// First step call parrent : // First step call parrent :
ewol::widget::PopUp::onObjectRemove(_removeObject); ewol::widget::PopUp::onObjectRemove(_removeObject);
// second step find if in all the elements ... // second step find if in all the elements ...

View File

@ -19,7 +19,7 @@ extern const char * const applEventctagsCancel;
namespace appl { namespace appl {
class TagFileSelection : public ewol::widget::PopUp { class TagFileSelection : public ewol::widget::PopUp {
private: private:
appl::TagFileList* m_listTag; ewol::object::Shared<appl::TagFileList> m_listTag;
std::string m_eventNamed; std::string m_eventNamed;
public: public:
TagFileSelection(); TagFileSelection();
@ -32,7 +32,7 @@ namespace appl {
void addCtagsNewItem(std::string file, int32_t line); void addCtagsNewItem(std::string file, int32_t line);
public: // herited function public: // herited function
void onReceiveMessage(const ewol::object::Message& _msg); void onReceiveMessage(const ewol::object::Message& _msg);
void onObjectRemove(ewol::Object * _removeObject); void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
}; };
}; };

View File

@ -29,7 +29,6 @@
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms"); APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) : appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
m_buffer(NULL),
m_displayText(_fontName, _fontSize), m_displayText(_fontName, _fontSize),
m_insertMode(false) { m_insertMode(false) {
addObjectType("appl::TextViewer"); addObjectType("appl::TextViewer");
@ -65,9 +64,6 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
appl::TextViewer::~TextViewer() { appl::TextViewer::~TextViewer() {
appl::textPluginManager::disconnect(*this); appl::textPluginManager::disconnect(*this);
appl::GlyphPainting::release(m_paintingProperties);
appl::BufferManager::release(m_bufferManager);
appl::ViewerManager::release(m_viewerManager);
} }
std::string appl::TextViewer::getBufferPath() { std::string appl::TextViewer::getBufferPath() {
@ -428,7 +424,8 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
} }
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) { bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
if (_event.getId() != 0) { if ( _event.getId() != 0
&& _event.getStatus() == ewol::key::statusDown) {
keepFocus(); keepFocus();
} }
//tic(); //tic();
@ -627,7 +624,7 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::WidgetScrolled::onReceiveMessage(_msg); ewol::widget::WidgetScrolled::onReceiveMessage(_msg);
APPL_VERBOSE("receive msg: " << _msg); APPL_VERBOSE("receive msg: " << _msg);
// First call plugin // First call plugin
if (appl::textPluginManager::onReceiveMessage(*this, _msg) == true) { if (appl::textPluginManager::onReceiveMessageViewer(*this, _msg) == true) {
markToRedraw(); markToRedraw();
return; return;
} }
@ -702,7 +699,7 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
} }
} }
void appl::TextViewer::onObjectRemove(ewol::Object* _removeObject) { void appl::TextViewer::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
ewol::widget::WidgetScrolled::onObjectRemove(_removeObject); ewol::widget::WidgetScrolled::onObjectRemove(_removeObject);
if (m_buffer == _removeObject) { if (m_buffer == _removeObject) {
m_buffer = NULL; m_buffer = NULL;

View File

@ -24,7 +24,7 @@
namespace appl { namespace appl {
class TextViewer : public ewol::widget::WidgetScrolled { class TextViewer : public ewol::widget::WidgetScrolled {
private: private:
appl::GlyphPainting* m_paintingProperties; //!< element painting property ewol::object::Shared<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground; int32_t m_colorBackground;
int32_t m_colorSpace; int32_t m_colorSpace;
int32_t m_colorTabulation; int32_t m_colorTabulation;
@ -33,25 +33,25 @@ namespace appl {
int32_t m_colorSelection; int32_t m_colorSelection;
int32_t m_colorNormal; int32_t m_colorNormal;
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager ewol::object::Shared<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
public: public:
TextViewer(const std::string& _fontName="", int32_t _fontSize=-1); TextViewer(const std::string& _fontName="", int32_t _fontSize=-1);
virtual ~TextViewer(); virtual ~TextViewer();
private: private:
appl::Buffer* m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer) ewol::object::Shared<appl::Buffer> m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
public: public:
/** /**
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData) * @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
* @return pointer on buffer * @return pointer on buffer
*/ */
appl::Buffer* internalGetBuffer() { ewol::object::Shared<appl::Buffer> internalGetBuffer() {
return m_buffer; return m_buffer;
} }
private: private:
ewol::compositing::Text m_displayText; //!< Text display properties. ewol::compositing::Text m_displayText; //!< Text display properties.
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested. ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
std::vector<std::pair<appl::Buffer*, vec2>> m_drawingRemenber; std::vector<std::pair<ewol::object::Shared<appl::Buffer>, vec2>> m_drawingRemenber;
public: public:
void setFontSize(int32_t _size); void setFontSize(int32_t _size);
void setFontName(const std::string& _fontName); void setFontName(const std::string& _fontName);
@ -61,7 +61,7 @@ namespace appl {
virtual bool calculateMinSize(); virtual bool calculateMinSize();
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object* _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);
virtual bool onEventEntry(const ewol::event::Entry& _event); virtual bool onEventEntry(const ewol::event::Entry& _event);
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID); virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);

View File

@ -26,10 +26,14 @@ appl::ViewerManager::ViewerManager() :
} }
appl::ViewerManager::~ViewerManager() { appl::ViewerManager::~ViewerManager() {
appl::BufferManager::release(m_bufferManager);
} }
void appl::ViewerManager::setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer) { bool appl::ViewerManager::isLastSelected(const ewol::object::Shared<appl::TextViewer>& _viewer) {
return m_viewer == _viewer;
}
void appl::ViewerManager::setViewerSelected(const ewol::object::Shared<appl::TextViewer>& _viewer, const ewol::object::Shared<appl::Buffer>& _buffer) {
if (m_viewer == _viewer) { if (m_viewer == _viewer) {
return; return;
} }
@ -43,23 +47,23 @@ void appl::ViewerManager::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_DEBUG("receive message !!! " << _msg); APPL_DEBUG("receive message !!! " << _msg);
} }
void appl::ViewerManager::onObjectRemove(ewol::Object* _removeObject) { void appl::ViewerManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
ewol::Resource:: onObjectRemove(_removeObject); ewol::Resource:: onObjectRemove(_removeObject);
if (_removeObject == m_viewer) { if (_removeObject == m_viewer) {
m_viewer = NULL; m_viewer.reset();
return; return;
} }
} }
appl::ViewerManager* appl::ViewerManager::keep() { ewol::object::Shared<appl::ViewerManager> appl::ViewerManager::keep() {
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\""); //EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
appl::ViewerManager* object = static_cast<appl::ViewerManager*>(getManager().localKeep("???ViewerManager???")); ewol::object::Shared<appl::ViewerManager> object = ewol::dynamic_pointer_cast<appl::ViewerManager>(getManager().localKeep("???ViewerManager???"));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
// this element create a new one every time .... // this element create a new one every time ....
EWOL_INFO("CREATE : appl::ViewerManager: ???ViewerManager???"); EWOL_INFO("CREATE : appl::ViewerManager: ???ViewerManager???");
object = new appl::ViewerManager(); object = ewol::object::makeShared(new appl::ViewerManager());
if (NULL == object) { if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ???ViewerManager???"); EWOL_ERROR("allocation error of a resource : ???ViewerManager???");
return NULL; return NULL;
@ -67,12 +71,3 @@ appl::ViewerManager* appl::ViewerManager::keep() {
getManager().localAdd(object); getManager().localAdd(object);
return object; return object;
} }
void appl::ViewerManager::release(appl::ViewerManager*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@ -20,21 +20,22 @@ namespace appl {
class ViewerManager : public ewol::Resource { class ViewerManager : public ewol::Resource {
protected: protected:
ViewerManager(); ViewerManager();
~ViewerManager(); public:
virtual ~ViewerManager();
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
appl::TextViewer* m_viewer; ewol::object::Shared<appl::TextViewer> m_viewer;
public: public:
/** /**
* @brief Set the current buffer selected * @brief Set the current buffer selected
* @param[in] _viewer Pointer on the viewer selected * @param[in] _viewer Pointer on the viewer selected
*/ */
void setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer); void setViewerSelected(const ewol::object::Shared<appl::TextViewer>& _viewer, const ewol::object::Shared<appl::Buffer>& _buffer);
/** /**
* @brief Get the current buffer selected * @brief Get the current buffer selected
* @return Pointer on the buffer selected * @return Pointer on the buffer selected
*/ */
appl::TextViewer* getViewerSelected() { ewol::object::Shared<appl::TextViewer> getViewerSelected() {
return m_viewer; return m_viewer;
}; };
/** /**
@ -42,12 +43,10 @@ namespace appl {
* @param[in] _viewer element selected. * @param[in] _viewer element selected.
* @return true if the element is selected * @return true if the element is selected
*/ */
bool isLastSelected(appl::TextViewer* _viewer) { bool isLastSelected(const ewol::object::Shared<appl::TextViewer>& _viewer);
return m_viewer == _viewer;
};
public: // herited function public: // herited function
void onReceiveMessage(const ewol::object::Message& _msg); void onReceiveMessage(const ewol::object::Message& _msg);
void onObjectRemove(ewol::Object* _removeObject); void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
public: // resource manager public: // resource manager
/** /**
* @brief keep the resource pointer. * @brief keep the resource pointer.
@ -55,12 +54,7 @@ namespace appl {
* @param[in] _filename Name of the configuration file. * @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static appl::ViewerManager* keep(); static ewol::object::Shared<appl::ViewerManager> keep();
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::ViewerManager*& _object);
}; };
}; };

View File

@ -29,7 +29,7 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile() :
} }
// List all current open file : // List all current open file :
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) { for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
appl::Buffer* tmpBuffer = m_bufferManager->get(iii); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
continue; continue;
} }
@ -45,7 +45,7 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile() :
return; return;
} }
// create the worker : // create the worker :
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front()); m_worker = ewol::object::makeShared(new appl::WorkerCloseFile(m_bufferNameList.front()));
// remove first element : // remove first element :
m_bufferNameList.erase(m_bufferNameList.begin()); m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
@ -56,7 +56,7 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile() :
} }
appl::WorkerCloseAllFile::~WorkerCloseAllFile() { appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
appl::BufferManager::release(m_bufferManager);
} }
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
@ -70,7 +70,7 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
return; return;
} }
// create the worker : // create the worker :
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front()); m_worker = ewol::object::makeShared(new appl::WorkerCloseFile(m_bufferNameList.front()));
// remove first element : // remove first element :
m_bufferNameList.erase(m_bufferNameList.begin()); m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
@ -81,7 +81,7 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
} }
} }
void appl::WorkerCloseAllFile::onObjectRemove(ewol::Object* _removeObject) { void appl::WorkerCloseAllFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
if (_removeObject == m_worker) { if (_removeObject == m_worker) {
m_worker = NULL; m_worker = NULL;
APPL_VERBOSE("AutoRemove After saving sub widget ..."); APPL_VERBOSE("AutoRemove After saving sub widget ...");

View File

@ -19,11 +19,11 @@ namespace appl {
virtual ~WorkerCloseAllFile(); virtual ~WorkerCloseAllFile();
private: private:
std::vector<std::string> m_bufferNameList; std::vector<std::string> m_bufferNameList;
appl::WorkerCloseFile* m_worker; //! pop-up element that is open... ewol::object::Shared<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object * _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
}; };
}; };

View File

@ -38,7 +38,7 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
} }
if (m_bufferName == "") { if (m_bufferName == "") {
// need to find the curent file ... // need to find the curent file ...
appl::Buffer* tmpp = m_bufferManager->getBufferSelected(); ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) { if (tmpp == NULL) {
APPL_ERROR("No selected buffer now ..."); APPL_ERROR("No selected buffer now ...");
autoDestroy(); autoDestroy();
@ -63,14 +63,14 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
return; return;
} }
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp(); ewol::object::Shared<ewol::widget::StdPopUp> tmpPopUp = ewol::object::makeShared(new ewol::widget::StdPopUp());
if (tmpPopUp == NULL) { if (tmpPopUp == NULL) {
APPL_ERROR("Can not create a simple pop-up"); APPL_ERROR("Can not create a simple pop-up");
return; return;
} }
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>"); tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
tmpPopUp->setComment("The file named : <i>\"" + m_buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost..."); tmpPopUp->setComment("The file named : <i>\"" + m_buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
ewol::Widget* bt = NULL; ewol::object::Shared<ewol::Widget> bt = NULL;
if (m_buffer->hasFileName() == true) { if (m_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true); bt = tmpPopUp->addButton("Save", true);
if (bt != NULL) { if (bt != NULL) {
@ -87,7 +87,7 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
} }
tmpPopUp->addButton("Cancel", true); tmpPopUp->addButton("Cancel", true);
tmpPopUp->setRemoveOnExternClick(true); tmpPopUp->setRemoveOnExternClick(true);
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows(); ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) { if (tmpWindows == NULL) {
APPL_ERROR("Error to get the windows."); APPL_ERROR("Error to get the windows.");
autoDestroy(); autoDestroy();
@ -97,7 +97,7 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
} }
appl::WorkerCloseFile::~WorkerCloseFile() { appl::WorkerCloseFile::~WorkerCloseFile() {
appl::BufferManager::release(m_bufferManager);
} }
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
@ -107,7 +107,7 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
} }
APPL_DEBUG("have message : " << _msg); APPL_DEBUG("have message : " << _msg);
if (_msg.getMessage() == s_saveAsValidate) { if (_msg.getMessage() == s_saveAsValidate) {
m_worker = new appl::WorkerSaveFile(m_bufferName); m_worker = ewol::object::makeShared(new appl::WorkerSaveFile(m_bufferName));
if (m_worker != NULL) { if (m_worker != NULL) {
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone); m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
} }
@ -118,7 +118,7 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
return; return;
} }
if (m_buffer->storeFile() == false) { if (m_buffer->storeFile() == false) {
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows(); ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) { if (tmpWindows == NULL) {
return; return;
} }
@ -138,7 +138,7 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
} }
} }
void appl::WorkerCloseFile::onObjectRemove(ewol::Object* _removeObject) { void appl::WorkerCloseFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
if (_removeObject == m_worker) { if (_removeObject == m_worker) {
m_worker = NULL; m_worker = NULL;
APPL_VERBOSE("AutoRemove After closing sub widget ..."); APPL_VERBOSE("AutoRemove After closing sub widget ...");

View File

@ -23,12 +23,12 @@ namespace appl {
virtual ~WorkerCloseFile(); virtual ~WorkerCloseFile();
private: private:
std::string m_bufferName; std::string m_bufferName;
appl::Buffer* m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer ewol::object::Shared<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
appl::WorkerSaveFile* m_worker; //! sub-worker element... ewol::object::Shared<appl::WorkerSaveFile> m_worker; //! sub-worker element...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object * _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
}; };
}; };

View File

@ -28,8 +28,8 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile() :
return; return;
} }
// List all current open file : // List all current open file :
for (size_t iii=0; iii<m_bufferManager->size(); ++iii) { for (int32_t iii=0; iii<m_bufferManager->size(); ++iii) {
appl::Buffer* tmpBuffer = m_bufferManager->get(iii); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
continue; continue;
} }
@ -48,7 +48,7 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile() :
return; return;
} }
// create the worker : // create the worker :
m_worker = new appl::WorkerSaveFile(m_bufferNameList.front()); m_worker = ewol::object::makeShared(new appl::WorkerSaveFile(m_bufferNameList.front()));
// remove first element : // remove first element :
m_bufferNameList.erase(m_bufferNameList.begin()); m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
@ -59,7 +59,7 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile() :
} }
appl::WorkerSaveAllFile::~WorkerSaveAllFile() { appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
appl::BufferManager::release(m_bufferManager);
} }
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
@ -84,7 +84,7 @@ void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg
} }
} }
void appl::WorkerSaveAllFile::onObjectRemove(ewol::Object* _removeObject) { void appl::WorkerSaveAllFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
if (_removeObject == m_worker) { if (_removeObject == m_worker) {
m_worker = NULL; m_worker = NULL;
APPL_VERBOSE("AutoRemove After saving sub widget ..."); APPL_VERBOSE("AutoRemove After saving sub widget ...");

View File

@ -19,11 +19,11 @@ namespace appl {
virtual ~WorkerSaveAllFile(); virtual ~WorkerSaveAllFile();
private: private:
std::vector<std::string> m_bufferNameList; std::vector<std::string> m_bufferNameList;
appl::WorkerSaveFile* m_worker; //! pop-up element that is open... ewol::object::Shared<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object * _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
}; };
}; };

View File

@ -33,7 +33,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
} }
if (m_bufferName == "") { if (m_bufferName == "") {
// need to find the curent file ... // need to find the curent file ...
appl::Buffer* tmpp = m_bufferManager->getBufferSelected(); ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) { if (tmpp == NULL) {
APPL_ERROR("No selected buffer now ..."); APPL_ERROR("No selected buffer now ...");
autoDestroy(); autoDestroy();
@ -46,7 +46,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
autoDestroy(); autoDestroy();
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
APPL_ERROR("Error to get the buffer : " << m_bufferName); APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy(); autoDestroy();
@ -60,7 +60,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
return; return;
} }
} }
m_chooser = new ewol::widget::FileChooser(); m_chooser = ewol::object::makeShared(new ewol::widget::FileChooser());
if (NULL == m_chooser) { if (NULL == m_chooser) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
autoDestroy(); autoDestroy();
@ -71,7 +71,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
etk::FSNode tmpName(m_bufferName); etk::FSNode tmpName(m_bufferName);
m_chooser->setFolder(tmpName.getNameFolder()); m_chooser->setFolder(tmpName.getNameFolder());
m_chooser->setFileName(tmpName.getNameFile()); m_chooser->setFileName(tmpName.getNameFile());
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows(); ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) { if (tmpWindows == NULL) {
APPL_ERROR("Error to get the windows."); APPL_ERROR("Error to get the windows.");
autoDestroy(); autoDestroy();
@ -82,7 +82,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
} }
appl::WorkerSaveFile::~WorkerSaveFile() { appl::WorkerSaveFile::~WorkerSaveFile() {
appl::BufferManager::release(m_bufferManager);
} }
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
@ -99,14 +99,14 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName); APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName); ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == NULL) { if (tmpBuffer == NULL) {
APPL_ERROR("Error to get the buffer : " << m_bufferName); APPL_ERROR("Error to get the buffer : " << m_bufferName);
return; return;
} }
tmpBuffer->setFileName(_msg.getData()); tmpBuffer->setFileName(_msg.getData());
if (tmpBuffer->storeFile() == false) { if (tmpBuffer->storeFile() == false) {
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows(); ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) { if (tmpWindows == NULL) {
return; return;
} }
@ -117,7 +117,7 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
} }
} }
void appl::WorkerSaveFile::onObjectRemove(ewol::Object* _removeObject) { void appl::WorkerSaveFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
if (_removeObject == m_chooser) { if (_removeObject == m_chooser) {
m_chooser = NULL; m_chooser = NULL;
APPL_VERBOSE("AutoRemove After closing sub widget ..."); APPL_VERBOSE("AutoRemove After closing sub widget ...");

View File

@ -21,11 +21,11 @@ namespace appl {
virtual ~WorkerSaveFile(); virtual ~WorkerSaveFile();
private: private:
std::string m_bufferName; std::string m_bufferName;
ewol::widget::FileChooser* m_chooser; //! pop-up element that is open... ewol::object::Shared<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object * _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
}; };
}; };

View File

@ -25,19 +25,20 @@
#define HL2_DEBUG APPL_VERBOSE #define HL2_DEBUG APPL_VERBOSE
void appl::Highlight::parseRules(exml::Element* _child, void appl::Highlight::parseRules(exml::Element* _child,
std::vector<HighlightPattern*>& _mListPatern, std::vector<std::unique_ptr<HighlightPattern>>& _mListPatern,
int32_t _level) { int32_t _level) {
// Create the patern ... // Create the patern ...
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties); HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
// parse under Element // parse under Element
myPattern->parseRules(_child, _level); myPattern->parseRules(_child, _level);
// add element in the list // add element in the list
_mListPatern.push_back(myPattern); _mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
} }
appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) : appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) :
ewol::Resource(_xmlFilename), ewol::Resource(_xmlFilename),
m_typeName("") { m_typeName("") {
addObjectType("appl::Highlight");
// keep color propertiy file : // keep color propertiy file :
m_paintingProperties = appl::GlyphPainting::keep(_colorFile); m_paintingProperties = appl::GlyphPainting::keep(_colorFile);
@ -55,7 +56,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
int32_t level1 = 0; int32_t level1 = 0;
int32_t level2 = 0; int32_t level2 = 0;
// parse all the elements : // parse all the elements :
for(int32_t iii = 0; iii < root->size(); ++iii) { for(size_t iii = 0; iii < root->size(); ++iii) {
exml::Element* child = root->getElement(iii); exml::Element* child = root->getElement(iii);
if (child == NULL) { if (child == NULL) {
// trash here all that is not element ... // trash here all that is not element ...
@ -69,7 +70,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
} }
} else if (child->getValue() == "pass1") { } else if (child->getValue() == "pass1") {
// get sub Nodes ... // get sub Nodes ...
for(int32_t jjj=0; jjj< child->size(); jjj++) { for(size_t jjj=0; jjj< child->size(); jjj++) {
exml::Element* passChild = child->getElement(jjj); exml::Element* passChild = child->getElement(jjj);
if (passChild == NULL) { if (passChild == NULL) {
continue; continue;
@ -82,7 +83,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
} }
} else if (child->getValue() == "pass2") { } else if (child->getValue() == "pass2") {
// get sub Nodes ... // get sub Nodes ...
for(int32_t jjj=0; jjj< child->size(); jjj++) { for(size_t jjj=0; jjj< child->size(); jjj++) {
exml::Element* passChild = child->getElement(jjj); exml::Element* passChild = child->getElement(jjj);
if (passChild == NULL) { if (passChild == NULL) {
continue; continue;
@ -100,24 +101,19 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
} }
appl::Highlight::~Highlight() { appl::Highlight::~Highlight() {
// clean all Element
for (int32_t iii = 0; iii < m_listHighlightPass1.size(); ++iii) {
if (m_listHighlightPass1[iii] != NULL) {
delete(m_listHighlightPass1[iii]);
m_listHighlightPass1[iii] = NULL;
}
}
// clear the compleate list // clear the compleate list
m_listHighlightPass1.clear(); m_listHighlightPass1.clear();
// clear the compleate list // clear the compleate list
m_listHighlightPass2.clear();
// clear the compleate list
m_listExtentions.clear(); m_listExtentions.clear();
} }
bool appl::Highlight::hasExtention(const std::string& _ext) { bool appl::Highlight::hasExtention(const std::string& _ext) {
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) { for (auto &it : m_listExtentions) {
APPL_VERBOSE(" check : " << m_listExtentions[iii] << "=?=" << _ext); APPL_VERBOSE(" check : " << it << "=?=" << _ext);
if ( m_listExtentions[iii] == "*." + _ext if ( it == "*." + _ext
|| m_listExtentions[iii] == _ext) { || it == _ext) {
return true; return true;
} }
} }
@ -135,8 +131,8 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
} }
APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" "); APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" ");
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) { for (auto &it : m_listExtentions) {
if (extention == m_listExtentions[iii] ) { if (extention == it ) {
return true; return true;
} }
} }
@ -146,17 +142,17 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
void appl::Highlight::display() { void appl::Highlight::display() {
APPL_INFO("List of ALL Highlight : "); APPL_INFO("List of ALL Highlight : ");
for (int32_t iii=0; iii< m_listExtentions.size(); iii++) { for (auto &it : m_listExtentions) {
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] ); APPL_INFO(" Extention : " << it );
} }
// display all elements // display all elements
for (int32_t iii=0; iii< m_listHighlightPass1.size(); iii++) { for (auto &it : m_listHighlightPass1) {
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->getName() ); APPL_INFO(" Pass 1 : " << it->getName() );
//m_listHighlightPass1[iii]->display(); //m_listHighlightPass1[iii]->display();
} }
// display all elements // display all elements
for (int32_t iii=0; iii< m_listHighlightPass2.size(); iii++) { for (auto &it : m_listHighlightPass2) {
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->getName() ); APPL_INFO(" pass 2 : " << it->getName() );
//m_listHighlightPass2[iii]->display(); //m_listHighlightPass2[iii]->display();
} }
} }
@ -179,7 +175,7 @@ void appl::Highlight::parse(int64_t _start,
while (elementStart <= elementStop) { while (elementStart <= elementStop) {
HL_DEBUG("Parse element in the buffer pos=" << elementStart); HL_DEBUG("Parse element in the buffer pos=" << elementStart);
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){ for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
enum resultFind ret = HLP_FIND_OK; enum resultFind ret = HLP_FIND_OK;
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ")" ); HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ")" );
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)
@ -188,13 +184,13 @@ void appl::Highlight::parse(int64_t _start,
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); HL_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// remove element in the current List where the current Element have a end inside the next... // remove element in the current List where the current Element have a end inside the next...
int64_t kkk=_addingPos; int64_t kkk=_addingPos;
while(kkk < _metaData.size() ) { while(kkk < (int64_t)_metaData.size() ) {
if (_metaData[kkk].beginStart <= resultat.endStop) { if (_metaData[kkk].beginStart <= resultat.endStop) {
// remove element // remove element
HL_DEBUG("Erase element=" << kkk); HL_DEBUG("Erase element=" << kkk);
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1); _metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
// Increase the end of search // Increase the end of search
if (kkk < _metaData.size()) { if (kkk < (int64_t)_metaData.size()) {
// just befor the end of the next element // just befor the end of the next element
elementStop = _metaData[kkk].beginStart-1; elementStop = _metaData[kkk].beginStart-1;
} else { } else {
@ -240,7 +236,7 @@ void appl::Highlight::parse2(int64_t _start,
while (elementStart < elementStop) { while (elementStart < elementStop) {
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" ); //HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<m_listHighlightPass2.size(); jjj++){ for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass2.size(); jjj++){
enum resultFind ret = HLP_FIND_OK; enum resultFind ret = HLP_FIND_OK;
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" << HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
_start << "," << _buffer.size() << ")" ); _start << "," << _buffer.size() << ")" );
@ -260,29 +256,20 @@ void appl::Highlight::parse2(int64_t _start,
} }
} }
appl::Highlight* appl::Highlight::keep(const std::string& _filename) { ewol::object::Shared<appl::Highlight> appl::Highlight::keep(const std::string& _filename) {
//EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\""); //EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\"");
appl::Highlight* object = static_cast<appl::Highlight*>(getManager().localKeep(_filename)); ewol::object::Shared<appl::Highlight> object = ewol::dynamic_pointer_cast<appl::Highlight>(getManager().localKeep(_filename));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
EWOL_INFO("CREATE : appl::Highlight : file : \"" << _filename << "\""); EWOL_INFO("CREATE : appl::Highlight : file : \"" << _filename << "\"");
// this element create a new one every time .... // this element create a new one every time ....
object = new appl::Highlight(_filename, "THEME:COLOR:textViewer.json"); object = ewol::object::makeShared(new appl::Highlight(_filename, "THEME:COLOR:textViewer.json"));
if (NULL == object) { if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ??Highlight??"); EWOL_ERROR("allocation error of a resource : ??Highlight??");
return NULL; return NULL;
} }
getManager().localAdd(object); getManager().localAdd(object);
return object; return object;
} }
void appl::Highlight::release(appl::Highlight*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@ -25,6 +25,7 @@ namespace appl {
}; };
}; };
#include <memory>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <appl/HighlightPattern.h> #include <appl/HighlightPattern.h>
#include <appl/GlyphPainting.h> #include <appl/GlyphPainting.h>
@ -34,11 +35,12 @@ namespace appl {
namespace appl { namespace appl {
class Highlight : public ewol::Resource { class Highlight : public ewol::Resource {
private: private:
appl::GlyphPainting* m_paintingProperties; ewol::object::Shared<appl::GlyphPainting> m_paintingProperties;
protected: protected:
// Constructeur // Constructeur
Highlight(const std::string& _xmlFilename, const std::string& _colorFile); Highlight(const std::string& _xmlFilename, const std::string& _colorFile);
~Highlight(); public:
virtual ~Highlight();
private: private:
std::string m_typeName; //!< descriptive string type like "C/C++" std::string m_typeName; //!< descriptive string type like "C/C++"
public: public:
@ -60,12 +62,12 @@ namespace appl {
etk::Buffer &_buffer); etk::Buffer &_buffer);
private: private:
void parseRules(exml::Element* _child, void parseRules(exml::Element* _child,
std::vector<HighlightPattern*> &_mListPatern, std::vector<std::unique_ptr<HighlightPattern>> &_mListPatern,
int32_t _level); int32_t _level);
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer) std::vector<std::unique_ptr<HighlightPattern>> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) ) std::vector<std::unique_ptr<HighlightPattern>> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
public: public:
/** /**
* @brief keep the resource pointer. * @brief keep the resource pointer.
@ -73,12 +75,7 @@ namespace appl {
* @param[in] _filename Name of the configuration file. * @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static appl::Highlight* keep(const std::string& _filename); static ewol::object::Shared<appl::Highlight> keep(const std::string& _filename);
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::Highlight*& _object);
public: // herited function : public: // herited function :
virtual void updateContext() { virtual void updateContext() {
// no upfate to do ... // no upfate to do ...

View File

@ -15,14 +15,16 @@
#undef __class__ #undef __class__
#define __class__ "highlightManager" #define __class__ "highlightManager"
static std::vector<appl::Highlight*>& s_list() { // TODO : Review this in a generic unique resource ...
static std::vector<appl::Highlight*> list;
static std::vector<ewol::object::Shared<appl::Highlight>>& s_list() {
static std::vector<ewol::object::Shared<appl::Highlight>> list;
return list; return list;
} }
void appl::highlightManager::init() { void appl::highlightManager::init() {
std::vector<appl::Highlight*>& hlList = s_list(); std::vector<ewol::object::Shared<appl::Highlight>>& hlList = s_list();
if (hlList.size() != 0) { if (hlList.size() != 0) {
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ..."); APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
hlList.clear(); hlList.clear();
@ -31,16 +33,16 @@ void appl::highlightManager::init() {
etk::FSNode myFile("DATA:languages/"); etk::FSNode myFile("DATA:languages/");
// get the subfolder list : // get the subfolder list :
std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false); std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false);
for (int32_t iii = 0; iii < list.size(); ++iii) { for (auto &it : list) {
if (list[iii] == NULL) { if (it == NULL) {
continue; continue;
} }
if (list[iii]->getNodeType() != etk::FSN_FOLDER) { if (it->getNodeType() != etk::FSN_FOLDER) {
continue; continue;
} }
std::string filename = list[iii]->getName() + "/highlight.xml"; std::string filename = it->getName() + "/highlight.xml";
APPL_DEBUG("Load xml name : " << filename); APPL_DEBUG("Load xml name : " << filename);
appl::Highlight *myHightLine = appl::Highlight::keep(filename); ewol::object::Shared<appl::Highlight> myHightLine = appl::Highlight::keep(filename);
if (myHightLine != NULL) { if (myHightLine != NULL) {
hlList.push_back(myHightLine); hlList.push_back(myHightLine);
} else { } else {
@ -49,29 +51,22 @@ void appl::highlightManager::init() {
} }
// display : // display :
/* /*
for (int32_t iii = 0; iii < hlList.size(); ++iii) { for (auto &it : hlList) {
if (hlList[iii] == NULL) { if (it == NULL) {
continue; continue;
} }
hlList[iii]->display(); it->display();
} }
*/ */
} }
void appl::highlightManager::unInit() { void appl::highlightManager::unInit() {
std::vector<Highlight*>& hlList = s_list(); std::vector<ewol::object::Shared<Highlight>>& hlList = s_list();
if (hlList.size() == 0) { if (hlList.size() == 0) {
APPL_DEBUG("HighlightManager ==> no highlight"); APPL_DEBUG("HighlightManager ==> no highlight");
hlList.clear(); hlList.clear();
return; return;
} }
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
if (hlList[iii] == NULL) {
continue;
}
appl::Highlight::release(hlList[iii]);
hlList[iii] = NULL;
}
hlList.clear(); hlList.clear();
} }
@ -80,16 +75,16 @@ std::string appl::highlightManager::getTypeExtention(const std::string& _extenti
return ""; return "";
} }
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types"); APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
std::vector<Highlight*>& hlList = s_list(); std::vector<ewol::object::Shared<Highlight>>& hlList = s_list();
for (int32_t iii = 0; iii < hlList.size(); ++iii) { for (auto &it : hlList) {
if (hlList[iii] == NULL) { if (it == NULL) {
continue; continue;
} }
APPL_DEBUG(" check : " << hlList[iii]->getTypeName()); APPL_DEBUG(" check : " << it->getTypeName());
if (hlList[iii]->hasExtention(_extention) == true) { if (it->hasExtention(_extention) == true) {
APPL_DEBUG("Find type for extention : " << _extention APPL_DEBUG("Find type for extention : " << _extention
<< " type : " << hlList[iii]->getTypeName()); << " type : " << it->getTypeName());
return hlList[iii]->getTypeName(); return it->getTypeName();
} }
} }
return ""; return "";
@ -99,13 +94,12 @@ std::string appl::highlightManager::getFileWithTypeType(const std::string& _type
if (_type.size() == 0) { if (_type.size() == 0) {
return ""; return "";
} }
std::vector<Highlight*>& hlList = s_list(); for (auto &it : s_list()) {
for (int32_t iii = 0; iii < hlList.size(); ++iii) { if (it == NULL) {
if (hlList[iii] == NULL) {
continue; continue;
} }
if (hlList[iii]->getTypeName() == _type) { if (it->getTypeName() == _type) {
return hlList[iii]->getName(); return it->getName();
} }
} }
return ""; return "";

View File

@ -13,27 +13,20 @@
#undef __class__ #undef __class__
#define __class__ "HighlightPattern" #define __class__ "HighlightPattern"
appl::HighlightPattern::HighlightPattern(appl::GlyphPainting*& _glyphPainting) : appl::HighlightPattern::HighlightPattern(const ewol::object::Shared<appl::GlyphPainting>& _glyphPainting) :
m_glyphPainting(_glyphPainting), m_glyphPainting(_glyphPainting),
m_paternName(""), m_paternName(""),
m_regExpStart(NULL), m_regExpStart(nullptr),
m_regExpStop(NULL), m_regExpStop(nullptr),
m_colorName(""), m_colorName(""),
m_escapeChar(u32char::Null), m_escapeChar(u32char::Null),
m_multiline(false), m_multiline(false),
m_level(0) { m_level(0) {
m_regExpStart = new etk::RegExp<etk::Buffer>(); m_regExpStart = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
} }
appl::HighlightPattern::~HighlightPattern() { appl::HighlightPattern::~HighlightPattern() {
if (m_regExpStart != NULL) {
delete(m_regExpStart);
m_regExpStart = NULL;
}
if (m_regExpStop != NULL) {
delete(m_regExpStop);
m_regExpStop = NULL;
}
} }
void appl::HighlightPattern::setPaternStart(std::string& _regExp) { void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
@ -44,12 +37,9 @@ void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
} }
void appl::HighlightPattern::setPaternStop(std::string& _regExp) { void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
if (m_regExpStop != NULL) { m_regExpStop.reset();
delete(m_regExpStop);
m_regExpStop = NULL;
}
if (_regExp.size() != 0) { if (_regExp.size() != 0) {
m_regExpStop = new etk::RegExp<etk::Buffer>(); m_regExpStop = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
if (m_regExpStop != NULL) { if (m_regExpStop != NULL) {
m_regExpStop->compile(_regExp); m_regExpStop->compile(_regExp);
} else { } else {

View File

@ -29,11 +29,11 @@ enum resultFind {
namespace appl { namespace appl {
class HighlightPattern { class HighlightPattern {
private: private:
appl::GlyphPainting*& m_glyphPainting; ewol::object::Shared<appl::GlyphPainting> m_glyphPainting;
public: public:
// Constructeur // Constructeur
HighlightPattern(appl::GlyphPainting*& _glyphPainting); HighlightPattern(const ewol::object::Shared<appl::GlyphPainting>& _glyphPainting);
~HighlightPattern(); virtual ~HighlightPattern();
private: private:
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
public: public:
@ -44,11 +44,11 @@ namespace appl {
return m_paternName; return m_paternName;
}; };
private: private:
etk::RegExp<etk::Buffer>* m_regExpStart; //!< Start of Regular expression std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExpStart; //!< Start of Regular expression
public: public:
void setPaternStart(std::string& _regExp); void setPaternStart(std::string& _regExp);
private: private:
etk::RegExp<etk::Buffer>* m_regExpStop; //!< Stop of Regular Expression std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExpStop; //!< Stop of Regular Expression
public: public:
void setPaternStop(std::string& _regExp); void setPaternStop(std::string& _regExp);
private: private:

View File

@ -23,7 +23,7 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_activateOnRemove(false), m_activateOnRemove(false),
m_activateOnReceiveMessage(false), m_activateOnReceiveMessage(false),
m_activateOnCursorMove(false) { m_activateOnCursorMove(false) {
addObjectType("appl::TextViewerPlugin");
} }
appl::TextViewerPlugin::~TextViewerPlugin() { appl::TextViewerPlugin::~TextViewerPlugin() {

View File

@ -186,7 +186,7 @@ namespace appl {
* @param[in] _msg Generic message. * @param[in] _msg Generic message.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore
*/ */
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
return false; return false;
} }

View File

@ -17,6 +17,7 @@
appl::TextPluginAutoIndent::TextPluginAutoIndent() { appl::TextPluginAutoIndent::TextPluginAutoIndent() {
m_activateOnEventEntry = true; m_activateOnEventEntry = true;
addObjectType("appl::TextPluginAutoIndent");
} }
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer, bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,

View File

@ -19,7 +19,7 @@ namespace appl {
class TextPluginAutoIndent : public appl::TextViewerPlugin { class TextPluginAutoIndent : public appl::TextViewerPlugin {
public: public:
TextPluginAutoIndent(); TextPluginAutoIndent();
~TextPluginAutoIndent() { virtual ~TextPluginAutoIndent() {
// nothing to do ... // nothing to do ...
}; };
public: public:

View File

@ -17,6 +17,7 @@
appl::TextPluginCopy::TextPluginCopy() { appl::TextPluginCopy::TextPluginCopy() {
m_activateOnReceiveMessage = true; m_activateOnReceiveMessage = true;
addObjectType("appl::TextPluginCopy");
} }
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
@ -33,7 +34,7 @@ void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginCopy::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;

View File

@ -19,13 +19,13 @@ namespace appl {
class TextPluginCopy : public appl::TextViewerPlugin { class TextPluginCopy : public appl::TextViewerPlugin {
public: public:
TextPluginCopy(); TextPluginCopy();
~TextPluginCopy() { virtual ~TextPluginCopy() {
// nothing to do ... // nothing to do ...
}; };
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
}; };
}; };

View File

@ -19,15 +19,16 @@
appl::TextPluginCtags::TextPluginCtags() : appl::TextPluginCtags::TextPluginCtags() :
m_tagFilename(""),
m_tagFolderBase(""), m_tagFolderBase(""),
m_tagFilename(""),
m_ctagFile(NULL) { m_ctagFile(NULL) {
m_activateOnReceiveMessage = true; m_activateOnReceiveMessage = true;
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::keep();
addObjectType("appl::TextPluginCtags");
} }
appl::TextPluginCtags::~TextPluginCtags() { appl::TextPluginCtags::~TextPluginCtags() {
appl::BufferManager::release(m_bufferManager);
} }
const char* eventJumpDestination = "event-plugin-ctags-jump-destination"; const char* eventJumpDestination = "event-plugin-ctags-jump-destination";
@ -78,7 +79,7 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) { if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
APPL_INFO("Multiple file destination ..."); APPL_INFO("Multiple file destination ...");
appl::TagFileSelection* tmpWidget = new appl::TagFileSelection(); ewol::object::Shared<appl::TagFileSelection> tmpWidget = ewol::object::makeShared(new appl::TagFileSelection());
if (NULL == tmpWidget) { if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
@ -167,14 +168,14 @@ void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg)
jumpFile(tmp, lineID - 1); jumpFile(tmp, lineID - 1);
} }
} }
bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == eventOpenCtagsFile) { if (_msg.getMessage() == eventOpenCtagsFile) {
APPL_INFO("Request opening ctag file"); APPL_INFO("Request opening ctag file");
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser(); ewol::object::Shared<ewol::widget::FileChooser> tmpWidget = ewol::object::makeShared(new ewol::widget::FileChooser());
if (NULL == tmpWidget) { if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
return true; return true;

View File

@ -33,14 +33,14 @@ namespace appl {
void printTag(const tagEntry *_entry); void printTag(const tagEntry *_entry);
void jumpTo(const std::string& _name); void jumpTo(const std::string& _name);
void jumpFile(const std::string& _filename, int64_t _lineId); void jumpFile(const std::string& _filename, int64_t _lineId);
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: public:
TextPluginCtags(); TextPluginCtags();
~TextPluginCtags(); virtual ~TextPluginCtags();
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg); const ewol::object::Message& _msg);
// internal message : // internal message :
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);

View File

@ -20,6 +20,7 @@ namespace appl {
public: public:
TextViewerPluginData() { TextViewerPluginData() {
// nothing to do ... // nothing to do ...
addObjectType("appl::TextViewerPluginData");
} }
virtual ~TextViewerPluginData() { virtual ~TextViewerPluginData() {
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) { for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
@ -32,7 +33,7 @@ namespace appl {
m_specificData.clear(); m_specificData.clear();
} }
private: private:
std::vector<std::pair<appl::Buffer* ,TYPE* >> m_specificData; std::vector<std::pair<ewol::object::Shared<appl::Buffer> ,TYPE* >> m_specificData;
protected: protected:
TYPE* getDataRef(appl::TextViewer& _textDrawer) { TYPE* getDataRef(appl::TextViewer& _textDrawer) {
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) { for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
@ -49,13 +50,13 @@ namespace appl {
return data; return data;
} }
protected: // Wrap all element with their internal data: (do not use theses function) protected: // Wrap all element with their internal data: (do not use theses function)
bool onReceiveMessage(appl::TextViewer& _textDrawer, bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
TYPE* data = getDataRef(_textDrawer); TYPE* data = getDataRef(_textDrawer);
if (data == NULL) { if (data == NULL) {
return false; return false;
} }
return onReceiveMessage(_textDrawer, _msg, *data); return onReceiveMessageViewer(_textDrawer, _msg, *data);
} }
bool onWrite(appl::TextViewer& _textDrawer, bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
@ -87,7 +88,7 @@ namespace appl {
} }
public: public:
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const ewol::object::Message& _msg,
TYPE& _data) { TYPE& _data) {
return false; return false;
@ -115,8 +116,14 @@ namespace appl {
return; return;
}; };
public: public:
virtual void onObjectRemove(ewol::Object* _removeObject) { virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
// TODO : plop appl::TextViewerPlugin::onObjectRemove(_object);
for (auto it(m_specificData.begin()); it != m_specificData.end(); ++it) {
if (it->first == _object) {
m_specificData.erase(it);
it = m_specificData.begin();
}
}
}; };
}; };
}; };

View File

@ -20,6 +20,7 @@ appl::TextPluginHistory::TextPluginHistory() {
m_activateOnWrite = true; m_activateOnWrite = true;
m_activateOnReplace = true; m_activateOnReplace = true;
m_activateOnRemove = true; m_activateOnRemove = true;
addObjectType("appl::TextPluginHistory");
} }
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
@ -34,7 +35,7 @@ void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const ewol::object::Message& _msg,
appl::PluginHistoryData& _data) { appl::PluginHistoryData& _data) {
if (isEnable() == false) { if (isEnable() == false) {
@ -176,7 +177,8 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
} }
void appl::TextPluginHistory::onObjectRemove(ewol::Object* _removeObject) { void appl::TextPluginHistory::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
appl::TextViewerPluginData<appl::PluginHistoryData>::onObjectRemove(_object);
// TODO : Dependence with buffer removing ... // TODO : Dependence with buffer removing ...
} }

View File

@ -43,7 +43,7 @@ namespace appl {
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const ewol::object::Message& _msg,
appl::PluginHistoryData& _data); appl::PluginHistoryData& _data);
virtual bool onWrite(appl::TextViewer& _textDrawer, virtual bool onWrite(appl::TextViewer& _textDrawer,
@ -67,7 +67,7 @@ namespace appl {
void clearRedo(appl::PluginHistoryData& _data); void clearRedo(appl::PluginHistoryData& _data);
void clearUndo(appl::PluginHistoryData& _data); void clearUndo(appl::PluginHistoryData& _data);
public: public:
virtual void onObjectRemove(ewol::Object* _removeObject); virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
}; };
}; };

View File

@ -19,36 +19,36 @@
#undef __class__ #undef __class__
#define __class__ "textPluginManager" #define __class__ "textPluginManager"
static std::vector<appl::TextViewerPlugin *>& getList() { static std::list<ewol::object::Owner<appl::TextViewerPlugin>>& getList() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::list<ewol::object::Owner<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnEventEntry() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventEntry() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnEventInput() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventInput() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnWrite() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnWrite() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnReplace() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnReplace() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnRemove() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnRemove() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnReceiveMessage() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListonReceiveMessageViewer() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<appl::TextViewerPlugin *>& getListOnCursorMove() { static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnCursorMove() {
static std::vector<appl::TextViewerPlugin *> s_list; static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
@ -63,30 +63,22 @@ void appl::textPluginManager::unInit() {
getListOnWrite().clear(); getListOnWrite().clear();
getListOnReplace().clear(); getListOnReplace().clear();
getListOnRemove().clear(); getListOnRemove().clear();
getListOnReceiveMessage().clear(); getListonReceiveMessageViewer().clear();
getListOnCursorMove().clear(); getListOnCursorMove().clear();
// remove all plugin:
for (int32_t iii=0; iii<getList().size(); ++iii) {
if (getList()[iii] == NULL) {
continue;
}
delete(getList()[iii]);
getList()[iii] = NULL;
}
getList().clear(); getList().clear();
} }
void appl::textPluginManager::addDefaultPlugin() { void appl::textPluginManager::addDefaultPlugin() {
appl::textPluginManager::addPlugin(new appl::TextPluginCopy()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginCopy()));
appl::textPluginManager::addPlugin(new appl::TextPluginMultiLineTab()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginMultiLineTab()));
appl::textPluginManager::addPlugin(new appl::TextPluginAutoIndent()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginAutoIndent()));
appl::textPluginManager::addPlugin(new appl::TextPluginHistory()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginHistory()));
appl::textPluginManager::addPlugin(new appl::TextPluginRmLine()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginRmLine()));
appl::textPluginManager::addPlugin(new appl::TextPluginSelectAll()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginSelectAll()));
appl::textPluginManager::addPlugin(new appl::TextPluginCtags()); appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginCtags()));
} }
void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) { void appl::textPluginManager::addPlugin(const ewol::object::Shared<appl::TextViewerPlugin>& _plugin) {
if (_plugin == NULL) { if (_plugin == NULL) {
return; return;
} }
@ -107,7 +99,7 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
getListOnRemove().push_back(_plugin); getListOnRemove().push_back(_plugin);
} }
if (_plugin->isAvaillableOnReceiveMessage() == true) { if (_plugin->isAvaillableOnReceiveMessage() == true) {
getListOnReceiveMessage().push_back(_plugin); getListonReceiveMessageViewer().push_back(_plugin);
} }
if (_plugin->isAvaillableOnCursorMove() == true) { if (_plugin->isAvaillableOnCursorMove() == true) {
getListOnCursorMove().push_back(_plugin); getListOnCursorMove().push_back(_plugin);
@ -115,31 +107,30 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
} }
void appl::textPluginManager::connect(appl::TextViewer& _widget) { void appl::textPluginManager::connect(appl::TextViewer& _widget) {
for (int32_t iii=0; iii<getList().size(); ++iii) { for (auto &it : getList()) {
if (getList()[iii] == NULL) { if (it == NULL) {
continue; continue;
} }
getList()[iii]->onPluginEnable(_widget); it->onPluginEnable(_widget);
} }
} }
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) { void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
for (int32_t iii=0; iii<getList().size(); ++iii) { for (auto &it : getList()) {
if (getList()[iii] == NULL) { if (it == NULL) {
continue; continue;
} }
getList()[iii]->onPluginDisable(_widget); it->onPluginDisable(_widget);
} }
} }
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event) { const ewol::event::Entry& _event) {
std::vector<appl::TextViewerPlugin *>& list = getListOnEventEntry(); for (auto &it : getListOnEventEntry()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onEventEntry(_textDrawer, _event) == true ) { if (it->onEventEntry(_textDrawer, _event) == true ) {
return true; return true;
} }
} }
@ -148,12 +139,11 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
const ewol::event::Input& _event) { const ewol::event::Input& _event) {
std::vector<appl::TextViewerPlugin *>& list = getListOnEventInput(); for (auto &it : getListOnEventInput()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onEventInput(_textDrawer, _event) == true ) { if (it->onEventInput(_textDrawer, _event) == true ) {
return true; return true;
} }
} }
@ -163,12 +153,11 @@ bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _data) { const std::string& _data) {
std::vector<appl::TextViewerPlugin *>& list = getListOnWrite(); for (auto &it : getListOnWrite()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onWrite(_textDrawer, _pos, _data) == true ) { if (it->onWrite(_textDrawer, _pos, _data) == true ) {
return true; return true;
} }
} }
@ -179,12 +168,11 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _data, const std::string& _data,
const appl::Buffer::Iterator& _posEnd) { const appl::Buffer::Iterator& _posEnd) {
std::vector<appl::TextViewerPlugin *>& list = getListOnReplace(); for (auto &it : getListOnReplace()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) { if (it->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
return true; return true;
} }
} }
@ -194,26 +182,24 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd) { const appl::Buffer::Iterator& _posEnd) {
std::vector<appl::TextViewerPlugin *>& list = getListOnRemove(); for (auto &it : getListOnRemove()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onRemove(_textDrawer, _pos, _posEnd) == true ) { if (it->onRemove(_textDrawer, _pos, _posEnd) == true ) {
return true; return true;
} }
} }
return false; return false;
} }
bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
std::vector<appl::TextViewerPlugin *>& list = getListOnReceiveMessage(); for (auto &it : getListonReceiveMessageViewer()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onReceiveMessage(_textDrawer, _msg) == true ) { if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) {
return true; return true;
} }
} }
@ -222,12 +208,11 @@ bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos) { const appl::Buffer::Iterator& _pos) {
std::vector<appl::TextViewerPlugin *>& list = getListOnCursorMove(); for (auto &it : getListOnCursorMove()) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == NULL) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onCursorMove(_textDrawer, _pos) == true ) { if (it->onCursorMove(_textDrawer, _pos) == true ) {
return true; return true;
} }
} }

View File

@ -33,7 +33,7 @@ namespace appl {
* @brief Add a plugin. * @brief Add a plugin.
* @param[in] _plugin Plugin pointer to add. * @param[in] _plugin Plugin pointer to add.
*/ */
void addPlugin(appl::TextViewerPlugin* _plugin); void addPlugin(const ewol::object::Shared<appl::TextViewerPlugin>& _plugin);
/** /**
* @brief connect a new widget to the plugin. * @brief connect a new widget to the plugin.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
@ -98,7 +98,7 @@ namespace appl {
* @param[in] _msg Generic message. * @param[in] _msg Generic message.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore
*/ */
bool onReceiveMessage(appl::TextViewer& _textDrawer, bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg); const ewol::object::Message& _msg);
/** /**
* @brief Called when Cursor move of position. * @brief Called when Cursor move of position.

View File

@ -16,6 +16,7 @@
appl::TextPluginMultiLineTab::TextPluginMultiLineTab() { appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
m_activateOnEventEntry = true; m_activateOnEventEntry = true;
addObjectType("appl::TextPluginMultiLineTab");
} }
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer, bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
@ -47,22 +48,22 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
_textDrawer.copy(data, itStart, itStop); _textDrawer.copy(data, itStart, itStop);
// TODO : Change this ... // TODO : Change this ...
bool m_useTabs = true; bool m_useTabs = true;
int32_t m_tabDist = 4; size_t m_tabDist = 4;
if (true == _event.getSpecialKey().getShift() ) { if (true == _event.getSpecialKey().getShift() ) {
// un-indent // un-indent
data.insert(0, 1, u32char::Return); data.insert(0, 1, u32char::Return);
for (int32_t iii=1; iii<data.size(); ++iii) { for (size_t iii=1; iii<data.size(); ++iii) {
if (data[iii-1] != u32char::Return) { if ((char32_t)data[iii-1] != u32char::Return) {
continue; continue;
} }
if(data[iii] == u32char::Tabulation) { if((char32_t)data[iii] == u32char::Tabulation) {
data.erase(iii, 1); data.erase(iii, 1);
} else if(data[iii] == u32char::Space) { } else if((char32_t)data[iii] == u32char::Space) {
for (int32_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) { for (size_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
if(data[iii] == u32char::Space) { if((char32_t)data[iii] == u32char::Space) {
data.erase(iii, 1); data.erase(iii, 1);
} else if(data[iii] == u32char::Tabulation) { } else if((char32_t)data[iii] == u32char::Tabulation) {
data.erase(iii, 1); data.erase(iii, 1);
break; break;
} else { } else {
@ -75,8 +76,8 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
} else { } else {
// indent // indent
data.insert(0, 1, u32char::Return); data.insert(0, 1, u32char::Return);
for (int32_t iii=1; iii<data.size(); iii++) { for (size_t iii=1; iii<data.size(); iii++) {
if (data[iii-1] != u32char::Return) { if ((char32_t)data[iii-1] != u32char::Return) {
continue; continue;
} }
if (true == _event.getSpecialKey().getCtrl() ) { if (true == _event.getSpecialKey().getCtrl() ) {

View File

@ -19,7 +19,7 @@ namespace appl {
class TextPluginMultiLineTab : public appl::TextViewerPlugin { class TextPluginMultiLineTab : public appl::TextViewerPlugin {
public: public:
TextPluginMultiLineTab(); TextPluginMultiLineTab();
~TextPluginMultiLineTab() { virtual ~TextPluginMultiLineTab() {
// nothing to do ... // nothing to do ...
}; };
public: public:

View File

@ -17,6 +17,7 @@
appl::TextPluginRmLine::TextPluginRmLine() { appl::TextPluginRmLine::TextPluginRmLine() {
m_activateOnReceiveMessage = true; m_activateOnReceiveMessage = true;
addObjectType("appl::TextPluginRmLine");
} }
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
@ -29,7 +30,7 @@ void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginRmLine::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;

View File

@ -19,13 +19,13 @@ namespace appl {
class TextPluginRmLine : public appl::TextViewerPlugin { class TextPluginRmLine : public appl::TextViewerPlugin {
public: public:
TextPluginRmLine(); TextPluginRmLine();
~TextPluginRmLine() { virtual ~TextPluginRmLine() {
// nothing to do ... // nothing to do ...
}; };
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
}; };
}; };

View File

@ -17,6 +17,7 @@
appl::TextPluginSelectAll::TextPluginSelectAll() { appl::TextPluginSelectAll::TextPluginSelectAll() {
m_activateOnReceiveMessage = true; m_activateOnReceiveMessage = true;
addObjectType("appl::TextPluginSelectAll");
} }
static const char* eventSelectAll = "plugin-select-all"; static const char* eventSelectAll = "plugin-select-all";
@ -31,7 +32,7 @@ void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginSelectAll::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginSelectAll::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const ewol::object::Message& _msg) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;

View File

@ -19,13 +19,13 @@ namespace appl {
class TextPluginSelectAll : public appl::TextViewerPlugin { class TextPluginSelectAll : public appl::TextViewerPlugin {
public: public:
TextPluginSelectAll(); TextPluginSelectAll();
~TextPluginSelectAll() { virtual ~TextPluginSelectAll() {
// nothing to do ... // nothing to do ...
}; };
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
}; };
}; };

View File

@ -39,7 +39,7 @@ namespace globals
class ParameterGlobalsGui : public ewol::widget::Sizer { class ParameterGlobalsGui : public ewol::widget::Sizer {
public : public :
ParameterGlobalsGui(); ParameterGlobalsGui();
~ParameterGlobalsGui(); virtual ~ParameterGlobalsGui();
// herited function // herited function
virtual void onReceiveMessage(const ewol::object::Message& _msg); virtual void onReceiveMessage(const ewol::object::Message& _msg);
}; };

View File

@ -37,7 +37,7 @@ int main(int _argc, const char *_argv[]) {
// only one things to do: // only one things to do:
return ewol::run(_argc, _argv); return ewol::run(_argc, _argv);
} }
appl::BufferManager* bufferManager = NULL; ewol::object::Shared<appl::BufferManager> bufferManager = NULL;
/** /**
* @brief main application function initialisation * @brief main application function initialisation
@ -84,9 +84,9 @@ bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
cCurrentPath[FILENAME_MAX - 1] = '\0'; cCurrentPath[FILENAME_MAX - 1] = '\0';
//APPL_INFO("The current working directory is " << cCurrentPath); //APPL_INFO("The current working directory is " << cCurrentPath);
MainWindows* basicWindows = new MainWindows(); ewol::object::Shared<MainWindows> basicWindows = ewol::object::makeShared(new MainWindows());
if (NULL == basicWindows) { if (basicWindows == nullptr) {
APPL_ERROR("Can not allocate the basic windows"); APPL_ERROR("Can not allocate the basic windows");
_context.stop(); _context.stop();
return false; return false;
@ -126,24 +126,11 @@ bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
*/ */
void APP_UnInit(ewol::Context& _context) { void APP_UnInit(ewol::Context& _context) {
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)"); APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
ewol::widget::Windows* tmpWindows = _context.getWindows();
_context.setWindows(NULL);
if (NULL != tmpWindows) {
delete(tmpWindows);
tmpWindows = NULL;
}
appl::textPluginManager::unInit(); appl::textPluginManager::unInit();
APPL_INFO("Stop Hightlight"); APPL_INFO("Stop Hightlight");
appl::highlightManager::unInit(); appl::highlightManager::unInit();
//Kill all singleton //Kill all singleton
if (bufferManager != NULL) { bufferManager.reset();
APPL_INFO("Stop BufferManager");
appl::BufferManager::release(bufferManager);
bufferManager = NULL;
}
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)"); APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
} }

View File

@ -12,6 +12,7 @@ def create(target):
# module name is 'edn' and type binary. # module name is 'edn' and type binary.
myModule = module.Module(__file__, 'edn', 'PACKAGE') myModule = module.Module(__file__, 'edn', 'PACKAGE')
myModule.add_extra_compile_flags()
# add the file to compile: # add the file to compile:
myModule.add_src_file([ myModule.add_src_file([
'appl/ctags/readtags.cpp']) 'appl/ctags/readtags.cpp'])

View File

@ -1 +1 @@
1.1.2 1.2.0