[DEV] add ctrl+w in plgin list (with no frend dependency
This commit is contained in:
parent
16bf6e7648
commit
157bd7bcd2
@ -246,6 +246,67 @@ namespace appl {
|
|||||||
}
|
}
|
||||||
return m_buffer->end();
|
return m_buffer->end();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief Get an Iterator on the start selection.
|
||||||
|
* @return The Iterator
|
||||||
|
*/
|
||||||
|
appl::Buffer::Iterator selectStart(void) {
|
||||||
|
if (m_buffer==NULL) {
|
||||||
|
return appl::Buffer::Iterator();
|
||||||
|
}
|
||||||
|
return m_buffer->selectStart();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Get an Iterator on the stop selection.
|
||||||
|
* @return The Iterator
|
||||||
|
*/
|
||||||
|
appl::Buffer::Iterator selectStop(void) {
|
||||||
|
if (m_buffer==NULL) {
|
||||||
|
return appl::Buffer::Iterator();
|
||||||
|
}
|
||||||
|
return m_buffer->selectStop();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief get the start of a line with the position in the buffer.
|
||||||
|
* @param[in] _pos position in the buffer.
|
||||||
|
* @return The position in the buffer of the start of the line.
|
||||||
|
*/
|
||||||
|
appl::Buffer::Iterator getStartLine(const appl::Buffer::Iterator& _pos) {
|
||||||
|
if (m_buffer==NULL) {
|
||||||
|
return appl::Buffer::Iterator();
|
||||||
|
}
|
||||||
|
return m_buffer->getStartLine(_pos);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief get the end of a line with the position in the buffer.
|
||||||
|
* @param[in] _pos position in the buffer.
|
||||||
|
* @return The position in the buffer of the end of the line.
|
||||||
|
*/
|
||||||
|
appl::Buffer::Iterator getEndLine(const appl::Buffer::Iterator& _pos) {
|
||||||
|
if (m_buffer==NULL) {
|
||||||
|
return appl::Buffer::Iterator();
|
||||||
|
}
|
||||||
|
return m_buffer->getEndLine(_pos);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Register of the arrival of a Multicast message
|
||||||
|
* @param[in] _messageId Event Id waiting for...
|
||||||
|
*/
|
||||||
|
void ext_registerMultiCast(const char* const _messageId) {
|
||||||
|
registerMultiCast(_messageId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief add a specific shortcut with his description
|
||||||
|
* @param[in] _descriptiveString Description string of the shortcut
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <appl/TextPluginMultiLineTab.h>
|
#include <appl/TextPluginMultiLineTab.h>
|
||||||
#include <appl/TextPluginAutoIndent.h>
|
#include <appl/TextPluginAutoIndent.h>
|
||||||
#include <appl/TextPluginHistory.h>
|
#include <appl/TextPluginHistory.h>
|
||||||
|
#include <appl/TextPluginRmLine.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "textPluginManager"
|
#define __class__ "textPluginManager"
|
||||||
@ -78,6 +79,7 @@ void appl::textPluginManager::addDefaultPlugin(void) {
|
|||||||
appl::textPluginManager::addPlugin(new appl::TextPluginMultiLineTab());
|
appl::textPluginManager::addPlugin(new appl::TextPluginMultiLineTab());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginAutoIndent());
|
appl::textPluginManager::addPlugin(new appl::TextPluginAutoIndent());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginHistory());
|
appl::textPluginManager::addPlugin(new appl::TextPluginHistory());
|
||||||
|
appl::textPluginManager::addPlugin(new appl::TextPluginRmLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
||||||
|
53
sources/appl/TextPluginRmLine.cpp
Normal file
53
sources/appl/TextPluginRmLine.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license GPL v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <appl/TextPluginRmLine.h>
|
||||||
|
#include <ewol/clipBoard.h>
|
||||||
|
#include <appl/Gui/TextViewer.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "TextPluginRmLine"
|
||||||
|
|
||||||
|
|
||||||
|
appl::TextPluginRmLine::TextPluginRmLine(void) {
|
||||||
|
m_activateOnReceiveMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||||
|
// add event :
|
||||||
|
_textDrawer.ext_registerMultiCast(ednMsgGuiRm);
|
||||||
|
_textDrawer.ext_shortCutAdd("ctrl+w", ednMsgGuiRm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||||
|
// TODO : unknow function ...
|
||||||
|
}
|
||||||
|
|
||||||
|
bool appl::TextPluginRmLine::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||||
|
const ewol::EMessage& _msg) {
|
||||||
|
if (isEnable() == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_msg.getMessage() == ednMsgGuiRm) {
|
||||||
|
if (_textDrawer.hasBuffer() == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_textDrawer.hasTextSelected() == true) {
|
||||||
|
appl::Buffer::Iterator start = _textDrawer.getStartLine(_textDrawer.selectStart());
|
||||||
|
appl::Buffer::Iterator end = _textDrawer.getEndLine(_textDrawer.selectStop())+1;
|
||||||
|
_textDrawer.replace("", start, end);
|
||||||
|
} else {
|
||||||
|
appl::Buffer::Iterator start = _textDrawer.getStartLine(_textDrawer.cursor());
|
||||||
|
appl::Buffer::Iterator end = _textDrawer.getEndLine(_textDrawer.cursor())+1;
|
||||||
|
_textDrawer.replace("", start, end);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
33
sources/appl/TextPluginRmLine.h
Normal file
33
sources/appl/TextPluginRmLine.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license GPL v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __APPL_TEXT_RM_LINE_H__
|
||||||
|
#define __APPL_TEXT_RM_LINE_H__
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/renderer/EObject.h>
|
||||||
|
#include <appl/Gui/TextViewer.h>
|
||||||
|
#include <ewol/compositing/Text.h>
|
||||||
|
#include <appl/TextPlugin.h>
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
|
class TextPluginRmLine : public appl::TextViewerPlugin {
|
||||||
|
public:
|
||||||
|
TextPluginRmLine(void);
|
||||||
|
~TextPluginRmLine(void) {
|
||||||
|
// nothing to do ...
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||||
|
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||||
|
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::EMessage& _msg);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -40,6 +40,7 @@ def Create(target):
|
|||||||
'appl/TextPluginMultiLineTab.cpp',
|
'appl/TextPluginMultiLineTab.cpp',
|
||||||
'appl/TextPluginAutoIndent.cpp',
|
'appl/TextPluginAutoIndent.cpp',
|
||||||
'appl/TextPluginHistory.cpp',
|
'appl/TextPluginHistory.cpp',
|
||||||
|
'appl/TextPluginRmLine.cpp',
|
||||||
'appl/TextPluginManager.cpp'])
|
'appl/TextPluginManager.cpp'])
|
||||||
|
|
||||||
# Generic color management for the text editor :
|
# Generic color management for the text editor :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user