[DEV] update new object interface & rework global message (start)

This commit is contained in:
Edouard DUPIN 2014-08-25 05:55:06 +02:00
parent 686ec6d8bd
commit cd3c5ff2d4
25 changed files with 423 additions and 453 deletions

View File

@ -104,10 +104,6 @@ void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _sel
} }
} }
} }
static const char* const ednEventIsSave = "edn-buffer-is-saved";
static const char* const ednEventIsModify = "edn-buffer-is-modify";
static const char* const ednEventChangeName = "edn-buffer-change-name";
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) { void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_VERBOSE("message : " << _msg); APPL_VERBOSE("message : " << _msg);
ewol::widget::List::onReceiveMessage(_msg); ewol::widget::List::onReceiveMessage(_msg);
@ -117,9 +113,9 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("event on element nor exist : " << _msg.getData()); APPL_ERROR("event on element nor exist : " << _msg.getData());
return; return;
} }
buffer->registerOnEvent(shared_from_this(), "is-save", ednEventIsSave); buffer->signalIsSave.bind(shared_from_this(), &BufferView::onCallbackIsSave);
buffer->registerOnEvent(shared_from_this(), "is-modify", ednEventIsModify); buffer->signalIsModify.bind(shared_from_this(), &BufferView::onCallbackIsModify);
buffer->registerOnEvent(shared_from_this(), "change-name", ednEventChangeName); buffer->signalChangeName.bind(shared_from_this(), &BufferView::onCallbackChangeName);
appl::dataBufferStruct* tmp = new appl::dataBufferStruct(_msg.getData(), buffer); appl::dataBufferStruct* tmp = new appl::dataBufferStruct(_msg.getData(), buffer);
if (tmp == nullptr) { if (tmp == nullptr) {
APPL_ERROR("Allocation error of the tmp buffer list element"); APPL_ERROR("Allocation error of the tmp buffer list element");
@ -133,34 +129,6 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
markToRedraw(); markToRedraw();
return; return;
} }
if (_msg.getMessage() == ednEventChangeName) {
for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii] == nullptr) {
continue;
}
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) {
m_list[iii]->m_bufferName = m_list[iii]->m_buffer->getFileName();
if (m_openOrderMode == false) {
// re-order the fine in the correct position
appl::dataBufferStruct* tmp = m_list[iii];
m_list[iii] = nullptr;
m_list.erase(m_list.begin() + iii);
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
break;
}
}
}
markToRedraw();
return;
}
if (_msg.getMessage() == ednEventIsSave) {
markToRedraw();
return;
}
if (_msg.getMessage() == ednEventIsModify) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectChange) { if (_msg.getMessage() == appl::MsgSelectChange) {
m_selectedID = -1; m_selectedID = -1;
std::shared_ptr<appl::Buffer> tmpBuffer; std::shared_ptr<appl::Buffer> tmpBuffer;
@ -222,6 +190,31 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
} }
} }
void BufferView::onCallbackChangeName() {
for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii] == nullptr) {
continue;
}
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) {
m_list[iii]->m_bufferName = m_list[iii]->m_buffer->getFileName();
if (m_openOrderMode == false) {
// re-order the fine in the correct position
appl::dataBufferStruct* tmp = m_list[iii];
m_list[iii] = nullptr;
m_list.erase(m_list.begin() + iii);
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
break;
}
}
}
markToRedraw();
}
void BufferView::onCallbackIsSave() {
markToRedraw();
}
void BufferView::onCallbackIsModify() {
markToRedraw();
}
etk::Color<> BufferView::getBasicBG() { etk::Color<> BufferView::getBasicBG() {
return (*m_paintingProperties)[m_colorBackground1].getForeground(); return (*m_paintingProperties)[m_colorBackground1].getForeground();

View File

@ -69,6 +69,10 @@ class BufferView : public ewol::widget::List {
virtual uint32_t getNuberOfRaw(); virtual uint32_t getNuberOfRaw();
virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
private: //callback function:
void onCallbackChangeName();
void onCallbackIsSave();
void onCallbackIsModify();
}; };

View File

@ -279,7 +279,6 @@ MainWindows::~MainWindows() {
} }
static const char* const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
static const char* const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected"; static const char* const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
static const char* const ednEventIsSave = "edn-buffer-is-saved"; static const char* const ednEventIsSave = "edn-buffer-is-saved";
static const char* const ednEventIsModify = "edn-buffer-is-modify"; static const char* const ednEventIsModify = "edn-buffer-is-modify";
@ -310,7 +309,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
} }
// apply widget pop-up ... // apply widget pop-up ...
popUpWidgetPush(tmpWidget); popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(shared_from_this(), "validate", ednEventPopUpFileSelected); tmpWidget->signalValidate.bind(shared_from_this(), &MainWindows::onCallbackPopUpFileSelected);
} else if (_msg.getMessage() == ednMsgProperties) { } else if (_msg.getMessage() == ednMsgProperties) {
// Request the parameter GUI // Request the parameter GUI
std::shared_ptr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create(); std::shared_ptr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
@ -379,36 +378,16 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("can not call unexistant buffer manager ... "); APPL_ERROR("can not call unexistant buffer manager ... ");
return; return;
} }
if ( _msg.getMessage() == appl::MsgSelectNewFile
|| _msg.getMessage() == ednEventIsModify
|| _msg.getMessage() == ednEventIsSave
|| _msg.getMessage() == ednEventChangeName) {
// select a new Buffer ==> change title:
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
setTitle("Edn");
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel("");
}
} else {
if (_msg.getMessage() == appl::MsgSelectNewFile) { if (_msg.getMessage() == appl::MsgSelectNewFile) {
tmpp->registerOnEvent(shared_from_this(), "is-save", ednEventIsSave); onCallbackTitleUpdate();
tmpp->registerOnEvent(shared_from_this(), "is-modify", ednEventIsModify); std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
tmpp->registerOnEvent(shared_from_this(), "change-name", ednEventChangeName); if (tmpp != nullptr) {
tmpp->signalIsSave.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
tmpp->signalIsModify.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
tmpp->signalChangeName.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
} }
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
} else if (_msg.getMessage() == ednMsgGuiNew) { } else if (_msg.getMessage() == ednMsgGuiNew) {
m_bufferManager->createNewBuffer(); m_bufferManager->createNewBuffer();
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.getData());
m_bufferManager->open(_msg.getData());
} else if (_msg.getMessage() == ednMsgGuiSave) { } else if (_msg.getMessage() == ednMsgGuiSave) {
APPL_DEBUG("Request saving the file : " << _msg.getData()); APPL_DEBUG("Request saving the file : " << _msg.getData());
if (etk::tolower(_msg.getData()) == "current") { if (etk::tolower(_msg.getData()) == "current") {
@ -475,6 +454,31 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
} }
return; return;
} }
void MainWindows::onCallbackPopUpFileSelected(const std::string& _value) {
APPL_DEBUG("Request opening the file : " << _value);
m_bufferManager->open(_value);
}
void MainWindows::onCallbackTitleUpdate() {
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
// select a new Buffer ==> change title:
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
setTitle("Edn");
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel("");
}
} else {
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
}
void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) { void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) { if (_buffer == nullptr) {
@ -496,24 +500,24 @@ void MainWindows::closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer
} }
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...");
std::shared_ptr<ewol::Widget> bt = nullptr; std::shared_ptr<ewol::widget::Button> bt = nullptr;
if (_buffer->hasFileName() == true) { if (_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true); bt = tmpPopUp->addButton("Save", true);
if (bt != nullptr) { if (bt != nullptr) {
// TODO : The element is removed before beeing pressed // TODO : The element is removed before beeing pressed
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFile, _buffer->getFileName()); // TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestSaveFile, _buffer->getFileName());
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); // TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
} }
} }
bt = tmpPopUp->addButton("Save As", true); bt = tmpPopUp->addButton("Save As", true);
if (bt != nullptr) { if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName()); // TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); //bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : Request the close when saved ... // TODO : Request the close when saved ...
} }
bt = tmpPopUp->addButton("Close", true); bt = tmpPopUp->addButton("Close", true);
if (bt != nullptr) { if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); // TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
} }
tmpPopUp->addButton("Cancel", true); tmpPopUp->addButton("Cancel", true);
tmpPopUp->setRemoveOnExternClick(true); tmpPopUp->setRemoveOnExternClick(true);

