[DEV] this plugin to the new ewol interface

This commit is contained in:
Edouard DUPIN 2014-08-27 22:58:21 +02:00
parent a371c09e22
commit 7e6f56a1cd
19 changed files with 82 additions and 161 deletions

View File

@ -236,9 +236,6 @@ void MainWindows::init() {
shortCutAdd("ctrl+q", "menu:close"); shortCutAdd("ctrl+q", "menu:close");
shortCutAdd("ctrl+shift+q", "menu:close-all"); shortCutAdd("ctrl+shift+q", "menu:close-all");
shortCutAdd("ctrl+z", "menu:undo");
shortCutAdd("ctrl+shift+z", "menu:redo");
shortCutAdd("ctrl+l", "menu:goto-line"); shortCutAdd("ctrl+l", "menu:goto-line");
shortCutAdd("ctrl+f", "menu:search"); shortCutAdd("ctrl+f", "menu:search");
@ -280,24 +277,6 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
appl::WorkerSaveFile::create("", true); appl::WorkerSaveFile::create("", true);
} else if (_value == "menu:property") { } else if (_value == "menu:property") {
displayProperty(); displayProperty();
} else if (_value == "menu:undo") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:redo") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:copy") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:cut") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:past") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:remove") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:select-all") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:select-none") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:goto-line") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:search") { } else if (_value == "menu:search") {
if (m_widgetSearch == nullptr) { if (m_widgetSearch == nullptr) {
return; return;

View File

@ -61,6 +61,7 @@ void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
appl::textPluginManager::connect(*this); appl::textPluginManager::connect(*this);
// last created has focus ... // last created has focus ...
setCurrentSelect(); setCurrentSelect();
signalShortcut.bind(shared_from_this(), &appl::TextViewer::onCallbackShortCut);
/* /*
registerMultiCast(ednMsgBufferId); registerMultiCast(ednMsgBufferId);
@ -74,11 +75,17 @@ void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
} }
} }
appl::TextViewer::~TextViewer() { appl::TextViewer::~TextViewer() {
appl::textPluginManager::disconnect(*this); appl::textPluginManager::disconnect(*this);
} }
void appl::TextViewer::onCallbackShortCut(const std::string& _value) {
if (appl::textPluginManager::onReceiveShortCut(*this, _value) == true) {
return;
}
}
void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) { void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
// reset scroll: // reset scroll:
if (m_buffer != nullptr) { if (m_buffer != nullptr) {
@ -672,40 +679,6 @@ void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboard
markToRedraw(); markToRedraw();
} }
void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::WidgetScrolled::onReceiveMessage(_msg);
APPL_VERBOSE("receive msg: " << _msg);
// First call plugin
/*
if (appl::textPluginManager::onReceiveMessageViewer(*this, _msg) == true) {
markToRedraw();
return;
}
// If not the last buffer selected, then no event parsing ...
if (isSelectedLast() == false) {
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
if (m_buffer == nullptr) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
select(it, m_buffer->getEndLine(it));
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
if (m_buffer == nullptr) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
moveCursor(it);
markToRedraw();
return;
}
*/
}
void appl::TextViewer::onCallbackIsModify() { void appl::TextViewer::onCallbackIsModify() {
markToRedraw(); markToRedraw();
} }

View File

@ -63,7 +63,6 @@ namespace appl {
public: // Derived function public: // Derived function
virtual bool calculateMinSize(); virtual bool calculateMinSize();
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);
virtual bool onEventEntry(const ewol::event::Entry& _event); virtual bool onEventEntry(const ewol::event::Entry& _event);
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID); virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
@ -391,6 +390,7 @@ namespace appl {
* @brief Register of the arrival of a Multicast message * @brief Register of the arrival of a Multicast message
* @param[in] _messageId Event Id waiting for... * @param[in] _messageId Event Id waiting for...
*/ */
// TODO : Remove
void ext_registerMultiCast(const char* const _messageId) { void ext_registerMultiCast(const char* const _messageId) {
//registerMultiCast(_messageId); //registerMultiCast(_messageId);
} }
@ -400,14 +400,13 @@ namespace appl {
* @param[in] _generateEventId Event generic of the element * @param[in] _generateEventId Event generic of the element
* @param[in] _data Associate data wit the event * @param[in] _data Associate data wit the event
*/ */
virtual void ext_shortCutAdd(const char * _descriptiveString, virtual void ext_shortCutAdd(const std::string& _descriptiveString,
const char * _generateEventId, const std::string& _generateEventName) {
std::string _data="", shortCutAdd(_descriptiveString, _generateEventName);
bool _broadcast=false) {
//shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
} }
private: // callback fundtions private: // callback fundtions
void onCallbackIsModify(); void onCallbackIsModify();
void onCallbackShortCut(const std::string& _value);
void onCallbackSelectChange(); void onCallbackSelectChange();
void onCallbackselectNewFile(const std::string& _value); void onCallbackselectNewFile(const std::string& _value);
}; };

