[DEV] update new ETK
This commit is contained in:
parent
f655155aa4
commit
b6e3bce68f
@ -112,7 +112,7 @@ def configure(target, my_module):
|
||||
|
||||
my_module.add_flag('c', [
|
||||
"-DPROJECT_NAME=\"\\\""+my_module.get_name()+"\\\"\"",
|
||||
"-DAPPL_VERSION=\"\\\"" + tools.version_toString(get_version()) + "\\\"\""
|
||||
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
|
||||
])
|
||||
versionIDCode = str(get_version_id())
|
||||
|
||||
|
@ -18,7 +18,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
|
||||
}
|
||||
if (m_data != nullptr) {
|
||||
if (m_current < (int64_t)m_data->m_data.size() ) {
|
||||
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
|
||||
int8_t nbChar = utf8::length(m_data->m_data[m_current]);
|
||||
if (nbChar != 0) {
|
||||
m_current+=nbChar;
|
||||
} else {
|
||||
@ -37,7 +37,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- () {
|
||||
if (m_data != nullptr) {
|
||||
if (m_current > 0) {
|
||||
int32_t iii = -1;
|
||||
while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false
|
||||
while( utf8::first(m_data->m_data[m_current+iii]) == false
|
||||
&& iii >= -6
|
||||
&& m_current-iii>0) {
|
||||
--iii;
|
||||
@ -69,7 +69,7 @@ char32_t appl::Buffer::Iterator::operator* () {
|
||||
char tmpVal[5];
|
||||
memset(tmpVal, 0, sizeof(tmpVal));
|
||||
tmpVal[0] = m_data->m_data[m_current];
|
||||
int8_t nbChar = utf8::theoricLen(tmpVal[0]);
|
||||
int8_t nbChar = utf8::length(tmpVal[0]);
|
||||
for (int32_t iii=1; iii<nbChar && m_current+iii<(int64_t)m_data->m_data.size(); ++iii) {
|
||||
tmpVal[iii] = m_data->m_data[m_current+iii];
|
||||
}
|
||||
@ -286,17 +286,17 @@ bool appl::Buffer::search(const appl::Buffer::Iterator& _pos,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
char32_t firstElement = tolower(_search[0]);
|
||||
char32_t firstElement = u32char::toLower(_search[0]);
|
||||
// move in the string
|
||||
for (Iterator it = _pos;
|
||||
(bool)it == true;
|
||||
++it) {
|
||||
if ((char32_t)tolower(*it) == firstElement) {
|
||||
if ((char32_t)u32char::toLower(*it) == firstElement) {
|
||||
// find the first char ==> check next...
|
||||
bool find = true;
|
||||
Iterator tmp = it;
|
||||
for (size_t iii=0; iii<_search.size(); ++iii) {
|
||||
if (tolower(*tmp) != tolower(_search[iii])) {
|
||||
if (u32char::toLower(*tmp) != u32char::toLower(_search[iii])) {
|
||||
find = false;
|
||||
break;
|
||||
}
|
||||
@ -357,18 +357,18 @@ bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lastElement = tolower(lastElement);
|
||||
lastElement = u32char::toLower(lastElement);
|
||||
// move in the string
|
||||
for (Iterator it = _pos - 1;
|
||||
(bool)it == true;
|
||||
--it) {
|
||||
//APPL_DEBUG("compare : " << *it << " ?= " << _search);
|
||||
if ((char32_t)tolower(*it) == lastElement) {
|
||||
if ((char32_t)u32char::toLower(*it) == lastElement) {
|
||||
// find the last char ==> check previous...
|
||||
bool find = true;
|
||||
_result = it;
|
||||
for (int64_t iii=_search.size()-1; iii>=0; --iii) {
|
||||
if (tolower(*_result) != tolower(_search[iii])) {
|
||||
if (u32char::toLower(*_result) != u32char::toLower(_search[iii])) {
|
||||
find = false;
|
||||
break;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <appl/Buffer.hpp>
|
||||
#include <appl/globalMsg.hpp>
|
||||
#include <ewol/widget/Widget.hpp>
|
||||
@ -28,7 +27,7 @@ namespace appl {
|
||||
DECLARE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
|
||||
virtual ~BufferManager();
|
||||
private:
|
||||
std::list<ememory::SharedPtr<appl::Buffer>> m_list; // list of all buffer curently open
|
||||
etk::Vector<ememory::SharedPtr<appl::Buffer>> m_list; // list of all buffer curently open
|
||||
public:
|
||||
/**
|
||||
* @brief Get a specific buffer with his name (can create a new buffer).
|
||||
@ -85,16 +84,16 @@ namespace appl {
|
||||
void requestDestroyFromChild(const ememory::SharedPtr<Object>& _child);
|
||||
public:
|
||||
// generic iterators:
|
||||
std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator begin() const {
|
||||
const etk::Vector<ememory::SharedPtr<appl::Buffer>>::Iterator begin() const {
|
||||
return m_list.begin();
|
||||
}
|
||||
std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator end() const {
|
||||
const etk::Vector<ememory::SharedPtr<appl::Buffer>>::Iterator end() const {
|
||||
return m_list.end();
|
||||
}
|
||||
std::list<ememory::SharedPtr<appl::Buffer>>::iterator begin() {
|
||||
etk::Vector<ememory::SharedPtr<appl::Buffer>>::Iterator begin() {
|
||||
return m_list.begin();
|
||||
}
|
||||
std::list<ememory::SharedPtr<appl::Buffer>>::iterator end() {
|
||||
etk::Vector<ememory::SharedPtr<appl::Buffer>>::Iterator end() {
|
||||
return m_list.end();
|
||||
}
|
||||
};
|
||||
|
@ -67,7 +67,7 @@ void BufferView::removeAllElement() {
|
||||
void BufferView::insertAlphabetic(const appl::dataBufferStruct& _dataStruct, bool _selectNewPosition) {
|
||||
// alphabetical order:
|
||||
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
||||
if (etk::tolower(m_list[iii].m_bufferName.getNameFile()) > etk::tolower(_dataStruct.m_bufferName.getNameFile())) {
|
||||
if (m_list[iii].m_bufferName.getNameFile().toLower() > _dataStruct.m_bufferName.getNameFile().toLower()) {
|
||||
m_list.insert(m_list.begin() + iii, _dataStruct);
|
||||
if (_selectNewPosition == true) {
|
||||
m_selectedID = iii;
|
||||
|
@ -16,6 +16,9 @@ namespace appl {
|
||||
public:
|
||||
etk::FSNode m_bufferName;
|
||||
ememory::SharedPtr<appl::Buffer> m_buffer;
|
||||
dataBufferStruct() {
|
||||
|
||||
};
|
||||
dataBufferStruct(const etk::String& _bufferName, const ememory::SharedPtr<appl::Buffer>& _buffer) :
|
||||
m_bufferName(_bufferName),
|
||||
m_buffer(_buffer) {
|
||||
|
@ -34,9 +34,9 @@ void appl::widget::Search::init() {
|
||||
subBind(ewol::widget::Button, "[" + etk::toString(getId()) + "]SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap);
|
||||
subBind(ewol::widget::Button, "[" + etk::toString(getId()) + "]SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward);
|
||||
// set default properties
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]SEARCH:case", "value", etk::to_string(m_caseSensitive));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]SEARCH:wrap", "value", etk::to_string(m_wrap));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]SEARCH:up-down", "value", etk::to_string(m_forward));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]SEARCH:case", "value", etk::toString(m_caseSensitive));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]SEARCH:wrap", "value", etk::toString(m_wrap));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]SEARCH:up-down", "value", etk::toString(m_forward));
|
||||
// get widget
|
||||
m_searchEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("[" + etk::toString(getId()) + "]SEARCH:search-entry"));
|
||||
m_replaceEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("[" + etk::toString(getId()) + "]SEARCH:replace-entry"));
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <ewol/compositing/Drawing.hpp>
|
||||
#include <appl/BufferManager.hpp>
|
||||
#include <appl/Gui/ViewerManager.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace appl {
|
||||
class textPluginManager;
|
||||
|
@ -89,7 +89,7 @@ void appl::Highlight::init(const etk::String& _xmlFilename, const etk::String& _
|
||||
APPL_ERROR("Can not parse an element pass with no attribute name ... ligne=" << child.getPos());
|
||||
continue;
|
||||
}
|
||||
m_listHighlightNamed.insert(etk::Pair<etk::String, etk::Vector<HighlightPattern>>(attributeName, etk::Vector<HighlightPattern>()));
|
||||
m_listHighlightNamed.add(attributeName, etk::Vector<HighlightPattern>());
|
||||
auto it3 = m_listHighlightNamed.find(attributeName);
|
||||
int32_t level3=0;
|
||||
// get sub Nodes ...
|
||||
@ -123,24 +123,20 @@ appl::Highlight::~Highlight() {
|
||||
bool appl::Highlight::isCompatible(const etk::String& _name) {
|
||||
for (auto &it : m_listExtentions) {
|
||||
APPL_WARNING(" check : " << it << "=?=" << _name);
|
||||
// TODO: Remove dependency with the std::regex ...
|
||||
std::regex expression;
|
||||
try {
|
||||
expression.assign(it, std::regex_constants::optimize | std::regex_constants::ECMAScript);
|
||||
} catch (std::regex_error e) {
|
||||
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << it);
|
||||
etk::RegEx<etk::String> regex;
|
||||
regex.compile(it);
|
||||
if (regex.getStatus() == false) {
|
||||
APPL_ERROR("can not parse regex: " << it);
|
||||
continue;
|
||||
}
|
||||
std::smatch resultMatch;
|
||||
std::regex_search(_name.begin(), _name.end(), resultMatch, expression, std::regex_constants::match_continuous);
|
||||
if (resultMatch.size() <= 0) {
|
||||
if (regex.parse(_name, 0, _name.size()) == false) {
|
||||
continue;
|
||||
}
|
||||
APPL_WARNING(" - begin=" << std::distance(_name.begin(), resultMatch[0].first) << " end=" << std::distance(_name.begin(), resultMatch[0].second));
|
||||
if (resultMatch[0].first != _name.begin()) {
|
||||
APPL_WARNING(" - begin=" << regex.start() << " end=" << regex.stop());
|
||||
if (regex.start() != 0) {
|
||||
continue;
|
||||
}
|
||||
if (resultMatch[0].second != _name.end()) {
|
||||
if (regex.stop() != _name.size()) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
|
@ -42,19 +42,17 @@ void appl::HighlightPattern::setPatern(const etk::String& _regExp, const etk::St
|
||||
APPL_DEBUG("parse regex='" << _regExp << "' -> '" << _regExpStop << "'");
|
||||
m_hasParsingError = false;
|
||||
if (_regExp != "") {
|
||||
try {
|
||||
m_regExp[0].compile(_regExp);
|
||||
} catch (std::runtime_error e) {
|
||||
m_regExp[0].compile(_regExp);
|
||||
if (m_regExp[0].getStatus() == false) {
|
||||
m_hasParsingError = true;
|
||||
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << _regExp);
|
||||
APPL_ERROR("can not parse regex for : " << _regExp);
|
||||
}
|
||||
}
|
||||
if (_regExpStop != "") {
|
||||
try {
|
||||
m_regExp[1].compile(_regExpStop);
|
||||
} catch (std::runtime_error e) {
|
||||
m_regExp[1].compile(_regExpStop);
|
||||
if (m_regExp[1].getStatus() == false) {
|
||||
m_hasParsingError = true;
|
||||
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << _regExpStop);
|
||||
APPL_ERROR("can not parse regex for : " << _regExpStop);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,7 +155,7 @@ bool appl::HighlightPattern::find(int32_t _start,
|
||||
// when we have only one element:
|
||||
if (m_regExp[0].processOneElement(_buffer, _start, _stop) == true) {
|
||||
_resultat.start = m_regExp[0].start();
|
||||
_resultat.stop = m_regExp[0].stop();
|
||||
_resultat.stop = m_regExp[0].stop();
|
||||
//APPL_DEBUG("find data at : start=" << _resultat.start << " stop=" << _resultat.stop << " data='" <<etk::String(_buffer, _resultat.start, _resultat.stop-_resultat.start) << "'" );
|
||||
//APPL_DEBUG("find data at : start=" << _resultat.start << " stop=" << _resultat.stop );
|
||||
if (m_hasEndRegEx == true) {
|
||||
|
@ -10,8 +10,7 @@ class HighlightPattern;
|
||||
|
||||
#include <appl/GlyphPainting.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <regex>
|
||||
#include <etk/RegExp.hpp>
|
||||
#include <etk/RegEx.hpp>
|
||||
#include <etk/Buffer.hpp>
|
||||
#include <exml/exml.hpp>
|
||||
|
||||
@ -46,7 +45,7 @@ namespace appl {
|
||||
bool m_hasParsingError;
|
||||
etk::String m_regexValue[2];
|
||||
bool m_hasEndRegEx;
|
||||
etk::RegExp<etk::Buffer> m_regExp[2]; //!< Start of Regular expression
|
||||
etk::RegEx<etk::Buffer> m_regExp[2]; //!< Start of Regular expression
|
||||
public:
|
||||
void setPatern(const etk::String& _regExp, const etk::String& _regExpStop="", bool _hasEndRegEx=false);
|
||||
etk::Pair<etk::String,etk::String> getPaternString();
|
||||
|
@ -28,7 +28,7 @@ namespace appl {
|
||||
m_specificData.clear();
|
||||
}
|
||||
private:
|
||||
etk::Vector<etk::Pair<ememory::WeakPtr<appl::Buffer> ,std::unique_ptr<TYPE>>> m_specificData;
|
||||
etk::Vector<etk::Pair<ememory::WeakPtr<appl::Buffer> ,ememory::UniquePtr<TYPE>>> m_specificData;
|
||||
protected:
|
||||
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
|
||||
auto it = m_specificData.begin();
|
||||
@ -43,13 +43,14 @@ namespace appl {
|
||||
}
|
||||
++it;
|
||||
}
|
||||
std::unique_ptr<TYPE> data(new TYPE());
|
||||
ememory::UniquePtr<TYPE> data(new TYPE());
|
||||
if (data == nullptr) {
|
||||
APPL_ERROR("ALLOCATION plugin data error");
|
||||
return nullptr;
|
||||
}
|
||||
TYPE* copyPocalPointer = data.get();
|
||||
m_specificData.pushBack(etk::makePair(_textDrawer.internalGetBuffer(), etk::move(data)));
|
||||
ememory::WeakPtr<appl::Buffer> tmpBuffer = _textDrawer.internalGetBuffer();
|
||||
m_specificData.pushBack(etk::makePair(tmpBuffer, etk::move(data)));
|
||||
// create a new one ...
|
||||
return copyPocalPointer;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace appl {
|
||||
class textPluginManager : public gale::Resource {
|
||||
private:
|
||||
ememory::WeakPtr<appl::TextViewer> m_currentViewer;
|
||||
std::list<ememory::SharedPtr<appl::TextViewerPlugin>> m_list;
|
||||
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_list;
|
||||
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventEntry;
|
||||
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventInput;
|
||||
etk::Vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnWrite;
|
||||
|
@ -43,9 +43,9 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
bool m_useTabs = true;
|
||||
size_t m_tabDist = 4;
|
||||
|
||||
if (true == _event.getSpecialKey().getShift() ) {
|
||||
if (_event.getSpecialKey().getShift() == true) {
|
||||
// un-indent
|
||||
data.insert(0, 1, u32char::Return);
|
||||
data.insert(0, u32char::Return);
|
||||
for (size_t iii=1; iii<data.size(); ++iii) {
|
||||
if ((char32_t)data[iii-1] != u32char::Return) {
|
||||
continue;
|
||||
@ -68,17 +68,19 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
data.erase(0, 1);
|
||||
} else {
|
||||
// indent
|
||||
data.insert(0, 1, u32char::Return);
|
||||
data.insert(0, u32char::Return);
|
||||
for (size_t iii=1; iii<data.size(); iii++) {
|
||||
if ((char32_t)data[iii-1] != u32char::Return) {
|
||||
continue;
|
||||
}
|
||||
if (true == _event.getSpecialKey().getCtrl() ) {
|
||||
data.insert(iii, 1, u32char::Space);
|
||||
} else if (true == m_useTabs) {
|
||||
data.insert(iii, 1, u32char::Tabulation);
|
||||
if (_event.getSpecialKey().getCtrl() == true) {
|
||||
data.insert(iii, u32char::Space);
|
||||
} else if (m_useTabs == true) {
|
||||
data.insert(iii, u32char::Tabulation);
|
||||
} else {
|
||||
data.insert(iii, m_tabDist, u32char::Space);
|
||||
for (size_t iii=0; iii<m_tabDist; ++iii) {
|
||||
data.insert(iii, u32char::Space);
|
||||
}
|
||||
}
|
||||
}
|
||||
data.erase(0, 1);
|
||||
|
@ -139,11 +139,11 @@ void globals::ParameterGlobalsGui::init() {
|
||||
ewol::widget::Composer::init();
|
||||
loadFromFile("DATA:GUI-Parameter-global.xml", getId());
|
||||
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:auto-indent", "value", etk::to_string(isSetAutoIndent()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-space-char", "value", etk::to_string(isSetDisplaySpaceChar()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-tab", "value", etk::to_string(isSetDisplayTabChar()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-eol", "value", etk::to_string(isSetDisplayEndOfLine()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-shape", "value", etk::to_string(isSetDisplayEndOfLine()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:auto-indent", "value", etk::toString(isSetAutoIndent()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-space-char", "value", etk::toString(isSetDisplaySpaceChar()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-tab", "value", etk::toString(isSetDisplayTabChar()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-eol", "value", etk::toString(isSetDisplayEndOfLine()));
|
||||
propertySetOnWidgetNamed("[" + etk::toString(getId()) + "]appl-param:display-shape", "value", etk::toString(isSetDisplayEndOfLine()));
|
||||
|
||||
subBind(ewol::widget::CheckBox, "[" + etk::toString(getId()) + "]appl-param:auto-indent", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
|
||||
subBind(ewol::widget::CheckBox, "[" + etk::toString(getId()) + "]appl-param:display-space-char", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
|
||||
|
@ -26,7 +26,7 @@ aa "\u4855" aa "\U78965412" aa "\x0F" aa "\o45"
|
||||
|
||||
etk::String
|
||||
|
||||
std::thread::sleep
|
||||
ethread::Thread::sleep
|
||||
|
||||
/*
|
||||
* TODO: Todo in a multipleLine interface
|
||||
|
Loading…
x
Reference in New Issue
Block a user