View File

@ -41,6 +41,9 @@ class MainWindows : public ewol::widget::Windows {
void closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer); void closeNotSavedFile(const std::shared_ptr<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);
private:
void onCallbackPopUpFileSelected(const std::string& _value);
void onCallbackTitleUpdate();
}; };

View File

@ -12,6 +12,8 @@
#include "appl/Gui/TextViewer.h" #include "appl/Gui/TextViewer.h"
#include "appl/Gui/MainWindows.h" #include "appl/Gui/MainWindows.h"
#include "appl/globalMsg.h" #include "appl/globalMsg.h"
#include <ewol/widget/Button.h>
#include <ewol/widget/Entry.h>
#undef __class__ #undef __class__
@ -38,23 +40,23 @@ void appl::widget::Search::init() {
ewol::widget::Composer::init(ewol::widget::Composer::file, "DATA:GUI-Search.xml"); ewol::widget::Composer::init(ewol::widget::Composer::file, "DATA:GUI-Search.xml");
m_viewerManager = appl::ViewerManager::create(); m_viewerManager = appl::ViewerManager::create();
// link event // link event
registerOnEventNameWidget(shared_from_this(), "SEARCH:close", "pressed", l_eventHideBt); subBind(ewol::widget::Button, "SEARCH:close", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackHide);
registerOnEventNameWidget(shared_from_this(), "SEARCH:search-entry", "modify", l_eventSearchEntry); subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackSearchValue);
registerOnEventNameWidget(shared_from_this(), "SEARCH:search-entry", "enter", l_eventSearchEntryEnter); subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackSearchEntryValidate);
registerOnEventNameWidget(shared_from_this(), "SEARCH:search", "pressed", l_eventSearchBt); subBind(ewol::widget::Button, "SEARCH:search", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackSearch);
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace-entry", "modify", l_eventReplaceEntry); subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackReplaceValue);
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace-entry", "enter", l_eventReplaceEntryEnter); subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace", "pressed", l_eventReplaceBt); subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackReplace);
registerOnEventNameWidget(shared_from_this(), "SEARCH:case", "value", l_eventCaseCb); subBind(ewol::widget::Button, "SEARCH:case", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackCase);
registerOnEventNameWidget(shared_from_this(), "SEARCH:wrap", "value", l_eventWrapCb); subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackWrap);
registerOnEventNameWidget(shared_from_this(), "SEARCH:up-down", "value", l_eventForwardCb); subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackForward);
// set default properties // set default properties
parameterSetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive)); parameterSetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
parameterSetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap)); parameterSetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
parameterSetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward)); parameterSetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
// get widget // get widget
m_searchEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:search-entry")); m_searchEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:replace-entry")); m_replaceEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
// Display and hide event: // Display and hide event:
registerMultiCast(ednMsgGuiSearch); registerMultiCast(ednMsgGuiSearch);
// basicly hiden ... // basicly hiden ...
@ -118,30 +120,45 @@ void appl::widget::Search::replace() {
viewer->replace(m_replaceData); viewer->replace(m_replaceData);
} }
void appl::widget::Search::OnCallbackHide() {
hide();
}
void appl::widget::Search::OnCallbackSearchValue(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
}
void appl::widget::Search::OnCallbackSearch() {
find();
}
void appl::widget::Search::OnCallbackSearchEntryValidate(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
find();
}
void appl::widget::Search::OnCallbackReplaceValue(const std::string& _value) {
m_replaceData = etk::to_u32string(_value);
}
void appl::widget::Search::OnCallbackReplace() {
replace();
find();
}
void appl::widget::Search::OnCallbackReplaceEntryValidate(const std::string& _value) {
m_replaceData = etk::to_u32string(_value);
replace();
find();
}
void appl::widget::Search::OnCallbackCase(const bool& _value) {
m_caseSensitive = _value;
}
void appl::widget::Search::OnCallbackWrap(const bool& _value) {
m_wrap = _value;
}
void appl::widget::Search::OnCallbackForward(const bool& _value) {
m_forward = _value;
}
void appl::widget::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() == ednMsgGuiSearch) {
m_searchData = etk::to_u32string(_msg.getData());
} else if ( _msg.getMessage() == l_eventSearchEntryEnter
|| _msg.getMessage() == l_eventSearchBt) {
find();
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
m_replaceData = etk::to_u32string(_msg.getData());
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter
|| _msg.getMessage() == l_eventReplaceBt) {
replace();
find();
} else if ( _msg.getMessage() == l_eventCaseCb) {
m_caseSensitive = etk::string_to_bool(_msg.getData());
} else if ( _msg.getMessage() == l_eventWrapCb) {
m_wrap = etk::string_to_bool(_msg.getData());
} else if ( _msg.getMessage() == l_eventForwardCb) {
m_forward = etk::string_to_bool(_msg.getData());
} else if ( _msg.getMessage() == l_eventHideBt) {
hide();
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
if (true == isHide()) { if (true == isHide()) {
show(); show();
if (m_searchEntry!= nullptr) { if (m_searchEntry!= nullptr) {

View File

@ -44,6 +44,17 @@ namespace appl {
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);
private: // callback functions
void OnCallbackHide();
void OnCallbackSearchValue(const std::string& _value);
void OnCallbackSearch();
void OnCallbackSearchEntryValidate(const std::string& _value);
void OnCallbackReplaceValue(const std::string& _value);
void OnCallbackReplace();
void OnCallbackReplaceEntryValidate(const std::string& _value);
void OnCallbackCase(const bool& _value);
void OnCallbackWrap(const bool& _value);
void OnCallbackForward(const bool& _value);
}; };
}; };
}; };