View File

@ -21,7 +21,7 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_activateOnWrite(false), m_activateOnWrite(false),
m_activateOnReplace(false), m_activateOnReplace(false),
m_activateOnRemove(false), m_activateOnRemove(false),
m_activateOnReceiveMessage(false), m_activateOnReceiveShortCut(false),
m_activateOnCursorMove(false) { m_activateOnCursorMove(false) {
addObjectType("appl::TextViewerPlugin"); addObjectType("appl::TextViewerPlugin");
} }

View File

@ -174,23 +174,22 @@ namespace appl {
return false; return false;
}; };
protected: protected:
bool m_activateOnReceiveMessage; //!< onReceiveMessage is availlable for this plugin. bool m_activateOnReceiveShortCut; //!< onReceiveShortCut is availlable for this plugin.
public: public:
/** /**
* @brief Get the availlability of a callback * @brief Get the availlability of a callback
* @return true if availlable * @return true if availlable
*/ */
bool isAvaillableOnReceiveMessage() { bool isAvaillableOnReceiveShortCut() {
return m_activateOnReceiveMessage; return m_activateOnReceiveShortCut;
} }
/** /**
* @brief Called when a message arrive. * @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
* @param[in] _msg Generic message. * @param[in] _shortCutName Generic message requested.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore
*/ */
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName) {
const ewol::object::Message& _msg) {
return false; return false;
} }
protected: protected:

View File

@ -16,7 +16,7 @@
appl::TextPluginCopy::TextPluginCopy() { appl::TextPluginCopy::TextPluginCopy() {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginCopy"); addObjectType("appl::TextPluginCopy");
} }
@ -26,28 +26,22 @@ void appl::TextPluginCopy::init() {
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event : // add event :
/* _textDrawer.ext_shortCutAdd("ctrl+x", "appl::TextPluginCopy::cut");
_textDrawer.ext_registerMultiCast(ednMsgGuiCopy); _textDrawer.ext_shortCutAdd("ctrl+c", "appl::TextPluginCopy::copy");
_textDrawer.ext_registerMultiCast(ednMsgGuiPaste); _textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
_textDrawer.ext_registerMultiCast(ednMsgGuiCut);
_textDrawer.ext_shortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
_textDrawer.ext_shortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
_textDrawer.ext_shortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
*/
} }
void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool appl::TextPluginCopy::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
/* if ( _shortCutName == "appl::TextPluginCopy::copy"
if ( _msg.getMessage() == ednMsgGuiCopy || _shortCutName == "appl::TextPluginCopy::cut") {
|| _msg.getMessage() == ednMsgGuiCut) {
if (_textDrawer.hasBuffer() == true) { if (_textDrawer.hasBuffer() == true) {
std::string value; std::string value;
_textDrawer.copy(value); _textDrawer.copy(value);
@ -55,16 +49,15 @@ bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardStd, value); ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardStd, value);
} }
} }
if (_msg.getMessage() == ednMsgGuiCut) { if (_shortCutName == "appl::TextPluginCopy::cut") {
_textDrawer.remove(); _textDrawer.remove();
} }
return true; return true;
} else if (_msg.getMessage() == ednMsgGuiPaste) { } else if (_shortCutName == "appl::TextPluginCopy::Paste") {
if (_textDrawer.hasBuffer() == true) { if (_textDrawer.hasBuffer() == true) {
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd); ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd);
} }
return true; return true;
} }
*/
return false; return false;
} }

