[DEV] update to the new treeview
This commit is contained in:
parent
2d6e2d4d2f
commit
45827887f7
@ -191,41 +191,39 @@ uint32_t BufferView::getNuberOfRaw() {
|
|||||||
return m_list.size();
|
return m_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BufferView::getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
fluorine::Variant BufferView::getData(int32_t _role, const ivec2& _pos) {
|
||||||
if( _raw >= 0
|
switch (_role) {
|
||||||
&& _raw<(int64_t)m_list.size() ) {
|
case ewol::widget::ListRole::Text:
|
||||||
_myTextToWrite = m_list[_raw].m_bufferName.getNameFile();
|
return m_list[_pos.y()].m_bufferName.getNameFile();;
|
||||||
|
case ewol::widget::ListRole::FgColor:
|
||||||
if ( m_list[_raw].m_buffer != null
|
if ( m_list[_pos.y()].m_buffer != null
|
||||||
&& m_list[_raw].m_buffer->isModify() == false) {
|
&& m_list[_pos.y()].m_buffer->isModify() == false) {
|
||||||
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
return (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
||||||
} else {
|
} else {
|
||||||
_fg = (*m_paintingProperties)[m_colorTextModify].getForeground();
|
return (*m_paintingProperties)[m_colorTextModify].getForeground();
|
||||||
}
|
}
|
||||||
if (_raw%2 == 0) {
|
case ewol::widget::ListRole::BgColor:
|
||||||
_bg = (*m_paintingProperties)[m_colorBackground1].getForeground();
|
if (m_selectedID == _pos.y()) {
|
||||||
} else {
|
return (*m_paintingProperties)[m_colorBackgroundSelect].getForeground();
|
||||||
_bg = (*m_paintingProperties)[m_colorBackground2].getForeground();
|
|
||||||
}
|
}
|
||||||
// the buffer change of selection ...
|
if (_pos.y() % 2) {
|
||||||
if (m_selectedID == _raw) {
|
return (*m_paintingProperties)[m_colorBackground1].getForeground();
|
||||||
_bg = (*m_paintingProperties)[m_colorBackgroundSelect].getForeground();
|
|
||||||
}
|
}
|
||||||
} else {
|
return (*m_paintingProperties)[m_colorBackground2].getForeground();
|
||||||
_myTextToWrite = "ERROR";
|
|
||||||
}
|
}
|
||||||
return true;
|
return fluorine::Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BufferView::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
|
|
||||||
|
bool BufferView::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) {
|
||||||
if (1 == _IdInput && _typeEvent == gale::key::status::pressSingle) {
|
if (1 == _IdInput && _typeEvent == gale::key::status::pressSingle) {
|
||||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
APPL_INFO("Event on List : IdInput=" << _IdInput << " pos=" << _pos );
|
||||||
if( _raw >= 0
|
if( _pos.y() >= 0
|
||||||
&& _raw<(int64_t)m_list.size()) {
|
&& _pos.y() < (int64_t)m_list.size()) {
|
||||||
if (m_list[_raw].m_buffer != null) {
|
if (m_list[_raw].m_buffer != null) {
|
||||||
if (m_bufferManager != null) {
|
if (m_bufferManager != null) {
|
||||||
APPL_INFO("Select file :" << m_list[_raw].m_buffer->getFileName() << " in list");
|
APPL_INFO("Select file :" << m_list[_pos.y()].m_buffer->getFileName() << " in list");
|
||||||
m_bufferManager->open(m_list[_raw].m_buffer->getFileName());
|
m_bufferManager->open(m_list[_pos.y()].m_buffer->getFileName());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class BufferView : public ewol::widget::List {
|
|||||||
protected:
|
protected:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
BufferView();
|
BufferView();
|
||||||
void init();
|
void init() override;
|
||||||
public:
|
public:
|
||||||
DECLARE_FACTORY(BufferView);
|
DECLARE_FACTORY(BufferView);
|
||||||
virtual ~BufferView();
|
virtual ~BufferView();
|
||||||
@ -61,14 +61,14 @@ class BufferView : public ewol::widget::List {
|
|||||||
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
||||||
protected:
|
protected:
|
||||||
// function call to display the list :
|
// function call to display the list :
|
||||||
virtual etk::Color<> getBasicBG();
|
etk::Color<> getBasicBG() override;
|
||||||
void removeAllElement();
|
void removeAllElement();
|
||||||
// Derived function
|
// Derived function
|
||||||
virtual uint32_t getNuberOfColomn();
|
uint32_t getNuberOfColomn() override;
|
||||||
virtual bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||||
virtual uint32_t getNuberOfRaw();
|
uint32_t getNuberOfRaw() override;
|
||||||
virtual bool getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||||
virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||||
private: //callback function:
|
private: //callback function:
|
||||||
void onCallbackChangeName();
|
void onCallbackChangeName();
|
||||||
void onCallbackIsSave();
|
void onCallbackIsSave();
|
||||||
|
@ -50,46 +50,50 @@ uint32_t appl::TagFileList::getNuberOfRaw() {
|
|||||||
return m_list.size();
|
return m_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
fluorine::Variant appl::TagFileList::getData(int32_t _role, const ivec2& _pos) {
|
||||||
if (_raw >= 0 && (size_t)_raw < m_list.size() && null != m_list[_raw]) {
|
switch (_role) {
|
||||||
if (0 == _colomn) {
|
case ewol::widget::ListRole::Text:
|
||||||
_myTextToWrite = etk::toString(m_list[_raw]->fileLine);
|
if ( _pos.y() >= 0
|
||||||
} else {
|
&& (size_t)_pos.y() < m_list.size()
|
||||||
_myTextToWrite = m_list[_raw]->filename;
|
&& null != m_list[_pos.y()]) {
|
||||||
|
if (0 == _pos.x()) {
|
||||||
|
return etk::toString(m_list[_pos.y()]->fileLine);
|
||||||
}
|
}
|
||||||
} else {
|
return m_list[_pos.y()]->filename;
|
||||||
_myTextToWrite = "ERROR";
|
|
||||||
}
|
}
|
||||||
_fg = m_colorProperty->get(m_colorIdText);
|
return "ERROR";
|
||||||
if (_raw % 2) {
|
case ewol::widget::ListRole::FgColor:
|
||||||
_bg = m_colorProperty->get(m_colorIdBackground1);
|
return m_colorProperty->get(m_colorIdText);
|
||||||
} else {
|
case ewol::widget::ListRole::BgColor:
|
||||||
_bg = m_colorProperty->get(m_colorIdBackground2);
|
if (m_selectedLine == _pos.y()) {
|
||||||
|
return m_colorProperty->get(m_colorIdBackgroundSelected);
|
||||||
}
|
}
|
||||||
if (m_selectedLine == _raw) {
|
if (_pos.y() % 2) {
|
||||||
_bg = m_colorProperty->get(m_colorIdBackgroundSelected);
|
return m_colorProperty->get(m_colorIdBackground1);
|
||||||
}
|
}
|
||||||
return true;
|
return m_colorProperty->get(m_colorIdBackground2);
|
||||||
};
|
}
|
||||||
|
return fluorine::Variant();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
|
bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) {
|
||||||
if (_typeEvent == gale::key::status::pressSingle) {
|
if (_typeEvent == gale::key::status::pressSingle) {
|
||||||
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
EWOL_INFO("Event on List : IdInput=" << _IdInput << " pos=" << _pos );
|
||||||
if (_IdInput == 1) {
|
if (_IdInput == 1) {
|
||||||
int32_t previousRaw = m_selectedLine;
|
int32_t previousRaw = m_selectedLine;
|
||||||
if (_raw > (int64_t)m_list.size() ) {
|
if (_pos.y() > (int64_t)m_list.size() ) {
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
} else {
|
} else {
|
||||||
m_selectedLine = _raw;
|
m_selectedLine = _pos.y();
|
||||||
}
|
}
|
||||||
if( m_selectedLine >= 0
|
if( m_selectedLine >= 0
|
||||||
&& m_selectedLine < (int64_t)m_list.size()
|
&& m_selectedLine < (int64_t)m_list.size()
|
||||||
&& null != m_list[m_selectedLine] ) {
|
&& null != m_list[m_selectedLine] ) {
|
||||||
if (previousRaw != m_selectedLine) {
|
if (previousRaw != m_selectedLine) {
|
||||||
signalSelect.emit(etk::toString(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
signalSelect.emit(etk::toString(m_list[_pos.y()]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||||
} else {
|
} else {
|
||||||
signalValidate.emit(etk::toString(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
signalValidate.emit(etk::toString(m_list[_pos.y()]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
signalUnSelect.emit();
|
signalUnSelect.emit();
|
||||||
|
@ -38,17 +38,17 @@ namespace appl {
|
|||||||
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
||||||
protected:
|
protected:
|
||||||
TagFileList();
|
TagFileList();
|
||||||
void init();
|
void init() override;
|
||||||
public:
|
public:
|
||||||
DECLARE_FACTORY(TagFileList);
|
DECLARE_FACTORY(TagFileList);
|
||||||
virtual ~TagFileList();
|
virtual ~TagFileList();
|
||||||
// display API :
|
// display API :
|
||||||
virtual etk::Color<> getBasicBG();
|
etk::Color<> getBasicBG() override;
|
||||||
uint32_t getNuberOfColomn();
|
uint32_t getNuberOfColomn() override;
|
||||||
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||||
uint32_t getNuberOfRaw();
|
uint32_t getNuberOfRaw() override;
|
||||||
bool getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief add a Ctags item on the curent list
|
* @brief add a Ctags item on the curent list
|
||||||
|
10
todo.txt
10
todo.txt
@ -1,4 +1,12 @@
|
|||||||
List of all thing to do to have a corect text editor :
|
|
||||||
|
Truc urgent:
|
||||||
|
==> pop-up quand le fichier a changer depuis le dernière enregistrement
|
||||||
|
==> action sur close ==> automatic run clang-format
|
||||||
|
==> treeview/listView sur la gauche
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List of all thing to do to have a correct text editor:
|
||||||
edn :
|
edn :
|
||||||
- Correct the pb on highlight
|
- Correct the pb on highlight
|
||||||
- Ctags back event
|
- Ctags back event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user