View File

@ -78,16 +78,16 @@ void appl::TagFileSelection::init() {
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(shared_from_this(), "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection); externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsSelection);
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel); externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsCancel);
m_listTag = appl::TagFileList::create(); m_listTag = appl::TagFileList::create();
if (nullptr == m_listTag) { if (nullptr == 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 {
m_listTag->registerOnEvent(shared_from_this(), "validate", applEventCtagsListValidate); m_listTag->signalValidate.bind(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListValidate);
m_listTag->registerOnEvent(shared_from_this(), "select", applEventCtagsListSelect); m_listTag->signalSelect.bind(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListSelect);
m_listTag->registerOnEvent(shared_from_this(), "unselect", applEventCtagsListUnSelect); m_listTag->signalUnSelect.bind(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListUnSelect);
m_listTag->setExpand(bvec2(true,true)); m_listTag->setExpand(bvec2(true,true));
m_listTag->setFill(bvec2(true,true)); m_listTag->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(m_listTag); mySizerVert->subWidgetAdd(m_listTag);
@ -108,29 +108,34 @@ appl::TagFileSelection::~TagFileSelection() {
} }
void appl::TagFileSelection::onReceiveMessage(const ewol::object::Message& _msg) { void appl::TagFileSelection::onCallbackCtagsSelection() {
EWOL_INFO("ctags LIST ... : " << _msg );
if (_msg.getMessage() == applEventctagsSelection) {
if (m_eventNamed!="") { if (m_eventNamed!="") {
signalSelect.emit(m_eventNamed); signalSelect.emit(m_eventNamed);
// == > Auto remove ... // == > Auto remove ...
autoDestroy(); autoDestroy();
} }
} else if (_msg.getMessage() == applEventCtagsListSelect) { }
m_eventNamed = _msg.getData();
} else if (_msg.getMessage() == applEventCtagsListUnSelect) { void appl::TagFileSelection::onCallbackCtagsCancel() {
m_eventNamed = "";
} else if (_msg.getMessage() == applEventCtagsListValidate) {
signalSelect.emit(_msg.getData());
// == > Auto remove ...
autoDestroy();
} else if (_msg.getMessage() == applEventctagsCancel) {
signalCancel.emit(); signalCancel.emit();
// == > Auto remove ... // == > Auto remove ...
autoDestroy(); autoDestroy();
} }
return;
}; void appl::TagFileSelection::onCallbackCtagsListValidate(const std::string& _value) {
signalSelect.emit(_value);
// == > Auto remove ...
autoDestroy();
}
void appl::TagFileSelection::onCallbackCtagsListSelect(const std::string& _value) {
m_eventNamed = _value;
}
void appl::TagFileSelection::onCallbackCtagsListUnSelect() {
m_eventNamed = "";
}
/** /**

View File

@ -33,8 +33,12 @@ namespace appl {
* @param[in] jump line id * @param[in] jump line id
*/ */
void addCtagsNewItem(std::string file, int32_t line); void addCtagsNewItem(std::string file, int32_t line);
public: // herited function public: // callback function
void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackCtagsSelection();
void onCallbackCtagsCancel();
void onCallbackCtagsListValidate(const std::string& _value);
void onCallbackCtagsListSelect(const std::string& _value);
void onCallbackCtagsListUnSelect();
}; };
}; };

View File

