CTAGS : Set the display of the file for the multiple jump list .

TODO : Set the selection keep when press jump button
TODO : Double click on a specific raw
This commit is contained in:
Edouard Dupin 2011-08-10 15:56:48 +02:00
parent 1f8d3cf045
commit f5911d5463
5 changed files with 231 additions and 176 deletions

View File

@ -160,56 +160,45 @@ void CTagsManager::AddToHistory(int32_t bufferID)
// add the current element
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::File currentFilename = myBufferManager->Get(bufferID)->GetFileName();
}
enum
{
CTAGS_COL_FILE = 0,
CTAGS_COL_REGEXP,
CTAGS_COL_LINE_NUMBER,
CTAGS_NUM_COLS
};
static GtkTreeModel * create_and_fill_model(void)
GtkTreeModel * CTagsManager::CreateAndFillModel(void)
{
GtkListStore * store;
GtkTreeIter iter;
store = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
store = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
// Append a row and fill in some data
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file1.c",
CTAGS_COL_REGEXP, "void function1(void);",
-1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file2.c",
CTAGS_COL_REGEXP, "void function2(void);",
-1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file3.c",
CTAGS_COL_REGEXP, "void function3(void);",
-1);
for (int32_t iii=0; iii<m_currentList.Size() ; iii++) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, m_currentList[iii].filename,
CTAGS_COL_LINE_NUMBER, m_currentList[iii].lineID,
-1);
}
return GTK_TREE_MODEL(store);
}
static GtkWidget * create_view_and_model(void)
GtkWidget * CTagsManager::CreateViewAndModel(void)
{
GtkCellRenderer * renderer;
GtkTreeModel * model;
GtkWidget * view;
GtkCellRenderer * renderer;
GtkTreeModel * model;
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),
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
-1,
"File",
renderer,
@ -218,14 +207,14 @@ static GtkWidget * create_view_and_model(void)
// Column 2
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW (view),
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
-1,
"Regular Expression",
"lineNumber",
renderer,
"text", CTAGS_COL_REGEXP,
"text", CTAGS_COL_LINE_NUMBER,
NULL);
model = create_and_fill_model();
model = CreateAndFillModel();
gtk_tree_view_set_model(GTK_TREE_VIEW (view), model);
@ -238,7 +227,7 @@ static GtkWidget * create_view_and_model(void)
void CTagsManager::MultipleJump(void)
int32_t CTagsManager::MultipleJump(void)
{
// dlg to confirm the quit event :
GtkWidget *myDialog = gtk_dialog_new_with_buttons("C-Tags jump...",
@ -251,20 +240,65 @@ void CTagsManager::MultipleJump(void)
//gtk_window_set_transient_for(GTK_WINDOW(myDialog), GTK_WINDOW(m_mainWindow->GetWidget()));
// add writting area
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog));
GtkWidget *listView = create_view_and_model ();
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 (myDialog));
int32_t result = gtk_dialog_run(GTK_DIALOG(myDialog));
// Get data from the gtk entry
result = 0; // remove warning
//GtkTreeIter *myIter;
//gtk_tree_selection_get_selected(selection, &model, myIter);
// Remove dialogue
gtk_widget_destroy(myDialog);
return 0;
}
/*
void BufferView::OnCtagsEventList(GtkWidget *menuitem, gpointer data)
{
//BufferView * self = reinterpret_cast<BufferView*>(data);
//self->SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, self->m_contectMenuSelectID);
//self->m_contectMenuSelectID = -1;
}
*/
void CTagsManager::JumpAtID(int32_t selectID)
{
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::File myFile = m_currentList[0].filename;
EDN_INFO(" OPEN the TAG file Destination : " << myFile );
if (false == myBufferManager->Exist(myFile) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(myFile);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myFile));
}
/*
int32_t localId = myBufferManager->GetId(myFile);
Edn::String pattern = entry.address.pattern;
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
if (pattern.Size() > 4) {
pattern.Remove(0,2);
pattern.Remove(pattern.Size()-1,2);
}
// TODO : remove '\' char when needed ...
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
*/
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, m_currentList[0].lineID);
}
void CTagsManager::JumpTo(void)
{
MultipleJump();
m_currentList.Clear();
if (NULL != m_ctagFile) {
Edn::VectorType<int8_t> data;
// get the middle button of the clipboard ==> represent the current selection ...
@ -276,33 +310,37 @@ void CTagsManager::JumpTo(void)
data.PushBack('\0');
EDN_INFO("try to find the tag : " << (const char *)&data[0]);
if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) {
//EDN_INFO("find the tag");
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::String destinationFilename = m_tagFolderBase;
destinationFilename += entry.file;
Edn::File myfile = destinationFilename;
EDN_INFO(" OPEN the TAG file Destination : " << myfile );
if (false == myBufferManager->Exist(myfile) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(myfile);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myfile));
}
int32_t localId = myBufferManager->GetId(myfile);
Edn::String pattern = entry.address.pattern;
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
if (pattern.Size() > 4) {
pattern.Remove(0,2);
pattern.Remove(pattern.Size()-1,2);
}
// TODO : remove '\' char when needed ...
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
/*
tagEntry entrySave = entry;
int32_t numberOfTags = 0;
// For all tags : Save in an internal Structure :
do {
PrintTag (&entry);
Edn::String destinationFilename = m_tagFolderBase;
destinationFilename += entry.file;
Edn::File myfile = destinationFilename;
TagListFind_ts myStruct;
strncpy(myStruct.filename, myfile.GetCompleateName().c_str(), MAX_FILE_NAME);
myStruct.filename[MAX_FILE_NAME-1] = '\0';
strncpy(myStruct.RegExp, entry.address.pattern, MAX_REG_EXP_SEARCH);
myStruct.RegExp[MAX_REG_EXP_SEARCH-1] = '\0';
myStruct.lineID = entry.address.lineNumber;
// at at the corect position
m_currentList.PushBack(myStruct);
PrintTag(&entry, true);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
if (1==m_currentList.Size() ) {
JumpAtID(0);
} else {
// Open a choice windows...
int32_t SelectID = MultipleJump();
}
/*
// Display all the element :
do {
PrintTag(&entry, true);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
*/
} else {
@ -311,21 +349,26 @@ void CTagsManager::JumpTo(void)
}
}
void CTagsManager::PrintTag (const tagEntry *entry)
void CTagsManager::PrintTag (const tagEntry *entry, bool small)
{
int i;
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" pattern=\"" <<entry->address.pattern
<< "\" at line="<<entry->address.lineNumber);
EDN_INFO("Extention field : ");
if (entry->kind != NULL && entry->kind [0] != '\0') {
EDN_INFO(" kind : " << entry->kind);
}
if (entry->fileScope) {
EDN_INFO(" file : ");
}
for (i = 0 ; i < entry->fields.count ; ++i) {
EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
if (small==true) {
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" at line="<< entry->address.lineNumber);
} else {
int i;
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" pattern=\"" <<entry->address.pattern
<< "\" at line="<<entry->address.lineNumber);
EDN_INFO("Extention field : ");
if (entry->kind != NULL && entry->kind [0] != '\0') {
EDN_INFO(" kind : " << entry->kind);
}
if (entry->fileScope) {
EDN_INFO(" file : ");
}
for (i = 0 ; i < entry->fields.count ; ++i) {
EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
}
}
}

