23 Commits
0.1.2 ... 0.1.6

Author SHA1 Message Date
f5911d5463 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
2011-08-10 15:56:48 +02:00
1f8d3cf045 Remove tag file in the repository 2011-08-10 09:20:54 +02:00
54cc9da39f HL : End of the parsing Error corection 2011-08-09 17:07:03 +02:00
7562c45aa7 CONFIG : update the xml parsing config : XML and boo files 2011-08-09 15:11:58 +02:00
d96a133c6a HL : Correction of a bug of reparsing the buffer betwwen 2 element Erase was not implemented as std::vector ==> I might change this ... 2011-08-09 14:28:58 +02:00
5a47446a09 Remove warning and Custom menuContext 2011-08-08 14:15:44 +02:00
a196c615bf Remove std::vector and std::string from the sources for reson of portability 2011-08-08 14:06:11 +02:00
2c6f280c58 new parsing mode of HL Done with success ==> can have some residual errors
TODO : Recursive Hightlight
2011-08-08 10:24:24 +02:00
722dafaaef base aof te new hilight system 2011-08-07 22:34:27 +02:00
45b4dca615 error whith the Highlight detection 2011-08-07 10:47:06 +02:00
322120a3f3 create the debian package and change the tag name methode 2011-08-06 12:20:08 +02:00
f5993b3f8b remove display of the dialogue from the miniature element 2011-08-05 15:12:40 +02:00
82af3768b0 remove the search windows from the task bar and the miniature bar 2011-08-05 15:10:29 +02:00
4c5f3a0424 String stream and file stream is now OK 2011-08-05 15:03:05 +02:00
7b303d2aad Edn::File is now implemented an integrated in the system ==> test is OK 2011-08-05 14:31:47 +02:00
ff055b88d4 create a class Edn::File that manage the modification of the falineme to get the real filename in the system ==> dit not work corectly... 2011-08-04 18:18:54 +02:00
55681d1dac try to create a real file viewer 2011-08-03 18:01:04 +02:00
ab74a7c516 Correction of a bug in the context menu 2011-08-03 14:47:14 +02:00
1fa86b3b03 Add the context menu for the bufferViewer element 2011-08-03 14:39:39 +02:00
dbade0e4e6 try to set a list when ctags requested and basic realpath for file class 2011-08-02 18:01:30 +02:00
356d7621ae remove from todo list and update license 2011-08-01 18:17:43 +02:00
896beaa4fd Add the goto line number dialogue 2011-08-01 10:01:26 +02:00
7b476ebc49 real installation of edn software in /usr/bin and /usr/shared/edn/... 2011-08-01 09:17:01 +02:00
56 changed files with 1406 additions and 4529 deletions

2
.gitignore vendored
View File

@@ -26,7 +26,9 @@ doxygen/ALL/
*.o *.o
*.so *.so
*.pyc *.pyc
tags
edn edn
out
edn_debug edn_debug
edn_release edn_release

View File

@@ -34,8 +34,11 @@ export CADRE_COTERS=' $(F_INVERSER) $(F_NORMALE) $(F_INVERSER) $(F_N
VERSION_TAG=$(shell git describe --tags) VERSION_TAG=$(shell git describe --tags)
#$(info $(VERSION_TAG)) #$(info $(VERSION_TAG))
VERSION_TAG_SHORT=$(shell git describe --tags --abbrev=0)
#$(info $(VERSION_TAG_SHORT))
VERSION_BUILD_TIME=$(shell date) VERSION_BUILD_TIME=$(shell date)
#$(info $(VERSION_BUILD_TIME)) #$(info $(VERSION_BUILD_TIME))
############################################################################### ###############################################################################
@@ -172,8 +175,7 @@ CXXFILES+= CustumWidget/BufferView/BufferView.cpp \
GuiTools/MainWindows/StatusBar.cpp \ GuiTools/MainWindows/StatusBar.cpp \
GuiTools/MainWindows/MenuBar.cpp \ GuiTools/MainWindows/MenuBar.cpp \
GuiTools/MainWindows/ToolBar.cpp \ GuiTools/MainWindows/ToolBar.cpp \
GuiTools/Search/Search.cpp \ GuiTools/Search/Search.cpp \
GuiTools/Search/SearchData.cpp \
GuiTools/Search/SearchData.cpp GuiTools/Search/SearchData.cpp
# Basic Interface : # Basic Interface :
@@ -290,11 +292,43 @@ install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@echo Remove temporary files *.bck @echo Remove temporary files *.bck
@rm -f `find . -name "*.bck"` @rm -f `find . -name "*.bck"`
count: count:
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"` wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE) install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS) @echo $(CADRE_HAUT_BAS)
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS) @echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS) @echo $(CADRE_HAUT_BAS)
@echo $(F_ROUGE)"
(stripped) $(OUTPUT_NAME_RELEASE) => $(PROG_NAME) "$(F_NORMALE)
@cp $(OUTPUT_NAME_RELEASE) $(PROG_NAME)
@strip -s $(PROG_NAME)
@echo $(F_VERT)"
(copy) $(PROG_NAME) /usr/bin/ "$(F_NORMALE)
@cp -vf $(PROG_NAME) /usr/bin/
@echo $(F_VERT)"
(data) data/* ==> /usr/share/edn/ "$(F_NORMALE)
@mkdir -p /usr/share/edn/
@cp -vf data/*.xml /usr/share/edn/
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
package: .encadrer
@echo 'Create Folders ...'
@mkdir -p package/$(PROG_NAME)/DEBIAN/
@mkdir -p package/$(PROG_NAME)/usr/bin/
@mkdir -p package/$(PROG_NAME)/usr/share/doc/
@mkdir -p package/$(PROG_NAME)/usr/share/edn/
# Create the control file
@echo "Package: "$(PROG_NAME) > package/$(PROG_NAME)/DEBIAN/control
@echo "Version: "$(VERSION_TAG_SHORT) >> package/$(PROG_NAME)/DEBIAN/control
@echo "Section: Development,Editors" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Priority: optional" >>package/$(PROG_NAME)/DEBIAN/control
@echo "Architecture: all" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Depends: bash" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Maintainer: Mr DUPIN Edouard <yui.heero@gmail.com>" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Description: Text editor for sources code with ctags management" >> package/$(PROG_NAME)/DEBIAN/control
@echo "" >> package/$(PROG_NAME)/DEBIAN/control
# Create the PostRm
@echo "#!/bin/bash" > package/$(PROG_NAME)/DEBIAN/postrm
@echo "rm ~/."$(PROG_NAME) >> package/$(PROG_NAME)/DEBIAN/postrm @echo "rm ~/."$(PROG_NAME) >> package/$(PROG_NAME)/DEBIAN/postrm

View File

@@ -41,10 +41,12 @@
*/ */
Buffer::Buffer() Buffer::Buffer()
{ {
static int32_t fileBasicID = 0;
m_fileModify = true; m_fileModify = true;
m_haveName = false; m_haveName = false;
Edn::String mString = "No-Name"; Edn::String mString = "Untitle - ";
m_fileName.SetCompleateName(mString); mString += fileBasicID++;
SetFileName(mString);
} }
/** /**
@@ -55,11 +57,10 @@ Buffer::Buffer()
* @return --- * @return ---
* *
*/ */
Buffer::Buffer(Edn::String &newFileName) Buffer::Buffer(Edn::File &newName)
{ {
m_fileModify = false; m_fileModify = false;
m_haveName = true; SetFileName(newName);
m_fileName.SetCompleateName(newFileName);
} }
/** /**
@@ -95,85 +96,6 @@ void Buffer::SetModify(bool status)
} }
} }
Edn::File Buffer::GetFileName(void)
{
return m_fileName;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String Buffer::GetName(void)
{
// nothing to do
return m_fileName.GetCompleateName();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String Buffer::GetShortName(void)
{
// nothing to do
return m_fileName.GetShortFilename();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String Buffer::GetFolder(void)
{
// nothing to do
return m_fileName.GetFolder();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool Buffer::HaveName(void)
{
// nothing to do
return true;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Buffer::SetName(Edn::String &newName)
{
// nothing to do
}
/** /**
* @brief * @brief
* *
@@ -360,6 +282,7 @@ void Buffer::Replace(Edn::String &data)
int32_t Buffer::FindLine(Edn::String &data) int32_t Buffer::FindLine(Edn::String &data)
{ {
// nothing to do // nothing to do
return 0;
} }
void Buffer::JumpAtLine(int32_t newLine) void Buffer::JumpAtLine(int32_t newLine)

View File

@@ -45,18 +45,38 @@ typedef struct{
class Buffer { class Buffer {
public: public:
Buffer(void); Buffer(void);
Buffer(Edn::String &filename); Buffer(Edn::File &newName);
virtual ~Buffer(void); virtual ~Buffer(void);
Edn::File GetFileName(void);
virtual Edn::String GetName(void); Edn::File GetFileName(void)
virtual Edn::String GetShortName(void); {
virtual Edn::String GetFolder(void); return m_fileName;
virtual void SetName(Edn::String &newName); };
void SetFileName(Edn::File &newName)
{
m_fileName = newName;
m_haveName = true;
NameChange();
};
void SetFileName(Edn::String &newName)
{
m_fileName.SetCompleateName(newName);
m_haveName = true;
NameChange();
};
bool HaveName(void)
{
return m_haveName;
}
virtual void Save(void); virtual void Save(void);
virtual bool HaveName(void);
bool IsModify(void); bool IsModify(void);
protected: protected:
void SetModify(bool status); void SetModify(bool status);
virtual void NameChange(void) { /*EDN_DEBUG("check name change ==> no HL change possible");*/};
public: public:
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate); virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
virtual void SetLineDisplay(uint32_t lineNumber); virtual void SetLineDisplay(uint32_t lineNumber);
@@ -88,9 +108,10 @@ class Buffer {
virtual void JumpAtLine(int32_t newLine); virtual void JumpAtLine(int32_t newLine);
protected: protected:
bool m_fileModify; bool m_fileModify; //!<
Edn::File m_fileName; // naming
bool m_haveName; //!< to know if the file have a name or NOT Edn::File m_fileName; //!< filename of the curent buffer
bool m_haveName; //!< to know if the file have a name or NOT
}; };

View File

