[DEV] buffer manager better work

This commit is contained in:
2013-10-29 21:13:45 +01:00
parent 7ddaa68bb0
commit 50c1830696
12 changed files with 176 additions and 55 deletions

View File

@@ -33,6 +33,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
registerMultiCast(ednMsgGuiFind);
registerMultiCast(ednMsgGuiReplace);
registerMultiCast(ednMsgGuiGotoLine);
registerMultiCast(appl::MsgSelectNewFile);
setLimitScrolling(0.2);
shortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
@@ -40,6 +41,9 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
shortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
shortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
// load buffer manager:
m_bufferManager = appl::BufferManager::keep();
// load color properties
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:textViewer.json");
// get all id properties ...
@@ -65,6 +69,12 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
appl::TextViewer::~TextViewer(void) {
appl::textPluginManager::disconnect(*this);
if (m_paintingProperties != NULL) {
appl::GlyphPainting::release(m_paintingProperties);
}
if (m_bufferManager != NULL) {
appl::BufferManager::release(m_bufferManager);
}
}
bool appl::TextViewer::calculateMinSize(void) {
@@ -519,13 +529,24 @@ void appl::TextViewer::onEventClipboard(ewol::clipBoard::clipboardListe_te _clip
void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg) {
// First call plugin
//APPL_DEBUG("receive msg: " << _msg);
if (appl::textPluginManager::onReceiveMessage(*this, _msg) == true) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectNewFile) {
m_buffer = m_bufferManager->get(_msg.getData());
}
markToRedraw();
}
void appl::TextViewer::onObjectRemove(ewol::EObject* _removeObject) {
if (m_buffer == _removeObject) {
m_buffer = NULL;
markToRedraw();
}
}
void appl::TextViewer::onGetFocus(void) {
showKeyboard();
APPL_INFO("Focus - In");