[DEV] update new ememory::SharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-19 22:03:39 +02:00
parent c284ad0b3a
commit 64b9f31a53
41 changed files with 295 additions and 287 deletions

View File

@ -871,7 +871,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
}
void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
if (nullptr == m_highlight) {
if (m_highlight == nullptr) {
return;
}
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
@ -903,7 +903,7 @@ appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) {
_MData.posHLPass1 = 0;
_MData.posHLPass2 = 0;
if (nullptr == m_highlight) {
if (m_highlight == nullptr) {
return;
}
//int64_t timeStart = ewol::getTime();
@ -1008,24 +1008,24 @@ uint32_t appl::Buffer::getCursorLinesId() {
}
namespace etk {
template<> std::string to_string<std::shared_ptr<appl::Buffer>>(const std::shared_ptr<appl::Buffer>& _obj) {
template<> std::string to_string<ememory::SharedPtr<appl::Buffer>>(const ememory::SharedPtr<appl::Buffer>& _obj) {
if (_obj != nullptr) {
return _obj->getFileName();
}
return "";
}
template<> std::u32string to_u32string<std::shared_ptr<appl::Buffer>>(const std::shared_ptr<appl::Buffer>& _obj) {
template<> std::u32string to_u32string<ememory::SharedPtr<appl::Buffer>>(const ememory::SharedPtr<appl::Buffer>& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<std::shared_ptr<appl::Buffer>>(std::shared_ptr<appl::Buffer>& _variableRet, const std::string& _value) {
template<> bool from_string<ememory::SharedPtr<appl::Buffer>>(ememory::SharedPtr<appl::Buffer>& _variableRet, const std::string& _value) {
if (_variableRet != nullptr) {
_variableRet->loadFile(_value);
return true;
}
return false;
}
template<> bool from_string<std::shared_ptr<appl::Buffer>>(std::shared_ptr<appl::Buffer>& _variableRet, const std::u32string& _value) {
template<> bool from_string<ememory::SharedPtr<appl::Buffer>>(ememory::SharedPtr<appl::Buffer>& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> std::string to_string<appl::Buffer>(const appl::Buffer& _obj) {
@ -1046,7 +1046,7 @@ namespace etk {
#include <esignal/details/ISignal.hxx>
// declare for signal event
template class esignal::Signal<std::shared_ptr<appl::Buffer>>;
template class esignal::ISignal<std::shared_ptr<appl::Buffer>>;
template class esignal::Signal<ememory::SharedPtr<appl::Buffer>>;
template class esignal::ISignal<ememory::SharedPtr<appl::Buffer>>;

View File

@ -337,7 +337,7 @@ namespace appl {
* @breif get the status of file modification.
* @return true if file is modify.
*/
bool isModify() {
bool isModify() const {
return m_isModify;
}
/**
@ -590,7 +590,7 @@ namespace appl {
protected:
std::string m_highlightType; //!< Name of the highlight type
std::shared_ptr<appl::Highlight> m_highlight; //!< internal link with the Highlight system
ememory::SharedPtr<appl::Highlight> m_highlight; //!< internal link with the Highlight system
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
public:
/**

View File

@ -26,13 +26,13 @@ appl::BufferManager::~BufferManager() {
}
std::shared_ptr<appl::Buffer> appl::BufferManager::createNewBuffer() {
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
ememory::SharedPtr<appl::Buffer> appl::BufferManager::createNewBuffer() {
ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
if (tmp == nullptr) {
APPL_ERROR("Can not allocate the Buffer (empty).");
return nullptr;
}
tmp->setParent(ewol::Object::shared_from_this());
tmp->setParent(ewol::Object::sharedFromThis());
m_list.push_back(tmp);
APPL_INFO("Create a new Buffer");
signalNewBuffer.emit(tmp->getFileName());
@ -43,7 +43,7 @@ std::shared_ptr<appl::Buffer> appl::BufferManager::createNewBuffer() {
return tmp;
}
std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
APPL_INFO("get('" << _fileName << "'," << _createIfNeeded << ")");
for (auto &it : m_list) {
if (it == nullptr) {
@ -59,12 +59,12 @@ std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileN
APPL_CRITICAL("plop");
return nullptr;
}
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
if (tmp == nullptr) {
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
return nullptr;
}
tmp->setParent(ewol::Object::shared_from_this());
tmp->setParent(ewol::Object::sharedFromThis());
tmp->loadFile(_fileName);
m_list.push_back(tmp);
APPL_INFO("Creata a open Buffer");
@ -75,7 +75,7 @@ std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileN
return nullptr;
}
void appl::BufferManager::setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected) {
void appl::BufferManager::setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected) {
m_bufferSelected = _bufferSelected;
if (m_bufferSelected == nullptr) {
APPL_ERROR("select a NULL buffer ...");
@ -88,7 +88,7 @@ void appl::BufferManager::setBufferSelected(std::shared_ptr<appl::Buffer> _buffe
APPL_INFO("Set buffer selected (done)");
}
std::shared_ptr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
int32_t id = 0;
for (auto &it : m_list) {
if (id == _id) {
@ -126,7 +126,7 @@ void appl::BufferManager::open(const std::string& _fileName) {
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(_fileName));
}
void appl::BufferManager::requestDestroyFromChild(const std::shared_ptr<Object>& _child) {
void appl::BufferManager::requestDestroyFromChild(const ememory::SharedPtr<Object>& _child) {
APPL_WARNING("Buffer request a close...");
bool find = false;
int32_t newValue = -1;
@ -145,7 +145,7 @@ void appl::BufferManager::requestDestroyFromChild(const std::shared_ptr<Object>&
++it;
}
if (find == true) {
signalRemoveBuffer.emit(std::dynamic_pointer_cast<appl::Buffer>(_child));
signalRemoveBuffer.emit(ememory::dynamicPointerCast<appl::Buffer>(_child));
}
if (m_bufferSelected == _child) {
if ( it != m_list.end()

View File

@ -21,14 +21,14 @@ namespace appl {
esignal::ISignal<std::string> signalNewBuffer;
esignal::ISignal<std::string> signalSelectFile;
esignal::ISignal<> signalTextSelectionChange;
esignal::ISignal<std::shared_ptr<appl::Buffer>> signalRemoveBuffer;
esignal::ISignal<ememory::SharedPtr<appl::Buffer>> signalRemoveBuffer;
protected:
BufferManager();
public:
DECLARE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
virtual ~BufferManager();
private:
std::list<std::shared_ptr<appl::Buffer>> m_list; // list of all buffer curently open
std::list<ememory::SharedPtr<appl::Buffer>> m_list; // list of all buffer curently open
public:
/**
* @brief Get a specific buffer with his name (can create a new buffer).
@ -36,7 +36,7 @@ namespace appl {
* @param[in] _createIfNeeded Create the buffer if not existed.
* @return a pointer on the buffer
*/
std::shared_ptr<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
ememory::SharedPtr<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
/**
* @brief Load a specific file, event if it not existed:
* @param[in] _fileName Name of the file to open or create.
@ -60,35 +60,41 @@ namespace appl {
* @param[in] _id Number of buffer
* @return pointer on the buffer
*/
std::shared_ptr<appl::Buffer> get(int32_t _id);
ememory::SharedPtr<appl::Buffer> get(int32_t _id);
/**
* @brief Create a new buffer empty.
* @return Created buffer or nullptr.
*/
std::shared_ptr<appl::Buffer> createNewBuffer();
ememory::SharedPtr<appl::Buffer> createNewBuffer();
private:
std::shared_ptr<appl::Buffer> m_bufferSelected;
ememory::SharedPtr<appl::Buffer> m_bufferSelected;
public:
/**
* @brief Set the current buffer selected
* @param[in] _bufferSelected Pointer on the buffer selected
*/
void setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected);
void setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected);
/**
* @brief Get the current buffer selected
* @return Pointer on the buffer selected
*/
std::shared_ptr<appl::Buffer> getBufferSelected() {
ememory::SharedPtr<appl::Buffer> getBufferSelected() {
return m_bufferSelected;
};
private:
void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
void requestDestroyFromChild(const ememory::SharedPtr<Object>& _child);
public:
// generic iterators:
std::list<std::shared_ptr<appl::Buffer>>::const_iterator begin() const {
std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator begin() const {
return m_list.begin();
}
std::list<std::shared_ptr<appl::Buffer>>::const_iterator end() const {
std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator end() const {
return m_list.end();
}
std::list<ememory::SharedPtr<appl::Buffer>>::iterator begin() {
return m_list.begin();
}
std::list<ememory::SharedPtr<appl::Buffer>>::iterator end() {
return m_list.end();
}
};

View File

@ -50,9 +50,9 @@ void BufferView::init() {
propertyHide.set(true);
propertyCanFocus.set(true);
if (m_bufferManager != nullptr) {
m_bufferManager->signalNewBuffer.connect(shared_from_this(), &BufferView::onCallbackNewBuffer);
m_bufferManager->signalSelectFile.connect(shared_from_this(), &BufferView::onCallbackselectNewFile);
m_bufferManager->signalRemoveBuffer.connect(shared_from_this(), &BufferView::onCallbackBufferRemoved);
m_bufferManager->signalNewBuffer.connect(sharedFromThis(), &BufferView::onCallbackNewBuffer);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &BufferView::onCallbackselectNewFile);
m_bufferManager->signalRemoveBuffer.connect(sharedFromThis(), &BufferView::onCallbackBufferRemoved);
}
}
@ -82,14 +82,14 @@ void BufferView::insertAlphabetic(const appl::dataBufferStruct& _dataStruct, boo
}
void BufferView::onCallbackNewBuffer(const std::string& _value) {
std::shared_ptr<appl::Buffer> buffer = m_bufferManager->get(_value);
ememory::SharedPtr<appl::Buffer> buffer = m_bufferManager->get(_value);
if (buffer == nullptr) {
APPL_ERROR("event on element nor exist : " << _value);
return;
}
buffer->signalIsSave.connect(shared_from_this(), &BufferView::onCallbackIsSave);
buffer->signalIsModify.connect(shared_from_this(), &BufferView::onCallbackIsModify);
buffer->signalChangeName.connect(shared_from_this(), &BufferView::onCallbackChangeName);
buffer->signalIsSave.connect(sharedFromThis(), &BufferView::onCallbackIsSave);
buffer->signalIsModify.connect(sharedFromThis(), &BufferView::onCallbackIsModify);
buffer->signalChangeName.connect(sharedFromThis(), &BufferView::onCallbackChangeName);
appl::dataBufferStruct tmp(_value, buffer);
if (m_openOrderMode == true) {
m_list.push_back(tmp);
@ -138,7 +138,7 @@ void BufferView::onCallbackChangeName() {
markToRedraw();
}
void BufferView::onCallbackBufferRemoved(const std::shared_ptr<appl::Buffer>& _buffer) {
void BufferView::onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>& _buffer) {
APPL_ERROR("request remove buffer:");
auto it = m_list.begin();
while (it != m_list.end()) {

View File

@ -15,8 +15,8 @@ namespace appl {
class dataBufferStruct {
public:
etk::FSNode m_bufferName;
std::shared_ptr<appl::Buffer> m_buffer;
dataBufferStruct(const std::string& _bufferName, const std::shared_ptr<appl::Buffer>& _buffer) :
ememory::SharedPtr<appl::Buffer> m_buffer;
dataBufferStruct(const std::string& _bufferName, const ememory::SharedPtr<appl::Buffer>& _buffer) :
m_bufferName(_bufferName),
m_buffer(_buffer) {
@ -30,9 +30,9 @@ namespace appl {
using BufferViewWeak = ememory::WeakPtr<BufferView>;
class BufferView : public ewol::widget::List {
private:
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
private:
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground1;
int32_t m_colorBackground2;
int32_t m_colorBackgroundSelect;
@ -72,6 +72,6 @@ class BufferView : public ewol::widget::List {
void onCallbackIsModify();
void onCallbackNewBuffer(const std::string& _value);
void onCallbackselectNewFile(const std::string& _value);
void onCallbackBufferRemoved(const std::shared_ptr<appl::Buffer>& _buffer);
void onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>& _buffer);
};

View File

@ -50,10 +50,10 @@ class ParameterAboutGui : public ewol::widget::Sizer {
void init() {
propertyMode.setDirectCheck(ewol::widget::Sizer::modeVert);
ewol::widget::Sizer::init();
std::shared_ptr<ewol::widget::Spacer> mySpacer;
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
mySpacer = ewol::widget::Spacer::create();
if (nullptr == mySpacer) {
if (mySpacer == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->propertyExpand.set(bvec2(true,true));
@ -71,8 +71,8 @@ class ParameterAboutGui : public ewol::widget::Sizer {
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
tmpLabel += "</left>";
std::shared_ptr<ewol::widget::Label> myLabel = ewol::widget::Label::create();
if (nullptr == myLabel) {
ememory::SharedPtr<ewol::widget::Label> myLabel = ewol::widget::Label::create();
if (myLabel == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myLabel->propertyValue.set(tmpLabel);
@ -96,9 +96,9 @@ void MainWindows::init() {
ewol::widget::SizerShared mySizerVert;
ewol::widget::SizerShared mySizerVert2;
ewol::widget::SizerShared mySizerHori;
std::shared_ptr<appl::TextViewer> myTextView;
std::shared_ptr<appl::TextViewer> myTextView2;
std::shared_ptr<BufferView> myBufferView;
ememory::SharedPtr<appl::TextViewer> myTextView;
ememory::SharedPtr<appl::TextViewer> myTextView2;
ememory::SharedPtr<BufferView> myBufferView;
ewol::widget::MenuShared myMenu;
// load buffer manager:
@ -204,7 +204,7 @@ void MainWindows::init() {
myMenu->add(idMenugDisplay, "_T{Unsplit}", "", "menu:split:disable");
myMenu->add(idMenugDisplay, "_T{Vertical}", "", "menu:split:vert");
myMenu->add(idMenugDisplay, "_T{Horizontal}", "", "menu:split:hori");
myMenu->signalSelect.connect(shared_from_this(), &MainWindows::onCallbackMenuEvent);
myMenu->signalSelect.connect(sharedFromThis(), &MainWindows::onCallbackMenuEvent);
m_widgetLabelFileName = ewol::widget::Label::create();
m_widgetLabelFileName->propertyValue.set("FileName");
m_widgetLabelFileName->propertyName.set("appl-widget-display-name");
@ -227,8 +227,8 @@ void MainWindows::init() {
shortCutAdd("ctrl+f", "menu:search");
shortCutAdd("F12", "menu:reloade-shader");
// TODO : auto-connect on shortcut event ==> maybe do beter later ...
signalShortcut.connect(shared_from_this(), &MainWindows::onCallbackShortCut);
m_bufferManager->signalSelectFile.connect(shared_from_this(), &MainWindows::onCallbackselectNewFile);
signalShortcut.connect(sharedFromThis(), &MainWindows::onCallbackShortCut);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &MainWindows::onCallbackselectNewFile);
}
@ -250,7 +250,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
} else if (_value == "menu:open") {
displayOpen();
} else if (_value == "menu:close") {
std::shared_ptr<appl::WorkerCloseFile> worker = appl::WorkerCloseFile::create();
ememory::SharedPtr<appl::WorkerCloseFile> worker = appl::WorkerCloseFile::create();
worker->startAction("");
} else if (_value == "menu:close-all") {
appl::WorkerCloseAllFile::create();
@ -273,7 +273,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
if (m_widgetSearch->isSelectSearch()) {
m_widgetSearch->propertyHide.set(true);
if (m_viewerManager != nullptr) {
std::shared_ptr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
ememory::SharedPtr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
@ -293,7 +293,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
if (m_widgetSearch->isSelectReplace()) {
m_widgetSearch->propertyHide.set(true);
if (m_viewerManager != nullptr) {
std::shared_ptr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
ememory::SharedPtr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
@ -350,7 +350,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData());
return;
@ -369,7 +369,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData());
return;
@ -380,7 +380,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData());
return;
@ -392,7 +392,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
*/
void MainWindows::displayOpen() {
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not open File chooser !!! ");
return;
@ -404,48 +404,48 @@ void MainWindows::displayOpen() {
return;
}
// Get a ref on the buffer selected (if null, no buffer was selected ...)
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != nullptr) {
etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->propertyPath.set(tmpFile.getNameFolder());
}
// apply widget pop-up ...
popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.connect(shared_from_this(), &MainWindows::onCallbackPopUpFileSelected);
tmpWidget->signalValidate.connect(sharedFromThis(), &MainWindows::onCallbackPopUpFileSelected);
}
void MainWindows::displayProperty() {
// Request the parameter GUI
std::shared_ptr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
if (nullptr == tmpWidget) {
ememory::SharedPtr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
#if 0
std::string menuDescription = "<title>Properties</title>\n";
menuDescription += "<group title='_T{Editor}'>\n";
menuDescription += " <menu title='_T{Editor Interface}' short-title='Editor' widget='appl-text-viewer'>\n";
menuDescription += "</group>\n";
menuDescription += "<group title='_T{Gui}'>\n";
menuDescription += " <menu title='Font selection' short-title='Font' widget=''>\n";
menuDescription += " <menu title='Color selection' short-title='Color' widget=''>\n";
menuDescription += " <menu title='Theme selection' short-title='Theme' widget=''>\n";
menuDescription += "</group>\n";
tmpWidget->setMenu(menuDescription);
#else
tmpWidget->propertyLabelTitle.set("_T{Properties}");
popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("_T{Editor}");
std::shared_ptr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
tmpWidget->menuAdd("_T{Editor}", "", tmpSubWidget);
tmpWidget->menuAdd("_T{Font & Color}", "", nullptr);
tmpWidget->menuAdd("_T{Highlight}", "", nullptr);
tmpWidget->menuAddGroup("_T{General}");
tmpWidget->menuAdd("_T{Display}", "", nullptr);
tmpSubWidget = ParameterAboutGui::create();
tmpWidget->menuAdd("_T{About}", "", tmpSubWidget);
#endif
return;
}
#if 0
std::string menuDescription = "<title>Properties</title>\n";
menuDescription += "<group title='_T{Editor}'>\n";
menuDescription += " <menu title='_T{Editor Interface}' short-title='Editor' widget='appl-text-viewer'>\n";
menuDescription += "</group>\n";
menuDescription += "<group title='_T{Gui}'>\n";
menuDescription += " <menu title='Font selection' short-title='Font' widget=''>\n";
menuDescription += " <menu title='Color selection' short-title='Color' widget=''>\n";
menuDescription += " <menu title='Theme selection' short-title='Theme' widget=''>\n";
menuDescription += "</group>\n";
tmpWidget->setMenu(menuDescription);
#else
tmpWidget->propertyLabelTitle.set("_T{Properties}");
popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("_T{Editor}");
ememory::SharedPtr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
tmpWidget->menuAdd("_T{Editor}", "", tmpSubWidget);
tmpWidget->menuAdd("_T{Font & Color}", "", nullptr);
tmpWidget->menuAdd("_T{Highlight}", "", nullptr);
tmpWidget->menuAddGroup("_T{General}");
tmpWidget->menuAdd("_T{Display}", "", nullptr);
tmpSubWidget = ParameterAboutGui::create();
tmpWidget->menuAdd("_T{About}", "", tmpSubWidget);
#endif
}
void MainWindows::onCallbackselectNewFile(const std::string& _value) {
@ -458,7 +458,7 @@ void MainWindows::onCallbackselectNewFile(const std::string& _value) {
m_connectionModify.disconnect();
m_connectionSaveName.disconnect();
onCallbackTitleUpdate();
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp != nullptr) {
m_connectionSave = tmpp->signalIsSave.connect(this, &MainWindows::onCallbackTitleUpdate);
m_connectionModify = tmpp->signalIsModify.connect(this, &MainWindows::onCallbackTitleUpdate);
@ -479,7 +479,7 @@ void MainWindows::onCallbackTitleUpdate() {
return;
}
// select a new Buffer ==> change title:
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
propertyTitle.set("Edn");
if (m_widgetLabelFileName != nullptr) {
@ -494,44 +494,44 @@ void MainWindows::onCallbackTitleUpdate() {
}
}
void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) {
void MainWindows::saveAsPopUp(const ememory::SharedPtr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) {
APPL_ERROR("Call With nullptr input...");
return;
}
std::shared_ptr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create("buffer-name", _buffer->getFileName());
ememory::SharedPtr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create("buffer-name", _buffer->getFileName());
}
void MainWindows::closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer) {
void MainWindows::closeNotSavedFile(const ememory::SharedPtr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) {
APPL_ERROR("Call With nullptr input...");
return;
}
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
ememory::SharedPtr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
if (tmpPopUp == nullptr) {
APPL_ERROR("Can not create a simple pop-up");
return;
}
tmpPopUp->propertyTitle.set("<bold>_T{Close un-saved file:}</bold>");
tmpPopUp->propertyComment.set("_T{The file named:} <i>\"" + _buffer->getFileName() + "\"</i> _T{is curently modify.} <br/>_T{If you don't saves these modifications,<br/>they will be definitly lost...}");
std::shared_ptr<ewol::widget::Button> bt = nullptr;
ememory::SharedPtr<ewol::widget::Button> bt = nullptr;
if (_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("_T{Save}", true);
if (bt != nullptr) {
// TODO : The element is removed before beeing pressed
// TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestSaveFile, _buffer->getFileName());
// TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFile, _buffer->getFileName());
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
}
}
bt = tmpPopUp->addButton("_T{Save As}", true);
if (bt != nullptr) {
// TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->signalPressed.connect(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : Request the close when saved ...
}
bt = tmpPopUp->addButton("_T{Close}", true);
if (bt != nullptr) {
// TODO : bt->signalPressed.connect(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
}
tmpPopUp->addButton("_T{Cancel}", true);
tmpPopUp->propertyCloseOutEvent.set(true);

View File

@ -29,18 +29,18 @@ class MainWindows : public ewol::widget::Windows {
DECLARE_FACTORY(MainWindows);
virtual ~MainWindows();
private:
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
/**
* @brief Display a pop-up to the select the name of the file.
* @param[in] _buffer Buffer that might be saved with a new name.
*/
void saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer);
void saveAsPopUp(const ememory::SharedPtr<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.
* @param[in] _buffer Buffer that might be close.
*/
void closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer);
void closeNotSavedFile(const ememory::SharedPtr<appl::Buffer>& _buffer);
void displayOpen();
void displayProperty();
private:

View File

@ -23,23 +23,23 @@ void appl::widget::Search::init() {
loadFromFile("DATA:GUI-Search.xml");
m_viewerManager = appl::ViewerManager::create();
// link event
subBind(ewol::widget::Button, "SEARCH:close", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackHide);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackSearchValue);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackSearchEntryValidate);
subBind(ewol::widget::Button, "SEARCH:search", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackSearch);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackReplaceValue);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackReplace);
subBind(ewol::widget::Button, "SEARCH:case", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackCase);
subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackWrap);
subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackForward);
subBind(ewol::widget::Button, "SEARCH:close", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackHide);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackSearchValue);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackSearchEntryValidate);
subBind(ewol::widget::Button, "SEARCH:search", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackSearch);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceValue);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackReplace);
subBind(ewol::widget::Button, "SEARCH:case", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackCase);
subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap);
subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward);
// set default properties
propertySetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
propertySetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
propertySetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
// get widget
m_searchEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
m_searchEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
// basicly hiden ...
propertyHide.set(true);
}
@ -53,7 +53,7 @@ void appl::widget::Search::find() {
APPL_WARNING("No viewer manager selected!!!");
return;
}
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
ememory::SharedPtr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == nullptr) {
APPL_INFO("No viewer selected!!!");
return;
@ -89,7 +89,7 @@ void appl::widget::Search::replace() {
APPL_WARNING("No viewer manager selected!!!");
return;
}
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
ememory::SharedPtr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == nullptr) {
APPL_INFO("No viewer selected!!!");
return;

View File

@ -16,12 +16,12 @@ namespace appl {
using SearchWeak = ememory::WeakPtr<appl::widget::Search>;
class Search : public ewol::widget::Composer {
private:
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
bool m_forward;
bool m_caseSensitive;
bool m_wrap;
std::shared_ptr<ewol::widget::Entry> m_searchEntry;
std::shared_ptr<ewol::widget::Entry> m_replaceEntry;
ememory::SharedPtr<ewol::widget::Entry> m_searchEntry;
ememory::SharedPtr<ewol::widget::Entry> m_replaceEntry;
std::u32string m_searchData;
std::u32string m_replaceData;
protected:

View File

@ -31,7 +31,7 @@ namespace appl {
int32_t m_selectedLine;
std::vector<appl::TagListElement*> m_list;
protected:
std::shared_ptr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
int32_t m_colorIdText; //!< Color of the text.
int32_t m_colorIdBackground1; //!< Color of the Background.
int32_t m_colorIdBackground2; //!< Color of the Background 2.

View File

@ -35,54 +35,54 @@ void appl::TagFileSelection::init() {
#endif
mySizerVert = ewol::widget::Sizer::create();
if (nullptr == mySizerVert) {
if (mySizerVert == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
return;
}
mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
mySizerVert->propertyLockExpand.set(bvec2(true,true));
mySizerVert->propertyExpand.set(bvec2(true,true));
// set it in the pop-up-system :
setSubWidget(mySizerVert);
ewol::WidgetShared compose = ewol::widget::composerGenerateString(
"<sizer mode='hori' expand='true,false' lock='false,true'>\n"
" <spacer expand='true,false'/>\n"
" <button name='PLUGIN-CTAGS-jump' expand='false' fill='true'>"
" <sizer mode='hori'>\n"
" <image src='THEME:GUI:Load.svg' fill='true' size='10,10mm'/>\n"
" <label>Jump</label>\n"
" </sizer>\n"
" </button>\n"
" <button name='PLUGIN-CTAGS-cancel' expand='false' fill='true'>"
" <sizer mode='hori'>\n"
" <image src='THEME:GUI:Remove.svg' fill='true' size='10,10mm'/>\n"
" <label>Cancel</label>\n"
" </sizer>\n"
" </button>\n"
"</sizer>\n");
mySizerVert->subWidgetAdd(compose);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsSelection);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsCancel);
m_listTag = appl::TagFileList::create();
if (m_listTag == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
mySizerVert->propertyLockExpand.set(bvec2(true,true));
mySizerVert->propertyExpand.set(bvec2(true,true));
// set it in the pop-up-system :
setSubWidget(mySizerVert);
ewol::WidgetShared compose = ewol::widget::composerGenerateString(
"<sizer mode='hori' expand='true,false' lock='false,true'>\n"
" <spacer expand='true,false'/>\n"
" <button name='PLUGIN-CTAGS-jump' expand='false' fill='true'>"
" <sizer mode='hori'>\n"
" <image src='THEME:GUI:Load.svg' fill='true' size='10,10mm'/>\n"
" <label>Jump</label>\n"
" </sizer>\n"
" </button>\n"
" <button name='PLUGIN-CTAGS-cancel' expand='false' fill='true'>"
" <sizer mode='hori'>\n"
" <image src='THEME:GUI:Remove.svg' fill='true' size='10,10mm'/>\n"
" <label>Cancel</label>\n"
" </sizer>\n"
" </button>\n"
"</sizer>\n");
mySizerVert->subWidgetAdd(compose);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsSelection);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsCancel);
m_listTag = appl::TagFileList::create();
if (m_listTag == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
m_listTag->signalValidate.connect(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListValidate);
m_listTag->signalSelect.connect(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListSelect);
m_listTag->signalUnSelect.connect(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListUnSelect);
m_listTag->propertyExpand.set(bvec2(true,true));
m_listTag->propertyFill.set(bvec2(true,true));
mySizerVert->subWidgetAdd(m_listTag);
}
ewol::widget::LabelShared myWidgetTitle = ewol::widget::Label::create();
if (myWidgetTitle == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetTitle->propertyValue.set("Ctags Jump Selection ...");
mySizerVert->subWidgetAdd(myWidgetTitle);
}
m_listTag->signalValidate.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListValidate);
m_listTag->signalSelect.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListSelect);
m_listTag->signalUnSelect.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListUnSelect);
m_listTag->propertyExpand.set(bvec2(true,true));
m_listTag->propertyFill.set(bvec2(true,true));
mySizerVert->subWidgetAdd(m_listTag);
}
ewol::widget::LabelShared myWidgetTitle = ewol::widget::Label::create();
if (myWidgetTitle == nullptr) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
return;
}
myWidgetTitle->propertyValue.set("Ctags Jump Selection ...");
mySizerVert->subWidgetAdd(myWidgetTitle);
}

View File

@ -14,7 +14,7 @@ namespace appl {
esignal::ISignal<std::string> signalSelect;
esignal::ISignal<> signalCancel;
private:
std::shared_ptr<appl::TagFileList> m_listTag;
ememory::SharedPtr<appl::TagFileList> m_listTag;
std::string m_eventNamed;
public:
TagFileSelection();

View File

@ -55,7 +55,7 @@ void appl::TextViewer::init() {
m_pluginManager->connect(*this);
// last created has focus ...
setCurrentSelect();
signalShortcut.connect(shared_from_this(), &appl::TextViewer::onCallbackShortCut);
signalShortcut.connect(sharedFromThis(), &appl::TextViewer::onCallbackShortCut);
/*
registerMultiCast(ednMsgBufferId);
@ -65,7 +65,7 @@ void appl::TextViewer::init() {
registerMultiCast(appl::MsgSelectGotoLineSelect);
*/
if (m_bufferManager != nullptr) {
m_bufferManager->signalSelectFile.connect(shared_from_this(), &appl::TextViewer::onCallbackselectNewFile);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &appl::TextViewer::onCallbackselectNewFile);
} else {
APPL_CRITICAL("Buffer manager has not been created at the init");
}
@ -90,11 +90,11 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
// reset scroll:
if (m_buffer != nullptr) {
m_buffer->signals.disconnect(shared_from_this());
m_buffer->signals.disconnect(sharedFromThis());
bool needAdd = true;
auto it = m_drawingRemenber.begin();
while (it != m_drawingRemenber.end()) {
std::shared_ptr<appl::Buffer> tmpBuff = it->first.lock();
ememory::SharedPtr<appl::Buffer> tmpBuff = it->first.lock();
if (tmpBuff == nullptr) {
it = m_drawingRemenber.erase(it);
continue;
@ -108,7 +108,7 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
++it;
}
if (needAdd == true) {
m_drawingRemenber.push_back(std::make_pair(std::weak_ptr<appl::Buffer>(m_buffer), m_originScrooled));
m_drawingRemenber.push_back(std::make_pair(ememory::WeakPtr<appl::Buffer>(m_buffer), m_originScrooled));
APPL_VERBOSE("Push origin : " << m_originScrooled);
}
}
@ -117,8 +117,8 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
m_buffer = m_bufferManager->get(_value);
m_bufferManager->setBufferSelected(m_buffer);
if (m_buffer != nullptr) {
m_buffer->signalIsModify.connect(shared_from_this(), &appl::TextViewer::onCallbackIsModify);
m_buffer->signalSelectChange.connect(shared_from_this(), &appl::TextViewer::onCallbackSelectChange);
m_buffer->signalIsModify.connect(sharedFromThis(), &appl::TextViewer::onCallbackIsModify);
m_buffer->signalSelectChange.connect(sharedFromThis(), &appl::TextViewer::onCallbackSelectChange);
for (auto element : m_drawingRemenber) {
if (element.first.lock() == m_buffer) {
m_originScrooled = element.second;
@ -979,13 +979,13 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
void appl::TextViewer::setCurrentSelect() {
if (m_viewerManager != nullptr) {
m_viewerManager->setViewerSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()), m_buffer);
m_viewerManager->setViewerSelected(ememory::dynamicPointerCast<appl::TextViewer>(sharedFromThis()), m_buffer);
}
}
bool appl::TextViewer::isSelectedLast() {
if (m_viewerManager != nullptr) {
return m_viewerManager->isLastSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()));
return m_viewerManager->isLastSelected(ememory::dynamicPointerCast<appl::TextViewer>(sharedFromThis()));
}
return false;
}

View File

@ -26,7 +26,7 @@ namespace appl {
eproperty::Value<std::string> propertyFontName; //!< name of the font to display text.
eproperty::Value<int32_t> propertyFontSize; //!< Size of the font to display text.
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground;
int32_t m_colorSpace;
int32_t m_colorTabulation;
@ -35,9 +35,9 @@ namespace appl {
int32_t m_colorSelection;
int32_t m_colorNormal;
private:
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::textPluginManager> m_pluginManager; //!< Plugin manager interface
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::textPluginManager> m_pluginManager; //!< Plugin manager interface
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
protected:
TextViewer();
void init();
@ -45,19 +45,19 @@ namespace appl {
DECLARE_FACTORY(TextViewer);
virtual ~TextViewer();
private:
std::shared_ptr<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)
ememory::SharedPtr<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:
/**
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
* @return pointer on buffer
*/
std::shared_ptr<appl::Buffer> internalGetBuffer() {
ememory::SharedPtr<appl::Buffer> internalGetBuffer() {
return m_buffer;
}
private:
ewol::compositing::Text m_displayText; //!< Text display properties.
ewol::compositing::Drawing m_displayDrawing; //!< Other display requested.
std::vector<std::pair<std::weak_ptr<appl::Buffer>, vec2>> m_drawingRemenber;
std::vector<std::pair<ememory::WeakPtr<appl::Buffer>, vec2>> m_drawingRemenber;
public:
virtual void onChangePropertyFontSize();
virtual void onChangePropertyFontName();

View File

@ -21,11 +21,15 @@ appl::ViewerManager::~ViewerManager() {
}
bool appl::ViewerManager::isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer) {
ememory::SharedPtr<appl::TextViewer> appl::ViewerManager::getViewerSelected() {
return m_viewer.lock();
}
bool appl::ViewerManager::isLastSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer) {
return m_viewer.lock() == _viewer;
}
void appl::ViewerManager::setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer) {
void appl::ViewerManager::setViewerSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer, const ememory::SharedPtr<appl::Buffer>& _buffer) {
if (m_viewer.lock() == _viewer) {
return;
}

View File

@ -22,26 +22,24 @@ namespace appl {
DECLARE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???");
virtual ~ViewerManager();
private:
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::weak_ptr<appl::TextViewer> m_viewer;
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::WeakPtr<appl::TextViewer> m_viewer;
public:
/**
* @brief Set the current buffer selected
* @param[in] _viewer Pointer on the viewer selected
*/
void setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer);
void setViewerSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer, const ememory::SharedPtr<appl::Buffer>& _buffer);
/**
* @brief Get the current buffer selected
* @return Pointer on the buffer selected
*/
std::shared_ptr<appl::TextViewer> getViewerSelected() {
return m_viewer.lock();
};
ememory::SharedPtr<appl::TextViewer> getViewerSelected();
/**
* @breif Check if the element is the last request selection
* @param[in] _viewer element selected.
* @return true if the element is selected
*/
bool isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer);
bool isLastSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer);
};
}

View File

@ -22,7 +22,7 @@ void appl::WorkerCloseAllFile::init() {
}
// List all current open file :
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
if (tmpBuffer == nullptr) {
continue;
}
@ -40,7 +40,7 @@ void appl::WorkerCloseAllFile::init() {
}
// create the worker :
m_worker = appl::WorkerCloseFile::create();
m_worker->signalCloseDone.connect(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->startAction(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
@ -65,7 +65,7 @@ void appl::WorkerCloseAllFile::onCallbackCloseDone() {
}
// create the worker :
m_worker = appl::WorkerCloseFile::create();
m_worker->signalCloseDone.connect(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->startAction(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());

View File

@ -18,8 +18,8 @@ namespace appl {
virtual ~WorkerCloseAllFile();
private:
std::vector<std::string> m_bufferNameList;
std::shared_ptr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback function
void onCallbackCloseDone();
};

View File

@ -33,7 +33,7 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
}
if (m_bufferName == "") {
// need to find the curent file ...
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ...");
destroy();
@ -59,7 +59,7 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
return;
}
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
ememory::SharedPtr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
if (tmpPopUp == nullptr) {
APPL_ERROR("Can not create a simple pop-up");
destroy();
@ -67,27 +67,27 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
}
tmpPopUp->propertyTitle.set("<bold>_T{Close un-saved file:}</bold>");
tmpPopUp->propertyComment.set("_T{The file named:} <i>'" + m_buffer->getFileName() + "'</i> _T{is curently modify.}<br/>_T{If you don't saves these modifications,}<br/>_T{they will be definitly lost...}");
std::shared_ptr<ewol::widget::Button> bt = nullptr;
ememory::SharedPtr<ewol::widget::Button> bt = nullptr;
if (m_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("_T{Save}", true);
if (bt != nullptr) {
bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveValidate);
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveValidate);
}
}
bt = tmpPopUp->addButton("_T{Save As}", true);
if (bt != nullptr) {
bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
}
bt = tmpPopUp->addButton("_T{Close}", true);
if (bt != nullptr) {
bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose);
}
bt = tmpPopUp->addButton("_T{Cancel}", true);
if (bt != nullptr) {
bt->signalPressed.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel);
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel);
}
tmpPopUp->propertyCloseOutEvent.set(true);
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
ememory::SharedPtr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows.");
destroy();
@ -113,8 +113,8 @@ void appl::WorkerCloseFile::onCallbackSaveAsValidate() {
}
m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferName);
if (m_worker != nullptr) {
m_worker->signalSaveDone.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
m_worker->signalAbort.connect(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel);
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose);
m_worker->signalAbort.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel);
}
}

View File

@ -28,9 +28,9 @@ namespace appl {
void startAction(const std::string& _bufferName);
private:
std::string m_bufferName;
std::shared_ptr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
ememory::SharedPtr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback Functions
void onCallbackSaveAsValidate();
void onCallbackSaveValidate();

View File

@ -47,7 +47,7 @@ void appl::WorkerSaveAllFile::init() {
destroy();
return;
}
m_worker->signalSaveDone.connect(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}
appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
@ -71,6 +71,6 @@ void appl::WorkerSaveAllFile::onCallbackSaveAsDone() {
destroy();
return;
}
m_worker->signalSaveDone.connect(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}

View File

@ -18,8 +18,8 @@ namespace appl {
virtual ~WorkerSaveAllFile();
private:
std::vector<std::string> m_bufferNameList;
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback function
void onCallbackSaveAsDone();
};

View File

@ -27,7 +27,7 @@ void appl::WorkerSaveFile::init() {
}
if (*propertyBufferName == "") {
// need to find the curent file ...
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ...");
destroy();
@ -40,7 +40,7 @@ void appl::WorkerSaveFile::init() {
destroy();
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << *propertyBufferName);
destroy();
@ -55,7 +55,7 @@ void appl::WorkerSaveFile::init() {
}
}
m_chooser = ewol::widget::FileChooser::create();
if (nullptr == m_chooser) {
if (m_chooser == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
destroy();
return;
@ -65,15 +65,15 @@ void appl::WorkerSaveFile::init() {
etk::FSNode tmpName(*propertyBufferName);
m_chooser->propertyPath.set(tmpName.getNameFolder());
m_chooser->propertyFile.set(tmpName.getNameFile());
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
ememory::SharedPtr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows.");
destroy();
return;
}
tmpWindows->popUpWidgetPush(m_chooser);
m_chooser->signalValidate.connect(shared_from_this(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
m_chooser->signalCancel.connect(shared_from_this(), &appl::WorkerSaveFile::onCallbackCancel);
m_chooser->signalValidate.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
m_chooser->signalCancel.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackCancel);
}
appl::WorkerSaveFile::~WorkerSaveFile() {
@ -101,7 +101,7 @@ void appl::WorkerSaveFile::onCallbackSaveAsValidate(const std::string& _value) {
destroy();
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << *propertyBufferName);
destroy();

View File

@ -22,8 +22,8 @@ namespace appl {
DECLARE_FACTORY(WorkerSaveFile);
virtual ~WorkerSaveFile();
private:
std::shared_ptr<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback function
void onCallbackSaveAsValidate(const std::string& _value);
void onCallbackCancel();

View File

@ -18,7 +18,7 @@ namespace appl {
};
}
#include <memory>
#include <ememory/memory.h>
#include <etk/os/FSNode.h>
#include <appl/HighlightPattern.h>
#include <appl/GlyphPainting.h>
@ -27,7 +27,7 @@ namespace appl {
namespace appl {
class Highlight : public gale::Resource {
private:
std::shared_ptr<appl::GlyphPainting> m_paintingProperties;
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties;
public:
// Constructeur
Highlight();

View File

@ -12,14 +12,14 @@
// TODO : Review this in a generic unique resource ...
static std::vector<std::shared_ptr<appl::Highlight>>& s_list() {
static std::vector<std::shared_ptr<appl::Highlight>> list;
static std::vector<ememory::SharedPtr<appl::Highlight>>& s_list() {
static std::vector<ememory::SharedPtr<appl::Highlight>> list;
return list;
}
void appl::highlightManager::init() {
std::vector<std::shared_ptr<appl::Highlight>>& hlList = s_list();
std::vector<ememory::SharedPtr<appl::Highlight>>& hlList = s_list();
if (hlList.size() != 0) {
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
hlList.clear();
@ -37,7 +37,7 @@ void appl::highlightManager::init() {
}
std::string filename = it->getName() + "/highlight.xml";
APPL_DEBUG("Load xml name : " << filename);
std::shared_ptr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
ememory::SharedPtr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
if (myHightLine != nullptr) {
// Check if the language name already exist
for (auto &it2 : hlList) {
@ -63,7 +63,7 @@ void appl::highlightManager::init() {
}
void appl::highlightManager::unInit() {
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
std::vector<ememory::SharedPtr<Highlight>>& hlList = s_list();
if (hlList.size() == 0) {
APPL_DEBUG("HighlightManager ==> no highlight");
hlList.clear();
@ -77,7 +77,7 @@ std::string appl::highlightManager::getTypeFile(const std::string& _fileName) {
return "";
}
APPL_DEBUG("Try to find type for extention : '" << _fileName << "' in " << s_list().size() << " types");
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
std::vector<ememory::SharedPtr<Highlight>>& hlList = s_list();
for (auto &it : hlList) {
if (it == nullptr) {
continue;

View File

@ -7,7 +7,7 @@
#include <appl/global.h>
#include <appl/HighlightPattern.h>
appl::HighlightPattern::HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting, const exml::Element& _child, int32_t _level) :
appl::HighlightPattern::HighlightPattern(const ememory::SharedPtr<appl::GlyphPainting>& _glyphPainting, const exml::Element& _child, int32_t _level) :
m_glyphPainting(_glyphPainting),
m_paternName(""),
m_hasParsingError(true),

View File

@ -16,11 +16,11 @@ class HighlightPattern;
namespace appl {
class HighlightPattern {
private:
std::shared_ptr<appl::GlyphPainting> m_glyphPainting;
ememory::SharedPtr<appl::GlyphPainting> m_glyphPainting;
public:
// Constructeur
HighlightPattern();
HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting, const exml::Element& _child, int32_t _level);
HighlightPattern(const ememory::SharedPtr<appl::GlyphPainting>& _glyphPainting, const exml::Element& _child, int32_t _level);
virtual ~HighlightPattern();
private:
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")

View File

@ -17,7 +17,7 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_activateOnReceiveShortCut(false),
m_activateOnCursorMove(false) {
addObjectType("appl::TextViewerPlugin");
m_menuInterface = std::dynamic_pointer_cast<ewol::widget::Menu>(getObjectNamed("appl-menu-interface"));
m_menuInterface = ememory::dynamicPointerCast<ewol::widget::Menu>(getObjectNamed("appl-menu-interface"));
if (m_menuInterface.expired() == true) {
APPL_ERROR("Can not acces to the Menu interface");
}

View File

@ -18,7 +18,7 @@ namespace appl {
class TextViewerPlugin : public ewol::Object {
friend class appl::TextViewer;
protected:
std::weak_ptr<appl::textPluginManager> m_pluginManager;
ememory::WeakPtr<appl::textPluginManager> m_pluginManager;
protected:
TextViewerPlugin();
public:

View File

@ -20,7 +20,7 @@ appl::TextPluginCopy::TextPluginCopy() :
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event :
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
@ -39,7 +39,7 @@ void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::cut");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::copy");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::Paste");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRemove);
menu->remove(m_menuIdPast);

View File

@ -59,8 +59,8 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
APPL_INFO("Multiple file destination ...");
std::shared_ptr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
if (nullptr == tmpWidget) {
ememory::SharedPtr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
@ -72,7 +72,7 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->signalSelect.connect(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
tmpWidget->signalSelect.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
}
} else {
jumpFile(myfile.getName(), lineID - 1);
@ -156,8 +156,8 @@ bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
}
if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
APPL_INFO("Request opening ctag file");
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (nullptr == tmpWidget) {
ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
return true;
}
@ -170,7 +170,7 @@ bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
tmpWidget->propertyPath.set(path);
}
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.connect(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
tmpWidget->signalValidate.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
return true;
} else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
if (_textDrawer.hasBuffer() == false) {

View File

@ -28,7 +28,7 @@ namespace appl {
void printTag(const tagEntry *_entry);
void jumpTo(const std::string& _name);
void jumpFile(const std::string& _filename, int64_t _lineId);
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
protected:
TextPluginCtags();
public:

View File

@ -28,12 +28,12 @@ namespace appl {
m_specificData.clear();
}
private:
std::vector<std::pair<std::weak_ptr<appl::Buffer> ,std::unique_ptr<TYPE>>> m_specificData;
std::vector<std::pair<ememory::WeakPtr<appl::Buffer> ,std::unique_ptr<TYPE>>> m_specificData;
protected:
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
auto it = m_specificData.begin();
while(it != m_specificData.end()) {
std::shared_ptr<appl::Buffer> buf = it->first.lock();
ememory::SharedPtr<appl::Buffer> buf = it->first.lock();
if (buf == nullptr) {
it = m_specificData.erase(it);
continue;

View File

@ -20,7 +20,7 @@ appl::TextPluginHistory::TextPluginHistory() :
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
@ -36,7 +36,7 @@ void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Undo");
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Redo");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRedo);
menu->remove(m_menuIdUndo);
@ -137,7 +137,7 @@ bool appl::TextPluginHistory::onDataWrite(appl::TextViewer& _textDrawer,
clearRedo(_data);
_data.m_undo.push_back(tmpElement);
}
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
@ -165,7 +165,7 @@ bool appl::TextPluginHistory::onDataReplace(appl::TextViewer& _textDrawer,
clearRedo(_data);
_data.m_undo.push_back(tmpElement);
}
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
@ -190,7 +190,7 @@ bool appl::TextPluginHistory::onDataRemove(appl::TextViewer& _textDrawer,
_data.m_undo.push_back(tmpElement);
}
_textDrawer.removeDirect();
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}

View File

@ -30,7 +30,7 @@ void appl::textPluginManager::addDefaultPlugin() {
appl::textPluginManager::addPlugin(appl::TextPluginCtags::create());
}
void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin) {
void appl::textPluginManager::addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin) {
if (_plugin == nullptr) {
return;
}
@ -57,14 +57,14 @@ void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPl
if (_plugin->isAvaillableOnCursorMove() == true) {
m_listOnCursorMove.push_back(_plugin);
}
std::shared_ptr<appl::TextViewer> viewer = m_currentViewer.lock();
ememory::SharedPtr<appl::TextViewer> viewer = m_currentViewer.lock();
if (viewer != nullptr) {
_plugin->onPluginEnable(*viewer);
}
}
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
m_currentViewer = std::dynamic_pointer_cast<appl::TextViewer>(_widget.shared_from_this());
m_currentViewer = ememory::dynamicPointerCast<appl::TextViewer>(_widget.sharedFromThis());
for (auto &it : m_list) {
if (it == nullptr) {
continue;

View File

@ -13,15 +13,15 @@
namespace appl {
class textPluginManager : public gale::Resource {
private:
std::weak_ptr<appl::TextViewer> m_currentViewer;
std::list<std::shared_ptr<appl::TextViewerPlugin>> m_list;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnEventEntry;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnEventInput;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnWrite;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnReplace;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnRemove;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnReceiveShortCutViewer;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnCursorMove;
ememory::WeakPtr<appl::TextViewer> m_currentViewer;
std::list<ememory::SharedPtr<appl::TextViewerPlugin>> m_list;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventEntry;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventInput;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnWrite;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReplace;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnRemove;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReceiveShortCutViewer;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnCursorMove;
protected:
textPluginManager();
void init(const std::string& _name);
@ -36,7 +36,7 @@ namespace appl {
* @brief Add a plugin.
* @param[in] _plugin Plugin pointer to add.
*/
void addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin);
void addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin);
/**
* @brief connect a new widget to the plugin.
* @param[in] _widget Reference on the widget caller.

View File

@ -16,7 +16,7 @@ appl::TextPluginSelectAll::TextPluginSelectAll() :
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
@ -32,7 +32,7 @@ void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::None");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdSelectNone);
menu->remove(m_menuIdSelectAll);

View File

@ -105,65 +105,65 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui() {
void globals::ParameterGlobalsGui::init() {
ewol::widget::Sizer::init();
propertyMode.set(ewol::widget::Sizer::modeVert);
std::shared_ptr<ewol::widget::CheckBox> myCheckbox;
std::shared_ptr<ewol::widget::Spacer> mySpacer;
ememory::SharedPtr<ewol::widget::CheckBox> myCheckbox;
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
mySpacer = ewol::widget::Spacer::create();
if (nullptr == mySpacer) {
if (mySpacer == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->propertyExpand.set(bvec2(true,true));
subWidgetAdd(mySpacer);
}
myCheckbox = ewol::widget::CheckBox::create();
if (nullptr == myCheckbox) {
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Automatic Indentation");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetAutoIndent());
myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackIndentation);
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (nullptr == myCheckbox) {
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display space char (' ')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplaySpaceChar());
myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackSpace);
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (nullptr == myCheckbox) {
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display tabulation char ('\\t')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayTabChar());
myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackTabulation);
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (nullptr == myCheckbox) {
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display end of line ('\\n')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (nullptr == myCheckbox) {
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("switch Rounded/default");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackRounded);
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded);
subWidgetAdd(myCheckbox);
}
}

View File

@ -27,8 +27,8 @@
class MainApplication : public ewol::context::Application {
private:
std::shared_ptr<appl::BufferManager> m_bufferManager;
std::shared_ptr<appl::textPluginManager> m_pluginManager;
ememory::SharedPtr<appl::BufferManager> m_bufferManager;
ememory::SharedPtr<appl::textPluginManager> m_pluginManager;
public:
virtual void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)");
@ -82,7 +82,7 @@ class MainApplication : public ewol::context::Application {
cCurrentPath[FILENAME_MAX - 1] = '\0';
//APPL_INFO("The current working directory is " << cCurrentPath);
std::shared_ptr<MainWindows> basicWindows = MainWindows::create();
ememory::SharedPtr<MainWindows> basicWindows = MainWindows::create();
if (basicWindows == nullptr) {
APPL_ERROR("Can not allocate the basic windows");