@@ -62,8 +62,8 @@ BufferManager::~BufferManager(void)
EDN_INFO("~BufferManager::RemoveAll();"); EDN_INFO("~BufferManager::RemoveAll();");
RemoveAll(); RemoveAll();
// clear The list of Buffer // clear The list of Buffer
EDN_INFO("~BufferManager::listBuffer.clear();"); EDN_INFO("~BufferManager::listBuffer.Clear();");
listBuffer.clear(); listBuffer.Clear();
EDN_INFO("~BufferManager::delete(BufferNotExiste);"); EDN_INFO("~BufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste); delete(BufferNotExiste);
} }
@@ -73,6 +73,9 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
{ {
switch (id) switch (id)
{ {
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_idSelected = dataID;
break;
case EDN_MSG__NEW: case EDN_MSG__NEW:
{ {
int32_t newOne = Create(); int32_t newOne = Create();
@@ -81,6 +84,49 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
} }
} }
break; break;
case EDN_MSG__BUFF_ID_CLOSE:
// Check buffer existence
if(true == Exist(dataID)) {
// Get the new display buffer
if (m_idSelected == dataID) {
// Try previous buffer
int32_t destBuffer = -1;
for(int32_t ii=dataID-1; ii >= 0; ii--) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
// try next buffer
if (-1 == destBuffer) {
for(int32_t ii=dataID+1; ii < listBuffer.Size(); ii++) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
}
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
// set it to the currect display
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, destBuffer);
}
//EDN_DEBUG("Remove : " << dataID);
// Remove requested buffer
Remove(dataID);
}
break;
case EDN_MSG__BUFF_ID_SAVE:
// Check buffer existence
if(true == Exist(dataID)) {
// If no name ==> request a Gui display ...
if (Get(dataID)->HaveName() == false) {
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, dataID);
} else {
Get(dataID)->Save();
}
}
break;
} }
} }
@@ -101,7 +147,7 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
void BufferManager::RemoveAll(void) void BufferManager::RemoveAll(void)
{ {
int32_t i; int32_t i;
for (i=0; i<(int32_t)listBuffer.size(); i++) { for (i=0; i<listBuffer.Size(); i++) {
Remove(i); Remove(i);
} }
SendMessage(EDN_MSG__BUFFER_REMOVE_ALL); SendMessage(EDN_MSG__BUFFER_REMOVE_ALL);
@@ -122,8 +168,8 @@ int32_t BufferManager::Create(void)
// allocate a new Buffer // allocate a new Buffer
Buffer *myBuffer = new BufferText(); Buffer *myBuffer = new BufferText();
// Add at the list of element // Add at the list of element
listBuffer.push_back(myBuffer); listBuffer.PushBack(myBuffer);
int32_t basicID = (int32_t)listBuffer.size() - 1; int32_t basicID = listBuffer.Size() - 1;
SendMessage(EDN_MSG__BUFFER_ADD, basicID); SendMessage(EDN_MSG__BUFFER_ADD, basicID);
return basicID; return basicID;
} }
@@ -139,13 +185,14 @@ int32_t BufferManager::Create(void)
* @todo : check if this file is not curently open and return the old ID * @todo : check if this file is not curently open and return the old ID
* *
*/ */
int32_t BufferManager::Open(Edn::String &filename) int32_t BufferManager::Open(Edn::File &myFile)
{ {
// TODO : Check here if the file is already open ==> and display it if needed
// allocate a new Buffer // allocate a new Buffer
Buffer *myBuffer = new BufferText(filename); Buffer *myBuffer = new BufferText(myFile);
// Add at the list of element // Add at the list of element
listBuffer.push_back(myBuffer); listBuffer.PushBack(myBuffer);
int32_t basicID = (int32_t)listBuffer.size() - 1; int32_t basicID = listBuffer.Size() - 1;
SendMessage(EDN_MSG__BUFFER_ADD, basicID); SendMessage(EDN_MSG__BUFFER_ADD, basicID);
return basicID; return basicID;
} }
@@ -159,7 +206,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
return BufferNotExiste; return BufferNotExiste;
} }
// check if the Buffer existed // check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) { if (BufferID < listBuffer.Size()) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[BufferID]) { if (NULL != listBuffer[BufferID]) {
return listBuffer[BufferID]; return listBuffer[BufferID];
@@ -167,7 +214,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
EDN_ERROR("non existing Buffer " << BufferID); EDN_ERROR("non existing Buffer " << BufferID);
} }
} else { } else {
EDN_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size()); EDN_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
} }
return BufferNotExiste; return BufferNotExiste;
} }
@@ -179,7 +226,7 @@ bool BufferManager::Exist(int32_t BufferID)
return false; return false;
} }
// check if the Buffer existed // check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) { if (BufferID < listBuffer.Size()) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[BufferID]) { if (NULL != listBuffer[BufferID]) {
return true; return true;
@@ -189,14 +236,23 @@ bool BufferManager::Exist(int32_t BufferID)
} }
int32_t BufferManager::GetId(Edn::String &filename) bool BufferManager::Exist(Edn::File &myFile )
{
if (-1 == GetId(myFile)) {
return false;
}
return true;
}
int32_t BufferManager::GetId(Edn::File &myFile)
{ {
int32_t iii; int32_t iii;
// check if the Buffer existed // check if the Buffer existed
for (iii=0; iii < (int32_t)listBuffer.size(); iii++) { for (iii=0; iii < listBuffer.Size(); iii++) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[iii]) { if (NULL != listBuffer[iii]) {
if ( listBuffer[iii]->GetName() == filename) { if ( listBuffer[iii]->GetFileName() == myFile) {
return iii; return iii;
} }
} }
@@ -204,19 +260,11 @@ int32_t BufferManager::GetId(Edn::String &filename)
return -1; return -1;
} }
bool BufferManager::Exist(Edn::String &filename)
{
if (-1 == GetId(filename)) {
return false;
}
return true;
}
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5 // return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t BufferManager::Size(void) uint32_t BufferManager::Size(void)
{ {
return listBuffer.size(); return listBuffer.Size();
} }
@@ -234,7 +282,7 @@ bool BufferManager::Remove(int32_t BufferID)
return false; return false;
} }
// check if the Buffer existed // check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) { if (BufferID < listBuffer.Size()) {
// check if the buffer already existed // check if the buffer already existed
if (NULL != listBuffer[BufferID]) { if (NULL != listBuffer[BufferID]) {
// TODO : Check if it saved... // TODO : Check if it saved...
@@ -253,7 +301,7 @@ bool BufferManager::Remove(int32_t BufferID)
return false; return false;
} }
} else { } else {
EDN_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size()); EDN_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
return false; return false;
} }
} }
@@ -269,7 +317,7 @@ bool BufferManager::Remove(int32_t BufferID)
int32_t BufferManager::WitchBuffer(int32_t iEmeElement) int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{ {
int32_t i; int32_t i;
for (i=0; i<(int32_t)listBuffer.size(); i++) { for (i=0; i<listBuffer.Size(); i++) {
if (NULL != listBuffer[i]) { if (NULL != listBuffer[i]) {
iEmeElement--; iEmeElement--;
// find the element : // find the element :

View File

@@ -31,8 +31,6 @@
#include "BufferEmpty.h" #include "BufferEmpty.h"
#include "Singleton.h" #include "Singleton.h"
#include "MsgBroadcast.h" #include "MsgBroadcast.h"
#include <vector>
#include <string>
class BufferManager: public Singleton<BufferManager>, public MsgBroadcast class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
{ {
@@ -50,13 +48,13 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
// create a buffer with no element // create a buffer with no element
int32_t Create(void); int32_t Create(void);
// open curent filename // open curent filename
int32_t Open(Edn::String &filename); int32_t Open(Edn::File &myFile);
int32_t GetSelected(void) { return m_idSelected;}; int32_t GetSelected(void) { return m_idSelected;};
void SetSelected(int32_t id) {m_idSelected = id;}; void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID); Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID); bool Exist(int32_t BufferID);
bool Exist(Edn::String &filename); bool Exist(Edn::File &myFile);
int32_t GetId(Edn::String &filename); int32_t GetId(Edn::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5 // return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void); uint32_t Size(void);
int32_t WitchBuffer(int32_t iEmeElement); int32_t WitchBuffer(int32_t iEmeElement);
@@ -65,7 +63,7 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
private: private:
std::vector<Buffer*> listBuffer; //!< element List of the char Elements Edn::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected; int32_t m_idSelected;

View File

@@ -50,16 +50,10 @@ const uint32_t nbLineAllocatedInBase = 300;
*/ */
void BufferText::BasicInit(void) void BufferText::BasicInit(void)
{ {
static int32_t fileBasicID = 0;
NeedToCleanEndPage = true; NeedToCleanEndPage = true;
// set the first element that is displayed // set the first element that is displayed
m_displayStartBufferPos = 0; m_displayStartBufferPos = 0;
// set basic filename :
filename = "Untitled ";
filename += fileBasicID;
// no name ...
haveName = false;
fileBasicID++;
// set the number of the lineNumber; // set the number of the lineNumber;
nbColoneForLineNumber = 1; nbColoneForLineNumber = 1;
// init the link with the buffer manager // init the link with the buffer manager
@@ -80,6 +74,29 @@ void BufferText::BasicInit(void)
} }
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void BufferText::NameChange(void)
{
// Find HL system
//EDN_DEBUG("check name change");
if (true == HighlightManager::getInstance()->Exist(m_fileName)) {
Highlight * myHL = HighlightManager::getInstance()->Get(m_fileName);
// Set the new HL
if (NULL != myHL) {
m_EdnBuf.SetHLSystem(myHL);
}
}
}
/** /**
* @brief * @brief
* *
@@ -104,16 +121,15 @@ BufferText::BufferText()
* @return --- * @return ---
* *
*/ */
BufferText::BufferText(Edn::String &newFileName) BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
{ {
BasicInit(); BasicInit();
EDN_INFO("Add Data from file(" << newFileName.c_str() << ")"); NameChange();
EDN_INFO("Add Data from file(" << GetFileName() << ")");
FILE * myFile = NULL; FILE * myFile = NULL;
// set the filename :
SetName(newFileName);
// try to open the file. if not existed, new file // try to open the file. if not existed, new file
myFile = fopen(newFileName.c_str(), "r"); myFile = fopen(fileName.GetCompleateName().c_str(), "r");
if (NULL != myFile) { if (NULL != myFile) {
m_EdnBuf.DumpFrom(myFile); m_EdnBuf.DumpFrom(myFile);
// close the input file // close the input file
@@ -121,7 +137,7 @@ BufferText::BufferText(Edn::String &newFileName)
SetModify(false); SetModify(false);
} else { } else {
// fichier inexistant... creation d'un nouveaux // fichier inexistant... creation d'un nouveaux
EDN_WARNING("No File ==> created a new one(" << newFileName.c_str() << ")"); EDN_WARNING("No File ==> created a new one(" << GetFileName() << ")");
SetModify(true); SetModify(true);
} }
UpdateWindowsPosition(); UpdateWindowsPosition();
@@ -139,9 +155,9 @@ BufferText::BufferText(Edn::String &newFileName)
*/ */
void BufferText::Save(void) void BufferText::Save(void)
{ {
EDN_INFO("Save File : \"" << filename.c_str() << "\"" ); EDN_INFO("Save File : \"" << GetFileName() << "\"" );
FILE * myFile = NULL; FILE * myFile = NULL;
myFile = fopen(filename.c_str(), "w"); myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
if (NULL != myFile) { if (NULL != myFile) {
m_EdnBuf.DumpIn(myFile); m_EdnBuf.DumpIn(myFile);
fclose(myFile); fclose(myFile);
@@ -187,104 +203,6 @@ void BufferText::SelectionCheckMode(void)
} }
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String BufferText::GetName(void)
{
return filename;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String BufferText::GetShortName(void)
{
char *ptr = strrchr(filename.c_str(), '/');
if (NULL == ptr) {
ptr = strrchr(filename.c_str(), '\\');
}
Edn::String out = filename;
if (NULL != ptr) {
out = ptr+1;
}
return out;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String BufferText::GetFolder(void)
{
char tmpVal[4096];
strncpy(tmpVal, filename.c_str(), 4096);
tmpVal[4096-1] = '\0';
char *ptr = strrchr(tmpVal, '/');
if (NULL == ptr) {
ptr = strrchr(tmpVal, '\\');
}
Edn::String out = "./";
if (NULL != ptr) {
*ptr = '\0';
out = tmpVal;
}
return out;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool BufferText::HaveName(void)
{
return haveName;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void BufferText::SetName(Edn::String &newName)
{
filename = newName;
haveName = true;
// Find HL system
if (true == HighlightManager::getInstance()->Exist(newName)) {
Highlight * myHL = HighlightManager::getInstance()->Get(newName);
// Set the new HL
if (NULL != myHL) {
m_EdnBuf.SetHLSystem(myHL);
}
}
}
/** /**
* @brief * @brief
* *
@@ -1153,7 +1071,7 @@ int32_t BufferText::FindLine(Edn::String &data)
EDN_WARNING("no search data"); EDN_WARNING("no search data");
return 0; return 0;
} }
EDN_INFO("Search data line : \"" << data.c_str() << "\""); EDN_INFO("Search data line : \"" << data << "\"");
Edn::VectorType<int8_t> mVectSearch; Edn::VectorType<int8_t> mVectSearch;
mVectSearch = data.GetVector(); mVectSearch = data.GetVector();
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos ); //EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
@@ -1178,7 +1096,7 @@ void BufferText::JumpAtLine(int32_t newLine)
void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp) void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{ {
EDN_INFO("Search data : \"" << data.c_str() << "\""); EDN_INFO("Search data : \"" << data << "\"");
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd; int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect; bool SelectionIsRect;

View File

@@ -26,8 +26,6 @@
#ifndef __BUFFER_TEXT_H__ #ifndef __BUFFER_TEXT_H__
#define __BUFFER_TEXT_H__ #define __BUFFER_TEXT_H__
#include <vector>
#include <string>
#include "ColorizeManager.h" #include "ColorizeManager.h"
#include "Buffer.h" #include "Buffer.h"
#include "EdnBuf.h" #include "EdnBuf.h"
@@ -41,14 +39,9 @@ typedef enum {
class BufferText : public Buffer { class BufferText : public Buffer {
public: public:
BufferText(void); BufferText(void);
BufferText(Edn::String &filename); BufferText(Edn::File &fileName);
virtual ~BufferText(void); virtual ~BufferText(void);
Edn::String GetName(void);
Edn::String GetShortName(void);
Edn::String GetFolder(void);
void SetName(Edn::String &newName);
void Save(void); void Save(void);
bool HaveName(void);
void GetInfo(infoStatBuffer_ts &infoToUpdate); void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber); void SetLineDisplay(uint32_t lineNumber);
@@ -78,11 +71,10 @@ class BufferText : public Buffer {
void Undo(void); void Undo(void);
void Redo(void); void Redo(void);
void SetCharset(charset_te newCharset); void SetCharset(charset_te newCharset);
protected:
void NameChange(void);
private: private:
// naming
Edn::String filename; //!< filename of the curent buffer
bool haveName; //!< to know if the file have a name or NOT
// Display // Display
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line) bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number

View File

@@ -37,8 +37,17 @@ ColorizeManager::ColorizeManager(void)
ColorizeManager::~ColorizeManager(void) ColorizeManager::~ColorizeManager(void)
{ {
delete(errorColor); delete(errorColor);
// TODO : delete all color previously
listMyColor.clear(); int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
} }
@@ -181,7 +190,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
myNewColor->SetItalic(true); myNewColor->SetItalic(true);
} }
} }
listMyColor.push_back(myNewColor); listMyColor.PushBack(myNewColor);
} else { } else {
EDN_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]"); EDN_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
} }
@@ -198,8 +207,8 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
Colorize *ColorizeManager::Get(const char *colorName) Colorize *ColorizeManager::Get(const char *colorName)
{ {
uint32_t i; int32_t i;
for (i=0; i<listMyColor.size(); i++) { for (i=0; i<listMyColor.Size(); i++) {
Edn::String elementName = listMyColor[i]->GetName(); Edn::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) { if (elementName == colorName) {
return listMyColor[i]; return listMyColor[i];
@@ -227,8 +236,8 @@ color_ts & ColorizeManager::Get(basicColor_te myColor)
bool ColorizeManager::Exist(const char *colorName) bool ColorizeManager::Exist(const char *colorName)
{ {
uint32_t i; int32_t i;
for (i=0; i<listMyColor.size(); i++) { for (i=0; i<listMyColor.Size(); i++) {
Edn::String elementName = listMyColor[i]->GetName(); Edn::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) { if (elementName == colorName) {
return true; return true;
@@ -243,9 +252,9 @@ bool ColorizeManager::Exist(Edn::String &colorName)
void ColorizeManager::DisplayListOfColor(void) void ColorizeManager::DisplayListOfColor(void)
{ {
uint32_t i; int32_t i;
EDN_INFO(PFX"List of ALL COLOR : "); EDN_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.size(); i++) { for (i=0; i<listMyColor.Size(); i++) {
//Edn::String elementName = listMyColor[i]->GetName(); //Edn::String elementName = listMyColor[i]->GetName();
//EDN_INFO(i << " : \"" << elementName.c_str() << "\"" ); //EDN_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i); listMyColor[i]->Display(i);

View File

@@ -27,9 +27,8 @@
#define __COLORIZE_MANAGER_H__ #define __COLORIZE_MANAGER_H__
#include "Singleton.h" #include "Singleton.h"
#include <vector>
#include <string>
#include "Colorize.h" #include "Colorize.h"
#include "Edn.h"
typedef enum { typedef enum {
// BASIC color for codeViewer // BASIC color for codeViewer
@@ -59,19 +58,19 @@ class ColorizeManager: public Singleton<ColorizeManager>
ColorizeManager(void); ColorizeManager(void);
~ColorizeManager(void); ~ColorizeManager(void);
public: public:
void LoadFile(Edn::String &xmlFilename); void LoadFile(Edn::String &xmlFilename);
void LoadFile(const char * xmlFilename); void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName); Colorize * Get(const char *colorName);
Colorize * Get(Edn::String &colorName); Colorize * Get(Edn::String &colorName);
color_ts & Get(basicColor_te myColor); color_ts & Get(basicColor_te myColor);
bool Exist(Edn::String &colorName); bool Exist(Edn::String &colorName);
bool Exist(const char *colorName); bool Exist(const char *colorName);
void DisplayListOfColor(void); void DisplayListOfColor(void);
private: private:
std::vector<Colorize*> listMyColor; //!< List of ALL Color Edn::VectorType<Colorize*> listMyColor; //!< List of ALL Color
Colorize* errorColor; Colorize * errorColor;
color_ts basicColors[COLOR_NUMBER_MAX]; color_ts basicColors[COLOR_NUMBER_MAX];
}; };
#endif #endif

View File

@@ -41,7 +41,6 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
// Init link with the buffer Manager // Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance(); m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance(); m_colorManager = ColorizeManager::getInstance();
m_menuContext = MenuContext::getInstance();
m_widget = gtk_drawing_area_new(); m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 250, 100); gtk_widget_set_size_request( m_widget, 250, 100);
@@ -147,17 +146,17 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL; basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1; basicColor_te selectBG = COLOR_LIST_BG_1;
for (i=0; i < nbBufferOpen; i++) { for (i=0; i < nbBufferOpen; i++) {
Edn::String name; Edn::File name;
bool isModify; bool isModify;
if (self->m_bufferManager->Exist(i)) { if (self->m_bufferManager->Exist(i)) {
isModify = self->m_bufferManager->Get(i)->IsModify(); isModify = self->m_bufferManager->Get(i)->IsModify();
name = self->m_bufferManager->Get(i)->GetShortName(); name = self->m_bufferManager->Get(i)->GetFileName();
char *tmpModify = (char*)" "; char *tmpModify = (char*)" ";
if (true == isModify) { if (true == isModify) {
tmpModify = (char*)"M"; tmpModify = (char*)"M";
} }
char name2[1024] = ""; char name2[1024] = "";
sprintf(name2, "[%2d](%s) %s", i, tmpModify, name.c_str() ); sprintf(name2, "[%2d](%s) %s", i, tmpModify, name.GetShortFilename().c_str() );
if (true == isModify) { if (true == isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY; selectFG = COLOR_LIST_TEXT_MODIFY;
@@ -188,7 +187,7 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
// sur : émis lors du premier affichage de la GtkDrawingArea // sur : <EFBFBD>mis lors du premier affichage de la GtkDrawingArea
gboolean BufferView::CB_displayInit( GtkWidget *widget, gpointer data) gboolean BufferView::CB_displayInit( GtkWidget *widget, gpointer data)
{ {
BufferView * self = reinterpret_cast<BufferView*>(data); BufferView * self = reinterpret_cast<BufferView*>(data);
@@ -230,13 +229,12 @@ gint BufferView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer
gint BufferView::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data) gint BufferView::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{ {
BufferView * self = reinterpret_cast<BufferView*>(data); //BufferView * self = reinterpret_cast<BufferView*>(data);
# ifdef USE_GTK_VERSION_2_0 # ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
# endif # endif
EDN_INFO("Focus - out"); EDN_INFO("Focus - out");
self->m_menuContext->Hide();
return FALSE; return FALSE;
} }
@@ -251,12 +249,77 @@ gint BufferView::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpoint
} }
void BufferView::OnPopupEventShow(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventClose(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_CLOSE, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventSave(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_SAVE, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventSaveAs(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 BufferView::ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID)
{
// Save the slected buffer
m_contectMenuSelectID = BufferID;
if (m_bufferManager->Exist(m_contectMenuSelectID)) {
GtkWidget *menu, *menuitem;
menu = gtk_menu_new();
menuitem = gtk_menu_item_new_with_label("Show");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventShow), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
if (true == m_bufferManager->Get(m_contectMenuSelectID)->HaveName()) {
if (true == m_bufferManager->Get(m_contectMenuSelectID)->IsModify()) {
menuitem = gtk_menu_item_new_with_label("Save");
} else {
menuitem = gtk_menu_item_new_with_label("Force Save");
}
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventSave), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
menuitem = gtk_menu_item_new_with_label("Save As ...");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventSaveAs), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label("Close");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventClose), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);
// Note: event can be NULL here when called from view_onPopupMenu;
// gdk_event_get_time() accepts a NULL argument
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
(event != NULL) ? event->button : 0,
gdk_event_get_time((GdkEvent*)event));
} else {
EDN_ERROR("Buffer does not Exist !!! " << m_contectMenuSelectID);
}
}
gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data) gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{ {
BufferView * self = reinterpret_cast<BufferView*>(data); BufferView * self = reinterpret_cast<BufferView*>(data);
if (event->type != GDK_BUTTON_RELEASE) {
self->m_menuContext->Hide();
}
// get focus on the widget // get focus on the widget
gtk_widget_grab_focus(widget); gtk_widget_grab_focus(widget);
if (event->button == 1) { if (event->button == 1) {
@@ -294,16 +357,7 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g
uint32_t fontHeight = Display::GetFontHeight(); uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1); int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
if ( 0 <= selectBuf) { if ( 0 <= selectBuf) {
// TODO : Find a simple methode self->ViewPopupMenu(widget, event, selectBuf);
int32_t windowsPosX, windowsPosY;
gtk_window_get_position(GTK_WINDOW(gtk_widget_get_toplevel(widget)), &windowsPosX, &windowsPosY);
//EDN_INFO("windowsPosX=" << windowsPosX << " windowsPosY=" << windowsPosY);
int32_t widgetPosX, widgetPosY;
gtk_widget_translate_coordinates(widget, gtk_widget_get_toplevel(widget), 0, 0, &widgetPosX, &widgetPosY);
//EDN_INFO("widgetPosX=" << widgetPosX << " widgetPosY=" << widgetPosY);
self->m_menuContext->Show(self->m_shawableAreaX+2+widgetPosX+windowsPosX, ((int32_t)(event->y / fontHeight)*fontHeight)+(fontHeight/2)+widgetPosY+windowsPosY, false);
} else {
self->m_menuContext->Hide();
} }
} }
} else { } else {

View File

@@ -26,14 +26,11 @@
#define __BUFFER_VIEW_H__ #define __BUFFER_VIEW_H__
#include "tools_debug.h" #include "tools_debug.h"
#include <vector>
#include <string>
#include "Singleton.h" #include "Singleton.h"
#include "CodeView.h" #include "CodeView.h"
#include "BufferManager.h" #include "BufferManager.h"
#include "Display.h" #include "Display.h"
#include "MsgBroadcast.h" #include "MsgBroadcast.h"
#include "MenuContext.h"
@@ -55,18 +52,23 @@ class BufferView : public MsgBroadcast
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data); static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
static void CB_EventOnBufferManager(gpointer data); static void CB_EventOnBufferManager(gpointer data);
static void OnPopupEventShow(GtkWidget *menuitem, gpointer data);
static void OnPopupEventClose(GtkWidget *menuitem, gpointer data);
static void OnPopupEventSave(GtkWidget *menuitem, gpointer data);
static void OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data);
private: private:
void ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID);
// main windows widget : // main windows widget :
GtkWidget * m_widget; GtkWidget * m_widget;
// r<>cup<75>ration des proprieter g<>n<EFBFBD>ral... // r<>cup<75>ration des proprieter g<>n<EFBFBD>ral...
BufferManager * m_bufferManager; BufferManager * m_bufferManager;
ColorizeManager * m_colorManager; ColorizeManager * m_colorManager;
MenuContext * m_menuContext;
int32_t m_shawableAreaX; int32_t m_shawableAreaX;
int32_t m_shawableAreaY; int32_t m_shawableAreaY;
int32_t m_selectedID; int32_t m_selectedID;
int32_t m_contectMenuSelectID;
}; };

View File

@@ -46,7 +46,6 @@ CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
// Init link with the buffer Manager // Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance(); m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance(); m_colorManager = ColorizeManager::getInstance();
m_menuContext = MenuContext::getInstance();
m_widget = gtk_drawing_area_new(); m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 200, 100); gtk_widget_set_size_request( m_widget, 200, 100);
@@ -105,11 +104,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID); SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break; break;
case EDN_MSG__CURRENT_SAVE: case EDN_MSG__CURRENT_SAVE:
if (m_bufferManager->Get(m_bufferID)->HaveName() == false) { SendMessage(EDN_MSG__BUFF_ID_SAVE, m_bufferID);
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
} else {
m_bufferManager->Get(m_bufferID)->Save();
}
break; break;
case EDN_MSG__CURRENT_SAVE_AS: case EDN_MSG__CURRENT_SAVE_AS:
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID); SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
@@ -165,9 +160,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
case EDN_MSG__CURRENT_REPLACE_ALL: case EDN_MSG__CURRENT_REPLACE_ALL:
break; break;
case EDN_MSG__CURRENT_CLOSE: case EDN_MSG__CURRENT_CLOSE:
m_bufferManager->Remove(m_bufferID); SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
m_bufferID = -1;
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break; break;
case EDN_MSG__CURRENT_UNDO: case EDN_MSG__CURRENT_UNDO:
m_bufferManager->Get(m_bufferID)->Undo(); m_bufferManager->Get(m_bufferID)->Undo();

View File

@@ -32,7 +32,6 @@
#include "BufferManager.h" #include "BufferManager.h"
#include "Display.h" #include "Display.h"
#include "MsgBroadcast.h" #include "MsgBroadcast.h"
#include "MenuContext.h"
class CodeView : public MsgBroadcast class CodeView : public MsgBroadcast
{ {
@@ -58,7 +57,6 @@ class CodeView : public MsgBroadcast
// récupération des proprieter général... // récupération des proprieter général...
BufferManager * m_bufferManager; BufferManager * m_bufferManager;
ColorizeManager * m_colorManager; ColorizeManager * m_colorManager;
MenuContext * m_menuContext;
int32_t m_shawableAreaX; int32_t m_shawableAreaX;
int32_t m_shawableAreaY; int32_t m_shawableAreaY;
int32_t m_bufferID; int32_t m_bufferID;

View File

@@ -28,8 +28,7 @@
#include "tools_debug.h" #include "tools_debug.h"
#include "Singleton.h" #include "Singleton.h"
#include <string>
#include <vector>
class MainAreaView: public Singleton<MainAreaView> class MainAreaView: public Singleton<MainAreaView>

View File

@@ -93,17 +93,25 @@ MainWindows::~MainWindows(void)
} }
void MainWindows::SetTitle(Edn::String &fileName, bool isModify) void MainWindows::SetTitle(Edn::File &fileName, bool isModify)
{ {
Edn::String tmp = ""; Edn::String tmp = "";
if (fileName != "") { if (fileName.GetShortFilename() != "") {
tmp += fileName; tmp += fileName.GetShortFilename();
tmp += " - ";
tmp += fileName.GetFolder();
tmp += " - "; tmp += " - ";
} }
tmp += "Edn"; tmp += "Edn";
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str()); gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
} }
void MainWindows::SetNoTitle(void)
{
Edn::String tmp = "Edn";
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
}
void MainWindows::OnMessage(int32_t id, int32_t dataID) void MainWindows::OnMessage(int32_t id, int32_t dataID)
{ {
switch (id) switch (id)
@@ -112,12 +120,11 @@ void MainWindows::OnMessage(int32_t id, int32_t dataID)
// change Title : // change Title :
// TODO : String error when remove the error with -1; // TODO : String error when remove the error with -1;
if (-1 == dataID) { if (-1 == dataID) {
Edn::String plop = ""; SetNoTitle();
SetTitle(plop, false );
} else { } else {
Buffer *mybuf = BufferManager::getInstance()->Get(dataID); Buffer *mybuf = BufferManager::getInstance()->Get(dataID);
if (NULL != mybuf) { if (NULL != mybuf) {
Edn::String plop = mybuf->GetName(); Edn::File plop = mybuf->GetFileName();
SetTitle(plop, mybuf->IsModify() ); SetTitle(plop, mybuf->IsModify() );
} }
} }

View File

@@ -53,7 +53,8 @@ class MainWindows: public Singleton<MainWindows>, public MsgBroadcast
static bool OnQuit(GtkWidget *widget, gpointer data); static bool OnQuit(GtkWidget *widget, gpointer data);
private: private:
void SetTitle(Edn::String &fileName, bool isModify); void SetTitle(Edn::File &fileName, bool isModify);
void SetNoTitle(void);
// main windows widget : // main windows widget :
GtkWidget * m_mainWindow; GtkWidget * m_mainWindow;
BufferView m_BufferView; BufferView m_BufferView;

View File

@@ -224,6 +224,8 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
tmp->AddSeparator(); tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true); tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true);
tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true); tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true);
tmp->AddSeparator();
tmp->AddGen("Goto Line number ...", "ctrl+l", EDN_MSG__GUI_SHOW_GOTO_LINE, true);
// tmp->AddSeparator(); // tmp->AddSeparator();
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true); // tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true);
m_listMenu.PushBack(tmp); m_listMenu.PushBack(tmp);

View File

@@ -1,490 +0,0 @@
/**
*******************************************************************************
* @file MenuContext.cpp
* @brief Editeur De N'ours : special Menu (left button or normal menu) (Sources)
* @author Edouard DUPIN
* @date 22/07/2011
* @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 "tools_debug.h"
#include "tools_globals.h"
#include "MenuContext.h"
#undef __class__
#define __class__ "MenuContext"
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
MenuContext::MenuContext(void) : MsgBroadcast("Menu Context", EDN_CAT_MENU_CONTEXT)
{
//m_currentBufferID = -1;
m_dialog = NULL;
m_shawableSize.x=200;
m_shawableSize.y=200;
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
MenuContext::~MenuContext(void)
{
if(NULL != m_dialog) {
gtk_widget_destroy(m_dialog);
m_dialog = NULL;
}
}
void MenuContext::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
/*
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_currentBufferID = dataID;
break;
*/
}
}
void MenuContext::Clear(void)
{
}
void MenuContext::AddCommonElem(int32_t id)
{
}
void MenuContext::AddSpecificElem(Edn::String &text)
{
}
/* This is called when we need to draw the windows contents */
static gboolean expose (GtkWidget *widget, GdkEventExpose *event, gpointer userdata)
{
gint width;
gint height;
cairo_t *cr = NULL;
# if USE_GTK_VERSION_3_0
cr = gdk_cairo_create(gtk_widget_get_window(widget));
# elif USE_GTK_VERSION_2_0
cr = gdk_cairo_create(widget->window);
# endif
//if (supports_alpha)
{
// transparent
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
}
/*
else
{
// opaque white
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
}
*/
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* draw a circle */
//gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
//cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
//cairo_arc (cr, width / 2, height / 2, (width < height ? width : height) / 2 - 8 , 0, 2 * 3.14);
//cairo_fill (cr);
//cairo_stroke (cr);
//cairo_paint (cr);
cairo_destroy (cr);
return FALSE;
}
// http://zetcode.com/tutorials/cairographicstutorial/transparency/
void MenuContext::Show(int32_t x, int32_t y, bool top)
{
if(NULL != m_dialog) {
gtk_widget_destroy(m_dialog);
m_dialog = NULL;
}
m_dialog = gtk_window_new(GTK_WINDOW_POPUP);
//m_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// Set the dialog on top of the selected windows
//gtk_window_set_transient_for(GTK_WINDOW(m_dialog), parent);
// unset the border of the windows
//gtk_window_set_decorated(GTK_WINDOW(m_dialog), FALSE);
EDN_INFO("Set position X=" << x+2 << " Y=" << y+27);
# if USE_GTK_VERSION_3_0
gtk_window_move(GTK_WINDOW(m_dialog), x+2, y+27);
# elif USE_GTK_VERSION_2_0
gtk_widget_set_uposition(m_dialog, x+2, y+27);
# endif
#if 0
/* sdsfsdf */
gtk_widget_set_app_paintable (m_dialog, TRUE);
# ifdef USE_GTK_VERSION_3_0
g_signal_connect( G_OBJECT(m_dialog), "draw", G_CALLBACK(expose), this);
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_dialog), "expose_event", G_CALLBACK(expose), this);
# endif
#endif
//gtk_window_set_opacity(GTK_WINDOW(m_dialog), 0.25);
// enable the close signal of the windows
//g_signal_connect(G_OBJECT(m_mainWindow), "delete-event", G_CALLBACK(OnQuit), this);
//g_signal_connect(G_OBJECT(m_mainWindow), "destroy", G_CALLBACK(OnQuit), this);
/*
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER(m_dialog), vbox);
GtkWidget *myLabel = gtk_label_new("plop 1 ");
gtk_container_add(GTK_CONTAINER(vbox), myLabel);
myLabel = gtk_label_new("plop 2 ");
gtk_container_add(GTK_CONTAINER(vbox), myLabel);
*/
// Set key Accelerator :
//AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_dialog));
// Create the menu bar.
//gtk_box_pack_start( GTK_BOX (vbox), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
m_widget = gtk_drawing_area_new();
//gtk_window_set_opacity(GTK_WINDOW(m_widget), 0.8);
gtk_widget_set_size_request( m_widget, 250, 100);
gtk_widget_add_events( m_widget,
GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
# ifdef USE_GTK_VERSION_3_0
g_object_set(m_widget,"can-focus", TRUE, NULL);
# elif defined( USE_GTK_VERSION_2_0 )
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
# endif
// Focus Event
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
// Keyboard Event
g_signal_connect_after( G_OBJECT(m_widget), "key_press_event", G_CALLBACK(CB_keyboardEvent), this);
g_signal_connect_after( G_OBJECT(m_widget), "key_release_event", G_CALLBACK(CB_keyboardEvent), this);
// Mouse Event
g_signal_connect( G_OBJECT(m_widget), "button_press_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "button_release_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "motion_notify_event", G_CALLBACK(CB_mouseMotionEvent), this);
// Display Event
g_signal_connect( G_OBJECT(m_widget), "realize", G_CALLBACK(CB_displayInit), this);
# ifdef USE_GTK_VERSION_3_0
g_signal_connect( G_OBJECT(m_widget), "draw", G_CALLBACK(CB_displayDraw), this);
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
# endif
gtk_container_add(GTK_CONTAINER(m_dialog), m_widget);
// recursive version of gtk_widget_show
gtk_widget_show_all(m_dialog);
// Set the Focus
gtk_widget_grab_focus(m_widget);
}
void MenuContext::Hide(void)
{
if(NULL != m_dialog) {
gtk_widget_destroy(m_dialog);
m_dialog = NULL;
}
}
gboolean MenuContext::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
if (self->m_shawableSize.x != allocation.width) {
self->m_shawableSize.x = allocation.width;
}
if (self->m_shawableSize.y != allocation.height) {
self->m_shawableSize.y = allocation.height;
}
# elif defined( USE_GTK_VERSION_2_0)
if (self->m_shawableSize.x != widget->allocation.width) {
self->m_shawableSize.x = widget->allocation.width;
}
if (self->m_shawableSize.y != widget->allocation.height) {
self->m_shawableSize.y = widget->allocation.height;
}
# endif
EDN_INFO("Request a display of : " << self->m_shawableSize.x << "px * "<< self->m_shawableSize.y<<"px");
DrawerManager monDrawer(widget, self->m_shawableSize.x, self->m_shawableSize.y);
// get the number of buffer open
int32_t nbBufferOpen = self->m_bufferManager->Size();
int32_t i;
uint32_t lineID = 0;
uint32_t fontHeight = Display::GetFontHeight();
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1;
Edn::VectorType<Edn::String *> myData;
Edn::String * plop = new Edn::String("Save");
myData.PushBack(plop);
plop = new Edn::String("Show");
myData.PushBack(plop);
plop = new Edn::String("Close");
myData.PushBack(plop);
for (i=0; i < myData.Size(); i++) {
selectFG = COLOR_LIST_TEXT_NORMAL;
if (lineID%2==0) {
selectBG = COLOR_LIST_BG_1;
} else {
selectBG = COLOR_LIST_BG_2;
}
monDrawer.Rectangle(self->m_colorManager->Get(selectBG), 0, lineID*fontHeight, self->m_shawableSize.x, Display::GetFontHeight());
monDrawer.Text(self->m_colorManager->Get(selectFG), 2, lineID*fontHeight, myData[i]->c_str());
monDrawer.Flush();
lineID ++;
}
return TRUE;
}
gboolean MenuContext::CB_displayDraw2( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
gint width;
gint height;
cairo_t *cr = NULL;
# if USE_GTK_VERSION_3_0
cr = gdk_cairo_create(gtk_widget_get_window(widget));
# elif USE_GTK_VERSION_2_0
cr = gdk_cairo_create(widget->window);
# endif
// transparent
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* draw a circle */
gtk_window_get_size (GTK_WINDOW(widget), &width, &height);
cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_arc (cr, width / 2, height / 2, (width < height ? width : height) / 2 - 8 , 0, 2 * 3.14);
cairo_fill (cr);
cairo_stroke (cr);
cairo_paint (cr);
cairo_destroy (cr);
return FALSE;
}
// sur : <20>mis lors du premier affichage de la GtkDrawingArea
gboolean MenuContext::CB_displayInit( GtkWidget *widget, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
int32_t size_x = allocation.width;
int32_t size_y = allocation.height;
self->m_shawableSize.x = allocation.width;
self->m_shawableSize.y = allocation.height;
# elif defined( USE_GTK_VERSION_2_0)
int32_t size_x = widget->allocation.width;
int32_t size_y = widget->allocation.height;
self->m_shawableSize.x = widget->allocation.width;
self->m_shawableSize.y = widget->allocation.height;
# endif
EDN_INFO("Request a diplay of : " << size_x << "px * " << size_y << "px");
gtk_widget_queue_draw( widget );
return TRUE;
}
gint MenuContext::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
//MenuContext * self = reinterpret_cast<MenuContext*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - In");
gtk_widget_queue_draw( widget );
return FALSE;
}
gint MenuContext::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - out");
self->Hide();
return FALSE;
}
gint MenuContext::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data)
{
//MenuContext * self = reinterpret_cast<MenuContext*>(data);
if(event->type == GDK_KEY_PRESS) {
gtk_widget_queue_draw( widget );
}
return true;
}
gint MenuContext::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
// get focus on the widget
gtk_widget_grab_focus(widget);
if (event->button == 1) {
/*
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> One Clicked");
}else*/ if (event->type == GDK_2BUTTON_PRESS) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
//EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf);
if ( 0 <= selectBuf) {
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, selectBuf);
/*
MainWindows *window = MainWindows::getInstance();
EDN_INFO(" Event on Buffer " << selectBuf);
// set the new seected Buffer
window->SetSelected(selectBuf);
*/
}
}/* else if (event->type == GDK_3BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> Triple Clicked");
}else if (event->type == GDK_BUTTON_RELEASE) {
EDN_INFO("mouse-event BT1 ==> Realease");
}*/
}/* else if (event->button == 2) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT2 PRESS");
self->m_menuContext->Show(event->x, event->y, false);
}
} else if (event->button == 3) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT3 PRESS");
uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
if ( 0 <= selectBuf) {
// TODO : Find a simple methode
int32_t windowsPosX, windowsPosY;
gtk_window_get_position(GTK_WINDOW(gtk_widget_get_toplevel(widget)), &windowsPosX, &windowsPosY);
//EDN_INFO("windowsPosX=" << windowsPosX << " windowsPosY=" << windowsPosY);
int32_t widgetPosX, widgetPosY;
gtk_widget_translate_coordinates(widget, gtk_widget_get_toplevel(widget), 0, 0, &widgetPosX, &widgetPosY);
//EDN_INFO("widgetPosX=" << widgetPosX << " widgetPosY=" << widgetPosY);
self->m_menuContext->Show(self->m_shawableAreaX+2+widgetPosX+windowsPosX, ((int32_t)(event->y / fontHeight)*fontHeight)+(fontHeight/2)+widgetPosY+windowsPosY, false);
}
}
}*/ else {
EDN_INFO("mouse-event BT? PRESS");
}
gtk_widget_queue_draw( widget );
return true;
}
gint MenuContext::CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
//MenuContexterView * self = reinterpret_cast<MenuContext*>(data);
/*
if (true == ButtunOneSelected) {
int x, y;
GdkModifierType state;
if (event->is_hint) {
gdk_window_get_pointer(event->window, &x, &y, &state);
} else {
x = event->x;
y = event->y;
state = (GdkModifierType)event->state;
}
EDN_INFO("mouse-motion BT1 %d, %d", x, y);
}
*/
return true;
}

View File

@@ -1,72 +0,0 @@
/**
*******************************************************************************
* @file MenuContext.h
* @brief Editeur De N'ours : special Menu (left button or normal menu) (header)
* @author Edouard DUPIN
* @date 22/07/2011
* @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 __MENU_CONTEXT_H__
#define __MENU_CONTEXT_H__
#include "Singleton.h"
#include "MsgBroadcast.h"
#include "Edn.h"
#include "BufferManager.h"
#include "ColorizeManager.h"
class MenuContext: public Singleton<MenuContext>, public MsgBroadcast
{
friend class Singleton<MenuContext>;
// specific for sigleton system...
private:
// Constructeur
MenuContext(void);
~MenuContext(void);
public:
void OnMessage(int32_t id, int32_t dataID);
// sur : GTK+ callback :
static gboolean CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data);
static gboolean CB_displayDraw2( GtkWidget *widget, GdkEventExpose *event, gpointer data);
static gboolean CB_displayInit( GtkWidget *widget, gpointer data);
static gint CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data);
static gint CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data);
static gint CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data);
static gint CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data);
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
static void CB_EventOnBufferManager(gpointer data);
static void CB_ScreenChange(GtkWidget *widget, GdkScreen *old_screen, gpointer userdata);
public:
void Clear(void);
void AddCommonElem(int32_t id);
void AddSpecificElem(Edn::String &text);
void Show(int32_t x, int32_t y, bool top);
void Hide(void);
private:
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
GtkWidget * m_dialog;
GtkWidget * m_widget;
position_ts m_requestedPos;
position_ts m_shawableSize;
};
#endif

View File

@@ -68,7 +68,10 @@ void Search::Display(GtkWindow *parent)
gtk_window_set_transient_for(GTK_WINDOW(m_localDialog), parent); gtk_window_set_transient_for(GTK_WINDOW(m_localDialog), parent);
// set the dialog on the top right // set the dialog on the top right
gtk_window_set_gravity(GTK_WINDOW(m_localDialog), GDK_GRAVITY_NORTH_EAST); gtk_window_set_gravity(GTK_WINDOW(m_localDialog), GDK_GRAVITY_NORTH_EAST);
// Remove the dialogue from the task bar
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_localDialog), TRUE);
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(m_localDialog), TRUE);
// select the program icone // select the program icone
//gtk_window_set_default_icon_name("Replace"); //gtk_window_set_default_icon_name("Replace");

View File

@@ -28,8 +28,6 @@
#include "tools_debug.h" #include "tools_debug.h"
#include "Singleton.h" #include "Singleton.h"
#include <string>
#include <vector>
class Search: public Singleton<Search> class Search: public Singleton<Search>

View File

@@ -98,16 +98,18 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
GTK_STOCK_OPEN, // button text GTK_STOCK_OPEN, // button text
GTK_RESPONSE_ACCEPT, // response id GTK_RESPONSE_ACCEPT, // response id
NULL); // end button/response list NULL); // end button/response list
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
if( -1 != m_currentBufferID if( -1 != m_currentBufferID
&& true == myBufferManager->Exist(m_currentBufferID) ) && true == myBufferManager->Exist(m_currentBufferID) )
{ {
Edn::String fileFolder = myBufferManager->Get(m_currentBufferID)->GetFolder(); Edn::File fileName = myBufferManager->Get(m_currentBufferID)->GetFileName();
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog), fileFolder.c_str()); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), fileName.GetFolder().c_str());
//gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(dialog), "Untitled document"); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), fileName.GetShortFilename().c_str());
} }
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
Edn::String myfilename; Edn::File myfilename;
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog)); myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
if (false == myBufferManager->Exist(myfilename) ) { if (false == myBufferManager->Exist(myfilename) ) {
@@ -132,7 +134,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
} }
Buffer *myBuffer = BufferManager::getInstance()->Get(idSelected); Buffer *myBuffer = BufferManager::getInstance()->Get(idSelected);
Edn::String tmpString = "Save as file : "; Edn::String tmpString = "Save as file : ";
tmpString += myBuffer->GetShortName().c_str(); tmpString += myBuffer->GetFileName().GetShortFilename().c_str();
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL, GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, // button text GTK_STOCK_CANCEL, // button text
@@ -140,12 +142,14 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
GTK_STOCK_SAVE, // button text GTK_STOCK_SAVE, // button text
GTK_RESPONSE_ACCEPT, // response id GTK_RESPONSE_ACCEPT, // response id
NULL); // end button/response list NULL); // end button/response list
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
Edn::String myfilename; Edn::String myfilename;
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog)); myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
myBuffer->SetName(myfilename); myBuffer->SetFileName(myfilename);
myBuffer->Save(); myBuffer->Save();
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idSelected); SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idSelected);
@@ -161,6 +165,8 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_STOCK_QUIT, GTK_RESPONSE_NO, GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL); NULL);
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(myDialog), TRUE);
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog)); GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog));
GtkWidget *myLabel = gtk_label_new(""); GtkWidget *myLabel = gtk_label_new("");
gtk_label_set_markup (GTK_LABEL (myLabel), gtk_label_set_markup (GTK_LABEL (myLabel),
@@ -203,6 +209,46 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
} }
} }
break; break;
case EDN_MSG__GUI_SHOW_GOTO_LINE:
{
// dlg to confirm the quit event :
GtkWidget *myDialog = gtk_dialog_new_with_buttons("Goto Line",
GTK_WINDOW(m_mainWindow->GetWidget()),
GTK_DIALOG_MODAL,
"Jump", GTK_RESPONSE_YES,
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL);
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(myDialog), TRUE);
// Set over main windows
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 *myEntry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(myContentArea), myEntry, TRUE, TRUE, 0);
// Display it
gtk_widget_show_all(myContentArea);
int32_t result = gtk_dialog_run (GTK_DIALOG (myDialog));
// Get data from the gtk entry
const char *myData = gtk_entry_get_text(GTK_ENTRY(myEntry));
if (NULL != myData) {
int32_t lineID=0;
if (1==sscanf(myData, "%d",&lineID)) {
EDN_DEBUG("find in : \"" << myData << "\" = " << lineID);
if(GTK_RESPONSE_YES == result) {
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, lineID-1);
}
} else {
if (GTK_RESPONSE_YES == result) {
EDN_WARNING("find in : \"" << myData << "\" line Number is not correct ");
}
}
} else {
EDN_DEBUG("no line Writen ...");
}
// Remove dialogue
gtk_widget_destroy(myDialog);
}
break;
} }
} }

View File

@@ -33,14 +33,14 @@
#define __class__ "Highlight" #define __class__ "Highlight"
void Highlight::ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level) void Highlight::ParseRules(TiXmlNode *child, Edn::VectorType<HighlightPattern*> &mListPatern, int32_t level)
{ {
// Create the patern ... // Create the patern ...
HighlightPattern *myPattern = new HighlightPattern(); HighlightPattern *myPattern = new HighlightPattern();
// parse under Element // parse under Element
myPattern->ParseRules(child, level); myPattern->ParseRules(child, level);
// add element in the list // add element in the list
mListPatern.push_back(myPattern); mListPatern.PushBack(myPattern);
} }
@@ -52,7 +52,7 @@ Highlight::Highlight(Edn::String &xmlFilename)
// open the curent File // open the curent File
bool loadError = XmlDocument.LoadFile(xmlFilename.c_str()); bool loadError = XmlDocument.LoadFile(xmlFilename.c_str());
if (false == loadError) { if (false == loadError) {
EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename.c_str() << "\""); EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename << "\"");
return; return;
} }
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnLang" ); TiXmlElement* root = XmlDocument.FirstChildElement( "EdnLang" );
@@ -72,8 +72,8 @@ Highlight::Highlight(Edn::String &xmlFilename)
const char *myData = child->ToElement()->GetText(); const char *myData = child->ToElement()->GetText();
if (NULL != myData) { if (NULL != myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData); //EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
Edn::String myEdnData = myData; Edn::String * myEdnData = new Edn::String(myData);
m_listExtentions.push_back(myEdnData); m_listExtentions.PushBack(myEdnData);
} }
} else if (!strcmp(child->Value(), "pass1")) { } else if (!strcmp(child->Value(), "pass1")) {
// Get sub Nodes ... // Get sub Nodes ...
@@ -113,48 +113,54 @@ Highlight::Highlight(Edn::String &xmlFilename)
Highlight::~Highlight(void) Highlight::~Highlight(void)
{ {
uint32_t i; int32_t i;
// clean all Element // clean all Element
for (i=0; i< m_listHighlightPass1.size(); i++) { for (i=0; i< m_listHighlightPass1.Size(); i++) {
delete(m_listHighlightPass1[i]); if (NULL != m_listHighlightPass1[i]) {
delete(m_listHighlightPass1[i]);
m_listHighlightPass1[i] = NULL;
}
} }
// clear the compleate list // clear the compleate list
m_listHighlightPass1.clear(); m_listHighlightPass1.Clear();
// clean all Element
for (i=0; i< m_listExtentions.Size(); i++) {
if (NULL != m_listExtentions[i]) {
delete(m_listExtentions[i]);
m_listExtentions[i] = NULL;
}
}
// clear the compleate list
m_listExtentions.Clear();
} }
bool Highlight::HasExtention(Edn::String &ext) bool Highlight::HasExtention(Edn::String &ext)
{ {
uint32_t i; int32_t i;
for (i=0; i<m_listExtentions.size(); i++) { for (i=0; i<m_listExtentions.Size(); i++) {
if (ext == m_listExtentions[i] ) { if (ext == *m_listExtentions[i] ) {
return true; return true;
} }
} }
return false; return false;
} }
bool Highlight::FileNameCompatible(Edn::String &fileName) bool Highlight::FileNameCompatible(Edn::File &fileName)
{ {
uint32_t i; int32_t i;
int32_t posCopy = fileName.FindBack('/');
Edn::String shortFilename;
if (-1 != posCopy) {
shortFilename = fileName.Extract(posCopy+1);
} else {
shortFilename = fileName;
}
posCopy = shortFilename.FindBack('.');
Edn::String extention; Edn::String extention;
if (-1 != posCopy) { if (true == fileName.HasExtention() ) {
extention = shortFilename.Extract(posCopy); extention = "*.";
extention += fileName.GetExtention();
} else { } else {
extention = shortFilename; extention = fileName.GetShortFilename();
} }
EDN_DEBUG(" try to find : in \"" << fileName.c_str() << "\" shortfilename\"" << shortFilename.c_str() << "\" extention:\"" << extention.c_str() << "\" "); EDN_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
for (i=0; i<m_listExtentions.size(); i++) { for (i=0; i<m_listExtentions.Size(); i++) {
if (extention == m_listExtentions[i] ) { if (extention == *m_listExtentions[i] ) {
return true; return true;
} }
} }
@@ -164,134 +170,119 @@ bool Highlight::FileNameCompatible(Edn::String &fileName)
void Highlight::Display(void) void Highlight::Display(void)
{ {
uint32_t i; int32_t i;
EDN_INFO("List of ALL Highlight : "); EDN_INFO("List of ALL Highlight : ");
for (i=0; i< m_listExtentions.size(); i++) { for (i=0; i< m_listExtentions.Size(); i++) {
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i].c_str() ); EDN_INFO(" Extention : " << i << " : " << *m_listExtentions[i] );
} }
// Display all elements // Display all elements
for (i=0; i< m_listHighlightPass1.size(); i++) { for (i=0; i< m_listHighlightPass1.Size(); i++) {
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName().c_str() ); EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() );
//m_listHighlightPass1[i]->Display(); //m_listHighlightPass1[i]->Display();
} }
// Display all elements // Display all elements
for (i=0; i< m_listHighlightPass2.size(); i++) { for (i=0; i< m_listHighlightPass2.Size(); i++) {
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName().c_str() ); EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
//m_listHighlightPass2[i]->Display(); //m_listHighlightPass2[i]->Display();
} }
} }
// 13h 46min 22s | (l= 214) Highlight::Parse | [II] Find Pattern in the Buffer : (2457,2479)
void Highlight::Parse(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID) // TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas tr<74>grave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
void Highlight::Parse(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
int32_t addingPos,
EdnVectorBuf &buffer)
{ {
if (0 > addingPos) { if (0 > addingPos) {
addingPos = 0; addingPos = 0;
} }
/*int32_t emptyId = -1; //EDN_DEBUG("Parse element 0 => " << m_listHighlightPass1.Size() << " ==> position search: (" << start << "," << stop << ")" );
for (i=0; i< (int32_t)metaData.size(); i++) {
}*/
//EDN_DEBUG("Parse element " << elementID << " / " << m_listHighlightPass1.size() << " ==> position search: (" << start << "," << stop << ")" );
if (elementID >= (int32_t)m_listHighlightPass1.size() ){
//EDN_DEBUG("Return at " << elementID << " / " << m_listHighlightPass1.size() );
return;
}
int32_t elementStart = start; int32_t elementStart = start;
int32_t elementStop = stop; int32_t elementStop = stop;
resultFind_te ret = HLP_FIND_OK;
colorInformation_ts resultat; colorInformation_ts resultat;
while (HLP_FIND_ERROR != ret && elementStart<elementStop) { while (elementStart<elementStop) {
ret = m_listHighlightPass1[elementID]->Find(elementStart, elementStop, resultat, buffer); //EDN_DEBUG("Parse element in the buffer id=" << elementStart);
if (HLP_FIND_ERROR != ret) { //try to fond the HL in ALL of we have
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); for (int32_t jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
// Add curent element in the list ... resultFind_te ret = HLP_FIND_OK;
if (HLP_FIND_OK_NO_END == ret) { //EDN_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
// find if we have a next element with th save Pointer and not higher the this one // Stop the search to the end (to get the end of the pattern)
int32_t findNextElement = -1; ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.Size(), resultat, buffer);
int32_t i; if (HLP_FIND_ERROR != ret) {
int32_t curentLevel = ((HighlightPattern*)resultat.patern)->GetLevel(); //EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
for (i=addingPos; i< (int32_t)metaData.size(); i++) { // Remove element in the current List where the current Element have a end inside the next...
if (curentLevel > ((HighlightPattern*)metaData[i].patern)->GetLevel() ) { int32_t kkk=addingPos;
//EDN_DEBUG(" -> Find upper element at "<< i ); while(kkk < metaData.Size() ) {
break; if (metaData[kkk].beginStart <= resultat.endStop) {
} else if (curentLevel < ((HighlightPattern*)metaData[i].patern)->GetLevel() ) { // Remove element
findNextElement = i; //EDN_INFO("Erase element=" << kkk);
//EDN_DEBUG(" -> Find under element at "<< i ); metaData.Erase(kkk, kkk+1);
} // Increase the end of search
if (metaData[i].patern == resultat.patern) if (kkk < metaData.Size()) {
{ // just befor the end of the next element
findNextElement = i; elementStop = metaData[kkk].beginStart-1;
//EDN_DEBUG(" -> Find a same element at "<< i ); } else {
break; // end of the buffer
} elementStop = buffer.Size();
} }
if (-1 != findNextElement) {
// if not find a end, we need to search the end of this one and parse all data inside...
int32_t newEnd = buffer.Size();
if (findNextElement >= (int32_t)metaData.size()-1) {
// Remove old element :
//EDN_DEBUG(" --> Remove : " << addingPos << "==>" << (int32_t)metaData.size() << " (end)" );
metaData.erase(metaData.begin()+addingPos,metaData.end());
} else { } else {
// Remove old element : // Not find ==> exit the cycle :
//EDN_DEBUG(" --> Remove : " << addingPos << "==>" << findNextElement+1 ); break;
metaData.erase(metaData.begin()+addingPos,metaData.begin()+findNextElement+1);
newEnd = metaData[addingPos].beginStart-1;
} }
// Regenerate a local parsing : in a higher range of text
Parse(elementStart, edn_max(newEnd, stop), metaData, addingPos, buffer, elementID);
// Break the curent process, beacause we reparse the data in all range...
return;
} else {
//EDN_DEBUG(" --> No element removed " );
metaData.insert(metaData.begin() + addingPos, resultat);
//EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
} }
} else { // Add curent element in the list ...
metaData.insert(metaData.begin() + addingPos, resultat); metaData.Insert(addingPos, resultat);
//EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop ); //EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
// Update the current research starting element: (Set position at the end of the current element
elementStart = resultat.endStop-1;
// increment the position of insertion:
addingPos++;
// We find a pattern ==> Stop search for the current element
break;
} }
// parse the under element :
Parse(elementStart, resultat.beginStart-1, metaData, addingPos, buffer, elementID+1);
addingPos++;
elementStart = resultat.endStop;
} }
// Go to the next element (and search again ...).
elementStart++;
} }
// parse the under element :
Parse(elementStart, elementStop, metaData, addingPos, buffer, elementID+1);
} }
/** /**
* @brief second pass of the hightlight * @brief second pass of the hightlight
* *
*/ */
void Highlight::Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID) void Highlight::Parse2(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer)
{ {
if (elementID >= (int32_t)m_listHighlightPass2.size() ){ //EDN_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " ==> position search: (" << start << "," << stop << ")" );
return;
}
int32_t elementStart = start; int32_t elementStart = start;
int32_t elementStop = stop; int32_t elementStop = stop;
resultFind_te ret = HLP_FIND_OK;
colorInformation_ts resultat; colorInformation_ts resultat;
while (HLP_FIND_ERROR != ret && elementStart<elementStop) { while (elementStart<elementStop) {
if (m_listHighlightPass2[elementID]!=NULL) { //EDN_DEBUG("Parse element in the buffer id=" << elementStart);
ret = m_listHighlightPass2[elementID]->Find(elementStart, elementStop, resultat, buffer); //try to fond the HL in ALL of we have
} else { int32_t jjj;
ret = HLP_FIND_ERROR; for (jjj=0; jjj<m_listHighlightPass2.Size(); jjj++){
} resultFind_te ret = HLP_FIND_OK;
if (HLP_FIND_ERROR != ret) { //EDN_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); // Stop the search to the end (to get the end of the pattern)
// parse the under element : ret = m_listHighlightPass2[jjj]->Find(elementStart, elementStop, resultat, buffer);
Parse2(elementStart, resultat.beginStart, metaData, buffer, elementID+1); if (HLP_FIND_ERROR != ret) {
// Add curent element in the list ... //EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
metaData.push_back(resultat); // Add curent element in the list ...
elementStart = resultat.endStop; metaData.PushBack(resultat);
elementStart = resultat.endStop;
// Exit current cycle
break;
}
} }
// Go to the next element (and search again ...).
elementStart++;
} }
// parse the under element :
Parse2(elementStart, elementStop, metaData, buffer, elementID+1);
} }