@ -637,15 +637,6 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
markToRedraw(); markToRedraw();
return; return;
} }
// event needed even if selection of buffer is not done ...
if (_msg.getMessage() == appl_Buffer_eventIsModify) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl_Buffer_eventSelectChange) {
markToRedraw();
return;
}
// If not the last buffer selected, then no event parsing ... // If not the last buffer selected, then no event parsing ...
if (isSelectedLast() == false) { if (isSelectedLast() == false) {
return; return;
@ -671,7 +662,7 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
if (_msg.getMessage() == appl::MsgSelectNewFile) { if (_msg.getMessage() == appl::MsgSelectNewFile) {
// reset scroll: // reset scroll:
if (m_buffer != nullptr) { if (m_buffer != nullptr) {
m_buffer->unRegisterOnEvent(shared_from_this()); m_buffer->unBindAll(shared_from_this());
bool needAdd = true; bool needAdd = true;
for (size_t iii=0; iii<m_drawingRemenber.size(); ++iii) { for (size_t iii=0; iii<m_drawingRemenber.size(); ++iii) {
if (m_drawingRemenber[iii].first == m_buffer) { if (m_drawingRemenber[iii].first == m_buffer) {
@ -691,8 +682,8 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
m_buffer = m_bufferManager->get(_msg.getData()); m_buffer = m_bufferManager->get(_msg.getData());
m_bufferManager->setBufferSelected(m_buffer); m_bufferManager->setBufferSelected(m_buffer);
if (m_buffer != nullptr) { if (m_buffer != nullptr) {
m_buffer->registerOnEvent(shared_from_this(), "is-modify", appl_Buffer_eventIsModify); m_buffer->signalIsModify.bind(shared_from_this(), &appl::TextViewer::onCallbackIsModify);
m_buffer->registerOnEvent(shared_from_this(), "select-change", appl_Buffer_eventSelectChange); m_buffer->signalSelectChange.bind(shared_from_this(), &appl::TextViewer::onCallbackSelectChange);
for (auto element : m_drawingRemenber) { for (auto element : m_drawingRemenber) {
if (element.first == m_buffer) { if (element.first == m_buffer) {
m_originScrooled = element.second; m_originScrooled = element.second;
@ -708,6 +699,14 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
} }
} }
void appl::TextViewer::onCallbackIsModify() {
markToRedraw();
}
void appl::TextViewer::onCallbackSelectChange() {
markToRedraw();
}
void appl::TextViewer::onGetFocus() { void appl::TextViewer::onGetFocus() {
showKeyboard(); showKeyboard();
APPL_INFO("Focus - In"); APPL_INFO("Focus - In");

View File

@ -406,6 +406,9 @@ namespace appl {
bool _broadcast=false) { bool _broadcast=false) {
shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast); shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
} }
private: // callback fundtions
void onCallbackIsModify();
void onCallbackSelectChange();
}; };
}; };

View File

@ -13,8 +13,6 @@
#undef __class__ #undef __class__
#define __class__ "WorkerCloseAllFile" #define __class__ "WorkerCloseAllFile"
static const char* s_closeDone = "close-done";
appl::WorkerCloseAllFile::WorkerCloseAllFile() { appl::WorkerCloseAllFile::WorkerCloseAllFile() {
addObjectType("appl::WorkerCloseAllFile"); addObjectType("appl::WorkerCloseAllFile");
// load buffer manager: // load buffer manager:
@ -54,19 +52,18 @@ void appl::WorkerCloseAllFile::init() {
autoDestroy(); autoDestroy();
return; return;
} }
m_worker->registerOnEvent(shared_from_this(), "close-file-done", s_closeDone); m_worker->signalCloseDone.bind(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
} }
appl::WorkerCloseAllFile::~WorkerCloseAllFile() { appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
} }
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerCloseAllFile::onCallbackCloseDone() {
if (m_bufferManager == nullptr) { if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
if (_msg.getMessage() == s_closeDone) {
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
autoDestroy(); autoDestroy();
return; return;
@ -79,7 +76,6 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
autoDestroy(); autoDestroy();
return; return;
} }
m_worker->registerOnEvent(shared_from_this(), "close-file-done", s_closeDone); m_worker->signalCloseDone.bind(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
}
} }

View File

@ -24,8 +24,8 @@ namespace appl {
std::vector<std::string> m_bufferNameList; std::vector<std::string> m_bufferNameList;
std::shared_ptr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open... 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 std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback function
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackCloseDone();
}; };
}; };

View File

@ -14,11 +14,6 @@
#undef __class__ #undef __class__
#define __class__ "WorkerCloseFile" #define __class__ "WorkerCloseFile"
static const char* s_saveAsValidate = "save-as-validate";
static const char* s_saveValidate = "save-validate";
static const char* s_closeValidate = "close-validate";
static const char* s_saveAsDone = "save-as-done";
appl::WorkerCloseFile::WorkerCloseFile() : appl::WorkerCloseFile::WorkerCloseFile() :
signalCloseDone(*this, "close-file-done"), signalCloseDone(*this, "close-file-done"),
m_buffer(nullptr), m_buffer(nullptr),
@ -71,20 +66,20 @@ void appl::WorkerCloseFile::init(const std::string& _bufferName) {
} }
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...");
std::shared_ptr<ewol::Widget> bt = nullptr; std::shared_ptr<ewol::widget::Button> bt = nullptr;
if (m_buffer->hasFileName() == true) { if (m_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true); bt = tmpPopUp->addButton("Save", true);
if (bt != nullptr) { if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", s_saveValidate); bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveValidate);
} }
} }
bt = tmpPopUp->addButton("Save As", true); bt = tmpPopUp->addButton("Save As", true);
if (bt != nullptr) { if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", s_saveAsValidate); bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
} }
bt = tmpPopUp->addButton("Close", true); bt = tmpPopUp->addButton("Close", true);
if (bt != nullptr) { if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", s_closeValidate); bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
} }
tmpPopUp->addButton("Cancel", true); tmpPopUp->addButton("Cancel", true);
tmpPopUp->setRemoveOnExternClick(true); tmpPopUp->setRemoveOnExternClick(true);
@ -101,18 +96,23 @@ appl::WorkerCloseFile::~WorkerCloseFile() {
} }
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
void appl::WorkerCloseFile::onCallbackSaveAsValidate() {
if (m_bufferManager == nullptr) { if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
APPL_DEBUG("have message : " << _msg);
if (_msg.getMessage() == s_saveAsValidate) {
m_worker = appl::WorkerSaveFile::create(m_bufferName); m_worker = appl::WorkerSaveFile::create(m_bufferName);
if (m_worker != nullptr) { if (m_worker != nullptr) {
m_worker->registerOnEvent(shared_from_this(), "save-file-done", s_saveAsDone); m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
}
}
void appl::WorkerCloseFile::onCallbackSaveValidate() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
return;
} }
} else if (_msg.getMessage() == s_saveValidate) {
if (m_buffer == nullptr) { if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName); APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
autoDestroy(); autoDestroy();
@ -127,8 +127,13 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
} else { } else {
signalCloseDone.emit(); signalCloseDone.emit();
} }
} else if ( _msg.getMessage() == s_closeValidate }
|| _msg.getMessage() == s_saveAsDone) {
void appl::WorkerCloseFile::onCallbackClose() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
return;
}
if (m_buffer == nullptr) { if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName); APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy(); autoDestroy();
@ -137,6 +142,5 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
signalCloseDone.emit(); signalCloseDone.emit();
m_buffer->destroy(); m_buffer->destroy();
m_buffer.reset(); m_buffer.reset();
}
} }

