CTAGS : Back is done but the display result is not the best I can do...

This commit is contained in:
Edouard Dupin 2011-08-24 09:44:10 +02:00
parent c30f57b3f7
commit 643f2e38b3
7 changed files with 67 additions and 8 deletions

View File

@ -137,7 +137,6 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
// nothing to do
}
/**
* @brief
*
@ -290,6 +289,21 @@ void Buffer::JumpAtLine(int32_t newLine)
// nothing to do
}
/**
* @brief Get the current line (to know where to jump)
*
* @param ---
*
* @return Return the current line number
*
*/
int32_t Buffer::GetCurrentLine(void)
{
return 0;
}
/**
* @brief request a copy of the selection in the named clipBoard ID
*

View File

@ -106,6 +106,7 @@ class Buffer {
virtual void Replace(Edn::String &data);
virtual int32_t FindLine(Edn::String &data);
virtual void JumpAtLine(int32_t newLine);
virtual int32_t GetCurrentLine(void);
protected:
bool m_fileModify; //!<

View File

@ -229,8 +229,6 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
}
void BufferText::DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t lineNumber, int32_t positionY)
{
char tmpLineNumber[50];
@ -1094,6 +1092,21 @@ void BufferText::JumpAtLine(int32_t newLine)
UpdateWindowsPosition(true);
}
/**
* @brief Get the current line (to know where to jump)
*
* @param ---
*
* @return Return the current line number
*
*/
int32_t BufferText::GetCurrentLine(void)
{
return m_EdnBuf.CountLines(0, m_cursorPos);
}
void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{
EDN_INFO("Search data : \"" << data << "\"");

View File

@ -65,6 +65,8 @@ class BufferText : public Buffer {
void Replace(Edn::String &data);
int32_t FindLine(Edn::String &data);
void JumpAtLine(int32_t newLine);
int32_t GetCurrentLine(void);
void RemoveLine(void);
void SelectAll(void);
void SelectNone(void);

View File

@ -119,7 +119,22 @@ void CTagsManager::OnMessage(int32_t id, int32_t dataID)
JumpTo();
break;
case EDN_MSG__JUMP_BACK:
EDN_INFO("TODO .... jump back");
if (m_historyList.Size() > 0) {
BufferManager *myBufferManager = BufferManager::getInstance();
int32_t id = m_historyList.Size()-1;
if (false == myBufferManager->Exist(*m_historyList[id]) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(*m_historyList[id]);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(*m_historyList[id]));
}
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, m_historyList[id]->GetLineNumber());
// Remove element ....
delete(m_historyList[id]);
m_historyList[id]=NULL;
m_historyList.PopBack();
}
break;
}
@ -169,10 +184,10 @@ enum
CTAGS_NUM_COLS
};
void CTagsManager::cb_row (GtkTreeView *p_treeview,
GtkTreePath * p_path,
GtkTreeViewColumn * p_column,
gpointer data)
void CTagsManager::cb_row(GtkTreeView *p_treeview,
GtkTreePath * p_path,
GtkTreeViewColumn * p_column,
gpointer data)
{
EDN_DEBUG("event");
CTagsManager * self = reinterpret_cast<CTagsManager*>(data);
@ -302,6 +317,15 @@ void CTagsManager::JumpAtID(int32_t selectID)
{
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::File myFile = m_currentList[selectID].filename;
EDN_INFO("save curent filename and position : ");
int32_t currentSelected = myBufferManager->GetSelected();
Buffer* tmpBuf = myBufferManager->Get(currentSelected);
if (NULL != tmpBuf) {
Edn::File * bufferFilename = new Edn::File();
*bufferFilename = tmpBuf->GetFileName();
bufferFilename->SetLineNumber(tmpBuf->GetCurrentLine());
m_historyList.PushBack(bufferFilename);
}
EDN_INFO(" OPEN the TAG file Destination : " << myFile );
if (false == myBufferManager->Exist(myFile) ) {
// need to open the file :

View File

@ -212,6 +212,10 @@ int32_t Edn::File::GetLineNumber(void)
return m_lineNumberOpen;
}
void Edn::File::SetLineNumber(int32_t newline)
{
m_lineNumberOpen = newline;
}
bool Edn::File::HasExtention(void)
{

View File

@ -44,6 +44,7 @@ namespace Edn
bool HasExtention(void);
Edn::String GetExtention(void);
int32_t GetLineNumber(void);
void SetLineNumber(int32_t newline);
void SetCompleateName(Edn::String &newFilename);
const Edn::File& operator= (const Edn::File &ednF );