View File

@@ -23,6 +23,7 @@
******************************************************************************* *******************************************************************************
*/ */
#include "Edn.h"
#ifndef __HIGHLIGHT_H__ #ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__ #define __HIGHLIGHT_H__
@@ -38,14 +39,12 @@ extern "C" {
int32_t endStart; int32_t endStart;
int32_t endStop; int32_t endStop;
bool notEnded; bool notEnded;
HighlightPattern * patern; // pointer on class : HighlightPattern * patern; // pointer on class :
} colorInformation_ts; } colorInformation_ts;
} }
#include <vector>
#include "HighlightPattern.h" #include "HighlightPattern.h"
#include "Colorize.h" #include "Colorize.h"
#include "Edn.h"
#include "EdnVectorBuf.h" #include "EdnVectorBuf.h"
#include "tinyxml.h" #include "tinyxml.h"
@@ -55,17 +54,23 @@ class Highlight {
Highlight(Edn::String &xmlFilename); Highlight(Edn::String &xmlFilename);
~Highlight(void); ~Highlight(void);
bool HasExtention(Edn::String &ext); bool HasExtention(Edn::String &ext);
bool FileNameCompatible(Edn::String &fileName); bool FileNameCompatible(Edn::File &fileName);
void Display(void); void Display(void);
void Parse( int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID=0); void Parse(int32_t start,
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0); int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
int32_t addingPos,
EdnVectorBuf &buffer);
void Parse2(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer);
private: private:
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level); void ParseRules(TiXmlNode *child, Edn::VectorType<HighlightPattern*> &mListPatern, int32_t level);
Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<Edn::String> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" Edn::VectorType<Edn::String*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer) Edn::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) ) Edn::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
}; };