View File

@ -29,8 +29,10 @@ namespace appl {
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::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::WorkerSaveFile> m_worker; //! sub-worker element...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback Functions
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackSaveAsValidate();
void onCallbackSaveValidate();
void onCallbackClose();
}; };
}; };

View File

@ -13,8 +13,6 @@
#undef __class__ #undef __class__
#define __class__ "WorkerSaveAllFile" #define __class__ "WorkerSaveAllFile"
static const char* s_saveAsDone = "save-as-done";
appl::WorkerSaveAllFile::WorkerSaveAllFile() { appl::WorkerSaveAllFile::WorkerSaveAllFile() {
addObjectType("appl::WorkerSaveAllFile"); addObjectType("appl::WorkerSaveAllFile");
// load buffer manager: // load buffer manager:
@ -56,19 +54,18 @@ void appl::WorkerSaveAllFile::init() {
autoDestroy(); autoDestroy();
return; return;
} }
m_worker->registerOnEvent(shared_from_this(), "save-file-done", s_saveAsDone); m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
} }
appl::WorkerSaveAllFile::~WorkerSaveAllFile() { appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
} }
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerSaveAllFile::onCallbackSaveAsDone() {
if (m_bufferManager == nullptr) { if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
if (_msg.getMessage() == s_saveAsDone) {
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
autoDestroy(); autoDestroy();
return; return;
@ -81,7 +78,6 @@ void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg
autoDestroy(); autoDestroy();
return; return;
} }
m_worker->registerOnEvent(shared_from_this(), "save-file-done", s_saveAsDone); m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}
} }

View File

@ -24,8 +24,8 @@ namespace appl {
std::vector<std::string> m_bufferNameList; std::vector<std::string> m_bufferNameList;
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open... 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 std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback function
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackSaveAsDone();
}; };
}; };

View File

@ -13,7 +13,6 @@
#undef __class__ #undef __class__
#define __class__ "WorkerSaveFile" #define __class__ "WorkerSaveFile"
static const char* s_saveAsValidate = "save-as-validate";
appl::WorkerSaveFile::WorkerSaveFile() : appl::WorkerSaveFile::WorkerSaveFile() :
signalSaveDone(*this, "save-file-done") { signalSaveDone(*this, "save-file-done") {
@ -77,20 +76,19 @@ void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveA
return; return;
} }
tmpWindows->popUpWidgetPush(m_chooser); tmpWindows->popUpWidgetPush(m_chooser);
m_chooser->registerOnEvent(shared_from_this(), "validate", s_saveAsValidate); m_chooser->signalValidate.bind(shared_from_this(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
} }
appl::WorkerSaveFile::~WorkerSaveFile() { appl::WorkerSaveFile::~WorkerSaveFile() {
} }
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerSaveFile::onCallbackSaveAsValidate(const std::string& _value) {
if (m_bufferManager == nullptr) { if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
if (_msg.getMessage() == s_saveAsValidate) { if (_value == "") {
if (_msg.getData() == "") {
APPL_ERROR(" might be an error of the File chooser system..."); APPL_ERROR(" might be an error of the File chooser system...");
return; return;
} }
@ -103,7 +101,7 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
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(_value);
if (tmpBuffer->storeFile() == false) { if (tmpBuffer->storeFile() == false) {
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows(); std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) { if (tmpWindows == nullptr) {
@ -113,6 +111,5 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
} else { } else {
signalSaveDone.emit(); signalSaveDone.emit();
} }
}
} }

View File

@ -26,8 +26,8 @@ namespace appl {
std::string m_bufferName; std::string m_bufferName;
std::shared_ptr<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open... 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 std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback function
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackSaveAsValidate(const std::string& _value);
}; };
}; };

View File

