[DEV][CTAGS] integration of the first ewol display version
This commit is contained in:
parent
7aa4f9ae4d
commit
33a36fa0f7
@ -66,6 +66,7 @@ void CodeView::Init(void)
|
|||||||
RegisterMultiCast(ednMsgGuiChangeCharset);
|
RegisterMultiCast(ednMsgGuiChangeCharset);
|
||||||
RegisterMultiCast(ednMsgGuiFind);
|
RegisterMultiCast(ednMsgGuiFind);
|
||||||
RegisterMultiCast(ednMsgGuiReplace);
|
RegisterMultiCast(ednMsgGuiReplace);
|
||||||
|
RegisterMultiCast(ednMsgGuiGotoLine);
|
||||||
SetLimitScrolling(0.2);
|
SetLimitScrolling(0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,21 +398,12 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
|||||||
} else if (data == "All") {
|
} else if (data == "All") {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else if (eventId == ednMsgGuiGotoLine) {
|
||||||
|
int32_t lineID = 0;
|
||||||
|
sscanf(data.c_str(), "%d", &lineID);
|
||||||
|
APPL_INFO("Goto line : " << lineID);
|
||||||
|
BufferManager::Get(m_bufferID)->JumpAtLine(lineID);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
switch (id)
|
|
||||||
{
|
|
||||||
case APPL_MSG__CURRENT_GOTO_LINE:
|
|
||||||
if (dataID<0) {
|
|
||||||
dataID = 0;
|
|
||||||
}
|
|
||||||
BufferManager::Get(m_bufferID)->JumpAtLine(dataID);
|
|
||||||
break;
|
|
||||||
case APPL_MSG__CURRENT_SET_CHARSET:
|
|
||||||
BufferManager::Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// Force redraw of the widget
|
// Force redraw of the widget
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
|
145
Sources/appl/Gui/TagFileList.cpp
Normal file
145
Sources/appl/Gui/TagFileList.cpp
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file TagFileList.cpp
|
||||||
|
* @brief Editeur De N'ours : Tags list display to jump (sources)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 16/10/2012
|
||||||
|
* @par Project
|
||||||
|
* Edn
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
* You can not earn money with this Software (if the source extract from Edn
|
||||||
|
* represent less than 50% of original Sources)
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||||
|
|
||||||
|
|
||||||
|
appl::TagFileList::TagFileList(void)
|
||||||
|
{
|
||||||
|
m_selectedLine = -1;
|
||||||
|
AddEventId(applEventCtagsListSelect);
|
||||||
|
AddEventId(applEventCtagsListValidate);
|
||||||
|
SetMouseLimit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
appl::TagFileList::~TagFileList(void)
|
||||||
|
{
|
||||||
|
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
||||||
|
if (NULL != m_list[iii]) {
|
||||||
|
delete(m_list[iii]);
|
||||||
|
m_list[iii] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
draw::Color appl::TagFileList::GetBasicBG(void) {
|
||||||
|
draw::Color bg(0x00000010);
|
||||||
|
return bg;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t appl::TagFileList::GetNuberOfColomn(void) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool appl::TagFileList::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) {
|
||||||
|
myTitle = "title";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t appl::TagFileList::GetNuberOfRaw(void) {
|
||||||
|
return m_list.Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
|
} else {
|
||||||
|
myTextToWrite = "ERROR";
|
||||||
|
}
|
||||||
|
fg = draw::color::black;
|
||||||
|
if (raw % 2) {
|
||||||
|
bg = 0xFFFFFF00;
|
||||||
|
} else {
|
||||||
|
bg = 0xBFBFBFFF;
|
||||||
|
}
|
||||||
|
if (m_selectedLine == raw) {
|
||||||
|
bg = 0x8F8FFFFF;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
|
||||||
|
{
|
||||||
|
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
||||||
|
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||||
|
if (1 == IdInput) {
|
||||||
|
int32_t previousRaw = m_selectedLine;
|
||||||
|
if (raw > m_list.Size() ) {
|
||||||
|
m_selectedLine = -1;
|
||||||
|
} else {
|
||||||
|
m_selectedLine = raw;
|
||||||
|
}
|
||||||
|
if (previousRaw != m_selectedLine) {
|
||||||
|
if( m_selectedLine >=0
|
||||||
|
&& m_selectedLine < m_list.Size()
|
||||||
|
&& NULL != m_list[m_selectedLine] ) {
|
||||||
|
GenerateEventId(applEventCtagsListSelect, *m_list[m_selectedLine]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if( m_selectedLine >=0
|
||||||
|
&& m_selectedLine < m_list.Size()
|
||||||
|
&& NULL != m_list[m_selectedLine] ) {
|
||||||
|
GenerateEventId(applEventCtagsListValidate, *m_list[m_selectedLine]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// need to regenerate the display of the list :
|
||||||
|
MarkToRedraw();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a Ctags item on the curent list
|
||||||
|
* @param[in] file Compleate file name
|
||||||
|
* @param[in] jump line id
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void appl::TagFileList::Add(etk::UString file, int32_t line)
|
||||||
|
{
|
||||||
|
etk::UString *tmpFile = new etk::UString(file);
|
||||||
|
if (NULL != tmpFile) {
|
||||||
|
m_list.PushBack(tmpFile);
|
||||||
|
}
|
||||||
|
MarkToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
76
Sources/appl/Gui/TagFileList.h
Normal file
76
Sources/appl/Gui/TagFileList.h
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file TagFileList.h
|
||||||
|
* @brief Editeur De N'ours : Tags list display to jump (header)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 16/10/2012
|
||||||
|
* @par Project
|
||||||
|
* Edn
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
* You can not earn money with this Software (if the source extract from Edn
|
||||||
|
* represent less than 50% of original Sources)
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __APPL_CTAGS_LIST_H__
|
||||||
|
#define __APPL_CTAGS_LIST_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include <etk/Types.h>
|
||||||
|
#include <appl/Debug.h>
|
||||||
|
#include <ewol/widget/List.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern const char * const applEventCtagsListSelect;
|
||||||
|
extern const char * const applEventCtagsListValidate;
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
|
class TagFileList : public ewol::List
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
int32_t m_selectedLine;
|
||||||
|
etk::Vector<etk::UString *> m_list;
|
||||||
|
public:
|
||||||
|
TagFileList(void);
|
||||||
|
~TagFileList(void);
|
||||||
|
// display API :
|
||||||
|
virtual draw::Color GetBasicBG(void);
|
||||||
|
uint32_t GetNuberOfColomn(void);
|
||||||
|
bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
|
||||||
|
uint32_t GetNuberOfRaw(void);
|
||||||
|
bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
|
||||||
|
bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
|
||||||
|
/**
|
||||||
|
* @brief Get the current Object type of the EObject
|
||||||
|
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||||
|
* @param[in] objectType type description
|
||||||
|
* @return true if the object is compatible, otherwise false
|
||||||
|
*/
|
||||||
|
const char * const GetObjectType(void) { return "TagFileList"; };
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Add a Ctags item on the curent list
|
||||||
|
* @param[in] file Compleate file name
|
||||||
|
* @param[in] jump line id
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void Add(etk::UString file, int32_t line);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
216
Sources/appl/Gui/TagFileSelection.cpp
Normal file
216
Sources/appl/Gui/TagFileSelection.cpp
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file TagFileSelection.cpp
|
||||||
|
* @brief Editeur De N'ours : Tags list selection to jump (sources)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 16/10/2012
|
||||||
|
* @par Project
|
||||||
|
* Edn
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
* You can not earn money with this Software (if the source extract from Edn
|
||||||
|
* represent less than 50% of original Sources)
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file ewol/widget/meta/FileChooser.cpp
|
||||||
|
* @brief ewol File chooser meta widget system (Sources)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 29/12/2011
|
||||||
|
* @par Project
|
||||||
|
* ewol
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
*
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <appl/Gui/TagFileSelection.h>
|
||||||
|
#include <ewol/widget/SizerHori.h>
|
||||||
|
#include <ewol/widget/SizerVert.h>
|
||||||
|
#include <ewol/widget/List.h>
|
||||||
|
#include <ewol/widget/Spacer.h>
|
||||||
|
#include <ewol/widget/Image.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
#include <etk/Vector.h>
|
||||||
|
#include <etk/tool.h>
|
||||||
|
#include <ewol/widget/Button.h>
|
||||||
|
#include <ewol/widget/Label.h>
|
||||||
|
|
||||||
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "TagFileSelection"
|
||||||
|
|
||||||
|
|
||||||
|
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
||||||
|
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||||
|
|
||||||
|
|
||||||
|
appl::TagFileSelection::TagFileSelection(void)
|
||||||
|
{
|
||||||
|
AddEventId(applEventctagsSelection);
|
||||||
|
AddEventId(applEventctagsCancel);
|
||||||
|
|
||||||
|
ewol::Label* myWidgetTitle = NULL;
|
||||||
|
ewol::Button* myWidgetValidate = NULL;
|
||||||
|
ewol::Button* myWidgetCancel = NULL;
|
||||||
|
|
||||||
|
ewol::SizerVert * mySizerVert = NULL;
|
||||||
|
ewol::SizerHori * mySizerHori = NULL;
|
||||||
|
ewol::Spacer * mySpacer = NULL;
|
||||||
|
#if defined(__TARGET_OS__Android)
|
||||||
|
SetDisplayRatio(0.90);
|
||||||
|
#elif defined(__TARGET_OS__Windows)
|
||||||
|
SetDisplayRatio(0.80);
|
||||||
|
#else
|
||||||
|
SetDisplayRatio(0.80);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mySizerVert = new ewol::SizerVert();
|
||||||
|
if (NULL == mySizerVert) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
mySizerVert->LockExpendContamination(true);
|
||||||
|
// set it in the pop-up-system :
|
||||||
|
SubWidgetSet(mySizerVert);
|
||||||
|
|
||||||
|
mySizerHori = new ewol::SizerHori();
|
||||||
|
if (NULL == mySizerHori) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||||
|
mySpacer = new ewol::Spacer();
|
||||||
|
if (NULL == mySpacer) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
mySpacer->SetExpendX(true);
|
||||||
|
mySizerHori->SubWidgetAdd(mySpacer);
|
||||||
|
}
|
||||||
|
myWidgetValidate = new ewol::Button("Jump");
|
||||||
|
if (NULL == myWidgetValidate) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
myWidgetValidate->SetImage("icon/Load.svg");
|
||||||
|
myWidgetValidate->RegisterOnEvent(this, ewolEventButtonPressed, applEventctagsSelection);
|
||||||
|
mySizerHori->SubWidgetAdd(myWidgetValidate);
|
||||||
|
}
|
||||||
|
myWidgetCancel = new ewol::Button("Cancel");
|
||||||
|
if (NULL == myWidgetCancel) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
myWidgetCancel->SetImage("icon/Remove.svg");
|
||||||
|
myWidgetCancel->RegisterOnEvent(this, ewolEventButtonPressed, applEventctagsCancel);
|
||||||
|
mySizerHori->SubWidgetAdd(myWidgetCancel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_listTag = new appl::TagFileList();
|
||||||
|
if (NULL == m_listTag) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
//m_widgetListFolder->RegisterOnEvent(this, ewolEventFSFolderValidate, ewolEventFileChooserListFolder);
|
||||||
|
m_listTag->SetExpendX(true);
|
||||||
|
m_listTag->SetExpendY(true);
|
||||||
|
m_listTag->SetFillX(true);
|
||||||
|
m_listTag->SetFillY(true);
|
||||||
|
mySizerVert->SubWidgetAdd(m_listTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
myWidgetTitle = new ewol::Label("Ctags Jump Selection ...");
|
||||||
|
if (NULL == myWidgetTitle) {
|
||||||
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
|
} else {
|
||||||
|
mySizerVert->SubWidgetAdd(myWidgetTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
appl::TagFileSelection::~TagFileSelection(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||||
|
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||||
|
* @param[in] eventId Message registered by this class
|
||||||
|
* @param[in] data Data registered by this class
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void appl::TagFileSelection::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||||
|
{
|
||||||
|
EWOL_INFO("ctags LIST ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||||
|
if (eventId == applEventctagsSelection) {
|
||||||
|
GenerateEventId(eventId, "???");
|
||||||
|
//==> Auto remove ...
|
||||||
|
AutoDestroy();
|
||||||
|
} else if (eventId == applEventctagsCancel) {
|
||||||
|
//Nothing selected ...
|
||||||
|
//==> Auto remove ...
|
||||||
|
AutoDestroy();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a Ctags item on the curent list
|
||||||
|
* @param[in] file Compleate file name
|
||||||
|
* @param[in] jump line id
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void appl::TagFileSelection::AddCtagsNewItem(etk::UString file, int32_t line)
|
||||||
|
{
|
||||||
|
if (NULL != m_listTag) {
|
||||||
|
m_listTag->Add(file, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Inform object that an other object is removed ...
|
||||||
|
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||||
|
* @note : Sub classes must call this class
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void appl::TagFileSelection::OnObjectRemove(ewol::EObject * removeObject)
|
||||||
|
{
|
||||||
|
// First step call parrent :
|
||||||
|
ewol::PopUp::OnObjectRemove(m_listTag);
|
||||||
|
// second step find if in all the elements ...
|
||||||
|
if(removeObject == m_listTag) {
|
||||||
|
m_listTag = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
79
Sources/appl/Gui/TagFileSelection.h
Normal file
79
Sources/appl/Gui/TagFileSelection.h
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file TagFileSelection.h
|
||||||
|
* @brief Editeur De N'ours : Tags list selection to jump (header)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 16/10/2012
|
||||||
|
* @par Project
|
||||||
|
* Edn
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
* You can not earn money with this Software (if the source extract from Edn
|
||||||
|
* represent less than 50% of original Sources)
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __APPL_CTAGS_SELECTION_H__
|
||||||
|
#define __APPL_CTAGS_SELECTION_H__
|
||||||
|
|
||||||
|
#include <etk/Types.h>
|
||||||
|
#include <appl/Debug.h>
|
||||||
|
#include <ewol/widget/PopUp.h>
|
||||||
|
#include <appl/Gui/TagFileList.h>
|
||||||
|
|
||||||
|
extern const char * const applEventctagsSelection;
|
||||||
|
extern const char * const applEventctagsCancel;
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
|
class TagFileSelection : public ewol::PopUp
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
appl::TagFileList* m_listTag;
|
||||||
|
public:
|
||||||
|
TagFileSelection(void);
|
||||||
|
virtual ~TagFileSelection(void);
|
||||||
|
/**
|
||||||
|
* @brief Get the current Object type of the EObject
|
||||||
|
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||||
|
* @param[in] objectType type description
|
||||||
|
* @return true if the object is compatible, otherwise false
|
||||||
|
*/
|
||||||
|
const char * const GetObjectType(void) { return "EwolFileChooser"; };
|
||||||
|
/**
|
||||||
|
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||||
|
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||||
|
* @param[in] eventId Message registered by this class
|
||||||
|
* @param[in] data Data registered by this class
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||||
|
/**
|
||||||
|
* @brief Inform object that an other object is removed ...
|
||||||
|
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||||
|
* @note : Sub classes must call this class
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void OnObjectRemove(ewol::EObject * removeObject);
|
||||||
|
/**
|
||||||
|
* @brief Add a Ctags item on the curent list
|
||||||
|
* @param[in] file Compleate file name
|
||||||
|
* @param[in] jump line id
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void AddCtagsNewItem(etk::UString file, int32_t line);
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -28,12 +28,89 @@
|
|||||||
#include <CTagsManager.h>
|
#include <CTagsManager.h>
|
||||||
#include <BufferManager.h>
|
#include <BufferManager.h>
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/eObject/EObject.h>
|
||||||
|
#include <ewol/widget/meta/FileChooser.h>
|
||||||
|
#include <appl/Gui/TagFileSelection.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "CTagsManager"
|
#define __class__ "CTagsManager"
|
||||||
#if 0
|
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
char filename[MAX_FILE_NAME];
|
||||||
|
char RegExp[MAX_REG_EXP_SEARCH];
|
||||||
|
int32_t lineID;
|
||||||
|
} TagListFind_ts;
|
||||||
|
|
||||||
|
class CTagsManager: public ewol::EObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructeur
|
||||||
|
CTagsManager(void);
|
||||||
|
~CTagsManager(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the current Object type of the EObject
|
||||||
|
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||||
|
* @param[in] objectType type description
|
||||||
|
* @return true if the object is compatible, otherwise false
|
||||||
|
*/
|
||||||
|
const char * const GetObjectType(void)
|
||||||
|
{
|
||||||
|
return "CTagsManager";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||||
|
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||||
|
* @param[in] eventId Message registered by this class
|
||||||
|
* @param[in] data Data registered by this class
|
||||||
|
* @return ---
|
||||||
|
*/
|
||||||
|
void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||||
|
|
||||||
|
int32_t m_currentSelectedID;
|
||||||
|
void LoadTagFile(void);
|
||||||
|
int32_t MultipleJump(void);
|
||||||
|
void JumpTo(void);
|
||||||
|
void PrintTag(const tagEntry *entry, bool small);
|
||||||
|
etk::UString GetFolder(etk::UString &inputString);
|
||||||
|
etk::UString m_tagFolderBase;
|
||||||
|
etk::UString m_tagFilename;
|
||||||
|
tagFile * m_ctagFile;
|
||||||
|
// history system
|
||||||
|
void AddToHistory(int32_t bufferID);
|
||||||
|
int32_t m_historyPos;
|
||||||
|
etk::Vector<etk::File*> m_historyList;
|
||||||
|
etk::Vector<TagListFind_ts> m_currentList;
|
||||||
|
void JumpAtID(int32_t selectID);
|
||||||
|
};
|
||||||
|
|
||||||
|
static CTagsManager* s_elementPointer = NULL;
|
||||||
|
void cTagsManager::Init(void)
|
||||||
|
{
|
||||||
|
if (NULL != s_elementPointer) {
|
||||||
|
delete(s_elementPointer);
|
||||||
|
s_elementPointer = NULL;
|
||||||
|
EWOL_WARNING("Ctags manager already instanciate ... ==> restart IT");
|
||||||
|
}
|
||||||
|
s_elementPointer = new CTagsManager();
|
||||||
|
if (NULL != s_elementPointer) {
|
||||||
|
EWOL_ERROR("Ctags manager error to instanciate ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void cTagsManager::UnInit(void)
|
||||||
|
{
|
||||||
|
if (NULL != s_elementPointer) {
|
||||||
|
delete(s_elementPointer);
|
||||||
|
s_elementPointer = NULL;
|
||||||
|
} else {
|
||||||
|
EWOL_ERROR("Ctags manager not instanciate ... ==> can not remove it ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@ -48,7 +125,9 @@ CTagsManager::CTagsManager(void)
|
|||||||
m_tagFolderBase = "";
|
m_tagFolderBase = "";
|
||||||
m_ctagFile = NULL;
|
m_ctagFile = NULL;
|
||||||
m_historyPos = 0;
|
m_historyPos = 0;
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiCtags);
|
RegisterMultiCast(ednMsgGuiCtags);
|
||||||
|
RegisterMultiCast(ednMsgBufferId);
|
||||||
|
EWOL_INFO("Ctags manager (INIT)");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,14 +140,13 @@ CTagsManager::CTagsManager(void)
|
|||||||
*/
|
*/
|
||||||
CTagsManager::~CTagsManager(void)
|
CTagsManager::~CTagsManager(void)
|
||||||
{
|
{
|
||||||
/*
|
EWOL_INFO("Ctags manager (Un-INIT)");
|
||||||
if(0 != m_historyList.Size()) {
|
if(0 != m_historyList.Size()) {
|
||||||
for (int32_t iii=0; iii< m_historyList.Size(); iii++) {
|
for (int32_t iii=0; iii< m_historyList.Size(); iii++) {
|
||||||
delete(m_historyList[iii]);
|
delete(m_historyList[iii]);
|
||||||
}
|
}
|
||||||
m_historyList.Clear();
|
m_historyList.Clear();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::UString CTagsManager::GetFolder(etk::UString &inputString)
|
etk::UString CTagsManager::GetFolder(etk::UString &inputString)
|
||||||
@ -93,65 +171,55 @@ etk::UString CTagsManager::GetFolder(etk::UString &inputString)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTagsManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, float x, float y)
|
const char * ednEventPopUpCtagsLoadFile = "edn-event-load-ctags";
|
||||||
|
|
||||||
|
void CTagsManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||||
{
|
{
|
||||||
/*
|
if (eventId == ednMsgBufferId) {
|
||||||
switch (id)
|
//m_currentSelectedID = dataID;
|
||||||
{
|
} else if (eventId == ednEventPopUpCtagsLoadFile) {
|
||||||
case APPL_MSG__BUFFER_CHANGE_CURRENT:
|
// open the new one :
|
||||||
m_currentSelectedID = dataID;
|
etk::File tmpFilename = data;
|
||||||
break;
|
m_tagFilename = tmpFilename.GetShortFilename();
|
||||||
case APPL_MSG__OPEN_CTAGS:
|
m_tagFolderBase = tmpFilename.GetFolder();
|
||||||
|
APPL_DEBUG("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
|
||||||
|
LoadTagFile();
|
||||||
|
} else if (eventId == ednMsgGuiCtags) {
|
||||||
|
if (data == "Load") {
|
||||||
APPL_INFO("Request opening ctag file");
|
APPL_INFO("Request opening ctag file");
|
||||||
{
|
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
|
||||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL,
|
if (NULL == tmpWidget) {
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
} else {
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
tmpWidget->SetTitle("Open Exuberant Ctags File");
|
||||||
NULL); // end button/response list
|
tmpWidget->SetValidateLabel("Open");
|
||||||
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
PopUpWidgetPush(tmpWidget);
|
||||||
{
|
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpCtagsLoadFile);
|
||||||
// open the new one :
|
|
||||||
m_tagFilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
|
|
||||||
m_tagFolderBase = GetFolder(m_tagFilename);
|
|
||||||
LoadTagFile();
|
|
||||||
}
|
|
||||||
gtk_widget_destroy(dialog);
|
|
||||||
}
|
}
|
||||||
break;
|
} else if (data == "ReLoad") {
|
||||||
case APPL_MSG__RELOAD_CTAGS:
|
APPL_INFO("Request re-load ctag file");
|
||||||
LoadTagFile();
|
LoadTagFile();
|
||||||
break;
|
} else if (data == "Jump") {
|
||||||
case APPL_MSG__JUMP_TO_CURRENT_SELECTION:
|
|
||||||
JumpTo();
|
JumpTo();
|
||||||
break;
|
} else if (data == "Back") {
|
||||||
case APPL_MSG__JUMP_BACK:
|
|
||||||
if (m_historyList.Size() > 0) {
|
if (m_historyList.Size() > 0) {
|
||||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
|
||||||
int32_t id = m_historyList.Size()-1;
|
int32_t id = m_historyList.Size()-1;
|
||||||
if (false == myBufferManager->Exist(*m_historyList[id]) ) {
|
SendMultiCast(ednMsgOpenFile, m_historyList[id]->GetCompleateName() );
|
||||||
// need to open the file :
|
SendMultiCast(ednMsgGuiGotoLine, m_historyList[id]->GetLineNumber());
|
||||||
int32_t openID = myBufferManager->Open(*m_historyList[id]);
|
|
||||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
|
|
||||||
} else {
|
|
||||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(*m_historyList[id]));
|
|
||||||
}
|
|
||||||
SendMessage(APPL_MSG__CURRENT_GOTO_LINE, m_historyList[id]->GetLineNumber());
|
|
||||||
// Remove element ....
|
// Remove element ....
|
||||||
delete(m_historyList[id]);
|
delete(m_historyList[id]);
|
||||||
m_historyList[id]=NULL;
|
m_historyList[id]=NULL;
|
||||||
m_historyList.PopBack();
|
m_historyList.PopBack();
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CTagsManager::LoadTagFile(void)
|
void CTagsManager::LoadTagFile(void)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
tagFileInfo info;
|
tagFileInfo info;
|
||||||
|
|
||||||
// close previous tag file
|
// close previous tag file
|
||||||
@ -170,156 +238,45 @@ void CTagsManager::LoadTagFile(void)
|
|||||||
} else {
|
} else {
|
||||||
APPL_INFO("Error to open ctags file ...");
|
APPL_INFO("Error to open ctags file ...");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTagsManager::AddToHistory(int32_t bufferID)
|
void CTagsManager::AddToHistory(int32_t bufferID)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
// check tho history position : remove if needed
|
// check tho history position : remove if needed
|
||||||
if (m_historyPos < edn_max(m_historyList.Size()-1, 0) ) {
|
if (m_historyPos < etk_max(m_historyList.Size()-1, 0) ) {
|
||||||
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
|
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
|
||||||
delete(m_historyList[iii]);
|
delete(m_historyList[iii]);
|
||||||
}
|
}
|
||||||
m_historyList.EraseLen(m_historyPos, m_historyList.Size() - m_historyPos);
|
m_historyList.EraseLen(m_historyPos, m_historyList.Size() - m_historyPos);
|
||||||
}
|
}
|
||||||
// add the current element
|
// add the current element
|
||||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
etk::File currentFilename = BufferManager::Get(bufferID)->GetFileName();
|
||||||
etk::File currentFilename = myBufferManager->Get(bufferID)->GetFileName();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
CTAGS_COL_FILE = 0,
|
|
||||||
CTAGS_COL_LINE_NUMBER,
|
|
||||||
CTAGS_NUM_COLS
|
|
||||||
};
|
|
||||||
void CTagsManager::cb_row(GtkTreeView *p_treeview,
|
|
||||||
GtkTreePath * p_path,
|
|
||||||
GtkTreeViewColumn * p_column,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
APPL_DEBUG("event");
|
|
||||||
CTagsManager * self = static_cast<CTagsManager*>(data);
|
|
||||||
|
|
||||||
gchar * p_file=NULL;
|
|
||||||
gint lineNumber;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
|
|
||||||
if (gtk_tree_model_get_iter( GTK_TREE_MODEL(self->m_listStore), &iter, p_path))
|
|
||||||
{
|
|
||||||
gtk_tree_model_get( GTK_TREE_MODEL(self->m_listStore),
|
|
||||||
&iter,
|
|
||||||
CTAGS_COL_FILE, &p_file,
|
|
||||||
CTAGS_COL_LINE_NUMBER, &lineNumber,
|
|
||||||
-1 );
|
|
||||||
APPL_DEBUG("find : " << p_file << ":" << lineNumber);
|
|
||||||
for (int32_t iii = 0; iii < self->m_currentList.Size() ; iii++) {
|
|
||||||
if( self->m_currentList[iii].lineID == lineNumber
|
|
||||||
&& strcmp(self->m_currentList[iii].filename, p_file)==0)
|
|
||||||
{
|
|
||||||
g_object_unref( GTK_TREE_MODEL(self->m_listStore));
|
|
||||||
// Remove dialogue
|
|
||||||
gtk_widget_destroy(self->m_Dialog);
|
|
||||||
// Jump ...
|
|
||||||
self->JumpAtID(iii);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
GtkWidget * CTagsManager::CreateViewAndModel(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
GtkCellRenderer * renderer;
|
|
||||||
GtkWidget * view;
|
|
||||||
view = gtk_tree_view_new();
|
|
||||||
|
|
||||||
// Column 1
|
|
||||||
renderer = gtk_cell_renderer_text_new();
|
|
||||||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
|
|
||||||
-1,
|
|
||||||
"File",
|
|
||||||
renderer,
|
|
||||||
"text", CTAGS_COL_FILE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
// Column 2
|
|
||||||
renderer = gtk_cell_renderer_text_new();
|
|
||||||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
|
|
||||||
-1,
|
|
||||||
"lineNumber",
|
|
||||||
renderer,
|
|
||||||
"text", CTAGS_COL_LINE_NUMBER,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
// Set data in the list :
|
|
||||||
GtkTreeIter iter;
|
|
||||||
m_listStore = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
|
|
||||||
// Append a row and fill in some data
|
|
||||||
for (int32_t iii=0; iii<m_currentList.Size() ; iii++) {
|
|
||||||
gtk_list_store_append(m_listStore, &iter);
|
|
||||||
gtk_list_store_set(m_listStore, &iter,
|
|
||||||
CTAGS_COL_FILE, m_currentList[iii].filename,
|
|
||||||
CTAGS_COL_LINE_NUMBER, m_currentList[iii].lineID,
|
|
||||||
-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tree_view_set_model( GTK_TREE_VIEW(view), GTK_TREE_MODEL(m_listStore) );
|
|
||||||
g_signal_connect( G_OBJECT(view), "row-activated", G_CALLBACK(cb_row), this );
|
|
||||||
//g_object_unref(GTK_TREE_MODEL(m_listStore));
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int32_t CTagsManager::MultipleJump(void)
|
int32_t CTagsManager::MultipleJump(void)
|
||||||
{
|
{
|
||||||
/*
|
APPL_INFO("Multiple file destination ...");
|
||||||
// dlg to confirm the quit event :
|
appl::TagFileSelection* tmpWidget = new appl::TagFileSelection();
|
||||||
m_Dialog = gtk_dialog_new_with_buttons("C-Tags jump...",
|
if (NULL == tmpWidget) {
|
||||||
NULL,
|
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
GTK_DIALOG_MODAL,
|
} else {
|
||||||
//"Jump", GTK_RESPONSE_YES,
|
for (int32_t iii=0; iii<m_currentList.Size() ; iii++) {
|
||||||
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
|
tmpWidget->AddCtagsNewItem(m_currentList[iii].filename, m_currentList[iii].lineID);
|
||||||
NULL);
|
}
|
||||||
// Set over main windows
|
PopUpWidgetPush(tmpWidget);
|
||||||
//gtk_window_set_transient_for(GTK_WINDOW(myDialog), GTK_WINDOW(m_mainWindow->GetWidget()));
|
tmpWidget->RegisterOnEvent(this, applEventctagsSelection);
|
||||||
// add writting area
|
|
||||||
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(m_Dialog));
|
|
||||||
GtkWidget *listView = CreateViewAndModel();
|
|
||||||
gtk_box_pack_start(GTK_BOX(myContentArea), listView, TRUE, TRUE, 0);
|
|
||||||
// Display it
|
|
||||||
gtk_widget_show_all(myContentArea);
|
|
||||||
int32_t result = gtk_dialog_run(GTK_DIALOG(m_Dialog));
|
|
||||||
// Get data from the gtk entry
|
|
||||||
if (result == GTK_RESPONSE_NO) {
|
|
||||||
g_object_unref(GTK_TREE_MODEL(m_listStore));
|
|
||||||
// Remove dialogue
|
|
||||||
gtk_widget_destroy(m_Dialog);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CTagsManager::JumpAtID(int32_t selectID)
|
void CTagsManager::JumpAtID(int32_t selectID)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
|
||||||
etk::File myFile = m_currentList[selectID].filename;
|
etk::File myFile = m_currentList[selectID].filename;
|
||||||
APPL_INFO("save curent filename and position : ");
|
APPL_INFO("save curent filename and position : ");
|
||||||
int32_t currentSelected = myBufferManager->GetSelected();
|
int32_t currentSelected = BufferManager::GetSelected();
|
||||||
Buffer* tmpBuf = myBufferManager->Get(currentSelected);
|
Buffer* tmpBuf = BufferManager::Get(currentSelected);
|
||||||
if (NULL != tmpBuf) {
|
if (NULL != tmpBuf) {
|
||||||
etk::File * bufferFilename = new etk::File();
|
etk::File * bufferFilename = new etk::File();
|
||||||
*bufferFilename = tmpBuf->GetFileName();
|
*bufferFilename = tmpBuf->GetFileName();
|
||||||
@ -327,40 +284,33 @@ void CTagsManager::JumpAtID(int32_t selectID)
|
|||||||
m_historyList.PushBack(bufferFilename);
|
m_historyList.PushBack(bufferFilename);
|
||||||
}
|
}
|
||||||
APPL_INFO(" OPEN the TAG file Destination : " << myFile );
|
APPL_INFO(" OPEN the TAG file Destination : " << myFile );
|
||||||
if (false == myBufferManager->Exist(myFile) ) {
|
SendMultiCast(ednMsgOpenFile, myFile.GetCompleateName());
|
||||||
// need to open the file :
|
SendMultiCast(ednMsgGuiGotoLine, m_currentList[selectID].lineID - 1);
|
||||||
int32_t openID = myBufferManager->Open(myFile);
|
|
||||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
|
|
||||||
} else {
|
|
||||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myFile));
|
|
||||||
}
|
|
||||||
SendMessage(APPL_MSG__CURRENT_GOTO_LINE, m_currentList[selectID].lineID - 1);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CTagsManager::JumpTo(void)
|
void CTagsManager::JumpTo(void)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
m_currentList.Clear();
|
m_currentList.Clear();
|
||||||
if (NULL != m_ctagFile) {
|
if (NULL != m_ctagFile) {
|
||||||
etk::Vector<int8_t> data;
|
|
||||||
// get the middle button of the clipboard ==> represent the current selection ...
|
// get the middle button of the clipboard ==> represent the current selection ...
|
||||||
ClipBoard::Get(COPY_MIDDLE_BUTTON, data);
|
etk::UString data = ewol::clipBoard::Get(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||||
|
APPL_DEBUG("clipboard data : \"" << data << "\"");
|
||||||
if (data.Size() == 0) {
|
if (data.Size() == 0) {
|
||||||
APPL_INFO("No current S\E9lection");
|
APPL_INFO("No current selection");
|
||||||
}
|
}
|
||||||
tagEntry entry;
|
tagEntry entry;
|
||||||
data.PushBack('\0');
|
APPL_INFO("try to find the tag : " << data);
|
||||||
APPL_INFO("try to find the tag : " << (const char *)&data[0]);
|
if (tagsFind (m_ctagFile, &entry, data.c_str(), 0) == TagSuccess) {
|
||||||
if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) {
|
|
||||||
tagEntry entrySave = entry;
|
tagEntry entrySave = entry;
|
||||||
int32_t numberOfTags = 0;
|
int32_t numberOfTags = 0;
|
||||||
|
|
||||||
// For all tags : Save in an internal Structure :
|
// For all tags : Save in an internal Structure :
|
||||||
do {
|
do {
|
||||||
etk::UString destinationFilename = m_tagFolderBase;
|
etk::UString destinationFilename = m_tagFolderBase;
|
||||||
|
destinationFilename += "/";
|
||||||
destinationFilename += entry.file;
|
destinationFilename += entry.file;
|
||||||
|
APPL_WARNING("plop : \"" << destinationFilename << "\" from : " << m_tagFolderBase << " " << entry.file);
|
||||||
etk::File myfile = destinationFilename;
|
etk::File myfile = destinationFilename;
|
||||||
TagListFind_ts myStruct;
|
TagListFind_ts myStruct;
|
||||||
strncpy(myStruct.filename, myfile.GetCompleateName().c_str(), MAX_FILE_NAME);
|
strncpy(myStruct.filename, myfile.GetCompleateName().c_str(), MAX_FILE_NAME);
|
||||||
@ -376,7 +326,6 @@ void CTagsManager::JumpTo(void)
|
|||||||
|
|
||||||
if (1==m_currentList.Size() ) {
|
if (1==m_currentList.Size() ) {
|
||||||
JumpAtID(0);
|
JumpAtID(0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Open a choice windows...
|
// Open a choice windows...
|
||||||
int32_t SelectID = MultipleJump();
|
int32_t SelectID = MultipleJump();
|
||||||
@ -385,19 +334,19 @@ void CTagsManager::JumpTo(void)
|
|||||||
APPL_INFO("no tag find ...");
|
APPL_INFO("no tag find ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
|
||||||
void CTagsManager::PrintTag (const tagEntry *entry, bool small)
|
void CTagsManager::PrintTag (const tagEntry *entry, bool small)
|
||||||
{
|
{
|
||||||
if (small==true) {
|
if (small==true) {
|
||||||
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
||||||
<< "\" at line="<< entry->address.lineNumber);
|
<< "\" at line="<< (int32_t)entry->address.lineNumber);
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
||||||
<< "\" pattern=\"" <<entry->address.pattern
|
<< "\" pattern=\"" << entry->address.pattern
|
||||||
<< "\" at line="<<entry->address.lineNumber);
|
<< "\" at line="<< (int32_t)entry->address.lineNumber);
|
||||||
|
|
||||||
APPL_INFO("Extention field : ");
|
APPL_INFO("Extention field : ");
|
||||||
if (entry->kind != NULL && entry->kind [0] != '\0') {
|
if (entry->kind != NULL && entry->kind [0] != '\0') {
|
||||||
@ -411,7 +360,4 @@ void CTagsManager::PrintTag (const tagEntry *entry, bool small)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -33,40 +33,11 @@
|
|||||||
|
|
||||||
#define MAX_REG_EXP_SEARCH (1024)
|
#define MAX_REG_EXP_SEARCH (1024)
|
||||||
|
|
||||||
typedef struct{
|
namespace cTagsManager
|
||||||
char filename[MAX_FILE_NAME];
|
|
||||||
char RegExp[MAX_REG_EXP_SEARCH];
|
|
||||||
int32_t lineID;
|
|
||||||
} TagListFind_ts;
|
|
||||||
|
|
||||||
/*
|
|
||||||
class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
|
|
||||||
{
|
{
|
||||||
friend class etk::Singleton<CTagsManager>;
|
void Init(void);
|
||||||
// specific for sigleton system...
|
void UnInit(void);
|
||||||
private:
|
|
||||||
// Constructeur
|
|
||||||
CTagsManager(void);
|
|
||||||
~CTagsManager(void);
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, float x, float y);
|
|
||||||
private:
|
|
||||||
int32_t m_currentSelectedID;
|
|
||||||
void LoadTagFile(void);
|
|
||||||
int32_t MultipleJump(void);
|
|
||||||
void JumpTo(void);
|
|
||||||
void PrintTag(const tagEntry *entry, bool small);
|
|
||||||
etk::UString GetFolder(etk::UString &inputString);
|
|
||||||
etk::UString m_tagFolderBase;
|
|
||||||
etk::UString m_tagFilename;
|
|
||||||
tagFile * m_ctagFile;
|
|
||||||
// history system
|
|
||||||
void AddToHistory(int32_t bufferID);
|
|
||||||
int32_t m_historyPos;
|
|
||||||
etk::Vector<etk::File*> m_historyList;
|
|
||||||
etk::Vector<TagListFind_ts> m_currentList;
|
|
||||||
void JumpAtID(int32_t selectID);
|
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,6 +89,7 @@ void APP_Init(void)
|
|||||||
|
|
||||||
HighlightManager::Init();
|
HighlightManager::Init();
|
||||||
HighlightManager::loadLanguages();
|
HighlightManager::loadLanguages();
|
||||||
|
cTagsManager::Init();
|
||||||
|
|
||||||
char cCurrentPath[FILENAME_MAX];
|
char cCurrentPath[FILENAME_MAX];
|
||||||
// get the curent program folder
|
// get the curent program folder
|
||||||
@ -135,6 +136,8 @@ void APP_Init(void)
|
|||||||
ewol::shortCut::Add("ctrl+f", ednMsgGuiSearch, "");
|
ewol::shortCut::Add("ctrl+f", ednMsgGuiSearch, "");
|
||||||
ewol::shortCut::Add("F12", ednMsgGuiReloadShader, "");
|
ewol::shortCut::Add("F12", ednMsgGuiReloadShader, "");
|
||||||
|
|
||||||
|
ewol::shortCut::Add("ctrl+d", ednMsgGuiCtags, "Jump");
|
||||||
|
|
||||||
|
|
||||||
// add files
|
// add files
|
||||||
APPL_INFO("show list of files : ");
|
APPL_INFO("show list of files : ");
|
||||||
@ -164,6 +167,8 @@ void APP_UnInit(void)
|
|||||||
// Remove windows :
|
// Remove windows :
|
||||||
ewol::DisplayWindows(NULL);
|
ewol::DisplayWindows(NULL);
|
||||||
|
|
||||||
|
cTagsManager::UnInit();
|
||||||
|
|
||||||
APPL_INFO("Stop Hightlight");
|
APPL_INFO("Stop Hightlight");
|
||||||
HighlightManager::UnInit();
|
HighlightManager::UnInit();
|
||||||
//Kill all singleton
|
//Kill all singleton
|
||||||
|
@ -18,7 +18,9 @@ FILE_LIST+= appl/Gui/BufferView.cpp \
|
|||||||
appl/Gui/CodeView.cpp \
|
appl/Gui/CodeView.cpp \
|
||||||
appl/Gui/MainWindows.cpp \
|
appl/Gui/MainWindows.cpp \
|
||||||
appl/Gui/Search.cpp \
|
appl/Gui/Search.cpp \
|
||||||
appl/Gui/SearchData.cpp
|
appl/Gui/SearchData.cpp \
|
||||||
|
appl/Gui/TagFileSelection.cpp \
|
||||||
|
appl/Gui/TagFileList.cpp
|
||||||
|
|
||||||
# All needed for the buffer management :
|
# All needed for the buffer management :
|
||||||
FILE_LIST+= appl/Buffer/EdnVectorBuf.cpp \
|
FILE_LIST+= appl/Buffer/EdnVectorBuf.cpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user