View File

@@ -37,14 +37,23 @@ HighlightManager::HighlightManager(void)
HighlightManager::~HighlightManager(void) HighlightManager::~HighlightManager(void)
{ {
listHighlight.clear(); int32_t i;
// clean all Element
for (i=0; i< listHighlight.Size(); i++) {
if (NULL != listHighlight[i]) {
delete(listHighlight[i]);
listHighlight[i] = NULL;
}
}
// clear the compleate list
listHighlight.Clear();
} }
Highlight *HighlightManager::Get(Edn::String &fileName) Highlight *HighlightManager::Get(Edn::File &fileName)
{ {
uint32_t i; int32_t i;
for (i=0; i<listHighlight.size(); i++) { for (i=0; i<listHighlight.Size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) { if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return listHighlight[i]; return listHighlight[i];
} }
@@ -52,13 +61,10 @@ Highlight *HighlightManager::Get(Edn::String &fileName)
return NULL; return NULL;
} }
bool HighlightManager::Exist(Edn::String &fileName) bool HighlightManager::Exist(Edn::File &fileName)
{ {
uint32_t i; if (NULL != Get(fileName) ) {
for (i=0; i<listHighlight.size(); i++) { return true;
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return true;
}
} }
return false; return false;
} }
@@ -68,41 +74,40 @@ void HighlightManager::loadLanguages(void)
{ {
Edn::String homedir; Edn::String homedir;
#ifdef NDEBUG #ifdef NDEBUG
homedir = getenv("HOME"); homedir = "/usr/share/edn/";
homedir += "/.edn/";
#else #else
homedir = "./"; homedir = "./data/";
#endif #endif
Edn::String xmlFilename = homedir; Edn::String xmlFilename = homedir;
xmlFilename += "data/lang_c.xml"; xmlFilename += "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename); Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = homedir; xmlFilename = homedir;
xmlFilename += "data/lang_boo.xml"; xmlFilename += "lang_boo.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = homedir; xmlFilename = homedir;
xmlFilename += "data/lang_Makefile.xml"; xmlFilename += "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = homedir; xmlFilename = homedir;
xmlFilename += "data/lang_asm.xml"; xmlFilename += "lang_asm.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = homedir; xmlFilename = homedir;
xmlFilename += "data/lang_xml.xml"; xmlFilename += "lang_xml.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
xmlFilename = homedir; xmlFilename = homedir;
xmlFilename += "data/lang_php.xml"; xmlFilename += "lang_php.xml";
myHightline = new Highlight(xmlFilename); myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline); listHighlight.PushBack(myHightline);
myHightline->Display(); myHightline->Display();
} }

