[DEV] the Ctags is now availlable inmultiple files

This commit is contained in:
2012-10-17 10:24:23 +02:00
parent 33a36fa0f7
commit e383600df6
8 changed files with 101 additions and 118 deletions

View File

@@ -26,15 +26,11 @@
#include <etk/tool.h>
#include <appl/Gui/TagFileList.h>
extern "C" {
// file browsing ...
#include <dirent.h>
}
#undef __class__
#define __class__ "TagFileList"
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
@@ -77,7 +73,13 @@ uint32_t appl::TagFileList::GetNuberOfRaw(void) {
bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) {
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
myTextToWrite = *m_list[raw];
if (0==colomn) {
// note : tmp while the list support multiple colomn
myTextToWrite = m_list[raw]->filename;
myTextToWrite = m_list[raw]->filename + ":" + etk::UString(m_list[raw]->fileLine);
} else {
myTextToWrite = etk::UString(m_list[raw]->fileLine);
}
} else {
myTextToWrite = "ERROR";
}
@@ -105,18 +107,16 @@ bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typ
} else {
m_selectedLine = raw;
}
const char * event = applEventCtagsListValidate;
if (previousRaw != m_selectedLine) {
if( m_selectedLine >=0
&& m_selectedLine < m_list.Size()
&& NULL != m_list[m_selectedLine] ) {
GenerateEventId(applEventCtagsListSelect, *m_list[m_selectedLine]);
}
event = applEventCtagsListSelect;
}
if( m_selectedLine >=0
&& m_selectedLine < m_list.Size()
&& NULL != m_list[m_selectedLine] ) {
GenerateEventId(event, etk::UString(m_list[raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
} else {
if( m_selectedLine >=0
&& m_selectedLine < m_list.Size()
&& NULL != m_list[m_selectedLine] ) {
GenerateEventId(applEventCtagsListValidate, *m_list[m_selectedLine]);
}
GenerateEventId(applEventCtagsListUnSelect);
}
// need to regenerate the display of the list :
MarkToRedraw();
@@ -133,9 +133,9 @@ bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typ
* @param[in] jump line id
* @return ---
*/
void appl::TagFileList::Add(etk::UString file, int32_t line)
void appl::TagFileList::Add(etk::UString& file, int32_t line)
{
etk::UString *tmpFile = new etk::UString(file);
appl::TagListElement *tmpFile = new appl::TagListElement(file, line);
if (NULL != tmpFile) {
m_list.PushBack(tmpFile);
}

View File

@@ -34,13 +34,21 @@
extern const char * const applEventCtagsListSelect;
extern const char * const applEventCtagsListValidate;
extern const char * const applEventCtagsListUnSelect;
namespace appl {
class TagListElement {
public:
etk::UString filename;
int32_t fileLine;
TagListElement(etk::UString& file, int32_t line) : filename(file), fileLine(line) {};
~TagListElement(void) {};
};
class TagFileList : public ewol::List
{
private:
int32_t m_selectedLine;
etk::Vector<etk::UString *> m_list;
int32_t m_selectedLine;
etk::Vector<appl::TagListElement*> m_list;
public:
TagFileList(void);
~TagFileList(void);
@@ -65,7 +73,7 @@ namespace appl {
* @param[in] jump line id
* @return ---
*/
void Add(etk::UString file, int32_t line);
void Add(etk::UString& file, int32_t line);
};
};

View File

@@ -133,7 +133,9 @@ appl::TagFileSelection::TagFileSelection(void)
if (NULL == m_listTag) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
} else {
//m_widgetListFolder->RegisterOnEvent(this, ewolEventFSFolderValidate, ewolEventFileChooserListFolder);
m_listTag->RegisterOnEvent(this, applEventCtagsListValidate);
m_listTag->RegisterOnEvent(this, applEventCtagsListSelect);
m_listTag->RegisterOnEvent(this, applEventCtagsListUnSelect);
m_listTag->SetExpendX(true);
m_listTag->SetExpendY(true);
m_listTag->SetFillX(true);
@@ -168,11 +170,22 @@ void appl::TagFileSelection::OnReceiveMessage(ewol::EObject * CallerObject, cons
{
EWOL_INFO("ctags LIST ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
if (eventId == applEventctagsSelection) {
GenerateEventId(eventId, "???");
if (m_eventNamed!="") {
GenerateEventId(applEventctagsSelection, m_eventNamed);
//==> Auto remove ...
AutoDestroy();
}
} else if (eventId == applEventCtagsListSelect) {
m_eventNamed = data;
} else if (eventId == applEventCtagsListUnSelect) {
m_eventNamed = "";
} else if (eventId == applEventCtagsListValidate) {
GenerateEventId(applEventctagsSelection, data);
//==> Auto remove ...
AutoDestroy();
} else if (eventId == applEventctagsCancel) {
//Nothing selected ...
GenerateEventId(applEventctagsCancel, "");
//==> Auto remove ...
AutoDestroy();
}

View File

@@ -39,6 +39,7 @@ namespace appl {
{
private:
appl::TagFileList* m_listTag;
etk::UString m_eventNamed;
public:
TagFileSelection(void);
virtual ~TagFileSelection(void);