@ -44,12 +44,6 @@ const char* eventOpenCtagsOpenFileReturn = "event-plugin-ctags-open-file-return"
const char* eventOpenCtagsSelectReturn = "event-plugin-ctags-select-file-return"; const char* eventOpenCtagsSelectReturn = "event-plugin-ctags-select-file-return";
void appl::TextPluginCtags::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginCtags::onPluginEnable(appl::TextViewer& _textDrawer) {
// Add local event of this object (no dependency with the viewer ...
/*
registerMultiCast(ednMsgGuiCtags);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgCtagsLoadFile);
*/
// add event : // add event :
_textDrawer.ext_registerMultiCast(eventJumpDestination); _textDrawer.ext_registerMultiCast(eventJumpDestination);
_textDrawer.ext_registerMultiCast(eventJumpBack); _textDrawer.ext_registerMultiCast(eventJumpBack);
@ -98,7 +92,7 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess); } while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(shared_from_this(), "select", eventOpenCtagsSelectReturn); tmpWidget->signalSelect.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
} }
} else { } else {
jumpFile(myfile.getName(), lineID - 1); jumpFile(myfile.getName(), lineID - 1);
@ -157,23 +151,24 @@ void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
#endif #endif
} }
void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg) { void appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn(const std::string& _value) {
if (_msg.getMessage() == eventOpenCtagsOpenFileReturn) {
// open the new one : // open the new one :
etk::FSNode tmpFilename = _msg.getData(); etk::FSNode tmpFilename = _value;
m_tagFilename = tmpFilename.getNameFile(); m_tagFilename = tmpFilename.getNameFile();
m_tagFolderBase = tmpFilename.getNameFolder(); m_tagFolderBase = tmpFilename.getNameFolder();
APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " "); APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
loadTagFile(); loadTagFile();
} else if (_msg.getMessage() == eventOpenCtagsSelectReturn) { }
void appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn(const std::string& _value) {
// parse the input data // parse the input data
char tmp[4096]; char tmp[4096];
int32_t lineID; int32_t lineID;
// TODO : Review this ... // TODO : Review this ...
sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp); sscanf(_value.c_str(), "%d:%s", &lineID, tmp);
jumpFile(tmp, lineID - 1); jumpFile(tmp, lineID - 1);
}
} }
bool appl::TextPluginCtags::onReceiveMessageViewer(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) {
@ -195,7 +190,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
tmpWidget->setFolder(path); tmpWidget->setFolder(path);
} }
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(shared_from_this(), "validate", eventOpenCtagsOpenFileReturn); tmpWidget->signalValidate.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
return true; return true;
} else if (_msg.getMessage() == eventJumpDestination) { } else if (_msg.getMessage() == eventJumpDestination) {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {

View File

@ -45,8 +45,9 @@ namespace appl {
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg); const ewol::object::Message& _msg);
// internal message : // callback function:
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackOpenCtagsOpenFileReturn(const std::string& _value);
void onCallbackOpenCtagsSelectReturn(const std::string& _value);
}; };
}; };

View File

@ -31,64 +31,6 @@ class myParamGlobal : public ewol::Object {
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process) m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
setName("edn_global_param"); setName("edn_global_param");
} }
/*
bool onSetConfig(const ewol::object::Config& _conf) {
// Not set the EObject node parameter (name == > not change ...)
if (_conf.getConfig() == configEOL) {
m_displayEOL = etk::string_to_bool(_conf.getData());
return true;
}
if (_conf.getConfig() == configAutoIndent) {
m_AutoIndent = etk::string_to_bool(_conf.getData());
return true;
}
if (_conf.getConfig() == configShowTabChar) {
m_displayTabChar = etk::string_to_bool(_conf.getData());
return true;
}
if (_conf.getConfig() == configShowSpaceChar) {
m_displaySpaceChar = etk::string_to_bool(_conf.getData());
return true;
}
return false;
}
bool onGetConfig(const char* _config, std::string& _result) const {
// Not set the EObject node parameter (name == > not change ...)
if (_config == configEOL) {
if (true == m_displayEOL) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configAutoIndent) {
if (true == m_AutoIndent) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configShowTabChar) {
if (true == m_displayTabChar) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configShowSpaceChar) {
if (true == m_displaySpaceChar) {
_result = "true";
} else {
_result = "false";
}
return true;
}
return false;
}
*/
}; };
@ -161,11 +103,6 @@ int32_t globals::getNbLineBorder() {
#include <ewol/widget/CheckBox.h> #include <ewol/widget/CheckBox.h>
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
static const char * const l_changeIndentation = "edn-event-change-indentation";
static const char * const l_changeSpace = "edn-event-change-spaces";
static const char * const l_changeTabulation = "edn-event-change-tabulation";
static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
static const char * const l_changeRounded = "edn-event-change-rounded";
globals::ParameterGlobalsGui::ParameterGlobalsGui() { globals::ParameterGlobalsGui::ParameterGlobalsGui() {
addObjectType("globals::ParameterGlobalsGui"); addObjectType("globals::ParameterGlobalsGui");
@ -189,7 +126,7 @@ void globals::ParameterGlobalsGui::init() {
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetAutoIndent()); myCheckbox->setValue(isSetAutoIndent());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeIndentation); myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = ewol::widget::CheckBox::create("Display space char (' ')"); myCheckbox = ewol::widget::CheckBox::create("Display space char (' ')");
@ -198,7 +135,7 @@ void globals::ParameterGlobalsGui::init() {
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplaySpaceChar()); myCheckbox->setValue(isSetDisplaySpaceChar());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeSpace); myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackSpace);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = ewol::widget::CheckBox::create("Display tabulation char ('\\t')"); myCheckbox = ewol::widget::CheckBox::create("Display tabulation char ('\\t')");
@ -207,7 +144,7 @@ void globals::ParameterGlobalsGui::init() {
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayTabChar()); myCheckbox->setValue(isSetDisplayTabChar());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeTabulation); myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = ewol::widget::CheckBox::create("Display end of line ('\\n')"); myCheckbox = ewol::widget::CheckBox::create("Display end of line ('\\n')");
@ -216,7 +153,7 @@ void globals::ParameterGlobalsGui::init() {
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine()); myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeEndOfLine); myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = ewol::widget::CheckBox::create("switch Rounded/default"); myCheckbox = ewol::widget::CheckBox::create("switch Rounded/default");
@ -225,7 +162,7 @@ void globals::ParameterGlobalsGui::init() {
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine()); myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeRounded); myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackRounded);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
} }
@ -235,35 +172,22 @@ globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
} }
void globals::ParameterGlobalsGui::onReceiveMessage(const ewol::object::Message& _msg) { void globals::ParameterGlobalsGui::onCallbackEndOfLine(const bool& _value) {
ewol::widget::Sizer::onReceiveMessage(_msg); setDisplayEndOfLine(_value);
}
if (_msg.getMessage() == l_changeEndOfLine) { void globals::ParameterGlobalsGui::onCallbackIndentation(const bool& _value) {
if (_msg.getData() == "true") { setAutoIndent(_value);
setDisplayEndOfLine(true); }
} else {
setDisplayEndOfLine(false); void globals::ParameterGlobalsGui::onCallbackSpace(const bool& _value) {
} setDisplaySpaceChar(_value);
} else if (_msg.getMessage() == l_changeIndentation) { }
if (_msg.getData() == "true") { void globals::ParameterGlobalsGui::onCallbackTabulation(const bool& _value) {
setAutoIndent(true); setDisplayTabChar(_value);
} else { }
setAutoIndent(false); void globals::ParameterGlobalsGui::onCallbackRounded(const bool& _value) {
} if (_value == true) {
} else if (_msg.getMessage() == l_changeSpace) {
if (_msg.getData() == "true") {
setDisplaySpaceChar(true);
} else {
setDisplaySpaceChar(false);
}
} else if (_msg.getMessage() == l_changeTabulation) {
if (_msg.getData() == "true") {
setDisplayTabChar(true);
} else {
setDisplayTabChar(false);
}
} else if (_msg.getMessage() == l_changeRounded) {
if (_msg.getData() == "true") {
etk::theme::setName("GUI", "rounded");; etk::theme::setName("GUI", "rounded");;
} else { } else {
etk::theme::setName("GUI", "default");; etk::theme::setName("GUI", "default");;
@ -271,7 +195,5 @@ void globals::ParameterGlobalsGui::onReceiveMessage(const ewol::object::Message&
// Reload shaders and graphic system ... // Reload shaders and graphic system ...
ewol::getContext().getResourcesManager().reLoadResources(); ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll(); ewol::getContext().forceRedrawAll();
}
} }

View File

@ -43,8 +43,11 @@ namespace globals
public: public:
DECLARE_FACTORY(ParameterGlobalsGui); DECLARE_FACTORY(ParameterGlobalsGui);
virtual ~ParameterGlobalsGui(); virtual ~ParameterGlobalsGui();
// herited function void onCallbackEndOfLine(const bool& _value);
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackIndentation(const bool& _value);
void onCallbackSpace(const bool& _value);
void onCallbackTabulation(const bool& _value);
void onCallbackRounded(const bool& _value);
}; };
} }