View File

@@ -29,8 +29,6 @@
class HighlightManager; class HighlightManager;
#include "Singleton.h" #include "Singleton.h"
#include <vector>
#include <string>
#include "Highlight.h" #include "Highlight.h"
@@ -45,11 +43,11 @@ class HighlightManager: public Singleton<HighlightManager>
public: public:
void loadLanguages(void); void loadLanguages(void);
Highlight * Get(Edn::String &fileName); Highlight * Get(Edn::File &fileName);
bool Exist(Edn::String &fileName); bool Exist(Edn::File &fileName);
private: private:
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules Edn::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
}; };
#endif #endif

View File

@@ -98,10 +98,10 @@ bool HighlightPattern::IsEnable(void)
void HighlightPattern::Display(void) void HighlightPattern::Display(void)
{ {
/* /*
EDN_INFO("patern : \"" << m_paternName.c_str() << "\" level=" << m_level ); EDN_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
EDN_INFO(" ==> colorName \"" << m_colorName.c_str() << "\""); EDN_INFO(" ==> colorName \"" << m_colorName << "\"");
EDN_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp().c_str() << "\""); EDN_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp() << "\"");
EDN_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp().c_str() << "\""); EDN_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp() << "\"");
if (true == m_haveStopPatern) { if (true == m_haveStopPatern) {
EDN_INFO(" ==> stop pattern: YES"); EDN_INFO(" ==> stop pattern: YES");
} else { } else {
@@ -115,7 +115,7 @@ void HighlightPattern::Display(void)
*/ */
// Display all elements // Display all elements
for (int32_t i=0; i< m_subPatern.Size(); i++) { for (int32_t i=0; i< m_subPatern.Size(); i++) {
EDN_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName().c_str() ); EDN_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
m_subPatern[i]->Display(); m_subPatern[i]->Display();
} }
} }
@@ -190,6 +190,19 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
} }
} }
/**
* @brief Find Element only in the specify start characters and find the end with the range done
*
* @param[in] start First character to search data (if recognise it start here)
* @param[in] stop End of the possibility whe search can continue
* @param[out] resultat Position where find data
* @param[in] buffer : Where to search data
*
* @return HLP_FIND_OK We find a compleate pattern
* @return HLP_FIND_OK_NO_END Xe find a partial pattern (missing end)
* @return HLP_FIND_ERROR Not find the pattern
*/
resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer) resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer)
{ {
//EDN_DEBUG(" try to find the element"); //EDN_DEBUG(" try to find the element");
@@ -202,7 +215,7 @@ resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformati
// when we have only one element : // when we have only one element :
if (false == m_haveStopPatern) { if (false == m_haveStopPatern) {
if (true == m_regExpStart->Process(buffer, start, stop)) { if (true == m_regExpStart->ProcessOneElement(buffer, start, stop)) {
resultat.beginStart = m_regExpStart->Start(); resultat.beginStart = m_regExpStart->Start();
resultat.beginStop = m_regExpStart->Stop(); resultat.beginStop = m_regExpStart->Stop();
resultat.endStart = m_regExpStart->Start(); resultat.endStart = m_regExpStart->Start();
@@ -212,7 +225,7 @@ resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformati
//EDN_DEBUG("NOT find hightlightpatern ..."); //EDN_DEBUG("NOT find hightlightpatern ...");
} else { } else {
// try while we find the first element // try while we find the first element
if (true == m_regExpStart->Process(buffer, start, stop, m_escapeChar)) { if (true == m_regExpStart->ProcessOneElement(buffer, start, stop, m_escapeChar)) {
resultat.beginStart = m_regExpStart->Start(); resultat.beginStart = m_regExpStart->Start();
resultat.beginStop = m_regExpStart->Stop(); resultat.beginStop = m_regExpStart->Stop();
if (true == m_regExpStop->Process(buffer, resultat.beginStop, stop, m_escapeChar)) { if (true == m_regExpStop->Process(buffer, resultat.beginStop, stop, m_escapeChar)) {

View File

@@ -65,7 +65,7 @@ class HighlightPattern {
bool IsEnable(void); bool IsEnable(void);
void Display(void); void Display(void);
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer); resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer);
Colorize * GetColor(void) { return m_color; }; Colorize * GetColor(void) { return m_color; };
void ParseRules(TiXmlNode *child, int32_t level); void ParseRules(TiXmlNode *child, int32_t level);
@@ -79,8 +79,8 @@ class HighlightPattern {
bool m_haveStopPatern; //!< Stop patern presence bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline bool m_multiline; //!< The patern is multiline
char m_escapeChar; //!< Escape char to prevent exeit of patern .... char m_escapeChar; //!< Escape char to prevent exeit of patern ....
Edn::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one Edn::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// Edn::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ... // Edn::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
}; };
#endif #endif

View File

@@ -99,10 +99,8 @@ void CTagsManager::OnMessage(int32_t id, int32_t dataID)
{ {
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL, GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, // button text GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_RESPONSE_CANCEL, // response id GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
GTK_STOCK_OPEN, // button text
GTK_RESPONSE_ACCEPT, // response id
NULL); // end button/response list NULL); // end button/response list
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{ {
@@ -141,7 +139,7 @@ void CTagsManager::LoadTagFile(void)
return; return;
} }
// load (open) the tag file : // load (open) the tag file :
EDN_INFO("try to open tag file : " << m_tagFilename.c_str()); EDN_INFO("try to open tag file : " << m_tagFilename);
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info); m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
if (NULL != m_ctagFile) { if (NULL != m_ctagFile) {
EDN_INFO("open exuberant Ctags file is OK ..."); EDN_INFO("open exuberant Ctags file is OK ...");
@@ -161,15 +159,146 @@ void CTagsManager::AddToHistory(int32_t bufferID)
} }
// add the current element // add the current element
BufferManager *myBufferManager = BufferManager::getInstance(); BufferManager *myBufferManager = BufferManager::getInstance();
Edn::String currentFilename = myBufferManager->Get(bufferID)->GetName(); Edn::File currentFilename = myBufferManager->Get(bufferID)->GetFileName();
int32_t currentLineId = 0; }
Edn::File * currentFile = new Edn::File(currentFilename);
enum
{
CTAGS_COL_FILE = 0,
CTAGS_COL_LINE_NUMBER,
CTAGS_NUM_COLS
};
GtkTreeModel * CTagsManager::CreateAndFillModel(void)
{
GtkListStore * store;
GtkTreeIter iter;
store = 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(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);
}
GtkWidget * CTagsManager::CreateViewAndModel(void)
{
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),
-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);
model = CreateAndFillModel();
gtk_tree_view_set_model(GTK_TREE_VIEW (view), model);
g_object_unref(model);
return view;
}
int32_t CTagsManager::MultipleJump(void)
{
// dlg to confirm the quit event :
GtkWidget *myDialog = gtk_dialog_new_with_buttons("C-Tags jump...",
NULL,
GTK_DIALOG_MODAL,
"Jump", GTK_RESPONSE_YES,
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL);
// Set over main windows
//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 = 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));
// 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) void CTagsManager::JumpTo(void)
{ {
m_currentList.Clear();
if (NULL != m_ctagFile) { if (NULL != m_ctagFile) {
Edn::VectorType<int8_t> data; Edn::VectorType<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 ...
@@ -181,32 +310,37 @@ void CTagsManager::JumpTo(void)
data.PushBack('\0'); data.PushBack('\0');
EDN_INFO("try to find the tag : " << (const char *)&data[0]); EDN_INFO("try to find the tag : " << (const char *)&data[0]);
if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) { if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) {
//EDN_INFO("find the tag"); tagEntry entrySave = entry;
BufferManager *myBufferManager = BufferManager::getInstance(); int32_t numberOfTags = 0;
Edn::String destinationFilename = m_tagFolderBase;
destinationFilename += entry.file; // For all tags : Save in an internal Structure :
EDN_INFO(" OPEN the TAG file Destination : " << destinationFilename.c_str() );
if (false == myBufferManager->Exist(destinationFilename) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(destinationFilename);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(destinationFilename));
}
int32_t localId = myBufferManager->GetId(destinationFilename);
Edn::String pattern = entry.address.pattern;
EDN_DEBUG("try to find line with : \"" << pattern.c_str() << "\"" );
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.c_str() << "\"" );
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
/*
do { 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); } while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
*/ */
} else { } else {
@@ -215,21 +349,26 @@ void CTagsManager::JumpTo(void)
} }
} }
void CTagsManager::PrintTag (const tagEntry *entry) void CTagsManager::PrintTag (const tagEntry *entry, bool small)
{ {
int i; if (small==true) {
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" pattern=\"" <<entry->address.pattern << "\" at line="<< entry->address.lineNumber);
<< "\" 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 : "); EDN_INFO("Extention field : ");
if (entry->kind != NULL && entry->kind [0] != '\0') { if (entry->kind != NULL && entry->kind [0] != '\0') {
EDN_INFO(" kind : " << entry->kind); EDN_INFO(" kind : " << entry->kind);
} }
if (entry->fileScope) { if (entry->fileScope) {
EDN_INFO(" file : "); EDN_INFO(" file : ");
} }
for (i = 0 ; i < entry->fields.count ; ++i) { for (i = 0 ; i < entry->fields.count ; ++i) {
EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value ); EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
}
} }
} }

View File

@@ -32,6 +32,14 @@
#include "readtags.h" #include "readtags.h"
#include "Edn.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 class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
{ {
@@ -47,8 +55,9 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
private: private:
int32_t m_currentSelectedID; int32_t m_currentSelectedID;
void LoadTagFile(void); void LoadTagFile(void);
int32_t MultipleJump(void);
void JumpTo(void); void JumpTo(void);
void PrintTag(const tagEntry *entry); void PrintTag(const tagEntry *entry, bool small);
Edn::String GetFolder(Edn::String &inputString); Edn::String GetFolder(Edn::String &inputString);
Edn::String m_tagFolderBase; Edn::String m_tagFolderBase;
Edn::String m_tagFilename; Edn::String m_tagFilename;
@@ -57,6 +66,12 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
void AddToHistory(int32_t bufferID); void AddToHistory(int32_t bufferID);
int32_t m_historyPos; int32_t m_historyPos;
Edn::VectorType<Edn::File*> m_historyList; 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 #endif

View File

@@ -80,13 +80,13 @@ int main (int argc, char *argv[])
ColorizeManager *myColorManager = NULL; ColorizeManager *myColorManager = NULL;
myColorManager = ColorizeManager::getInstance(); myColorManager = ColorizeManager::getInstance();
Edn::String homedir; Edn::String homedir;
//homedir = getenv("HOME");
#ifdef NDEBUG #ifdef NDEBUG
homedir = getenv("HOME"); homedir = "/usr/share/edn/";
homedir += "/.edn/";
#else #else
homedir = "./"; homedir = "./data/";
#endif #endif
homedir += "data/color_black.xml"; homedir += "color_black.xml";
myColorManager->LoadFile( homedir.c_str() ); myColorManager->LoadFile( homedir.c_str() );
myColorManager->DisplayListOfColor(); myColorManager->DisplayListOfColor();
@@ -110,13 +110,8 @@ int main (int argc, char *argv[])
EDN_INFO("show list of files : "); EDN_INFO("show list of files : ");
for( int32_t i=1 ; i<argc; i++) { for( int32_t i=1 ; i<argc; i++) {
EDN_INFO("need load file : \"" << argv[i] << "\"" ); EDN_INFO("need load file : \"" << argv[i] << "\"" );
Edn::String myfile = ""; Edn::File myfile = (char *)argv[i];
// Special case for the root file origin
if ('/' != argv[i][0]) {
myfile+=cCurrentPath;
myfile+="/";
}
myfile+=(char *)argv[i];
if (false == myBufferManager->Exist(myfile) ) { if (false == myBufferManager->Exist(myfile) ) {
int32_t idBuffOpened = myBufferManager->Open(myfile); int32_t idBuffOpened = myBufferManager->Open(myfile);
if (1==i) { if (1==i) {

View File

@@ -246,7 +246,6 @@ void DrawerManager::Text(color_ts & SelectColorFg, color_ts & SelectColorBg, int
cairo_set_font_face(m_cairo, Display::GetFont(false, false)); cairo_set_font_face(m_cairo, Display::GetFont(false, false));
int32_t letterHeight = Display::GetFontHeight(); int32_t letterHeight = Display::GetFontHeight();
int32_t letterWidth = Display::GetFontWidth(); int32_t letterWidth = Display::GetFontWidth();
int32_t stringLen = strUtf8Len(myText);
DirectRectangle(SelectColorBg, x, y, letterWidth*strlen(myText), letterHeight); DirectRectangle(SelectColorBg, x, y, letterWidth*strlen(myText), letterHeight);
cairo_fill(m_cairo); cairo_fill(m_cairo);
cairo_move_to(m_cairo, x, y+letterHeight-4); cairo_move_to(m_cairo, x, y+letterHeight-4);

View File

@@ -26,11 +26,9 @@
#ifndef __TOOLS_DISPLAY_H__ #ifndef __TOOLS_DISPLAY_H__
#define __TOOLS_DISPLAY_H__ #define __TOOLS_DISPLAY_H__
#include "tools_debug.h" #include "tools_debug.h"
#include "Colorize.h" #include "Colorize.h"
#include "ColorizeManager.h" #include "ColorizeManager.h"
#include <string>
#include <vector>
/** /**

View File

@@ -49,13 +49,13 @@ end *************** *************
*/ */
typedef struct { typedef struct {
bool selected; //!< True if the selection is active bool selected; //!< True if the selection is active
bool rectangular; //!< True if the selection is rectangular bool rectangular; //!< True if the selection is rectangular
bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard. bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard.
int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it. int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it.
int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it. int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it.
int32_t rectStart; //!< Indent of left edge of rect. selection int32_t rectStart; //!< Indent of left edge of rect. selection
int32_t rectEnd; //!< Indent of right edge of rect. selection int32_t rectEnd; //!< Indent of right edge of rect. selection
} selection; } selection;
typedef enum{ typedef enum{
@@ -67,10 +67,10 @@ typedef enum{
typedef struct { typedef struct {
std::vector<colorInformation_ts> HLData; Edn::VectorType<colorInformation_ts> HLData;
int32_t idSequence; int32_t idSequence;
int32_t posHLPass1; int32_t posHLPass1;
int32_t posHLPass2; int32_t posHLPass2;
}displayHLData_ts; }displayHLData_ts;
@@ -125,54 +125,54 @@ class EdnBuf {
// selection remember... // selection remember...
// ----------------------------------------- // -----------------------------------------
public: public:
bool SelectHasSelection( selectionType_te select); bool SelectHasSelection( selectionType_te select);
void Select( selectionType_te select, int32_t start, int32_t end); void Select( selectionType_te select, int32_t start, int32_t end);
void Unselect( selectionType_te select); void Unselect( selectionType_te select);
void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd); void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd); bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text); void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text);
void RemoveSelected( selectionType_te select); void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text); void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text);
private: private:
// current selection of the buffer // current selection of the buffer
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted); void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted);
void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted); void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted);
// ----------------------------------------- // -----------------------------------------
// History section : // History section :
// ----------------------------------------- // -----------------------------------------
public: public:
int32_t Undo( void); int32_t Undo(void);
int32_t Redo( void); int32_t Redo(void);
private: private:
bool m_isUndoProcessing; bool m_isUndoProcessing;
bool m_isRedoProcessing; bool m_isRedoProcessing;
Edn::VectorType<EdnBufHistory*> m_historyUndo; Edn::VectorType<EdnBufHistory*> m_historyUndo;
Edn::VectorType<EdnBufHistory*> m_historyRedo; Edn::VectorType<EdnBufHistory*> m_historyRedo;
// ----------------------------------------- // -----------------------------------------
// hightlight section : // hightlight section :
// ----------------------------------------- // -----------------------------------------
private: private:
Highlight * m_Highlight; //!< internal link with the Highlight system Highlight * m_Highlight; //!< internal link with the Highlight system
std::vector<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1 Edn::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded); void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0); void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void); void CleanHighLight(void);
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded); void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
public: public:
void SetHLSystem( Highlight * newHLSystem); void SetHLSystem( Highlight * newHLSystem);
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines); void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines);
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos); colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
private: private:
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos); colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
private: private:
EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t
void CountNumberOfLines(void); void CountNumberOfLines(void);
int32_t m_nbLine; //!< Number of line in the biffer int32_t m_nbLine; //!< Number of line in the biffer
// ----------------------------------------- // -----------------------------------------
// Display property and charset ... // Display property and charset ...
@@ -186,27 +186,27 @@ class EdnBuf {
void SetUTF8Mode(bool newOne) { m_isUtf8 = newOne; m_charsetType=EDN_CHARSET_UTF8; }; void SetUTF8Mode(bool newOne) { m_isUtf8 = newOne; m_charsetType=EDN_CHARSET_UTF8; };
private: private:
// Special mode of the buffer : // Special mode of the buffer :
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now) bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
// Local Tabulation policies // Local Tabulation policies
int32_t m_tabDist; //!< equiv. number of characters in a tab int32_t m_tabDist; //!< equiv. number of characters in a tab
bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations
// ----------------------------------------- // -----------------------------------------
// Local function : // Local function :
// ----------------------------------------- // -----------------------------------------
private: private:
void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd); void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd);
char *getSelectionText( selection &sel); char * getSelectionText( selection &sel);
void removeSelected( selection &sel); void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text); void replaceSelected( selection &sel, const char *text);
void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText); void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText); int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
bool charMatch( char first, char second, bool caseSensitive = true); bool charMatch( char first, char second, bool caseSensitive = true);
}; };
#endif #endif