View File

@ -28,7 +28,7 @@ namespace appl {
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
}; };
}; };

View File

@ -22,7 +22,7 @@ appl::TextPluginCtags::TextPluginCtags() :
m_tagFolderBase(""), m_tagFolderBase(""),
m_tagFilename(""), m_tagFilename(""),
m_ctagFile(nullptr) { m_ctagFile(nullptr) {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::create(); m_bufferManager = appl::BufferManager::create();
addObjectType("appl::TextPluginCtags"); addObjectType("appl::TextPluginCtags");
@ -37,20 +37,11 @@ appl::TextPluginCtags::~TextPluginCtags() {
} }
const char* eventJumpDestination = "event-plugin-ctags-jump-destination";
const char* eventJumpBack = "event-plugin-ctags-jump-back";
const char* eventOpenCtagsFile = "event-plugin-ctags-open";
const char* eventOpenCtagsOpenFileReturn = "event-plugin-ctags-open-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 event : // add event :
_textDrawer.ext_registerMultiCast(eventJumpDestination); _textDrawer.ext_shortCutAdd("ctrl+d", "appl::TextPluginCtags::JumpDestination");
_textDrawer.ext_registerMultiCast(eventJumpBack); _textDrawer.ext_shortCutAdd("ctrl+shift+d", "appl::TextPluginCtags::JumpBack");
_textDrawer.ext_registerMultiCast(eventOpenCtagsFile); _textDrawer.ext_shortCutAdd("ctrl+alt+d", "appl::TextPluginCtags::OpenCtagsFile");
_textDrawer.ext_shortCutAdd("ctrl+d", eventJumpDestination);
_textDrawer.ext_shortCutAdd("ctrl+shift+d", eventJumpBack);
_textDrawer.ext_shortCutAdd("ctrl+alt+d", eventOpenCtagsFile);
} }
void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) {
@ -169,12 +160,12 @@ void appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn(const std::string& _
jumpFile(tmp, lineID - 1); jumpFile(tmp, lineID - 1);
} }
bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == eventOpenCtagsFile) { if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
APPL_INFO("Request opening ctag file"); APPL_INFO("Request opening ctag file");
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create(); std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (nullptr == tmpWidget) { if (nullptr == tmpWidget) {
@ -192,7 +183,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn); tmpWidget->signalValidate.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
return true; return true;
} else if (_msg.getMessage() == eventJumpDestination) { } else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }
@ -210,7 +201,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
} }
jumpTo(textToSearch); jumpTo(textToSearch);
return true; return true;
} else if (_msg.getMessage() == eventJumpBack) { } else if (_shortCutName == "appl::TextPluginCtags::JumpBack") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }

View File

@ -43,8 +43,8 @@ namespace appl {
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg); const std::string& _shortCutName);
// callback function: // callback function:
void onCallbackOpenCtagsOpenFileReturn(const std::string& _value); void onCallbackOpenCtagsOpenFileReturn(const std::string& _value);
void onCallbackOpenCtagsSelectReturn(const std::string& _value); void onCallbackOpenCtagsSelectReturn(const std::string& _value);

View File