View File

@ -32,6 +32,14 @@
#include "readtags.h"
#include "Edn.h"
#define MAX_REG_EXP_SEARCH (1024)
typedef struct{
char filename[MAX_FILE_NAME];
char RegExp[MAX_REG_EXP_SEARCH];
int32_t lineID;
} TagListFind_ts;
class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
{
@ -47,9 +55,9 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
private:
int32_t m_currentSelectedID;
void LoadTagFile(void);
void MultipleJump(void);
int32_t MultipleJump(void);
void JumpTo(void);
void PrintTag(const tagEntry *entry);
void PrintTag(const tagEntry *entry, bool small);
Edn::String GetFolder(Edn::String &inputString);
Edn::String m_tagFolderBase;
Edn::String m_tagFilename;
@ -58,6 +66,12 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
void AddToHistory(int32_t bufferID);
int32_t m_historyPos;
Edn::VectorType<Edn::File*> m_historyList;
Edn::VectorType<TagListFind_ts> m_currentList;
void JumpAtID(int32_t selectID);
GtkTreeModel * CreateAndFillModel(void);
GtkWidget * CreateViewAndModel(void);
// TMP Val :
};
#endif

View File

@ -28,7 +28,6 @@
#include "tools_globals.h"
#include "Edn.h"
#define MAX_FILE_NAME (10240)
#undef __class__
#define __class__ "Edn::File"
@ -154,7 +153,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
} else {
destFilename = newFilename;
}
//EDN_DEBUG("2 : Get file Name : " << destFilename );
EDN_DEBUG("2 : Get file Name : " << destFilename );
if ('/' != *destFilename.c_str()) {
// Get the command came from the running of the program :
char cCurrentPath[FILENAME_MAX];
@ -167,7 +166,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
destFilename += '/';
destFilename += tmpFilename;
}
//EDN_DEBUG("3 : Get file Name : " << destFilename );
EDN_DEBUG("3 : Get file Name : " << destFilename );
// Get the real Path of the current File
ok = realpath(destFilename.c_str(), buf);
@ -177,7 +176,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
// Get the FileName
Edn::String tmpFilename = destFilename.Extract(lastPos+1);
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
//EDN_DEBUG("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
EDN_DEBUG("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
ok = realpath(destFilename.c_str(), buf);
if (!ok) {
EDN_ERROR("Can not find real Path name of \"" << destFilename << "\"");

View File

@ -26,6 +26,8 @@
#ifndef __EDN__FILE_H__
#define __EDN__FILE_H__
#define MAX_FILE_NAME (10240)
namespace Edn
{
class File

View File

@ -1,4 +1,4 @@
# For the first realease :
# For the first realease 1.0 :
* Systèmes :
- Affichage ligne par ligne
- Correction du bug de hl(sub patern empty)
@ -14,126 +14,123 @@
- Ctags phase 1
- Project manager phase 1
# action a faire (ordonner) :
- SEARCH : get selected text in the search windows
- SEARCH : Select the search windows when call crtl+F
- ctags : Back simple et multiple
- ctags : Multiple files
- sys : search complet, replace complet and replace ALL ...
- gui : ordonner les fichier ouvert par nom ...
- sys : Mise en place des colorisation de base pour le
* makefiles
* script bash
* python
* matlab
* java script
* SQL
- project : list of current files open
- gui : demander l'enregistrement avant de fermer (quand c'est nécessaire)
- gui : demande de création de nouveaux fichier ou quiter l'editeur ...
- gui : ascenceur quand nécessaire
- gui : Demander la création de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
- Catch Shift+TAB
- Correction du bug des entré bizard tel que les chapot et les guillemets
- gui : Parameters : et en autre la taille de la police ... et voir pour la récupérer sur le system... et ce serait cool...
- PB de copier coller sur les éà ...
- Charset UTF-8 et iso 8859-15 correcte
- Transformation de charset a la volé
- Charset par defaut
- Déction de charset (à mettre dans les todo de charset) ==> regarder les librairies open sources
- Faire les deplacement de EdnXXX dans le nameSpace Edn::XXX
- pb de sélection quand la ligne est pleine et la première ligne sélectionné...
- Edn::VectorType : Rewrite the erase fuction to support start => stop and Erase len methode ...
# action a faire (ordonner par révision) :
* 0.1.X :
- ctags : Back simple et multiple
- ctags : Multiple files
- sys : search complet, replace complet and replace ALL ...
- gui : demander l'enregistrement avant de fermer (quand c'est nécessaire)
- Faire les deplacement de EdnXXX dans le nameSpace Edn::XXX
- Edn::VectorType : Rewrite the erase fuction to support start => stop and Erase len methode ...
* 0.2.X :
- gui : Demander la création de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
- sys : Mise en place des colorisation de base pour le
* makefiles
* script bash
* python
* matlab
* java script
* SQL
- gui : ascenceur quand nécessaire
- Catch Shift+TAB
- Correction du bug des entré bizard tel que les chapot et les guillemets
- pb de sélection quand la ligne est pleine et la première ligne séctionnée.
- PB de copier coller sur les éàè ...
* 0.3.X :
- Charset UTF-8 et iso 8859-15 correcte
- Transformation de charset a la volée
- Charset par defaut
- Détection de charset (à mettre dans les todo de charset)
==> regarder les librairies open sources
* 0.4.X :
- SEARCH : get selected text in the search windows
- SEARCH : Select the search windows when call crtl+F
- gui : ordonner les fichier ouvert par nom ...
* 0.5.X :
- project : list of current files open
- gui : Parameters : et en autre la taille de la police ... et voir pour la récupérer sur le system... et ce serait cool...
# Text Editor
- [1] 90% Indent group with Tabulation and shift+tabulation
- [1] 100% Basic smart indent : Recopy the start of the previous line when return (copy '\t' and ' ')
- [1] 0% Replace Tab with space when press the key
- [1] 0% Request save user when quit the software
- [1] 0% Hide/Display scroll element when not usefull
- [1] 10% Regular expression search
- [1] 80% Colorisation syntaxique
- [1] 80% Copier / coller ==> probleme sur les caractères spéciaux comme ° é à ...
- [1] 10% Search
- [1] 10% Replace
- [1] 80% Undo / Redo ajout de caractères autre que " ", "\t" et "\n"
- [2] 0% Selectionner en colone
- [2] 0% Supression multiple de ligne par la commande ctrl+D
- [3] 0% Multi-file search ==> display it in a result buffer (clickable only)
- [3] 0% basic UTF8 string management ==> bad with the curent buffer
- [5] 0% Replace in all elements of the project file or a part
- [5] 0% Multiple Text Editor in the same Time
- [5] 0% Support des Macros ==> In python ??? or other ...
- 90% Indent group with Tabulation and shift+tabulation
- 100% Basic smart indent : Recopy the start of the previous line when return (copy '\t' and ' ')
- 0% Replace Tab with space when press the key
- 0% Request save user when quit the software
- 0% Hide/Display scroll element when not usefull
- 10% Regular expression search
- 80% Colorisation syntaxique
- 80% Copier / coller ==> probleme sur les caractères spéciaux comme ° é à ...
- 10% Search
- 10% Replace
- 80% Undo / Redo ajout de caractères autre que " ", "\t" et "\n"
- 0% Selectionner en colone
- 0% Supression multiple de ligne par la commande ctrl+D
- 0% Multi-file search ==> display it in a result buffer (clickable only)
- 0% basic UTF8 string management ==> bad with the curent buffer
- 0% Replace in all elements of the project file or a part
- 0% Multiple Text Editor in the same Time
- 0% Support des Macros ==> In python ??? or other ...
# Ctags :
- [1] 100% Parse (use the ctags parser)
- [1] 50% Find
- [1] 50% Jump
- [1] 10% History of move (with display)
- 100% Parse (use the ctags parser)
- 100% Find
- 50% Jump
- 10% History of move (with display)
# Buffer Viewer :
- [1] 0% Right menu
- [1] 100% Display buffer in color
- [1] 100% Display buffer Saved / not Saved
- [2] 0% Image of the type of buffer (optionnal)
- 100% Right menu
- 100% Display buffer in color
- 100% Display buffer Saved / not Saved
- 0% Image of the type of buffer (optionnal)
# Configuration :
- [1] 0% Creer une IHM pour les configurations de base
- [1] 0% Creer une IHM pour l'edition du hightliner syntaxique (quand il marchera...)
- [1] 0% Creer une IHM pour les couleurs (voir la lier avec l'IHM pour le hightliner)
- [1] 0% saugegarde automatique de la configuration ou sur demande...
- 0% Creer une IHM pour les configurations de base
- 0% Creer une IHM pour l'edition du hightliner syntaxique (quand il marchera...)
- 0% Creer une IHM pour les couleurs (voir la lier avec l'IHM pour le hightliner)
- 0% saugegarde automatique de la configuration ou sur demande...
# Project manager :
- [2] 0% Faire un editeur des dossiers du projet a ouvrir ==> automatiquement ajouter dans les Ctags
- [2] 0% Base
- [2] 0% Save All
- [2] 0% TreeView
- 0% Faire un editeur des dossiers du projet a ouvrir ==> automatiquement ajouter dans les Ctags
- 0% Base
- 0% Save All
- 0% TreeView
# Tree View :
- [2] 0% View
- [2] 0% Open File
- [2] 0% Jump to the curent File
- [2] 0% Hide CVS / Git / SVN elements
- 0% View
- 0% Open File
- 0% Jump to the curent File
- 0% Hide CVS / Git / SVN elements
# Diff :
- [4] 0% generate a Diff between files
- [4] 0% same in binary
- 0% generate a Diff between files
- 0% same in binary
# Git :
- [4] 0% Diff with the current wersion commited (local)
- [9] 0% Git branch local display (as gitk --all) ...
- [4] 0% view git chawan history ... (git Log)
- 0% Diff with the current wersion commited (local)
- 0% Git branch local display (as gitk --all) ...
- 0% view git chawan history ... (git Log)
# CVS :
- [6] 0% check the version with CVS
- [6] 0% commit
- [6] 0% display the Branch
- [6] 0% Select a new repository ...
- 0% check the version with CVS
- 0% commit
- 0% display the Branch
- 0% Select a new repository ...
# Publication :
- [1] 0% faire une publication du logiciel sur le Web... (need a stable version)
- [2] 0% faire un package
- 0% faire une publication du logiciel sur le Web... (need a stable version)
- 0% faire un package
# Repository :
- [2] 0% create my own repository (@home)
- [2] 0% manage right with Git
- [2] 0% create a website fot it (@home)
- [2] 0% reserve edn.org
- 0% create my own repository (@home)
- 0% manage right with Git
- 0% create a website fot it (@home)
- 0% reserve edn.org
# plugin : (never i think ...)
- [ ] 0% Comprendre comment faire un system avec des plugin (interne et simple)...
- [ ] 0% En c++ compiler seulement, pas d'interface pyton ou autre c'est trop moche.
# notes :
The [x] Represent the version expected of the feature
# Global TODO List:
- [1] 0% EdnString ==> a revoir pour etre plus rapide et plus complète... et suporter le << et >>
- [1] 0% Remove wxString from the current code...
- 0% Comprendre comment faire un system avec des plugin (interne et simple)...
- 0% En c++ compiler seulement, pas d'interface pyton ou autre c'est trop moche.
# note utiles :
http://majutsushi.github.com/tagbar/ ==> je devrais regarder ca pour savoir ce que je peux faire avec du ctags
CTags : Set the parsing methode : "ctags -R --fields=+n Sources/"