View File

@@ -35,12 +35,12 @@ void EdnBuf::SetHLSystem(Highlight * newHLSystem)
{ {
if (m_Highlight != newHLSystem) { if (m_Highlight != newHLSystem) {
m_Highlight = newHLSystem; m_Highlight = newHLSystem;
m_HLDataPass1.clear(); m_HLDataPass1.Clear();
RegenerateHighLightAt(0, 0, m_data.Size()); RegenerateHighLightAt(0, 0, m_data.Size());
} }
} }
// TODO : Check this fuction it have too many conditionnal inside ==> can do a better algo
void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded) void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded)
{ {
GTimeVal timeStart; GTimeVal timeStart;
@@ -60,14 +60,23 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
return; return;
} }
// normal case // normal case
EDN_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");"); //EDN_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
int32_t i; int32_t i;
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
EDN_DEBUG("HighLight (previous) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
int32_t posEnd = pos + nbDeleted; int32_t posEnd = pos + nbDeleted;
// search position of the old element to reparse IT... // search position of the old element to reparse IT...
int32_t startId; int32_t startId;
int32_t stopId; int32_t stopId;
// clean data if needed // clean data if needed
if (0 != m_HLDataPass1.size()) { if (0 != m_HLDataPass1.Size()) {
// find element previous // find element previous
FindMainHighLightPosition(pos, posEnd, startId, stopId, true); FindMainHighLightPosition(pos, posEnd, startId, stopId, true);
@@ -75,19 +84,37 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
if( -1 == startId if( -1 == startId
&& -1 == stopId) && -1 == stopId)
{ {
m_HLDataPass1.clear(); m_HLDataPass1.Clear();
} else if(-1 == startId) { } else if(-1 == startId) {
if (0 == stopId){ if (0 == stopId){
m_HLDataPass1.erase(m_HLDataPass1.begin()); m_HLDataPass1.Erase(0);
//EDN_DEBUG("1 * Erase 0");
} else { } else {
m_HLDataPass1.erase(m_HLDataPass1.begin(),m_HLDataPass1.begin()+stopId); m_HLDataPass1.Erase(0,stopId);
//EDN_DEBUG("2 * Erase 0->" << stopId);
} }
} else if(-1 == stopId) { } else if(-1 == stopId) {
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1,m_HLDataPass1.end()); //EDN_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size() - startId);
stopId = -1;
} else { } else {
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1,m_HLDataPass1.begin()+stopId); int32_t currentSize = m_HLDataPass1.Size();
//EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.Erase(startId+1, stopId - startId);
if (stopId == currentSize-1) {
stopId = -1;
}
} }
EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1); //EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
EDN_DEBUG("HighLight (Middle) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
// update position after the range position : // update position after the range position :
int32_t elemStart; int32_t elemStart;
if(-1 == startId) { if(-1 == startId) {
@@ -95,7 +122,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
} else { } else {
elemStart = startId+1; elemStart = startId+1;
} }
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) { for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
//EDN_DEBUG("move element=" << i); //EDN_DEBUG("move element=" << i);
m_HLDataPass1[i].beginStart += nbAdded - nbDeleted; m_HLDataPass1[i].beginStart += nbAdded - nbDeleted;
m_HLDataPass1[i].beginStop += nbAdded - nbDeleted; m_HLDataPass1[i].beginStop += nbAdded - nbDeleted;
@@ -113,23 +140,24 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0); GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
} else if(-1 == stopId) { } else if(-1 == stopId) {
//EDN_DEBUG("******* Regenerate STOP"); //EDN_DEBUG("******* Regenerate STOP");
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.Size(), m_HLDataPass1.size()); GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.Size() -1].endStop, m_data.Size(), m_HLDataPass1.Size());
} else { } else {
//EDN_DEBUG("******* Regenerate RANGE"); //EDN_DEBUG("******* Regenerate RANGE");
GenerateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1); GenerateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
} }
} else { } else {
// Parse the new element ... // Parse the new element ...
//GenerateHighLightAt(pos, nbAdded);
GenerateHighLightAt(0, m_data.Size()); GenerateHighLightAt(0, m_data.Size());
} }
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) { /*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp; Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) { if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName(); ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
} }
//EDN_DEBUG("HighLight element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp.c_str() ); EDN_DEBUG("HighLight (end) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
} }
*/
GTimeVal timeStop; GTimeVal timeStop;
g_get_current_time(&timeStop); g_get_current_time(&timeStop);
EDN_DEBUG("HL General = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s"); EDN_DEBUG("HL General = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
@@ -177,7 +205,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
S=-1 *************** E S=-1 *************** E
*/ */
int32_t i; int32_t i;
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) { for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
if (m_HLDataPass1[i].endStop > startPos) { if (m_HLDataPass1[i].endStop > startPos) {
break; break;
} }
@@ -198,7 +226,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
} else { } else {
elemStart = startId+1; elemStart = startId+1;
} }
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) { for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
if (m_HLDataPass1[i].beginStart > endPos) if (m_HLDataPass1[i].beginStart > endPos)
{ {
stopId = i; stopId = i;
@@ -206,13 +234,13 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
} }
} }
/* /*
if (-1 != startId && startId < (int32_t)m_HLDataPass1.size()) { if (-1 != startId && startId < (int32_t)m_HLDataPass1.Size()) {
EDN_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.size()-1); EDN_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.Size()-1);
} else { } else {
EDN_DEBUG("==> BEGIN : start=???, stop=??? id=" << startId); EDN_DEBUG("==> BEGIN : start=???, stop=??? id=" << startId);
} }
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.size()) { if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.Size()) {
EDN_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.size()-1); EDN_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.Size()-1);
} else { } else {
EDN_DEBUG("==> END : start=???, stop=??? id=" << stopId); EDN_DEBUG("==> END : start=???, stop=??? id=" << stopId);
} }
@@ -236,7 +264,7 @@ void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
void EdnBuf::CleanHighLight(void) void EdnBuf::CleanHighLight(void)
{ {
// Remove all element in the list... // Remove all element in the list...
m_HLDataPass1.clear(); m_HLDataPass1.Clear();
} }
@@ -244,7 +272,7 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
{ {
int32_t i; int32_t i;
int32_t start = edn_max(0, starPos-1); int32_t start = edn_max(0, starPos-1);
for (i=start; i<(int32_t)m_HLDataPass1.size(); i++) { for (i=start; i<(int32_t)m_HLDataPass1.Size(); i++) {
starPos = i; starPos = i;
if( m_HLDataPass1[i].beginStart <= pos if( m_HLDataPass1[i].beginStart <= pos
&& m_HLDataPass1[i].endStop > pos) && m_HLDataPass1[i].endStop > pos)
@@ -272,7 +300,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
g_get_current_time(&timeStart); g_get_current_time(&timeStart);
MData.idSequence = m_HLDataSequence; MData.idSequence = m_HLDataSequence;
HLStart = StartOfLine(HLStart); HLStart = StartOfLine(HLStart);
MData.HLData.clear(); MData.HLData.Clear();
int32_t HLStop = CountForwardNLines(HLStart, nbLines); int32_t HLStop = CountForwardNLines(HLStart, nbLines);
int32_t startId, stopId; int32_t startId, stopId;
// find element previous // find element previous
@@ -282,7 +310,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//EDN_DEBUG("List of section between : "<< startId << " & " << stopId); //EDN_DEBUG("List of section between : "<< startId << " & " << stopId);
int32_t endSearch = stopId+1; int32_t endSearch = stopId+1;
if (-1 == stopId) { if (-1 == stopId) {
endSearch = m_HLDataPass1.size(); endSearch = m_HLDataPass1.Size();
} }
for (k=edn_max(startId, 0); k<endSearch; k++) { for (k=edn_max(startId, 0); k<endSearch; k++) {
// empty section : // empty section :
@@ -305,9 +333,9 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999); //EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ... // TODO : ...
} }
if (endSearch == (int32_t)m_HLDataPass1.size() ){ if (endSearch == (int32_t)m_HLDataPass1.Size() ){
//if( k < (int32_t)m_HLDataPass1.size()) { //if( k < (int32_t)m_HLDataPass1.Size()) {
if (m_HLDataPass1.size() != 0) { if (m_HLDataPass1.Size() != 0) {
//EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop ); //EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop, m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
HLStop, HLStop,
@@ -334,7 +362,7 @@ colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData
{ {
int32_t i; int32_t i;
int32_t start = edn_max(0, MData.posHLPass2-1); int32_t start = edn_max(0, MData.posHLPass2-1);
for (i=start; i<(int32_t)MData.HLData.size(); i++) { for (i=start; i<(int32_t)MData.HLData.Size(); i++) {
MData.posHLPass2 = i; MData.posHLPass2 = i;
if( MData.HLData[i].beginStart <= pos if( MData.HLData[i].beginStart <= pos
&& MData.HLData[i].endStop > pos) && MData.HLData[i].endStop > pos)

View File

@@ -28,12 +28,34 @@
#include "tools_globals.h" #include "tools_globals.h"
#include "Edn.h" #include "Edn.h"
#undef __class__
#define __class__ "Edn::File"
std::ostream& Edn::operator <<(std::ostream &os, const Edn::File &obj)
{
os << obj.m_folder;
os << "/";
os << obj.m_shortFilename;
return os;
}
Edn::File::File(Edn::String &filename, int32_t LineNumber) Edn::File::File(Edn::String &filename, int32_t LineNumber)
{ {
m_lineNumberOpen = 0; m_lineNumberOpen = LineNumber;
SetCompleateName(filename); SetCompleateName(filename);
} }
Edn::File::File(const char *filename, int32_t LineNumber)
{
Edn::String tmpString = filename;
m_lineNumberOpen = LineNumber;
SetCompleateName(tmpString);
}
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber) Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
{ {
Edn::String tmpString = folder; Edn::String tmpString = folder;
@@ -43,72 +65,178 @@ Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
m_lineNumberOpen = lineNumber; m_lineNumberOpen = lineNumber;
} }
Edn::File::~File(void) Edn::File::~File(void)
{ {
// nothing to do ... // nothing to do ...
} }
void Edn::File::ExtranctAndName(Edn::String &inputString)
{
m_folder = "";
m_shortFilename = "";
for (int32_t iii=inputString.Size()-1; iii >= 0 ; iii--) { Edn::String Edn::File::GetFolder(void) const
/*
if (inputString[iii] != '/') {
m_shortFilename.Insert(0, inputString[iii]);
} else {
break;
}
*/
}
/*
char tmpVal[4096];
strncpy(tmpVal, inputString.c_str(), 4096);
tmpVal[4096-1] = '\0';
char *ptr = strrchr(tmpVal, '/');
if (NULL == ptr) {
ptr = strrchr(tmpVal, '\\');
}
Edn::String out = "./";
if (NULL != ptr) {
*ptr = '\0';
out = tmpVal;
out+= '/';
}
return out;
*/
}
Edn::String Edn::File::GetFolder(void)
{ {
return m_folder; return m_folder;
} }
Edn::String Edn::File::GetShortFilename(void) Edn::String Edn::File::GetShortFilename(void) const
{ {
return m_shortFilename; return m_shortFilename;
} }
Edn::String Edn::File::GetCompleateName(void) Edn::String Edn::File::GetCompleateName(void) const
{ {
Edn::String out; Edn::String out;
out = m_folder; out = m_folder;
out += '/'; out += '/';
out += m_shortFilename; out += m_shortFilename;
return out;
} }
const Edn::File& Edn::File::operator= (const Edn::File &ednF )
{
if( this != &ednF ) // avoid copy to itself
{
m_folder = ednF.m_folder;
m_shortFilename = ednF.m_shortFilename;
m_lineNumberOpen = ednF.m_lineNumberOpen;
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::File::operator== (const Edn::File &ednF) const
{
if( this != &ednF ) {
if (ednF.GetCompleateName() == GetCompleateName() ) {
return true;
} else {
return false;
}
return true;
}
return true;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::File::operator!= (const Edn::File &ednF) const
{
return !(*this == ednF);
}
void Edn::File::SetCompleateName(Edn::String &newFilename) void Edn::File::SetCompleateName(Edn::String &newFilename)
{ {
char buf[MAX_FILE_NAME];
memset(buf, 0, MAX_FILE_NAME);
char * ok;
// Reset ALL DATA :
m_folder = "";
m_shortFilename = "";
m_lineNumberOpen = 0;
EDN_DEBUG("1 :Set Name : " << newFilename );
Edn::String destFilename;
if (newFilename.Size() == 0) {
destFilename = "no-name";
} else {
destFilename = newFilename;
}
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];
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
return;
}
cCurrentPath[FILENAME_MAX - 1] = '\0';
Edn::String tmpFilename = destFilename;
destFilename = cCurrentPath;
destFilename += '/';
destFilename += tmpFilename;
}
EDN_DEBUG("3 : Get file Name : " << destFilename );
// Get the real Path of the current File
ok = realpath(destFilename.c_str(), buf);
if (!ok) {
int32_t lastPos = destFilename.FindBack('/');
if (-1 != lastPos) {
// Get the FileName
Edn::String tmpFilename = destFilename.Extract(lastPos+1);
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
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 << "\"");
m_shortFilename = tmpFilename;
m_folder = destFilename;
} else {
// ALL is OK ...
m_shortFilename = tmpFilename;
m_folder = destFilename;
}
} else {
EDN_WARNING("file : \"" << destFilename << "\" ==> No data???");
// Basic ERROR ...
m_shortFilename = destFilename;
}
} else {
destFilename = buf;
int32_t lastPos = destFilename.FindBack('/');
if (-1 != lastPos) {
m_shortFilename = destFilename.Extract(lastPos+1);
m_folder = destFilename.Extract(0, lastPos);
} else {
// Basic ERROR ...
EDN_WARNING("file : \"" << destFilename << "\" ==> No data???");
m_shortFilename = destFilename;
}
}
EDN_DEBUG("Set FileName :\"" << m_folder << "\" / \"" << m_shortFilename << "\" ");
} }
int32_t Edn::File::GetLineNumber(void) int32_t Edn::File::GetLineNumber(void)
{ {
return m_lineNumberOpen; return m_lineNumberOpen;
} }
bool Edn::File::HasExtention(void)
{
int32_t lastPos = m_shortFilename.FindBack('.');
if( -1 != lastPos // not find the .
&& 0 != lastPos // Find a . at the fist position .jdlskjdfklj ==> hiden file
&& m_shortFilename.Size() != lastPos ) // Remove file ended with .
{
return true;
} else {
return false;
}
}
Edn::String Edn::File::GetExtention(void)
{
Edn::String tmpExt = "";
int32_t lastPos = m_shortFilename.FindBack('.');
if( -1 != lastPos // not find the .
&& 0 != lastPos // Find a . at the fist position .jdlskjdfklj ==> hiden file
&& m_shortFilename.Size() != lastPos ) // Remove file ended with .
{
// Get the FileName
tmpExt = m_shortFilename.Extract(lastPos+1);
}
return tmpExt;
}

