diff --git a/sources/appl/Buffer/BufferManager.cpp b/sources/appl/Buffer/BufferManager.cpp index 7db26fc..453c90f 100644 --- a/sources/appl/Buffer/BufferManager.cpp +++ b/sources/appl/Buffer/BufferManager.cpp @@ -21,25 +21,12 @@ class classBufferManager: public ewol::EObject // Constructeur classBufferManager(void); ~classBufferManager(void); - /** - * @brief Get the current Object type of the EObject - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type description - * @return true if the object is compatible, otherwise false - */ const char * const GetObjectType(void) { return "ApplBufferManager"; } public: - /** - * @brief Receive a message from an other EObject with a specific eventId and data - * @param[in] CallerObject Pointer on the EObject that information came from - * @param[in] eventId Message registered by this class - * @param[in] data Data registered by this class - * @return --- - */ - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); + virtual void OnReceiveMessage(const ewol::EMessage& _msg); private: // return the ID of the buffer allocated // create a buffer with no element @@ -70,14 +57,6 @@ class classBufferManager: public ewol::EObject // Constructeur -/** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ classBufferManager::classBufferManager(void) { m_idSelected = -1; @@ -89,14 +68,6 @@ classBufferManager::classBufferManager(void) RegisterMultiCast(ednMsgBufferId); } -/** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ classBufferManager::~classBufferManager(void) { //clean All Buffer @@ -108,24 +79,17 @@ classBufferManager::~classBufferManager(void) } -/** - * @brief Receive a message from an other EObject with a specific eventId and data - * @param[in] CallerObject Pointer on the EObject that information came from - * @param[in] eventId Message registered by this class - * @param[in] data Data registered by this class - * @return --- - */ -void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg) { - ewol::EObject::OnReceiveMessage(CallerObject, eventId, data); + ewol::EObject::OnReceiveMessage(_msg); - if (eventId == ednMsgBufferId) { + if (_msg.GetMessage() == ednMsgBufferId) { // select a new buffer ID : - if (data == "") { + if (_msg.GetData() == "") { APPL_ERROR("Request select buffer ID = \"\" "); } else { int32_t newID = -1; - sscanf(data.c_str(), "%d", &newID); + sscanf(_msg.GetData().c_str(), "%d", &newID); if(true == Exist(newID)) { m_idSelected = newID; } else { @@ -133,17 +97,17 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch APPL_ERROR("Request a non existant ID : " << newID << " reset to -1..."); } } - } else if (eventId == ednMsgGuiNew) { + } else if (_msg.GetMessage() == ednMsgGuiNew) { int32_t newOne = Create(); if (-1 != newOne) { m_idSelected = newOne; SendMultiCast(ednMsgBufferId, m_idSelected); SendMultiCast(ednMsgBufferListChange); } - } else if (eventId == ednMsgOpenFile) { - if (data != "" ) { - etk::FSNode myFile(data); - APPL_DEBUG("request open file = \"" < request a Gui display ... @@ -170,7 +134,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch } } else { int32_t newId; - sscanf(data.c_str(), "%d", &newId); + sscanf(_msg.GetData().c_str(), "%d", &newId); if (false == Exist(newId)) { APPL_ERROR("Request a save As with a non existant ID=" << newId); } else { @@ -184,20 +148,20 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch SendMultiCast(ednMsgBufferState, "saved"); } } - } else if (eventId == ednMsgGuiClose) { - if (data == "") { + } else if (_msg.GetMessage() == ednMsgGuiClose) { + if (_msg.GetData() == "") { APPL_ERROR("Null data for close file ... "); } else { - if (data == "All") { + if (_msg.GetData() == "All") { } else { int32_t closeID = -1; - if (data == "current") { + if (_msg.GetData() == "current") { closeID = m_idSelected; APPL_DEBUG("Close specific buffer ID" << closeID); } else { // close specific buffer ... - sscanf(data.c_str(), "%d", &closeID); + sscanf(_msg.GetData().c_str(), "%d", &closeID); APPL_DEBUG("Close specific buffer ID="<< closeID); } if(true == Exist(closeID)) { @@ -232,13 +196,13 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch } } } - } else if (eventId == ednMsgCodeViewSelectedId) { + } else if (_msg.GetMessage() == ednMsgCodeViewSelectedId) { //Change the selected buffer - if (data == "") { + if (_msg.GetData() == "") { APPL_ERROR("Null data for changing buffer ID file ... "); } else { int32_t newId; - sscanf(data.c_str(), "%d", &newId); + sscanf(_msg.GetData().c_str(), "%d", &newId); if (true == Exist(newId)) { m_idSelected = newId; } else { diff --git a/sources/appl/Colorize/ColorizeManager.cpp b/sources/appl/Colorize/ColorizeManager.cpp index 8e65c6e..fa0dc2e 100644 --- a/sources/appl/Colorize/ColorizeManager.cpp +++ b/sources/appl/Colorize/ColorizeManager.cpp @@ -23,24 +23,11 @@ class classColorManager: public ewol::EObject classColorManager(void); ~classColorManager(void); - /** - * @brief Get the current Object type of the EObject - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type description - * @return true if the object is compatible, otherwise false - */ const char * const GetObjectType(void) { return "ApplColorManager"; } - /** - * @brief Receive a message from an other EObject with a specific eventId and data - * @param[in] CallerObject Pointer on the EObject that information came from - * @param[in] eventId Message registered by this class - * @param[in] data Data registered by this class - * @return --- - */ - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); + virtual void OnReceiveMessage(const ewol::EMessage& _msg); public: void LoadFile(etk::UString &xmlFilename); void LoadFile(const char * xmlFilename); @@ -80,7 +67,7 @@ classColorManager::~classColorManager(void) listMyColor.Clear(); } -void classColorManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void classColorManager::OnReceiveMessage(const ewol::EMessage& _msg) { /* switch (id) diff --git a/sources/appl/Gui/BufferView.cpp b/sources/appl/Gui/BufferView.cpp index f11ffb9..3a05758 100644 --- a/sources/appl/Gui/BufferView.cpp +++ b/sources/appl/Gui/BufferView.cpp @@ -68,17 +68,10 @@ void BufferView::RemoveAllElement(void) m_list.Clear(); } -/** - * @brief Receive a message from an other EObject with a specific eventId and data - * @param[in] CallerObject Pointer on the EObject that information came from - * @param[in] eventId Message registered by this class - * @param[in] data Data registered by this class - * @return --- - */ -void BufferView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void BufferView::OnReceiveMessage(const ewol::EMessage& _msg) { - widget::List::OnReceiveMessage(CallerObject, eventId, data); - if (eventId == ednMsgBufferListChange) { + widget::List::OnReceiveMessage(_msg); + if (_msg.GetMessage() == ednMsgBufferListChange) { // clean The list RemoveAllElement(); // Get all the buffer name and properties: @@ -102,10 +95,10 @@ void BufferView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve SortElementList(m_list); } MarkToRedraw(); - }else if (eventId == ednMsgBufferId) { + }else if (_msg.GetMessage() == ednMsgBufferId) { m_selectedIdRequested = BufferManager::GetSelected(); MarkToRedraw(); - }else if (eventId == ednMsgBufferState) { + }else if (_msg.GetMessage() == ednMsgBufferState) { // Update list of modify section ... for (int32_t iii=0; iii=0 && m_bufferID < m_lineNumberList.Size()) { m_lineNumberList[m_bufferID] = m_originScrooled; } int32_t bufferID = 0; - sscanf(data.c_str(), "%d", &bufferID); + sscanf(_msg.GetData().c_str(), "%d", &bufferID); APPL_INFO("Select a new Buffer ... " << bufferID); // set the new buffer ID m_bufferID = bufferID; @@ -341,105 +341,105 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event && m_bufferID < m_lineNumberList.Size()) { m_originScrooled = m_lineNumberList[m_bufferID]; } - } else if (eventId == ednMsgGuiCopy) { + } else if (_msg.GetMessage() == ednMsgGuiCopy) { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Copy(ewol::clipBoard::clipboardStd); } - } else if (eventId == ednMsgGuiCut) { + } else if (_msg.GetMessage() == ednMsgGuiCut) { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Cut(ewol::clipBoard::clipboardStd); } - } else if (eventId == ednMsgGuiPaste) { + } else if (_msg.GetMessage() == ednMsgGuiPaste) { ewol::clipBoard::Request(ewol::clipBoard::clipboardStd); - } else if (eventId == ednMsgGuiUndo) { + } else if (_msg.GetMessage() == ednMsgGuiUndo) { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Undo(); } - } else if (eventId == ednMsgGuiRedo) { + } else if (_msg.GetMessage() == ednMsgGuiRedo) { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Redo(); } - } else if (eventId == ednMsgGuiRm) { + } else if (_msg.GetMessage() == ednMsgGuiRm) { // data : "Word" "Line" "Paragraph" - if (data == "Word") { - APPL_WARNING(" on event " << eventId << " data=\"" << data << "\" ==> not coded" ); - } else if (data == "Line") { + if (_msg.GetData() == "Word") { + APPL_WARNING(" on event " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\" ==> not coded" ); + } else if (_msg.GetData() == "Line") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->RemoveLine(); } - } else if (data == "Paragraph") { - APPL_WARNING(" on event " << eventId << " data=\"" << data << "\" ==> not coded" ); + } else if (_msg.GetData() == "Paragraph") { + APPL_WARNING(" on event " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\" ==> not coded" ); } else { - APPL_ERROR(" on event " << eventId << " unknow data=\"" << data << "\"" ); + APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" ); } - } else if (eventId == ednMsgGuiSelect) { + } else if (_msg.GetMessage() == ednMsgGuiSelect) { // data : "ALL" "NONE" - if (data == "ALL") { + if (_msg.GetData() == "ALL") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->SelectAll(); } - } else if (data == "NONE") { + } else if (_msg.GetData() == "NONE") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->SelectNone(); } } else { - APPL_ERROR(" on event " << eventId << " unknow data=\"" << data << "\"" ); + APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" ); } - } else if (eventId == ednMsgGuiChangeCharset) { + } else if (_msg.GetMessage() == ednMsgGuiChangeCharset) { // data : "UTF-8" "ISO-8859-1" "ISO-8859-15" - if (data == "UTF-8") { + if (_msg.GetData() == "UTF-8") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->SetCharset(unicode::EDN_CHARSET_UTF8); } - } else if (data == "ISO-8859-1") { + } else if (_msg.GetData() == "ISO-8859-1") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_1); } - } else if (data == "ISO-8859-15") { + } else if (_msg.GetData() == "ISO-8859-15") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_15); } } else { - APPL_ERROR(" on event " << eventId << " unknow data=\"" << data << "\"" ); + APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" ); } - } else if (eventId == ednMsgGuiFind) { + } else if (_msg.GetMessage() == ednMsgGuiFind) { etk::UString myDataString; SearchData::GetSearch(myDataString); - if (data == "Next") { + if (_msg.GetData() == "Next") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() ); } - } else if (data == "Previous") { + } else if (_msg.GetData() == "Previous") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() ); } } - } else if (eventId == ednMsgGuiReplace) { + } else if (_msg.GetMessage() == ednMsgGuiReplace) { etk::UString myDataString; SearchData::GetReplace(myDataString); - if (data == "Normal") { + if (_msg.GetData() == "Normal") { BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { tmpBuffer->Replace(myDataString); } - } else if (data == "All") { + } else if (_msg.GetData() == "All") { } - } else if (eventId == ednMsgGuiGotoLine) { + } else if (_msg.GetMessage() == ednMsgGuiGotoLine) { int32_t lineID = 0; - sscanf(data.c_str(), "%d", &lineID); + sscanf(_msg.GetData().c_str(), "%d", &lineID); APPL_INFO("Goto line : " << lineID); BufferText* tmpBuffer = BufferManager::Get(m_bufferID); if (NULL!=tmpBuffer) { diff --git a/sources/appl/Gui/CodeView.h b/sources/appl/Gui/CodeView.h index fe64b6f..9c9a269 100644 --- a/sources/appl/Gui/CodeView.h +++ b/sources/appl/Gui/CodeView.h @@ -25,36 +25,34 @@ class CodeView :public widget::WidgetScrooled CodeView(etk::UString fontName, int32_t fontSize); CodeView(void); virtual ~CodeView(void); - // Derived function - const char * const GetObjectType(void) { return "ApplCodeView"; }; - // Derived function - virtual bool CalculateMinSize(void); private: - etk::UString m_label; - draw::Color m_textColorFg; //!< Text color - draw::Color m_textColorBg; //!< Background color - int32_t m_bufferID; - bool m_buttunOneSelected; - etk::Vector m_lineNumberList; + etk::UString m_label; + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color + int32_t m_bufferID; + bool m_buttunOneSelected; + etk::Vector m_lineNumberList; void UpdateNumberOfLineReference(int32_t bufferID); // drawing elements : - ewol::Text m_displayText; - ewol::Drawing m_displayDrawing; - public: // Derived function - virtual void OnRegenerateDisplay(void); - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); - virtual bool OnEventInput(const ewol::EventInput& _event); - virtual bool OnEventEntry(const ewol::EventEntry& _event); - virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID); - virtual void OnGetFocus(void); - virtual void OnLostFocus(void); + ewol::Text m_displayText; + ewol::Drawing m_displayDrawing; public: void SetFontSize(int32_t size); void SetFontName(etk::UString fontName); private: void CalculateMaxSize(void); - protected: - virtual void OnDraw(ewol::DrawProperty& displayProp); + protected: // derived function + virtual void OnDraw(void); + public: // Derived function + const char * const GetObjectType(void) { return "ApplCodeView"; }; + virtual bool CalculateMinSize(void); + virtual void OnRegenerateDisplay(void); + virtual void OnReceiveMessage(const ewol::EMessage& _msg); + virtual bool OnEventInput(const ewol::EventInput& _event); + virtual bool OnEventEntry(const ewol::EventEntry& _event); + virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID); + virtual void OnGetFocus(void); + virtual void OnLostFocus(void); }; #endif diff --git a/sources/appl/Gui/MainWindows.cpp b/sources/appl/Gui/MainWindows.cpp index e70040c..50b80f4 100644 --- a/sources/appl/Gui/MainWindows.cpp +++ b/sources/appl/Gui/MainWindows.cpp @@ -253,13 +253,13 @@ const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected"; const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected"; -void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void MainWindows::OnReceiveMessage(const ewol::EMessage& _msg) { - ewol::Windows::OnReceiveMessage(CallerObject, eventId, data); + ewol::Windows::OnReceiveMessage(_msg); //APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" ); // Open file Section ... - if (eventId == ednMsgGuiOpen) { + if (_msg.GetMessage() == ednMsgGuiOpen) { widget::FileChooser* tmpWidget = new widget::FileChooser(); tmpWidget->SetTitle("Open Files ..."); tmpWidget->SetValidateLabel("Open"); @@ -272,18 +272,18 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev } PopUpWidgetPush(tmpWidget); tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected); - } else if (eventId == ednEventPopUpFileSelected) { - APPL_DEBUG("Request opening the file : " << data); - SendMultiCast(ednMsgOpenFile, data); - } else if (eventId == ednMsgGuiSaveAs) { - if (data == "") { + } else if (_msg.GetMessage() == ednEventPopUpFileSelected) { + APPL_DEBUG("Request opening the file : " << _msg.GetData()); + SendMultiCast(ednMsgOpenFile, _msg.GetData()); + } else if (_msg.GetMessage() == ednMsgGuiSaveAs) { + if (_msg.GetData() == "") { APPL_ERROR("Null data for Save As file ... "); } else { m_currentSavingAsIdBuffer = -1; - if (data == "current") { + if (_msg.GetData() == "current") { m_currentSavingAsIdBuffer = BufferManager::GetSelected(); } else { - sscanf(data.c_str(), "%d", &m_currentSavingAsIdBuffer); + sscanf(_msg.GetData().c_str(), "%d", &m_currentSavingAsIdBuffer); } if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) { @@ -310,15 +310,15 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev } } } - } else if (eventId == ednEventPopUpFileSaveAs) { + } else if (_msg.GetMessage() == ednEventPopUpFileSaveAs) { // get the filename : - etk::UString tmpData = data; + etk::UString tmpData = _msg.GetData(); APPL_DEBUG("Request Saving As file : " << tmpData); BufferManager::Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData); SendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer); - } else if( eventId == ednMsgBufferState - || eventId == ednMsgBufferId) { + } else if( _msg.GetMessage() == ednMsgBufferState + || _msg.GetMessage() == ednMsgBufferId) { // the buffer change we need to update the widget string BufferText* tmpBuffer = BufferManager::Get(BufferManager::GetSelected()); if (NULL != tmpBuffer) { @@ -341,7 +341,7 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev } return; // TODO : Set the Title .... - } else if (eventId == ednMsgProperties) { + } else if (_msg.GetMessage() == ednMsgProperties) { // Request the parameter GUI widget::Parameter* tmpWidget = new widget::Parameter(); if (NULL == tmpWidget) { @@ -359,7 +359,7 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev tmpSubWidget = new ParameterAboutGui(); tmpWidget->MenuAdd("About", "", tmpSubWidget); } - } else if (eventId == ednMsgGuiReloadShader) { + } else if (_msg.GetMessage() == ednMsgGuiReloadShader) { ewol::resource::ReLoadResources(); ewol::ForceRedrawAll(); } @@ -367,10 +367,10 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev return; } -void MainWindows::OnObjectRemove(ewol::EObject * removeObject) +void MainWindows::OnObjectRemove(ewol::EObject * _removeObject) { - ewol::Windows::OnObjectRemove(removeObject); - if (m_widgetLabelFileName == removeObject) { + ewol::Windows::OnObjectRemove(_removeObject); + if (m_widgetLabelFileName == _removeObject) { m_widgetLabelFileName = NULL; } } diff --git a/sources/appl/Gui/MainWindows.h b/sources/appl/Gui/MainWindows.h index 657cec4..b71b3ec 100644 --- a/sources/appl/Gui/MainWindows.h +++ b/sources/appl/Gui/MainWindows.h @@ -26,12 +26,10 @@ class MainWindows : public ewol::Windows // Constructeur MainWindows(void); ~MainWindows(void); - // Derived function - const char * const GetObjectType(void) { return "MainWindows"; }; - // Derived function - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); - // Derived function - virtual void OnObjectRemove(ewol::EObject * removeObject); + public: // Derived function + virtual const char * const GetObjectType(void) { return "MainWindows"; }; + virtual void OnReceiveMessage(const ewol::EMessage& _msg); + virtual void OnObjectRemove(ewol::EObject * _removeObject); }; #define EDN_CAST_MAIN_WINDOWS(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_MAIN_WINDOWS,MainWindows,curentPointer) diff --git a/sources/appl/Gui/Search.cpp b/sources/appl/Gui/Search.cpp index c541dec..698a71e 100644 --- a/sources/appl/Gui/Search.cpp +++ b/sources/appl/Gui/Search.cpp @@ -191,63 +191,63 @@ Search::~Search(void) } -void Search::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void Search::OnReceiveMessage(const ewol::EMessage& _msg) { - widget::Sizer::OnReceiveMessage(CallerObject, eventId, data); + widget::Sizer::OnReceiveMessage(_msg); //APPL_INFO("Search receive message : \"" << eventId << "\" data=\"" << data << "\""); - if ( eventId == l_eventSearchEntry) { - SearchData::SetSearch(data); - } else if ( eventId == l_eventSearchEntryEnter) { - SearchData::SetSearch(data); + if ( _msg.GetMessage() == l_eventSearchEntry) { + SearchData::SetSearch(_msg.GetData()); + } else if ( _msg.GetMessage() == l_eventSearchEntryEnter) { + SearchData::SetSearch(_msg.GetData()); if (true==m_forward) { SendMultiCast(ednMsgGuiFind, "Previous"); } else { SendMultiCast(ednMsgGuiFind, "Next"); } - } else if ( eventId == l_eventReplaceEntry) { - SearchData::SetReplace(data); - } else if ( eventId == l_eventReplaceEntryEnter) { - SearchData::SetReplace(data); + } else if ( _msg.GetMessage() == l_eventReplaceEntry) { + SearchData::SetReplace(_msg.GetData()); + } else if ( _msg.GetMessage() == l_eventReplaceEntryEnter) { + SearchData::SetReplace(_msg.GetData()); SendMultiCast(ednMsgGuiReplace, "Normal"); if (true==m_forward) { SendMultiCast(ednMsgGuiFind, "Previous"); } else { SendMultiCast(ednMsgGuiFind, "Next"); } - } else if ( eventId == l_eventSearchBt) { + } else if ( _msg.GetMessage() == l_eventSearchBt) { if (true==m_forward) { SendMultiCast(ednMsgGuiFind, "Previous"); } else { SendMultiCast(ednMsgGuiFind, "Next"); } - } else if ( eventId == l_eventReplaceBt) { + } else if ( _msg.GetMessage() == l_eventReplaceBt) { SendMultiCast(ednMsgGuiReplace, "Normal"); if (true==m_forward) { SendMultiCast(ednMsgGuiFind, "Previous"); } else { SendMultiCast(ednMsgGuiFind, "Next"); } - } else if ( eventId == l_eventCaseCb) { - if (data == "1") { + } else if ( _msg.GetMessage() == l_eventCaseCb) { + if (_msg.GetData() == "1") { SearchData::SetCase(false); } else { SearchData::SetCase(true); } - } else if ( eventId == l_eventWrapCb) { - if (data == "1") { + } else if ( _msg.GetMessage() == l_eventWrapCb) { + if (_msg.GetData() == "1") { SearchData::SetWrap(false); } else { SearchData::SetWrap(true); } - } else if ( eventId == l_eventForwardCb) { - if (data == "1") { + } else if ( _msg.GetMessage() == l_eventForwardCb) { + if (_msg.GetData() == "1") { m_forward = false; } else { m_forward = true; } - } else if ( eventId == l_eventHideBt) { + } else if ( _msg.GetMessage() == l_eventHideBt) { Hide(); - } else if ( eventId == ednMsgGuiSearch) { + } else if ( _msg.GetMessage() == ednMsgGuiSearch) { if (true == IsHide()) { Show(); if (m_searchEntry!= NULL) { @@ -266,13 +266,13 @@ void Search::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId } } -void Search::OnObjectRemove(ewol::EObject * removeObject) +void Search::OnObjectRemove(ewol::EObject * _removeObject) { - widget::Sizer::OnObjectRemove(removeObject); - if (removeObject == m_searchEntry) { + widget::Sizer::OnObjectRemove(_removeObject); + if (_removeObject == m_searchEntry) { m_searchEntry = NULL; } - if (removeObject == m_replaceEntry) { + if (_removeObject == m_replaceEntry) { m_replaceEntry = NULL; } } diff --git a/sources/appl/Gui/Search.h b/sources/appl/Gui/Search.h index 8ccf736..c912425 100644 --- a/sources/appl/Gui/Search.h +++ b/sources/appl/Gui/Search.h @@ -15,20 +15,18 @@ class Search : public widget::Sizer { - public: - // Constructeur - Search(void); - ~Search(void); - // herited function - const char * const GetObjectType(void) { return "ApplSearch"; }; - // herited function - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); - // herited function - virtual void OnObjectRemove(ewol::EObject * removeObject); private: bool m_forward; widget::Entry * m_searchEntry; widget::Entry * m_replaceEntry; + public: + // Constructeur + Search(void); + ~Search(void); + public: // derived function + virtual const char * const GetObjectType(void) { return "ApplSearch"; }; + virtual void OnReceiveMessage(const ewol::EMessage& _msg); + virtual void OnObjectRemove(ewol::EObject * _removeObject); }; #endif diff --git a/sources/appl/Gui/TagFileList.h b/sources/appl/Gui/TagFileList.h index 462c79a..8f7e524 100644 --- a/sources/appl/Gui/TagFileList.h +++ b/sources/appl/Gui/TagFileList.h @@ -40,7 +40,7 @@ namespace appl { uint32_t GetNuberOfRaw(void); bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg); bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y); - // herited function + // derived function const char * const GetObjectType(void) { return "TagFileList"; }; public: /** diff --git a/sources/appl/Gui/TagFileSelection.cpp b/sources/appl/Gui/TagFileSelection.cpp index 3f2ea9e..3da9565 100644 --- a/sources/appl/Gui/TagFileSelection.cpp +++ b/sources/appl/Gui/TagFileSelection.cpp @@ -129,25 +129,25 @@ appl::TagFileSelection::~TagFileSelection(void) } -void appl::TagFileSelection::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void appl::TagFileSelection::OnReceiveMessage(const ewol::EMessage& _msg) { - EWOL_INFO("ctags LIST ... : \"" << eventId << "\" ==> data=\"" << data << "\"" ); - if (eventId == applEventctagsSelection) { + EWOL_INFO("ctags LIST ... : \"" << _msg.GetMessage() << "\" ==> data=\"" << _msg.GetData() << "\"" ); + if (_msg.GetMessage() == applEventctagsSelection) { if (m_eventNamed!="") { GenerateEventId(applEventctagsSelection, m_eventNamed); //==> Auto remove ... AutoDestroy(); } - } else if (eventId == applEventCtagsListSelect) { - m_eventNamed = data; + } else if (_msg.GetMessage() == applEventCtagsListSelect) { + m_eventNamed = _msg.GetData(); - } else if (eventId == applEventCtagsListUnSelect) { + } else if (_msg.GetMessage() == applEventCtagsListUnSelect) { m_eventNamed = ""; - } else if (eventId == applEventCtagsListValidate) { - GenerateEventId(applEventctagsSelection, data); + } else if (_msg.GetMessage() == applEventCtagsListValidate) { + GenerateEventId(applEventctagsSelection, _msg.GetData()); //==> Auto remove ... AutoDestroy(); - } else if (eventId == applEventctagsCancel) { + } else if (_msg.GetMessage() == applEventctagsCancel) { GenerateEventId(applEventctagsCancel, ""); //==> Auto remove ... AutoDestroy(); @@ -168,12 +168,12 @@ void appl::TagFileSelection::AddCtagsNewItem(etk::UString file, int32_t line) } } -void appl::TagFileSelection::OnObjectRemove(ewol::EObject * removeObject) +void appl::TagFileSelection::OnObjectRemove(ewol::EObject * _removeObject) { // First step call parrent : - widget::PopUp::OnObjectRemove(m_listTag); + widget::PopUp::OnObjectRemove(_removeObject); // second step find if in all the elements ... - if(removeObject == m_listTag) { + if(_removeObject == m_listTag) { m_listTag = NULL; } } diff --git a/sources/appl/Gui/TagFileSelection.h b/sources/appl/Gui/TagFileSelection.h index dc72be0..75a761c 100644 --- a/sources/appl/Gui/TagFileSelection.h +++ b/sources/appl/Gui/TagFileSelection.h @@ -25,19 +25,16 @@ namespace appl { public: TagFileSelection(void); virtual ~TagFileSelection(void); - // herited function - const char * const GetObjectType(void) { return "EwolFileChooser"; }; - // herited function - void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); - // herited function - void OnObjectRemove(ewol::EObject * removeObject); /** * @brief Add a Ctags item on the curent list * @param[in] file Compleate file name * @param[in] jump line id */ void AddCtagsNewItem(etk::UString file, int32_t line); - + public: // herited function + const char * const GetObjectType(void) { return "EwolFileChooser"; }; + void OnReceiveMessage(const ewol::EMessage& _msg); + void OnObjectRemove(ewol::EObject * _removeObject); }; }; diff --git a/sources/appl/Highlight/HighlightManager.cpp b/sources/appl/Highlight/HighlightManager.cpp index ed9e498..6d6fa05 100644 --- a/sources/appl/Highlight/HighlightManager.cpp +++ b/sources/appl/Highlight/HighlightManager.cpp @@ -44,7 +44,7 @@ class localClassHighlightManager: public ewol::EObject } // herited function - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) + virtual void OnReceiveMessage(const ewol::EMessage& _msg) { /* switch (id) diff --git a/sources/appl/ctags/CTagsManager.cpp b/sources/appl/ctags/CTagsManager.cpp index e8b061d..9b24875 100644 --- a/sources/appl/ctags/CTagsManager.cpp +++ b/sources/appl/ctags/CTagsManager.cpp @@ -26,24 +26,11 @@ class CTagsManager: public ewol::EObject CTagsManager(void); ~CTagsManager(void); - /** - * @brief Get the current Object type of the EObject - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type description - * @return true if the object is compatible, otherwise false - */ const char * const GetObjectType(void) { return "CTagsManager"; }; - /** - * @brief Receive a message from an other EObject with a specific eventId and data - * @param[in] CallerObject Pointer on the EObject that information came from - * @param[in] eventId Message registered by this class - * @param[in] data Data registered by this class - * @return --- - */ - void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); + void OnReceiveMessage(const ewol::EMessage& _msg); int32_t m_currentSelectedID; void LoadTagFile(void); @@ -125,21 +112,21 @@ CTagsManager::~CTagsManager(void) const char * ednEventPopUpCtagsLoadFile = "edn-event-load-ctags"; -void CTagsManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void CTagsManager::OnReceiveMessage(const ewol::EMessage& _msg) { //EWOL_INFO("ctags manager event ... : \"" << eventId << "\" ==> data=\"" << data << "\"" ); - if (eventId == ednMsgBufferId) { + if (_msg.GetMessage() == ednMsgBufferId) { //m_currentSelectedID = dataID; - } else if( eventId == ednEventPopUpCtagsLoadFile - || eventId == ednMsgCtagsLoadFile) { + } else if( _msg.GetMessage() == ednEventPopUpCtagsLoadFile + || _msg.GetMessage() == ednMsgCtagsLoadFile) { // open the new one : - etk::FSNode tmpFilename = data; + etk::FSNode tmpFilename = _msg.GetData(); m_tagFilename = tmpFilename.GetNameFile(); m_tagFolderBase = tmpFilename.GetNameFolder(); APPL_DEBUG("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " "); LoadTagFile(); - } else if (eventId == ednMsgGuiCtags) { - if (data == "Load") { + } else if (_msg.GetMessage() == ednMsgGuiCtags) { + if (_msg.GetData() == "Load") { APPL_INFO("Request opening ctag file"); widget::FileChooser* tmpWidget = new widget::FileChooser(); if (NULL == tmpWidget) { @@ -150,12 +137,12 @@ void CTagsManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * e ewol::WindowsPopUpAdd(tmpWidget); tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpCtagsLoadFile); } - } else if (data == "ReLoad") { + } else if (_msg.GetData() == "ReLoad") { APPL_INFO("Request re-load ctag file"); LoadTagFile(); - } else if (data == "Jump") { + } else if (_msg.GetData() == "Jump") { JumpTo(); - } else if (data == "Back") { + } else if (_msg.GetData() == "Back") { if (m_historyList.Size() > 0) { int32_t id = m_historyList.Size()-1; SendMultiCast(ednMsgOpenFile, m_historyList[id]->GetName() ); @@ -168,13 +155,13 @@ void CTagsManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * e } else { } - } else if (eventId == applEventctagsSelection) { + } else if (_msg.GetMessage() == applEventctagsSelection) { // save the current file in the history RegisterHistory(); // parse the input data char tmp[4096]; int32_t lineID; - sscanf(data.c_str(), "%d:%s", &lineID, tmp); + sscanf(_msg.GetData().c_str(), "%d:%s", &lineID, tmp); // generate envents SendMultiCast(ednMsgOpenFile, tmp); SendMultiCast(ednMsgGuiGotoLine, lineID - 1); diff --git a/sources/appl/global.cpp b/sources/appl/global.cpp index f6cc6da..316ae0e 100644 --- a/sources/appl/global.cpp +++ b/sources/appl/global.cpp @@ -179,36 +179,36 @@ globals::ParameterGlobalsGui::~ParameterGlobalsGui(void) } -void globals::ParameterGlobalsGui::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data) +void globals::ParameterGlobalsGui::OnReceiveMessage(const ewol::EMessage& _msg) { - widget::Sizer::OnReceiveMessage(CallerObject, eventId, data); + widget::Sizer::OnReceiveMessage(_msg); - if (eventId == l_changeEndOfLine) { - if (data == "true") { + if (_msg.GetMessage() == l_changeEndOfLine) { + if (_msg.GetData() == "true") { SetDisplayEndOfLine(true); } else { SetDisplayEndOfLine(false); } - } else if (eventId == l_changeIndentation) { - if (data == "true") { + } else if (_msg.GetMessage() == l_changeIndentation) { + if (_msg.GetData() == "true") { SetAutoIndent(true); } else { SetAutoIndent(false); } - } else if (eventId == l_changeSpace) { - if (data == "true") { + } else if (_msg.GetMessage() == l_changeSpace) { + if (_msg.GetData() == "true") { SetDisplaySpaceChar(true); } else { SetDisplaySpaceChar(false); } - } else if (eventId == l_changeTabulation) { - if (data == "true") { + } else if (_msg.GetMessage() == l_changeTabulation) { + if (_msg.GetData() == "true") { SetDisplayTabChar(true); } else { SetDisplayTabChar(false); } - } else if (eventId == l_changeRounded) { - if (data == "true") { + } else if (_msg.GetMessage() == l_changeRounded) { + if (_msg.GetData() == "true") { etk::theme::SetName("GUI", "rounded");; } else { etk::theme::SetName("GUI", "default");; diff --git a/sources/appl/global.h b/sources/appl/global.h index 78dced2..a7e40fb 100644 --- a/sources/appl/global.h +++ b/sources/appl/global.h @@ -41,7 +41,7 @@ namespace globals ParameterGlobalsGui(void); ~ParameterGlobalsGui(void); // herited function - virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data); + virtual void OnReceiveMessage(const ewol::EMessage& _msg); }; }