/** * @author Edouard DUPIN * * @copyright 2010, Edouard DUPIN, all right reserved * * @license GPL v3 (see license file) */ #include #include #undef __class__ #define __class__ "TextPluginMultiLineTab" appl::TextPluginMultiLineTab::TextPluginMultiLineTab() { m_activateOnEventEntry = true; addObjectType("appl::TextPluginMultiLineTab"); } bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer, const ewol::event::Entry& _event) { if (isEnable() == false) { return false; } if (_event.getType() != gale::key::keyboard_char) { return false; } //APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent); if (_event.getStatus() != gale::key::status_down) { return false; } char32_t localValue = _event.getChar(); if (localValue != u32char::Tabulation) { return false; } if (_textDrawer.hasTextSelected() == false) { return false; } appl::Buffer::Iterator itStart = _textDrawer.selectStart(); appl::Buffer::Iterator itStop = _textDrawer.selectStop(); // get the compleate section of the buffer : itStart = _textDrawer.getStartLine(itStart); itStop = _textDrawer.getEndLine(itStop); // copy the curent data in a classicle string: std::string data; _textDrawer.copy(data, itStart, itStop); // TODO : Change this ... bool m_useTabs = true; size_t m_tabDist = 4; if (true == _event.getSpecialKey().getShift() ) { // un-indent data.insert(0, 1, u32char::Return); for (size_t iii=1; iii