View File

@@ -26,6 +26,8 @@
#ifndef __EDN__FILE_H__ #ifndef __EDN__FILE_H__
#define __EDN__FILE_H__ #define __EDN__FILE_H__
#define MAX_FILE_NAME (10240)
namespace Edn namespace Edn
{ {
class File class File
@@ -33,21 +35,30 @@ namespace Edn
public: public:
File(void) { m_lineNumberOpen=0; } File(void) { m_lineNumberOpen=0; }
File(Edn::String &filename, int32_t LineNumber = 0); File(Edn::String &filename, int32_t LineNumber = 0);
File(const char *filename, int32_t LineNumber = 0);
File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0); File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0);
~File(void); ~File(void);
Edn::String GetFolder(void); Edn::String GetFolder(void) const;
Edn::String GetShortFilename(void); Edn::String GetShortFilename(void) const;
Edn::String GetCompleateName(void); Edn::String GetCompleateName(void) const;
bool HasExtention(void);
Edn::String GetExtention(void);
int32_t GetLineNumber(void); int32_t GetLineNumber(void);
void SetCompleateName(Edn::String &newFilename); void SetCompleateName(Edn::String &newFilename);
const Edn::File& operator= (const Edn::File &ednF );
bool operator== (const Edn::File &ednF ) const;
bool operator!= (const Edn::File &ednF ) const;
friend std::ostream& operator <<( std::ostream &os,const Edn::File &obj);
private : private :
void ExtranctAndName(Edn::String &inputString);
Edn::String m_folder; Edn::String m_folder;
Edn::String m_shortFilename; Edn::String m_shortFilename;
int32_t m_lineNumberOpen; int32_t m_lineNumberOpen;
}; };
std::ostream& operator <<(std::ostream &os, const Edn::File &obj);
} }
#endif #endif

View File