@ -55,13 +55,13 @@ namespace appl {
return data; return data;
} }
protected: // Wrap all element with their internal data: (do not use theses function) protected: // Wrap all element with their internal data: (do not use theses function)
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
TYPE* data = getDataRef(_textDrawer); TYPE* data = getDataRef(_textDrawer);
if (data == nullptr) { if (data == nullptr) {
return false; return false;
} }
return onDataReceiveMessageViewer(_textDrawer, _msg, *data); return onDataReceiveShortCut(_textDrawer, _shortCutName, *data);
} }
bool onWrite(appl::TextViewer& _textDrawer, bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
@ -93,9 +93,9 @@ namespace appl {
} }
public: public:
virtual bool onDataReceiveMessageViewer(appl::TextViewer& _textDrawer, virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const std::string& _shortCutName,
TYPE& _data) { TYPE& _data) {
return false; return false;
} }
virtual bool onDataWrite(appl::TextViewer& _textDrawer, virtual bool onDataWrite(appl::TextViewer& _textDrawer,

View File

@ -16,7 +16,7 @@
#define __class__ "TextPluginHistory" #define __class__ "TextPluginHistory"
appl::TextPluginHistory::TextPluginHistory() { appl::TextPluginHistory::TextPluginHistory() {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
m_activateOnWrite = true; m_activateOnWrite = true;
m_activateOnReplace = true; m_activateOnReplace = true;
m_activateOnRemove = true; m_activateOnRemove = true;
@ -30,26 +30,21 @@ void appl::TextPluginHistory::init() {
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event : // add event :
/* _textDrawer.ext_shortCutAdd("ctrl+z", "appl::TextPluginHistory::Undo");
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo); _textDrawer.ext_shortCutAdd("ctrl+shift+z", "appl::TextPluginHistory::Redo");
_textDrawer.ext_registerMultiCast(ednMsgGuiUndo);
_textDrawer.ext_shortCutAdd("ctrl+z", ednMsgGuiUndo);
_textDrawer.ext_shortCutAdd("ctrl+shift+z", ednMsgGuiRedo);
*/
} }
void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginHistory::onDataReceiveMessageViewer(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const std::string& _shortCutName,
appl::PluginHistoryData& _data) { appl::PluginHistoryData& _data) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
/* if (_shortCutName == "appl::TextPluginHistory::Redo") {
if (_msg.getMessage() == ednMsgGuiRedo) {
if (_data.m_redo.size() == 0) { if (_data.m_redo.size() == 0) {
return true; return true;
} }
@ -65,7 +60,7 @@ bool appl::TextPluginHistory::onDataReceiveMessageViewer(appl::TextViewer& _text
_textDrawer.position(tmpElement->m_endPosRemoved) ); _textDrawer.position(tmpElement->m_endPosRemoved) );
return true; return true;
} else if (_msg.getMessage() == ednMsgGuiUndo) { } else if (_shortCutName == "appl::TextPluginHistory::Undo") {
if (_data.m_undo.size() == 0) { if (_data.m_undo.size() == 0) {
return true; return true;
} }
@ -82,7 +77,6 @@ bool appl::TextPluginHistory::onDataReceiveMessageViewer(appl::TextViewer& _text
return true; return true;
} }
*/
return false; return false;
} }

View File

@ -46,9 +46,9 @@ namespace appl {
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onDataReceiveMessageViewer(appl::TextViewer& _textDrawer, virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const std::string& _shortCutName,
appl::PluginHistoryData& _data); appl::PluginHistoryData& _data);
virtual bool onDataWrite(appl::TextViewer& _textDrawer, virtual bool onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,

View File

@ -43,7 +43,7 @@ static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnRemove() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list; static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListonReceiveMessageViewer() { static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListonReceiveShortCutViewer() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list; static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list; return s_list;
} }
@ -63,7 +63,7 @@ void appl::textPluginManager::unInit() {
getListOnWrite().clear(); getListOnWrite().clear();
getListOnReplace().clear(); getListOnReplace().clear();
getListOnRemove().clear(); getListOnRemove().clear();
getListonReceiveMessageViewer().clear(); getListonReceiveShortCutViewer().clear();
getListOnCursorMove().clear(); getListOnCursorMove().clear();
getList().clear(); getList().clear();
} }
@ -98,8 +98,8 @@ void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPl
if (_plugin->isAvaillableOnRemove() == true) { if (_plugin->isAvaillableOnRemove() == true) {
getListOnRemove().push_back(_plugin); getListOnRemove().push_back(_plugin);
} }
if (_plugin->isAvaillableOnReceiveMessage() == true) { if (_plugin->isAvaillableOnReceiveShortCut() == true) {
getListonReceiveMessageViewer().push_back(_plugin); getListonReceiveShortCutViewer().push_back(_plugin);
} }
if (_plugin->isAvaillableOnCursorMove() == true) { if (_plugin->isAvaillableOnCursorMove() == true) {
getListOnCursorMove().push_back(_plugin); getListOnCursorMove().push_back(_plugin);
@ -193,13 +193,13 @@ bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
return false; return false;
} }
bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
for (auto &it : getListonReceiveMessageViewer()) { for (auto &it : getListonReceiveShortCutViewer()) {
if (it == nullptr) { if (it == nullptr) {
continue; continue;
} }
if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) { if (it->onReceiveShortCut(_textDrawer, _shortCutName) == true ) {
return true; return true;
} }
} }

