[DEV] this plugin to the new ewol interface
This commit is contained in:
parent
a371c09e22
commit
7e6f56a1cd
@ -236,9 +236,6 @@ void MainWindows::init() {
|
||||
shortCutAdd("ctrl+q", "menu:close");
|
||||
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+f", "menu:search");
|
||||
@ -280,24 +277,6 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
|
||||
appl::WorkerSaveFile::create("", true);
|
||||
} else if (_value == "menu:property") {
|
||||
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") {
|
||||
if (m_widgetSearch == nullptr) {
|
||||
return;
|
||||
|
@ -61,6 +61,7 @@ void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
|
||||
appl::textPluginManager::connect(*this);
|
||||
// last created has focus ...
|
||||
setCurrentSelect();
|
||||
signalShortcut.bind(shared_from_this(), &appl::TextViewer::onCallbackShortCut);
|
||||
|
||||
/*
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
@ -74,11 +75,17 @@ void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
appl::TextViewer::~TextViewer() {
|
||||
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) {
|
||||
// reset scroll:
|
||||
if (m_buffer != nullptr) {
|
||||
@ -672,40 +679,6 @@ void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboard
|
||||
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() {
|
||||
markToRedraw();
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ namespace appl {
|
||||
public: // Derived function
|
||||
virtual bool calculateMinSize();
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
||||
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
|
||||
@ -391,6 +390,7 @@ namespace appl {
|
||||
* @brief Register of the arrival of a Multicast message
|
||||
* @param[in] _messageId Event Id waiting for...
|
||||
*/
|
||||
// TODO : Remove
|
||||
void ext_registerMultiCast(const char* const _messageId) {
|
||||
//registerMultiCast(_messageId);
|
||||
}
|
||||
@ -400,14 +400,13 @@ namespace appl {
|
||||
* @param[in] _generateEventId Event generic of the element
|
||||
* @param[in] _data Associate data wit the event
|
||||
*/
|
||||
virtual void ext_shortCutAdd(const char * _descriptiveString,
|
||||
const char * _generateEventId,
|
||||
std::string _data="",
|
||||
bool _broadcast=false) {
|
||||
//shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
|
||||
virtual void ext_shortCutAdd(const std::string& _descriptiveString,
|
||||
const std::string& _generateEventName) {
|
||||
shortCutAdd(_descriptiveString, _generateEventName);
|
||||
}
|
||||
private: // callback fundtions
|
||||
void onCallbackIsModify();
|
||||
void onCallbackShortCut(const std::string& _value);
|
||||
void onCallbackSelectChange();
|
||||
void onCallbackselectNewFile(const std::string& _value);
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ appl::TextViewerPlugin::TextViewerPlugin() :
|
||||
m_activateOnWrite(false),
|
||||
m_activateOnReplace(false),
|
||||
m_activateOnRemove(false),
|
||||
m_activateOnReceiveMessage(false),
|
||||
m_activateOnReceiveShortCut(false),
|
||||
m_activateOnCursorMove(false) {
|
||||
addObjectType("appl::TextViewerPlugin");
|
||||
}
|
||||
|
@ -174,23 +174,22 @@ namespace appl {
|
||||
return false;
|
||||
};
|
||||
protected:
|
||||
bool m_activateOnReceiveMessage; //!< onReceiveMessage is availlable for this plugin.
|
||||
bool m_activateOnReceiveShortCut; //!< onReceiveShortCut is availlable for this plugin.
|
||||
public:
|
||||
/**
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnReceiveMessage() {
|
||||
return m_activateOnReceiveMessage;
|
||||
bool isAvaillableOnReceiveShortCut() {
|
||||
return m_activateOnReceiveShortCut;
|
||||
}
|
||||
/**
|
||||
* @brief Called when a message arrive.
|
||||
* @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
|
||||
*/
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName) {
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
appl::TextPluginCopy::TextPluginCopy() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
m_activateOnReceiveShortCut = true;
|
||||
addObjectType("appl::TextPluginCopy");
|
||||
}
|
||||
|
||||
@ -26,28 +26,22 @@ void appl::TextPluginCopy::init() {
|
||||
|
||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
/*
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiCopy);
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiPaste);
|
||||
_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");
|
||||
*/
|
||||
_textDrawer.ext_shortCutAdd("ctrl+x", "appl::TextPluginCopy::cut");
|
||||
_textDrawer.ext_shortCutAdd("ctrl+c", "appl::TextPluginCopy::copy");
|
||||
_textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
|
||||
}
|
||||
|
||||
void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginCopy::onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if ( _msg.getMessage() == ednMsgGuiCopy
|
||||
|| _msg.getMessage() == ednMsgGuiCut) {
|
||||
if ( _shortCutName == "appl::TextPluginCopy::copy"
|
||||
|| _shortCutName == "appl::TextPluginCopy::cut") {
|
||||
if (_textDrawer.hasBuffer() == true) {
|
||||
std::string value;
|
||||
_textDrawer.copy(value);
|
||||
@ -55,16 +49,15 @@ bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardStd, value);
|
||||
}
|
||||
}
|
||||
if (_msg.getMessage() == ednMsgGuiCut) {
|
||||
if (_shortCutName == "appl::TextPluginCopy::cut") {
|
||||
_textDrawer.remove();
|
||||
}
|
||||
return true;
|
||||
} else if (_msg.getMessage() == ednMsgGuiPaste) {
|
||||
} else if (_shortCutName == "appl::TextPluginCopy::Paste") {
|
||||
if (_textDrawer.hasBuffer() == true) {
|
||||
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace appl {
|
||||
public:
|
||||
virtual void onPluginEnable(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);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ appl::TextPluginCtags::TextPluginCtags() :
|
||||
m_tagFolderBase(""),
|
||||
m_tagFilename(""),
|
||||
m_ctagFile(nullptr) {
|
||||
m_activateOnReceiveMessage = true;
|
||||
m_activateOnReceiveShortCut = true;
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
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) {
|
||||
// add event :
|
||||
_textDrawer.ext_registerMultiCast(eventJumpDestination);
|
||||
_textDrawer.ext_registerMultiCast(eventJumpBack);
|
||||
_textDrawer.ext_registerMultiCast(eventOpenCtagsFile);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+d", eventJumpDestination);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+shift+d", eventJumpBack);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+alt+d", eventOpenCtagsFile);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+d", "appl::TextPluginCtags::JumpDestination");
|
||||
_textDrawer.ext_shortCutAdd("ctrl+shift+d", "appl::TextPluginCtags::JumpBack");
|
||||
_textDrawer.ext_shortCutAdd("ctrl+alt+d", "appl::TextPluginCtags::OpenCtagsFile");
|
||||
}
|
||||
|
||||
void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
@ -169,12 +160,12 @@ void appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn(const std::string& _
|
||||
jumpFile(tmp, lineID - 1);
|
||||
}
|
||||
|
||||
bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
if (_msg.getMessage() == eventOpenCtagsFile) {
|
||||
if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
|
||||
APPL_INFO("Request opening ctag file");
|
||||
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
|
||||
if (nullptr == tmpWidget) {
|
||||
@ -192,7 +183,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
|
||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->signalValidate.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
|
||||
return true;
|
||||
} else if (_msg.getMessage() == eventJumpDestination) {
|
||||
} else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
|
||||
if (_textDrawer.hasBuffer() == false) {
|
||||
return false;
|
||||
}
|
||||
@ -210,7 +201,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
|
||||
}
|
||||
jumpTo(textToSearch);
|
||||
return true;
|
||||
} else if (_msg.getMessage() == eventJumpBack) {
|
||||
} else if (_shortCutName == "appl::TextPluginCtags::JumpBack") {
|
||||
if (_textDrawer.hasBuffer() == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ namespace appl {
|
||||
public:
|
||||
virtual void onPluginEnable(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);
|
||||
// callback function:
|
||||
void onCallbackOpenCtagsOpenFileReturn(const std::string& _value);
|
||||
void onCallbackOpenCtagsSelectReturn(const std::string& _value);
|
||||
|
@ -55,13 +55,13 @@ namespace appl {
|
||||
return data;
|
||||
}
|
||||
protected: // Wrap all element with their internal data: (do not use theses function)
|
||||
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName) {
|
||||
TYPE* data = getDataRef(_textDrawer);
|
||||
if (data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return onDataReceiveMessageViewer(_textDrawer, _msg, *data);
|
||||
return onDataReceiveShortCut(_textDrawer, _shortCutName, *data);
|
||||
}
|
||||
bool onWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
@ -93,9 +93,9 @@ namespace appl {
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool onDataReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
TYPE& _data) {
|
||||
virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName,
|
||||
TYPE& _data) {
|
||||
return false;
|
||||
}
|
||||
virtual bool onDataWrite(appl::TextViewer& _textDrawer,
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define __class__ "TextPluginHistory"
|
||||
|
||||
appl::TextPluginHistory::TextPluginHistory() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
m_activateOnReceiveShortCut = true;
|
||||
m_activateOnWrite = true;
|
||||
m_activateOnReplace = true;
|
||||
m_activateOnRemove = true;
|
||||
@ -30,26 +30,21 @@ void appl::TextPluginHistory::init() {
|
||||
|
||||
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
/*
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo);
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiUndo);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+z", ednMsgGuiUndo);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+shift+z", ednMsgGuiRedo);
|
||||
*/
|
||||
_textDrawer.ext_shortCutAdd("ctrl+z", "appl::TextPluginHistory::Undo");
|
||||
_textDrawer.ext_shortCutAdd("ctrl+shift+z", "appl::TextPluginHistory::Redo");
|
||||
}
|
||||
|
||||
void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginHistory::onDataReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
appl::PluginHistoryData& _data) {
|
||||
bool appl::TextPluginHistory::onDataReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName,
|
||||
appl::PluginHistoryData& _data) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if (_msg.getMessage() == ednMsgGuiRedo) {
|
||||
if (_shortCutName == "appl::TextPluginHistory::Redo") {
|
||||
if (_data.m_redo.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
@ -65,7 +60,7 @@ bool appl::TextPluginHistory::onDataReceiveMessageViewer(appl::TextViewer& _text
|
||||
_textDrawer.position(tmpElement->m_endPosRemoved) );
|
||||
|
||||
return true;
|
||||
} else if (_msg.getMessage() == ednMsgGuiUndo) {
|
||||
} else if (_shortCutName == "appl::TextPluginHistory::Undo") {
|
||||
if (_data.m_undo.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
@ -82,7 +77,6 @@ bool appl::TextPluginHistory::onDataReceiveMessageViewer(appl::TextViewer& _text
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ namespace appl {
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||
virtual bool onDataReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
appl::PluginHistoryData& _data);
|
||||
virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName,
|
||||
appl::PluginHistoryData& _data);
|
||||
virtual bool onDataWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _strData,
|
||||
|
@ -43,7 +43,7 @@ static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnRemove() {
|
||||
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> 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;
|
||||
return s_list;
|
||||
}
|
||||
@ -63,7 +63,7 @@ void appl::textPluginManager::unInit() {
|
||||
getListOnWrite().clear();
|
||||
getListOnReplace().clear();
|
||||
getListOnRemove().clear();
|
||||
getListonReceiveMessageViewer().clear();
|
||||
getListonReceiveShortCutViewer().clear();
|
||||
getListOnCursorMove().clear();
|
||||
getList().clear();
|
||||
}
|
||||
@ -98,8 +98,8 @@ void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPl
|
||||
if (_plugin->isAvaillableOnRemove() == true) {
|
||||
getListOnRemove().push_back(_plugin);
|
||||
}
|
||||
if (_plugin->isAvaillableOnReceiveMessage() == true) {
|
||||
getListonReceiveMessageViewer().push_back(_plugin);
|
||||
if (_plugin->isAvaillableOnReceiveShortCut() == true) {
|
||||
getListonReceiveShortCutViewer().push_back(_plugin);
|
||||
}
|
||||
if (_plugin->isAvaillableOnCursorMove() == true) {
|
||||
getListOnCursorMove().push_back(_plugin);
|
||||
@ -193,13 +193,13 @@ bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
for (auto &it : getListonReceiveMessageViewer()) {
|
||||
bool appl::textPluginManager::onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName) {
|
||||
for (auto &it : getListonReceiveShortCutViewer()) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) {
|
||||
if (it->onReceiveShortCut(_textDrawer, _shortCutName) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -95,11 +95,11 @@ namespace appl {
|
||||
/**
|
||||
* @brief Called when a message arrive.
|
||||
* @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
|
||||
*/
|
||||
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg);
|
||||
bool onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName);
|
||||
/**
|
||||
* @brief Called when Cursor move of position.
|
||||
* @param[in] _widget Reference on the widget caller.
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
appl::TextPluginRmLine::TextPluginRmLine() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
m_activateOnReceiveShortCut = true;
|
||||
addObjectType("appl::TextPluginRmLine");
|
||||
}
|
||||
|
||||
@ -26,23 +26,19 @@ void appl::TextPluginRmLine::init() {
|
||||
|
||||
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
/*
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiRm);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+w", ednMsgGuiRm);
|
||||
*/
|
||||
_textDrawer.ext_shortCutAdd("ctrl+w", "appl::TextPluginRmLine::Rm");
|
||||
}
|
||||
|
||||
void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginRmLine::onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if (_msg.getMessage() == ednMsgGuiRm) {
|
||||
if (_shortCutName == "appl::TextPluginRmLine::Rm") {
|
||||
if (_textDrawer.hasBuffer() == false) {
|
||||
return false;
|
||||
}
|
||||
@ -57,6 +53,5 @@ bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawe
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace appl {
|
||||
public:
|
||||
virtual void onPluginEnable(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);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
appl::TextPluginSelectAll::TextPluginSelectAll() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
m_activateOnReceiveShortCut = true;
|
||||
addObjectType("appl::TextPluginSelectAll");
|
||||
}
|
||||
|
||||
@ -24,24 +24,21 @@ void appl::TextPluginSelectAll::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
static const char* eventSelectAll = "plugin-select-all";
|
||||
|
||||
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
_textDrawer.ext_registerMultiCast(eventSelectAll);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+a", eventSelectAll);
|
||||
_textDrawer.ext_shortCutAdd("ctrl+a", "appl::TextPluginSelectAll::All");
|
||||
}
|
||||
|
||||
void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginSelectAll::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginSelectAll::onReceiveShortCut(appl::TextViewer& _textDrawer,
|
||||
const std::string& _shortCutName) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
if (_msg.getMessage() == eventSelectAll) {
|
||||
if (_shortCutName == "appl::TextPluginSelectAll::All") {
|
||||
if (_textDrawer.hasBuffer() == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace appl {
|
||||
public:
|
||||
virtual void onPluginEnable(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
1
sources/tagCode
Normal file
@ -0,0 +1 @@
|
||||
5
|
Loading…
x
Reference in New Issue
Block a user