@@ -1801,13 +1801,13 @@ template<class CLASS_TYPE> class EdnRegExp {
if (true == m_notBeginWithChar) { if (true == m_notBeginWithChar) {
if (i>0) { if (i>0) {
char tmpVal = SearchIn[i-1]; char tmpVal = SearchIn[i-1];
if( ( 'a' <= tmpVal if( ( 'a' <= tmpVal
&& 'z' >= tmpVal ) && 'z' >= tmpVal )
|| ( 'A' <= tmpVal || ( 'A' <= tmpVal
&& 'Z' >= tmpVal ) && 'Z' >= tmpVal )
|| ( '0' <= tmpVal || ( '0' <= tmpVal
&& '9' >= tmpVal ) && '9' >= tmpVal )
|| ( '_' == tmpVal ) ) || ( '_' == tmpVal ) )
{ {
// go on the next char ... // go on the next char ...
continue; continue;
@@ -1827,13 +1827,13 @@ template<class CLASS_TYPE> class EdnRegExp {
if (true == m_notEndWithChar) { if (true == m_notEndWithChar) {
if (i+findLen < SearchIn.Size() ) { if (i+findLen < SearchIn.Size() ) {
char tmpVal = SearchIn[i+findLen]; char tmpVal = SearchIn[i+findLen];
if( ( 'a' <= tmpVal if( ( 'a' <= tmpVal
&& 'z' >= tmpVal ) && 'z' >= tmpVal )
|| ( 'A' <= tmpVal || ( 'A' <= tmpVal
&& 'Z' >= tmpVal ) && 'Z' >= tmpVal )
|| ( '0' <= tmpVal || ( '0' <= tmpVal
&& '9' >= tmpVal ) && '9' >= tmpVal )
|| ( '_' == tmpVal ) ) || ( '_' == tmpVal ) )
{ {
// go on the next char ... // go on the next char ...
continue; continue;
@@ -1860,6 +1860,72 @@ template<class CLASS_TYPE> class EdnRegExp {
return false; return false;
}; };
bool ProcessOneElement( CLASS_TYPE &SearchIn,
int32_t startPos,
int32_t endPos,
char escapeChar=0)
{
if (false == m_isOk) {
return false;
}
int32_t buflen = SearchIn.Size();
if (endPos > buflen) {
endPos = buflen;
}
if (startPos > endPos) {
return false;
}
int32_t findLen=0;
int32_t maxlen = endPos-startPos;
if (true == m_notBeginWithChar) {
if (startPos>0) {
char tmpVal = SearchIn[startPos-1];
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
{
// go on the next char ...
return false;
}
}
}
if (true == m_exprRootNode.Parse(SearchIn, startPos, maxlen, findLen)) {
if( 0!=escapeChar
&& startPos>0)
{
if (escapeChar == (char)SearchIn[startPos-1]) {
//==> detected escape char ==> try find again ...
return false;
}
}
// Check end :
if (true == m_notEndWithChar) {
if (startPos+findLen < SearchIn.Size() ) {
char tmpVal = SearchIn[startPos+findLen];
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
{
// go on the next char ...
return false;
}
}
}
m_areaFind.start = startPos;
m_areaFind.stop = startPos + findLen;
return true;
}
return false;
};
/** /**
* @brief * @brief

View File

@@ -28,8 +28,13 @@
#undef __class__ #undef __class__
#define __class__ "EdnString" #define __class__ "Edn::String"
std::ostream& Edn::operator <<(std::ostream &os, const Edn::String &obj)
{
os << (char*)&obj.m_data[0];
return os;
}
/** /**
* @brief * @brief
@@ -385,6 +390,9 @@ Edn::String Edn::String::operator+ (const char * inputData)
} }
/** /**
* @brief * @brief
* *
@@ -592,57 +600,57 @@ void Edn::TestUntaire_String(void)
int32_t iddd = 0; int32_t iddd = 0;
Edn::String * monString = new Edn::String(); Edn::String * monString = new Edn::String();
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
delete(monString); delete(monString);
monString = new Edn::String("test de direct data"); monString = new Edn::String("test de direct data");
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
delete(monString); delete(monString);
monString = new Edn::String("test de direct data", 7); monString = new Edn::String("test de direct data", 7);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
delete(monString); delete(monString);
int32_t testId = -6789; int32_t testId = -6789;
monString = new Edn::String(testId); monString = new Edn::String(testId);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
delete(monString); delete(monString);
uint32_t testId2 = 12345; uint32_t testId2 = 12345;
monString = new Edn::String((unsigned int)testId2); monString = new Edn::String((unsigned int)testId2);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
delete(monString); delete(monString);
Edn::String plop = "otherString"; Edn::String plop = "otherString";
monString = new Edn::String(plop); monString = new Edn::String(plop);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << monString << "\"");
delete(monString); delete(monString);
Edn::String s1 = "test de base ..."; Edn::String s1 = "test de base ...";
s1 += s1; s1 += s1;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
s1 += " plop 2 "; s1 += " plop 2 ";
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
s1 += plop; s1 += plop;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
s1 = plop; s1 = plop;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
s1 = "test direct 44"; s1 = "test direct 44";
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
Edn::VectorType<int8_t> vb1; Edn::VectorType<int8_t> vb1;
vb1.PushBack('v'); vb1.PushBack('v');
vb1.PushBack('b'); vb1.PushBack('b');
vb1.PushBack('1'); vb1.PushBack('1');
s1 = vb1; s1 = vb1;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
vb1.Clear(); vb1.Clear();
vb1.PushBack('v'); vb1.PushBack('v');
vb1.PushBack('b'); vb1.PushBack('b');
vb1.PushBack('2'); vb1.PushBack('2');
vb1.PushBack('\0'); vb1.PushBack('\0');
s1 = vb1; s1 = vb1;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\""); EDN_INFO("phase : " << iddd++ << " : \"" << s1 << "\"");
if (s1 == "vb2") { if (s1 == "vb2") {
EDN_INFO("phase : " << iddd++ << " : == OK"); EDN_INFO("phase : " << iddd++ << " : == OK");

View File

@@ -25,6 +25,8 @@
#ifndef __END__STRING_H__ #ifndef __END__STRING_H__
#define __END__STRING_H__ #define __END__STRING_H__
#include <iostream>
namespace Edn namespace Edn
{ {
class String class String
@@ -55,6 +57,7 @@ namespace Edn
Edn::String operator+ (const Edn::String &ednS); // + operator Edn::String operator+ (const Edn::String &ednS); // + operator
Edn::String operator+ (const char * inputData); Edn::String operator+ (const char * inputData);
//operator const char *() //operator const char *()
friend std::ostream& operator <<( std::ostream &os,const Edn::String &obj);
bool IsEmpty(void) const; bool IsEmpty(void) const;
int32_t Size(void) const; int32_t Size(void) const;
@@ -76,7 +79,14 @@ namespace Edn
}; };
void TestUntaire_String(void); void TestUntaire_String(void);
std::ostream& operator <<(std::ostream &os, const Edn::String &obj);
} }
#endif #endif

View File

@@ -36,8 +36,6 @@
* *
* @tparam[in] SIZE Size of the current element. * @tparam[in] SIZE Size of the current element.
* *
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
*
* m_data * m_data
* <------------ m_dataSize ------------> * <------------ m_dataSize ------------>
* ---------------------------------------- * ----------------------------------------

View File

@@ -301,6 +301,7 @@ void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &b
} }
} }
#if 0 // Remove for the moment ...
/** /**
* @brief Get the number of element of the previous UTF8 char (in the curent Buffer) * @brief Get the number of element of the previous UTF8 char (in the curent Buffer)
* *
@@ -349,7 +350,7 @@ static void Utf8_SizePreviousElement(const char * data, int32_t lenMax, uint8_t
size = 1; size = 1;
} }
} }
#endif
/** /**
* @brief * @brief

View File

@@ -26,14 +26,11 @@
#include "tools_globals.h" #include "tools_globals.h"
#include "ColorizeManager.h" #include "ColorizeManager.h"
#include "MsgBroadcast.h" #include "MsgBroadcast.h"
#include <string>
#undef __class__ #undef __class__
#define __class__ "globals" #define __class__ "globals"
// Variables privé du namespace
static std::string curentFileName = "???";
erreurCode_te globals::init(void) erreurCode_te globals::init(void)
@@ -201,36 +198,3 @@ bool globals::IsSetInsert(void)
/*
* Basic GUI system :
*
*
*
*
*/
void globals::DisplaySystemString(std::vector<int32_t> &data)
{
// Display the copyed data ...
uint32_t i;
EDN_INFO("Display Data : ");
printf(" ========================================================\n");
for(i=0; i<data.size(); i++) {
# ifdef USE_GTK_VERSION_2_0
if (GDK_Return == data[i]) {
# elif USE_GTK_VERSION_3_0
if (GDK_KEY_Return == data[i]) {
# endif
printf("\n = ");
} else {
printf("%c", (char)data[i]);
}
}
printf("\n ========================================================\n");
}

View File

@@ -27,14 +27,12 @@
#define __TOOLS_GLOBALS_H__ #define __TOOLS_GLOBALS_H__
#include "tools_debug.h" #include "tools_debug.h"
#include <string>
#include <vector>
namespace globals namespace globals
{ {
erreurCode_te init(void); erreurCode_te init(void);
int32_t getNbColoneBorder(void); int32_t getNbColoneBorder(void);
int32_t getNbLineBorder(void); int32_t getNbLineBorder(void);
bool IsSetDisplayEndOfLine(void); bool IsSetDisplayEndOfLine(void);
void SetDisplayEndOfLine(bool newVal); void SetDisplayEndOfLine(bool newVal);
@@ -45,25 +43,24 @@ namespace globals
bool IsSetAutoIndent(void); bool IsSetAutoIndent(void);
void SetAutoIndent(bool newVal); void SetAutoIndent(bool newVal);
void init2(void); void init2(void);
void SetShift(void); void SetShift(void);
void UnSetShift(void); void UnSetShift(void);
bool IsSetShift(void); bool IsSetShift(void);
void SetAlt(void); void SetAlt(void);
void UnSetAlt(void); void UnSetAlt(void);
bool IsSetAlt(void); bool IsSetAlt(void);
void SetCtrl(void); void SetCtrl(void);
void UnSetCtrl(void); void UnSetCtrl(void);
bool IsSetCtrl(void); bool IsSetCtrl(void);
void SetPomme(void); void SetPomme(void);
void UnSetPomme(void); void UnSetPomme(void);
bool IsSetPomme(void); bool IsSetPomme(void);
void SetInsert(void); void SetInsert(void);
void UnSetInsert(void); void UnSetInsert(void);
void ToggleInsert(void); void ToggleInsert(void);
bool IsSetInsert(void); bool IsSetInsert(void);
void DisplaySystemString(std::vector<int32_t> &data);
} }
#endif #endif

View File

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

View File

@@ -34,6 +34,8 @@
<color name="macro" FG="#6c09c8" bold="yes"/> <color name="macro" FG="#6c09c8" bold="yes"/>
<color name="SYNTAX_ERROR" FG="#000000" BG="#FF0000" bold="yes"/> <color name="SYNTAX_ERROR" FG="#000000" BG="#FF0000" bold="yes"/>
<color name="functionName" FG="#24d1e0" bold="yes"/> <color name="functionName" FG="#24d1e0" bold="yes"/>
<color name="TestResultOK" FG="#000000" BG="#00FF00" bold="yes"/>
<color name="TestResultERROR" FG="#000000" BG="#FF0000" bold="yes"/>
</syntax> </syntax>
</EdnColor> </EdnColor>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c"> <EdnLang version="0.1" lang="c">
<ext>Makefile</ext> <ext>Makefile</ext>
<ext>.mk</ext> <ext>*.mk</ext>
<ext>*.global</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification --> <pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my preprocesseur"> <rule name="my preprocesseur">
<color>preprocesseur</color> <color>preprocesseur</color>
@@ -9,9 +10,23 @@
<end>\n</end> <end>\n</end>
<EscapeChar>\</EscapeChar> <EscapeChar>\</EscapeChar>
</rule> </rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>'</start>
<end>'</end>
</rule>
</pass1> </pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear --> <pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</start>
</rule>
</pass2> </pass2>
</EdnLang> </EdnLang>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur"> <EdnLang version="0.1" lang="Assembleur">
<ext>.s</ext> <ext>*.s</ext>
<ext>.S</ext> <ext>*.S</ext>
<ext>.asm</ext> <ext>*.asm</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification --> <pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen"> <rule name="my comment multiline doxygen">
<color>commentDoxygen</color> <color>commentDoxygen</color>

View File

@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c"> <EdnLang version="0.1" lang="c">
<ext>.boo</ext> <ext>*.boo</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification --> <pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="comment ##"> <rule name="comment ##">
<color>SYNTAX_ERROR</color> <color>SYNTAX_ERROR</color>
<start>##</start> <start>##</start>
@@ -14,5 +12,49 @@
<start>#</start> <start>#</start>
<end>\n</end> <end>\n</end>
</rule> </rule>
<rule name="notes ... ">
<color>preprocesseur</color>
<start>(NOTE|TODO) : </start>
<end>\n</end>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>\@'</start>
<end>'</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="pourcentage OK">
<color>TestResultOK</color>
<start>100%</start>
</rule>
<rule name="pourcentage">
<color>number</color>
<start>[0-9]*%</start>
</rule>
<rule name="R<>sultat OK">
<color>TestResultOK</color>
<start>\[( )*(OK|Ok|ok)( )*\]</start>
</rule>
<rule name="resultat en erreur">
<color>TestResultERROR</color>
<start>\[(ERREUR|Erreur|erreur)\]</start>
</rule>
<rule name="resultat vide">
<color>number</color>
<start>\[( )*\]</start>
</rule>
<rule name="notes ... ">
<color>macro</color>
<start>==&gt;</start>
</rule>
</pass2> </pass2>
</EdnLang> </EdnLang>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c"> <EdnLang version="0.1" lang="c">
<ext>.c</ext> <ext>*.c</ext>
<ext>.cpp</ext> <ext>*.cpp</ext>
<ext>.h</ext> <ext>*.h</ext>
<ext>.hpp</ext> <ext>*.hpp</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification --> <pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen"> <rule name="my comment multiline doxygen">
<color>commentDoxygen</color> <color>commentDoxygen</color>
@@ -111,7 +111,7 @@
</rule> </rule>
<rule name="condition"> <rule name="condition">
<color>boolean</color> <color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</start> <start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule> </rule>
<!-- With all elementes : <!-- With all elementes :
<rule name="BIG LETTER"> <rule name="BIG LETTER">

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c"> <EdnLang version="0.1" lang="c">
<ext>.php</ext> <ext>*.php</ext>
<ext>.php3</ext> <ext>*.php3</ext>
<ext>.php4</ext> <ext>*.php4</ext>
<ext>.phtml</ext> <ext>*.phtml</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification --> <pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline"> <rule name="my comment multiline">
<color>comment</color> <color>comment</color>

View File

@@ -1,15 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur"> <EdnLang version="0.1" lang="Assembleur">
<ext>.xml</ext> <ext>*.xml</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification --> <pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Comment"> <rule name="Comment">
<color>comment</color> <color>comment</color>
<start>&lt;!\-\-</start> <start>&lt;!\-\-</start>
<end>\-\-&gt;</end> <end>\-\-&gt;</end>
</rule> </rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>\@'</start>
<end>('|\n)</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1> </pass1>
<pass2> <pass2>
<rule name="special Balise">
<color>error</color>
<start>&lt;\?\w*|\?&gt;</start>
</rule>
<rule name="normale Balise">
<color>functionName</color>
<start>&lt;/\w*|&lt;\w*|/&gt;|&gt;</start>
</rule>
</pass2> </pass2>
</EdnLang> </EdnLang>

View File

@@ -21,7 +21,6 @@ You can NOT:
- Add malware in the Sources. - Add malware in the Sources.
- Do something bad with the sources. - Do something bad with the sources.
- Use it to travel in the space with a toaster. - Use it to travel in the space with a toaster.
- Write Java sources code with this software.
I reserve the right to change this licence. If it change the version of the copy you have keep its own license I reserve the right to change this license. If it change the version of the copy you have keep its own license

2041
tags

File diff suppressed because it is too large Load Diff

1020
test2.c

File diff suppressed because it is too large Load Diff