[DEV] coding style review
This commit is contained in:
@@ -15,50 +15,44 @@
|
||||
#include <ewol/renderer/EObject.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "BufferView"
|
||||
#define __class__ "BufferView"
|
||||
|
||||
|
||||
|
||||
static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
|
||||
{
|
||||
etk::Vector<appl::dataBufferStruct *> tmpList = list;
|
||||
list.clear();
|
||||
static void SortElementList(etk::Vector<appl::dataBufferStruct*>& _list) {
|
||||
etk::Vector<appl::dataBufferStruct *> tmpList = _list;
|
||||
_list.clear();
|
||||
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
||||
if (NULL != tmpList[iii]) {
|
||||
int32_t findPos = 0;
|
||||
for(int32_t jjj=0; jjj<list.size(); jjj++) {
|
||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||
if (list[jjj]!=NULL) {
|
||||
if (tmpList[iii]->m_bufferName.getNameFile() > list[jjj]->m_bufferName.GetNameFile()) {
|
||||
findPos = jjj+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG("position="<<findPos);
|
||||
list.insert(findPos, tmpList[iii]);
|
||||
if (NULL == tmpList[iii]) {
|
||||
continue;
|
||||
}
|
||||
int32_t findPos = 0;
|
||||
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
|
||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||
if (_list[jjj] == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
|
||||
findPos = jjj+1;
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG("position="<<findPos);
|
||||
_list.insert(findPos, tmpList[iii]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BufferView::BufferView(void)
|
||||
{
|
||||
BufferView::BufferView(void) {
|
||||
setCanHaveFocus(true);
|
||||
RegisterMultiCast(ednMsgBufferListChange);
|
||||
RegisterMultiCast(ednMsgBufferState);
|
||||
RegisterMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(ednMsgBufferListChange);
|
||||
registerMultiCast(ednMsgBufferState);
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
m_selectedID = -1;
|
||||
m_selectedIdRequested = -1;
|
||||
}
|
||||
|
||||
BufferView::~BufferView(void)
|
||||
{
|
||||
BufferView::~BufferView(void) {
|
||||
removeAllElement();
|
||||
}
|
||||
|
||||
void BufferView::removeAllElement(void)
|
||||
{
|
||||
void BufferView::removeAllElement(void) {
|
||||
for(int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (NULL!=m_list[iii]) {
|
||||
delete(m_list[iii]);
|
||||
@@ -68,8 +62,7 @@ void BufferView::removeAllElement(void)
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
||||
{
|
||||
void BufferView::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||
widget::List::onReceiveMessage(_msg);
|
||||
if (_msg.getMessage() == ednMsgBufferListChange) {
|
||||
// clean The list
|
||||
@@ -77,7 +70,8 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
||||
// get all the buffer name and properties:
|
||||
int32_t nbBufferOpen = BufferManager::size();
|
||||
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
|
||||
if (BufferManager::Exist(iii)) {
|
||||
if (BufferManager::exist(iii)) {
|
||||
/*
|
||||
BufferText* tmpBuffer = BufferManager::get(iii);
|
||||
if (NULL != tmpBuffer) {
|
||||
bool isModify = tmpBuffer->isModify();
|
||||
@@ -89,6 +83,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
if (true == globals::OrderTheBufferList() ) {
|
||||
@@ -102,7 +97,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
||||
// update list of modify section ...
|
||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (NULL!=m_list[iii]) {
|
||||
m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify();
|
||||
//m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify();
|
||||
}
|
||||
}
|
||||
markToRedraw();
|
||||
@@ -110,29 +105,24 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
||||
}
|
||||
|
||||
|
||||
etk::Color<> BufferView::getBasicBG(void)
|
||||
{
|
||||
etk::Color<> BufferView::getBasicBG(void) {
|
||||
return ColorizeManager::get(COLOR_LIST_BG_1);
|
||||
}
|
||||
|
||||
uint32_t BufferView::getNuberOfColomn(void)
|
||||
{
|
||||
uint32_t BufferView::getNuberOfColomn(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool BufferView::getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg)
|
||||
{
|
||||
myTitle = "Buffers : ";
|
||||
bool BufferView::getTitle(int32_t _colomn, etk::UString &_myTitle, etk::Color<> &_fg, etk::Color<> &_bg) {
|
||||
_myTitle = "Buffers : ";
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t BufferView::getNuberOfRaw(void)
|
||||
{
|
||||
uint32_t BufferView::getNuberOfRaw(void) {
|
||||
return m_list.size();
|
||||
}
|
||||
|
||||
bool BufferView::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg)
|
||||
{
|
||||
bool BufferView::getElement(int32_t _colomn, int32_t _raw, etk::UString& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
bool isModify;
|
||||
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||
basicColor_te selectBG = COLOR_LIST_BG_1;
|
||||
@@ -140,49 +130,49 @@ bool BufferView::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
|
||||
if (m_selectedIdRequested != -1) {
|
||||
m_selectedID = -1;
|
||||
}
|
||||
if( raw >= 0
|
||||
&& raw<m_list.size()
|
||||
&& NULL != m_list[raw]) {
|
||||
myTextToWrite = m_list[raw]->m_bufferName.getNameFile();
|
||||
if( _raw >= 0
|
||||
&& _raw<m_list.size()
|
||||
&& NULL != m_list[_raw]) {
|
||||
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
|
||||
|
||||
if (true == m_list[raw]->m_isModify) {
|
||||
if (true == m_list[_raw]->m_isModify) {
|
||||
selectFG = COLOR_LIST_TEXT_MODIFY;
|
||||
} else {
|
||||
selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||
}
|
||||
if (raw%2 == 0) {
|
||||
if (_raw%2 == 0) {
|
||||
selectBG = COLOR_LIST_BG_1;
|
||||
} else {
|
||||
selectBG = COLOR_LIST_BG_2;
|
||||
}
|
||||
// the buffer change of selection ...
|
||||
if (m_selectedIdRequested == m_list[raw]->m_bufferID) {
|
||||
m_selectedID = raw;
|
||||
if (m_selectedIdRequested == m_list[_raw]->m_bufferID) {
|
||||
m_selectedID = _raw;
|
||||
// stop searching
|
||||
m_selectedIdRequested = -1;
|
||||
// set the raw visible :
|
||||
setRawVisible(m_selectedID);
|
||||
}
|
||||
if (m_selectedID == raw) {
|
||||
if (m_selectedID == _raw) {
|
||||
selectBG = COLOR_LIST_BG_SELECTED;
|
||||
}
|
||||
} else {
|
||||
myTextToWrite = "ERROR";
|
||||
_myTextToWrite = "ERROR";
|
||||
}
|
||||
fg = ColorizeManager::get(selectFG);
|
||||
bg = ColorizeManager::get(selectBG);
|
||||
_fg = ColorizeManager::get(selectFG);
|
||||
_bg = ColorizeManager::get(selectBG);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BufferView::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
|
||||
bool BufferView::onItemEvent(int32_t _IdInput, ewol::keyEvent::status_te _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y)
|
||||
{
|
||||
if (1 == IdInput && typeEvent == ewol::keyEvent::statusSingle) {
|
||||
APPL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||
if( raw >= 0
|
||||
&& raw<m_list.size()
|
||||
&& NULL != m_list[raw]) {
|
||||
m_selectedIdRequested = m_list[raw]->m_bufferID;
|
||||
SendMultiCast(ednMsgBufferId, m_list[raw]->m_bufferID);
|
||||
if (1 == _IdInput && _typeEvent == ewol::keyEvent::statusSingle) {
|
||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
if( _raw >= 0
|
||||
&& _raw<m_list.size()
|
||||
&& NULL != m_list[_raw]) {
|
||||
m_selectedIdRequested = m_list[_raw]->m_bufferID;
|
||||
sendMultiCast(ednMsgBufferId, m_list[_raw]->m_bufferID);
|
||||
}
|
||||
}
|
||||
markToRedraw();
|
||||
|
Reference in New Issue
Block a user