View File

@ -8,10 +8,32 @@
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
appl::Broadcast::Broadcast() :
signalBufferState(*this, "buffer-state"),
signalBufferName(*this, "buffer-name"),
signalBufferId(*this, "buffer-id"),
signalCodeViewSelectedId(*this, "code-view-select-id"),
signalOpenFile(*this, "open-file"),
signalBufferListChange(*this, "buffer-list-change"),
signalBufferColor(*this, "buffer-color"),
signalSelectNewFile(*this, "select-new-file"),
signalSelectChange(*this, "select-change"),
signalNameChange(*this, "buffer-name-change"),
signalNameGuiChangeColor(*this, "gui-Change-color"),
signalSelectGotoLine(*this, "gui-goto-line"),
signalSelectGotoLineSelect(*this, "gui-goto-line-select")
{
}
void appl::Broadcast::init(const std::string& _uniqueName) {
ewol::Resource::init(_uniqueName);
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Event of the gui request something : // Event of the gui request something :
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/*
extern const char* const ednMsgGuiNew = "edn-Msg-Gui-New"; extern const char* const ednMsgGuiNew = "edn-Msg-Gui-New";
extern const char* const ednMsgGuiOpen = "edn-Msg-Gui-Open"; extern const char* const ednMsgGuiOpen = "edn-Msg-Gui-Open";
extern const char* const ednMsgGuiClose = "edn-Msg-Gui-Close"; extern const char* const ednMsgGuiClose = "edn-Msg-Gui-Close";
@ -40,27 +62,10 @@ extern const char* const ednMsgGuiCtags = "edn-Msg-Gui-CTags";
extern const char* const ednMsgCtagsLoadFile = "edn-Msg-CTags-direct-load"; extern const char* const ednMsgCtagsLoadFile = "edn-Msg-CTags-direct-load";
extern const char* const ednMsgGuiReloadShader = "edn-Msg-Gui-ReloadOpenGlShader"; extern const char* const ednMsgGuiReloadShader = "edn-Msg-Gui-ReloadOpenGlShader";
*/
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Event internal : // Event internal :
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
extern const char* const ednMsgBufferState = "edn-Msg-Buffer-State";
extern const char* const ednMsgBufferName = "edn-Msg-Buffer-Name";
extern const char* const ednMsgBufferId = "edn-Msg-Buffer-Id";
extern const char* const ednMsgCodeViewSelectedId = "edn-Msg-CodeView-Select-Id";
extern const char* const ednMsgOpenFile = "edn-Msg-OpenFile";
extern const char* const ednMsgBufferListChange = "edn-Msg-BufferListChange";
extern const char* const ednMsgBufferColor = "edn-Msg-Buffer-Color";
extern const char* const appl::MsgSelectNewFile = "edn-msg-select-new-file";
extern const char* const appl::MsgSelectChange = "edn-msg-select-change";
extern const char* const appl::MsgNameChange = "edn-msg-buffer-name-change";
extern const char* const appl::MsgNameGuiChangeColor = "edn-Msg-Gui-Change-color";
extern const char* const appl::MsgSelectGotoLine = "edn-Msg-Gui-goto-line";
extern const char* const appl::MsgSelectGotoLineSelect = "edn-Msg-Gui-goto-line-select";

View File

@ -8,60 +8,66 @@
#ifndef __MSG_BROADCAST_H__ #ifndef __MSG_BROADCAST_H__
#define __MSG_BROADCAST_H__ #define __MSG_BROADCAST_H__
namespace appl {
class Broadcast : public ewol::Resource {
public:
Broadcast();
void init(const std::string& _uniqueName);
public:
DECLARE_RESOURCE_SINGLE_FACTORY(Broadcast, "???Broadcast???");
virtual ~Broadcast() {};
public:
/*
ewol::object::Signal<> signalGuiNew; // data : ""
ewol::object::Signal<> signalGuiOpen; // data : ""
ewol::object::Signal<> signalGuiClose; // data : "current" "All"
ewol::object::Signal<> signalGuiSave; // data : ""
ewol::object::Signal<> signalSaveAs; // data : ""
ewol::object::Signal<> signalProperties; // data : ""
ewol::object::Signal<> signalGuiExit; // data : ""
//////////////////////////////////////////////////////////////////////// ewol::object::Signal<> signalGuiUndo; // data : ""
// Event of the gui request something : ewol::object::Signal<> signalGuiRedo; // data : ""
//////////////////////////////////////////////////////////////////////// ewol::object::Signal<> signalGuiCopy; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiNew; // data : "" ewol::object::Signal<> signalGuiCut; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiOpen; // data : "" ewol::object::Signal<> signalGuiPaste; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiClose; // data : "current" "All" ewol::object::Signal<> signalGuiRm; // data : "Word" "Line" "Paragraph"
extern const char* const ednMsgGuiSave; // data : "" ewol::object::Signal<> signalGuiSelect; // data : "ALL" "NONE"
extern const char* const ednMsgGuiSaveAs; // data : "" ewol::object::Signal<> signalGuiGotoLine; // data : "???" / "1" ... "999999999999"
extern const char* const ednMsgProperties; // data : ""
extern const char* const ednMsgGuiExit; // data : ""
extern const char* const ednMsgGuiUndo; // data : "" ewol::object::Signal<> signalGuiSearch; // data : ""
extern const char* const ednMsgGuiRedo; // data : "" ewol::object::Signal<> signalGuiReplace; // data : "Normal" "All"
extern const char* const ednMsgGuiCopy; // data : "STD" "Middle" "1" ... "9" ewol::object::Signal<> signalGuiFind; // data : "Next" "Previous" "All" "None"
extern const char* const ednMsgGuiCut; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiPaste; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiRm; // data : "Word" "Line" "Paragraph"
extern const char* const ednMsgGuiSelect; // data : "ALL" "NONE"
extern const char* const ednMsgGuiGotoLine; // data : "???" / "1" ... "999999999999"
extern const char* const ednMsgGuiSearch; // data : "" ewol::object::Signal<> signalShowSpaces; // data : "enable" "disable"
extern const char* const ednMsgGuiReplace; // data : "Normal" "All" ewol::object::Signal<> signalShowEndOfLine; // data : "enable" "disable"
extern const char* const ednMsgGuiFind; // data : "Next" "Previous" "All" "None"
extern const char* const ednMsgGuiShowSpaces; // data : "enable" "disable" ewol::object::Signal<> signalGuiCtags; // data : "Load" "ReLoad" "Jump" "Back"
extern const char* const ednMsgGuiShowEndOfLine; // data : "enable" "disable" ewol::object::Signal<> signalCtagsLoadFile; // data : "filename of the ctags file"
extern const char* const ednMsgGuiCtags; // data : "Load" "ReLoad" "Jump" "Back"
extern const char* const ednMsgCtagsLoadFile; // data : "filename of the ctags file"
extern const char* const ednMsgGuiReloadShader; // data : ""
ewol::object::Signal<> signalGuiReloadShader; // data : ""
*/
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Event internal : // Event internal :
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
extern const char* const ednMsgBufferState; // data : "Saved" "Modify" "HasHistory" "HasNotHistory" "HasFutureHistory" "HasNotFutureHistory" ewol::object::Signal<std::string> signalBufferState; // data : "Saved" "Modify" "HasHistory" "HasNotHistory" "HasFutureHistory" "HasNotFutureHistory"
extern const char* const ednMsgBufferName; // data : "filename" ewol::object::Signal<std::string> signalBufferName; // data : "filename"
extern const char* const ednMsgBufferId; // data : "0" ... "99999999999" ewol::object::Signal<void> signalBufferId; // data : "0" ... "99999999999"
extern const char* const ednMsgCodeViewSelectedId; // data : "0" ... "99999999999" ewol::object::Signal<void> signalCodeViewSelectedId; // data : "0" ... "99999999999"
extern const char* const ednMsgOpenFile; // data : "/Compleate/file/name.xx" ewol::object::Signal<std::string> signalOpenFile; // data : "/Compleate/file/name.xx"
extern const char* const ednMsgBufferListChange; // data : "" ewol::object::Signal<void> signalBufferListChange; // data : ""
extern const char* const ednMsgBufferColor; // data : "new" ewol::object::Signal<std::string> signalBufferColor; // data : "new"
namespace appl { ewol::object::Signal<std::string> signalSelectNewFile; // data : "buffer/name"
extern const char* const MsgSelectNewFile; // data : "buffer/name" ewol::object::Signal<void> signalSelectChange; // data : ""
extern const char* const MsgSelectChange; // data : "" ewol::object::Signal<void> signalNameChange; // data : ""
extern const char* const MsgNameChange; // data : "" ewol::object::Signal<std::string> signalNameGuiChangeColor; // data : "Black" "White"
extern const char* const MsgNameGuiChangeColor; // data : "Black" "White" ewol::object::Signal<int32_t> signalSelectGotoLine; // data : "75822"
extern const char* const MsgSelectGotoLine; // data : "75822" ewol::object::Signal<int32_t> signalSelectGotoLineSelect; // data : "75822"
extern const char* const MsgSelectGotoLineSelect; // data : "75822" };
}; };
#endif #endif

View File

@ -97,7 +97,7 @@ class MainApplication : public ewol::context::Application {
std::string name = file.getName(); std::string name = file.getName();
APPL_INFO("Load ctag file : \"" << name << "\"" ); APPL_INFO("Load ctag file : \"" << name << "\"" );
ctagDetected = false; ctagDetected = false;
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name); //_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
} else { } else {
etk::FSNode file(tmpppp); etk::FSNode file(tmpppp);
std::string name = file.getName(); std::string name = file.getName();