[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();
|
||||
}
|
||||
|
||||
bool BufferView::getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
if( _raw >= 0
|
||||
&& _raw<(int64_t)m_list.size() ) {
|
||||
_myTextToWrite = m_list[_raw].m_bufferName.getNameFile();
|
||||
|
||||
if ( m_list[_raw].m_buffer != null
|
||||
&& m_list[_raw].m_buffer->isModify() == false) {
|
||||
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
||||
} else {
|
||||
_fg = (*m_paintingProperties)[m_colorTextModify].getForeground();
|
||||
}
|
||||
if (_raw%2 == 0) {
|
||||
_bg = (*m_paintingProperties)[m_colorBackground1].getForeground();
|
||||
} else {
|
||||
_bg = (*m_paintingProperties)[m_colorBackground2].getForeground();
|
||||
}
|
||||
// the buffer change of selection ...
|
||||
if (m_selectedID == _raw) {
|
||||
_bg = (*m_paintingProperties)[m_colorBackgroundSelect].getForeground();
|
||||
}
|
||||
} else {
|
||||
_myTextToWrite = "ERROR";
|
||||
fluorine::Variant BufferView::getData(int32_t _role, const ivec2& _pos) {
|
||||
switch (_role) {
|
||||
case ewol::widget::ListRole::Text:
|
||||
return m_list[_pos.y()].m_bufferName.getNameFile();;
|
||||
case ewol::widget::ListRole::FgColor:
|
||||
if ( m_list[_pos.y()].m_buffer != null
|
||||
&& m_list[_pos.y()].m_buffer->isModify() == false) {
|
||||
return (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
||||
} else {
|
||||
return (*m_paintingProperties)[m_colorTextModify].getForeground();
|
||||
}
|
||||
case ewol::widget::ListRole::BgColor:
|
||||
if (m_selectedID == _pos.y()) {
|
||||
return (*m_paintingProperties)[m_colorBackgroundSelect].getForeground();
|
||||
}
|
||||
if (_pos.y() % 2) {
|
||||
return (*m_paintingProperties)[m_colorBackground1].getForeground();
|
||||
}
|
||||
return (*m_paintingProperties)[m_colorBackground2].getForeground();
|
||||
}
|
||||
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) {
|
||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
if( _raw >= 0
|
||||
&& _raw<(int64_t)m_list.size()) {
|
||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " pos=" << _pos );
|
||||
if( _pos.y() >= 0
|
||||
&& _pos.y() < (int64_t)m_list.size()) {
|
||||
if (m_list[_raw].m_buffer != null) {
|
||||
if (m_bufferManager != null) {
|
||||
APPL_INFO("Select file :" << m_list[_raw].m_buffer->getFileName() << " in list");
|
||||
m_bufferManager->open(m_list[_raw].m_buffer->getFileName());
|
||||
APPL_INFO("Select file :" << m_list[_pos.y()].m_buffer->getFileName() << " in list");
|
||||
m_bufferManager->open(m_list[_pos.y()].m_buffer->getFileName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class BufferView : public ewol::widget::List {
|
||||
protected:
|
||||
// Constructeur
|
||||
BufferView();
|
||||
void init();
|
||||
void init() override;
|
||||
public:
|
||||
DECLARE_FACTORY(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
|
||||
protected:
|
||||
// function call to display the list :
|
||||
virtual etk::Color<> getBasicBG();
|
||||
etk::Color<> getBasicBG() override;
|
||||
void removeAllElement();
|
||||
// Derived function
|
||||
virtual uint32_t getNuberOfColomn();
|
||||
virtual bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
virtual uint32_t getNuberOfRaw();
|
||||
virtual bool getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||
uint32_t getNuberOfColomn() override;
|
||||
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||
uint32_t getNuberOfRaw() override;
|
||||
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||
private: //callback function:
|
||||
void onCallbackChangeName();
|
||||
void onCallbackIsSave();
|
||||
|
@ -50,46 +50,50 @@ uint32_t appl::TagFileList::getNuberOfRaw() {
|
||||
return m_list.size();
|
||||
}
|
||||
|
||||
bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
if (_raw >= 0 && (size_t)_raw < m_list.size() && null != m_list[_raw]) {
|
||||
if (0 == _colomn) {
|
||||
_myTextToWrite = etk::toString(m_list[_raw]->fileLine);
|
||||
} else {
|
||||
_myTextToWrite = m_list[_raw]->filename;
|
||||
}
|
||||
} else {
|
||||
_myTextToWrite = "ERROR";
|
||||
fluorine::Variant appl::TagFileList::getData(int32_t _role, const ivec2& _pos) {
|
||||
switch (_role) {
|
||||
case ewol::widget::ListRole::Text:
|
||||
if ( _pos.y() >= 0
|
||||
&& (size_t)_pos.y() < m_list.size()
|
||||
&& null != m_list[_pos.y()]) {
|
||||
if (0 == _pos.x()) {
|
||||
return etk::toString(m_list[_pos.y()]->fileLine);
|
||||
}
|
||||
return m_list[_pos.y()]->filename;
|
||||
}
|
||||
return "ERROR";
|
||||
case ewol::widget::ListRole::FgColor:
|
||||
return m_colorProperty->get(m_colorIdText);
|
||||
case ewol::widget::ListRole::BgColor:
|
||||
if (m_selectedLine == _pos.y()) {
|
||||
return m_colorProperty->get(m_colorIdBackgroundSelected);
|
||||
}
|
||||
if (_pos.y() % 2) {
|
||||
return m_colorProperty->get(m_colorIdBackground1);
|
||||
}
|
||||
return m_colorProperty->get(m_colorIdBackground2);
|
||||
}
|
||||
_fg = m_colorProperty->get(m_colorIdText);
|
||||
if (_raw % 2) {
|
||||
_bg = m_colorProperty->get(m_colorIdBackground1);
|
||||
} else {
|
||||
_bg = m_colorProperty->get(m_colorIdBackground2);
|
||||
}
|
||||
if (m_selectedLine == _raw) {
|
||||
_bg = m_colorProperty->get(m_colorIdBackgroundSelected);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
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) {
|
||||
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
EWOL_INFO("Event on List : IdInput=" << _IdInput << " pos=" << _pos );
|
||||
if (_IdInput == 1) {
|
||||
int32_t previousRaw = m_selectedLine;
|
||||
if (_raw > (int64_t)m_list.size() ) {
|
||||
if (_pos.y() > (int64_t)m_list.size() ) {
|
||||
m_selectedLine = -1;
|
||||
} else {
|
||||
m_selectedLine = _raw;
|
||||
m_selectedLine = _pos.y();
|
||||
}
|
||||
if( m_selectedLine >= 0
|
||||
&& m_selectedLine < (int64_t)m_list.size()
|
||||
&& null != m_list[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 {
|
||||
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 {
|
||||
signalUnSelect.emit();
|
||||
|
@ -38,17 +38,17 @@ namespace appl {
|
||||
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
||||
protected:
|
||||
TagFileList();
|
||||
void init();
|
||||
void init() override;
|
||||
public:
|
||||
DECLARE_FACTORY(TagFileList);
|
||||
virtual ~TagFileList();
|
||||
// display API :
|
||||
virtual etk::Color<> getBasicBG();
|
||||
uint32_t getNuberOfColomn();
|
||||
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
uint32_t getNuberOfRaw();
|
||||
bool getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||
etk::Color<> getBasicBG() override;
|
||||
uint32_t getNuberOfColomn() override;
|
||||
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||
uint32_t getNuberOfRaw() override;
|
||||
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||
public:
|
||||
/**
|
||||
* @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 :
|
||||
- Correct the pb on highlight
|
||||
- Ctags back event
|
||||
|
Loading…
x
Reference in New Issue
Block a user