View File

@ -95,11 +95,11 @@ namespace appl {
/** /**
* @brief Called when a message arrive. * @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
* @param[in] _msg Generic message. * @param[in] _shortCutName shortcut properties.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore
*/ */
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg); const std::string& _shortCutName);
/** /**
* @brief Called when Cursor move of position. * @brief Called when Cursor move of position.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.

View File

@ -16,7 +16,7 @@
appl::TextPluginRmLine::TextPluginRmLine() { appl::TextPluginRmLine::TextPluginRmLine() {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginRmLine"); addObjectType("appl::TextPluginRmLine");
} }
@ -26,23 +26,19 @@ void appl::TextPluginRmLine::init() {
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event : // add event :
/* _textDrawer.ext_shortCutAdd("ctrl+w", "appl::TextPluginRmLine::Rm");
_textDrawer.ext_registerMultiCast(ednMsgGuiRm);
_textDrawer.ext_shortCutAdd("ctrl+w", ednMsgGuiRm);
*/
} }
void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool appl::TextPluginRmLine::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
/* if (_shortCutName == "appl::TextPluginRmLine::Rm") {
if (_msg.getMessage() == ednMsgGuiRm) {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }
@ -57,6 +53,5 @@ bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawe
} }
return true; return true;
} }
*/
return false; return false;
} }

View File

@ -28,7 +28,7 @@ namespace appl {
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
}; };
}; };

View File

@ -16,7 +16,7 @@
appl::TextPluginSelectAll::TextPluginSelectAll() { appl::TextPluginSelectAll::TextPluginSelectAll() {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginSelectAll"); addObjectType("appl::TextPluginSelectAll");
} }
@ -24,24 +24,21 @@ void appl::TextPluginSelectAll::init() {
appl::TextViewerPlugin::init(); appl::TextViewerPlugin::init();
} }
static const char* eventSelectAll = "plugin-select-all";
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event : // add event :
_textDrawer.ext_registerMultiCast(eventSelectAll); _textDrawer.ext_shortCutAdd("ctrl+a", "appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutAdd("ctrl+a", eventSelectAll);
} }
void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... // TODO : unknow function ...
} }
bool appl::TextPluginSelectAll::onReceiveMessageViewer(appl::TextViewer& _textDrawer, bool appl::TextPluginSelectAll::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == eventSelectAll) { if (_shortCutName == "appl::TextPluginSelectAll::All") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }

View File

@ -28,7 +28,7 @@ namespace appl {
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
}; };
}; };

1
sources/tagCode Normal file
View File

@ -0,0 +1 @@
5