19 Commits
0.1.1 ... 0.1.3

Author SHA1 Message Date
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
83f1e2e5b5 add php basic language interpretation 2011-07-31 15:30:11 +02:00
396b03bd42 remove vector (not ready), and correct display error in gtk 3.0 2011-07-31 11:58:44 +02:00
e3e868f351 debut de déplacement du vecteur 2011-07-29 17:07:46 +02:00
0fe575e432 move EdnVectorBin in Edn::VectorType 2011-07-29 13:37:09 +02:00
45aad6b2e2 Mise en place des RegExp en Template ==> OK 2011-07-29 10:44:12 +02:00
f9418d665e mise en place d'un system de RegExp en Template (Non Fonctionnel...) 2011-07-28 18:07:46 +02:00
a751e602ad context menu base 2011-07-27 18:20:13 +02:00
d92945717d some work ... 2011-07-26 17:25:45 +02:00
4da853c367 Correct some display error 2011-07-25 18:01:54 +02:00
dad2057818 test the transparency 2011-07-24 20:25:34 +02:00
088f89d421 try a menu context display 2011-07-22 18:31:43 +02:00
5ff5525c6b Add the version name and compilation date in the About dialog 2011-07-22 10:50:47 +02:00
b3d776b723 add the about dialog 2011-07-22 07:47:25 +02:00
58 changed files with 4006 additions and 2587 deletions

View File

@@ -31,6 +31,11 @@ export F_GRIS=
export CADRE_HAUT_BAS=' $(F_INVERSER) $(F_NORMALE)'
export CADRE_COTERS='
$(F_INVERSER) $(F_NORMALE) $(F_INVERSER) $(F_NORMALE)'
VERSION_TAG=$(shell git describe --tags)
#$(info $(VERSION_TAG))
VERSION_BUILD_TIME=$(shell date)
#$(info $(VERSION_TAG))
###############################################################################
@@ -45,10 +50,11 @@ DEBUG:=1
###############################################################################
### Compilation Define ###
###############################################################################
ifeq ("$(DEBUG)", "0")
ifeq ("$(DEBUG)", "0")
DEFINE= -DEDN_DEBUG_LEVEL=1 -DNDEBUG -DVERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
else
else
DEFINE= -DEDN_DEBUG_LEVEL=3 -DVERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
endif
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
GTKFLAGS=
@@ -153,9 +159,9 @@ CXXFILES+= tools/AL/AL_Mutex.cpp \
tools/MsgBroadcast/MsgBroadcast.cpp \
tools/MsgBroadcast/AccelKey.cpp \
tools/charset/charsetTable.cpp \
tools/charset/charset.cpp \
tools/charset/charset.cpp \
tools/NameSpaceEdn/File.cpp \
tools/NameSpaceEdn/File.cpp \
tools/NameSpaceEdn/String.cpp \
tools/NameSpaceEdn/RegExp.cpp
# Gui:
@@ -166,7 +172,8 @@ CXXFILES+= CustumWidget/BufferView/BufferView.cpp \
GuiTools/MainWindows/StatusBar.cpp \
GuiTools/MainWindows/MenuBar.cpp \
GuiTools/MainWindows/ToolBar.cpp \
GuiTools/Search/Search.cpp \
GuiTools/Search/Search.cpp \
GuiTools/Search/SearchData.cpp \
GuiTools/MenuContext/MenuContext.cpp
# Basic Interface :
@@ -203,7 +210,7 @@ all: build
all: build
-include $(OBJ:.o=.d)
build: .encadrer .versionFile $(OUTPUT_NAME)
@@ -221,6 +228,11 @@ build: .encadrer $(OUTPUT_NAME)
@echo $(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@mkdir -p $(addprefix $(OBJECT_DIRECTORY)/, $(LISTE_MODULES))
@mkdir -p ~/.bin
FILE_IMAGES= data/imagesSources/*.png
.versionFile :
@rm -f $(OBJECT_DIRECTORY)/GuiTools/WindowsManager/WindowsManager.o
@@ -230,14 +242,12 @@ pngToCpp: tools/pngToCpp/pngToCpp.c
pngToCpp: tools/pngToCpp/pngToCpp.c
@echo $(F_ROUGE)"
(bin) $@"$(F_NORMALE)
@$(CXX) $< -o $@
@$(CXX) $< -o $@
@strip -s $@
# Generate basic
$(FILE_DIRECTORY)/GuiTools/myImage.cpp: $(FILE_IMAGES) $(MAKE_DEPENDENCE) pngToCpp
@echo $(F_BLUE)"
@#echo ./pngToCpp $@ $(FILE_IMAGES)
(.cpp) *.png ==> $@"$(F_NORMALE)
@./pngToCpp $@ $(FILE_IMAGES)
@@ -273,18 +283,18 @@ clean:
@echo Remove File : pngToCpp
@rm -f pngToCpp
@echo Remove File : $(FILE_DIRECTORY)/GuiTools/myImage.*
@rm -f $(FILE_DIRECTORY)/GuiTools/myImage.*
@rm -f $(FILE_DIRECTORY)/GuiTools/myImage.*
@echo Remove doxygen files : doxygen/*
@rm -rf doxygen
@rm -f doxygen.log
@echo Remove temporary files *.bck
@rm -f `find . -name "*.bck"`
count:
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
install: .encadrer $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS)
count:
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS)
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@echo $(F_ROUGE)"

1
README
View File

@@ -17,6 +17,5 @@ You can NOT:
- Add malware in the Sources.
- Do something bad with the sources.
- 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

View File

@@ -62,8 +62,8 @@ BufferManager::~BufferManager(void)
EDN_INFO("~BufferManager::RemoveAll();");
RemoveAll();
// clear The list of Buffer
EDN_INFO("~BufferManager::listBuffer.clear();");
listBuffer.clear();
EDN_INFO("~BufferManager::listBuffer.Clear();");
listBuffer.Clear();
EDN_INFO("~BufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste);
}
@@ -73,6 +73,9 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_idSelected = dataID;
break;
case EDN_MSG__NEW:
{
int32_t newOne = Create();
@@ -81,6 +84,49 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
}
}
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)
{
int32_t i;
for (i=0; i<(int32_t)listBuffer.size(); i++) {
for (i=0; i<listBuffer.Size(); i++) {
Remove(i);
}
SendMessage(EDN_MSG__BUFFER_REMOVE_ALL);
@@ -122,8 +168,8 @@ int32_t BufferManager::Create(void)
// allocate a new Buffer
Buffer *myBuffer = new BufferText();
// Add at the list of element
listBuffer.push_back(myBuffer);
int32_t basicID = (int32_t)listBuffer.size() - 1;
listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.Size() - 1;
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
return basicID;
}
@@ -144,8 +190,8 @@ int32_t BufferManager::Open(Edn::String &filename)
// allocate a new Buffer
Buffer *myBuffer = new BufferText(filename);
// Add at the list of element
listBuffer.push_back(myBuffer);
int32_t basicID = (int32_t)listBuffer.size() - 1;
listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.Size() - 1;
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
return basicID;
}
@@ -159,7 +205,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
return BufferNotExiste;
}
// check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) {
if (BufferID < listBuffer.Size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
return listBuffer[BufferID];
@@ -167,7 +213,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
EDN_ERROR("non existing Buffer " << BufferID);
}
} 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;
}
@@ -179,7 +225,7 @@ bool BufferManager::Exist(int32_t BufferID)
return false;
}
// check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) {
if (BufferID < listBuffer.Size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
return true;
@@ -193,7 +239,7 @@ int32_t BufferManager::GetId(Edn::String &filename)
{
int32_t iii;
// 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
if (NULL != listBuffer[iii]) {
if ( listBuffer[iii]->GetName() == filename) {
@@ -216,7 +262,7 @@ bool BufferManager::Exist(Edn::String &filename)
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t BufferManager::Size(void)
{
return listBuffer.size();
return listBuffer.Size();
}
@@ -234,7 +280,7 @@ bool BufferManager::Remove(int32_t BufferID)
return false;
}
// check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) {
if (BufferID < listBuffer.Size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
// TODO : Check if it saved...
@@ -253,7 +299,7 @@ bool BufferManager::Remove(int32_t BufferID)
return false;
}
} 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;
}
}
@@ -269,7 +315,7 @@ bool BufferManager::Remove(int32_t BufferID)
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t i;
for (i=0; i<(int32_t)listBuffer.size(); i++) {
for (i=0; i<listBuffer.Size(); i++) {
if (NULL != listBuffer[i]) {
iEmeElement--;
// find the element :

View File

@@ -31,8 +31,6 @@
#include "BufferEmpty.h"
#include "Singleton.h"
#include "MsgBroadcast.h"
#include <vector>
#include <string>
class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
{
@@ -65,7 +63,7 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
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
int32_t m_idSelected;

View File

@@ -29,6 +29,7 @@
#include "BufferText.h"
#include "toolsMemory.h"
#include "Edn.h"
#include "RegExp.h"
#undef __class__
#define __class__ "BufferText"
@@ -1046,7 +1047,7 @@ void BufferText::AddChar(char * UTF8data)
if (1==size) {
if (UTF8data[0] == 0x09) {
if (false == haveSelectionActive) {
EdnVectorBin<int8_t> tmpVect;
Edn::VectorType<int8_t> tmpVect;
tmpVect.PushBack(0x09);
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true);
@@ -1059,7 +1060,7 @@ void BufferText::AddChar(char * UTF8data)
}
actionDone = true;
} else if (UTF8data[0] == '\n') {
EdnVectorBin<int8_t> tmpVect;
Edn::VectorType<int8_t> tmpVect;
tmpVect.PushBack('\n');
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
if (true == globals::IsSetAutoIndent() ) {
@@ -1114,7 +1115,7 @@ void BufferText::AddChar(char * UTF8data)
if (false == actionDone) {
if (true == m_EdnBuf.GetUTF8Mode()) {
EdnVectorBin<int8_t> tmpVect;
Edn::VectorType<int8_t> tmpVect;
int32_t localOfset = strlen(UTF8data);
tmpVect.PushBack((int8_t*)UTF8data, localOfset);
if (false == haveSelectionActive) {
@@ -1128,8 +1129,8 @@ void BufferText::AddChar(char * UTF8data)
// convert in the Good ISO format :
char output_ISO;
convertUtf8ToIso(m_EdnBuf.GetCharsetType(), UTF8data, output_ISO);
printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
EdnVectorBin<int8_t> tmpVect;
//printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
Edn::VectorType<int8_t> tmpVect;
tmpVect.PushBack(output_ISO);
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
@@ -1145,7 +1146,6 @@ void BufferText::AddChar(char * UTF8data)
UpdateWindowsPosition();
}
#include "EdnRegExp.h"
int32_t BufferText::FindLine(Edn::String &data)
{
@@ -1154,7 +1154,7 @@ int32_t BufferText::FindLine(Edn::String &data)
return 0;
}
EDN_INFO("Search data line : \"" << data.c_str() << "\"");
EdnVectorBin<int8_t> mVectSearch;
Edn::VectorType<int8_t> mVectSearch;
mVectSearch = data.GetVector();
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
int32_t foundPos;
@@ -1197,7 +1197,7 @@ void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool w
EDN_WARNING("no search data");
return;
}
EdnVectorBin<int8_t> mVectSearch;
Edn::VectorType<int8_t> mVectSearch;
mVectSearch = data.GetVector();
if (false == back) {
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
@@ -1289,7 +1289,7 @@ void BufferText::Replace(Edn::String &data)
*/
void BufferText::Copy(int8_t clipboardID)
{
EdnVectorBin<int8_t> mVect;
Edn::VectorType<int8_t> mVect;
// get the curent selected data
if (true == m_EdnBuf.SelectHasSelection(SELECTION_PRIMARY) ) {
m_EdnBuf.GetSelectionText(SELECTION_PRIMARY, mVect);
@@ -1338,7 +1338,7 @@ void BufferText::Cut(int8_t clipboardID)
*/
void BufferText::Paste(int8_t clipboardID)
{
EdnVectorBin<int8_t> mVect;
Edn::VectorType<int8_t> mVect;
// copy data from the click board :
ClipBoard::Get(clipboardID, mVect);

View File

@@ -49,8 +49,8 @@ class Colorize {
Edn::String GetName(void);
void SetFgColor(const char *myColor);
void SetBgColor(const char *myColor);
void ApplyFG(cairo_t * cr) { cairo_set_source_rgb(cr, m_colorFG.red, m_colorFG.green, m_colorFG.blue); };
void ApplyBG(cairo_t * cr) { cairo_set_source_rgb(cr, m_colorBG.red, m_colorBG.green, m_colorBG.blue); };
void ApplyFG(cairo_t * cr) { cairo_set_source_rgba(cr, m_colorFG.red, m_colorFG.green, m_colorFG.blue, 1); };
void ApplyBG(cairo_t * cr) { cairo_set_source_rgba(cr, m_colorBG.red, m_colorBG.green, m_colorBG.blue, 1); };
color_ts & GetFG(void) { return m_colorFG; };
color_ts & GetBG(void) { return m_colorBG; };

View File

@@ -41,6 +41,7 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
m_menuContext = MenuContext::getInstance();
m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 250, 100);
@@ -187,7 +188,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)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
@@ -229,12 +230,13 @@ gint BufferView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer
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
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - out");
self->m_menuContext->Hide();
return FALSE;
}
@@ -243,23 +245,88 @@ gint BufferView::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpoint
//BufferView * self = reinterpret_cast<BufferView*>(data);
if(event->type == GDK_KEY_PRESS) {
gtk_widget_queue_draw( widget );
gtk_widget_queue_draw( widget );
}
return true;
}
void BufferView::OnPopupEventShow(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, self->m_contectMenuSelectID);
}
void BufferView::OnPopupEventClose(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_CLOSE, self->m_contectMenuSelectID);
}
void BufferView::OnPopupEventSave(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_SAVE, self->m_contectMenuSelectID);
}
void BufferView::OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, self->m_contectMenuSelectID);
}
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)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
if (event->type != GDK_BUTTON_RELEASE) {
self->m_menuContext->Hide();
}
// 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) {
}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);
@@ -278,17 +345,25 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g
}else if (event->type == GDK_BUTTON_RELEASE) {
EDN_INFO("mouse-event BT1 ==> Realease");
}*/
}/* else if (event->button == 2) {
} 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) {
self->ViewPopupMenu(widget, event, selectBuf);
}
}
} else {
//EDN_INFO("mouse-event BT? PRESS");
}*/
EDN_INFO("mouse-event BT? PRESS");
}
gtk_widget_queue_draw( widget );
return true;
}

View File

@@ -33,6 +33,8 @@
#include "BufferManager.h"
#include "Display.h"
#include "MsgBroadcast.h"
#include "MenuContext.h"
class BufferView : public MsgBroadcast
@@ -53,17 +55,24 @@ class BufferView : public MsgBroadcast
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, 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:
void ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID);
// main windows widget :
GtkWidget * m_widget;
// r<>cup<75>ration des proprieter g<>n<EFBFBD>ral...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
MenuContext * m_menuContext;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_selectedID;
int32_t m_contectMenuSelectID;
};

View File

@@ -46,6 +46,7 @@ CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
m_menuContext = MenuContext::getInstance();
m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 200, 100);
@@ -104,11 +105,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE:
if (m_bufferManager->Get(m_bufferID)->HaveName() == false) {
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
} else {
m_bufferManager->Get(m_bufferID)->Save();
}
SendMessage(EDN_MSG__BUFF_ID_SAVE, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE_AS:
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
@@ -164,9 +161,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
case EDN_MSG__CURRENT_REPLACE_ALL:
break;
case EDN_MSG__CURRENT_CLOSE:
m_bufferManager->Remove(m_bufferID);
m_bufferID = -1;
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
break;
case EDN_MSG__CURRENT_UNDO:
m_bufferManager->Get(m_bufferID)->Undo();
@@ -358,7 +353,7 @@ gint CodeView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpo
EDN_INFO("mouse-event BT3 PRESS");
}
} else {
EDN_INFO("mouse-event BT? PRESS");
EDN_INFO("mouse-event BT" << event->type <<" PRESS");
}
return true;
}

View File

@@ -32,6 +32,7 @@
#include "BufferManager.h"
#include "Display.h"
#include "MsgBroadcast.h"
#include "MenuContext.h"
class CodeView : public MsgBroadcast
{
@@ -53,14 +54,15 @@ class CodeView : public MsgBroadcast
private:
// main windows widget :
GtkWidget * m_widget;
GtkWidget * m_widget;
// récupération des proprieter général...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_bufferID;
bool m_buttunOneSelected;
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
MenuContext * m_menuContext;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_bufferID;
bool m_buttunOneSelected;
};
#endif

View File

@@ -189,7 +189,7 @@ class MenuBarMain
GtkWidget * m_parent;
GtkWidget * m_menu;
GtkWidget * m_menuListe;
EdnVectorBin<messageData_ts*> m_message;
Edn::VectorType<messageData_ts*> m_message;
};
#undef __class__
@@ -224,6 +224,8 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
tmp->AddSeparator();
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->AddSeparator();
tmp->AddGen("Goto Line number ...", "ctrl+l", EDN_MSG__GUI_SHOW_GOTO_LINE, true);
// tmp->AddSeparator();
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true);
m_listMenu.PushBack(tmp);

View File

@@ -26,7 +26,7 @@
#include "tools_debug.h"
#include "tools_globals.h"
#include "MsgBroadcast.h"
#include "EdnVectorBin.h"
#include "VectorType.h"
#include "AccelKey.h"
#ifndef __MENU_BAR_H__
@@ -46,7 +46,7 @@ class MenuBar: public MsgBroadcast
private:
GtkWidget * m_mainWidget;
GtkAccelGroup * m_accelGroup;
EdnVectorBin<MenuBarMain*> m_listMenu;
Edn::VectorType<MenuBarMain*> m_listMenu;
};

View File

@@ -42,7 +42,7 @@ class ToolBar: public MsgBroadcast
void AddSeparator(void);
void Add(const char * title, const char * labelHelp, messageType_te id = EDN_MSG__NONE, bool enable = false);
GtkWidget * m_mainWidget;
EdnVectorBin<messageData_ts*> m_message;
Edn::VectorType<messageData_ts*> m_message;
};

View File

@@ -0,0 +1,490 @@
/**
*******************************************************************************
* @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

@@ -0,0 +1,72 @@
/**
*******************************************************************************
* @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

@@ -56,12 +56,18 @@ Search::~Search(void)
}
}
void Search::Display(void)
void Search::Display(GtkWindow *parent)
{
if(NULL == m_localDialog) {
m_localDialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// set dialog not resisable
gtk_window_set_resizable(GTK_WINDOW(m_localDialog), FALSE);
gtk_window_set_keep_above(GTK_WINDOW(m_localDialog), TRUE);
// set the windows alwais on top of every all system windows
//gtk_window_set_keep_above(GTK_WINDOW(m_localDialog), TRUE);
// Set the dialog on top of the selected windows
gtk_window_set_transient_for(GTK_WINDOW(m_localDialog), parent);
// set the dialog on the top right
gtk_window_set_gravity(GTK_WINDOW(m_localDialog), GDK_GRAVITY_NORTH_EAST);
// select the program icone
//gtk_window_set_default_icon_name("Replace");

View File

@@ -43,7 +43,7 @@ class Search: public Singleton<Search>
public:
void Destroy(void);
void Display(void);
void Display(GtkWindow *parent);
void Hide(void);
private:

View File

@@ -76,7 +76,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
EDN_INFO("Request opening SEARCH");
{
Search *myInstance = Search::getInstance();
myInstance->Display();
myInstance->Display(GTK_WINDOW(m_mainWindow->GetWidget()));
}
break;
case EDN_MSG__GUI_SHOW_PREFERENCE:
@@ -156,28 +156,91 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
case EDN_MSG__GUI_SHOW_ABOUT:
{
// dlg to confirm the quit event :
GtkWidget *p_dialog = gtk_dialog_new_with_buttons("About",
GtkWidget *myDialog = gtk_dialog_new_with_buttons("About",
NULL,
GTK_DIALOG_MODAL,
GTK_STOCK_YES, GTK_RESPONSE_YES,
GTK_STOCK_NO, GTK_RESPONSE_NO,
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL);
GtkWidget *p_label = gtk_label_new ("Do you want exit Edn?");
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area( GTK_DIALOG(p_dialog) )), p_label, TRUE, TRUE, 0);
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog));
GtkWidget *myLabel = gtk_label_new("");
gtk_label_set_markup (GTK_LABEL (myLabel),
"<b>Name :</b> Edn\n"
"<b>Version :</b> " VERSION_TAG_NAME "\n"
"<b>Build Time :</b> " VERSION_BUILD_TIME "\n\n"
"<b>Description :</b> Editeur De N'ours, l'Editeur Desoxyribo-Nucleique\n"
" Source Code Editor\n\n"
"<b>Copyright 2010 Edouard DUPIN, all right reserved</b>\n\n"
"<b>Terms of license : </b>\n"
"This software is distributed in the hope that it will be useful, but \n"
"WITHOUT ANY WARRANTY\n"
" <b>You can:</b>\n"
" * Redistribute the sources code and binaries.\n"
" * Modify the Sources code.\n"
" * Use a part of the sources (less than 50%) in an other software,\n"
" just write somewhere \"Edn is great\" visible by the user (on \n"
" your product or on your website with a link to my page).\n"
" * Redistribute the modification only if you want.\n"
" * Send me the bug-fix (it could be great).\n"
" * Pay me a beer or some other things.\n"
" Print the source code on WC paper ...\n"
" <b>You can NOT:</b>\n"
" * Earn money with this Software (But I can).\n"
" * Add malware in the Sources.\n"
" * Do something bad with the sources.\n"
" * Use it to travel in the space with a toaster.\n"
"I reserve the right to change this licence. If it change the version of \n"
"the copy you have keep its own license.\n\n"
"<b>Sources : </b> git://github.com/HeeroYui/edn.git ");
gtk_box_pack_start(GTK_BOX(myContentArea), myLabel, TRUE, TRUE, 0);
gtk_widget_show(p_label);
int32_t result = gtk_dialog_run (GTK_DIALOG (p_dialog));
gtk_widget_destroy(p_dialog);
gtk_widget_show_all(myContentArea);
int32_t result = gtk_dialog_run (GTK_DIALOG (myDialog));
gtk_widget_destroy(myDialog);
switch (result)
{
case GTK_RESPONSE_YES:
gtk_main_quit();
break;
case GTK_RESPONSE_NO:
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);
// 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

@@ -61,11 +61,11 @@ class Highlight {
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0);
private:
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level);
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"
std::vector<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)) )
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level);
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"
std::vector<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)) )
};

View File

@@ -68,34 +68,38 @@ void HighlightManager::loadLanguages(void)
{
Edn::String homedir;
#ifdef NDEBUG
homedir = getenv("HOME");
homedir += "/.edn/";
homedir = "/usr/share/edn/";
#else
homedir = "./";
homedir = "./data/";
#endif
Edn::String xmlFilename = homedir;
xmlFilename += "data/lang_c.xml";
xmlFilename += "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_boo.xml";
xmlFilename += "lang_boo.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_Makefile.xml";
xmlFilename += "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_asm.xml";
xmlFilename += "lang_asm.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_xml.xml";
xmlFilename += "lang_xml.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_php.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);

View File

@@ -39,8 +39,8 @@ HighlightPattern::HighlightPattern(void)
m_multiline = false;
ColorizeManager *myColorManager = ColorizeManager::getInstance();
m_color = myColorManager->Get("normal");
m_regExpStart = new EdnRegExp();
m_regExpStop = new EdnRegExp();
m_regExpStart = new EdnRegExp<EdnVectorBuf>();
m_regExpStop = new EdnRegExp<EdnVectorBuf>();
m_escapeChar = 0;
}

View File

@@ -22,17 +22,20 @@
*
*******************************************************************************
*/
#include "Highlight.h"
#ifndef __HIGHLIGHT_PATTERN_H__
#define __HIGHLIGHT_PATTERN_H__
class HighlightPattern;
#include "Edn.h"
#include "EdnRegExp.h"
#include "RegExp.h"
#include "Colorize.h"
#include "EdnVectorBin.h"
#include "VectorType.h"
#include "tinyxml.h"
#include "EdnVectorBuf.h"
typedef enum {
HLP_FIND_ERROR,
@@ -67,17 +70,17 @@ class HighlightPattern {
void ParseRules(TiXmlNode *child, int32_t level);
private:
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
Edn::String m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
Edn::String m_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager
EdnRegExp * m_regExpStart; //!< Start of Regular expression
EdnRegExp * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
char m_escapeChar; //!< Escape char to prevent exeit of patern ....
EdnVectorBin<HighlightPattern *> m_subPatern; //!< Under patern of this one
// EdnVectorBin<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
Edn::String m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
Edn::String m_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager
EdnRegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
EdnRegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
char m_escapeChar; //!< Escape char to prevent exeit of patern ....
Edn::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// Edn::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
};
#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,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, // button text
GTK_RESPONSE_CANCEL, // response id
GTK_STOCK_OPEN, // button text
GTK_RESPONSE_ACCEPT, // response id
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL); // end button/response list
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
@@ -167,11 +165,110 @@ void CTagsManager::AddToHistory(int32_t bufferID)
}
enum
{
CTAGS_COL_FILE = 0,
CTAGS_COL_REGEXP,
CTAGS_NUM_COLS
};
static GtkTreeModel * create_and_fill_model(void)
{
GtkListStore * store;
GtkTreeIter iter;
store = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
// Append a row and fill in some data
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file1.c",
CTAGS_COL_REGEXP, "void function1(void);",
-1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file2.c",
CTAGS_COL_REGEXP, "void function2(void);",
-1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file3.c",
CTAGS_COL_REGEXP, "void function3(void);",
-1);
return GTK_TREE_MODEL(store);
}
static GtkWidget * create_view_and_model(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,
"Regular Expression",
renderer,
"text", CTAGS_COL_REGEXP,
NULL);
model = create_and_fill_model();
gtk_tree_view_set_model(GTK_TREE_VIEW (view), model);
g_object_unref(model);
return view;
}
void 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 = create_view_and_model ();
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
// Remove dialogue
gtk_widget_destroy(myDialog);
}
void CTagsManager::JumpTo(void)
{
MultipleJump();
if (NULL != m_ctagFile) {
EdnVectorBin<int8_t> data;
Edn::VectorType<int8_t> data;
// get the middle button of the clipboard ==> represent the current selection ...
ClipBoard::Get(COPY_MIDDLE_BUTTON, data);
if (data.Size() == 0) {

View File

@@ -47,6 +47,7 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
private:
int32_t m_currentSelectedID;
void LoadTagFile(void);
void MultipleJump(void);
void JumpTo(void);
void PrintTag(const tagEntry *entry);
Edn::String GetFolder(Edn::String &inputString);
@@ -56,7 +57,7 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
// history system
void AddToHistory(int32_t bufferID);
int32_t m_historyPos;
EdnVectorBin<Edn::File*> m_historyList;
Edn::VectorType<Edn::File*> m_historyList;
};
#endif

View File

@@ -80,13 +80,13 @@ int main (int argc, char *argv[])
ColorizeManager *myColorManager = NULL;
myColorManager = ColorizeManager::getInstance();
Edn::String homedir;
//homedir = getenv("HOME");
#ifdef NDEBUG
homedir = getenv("HOME");
homedir += "/.edn/";
homedir = "/usr/share/edn/";
#else
homedir = "./";
homedir = "./data/";
#endif
homedir += "data/color_black.xml";
homedir += "color_black.xml";
myColorManager->LoadFile( homedir.c_str() );
myColorManager->DisplayListOfColor();
@@ -117,6 +117,7 @@ int main (int argc, char *argv[])
myfile+="/";
}
myfile+=(char *)argv[i];
if (false == myBufferManager->Exist(myfile) ) {
int32_t idBuffOpened = myBufferManager->Open(myfile);
if (1==i) {

View File

@@ -35,7 +35,7 @@ note: la copy dans le :
[1..9] : copy interne
10 : bouton du milieux
*/
static EdnVectorBin<int8_t> mesCopy[TOTAL_OF_CLICKBOARD];
static Edn::VectorType<int8_t> mesCopy[TOTAL_OF_CLICKBOARD];
void ClipBoard::Init(void)
@@ -47,13 +47,13 @@ void ClipBoard::Init(void)
}
void ClipBoard::Set(uint8_t clipboardID, EdnVectorBin<int8_t> &data)
void ClipBoard::Set(uint8_t clipboardID, Edn::VectorType<int8_t> &data)
{
// check if ID is correct
if(clipboardID >= TOTAL_OF_CLICKBOARD) {
EDN_WARNING("request ClickBoard id error");
} else if(0 == data.Size()) {
EDN_WARNING("request a copy of nothing");
EDN_INFO("request a copy of nothing");
} else if (COPY_STD == clipboardID) {
GtkClipboard * clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
gtk_clipboard_set_text(clipboard, (const gchar*)&data[0], data.Size() );
@@ -66,7 +66,7 @@ void ClipBoard::Set(uint8_t clipboardID, EdnVectorBin<int8_t> &data)
}
void ClipBoard::Get(uint8_t clipboardID, EdnVectorBin<int8_t> &data)
void ClipBoard::Get(uint8_t clipboardID, Edn::VectorType<int8_t> &data)
{
if(clipboardID >= TOTAL_OF_CLICKBOARD) {
EDN_WARNING("request ClickBoard id error");

View File

@@ -27,7 +27,7 @@
#define __CLIP_BOARD_H__
#include "tools_debug.h"
#include "EdnVectorBin.h"
#include "VectorType.h"
#define TOTAL_OF_CLICKBOARD (11)
#define COPY_MIDDLE_BUTTON (10)
@@ -36,8 +36,8 @@
namespace ClipBoard
{
void Init(void);
void Set(uint8_t clipboardID, EdnVectorBin<int8_t> &data);
void Get(uint8_t clipboardID, EdnVectorBin<int8_t> &data);
void Set(uint8_t clipboardID, Edn::VectorType<int8_t> &data);
void Get(uint8_t clipboardID, Edn::VectorType<int8_t> &data);
}
#endif

View File

@@ -166,6 +166,17 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
cairo_scale(m_cairo, 1.0, 1.0);
// http://cairographics.org/FAQ/#clear_a_surface
// http://gtk.developpez.com/faq/?page=gtkwidget#GTK_WIDGET_transparent
//cairo_set_source_rgba(m_cairo, 1, 1, 1, 0);
//cairo_set_operator(m_cairo, CAIRO_OPERATOR_SOURCE);
//cairo_paint(m_cairo);
//cairo_fill(m_cairo);
//cairo_stroke (m_cairo);
}

View File

@@ -126,7 +126,7 @@ bool EdnBuf::DumpFrom(FILE *myFile)
}
void EdnBuf::GetAll(EdnVectorBin<int8_t> &text)
void EdnBuf::GetAll(Edn::VectorType<int8_t> &text)
{
// Clean output vector
text.Clear();
@@ -135,9 +135,9 @@ void EdnBuf::GetAll(EdnVectorBin<int8_t> &text)
}
void EdnBuf::SetAll(EdnVectorBin<int8_t> &text)
void EdnBuf::SetAll(Edn::VectorType<int8_t> &text)
{
EdnVectorBin<int8_t> deletedText;
Edn::VectorType<int8_t> deletedText;
// extract all data of the buffer :
GetAll(deletedText);
@@ -155,7 +155,7 @@ void EdnBuf::SetAll(EdnVectorBin<int8_t> &text)
eventModification(0, m_data.Size(), deletedText);
}
void EdnBuf::GetRange(int32_t start, int32_t end, EdnVectorBin<int8_t> &output)
void EdnBuf::GetRange(int32_t start, int32_t end, Edn::VectorType<int8_t> &output)
{
// Remove all data ...
output.Clear();
@@ -189,7 +189,7 @@ int8_t EdnBuf::operator[] (int32_t pos)
* @return ---
*
*/
void EdnBuf::Insert(int32_t pos, EdnVectorBin<int8_t> &insertText)
void EdnBuf::Insert(int32_t pos, Edn::VectorType<int8_t> &insertText)
{
// if pos is not contiguous to existing text, make it
pos = edn_average(0, pos, m_data.Size() );
@@ -197,7 +197,7 @@ void EdnBuf::Insert(int32_t pos, EdnVectorBin<int8_t> &insertText)
insert(pos, insertText);
// Call the redisplay ...
EdnVectorBin<int8_t> deletedText;
Edn::VectorType<int8_t> deletedText;
eventModification(pos, insertText.Size(), deletedText);
}
@@ -212,9 +212,9 @@ void EdnBuf::Insert(int32_t pos, EdnVectorBin<int8_t> &insertText)
* @return ---
*
*/
void EdnBuf::Replace(int32_t start, int32_t end, EdnVectorBin<int8_t> &insertText)
void EdnBuf::Replace(int32_t start, int32_t end, Edn::VectorType<int8_t> &insertText)
{
EdnVectorBin<int8_t> deletedText;
Edn::VectorType<int8_t> deletedText;
GetRange(start, end, deletedText);
m_data.Replace(start, end-start, insertText);
// update internal elements
@@ -234,7 +234,7 @@ void EdnBuf::Replace(int32_t start, int32_t end, EdnVectorBin<int8_t> &insertTex
void EdnBuf::Remove(int32_t start, int32_t end)
{
EdnVectorBin<int8_t> deletedText;
Edn::VectorType<int8_t> deletedText;
// Make sure the arguments make sense
if (start > end) {
int32_t temp = start;
@@ -265,7 +265,7 @@ int32_t EdnBuf::Indent(selectionType_te select)
// Get Range :
int32_t l_start = StartOfLine(SelectionStart);
int32_t l_end = EndOfLine(SelectionEnd);
EdnVectorBin<int8_t> l_tmpData;
Edn::VectorType<int8_t> l_tmpData;
GetRange(l_start, l_end, l_tmpData);
l_tmpData.Insert(0, '\n');
@@ -304,7 +304,7 @@ int32_t EdnBuf::UnIndent(selectionType_te select)
// Get Range :
int32_t l_start = StartOfLine(SelectionStart);
int32_t l_end = EndOfLine(SelectionEnd);
EdnVectorBin<int8_t> l_tmpData;
Edn::VectorType<int8_t> l_tmpData;
GetRange(l_start, l_end, l_tmpData);
l_tmpData.Insert(0, '\n');
@@ -346,7 +346,7 @@ int32_t EdnBuf::UnIndent(selectionType_te select)
* @return ---
*
*/
void EdnBuf::GetLineText(int32_t pos, EdnVectorBin<int8_t> &text)
void EdnBuf::GetLineText(int32_t pos, Edn::VectorType<int8_t> &text)
{
GetRange( StartOfLine(pos), EndOfLine(pos), text);
}
@@ -666,9 +666,9 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
* @return number of line found
*
*/
int32_t EdnBuf::CountLines(EdnVectorBin<int8_t> &data)
int32_t EdnBuf::CountLines(Edn::VectorType<int8_t> &data)
{
EdnVectorBin<int8_t>::Iterator myPosIt = data.Begin();
Edn::VectorType<int8_t>::Iterator myPosIt = data.Begin();
int32_t lineCount = 0;
while(myPosIt) {
@@ -810,7 +810,7 @@ bool EdnBuf::charMatch(char first, char second, bool caseSensitive)
* @return false ==> not found data
*
*/
bool EdnBuf::SearchForward(int32_t startPos, EdnVectorBin<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive)
bool EdnBuf::SearchForward(int32_t startPos, Edn::VectorType<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive)
{
int32_t position;
int32_t searchLen = searchVect.Size();
@@ -851,7 +851,7 @@ bool EdnBuf::SearchForward(int32_t startPos, EdnVectorBin<int8_t> &searchVect, i
* @return false ==> not found data
*
*/
bool EdnBuf::SearchBackward(int32_t startPos, EdnVectorBin<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive)
bool EdnBuf::SearchBackward(int32_t startPos, Edn::VectorType<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive)
{
int32_t position;
int32_t searchLen = searchVect.Size();
@@ -977,7 +977,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
* @return number of element inserted.
*
*/
int32_t EdnBuf::insert(int32_t pos, EdnVectorBin<int8_t> &insertText)
int32_t EdnBuf::insert(int32_t pos, Edn::VectorType<int8_t> &insertText)
{
// Insert data in buffer
m_data.Insert(pos, insertText);
@@ -998,7 +998,7 @@ int32_t EdnBuf::insert(int32_t pos, EdnVectorBin<int8_t> &insertText)
* @return ---
*
*/
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText)
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText)
{
if( 0 == deletedText.Size()
&& 0 == nInserted)

View File

@@ -82,21 +82,21 @@ class EdnBuf {
// destructer
~EdnBuf(void);
// public function :
void GetAll( EdnVectorBin<int8_t> &text);
void SetAll( EdnVectorBin<int8_t> &text);
void GetRange( int32_t start, int32_t end, EdnVectorBin<int8_t> &output);
void GetAll( Edn::VectorType<int8_t> &text);
void SetAll( Edn::VectorType<int8_t> &text);
void GetRange( int32_t start, int32_t end, Edn::VectorType<int8_t> &output);
bool DumpIn( FILE *myFile);
bool DumpFrom( FILE *myFile);
// replace with operator [] ...
int8_t operator[] (int32_t);
void Insert( int32_t pos, EdnVectorBin<int8_t> &insertText);
void Replace( int32_t start, int32_t end, EdnVectorBin<int8_t> &insertText);
void Insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
void Replace( int32_t start, int32_t end, Edn::VectorType<int8_t> &insertText);
void Remove( int32_t start, int32_t end);
int32_t Indent( selectionType_te select);
int32_t UnIndent( selectionType_te select);
void GetLineText( int32_t pos, EdnVectorBin<int8_t> &text);
void GetLineText( int32_t pos, Edn::VectorType<int8_t> &text);
int32_t StartOfLine( int32_t pos);
int32_t EndOfLine( int32_t pos);
@@ -107,12 +107,12 @@ class EdnBuf {
int32_t CountForwardDispChars( int32_t lineStartPos, int32_t nChars);
int32_t CountLines( int32_t startPos, int32_t endPos);
int32_t CountLines( void);
int32_t CountLines( EdnVectorBin<int8_t> &data);
int32_t CountLines( Edn::VectorType<int8_t> &data);
int32_t CountForwardNLines( int32_t startPos, int32_t nLines);
int32_t CountBackwardNLines( int32_t startPos, int32_t nLines);
bool SearchForward( int32_t startPos, EdnVectorBin<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive = true);
bool SearchBackward( int32_t startPos, EdnVectorBin<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive = true);
bool SearchForward( int32_t startPos, Edn::VectorType<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive = true);
bool SearchBackward( int32_t startPos, Edn::VectorType<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive = true);
bool SearchForward( int32_t startPos, char searchChar, int32_t *foundPos);
bool SearchBackward( int32_t startPos, char searchChar, int32_t *foundPos);
bool SelectAround( int32_t startPos, int32_t &beginPos, int32_t &endPos);
@@ -130,9 +130,9 @@ class EdnBuf {
void Unselect( selectionType_te select);
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);
void GetSelectionText( selectionType_te select, EdnVectorBin<int8_t> &text);
void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text);
void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, EdnVectorBin<int8_t> &text);
void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text);
private:
// current selection of the buffer
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
@@ -148,8 +148,8 @@ class EdnBuf {
private:
bool m_isUndoProcessing;
bool m_isRedoProcessing;
EdnVectorBin<EdnBufHistory*> m_historyUndo;
EdnVectorBin<EdnBufHistory*> m_historyRedo;
Edn::VectorType<EdnBufHistory*> m_historyUndo;
Edn::VectorType<EdnBufHistory*> m_historyRedo;
// -----------------------------------------
// hightlight section :
@@ -201,10 +201,10 @@ class EdnBuf {
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void eventModification( int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText);
void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
int32_t insert( int32_t pos, EdnVectorBin<int8_t> &insertText);
int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
bool charMatch( char first, char second, bool caseSensitive = true);
};

View File

@@ -39,7 +39,7 @@ EdnBufHistory::EdnBufHistory(void)
m_nInserted = 0;
}
EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText)
EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText)
{
//EDN_INFO("EdnBufHistory new + data");
m_pos = pos;
@@ -47,7 +47,7 @@ EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, EdnVectorBin<int8_t
m_deletedText = deletedText;
}
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText)
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText)
{
//EDN_INFO("EdnBufHistory new + data");
m_pos = pos;
@@ -75,7 +75,7 @@ int32_t EdnBufHistory::getnbInserted(void)
return m_nInserted;
}
void EdnBufHistory::getData(EdnVectorBin<int8_t> &deletedText)
void EdnBufHistory::getData(Edn::VectorType<int8_t> &deletedText)
{
deletedText = m_deletedText;
}

View File

@@ -27,22 +27,22 @@
#define __EDN_BUFFER_HISTORY_H__
#include "EdnVectorBin.h"
#include "VectorType.h"
class EdnBufHistory{
public:
EdnBufHistory(void);
EdnBufHistory(int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText);
EdnBufHistory(int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
~EdnBufHistory(void);
void Set(int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText);
void Set(int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
int32_t getPos(void);
int32_t getnbDeleted(void);
int32_t getnbInserted(void);
void getData(EdnVectorBin<int8_t> &deletedText);
void getData(Edn::VectorType<int8_t> &deletedText);
private:
int32_t m_pos;
int32_t m_nInserted;
EdnVectorBin<int8_t> m_deletedText;
Edn::VectorType<int8_t> m_deletedText;
};
#endif

View File

@@ -53,7 +53,7 @@ int32_t EdnBuf::Undo(void)
int32_t pos = m_historyUndo[nbElement]->getPos();
int32_t nbDeleted = m_historyUndo[nbElement]->getnbDeleted();
int32_t nbInserted = m_historyUndo[nbElement]->getnbInserted();
EdnVectorBin<int8_t> deletedText;
Edn::VectorType<int8_t> deletedText;
m_historyUndo[nbElement]->getData(deletedText);
m_isUndoProcessing = true;
if (0 == nbInserted) {
@@ -101,7 +101,7 @@ int32_t EdnBuf::Redo(void)
int32_t pos = m_historyRedo[nbElement]->getPos();
int32_t nbDeleted = m_historyRedo[nbElement]->getnbDeleted();
int32_t nbInserted = m_historyRedo[nbElement]->getnbInserted();
EdnVectorBin<int8_t> deletedText;
Edn::VectorType<int8_t> deletedText;
m_historyRedo[nbElement]->getData(deletedText);
m_isRedoProcessing = true;
if (0 == nbInserted) {

View File

@@ -136,7 +136,7 @@ bool EdnBuf::GetSelectionPos(selectionType_te select, int32_t &start, int32_t &e
* @return ---
*
*/
void EdnBuf::GetSelectionText(selectionType_te select, EdnVectorBin<int8_t> &text)
void EdnBuf::GetSelectionText(selectionType_te select, Edn::VectorType<int8_t> &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;
@@ -198,7 +198,7 @@ void EdnBuf::RemoveSelected(selectionType_te select)
* @return ---
*
*/
void EdnBuf::ReplaceSelected(selectionType_te select, EdnVectorBin<int8_t> &text)
void EdnBuf::ReplaceSelected(selectionType_te select, Edn::VectorType<int8_t> &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;

File diff suppressed because it is too large Load Diff

View File

@@ -1,261 +0,0 @@
/**
*******************************************************************************
* @file EdnRegExp.h
* @brief Editeur De N'ours : Regular expression annalyser (header)
* @author Edouard DUPIN
* @date 04/04/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 __EDN_REG_EXP_H__
#define __EDN_REG_EXP_H__
class EdnRegExp;
#include "EdnTree.h"
#include "EdnBuf.h"
#include "EdnVectorBin.h"
#include "EdnVectorBuf.h"
/*
normal mode :
(...) sub element is separate with |
\d Digits [0-9]
\D NOT a digit [^0-9]
\l Letters [a-zA-Z]
\L NOT a Letter [^a-zA-Z]
\s Whitespace [ \t\n\r\f\v]
\S NOT Whitespace [^ \t\n\r\f\v]
\w "Word" character [a-zA-Z0-9_]
\W NOT a "Word" character [^a-zA-Z0-9_]
\@ at the start or the end not in the parsing of element ==> check if \w is not present (other regExp will be <> ...)
[anjdi] or [a-gt-j] range
. dot [^\x00-\x08\x0A-\x1F\x7F]
==> TODO :
$ End / Start of line of line ==> ce sera un truc supl<70>mentaire comme le \@
^in the [] invertion of the range element
multiplicity :
* ==> {0, 2147483647}
? ==> {0, 1}
+ ==> {1, 2147483647}
{x} ==> {x, x}
{x,y} ==> {x, y}
*/
class RegExpNode;
/**
* @brief Node Elements for every-one
*/
class RegExpNode{
public :
RegExpNode(void);
virtual ~RegExpNode(void) { };
virtual int32_t Generate(EdnVectorBin<int16_t> &data, int32_t startPos, int32_t nbElement);
virtual bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
virtual void Display(int32_t level);
void SetMult(int32_t min, int32_t max);
protected:
int32_t GetMultMin(void) { return m_multipleMin; };
int32_t GetMultMax(void) { return m_multipleMax; };
protected :
int32_t m_multipleMin; //!< minimum repetition (included)
int32_t m_multipleMax; //!< maximum repetition (included)
// Data Section ... (can have no data...)
EdnVectorBin<int16_t> m_RegExpData; //!< data to parse and compare in some case ...
};
class RegExpNodePThese : public RegExpNode {
public :
RegExpNodePThese(void) { };
~RegExpNodePThese(void);
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<RegExpNode*> m_subNode;
//int32_t m_posPthese; //!< position of the element is detected in the output element
};
class RegExpNodePTheseElem : public RegExpNode {
public :
RegExpNodePTheseElem(void) { };
~RegExpNodePTheseElem(void);
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<RegExpNode*> m_subNode;
private :
bool SetMultiplicityOnLastNode(int32_t min, int32_t max);
};
class RegExpNodeValue : public RegExpNode {
public :
RegExpNodeValue(void) { };
~RegExpNodeValue(void) { };
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<char> m_data;
};
class RegExpNodeBracket : public RegExpNode {
public :
RegExpNodeBracket(void) { };
~RegExpNodeBracket(void) { };
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<char> m_data;
};
class RegExpNodeDigit : public RegExpNode {
public :
RegExpNodeDigit(void) { };
~RegExpNodeDigit(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeDigitNot : public RegExpNode {
public :
RegExpNodeDigitNot(void) { };
~RegExpNodeDigitNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeLetter : public RegExpNode {
public :
RegExpNodeLetter(void) { };
~RegExpNodeLetter(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeLetterNot : public RegExpNode {
public :
RegExpNodeLetterNot(void) { };
~RegExpNodeLetterNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWhiteSpace : public RegExpNode {
public :
RegExpNodeWhiteSpace(void) { };
~RegExpNodeWhiteSpace(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWhiteSpaceNot : public RegExpNode {
public :
RegExpNodeWhiteSpaceNot(void) { };
~RegExpNodeWhiteSpaceNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWordChar : public RegExpNode {
public :
RegExpNodeWordChar(void) { };
~RegExpNodeWordChar(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWordCharNot : public RegExpNode {
public :
RegExpNodeWordCharNot(void) { };
~RegExpNodeWordCharNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeDot : public RegExpNode {
public :
RegExpNodeDot(void) { };
~RegExpNodeDot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeSOL : public RegExpNode {
public :
RegExpNodeSOL(void) { };
~RegExpNodeSOL(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeEOL : public RegExpNode {
public :
RegExpNodeEOL(void) { };
~RegExpNodeEOL(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
typedef struct {
int32_t start;
int32_t stop;
}elementPos_ts;
// Regular expression manager
class EdnRegExp {
// public API :
public:
// create the regular expression
EdnRegExp(const char *exp);
EdnRegExp(Edn::String &exp);
EdnRegExp(void);
~EdnRegExp(void);
void SetRegExp(const char *exp);
void SetRegExp(Edn::String &exp);
Edn::String GetRegExp(void) { return m_expressionRequested;};
bool GetStatus(void) { return m_isOk;};
// process the regular expression
bool Process( EdnVectorBuf &SearchIn,
int32_t startPos,
int32_t endPos,
char escapeChar=0);
int32_t Start(void) { return m_areaFind.start; };
int32_t Stop(void) { return m_areaFind.stop; };
void Display(void);
// internal parameters
private:
Edn::String m_expressionRequested; // TODO : Remove ...
elementPos_ts m_areaFind; //!< position around selection
RegExpNodePThese m_exprRootNode; //!< The tree where data is set
bool m_isOk; //!< Known if we can process with this regExp
bool m_notBeginWithChar; //!< The regular expression must not have previously a char [a-zA-Z0-9_]
bool m_notEndWithChar; //!< The regular expression must not have after the end a char [a-zA-Z0-9_]
// internal access
private:
bool CheckGoodPosition(EdnVectorBin<int16_t> tmpExp, int32_t &pos);
bool CheckGoodPosition(EdnVectorBin<int16_t> tmpExp);
};
#endif

View File

@@ -1,29 +0,0 @@
#include "tools_debug.h"
#include "tools_globals.h"
#include "EdnVectorBin.h"
void TestTemplate(void)
{
EDN_WARNING("Start Template Test ...");
EdnVectorBin<int32_t> plop;
EdnVectorBin<int8_t> plop2;
plop.PushBack(15365);
plop.PushBack(1);
plop.PushBack(2);
plop.PushBack(3);
plop.PushBack(4);
EDN_INFO("data is : " << plop[0]);
EDN_INFO("data is : " << plop[1]);
EDN_INFO("data is : " << plop[2]);
EDN_INFO("data is : " << plop[3]);
plop2.PushBack(65);
EDN_INFO("data is : " << plop2[0]);
}

View File

@@ -1,186 +0,0 @@
/**
*******************************************************************************
* @file EdnTree.h
* @brief Editeur De N'ours : Basic tree in a vector For none expensive tree (template)
* @author Edouard DUPIN
* @date 04/04/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 __EDN_TREE_H__
#define __EDN_TREE_H__
#undef __class__
#define __class__ "EdnTreeElement"
template < class T > class EdnTreeElement
{
public:
EdnTreeElement(int32_t parent, int32_t id, T &maNouvelleClass) : elementPtr(NULL), m_parent(parent), m_id(id)
{
elementPtr = new T(maNouvelleClass);
};
~EdnTreeElement(void)
{
delete(elementPtr);
};
EdnTreeElement(const EdnTreeElement &mustCopy ) : elementPtr(NULL), m_parent(mustCopy.m_parent), m_id(mustCopy.m_id)
{
elementPtr = new T(*mustCopy.elementPtr);
}
int32_t GetParrent(void) { return m_parent;};
int32_t GetId(void) { return m_id;};
T* GetPtr() const
{
return elementPtr;
};
private:
T* elementPtr; // pointer on the curent element
int32_t m_parent;
int32_t m_id;
};
#undef __class__
#define __class__ "EdnTree"
#define ROOT_NODE_ID (-1)
template < class T > class EdnTree
{
public:
// constructeur et destructeur
EdnTree(void)
{
m_LastId = 0;
};
~EdnTree(void)
{
};
// Common function ...
int32_t GetNumberNode(void)
{
return m_listElement.size();
};
int32_t GetDepth(void)
{
// TODO : ...
return 0;
};
//!< add an element in the tree
int32_t Add(T &maNouvelleClass, int32_t parent=-1)
{
if (true == CheckPresenceParrent(parent)) {
// create the local element
EdnTreeElement<T> nouvelElement(parent, m_LastId, maNouvelleClass);
// add it in the list
m_listElement.push_back(nouvelElement);
// increment the ID of the element
m_LastId++;
// Add is Ok, in theory ...
return m_LastId-1;
}
return -2;
};
bool Remove(int32_t id)
{
return false;
};
bool Clear(void)
{
return false;
};
T* Get(int32_t id)
{
// try to find ID
int32_t realID = FindElementWithId(id);
// when we find it, check it
if (0 > realID || realID >= m_LastId) {
return NULL;
}
// Return the element :
return m_listElement[realID].GetPtr();
};
std::vector<int32_t> GetListSubNode( int32_t parentId = ROOT_NODE_ID)
{
std::vector<int32_t> res;
int32_t i;
for (i=0; i<(int32_t)m_listElement.size(); i++) {
if (m_listElement[i].GetParrent() == parentId) {
// Add the element ID in the list ...
res.push_back(m_listElement[i].GetId());
}
}
return res;
};
std::vector<int32_t> Root(void)
{
return GetListSubNode(ROOT_NODE_ID);
};
private:
int32_t m_LastId;
std::vector< EdnTreeElement<T> > m_listElement; //!< list of element...
bool CheckPresence(int32_t id)
{
int32_t i;
for (i=0; i<(int32_t)m_listElement.size(); i++) {
if (m_listElement[i].GetId() == id) {
return true;
}
}
return false;
};
bool CheckPresenceParrent(int32_t parrentId)
{
if (ROOT_NODE_ID == parrentId) {
return true;
}
return CheckPresence(parrentId);
};
int32_t FindElementWithId(int32_t id)
{
int32_t i;
for (i=0; i<(int32_t)m_listElement.size(); i++) {
if (m_listElement[i].GetId() == id) {
return i;
}
}
return ROOT_NODE_ID;
};
};
#undef __class__
#define __class__ NULL
#endif

View File

@@ -227,7 +227,7 @@ int8_t& EdnVectorBuf::Get(int32_t pos)
* @return ---
*
*/
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, EdnVectorBin<int8_t> &tmpBuffer)
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, Edn::VectorType<int8_t> &tmpBuffer)
{
tmpBuffer.Clear();
if (pos < m_gapStart) {
@@ -399,7 +399,7 @@ void EdnVectorBuf::Insert(int32_t pos, const int8_t& item)
* @return ---
*
*/
void EdnVectorBuf::Insert(int32_t pos, EdnVectorBin<int8_t>& items)
void EdnVectorBuf::Insert(int32_t pos, Edn::VectorType<int8_t>& items)
{
if( pos > Size()
|| pos < 0 ) {
@@ -455,7 +455,7 @@ void EdnVectorBuf::Replace(int32_t pos, const int8_t& item)
* @return ---
*
*/
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, EdnVectorBin<int8_t>& items)
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, Edn::VectorType<int8_t>& items)
{
if( pos > Size()
|| pos < 0 ) {
@@ -652,7 +652,7 @@ void TestEdnVectorBuf(void)
myBufferTmp.Display();
plop='m';
EdnVectorBin<int8_t> items;
Edn::VectorType<int8_t> items;
items.PushBack('i');
items.PushBack('j');
items.PushBack('k');

View File

@@ -27,7 +27,7 @@
#define __EDN_VECTOR_BUF_H__
#include "toolsMemory.h"
#include "EdnVectorBin.h"
#include "VectorType.h"
#undef __class__
#define __class__ "EdnVectorBuf"
@@ -272,14 +272,14 @@ class EdnVectorBuf
EdnVectorBuf & operator=( const EdnVectorBuf & Evb);
int8_t operator[] (int32_t pos);
int8_t & Get( int32_t pos);
void Get( int32_t pos, int32_t nbElement, EdnVectorBin<int8_t> &tmpBuffer);
void Get( int32_t pos, int32_t nbElement, Edn::VectorType<int8_t> &tmpBuffer);
// insert functions
void PushBack( const int8_t& item);
void Insert( int32_t pos, const int8_t& item);
void Insert( int32_t pos, EdnVectorBin<int8_t>& items);
void Insert( int32_t pos, Edn::VectorType<int8_t>& items);
// Remove and insert functions
void Replace( int32_t pos, const int8_t& item);
void Replace( int32_t pos, int32_t nbRemoveElement, EdnVectorBin<int8_t>& items);
void Replace( int32_t pos, int32_t nbRemoveElement, Edn::VectorType<int8_t>& items);
// Revove fonctions
void Remove( int32_t pos, int32_t nbRemoveElement = 1);
void PopBack( void);

View File

@@ -161,6 +161,8 @@ static char * GetMessageTypeChar(messageCat_te Id)
return (char*)"GUI_MANAGER";
case EDN_CAT_CTAGS:
return (char*)"C-TAGS_MANAGER";
case EDN_CAT_MENU_CONTEXT:
return (char*)"MENU CONTEXT";
default:
return (char*)"??";
}
@@ -198,6 +200,10 @@ void MsgBroadcastCore::SendMessage(MsgBroadcast * pointerOnSender, messageType_t
&& MSG_TO_CTAGS__STOP >= id )
{
catDest = EDN_CAT_CTAGS;
} else if( MSG_TO_CONTEXT__START <= id
&& MSG_TO_CONTEXT__STOP >= id )
{
catDest = EDN_CAT_MENU_CONTEXT;
}
myStructMessage.localMessageID = m_messageID++;

View File

@@ -121,6 +121,10 @@ typedef enum {
EDN_MSG__JUMP_BACK,
MSG_TO_CTAGS__STOP,
// DESTINATION : context popup ...
MSG_TO_CONTEXT__START,
MSG_TO_CONTEXT__STOP,
}messageType_te;
@@ -132,6 +136,7 @@ typedef enum {
EDN_CAT_BUFFER_MANAGER,
EDN_CAT_GUI_MANAGER,
EDN_CAT_CTAGS,
EDN_CAT_MENU_CONTEXT,
}messageCat_te;
@@ -183,9 +188,9 @@ class MsgBroadcastCore: public Singleton<MsgBroadcastCore>
void RmReceiver(MsgBroadcast * pointerOnReceiver);
private:
EdnVectorBin<MsgBroadcast*> m_listMessage;
Edn::VectorType<MsgBroadcast*> m_listMessage;
uint32_t m_messageID;
EdnVectorBin<messageElement_ts> m_listOfMessage;
Edn::VectorType<messageElement_ts> m_listOfMessage;
};

View File

@@ -26,19 +26,11 @@
#include "tools_debug.h"
#include "toolsMemory.h"
#include "EdnVectorBin.h"
//#include "Vector.h" // TODO : Set the vector of edn enable
#include "VectorType.h"
#ifndef __EDN_H__
#define __EDN_H__
#define _IN_NAMESPACE_EDN_ (plop)
#include "String.h"
namespace Edn
{
#include "String.h"
#include "File.h"
}
#include "File.h"
#undef IN_NAMESPACE_EDN
#endif

View File

@@ -28,12 +28,15 @@
#include "tools_globals.h"
#include "Edn.h"
#define MAX_FILE_NAME (10240)
Edn::File::File(Edn::String &filename, int32_t LineNumber)
{
m_lineNumberOpen = 0;
SetCompleateName(filename);
}
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
{
Edn::String tmpString = folder;
@@ -105,7 +108,17 @@ Edn::String Edn::File::GetCompleateName(void)
void Edn::File::SetCompleateName(Edn::String &newFilename)
{
char buf[MAX_FILE_NAME];
memset(buf, 0, MAX_FILE_NAME);
char * ok;
// Get the real Path of the current File
ok = realpath(newFilename.c_str(), buf);
if (!ok) {
EDN_ERROR("Can not find real name of \"" << newFilename.c_str() << "\"");
} else {
EDN_DEBUG("file : \"" << newFilename.c_str() << "\" done:\"" << buf << "\" ");
}
}
int32_t Edn::File::GetLineNumber(void)

View File

@@ -23,31 +23,32 @@
*******************************************************************************
*/
#ifndef __EDN__FILE_H__
#define __EDN__FILE_H__
#ifndef _IN_NAMESPACE_EDN_
# error This will be include only in "edn.h"
#else
class File
namespace Edn
{
public:
File(void) { m_lineNumberOpen=0; }
File(Edn::String &filename, int32_t LineNumber = 0);
File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0);
~File(void);
Edn::String GetFolder(void);
Edn::String GetShortFilename(void);
Edn::String GetCompleateName(void);
int32_t GetLineNumber(void);
void SetCompleateName(Edn::String &newFilename);
private :
void ExtranctAndName(Edn::String &inputString);
Edn::String m_folder;
Edn::String m_shortFilename;
int32_t m_lineNumberOpen;
};
class File
{
public:
File(void) { m_lineNumberOpen=0; }
File(Edn::String &filename, int32_t LineNumber = 0);
File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0);
~File(void);
Edn::String GetFolder(void);
Edn::String GetShortFilename(void);
Edn::String GetCompleateName(void);
int32_t GetLineNumber(void);
void SetCompleateName(Edn::String &newFilename);
private :
void ExtranctAndName(Edn::String &inputString);
Edn::String m_folder;
Edn::String m_shortFilename;
int32_t m_lineNumberOpen;
};
}
#endif

View File

@@ -0,0 +1,488 @@
/**
*******************************************************************************
* @file RegExp.cpp
* @brief Editeur De N'ours : Regular expression annalyser (sources)
* @author Edouard DUPIN
* @date 04/04/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 "toolsMemory.h"
#include "RegExp.h"
const convertionTable_ts constConvertionTable[] = {
// haveBackSlash, inputValue, newValue
{ false , '(' , OPCODE_PTHESE_IN},
{ true , '(' , (int16_t)'('},
{ false , ')' , OPCODE_PTHESE_OUT},
{ true , ')' , (int16_t)')'},
{ false , '[' , OPCODE_BRACKET_IN},
{ true , '[' , (int16_t)'['},
{ false , ']' , OPCODE_BRACKET_OUT},
{ true , ']' , (int16_t)']'},
{ false , '{' , OPCODE_BRACE_IN},
{ true , '{' , (int16_t)'{'},
{ false , '}' , OPCODE_BRACE_OUT},
{ true , '}' , (int16_t)'}'},
{ false , '-' , OPCODE_TO},
{ true , '-' , (int16_t)'-'},
{ false , '*' , OPCODE_STAR},
{ true , '*' , (int16_t)'*'},
{ false , '.' , OPCODE_DOT},
{ true , '.' , (int16_t)'.'},
{ false , '?' , OPCODE_QUESTION},
{ true , '?' , (int16_t)'?'},
{ false , '+' , OPCODE_PLUS},
{ true , '+' , (int16_t)'+'},
{ false , '|' , OPCODE_PIPE},
{ true , '|' , (int16_t)'|'},
{ false , '^' , OPCODE_START_OF_LINE},
{ true , '^' , (int16_t)'^'},
{ false , '$' , OPCODE_END_OF_LINE},
{ true , '$' , (int16_t)'$'},
{ true , 'd' , OPCODE_DIGIT},
{ true , 'D' , OPCODE_DIGIT_NOT},
{ true , 'l' , OPCODE_LETTER},
{ true , 'L' , OPCODE_LETTER_NOT},
{ true , 's' , OPCODE_SPACE},
{ true , 'S' , OPCODE_SPACE_NOT},
{ true , 'w' , OPCODE_WORD},
{ true , 'W' , OPCODE_WORD_NOT},
{ true , 'a' , (int16_t)'\a'},
{ true , 'b' , (int16_t)'\b'},
{ true , 'e' , 0x001B}, // Escape character <Esc>
{ true , 'f' , (int16_t)'\f'},
{ true , 'n' , (int16_t)'\n'},
{ true , 'r' , (int16_t)'\r'},
{ true , 't' , (int16_t)'\t'},
{ true , 'v' , (int16_t)'\v'},
{ true , '\\' , (int16_t)'\\'},
{ true , '&' , (int16_t)'&'},
{ true , '0' , (int16_t)'\0'},
{ true , '@' , OPCODE_NO_CHAR},
};
const int32_t constConvertionTableSize = sizeof(constConvertionTable) / sizeof(convertionTable_ts) ;
/**
* @brief Display the internal data of a node
*
* @param[in] data element do display in the console
*
* @return ---
*
*/
void DisplayData(Edn::VectorType<char> &data)
{
int32_t i;
for (i=0; i<(int32_t)data.Size() ; i++) {
std::cout<< (char)(data[i]&0x00FF );
}
}
/**
* @brief Display of a part of the Regexp element
*
* @param[in] data Vector where data is constain
* @param[in] start Position where the display might start
* @param[in] stop Position where the display might stop
*
* @return ---
*
*/
void DisplayElem(Edn::VectorType<int16_t> &data, int32_t start, int32_t stop)
{
int32_t i;
std::cout<< COLOR_NORMAL;
for (i=start; i<(int32_t)data.Size() && i<stop ; i++) {
switch(data[i])
{
case OPCODE_PTHESE_IN: std::cout<<COLOR_RED << (char*)"(" << COLOR_NORMAL; break;
case OPCODE_PTHESE_OUT: std::cout<<COLOR_RED << (char*)")" << COLOR_NORMAL; break;
case OPCODE_BRACKET_IN: std::cout<<COLOR_YELLOW << (char*)"[" << COLOR_NORMAL; break;
case OPCODE_BRACKET_OUT: std::cout<<COLOR_YELLOW << (char*)"]" << COLOR_NORMAL; break;
case OPCODE_TO: std::cout<<COLOR_YELLOW << (char*)"-" << COLOR_NORMAL; break;
case OPCODE_BRACE_IN: std::cout<<COLOR_GREEN << (char*)"{" << COLOR_NORMAL; break;
case OPCODE_BRACE_OUT: std::cout<<COLOR_GREEN << (char*)"}" << COLOR_NORMAL; break;
case OPCODE_STAR: std::cout<<COLOR_BLUE << (char*)"*" << COLOR_NORMAL; break;
case OPCODE_DOT: std::cout<<COLOR_BLUE << (char*)"." << COLOR_NORMAL; break;
case OPCODE_QUESTION: std::cout<<COLOR_BLUE << (char*)"?" << COLOR_NORMAL; break;
case OPCODE_PLUS: std::cout<<COLOR_BLUE << (char*)"+" << COLOR_NORMAL; break;
case OPCODE_PIPE: std::cout<<COLOR_BLUE << (char*)"|" << COLOR_NORMAL; break;
case OPCODE_NO_CHAR: std::cout<<COLOR_MAGENTA << (char*)"@" << COLOR_NORMAL; break;
case OPCODE_START_OF_LINE: std::cout<<COLOR_MAGENTA << (char*)"^" << COLOR_NORMAL; break;
case OPCODE_END_OF_LINE: std::cout<<COLOR_MAGENTA << (char*)"$" << COLOR_NORMAL; break;
case OPCODE_DIGIT: std::cout<<COLOR_MAGENTA << (char*)"\\d" << COLOR_NORMAL; break;
case OPCODE_DIGIT_NOT: std::cout<<COLOR_MAGENTA << (char*)"\\D" << COLOR_NORMAL; break;
case OPCODE_LETTER: std::cout<<COLOR_MAGENTA << (char*)"\\l" << COLOR_NORMAL; break;
case OPCODE_LETTER_NOT: std::cout<<COLOR_MAGENTA << (char*)"\\L" << COLOR_NORMAL; break;
case OPCODE_SPACE: std::cout<<COLOR_MAGENTA << (char*)"\\s" << COLOR_NORMAL; break;
case OPCODE_SPACE_NOT: std::cout<<COLOR_MAGENTA << (char*)"\\S" << COLOR_NORMAL; break;
case OPCODE_WORD: std::cout<<COLOR_MAGENTA << (char*)"\\w" << COLOR_NORMAL; break;
case OPCODE_WORD_NOT: std::cout<<COLOR_MAGENTA << (char*)"\\W" << COLOR_NORMAL; break;
case '\n': std::cout<<COLOR_MAGENTA << (char*)"\\n" << COLOR_NORMAL; break;
case '\t': std::cout<<COLOR_MAGENTA << (char*)"\\t" << COLOR_NORMAL; break;
default: std::cout<< (char)(data[i]&0x00FF ); break;
}
}
}
char * levelSpace(int32_t level)
{
switch(level)
{
case 0: return (char*)"";
case 1: return (char*)" ";
case 2: return (char*)" ";
case 3: return (char*)" ";
case 4: return (char*)" ";
case 5: return (char*)" ";
case 6: return (char*)" ";
case 7: return (char*)" ";
case 8: return (char*)" ";
case 9: return (char*)" ";
case 10: return (char*)" ";
case 11: return (char*)" ";
case 12: return (char*)" ";
case 13: return (char*)" ";
case 14: return (char*)" ";
case 15: return (char*)" ";
case 16: return (char*)" ";
default: return (char*)" ";
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t GetLenOfPTheseElem(Edn::VectorType<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
int32_t nbOpen = 0;
// special case of the (...) or | ==> we search '|' or ')'
if( OPCODE_PTHESE_OUT == data[pos]
|| OPCODE_PIPE == data[pos]) {
return 0;
}
// find size ...
while (pos < (int32_t)data.Size() ) {
if(OPCODE_PTHESE_IN == data[pos]) {
// find a sub section :
nbOpen++;
} else if(0 < nbOpen) {
if (OPCODE_PTHESE_OUT == data[pos])
{
nbOpen--;
if (0 > nbOpen) {
EDN_ERROR("Error in the (...) find element at "<< pos);
return -1;
}
}
} else if( OPCODE_PTHESE_OUT == data[pos]
|| OPCODE_PIPE == data[pos])
{
// Find the end of the (...)
// just return the size inside
int32_t sizeInside = pos - startPos;
if (0 >= sizeInside) {
EDN_ERROR("Error in the (...) no data at "<< pos-1);
return -1;
} else {
return sizeInside;
}
}
pos++;
}
return pos - startPos;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t GetLenOfPThese(Edn::VectorType<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
int32_t nbOpen = 0;
// special case of the (...) or | ==> we search '|' or ')'
if( OPCODE_PTHESE_OUT == data[pos]) {
return 0;
} else if( OPCODE_PTHESE_IN == data[pos])
{
pos++;
// find size ...
while (pos < (int32_t)data.Size() ) {
if(OPCODE_PTHESE_IN == data[pos]) {
// find a sub section :
nbOpen++;
} else if(0 < nbOpen) {
if (OPCODE_PTHESE_OUT == data[pos])
{
nbOpen--;
if (0 > nbOpen) {
EDN_ERROR("Error in the (...) find element at "<< pos);
return -1;
}
}
} else if( OPCODE_PTHESE_OUT == data[pos])
{
// Find the end of the (...)
// just return the size inside
int32_t sizeInside = pos - startPos-1;
if (0 >= sizeInside) {
EDN_ERROR("Error in the (...) no data at "<< pos-1);
return -1;
} else {
return sizeInside;
}
}
pos++;
}
} else {
return -1;
}
return 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t GetLenOfBracket(Edn::VectorType<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
// special case of the (...) or | ==> we search '|' or ')'
if( OPCODE_BRACKET_OUT == data[pos]) {
return 0;
} else if( OPCODE_BRACKET_IN == data[pos]) {
pos++;
// find size ...
while (pos < (int32_t)data.Size() ) {
if(OPCODE_BRACKET_OUT == data[pos]) {
// Find the end of the [...]
// just return the size inside
int32_t sizeInside = pos - startPos -1 ;
if (0 >= sizeInside) {
EDN_ERROR("Error in the [...] no data at "<< pos-1);
return sizeInside;
} else {
return sizeInside;
}
} else if( OPCODE_TO != data[pos]
&& ( 0 > data[pos]
|| 0xFF < data[pos]) )
{
EDN_ERROR("Error in the [...] not permited element at "<< pos << " '" << (char)data[pos] << "'");
return false;
}
pos++;
}
} else {
return -1;
}
return 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t GetLenOfBrace(Edn::VectorType<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
// special case of the (...) or | ==> we search '|' or ')'
if( OPCODE_BRACE_OUT == data[pos]) {
return 0;
} else if( OPCODE_BRACE_IN == data[pos]) {
pos++;
// find size ...
while (pos < (int32_t)data.Size() ) {
if(OPCODE_BRACE_OUT == data[pos]) {
// Find the end of the [...]
// just return the size inside
int32_t sizeInside = pos - startPos -1 ;
if (0 >= sizeInside) {
EDN_ERROR("Error in the {...} no data at "<< pos-1);
return sizeInside;
} else {
return sizeInside;
}
} else if( ',' != data[pos]
&& ( '0' > data[pos]
|| '9' < data[pos]) )
{
EDN_ERROR("Error in the {...} not permited element at "<< pos << " '" << (char)data[pos] << "'");
return false;
}
pos++;
}
} else {
return -1;
}
return 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t GetLenOfNormal(Edn::VectorType<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
// find size ...
while (pos < (int32_t)data.Size() ) {
switch(data[pos])
{
case OPCODE_PTHESE_IN:
case OPCODE_PTHESE_OUT:
case OPCODE_BRACKET_IN:
case OPCODE_BRACKET_OUT:
case OPCODE_BRACE_IN:
case OPCODE_BRACE_OUT:
case OPCODE_TO:
case OPCODE_STAR:
case OPCODE_DOT:
case OPCODE_QUESTION:
case OPCODE_PLUS:
case OPCODE_PIPE:
case OPCODE_START_OF_LINE:
case OPCODE_END_OF_LINE:
case OPCODE_DIGIT:
case OPCODE_DIGIT_NOT:
case OPCODE_LETTER:
case OPCODE_LETTER_NOT:
case OPCODE_SPACE:
case OPCODE_SPACE_NOT:
case OPCODE_WORD:
case OPCODE_WORD_NOT:
{
// just return the size inside
int32_t sizeInside = pos - startPos;
if (0 >= sizeInside) {
EDN_ERROR("Error in the normal data : no data ...");
}
return sizeInside;
}
break;
default :
// nothing to do ...
break;
}
pos++;
}
return pos - startPos ;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool ParseBrace(Edn::VectorType<int16_t> &data, int32_t &min, int32_t &max)
{
//EDN_INFO("parse {...} in "; DisplayElem(data); );
int32_t k=0;
int32_t firstElement = 0;
int32_t SecondElement = 0;
while(k<data.Size()) {
if (',' == (char)data[k]) {
k++;
break;
} if ('}' == (char)data[k]) {
SecondElement = firstElement;
goto allIsSet;
} else if ('0' <= (char)data[k] && '9' >= (char)data[k]) {
firstElement *=10;
firstElement += (char)data[k] - '0';
} else {
EDN_ERROR("Can not parse this element " << (char)data[k] << " at pos " << k);
return false;
}
k++;
}
if (k==data.Size()) {
SecondElement = firstElement;
}
while(k<data.Size()) {
if (',' == (char)data[k]) {
EDN_ERROR("Can not find a second , in {} at pos " << k);
return false;
} if ('}' == (char)data[k]) {
goto allIsSet;
} else if ('0' <= (char)data[k] && '9' >= (char)data[k]) {
SecondElement *=10;
SecondElement += (char)data[k] - '0';
} else {
EDN_ERROR("Can not parse this element " << (char)data[k] << " at pos " << k);
return false;
}
k++;
}
allIsSet:
if (SecondElement == 0 && firstElement != 0) {
min = 0;
max = firstElement;
} else {
min = firstElement;
max = SecondElement;
}
if (min > max) {
EDN_ERROR("Minimum=" << min << " can not be < maximum=" << max );
return false;
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@@ -205,7 +205,7 @@ const Edn::String& Edn::String::operator= (const char * inputData)
* @return
*
*/
const Edn::String& Edn::String::operator= (EdnVectorBin<int8_t> inputData)
const Edn::String& Edn::String::operator= (Edn::VectorType<int8_t> inputData)
{
m_data = inputData;
if (m_data.Size()>0) {
@@ -569,9 +569,9 @@ Edn::String Edn::String::Extract(int32_t posStart, int32_t posEnd)
* @return The desired vector with data
*
*/
EdnVectorBin<int8_t> Edn::String::GetVector(void)
Edn::VectorType<int8_t> Edn::String::GetVector(void)
{
EdnVectorBin<int8_t> out = m_data;
Edn::VectorType<int8_t> out = m_data;
out.PopBack();
return out;
}
@@ -630,7 +630,7 @@ void Edn::TestUntaire_String(void)
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
s1 = "test direct 44";
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
EdnVectorBin<int8_t> vb1;
Edn::VectorType<int8_t> vb1;
vb1.PushBack('v');
vb1.PushBack('b');
vb1.PushBack('1');

View File

@@ -22,11 +22,11 @@
*
*******************************************************************************
*/
#ifndef __END__STRING_H__
#define __END__STRING_H__
#ifndef _IN_NAMESPACE_EDN_
# error This will be include only in "edn.h"
#else
namespace Edn
{
class String
{
public:
@@ -45,18 +45,17 @@
const Edn::String& operator= (const Edn::String &ednS ); // assigment
const Edn::String& operator= (const char * inputData);
const Edn::String& operator= (EdnVectorBin<int8_t> inputData);
bool operator== (const Edn::String& ednS) const; // == operator
bool operator== (const char * inputData) const;
bool operator!= (const Edn::String& ednS) const; // != operator
bool operator!= (const char * inputData) const;
const Edn::String& operator= (Edn::VectorType<int8_t> inputData);
bool operator== (const Edn::String& ednS) const; // == operator
bool operator== (const char * inputData) const;
bool operator!= (const Edn::String& ednS) const; // != operator
bool operator!= (const char * inputData) const;
const Edn::String& operator+= (const Edn::String &ednS); // += operator
const Edn::String& operator+= (const char * inputData);
Edn::String operator+ (const Edn::String &ednS); // + operator
Edn::String operator+ (const char * inputData);
//operator const char *()
bool IsEmpty(void) const;
int32_t Size(void) const;
@@ -64,7 +63,7 @@
void Remove(int32_t currentID, int32_t len);
void Clear(void);
EdnVectorBin<int8_t> GetVector(void);
Edn::VectorType<int8_t> GetVector(void);
char * c_str(void) { return (char*)&m_data[0]; };
// Sting operation :
@@ -73,10 +72,11 @@
Edn::String Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF);
private :
EdnVectorBin<int8_t> m_data;
Edn::VectorType<int8_t> m_data;
};
void TestUntaire_String(void);
}
#endif

View File

@@ -1,7 +1,7 @@
/**
*******************************************************************************
* @file EdnEdnVector.h
* @brief Editeur De N'ours : Basic EdnVector (template)
* @file Vector.h
* @brief Editeur De N'ours : Basic Edn::Vector (template)
* @author Edouard DUPIN
* @date 07/04/2011
* @par Project
@@ -26,7 +26,7 @@
#define __EDN_EdnVector_H__
#undef __class__
#define __class__ "EdnEdnVector"
#define __class__ "Edn::Vector"
/**
* @brief EdnVector classes ...
@@ -62,32 +62,35 @@
* ----------
*
*/
template<class T, int32_t INC=0> class EdnVector:
namespace Edn
{
template<class T, int32_t INC=0> class Vector
{
public:
class Iterator:
class Iterator
{
// Private data :
private:
int32_t m_current; // curent Id on the vector
EdnVector<T> * m_EdnVector; // Pointer on the curent element of the vector
Edn::Vector<T> * m_Vector; // Pointer on the curent element of the vector
public:
/**
* @brief Basic itarator constructor with no link with an EdnVector
* @brief Basic itarator constructor with no link with an Vector
*/
Iterator():
m_current(-1),
m_EdnVector(NULL)
m_Vector(NULL)
{
// nothing to do ...
}
/**
* @brief Recopy constructor on a specific EdnVector.
* @brief Recopy constructor on a specific Vector.
* @param[in] otherIterator The Iterator that might be copy
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_EdnVector(otherIterator.m_EdnVector)
m_Vector(otherIterator.m_Vector)
{
// nothing to do ...
}
@@ -99,7 +102,7 @@ template<class T, int32_t INC=0> class EdnVector:
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_EdnVector = otherIterator.m_EdnVector;
m_Vector = otherIterator.m_Vector;
return *this;
}
/**
@@ -108,11 +111,11 @@ template<class T, int32_t INC=0> class EdnVector:
~Iterator()
{
m_current = -1;
m_EdnVector = NULL;
m_Vector = NULL;
}
/**
* @brief basic boolean cast
* @return true if the element is present in the EdnVector size
* @return true if the element is present in the Vector size
*/
operator bool ()
{
@@ -204,13 +207,13 @@ template<class T, int32_t INC=0> class EdnVector:
* @return ---
*
*/
Iterator(EdnVector<T> * EdnVector, int pos):
Iterator(Edn::Vector<T> * myVector, int pos):
m_current(pos),
m_EdnVector(EdnVector)
m_Vector(myVector)
{
// nothing to do ...
}
friend class EdnVector;
friend class Edn::Vector<T>;
};
/**
@@ -221,7 +224,7 @@ template<class T, int32_t INC=0> class EdnVector:
* @return ---
*
*/
EdnVector(int count = 0):
Vector(int count = 0):
m_data(NULL),
m_count(0),
m_size(0)
@@ -237,15 +240,15 @@ template<class T, int32_t INC=0> class EdnVector:
* @return ---
*
*/
EdnVector(const EdnVector<T> & EdnVector):
m_size(EdnVector.m_size),
m_count(EdnVector.m_count),
Vector(const Edn::Vector<T> & myVector):
m_size(myVector.m_size),
m_count(myVector.m_count),
m_data(NULL)
{
int32_t i;
EDN_MALLOC_CAST(m_data, m_size, T, reinterpret_cast<T*>);
for(i=0; i<m_count; i++) {
new (&m_data[i]) T(EdnVector[i]);
new (&m_data[i]) T(myVector[i]);
}
}
@@ -257,7 +260,7 @@ template<class T, int32_t INC=0> class EdnVector:
* @return ---
*
*/
~EdnVector()
~Vector()
{
Destroy();
}
@@ -270,7 +273,7 @@ template<class T, int32_t INC=0> class EdnVector:
* @return ---
*
*/
EdnVector& operator=(const EdnVector<T> & EdnVector)
Vector& operator=(const Edn::Vector<T> & EdnVector)
{
int32_t i;
this->~EdnVector();
@@ -493,5 +496,11 @@ private:
}
}
};
}
#undef __class__
#define __class__ NULL
#define __class__ NULL
#endif

View File

@@ -1,7 +1,7 @@
/**
*******************************************************************************
* @file EdnEdnVectorBin.h
* @brief Editeur De N'ours : Basic EdnVectorBin for direct data insertion (template)
* @file VectorType.h
* @brief Editeur De N'ours : Basic VectorType for direct data insertion (template)
* @author Edouard DUPIN
* @date 07/04/2011
* @par Project
@@ -29,10 +29,10 @@
#include "toolsMemory.h"
#undef __class__
#define __class__ "EdnEdnVectorBin"
#define __class__ "Edn::VectorType"
/**
* @brief EdnVectorBin classes ...
* @brief VectorType classes ...
*
* @tparam[in] SIZE Size of the current element.
*
@@ -65,22 +65,26 @@
* ----------------------------------------
*
*/
template<typename MY_TYPE=int32_t> class EdnVectorBin
namespace Edn
{
template<typename MY_TYPE=int32_t> class VectorType
{
public:
class Iterator
{
// Private data :
// Private data :
private:
int32_t m_current; // curent Id on the vector
EdnVectorBin<MY_TYPE> * m_EdnVectorBin; // Pointer on the curent element of the vectorBin
int32_t m_current; //!< curent Id on the vector
VectorType<MY_TYPE> * m_VectorType; //!< Pointer on the curent element of the vectorBin
public:
/**
* @brief Basic itarator constructor with no link with an EdnVector
*/
Iterator():
m_current(-1),
m_EdnVectorBin(NULL)
m_VectorType(NULL)
{
// nothing to do ...
}
@@ -90,7 +94,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_EdnVectorBin(otherIterator.m_EdnVectorBin)
m_VectorType(otherIterator.m_VectorType)
{
// nothing to do ...
}
@@ -102,7 +106,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_EdnVectorBin = otherIterator.m_EdnVectorBin;
m_VectorType = otherIterator.m_VectorType;
return *this;
}
/**
@@ -111,7 +115,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
~Iterator()
{
m_current = -1;
m_EdnVectorBin = NULL;
m_VectorType = NULL;
}
/**
* @brief basic boolean cast
@@ -120,7 +124,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
operator bool ()
{
if( 0 <= m_current
&& m_current < m_EdnVectorBin->Size() )
&& m_current < m_VectorType->Size() )
{
return true;
} else {
@@ -133,8 +137,8 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
*/
Iterator& operator++ ()
{
if( NULL != m_EdnVectorBin
&& m_current < m_EdnVectorBin->Size() )
if( NULL != m_VectorType
&& m_current < m_VectorType->Size() )
{
m_current++;
}
@@ -177,8 +181,8 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
*/
MY_TYPE & operator-> () const
{
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_EdnVectorBin->Size());
return &m_EdnVectorBin->Get(m_current);
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size());
return &m_VectorType->Get(m_current);
}
/**
* @brief Get reference on the current Element
@@ -186,8 +190,8 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
*/
MY_TYPE & operator* () const
{
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_EdnVectorBin->Size());
return m_EdnVectorBin->Get(m_current);
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size());
return m_VectorType->Get(m_current);
}
private:
/**
@@ -198,26 +202,26 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
* @return ---
*
*/
Iterator(EdnVectorBin<MY_TYPE> * Evb, int32_t pos):
Iterator(VectorType<MY_TYPE> * Evb, int32_t pos):
m_current(pos),
m_EdnVectorBin(Evb)
m_VectorType(Evb)
{
// nothing to do ...
}
friend class EdnVectorBin;
friend class VectorType;
};
private:
MY_TYPE * m_data; //!< pointer on the curetn table of Data
int32_t m_size; //!< nb Element in the buffer
int32_t m_allocated; //!< Current allocated size
int32_t m_increment; //!< methode of increment
MY_TYPE * m_data; //!< pointer on the curetn table of Data
int32_t m_size; //!< nb Element in the buffer
int32_t m_allocated; //!< Current allocated size
int32_t m_increment; //!< methode of increment
public:
/**
* @brief Create an empty vector
* @param[in] count Minimum request size of the Buffer
*/
EdnVectorBin(int32_t count = 0):
VectorType(int32_t count = 0):
m_data(NULL),
m_size(0),
m_allocated(0),
@@ -230,12 +234,12 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
* @brief Re-copy constructor (copy all needed data)
* @param[in] Evb Vector that might be copy
*/
EdnVectorBin(const EdnVectorBin<MY_TYPE> & Evb)
VectorType(const Edn::VectorType<MY_TYPE> & Evb)
{
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
m_data = NULL;
m_data = NULL;
//EDN_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
// allocate all same data
EDN_MALLOC(m_data, m_allocated, MY_TYPE);
@@ -247,7 +251,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
/**
* @brief Destructor of the current Class
*/
~EdnVectorBin()
~VectorType()
{
if (NULL!=m_data) {
EDN_FREE(m_data);
@@ -263,7 +267,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
* @param[in] Evb Vector that might be copy
* @return reference on the curent re-copy vector
*/
EdnVectorBin& operator=(const EdnVectorBin<MY_TYPE> & Evb)
VectorType& operator=(const Edn::VectorType<MY_TYPE> & Evb)
{
//EDN_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
if( this != &Evb ) // avoid copy to itself
@@ -290,7 +294,7 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
EdnVectorBin& operator+= (const EdnVectorBin<MY_TYPE> & Evb) // += operator
VectorType& operator+= (const Edn::VectorType<MY_TYPE> & Evb) // += operator
{
int32_t nbElememt = Evb.Size();
int32_t idx = m_size;
@@ -502,9 +506,9 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
* @param[in] posEnd End position to extract data
* @return the extracted vector
*/
EdnVectorBin Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
VectorType Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
{
EdnVectorBin<MY_TYPE> out;
VectorType<MY_TYPE> out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
@@ -633,10 +637,11 @@ template<typename MY_TYPE=int32_t> class EdnVectorBin
// set the new allocation size
m_allocated = requestSize;
}
};
}
#undef __class__
#define __class__ NULL
#endif

View File

@@ -101,14 +101,14 @@ void convertUnicodeToIso(charset_te inputCharset, int32_t input_Unicode, char &
}
int32_t convertIsoToUnicode(charset_te inputCharset, EdnVectorBin<char>& input_ISO, EdnVectorBin<int32_t>& output_Unicode)
int32_t convertIsoToUnicode(charset_te inputCharset, Edn::VectorType<char>& input_ISO, Edn::VectorType<int32_t>& output_Unicode)
{
EDN_WARNING("TODO : not coded...");
return 0;
}
int32_t convertUnicodeToIso(charset_te inputCharset, EdnVectorBin<int32_t>& input_Unicode, EdnVectorBin<char>& output_ISO)
int32_t convertUnicodeToIso(charset_te inputCharset, Edn::VectorType<int32_t>& input_Unicode, Edn::VectorType<char>& output_ISO)
{
EDN_WARNING("TODO : not coded...");
return 0;
@@ -204,14 +204,14 @@ void convertUtf8ToUnicode(char * input_UTF8, int32_t &output_Unicode)
}
int32_t convertUnicodeToUtf8(EdnVectorBin<int32_t>& input_Unicode, EdnVectorBin<char>& output_UTF8)
int32_t convertUnicodeToUtf8(Edn::VectorType<int32_t>& input_Unicode, Edn::VectorType<char>& output_UTF8)
{
EDN_WARNING("TODO : not coded...");
return 0;
}
int32_t convertUtf8ToUnicode(EdnVectorBin<char>& input_UTF8, EdnVectorBin<int32_t>& output_Unicode)
int32_t convertUtf8ToUnicode(Edn::VectorType<char>& input_UTF8, Edn::VectorType<int32_t>& output_Unicode)
{
EDN_WARNING("TODO : not coded...");
return 0;
@@ -239,14 +239,14 @@ void convertUtf8ToIso(charset_te inputCharset, char * input_UTF8, char & output
}
int32_t convertIsoToUtf8(charset_te inputCharset, EdnVectorBin<char>& input_ISO, EdnVectorBin<char>& output_UTF8)
int32_t convertIsoToUtf8(charset_te inputCharset, Edn::VectorType<char>& input_ISO, Edn::VectorType<char>& output_UTF8)
{
EDN_WARNING("TODO : not coded...");
return 0;
}
int32_t convertUtf8ToIso(charset_te inputCharset, EdnVectorBin<char>& input_UTF8, EdnVectorBin<char>& output_ISO)
int32_t convertUtf8ToIso(charset_te inputCharset, Edn::VectorType<char>& input_UTF8, Edn::VectorType<char>& output_ISO)
{
EDN_WARNING("TODO : not coded...");
return 0;

View File

@@ -26,7 +26,7 @@
#ifndef __CHARSET_H__
#define __CHARSET_H__
#include "EdnVectorBin.h"
#include "VectorType.h"
typedef enum {
EDN_CHARSET_UTF8,
@@ -49,18 +49,18 @@ typedef enum {
// transform ISO <==> Unicode
void convertIsoToUnicode(charset_te inputCharset, char input_ISO, int32_t & output_Unicode);
void convertUnicodeToIso(charset_te inputCharset, int32_t input_Unicode, char & output_ISO);
int32_t convertIsoToUnicode(charset_te inputCharset, EdnVectorBin<char>& input_ISO, EdnVectorBin<int32_t>& output_Unicode);
int32_t convertUnicodeToIso(charset_te inputCharset, EdnVectorBin<int32_t>& input_Unicode, EdnVectorBin<char>& output_ISO);
int32_t convertIsoToUnicode(charset_te inputCharset, Edn::VectorType<char>& input_ISO, Edn::VectorType<int32_t>& output_Unicode);
int32_t convertUnicodeToIso(charset_te inputCharset, Edn::VectorType<int32_t>& input_Unicode, Edn::VectorType<char>& output_ISO);
// Transform UTF-8 <==> Unicode
void convertUnicodeToUtf8( int32_t input_Unicode, char * output_UTF8);
void convertUtf8ToUnicode( char * input_UTF8, int32_t& output_Unicode);
int32_t convertUnicodeToUtf8( EdnVectorBin<int32_t>& input_Unicode, EdnVectorBin<char>& output_UTF8);
int32_t convertUtf8ToUnicode( EdnVectorBin<char>& input_UTF8, EdnVectorBin<int32_t>& output_Unicode);
int32_t convertUnicodeToUtf8( Edn::VectorType<int32_t>& input_Unicode, Edn::VectorType<char>& output_UTF8);
int32_t convertUtf8ToUnicode( Edn::VectorType<char>& input_UTF8, Edn::VectorType<int32_t>& output_Unicode);
// Transform ISO <==> UTF-8
void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8);
void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO);
int32_t convertIsoToUtf8( charset_te inputCharset, EdnVectorBin<char>& input_ISO, EdnVectorBin<char>& output_UTF8);
int32_t convertUtf8ToIso( charset_te inputCharset, EdnVectorBin<char>& input_UTF8, EdnVectorBin<char>& output_ISO);
int32_t convertIsoToUtf8( charset_te inputCharset, Edn::VectorType<char>& input_ISO, Edn::VectorType<char>& output_UTF8);
int32_t convertUtf8ToIso( charset_te inputCharset, Edn::VectorType<char>& input_UTF8, Edn::VectorType<char>& output_ISO);
void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid);
int32_t strUtf8Len(const char *input_UTF8);

View File

@@ -18,7 +18,6 @@
# action a faire (ordonner) :
- sys : la methode de close est mauvaise...
- gui : Goto line (need only the gui)
- ctags : Back simple et multiple
- ctags : Multiple files
- sys : search complet, replace complet
@@ -31,7 +30,6 @@
* matlab
* java script
* SQL
* Assembleur
- project : list of current files open
- gui : demander l'enregistrement avant de fermer (quand c'est n<>cessaire)
- gui : demande de cr<63>ation de nouveaux fichier ou quiter l'editeur ...
@@ -46,16 +44,17 @@
- Transformation de charset a la vol<6F>
- Charset par defaut
- D<>ction de charset (<28> mettre dans les todo de charset)
- Faire les deplacement de EdnXXX dans le nameSpace Edn::XXX
- pb de s<>lection quand la ligne est pleine et la premi<6D>re ligne s<>lectionn<6E>...
# Text Editor
- [1] 0% Indent group with Tabulation and shift+tabulation
- [1] 0% Basic smart indent : Recopy the start of the previous line when return (copy '\t' and ' ')
- [1] 90% Indent group with Tabulation and shift+tabulation
- [1] 100% Basic smart indent : Recopy the start of the previous line when return (copy '\t' and ' ')
- [1] 0% Replace Tab with space when press the key
- [1] 0% Request save user when quit the software
- [1] 0% Hide/Display scroll element when not usefull
- [1] 0% Regular expression search
- [1] 10% Regular expression search
- [1] 80% Colorisation syntaxique
- [1] 80% Copier / coller ==> probleme sur les caract<63>res sp<73>ciaux comme <20> <20> <20> ...
- [1] 10% Search

View File

@@ -9,9 +9,23 @@
<end>\n</end>
<EscapeChar>\</EscapeChar>
</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>
<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>
</EdnLang>

76
data/lang_php.xml Normal file
View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c">
<ext>.php</ext>
<ext>.php3</ext>
<ext>.php4</ext>
<ext>.phtml</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline">
<color>comment</color>
<start>/\*</start>
<end>\*/</end>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<start>//[ \t]*TODO[ \t]*:</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="my comment inline">
<color>comment</color>
<start>#</start>
<end>\n</end>
</rule>
<rule name="my comment">
<color>comment</color>
<start>//</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</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>
<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>
<rule name="my type">
<color>type</color>
<start>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</start>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<start>\@abstract|and|as|break|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|interface|isset|list|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor\@</start>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<start>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</start>
</rule>
<rule name="numeric constant">
<color>number</color>
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
</rule>
<rule name="my boolean">
<color>boolean</color>
<start>\@true|TRUE|false|FALSE\@</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start>
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</start>
</rule>
</pass2>
</EdnLang>

View File

@@ -21,7 +21,6 @@ You can NOT:
- Add malware in the Sources.
- Do something bad with the sources.
- 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

143
test_transparence.c Normal file
View File

@@ -0,0 +1,143 @@
// gcc test_transparence.c -o out `pkg-config --cflags --libs gtk+-3.0` -DUSE_GTK_VERSION_3_0
// gcc test_transparence.c -o out `pkg-config --cflags --libs gtk+-2.0` -DUSE_GTK_VERSION_2_0
// includes system, malloc, EXIT_SUCCESS
#include <stdlib.h>
// includes fopen, fwrite, fseek, ftell
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <cairo.h>
static void screen_changed(GtkWidget *widget, GdkScreen *old_screen, gpointer user_data);
static gboolean expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
static void clicked(GtkWindow *win, GdkEventButton *event, gpointer user_data);
# if USE_GTK_VERSION_3_0
const GdkRGBA color = { 1.0, 1.0, 0.0, 0.0};
#endif
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 400, 400);
gtk_window_set_title(GTK_WINDOW(window), "Alpha Demo");
g_signal_connect(G_OBJECT(window), "delete-event", gtk_main_quit, NULL);
gtk_widget_set_app_paintable(window, TRUE);
# if USE_GTK_VERSION_3_0
g_signal_connect(G_OBJECT(window), "draw", G_CALLBACK(expose), NULL);
# elif USE_GTK_VERSION_2_0
g_signal_connect(G_OBJECT(window), "expose-event", G_CALLBACK(expose), NULL);
# endif
g_signal_connect(G_OBJECT(window), "screen-changed", G_CALLBACK(screen_changed), NULL);
# if USE_GTK_VERSION_3_0
GtkStyleContext *context;
GdkRGBA rgba;
context = gtk_widget_get_style_context(window);
gtk_style_context_get_background_color(context, GTK_STATE_FLAG_NORMAL,
&rgba);
gtk_widget_override_background_color(window,
GTK_STATE_FLAG_NORMAL, &rgba);
/*
gtk_widget_override_background_color(window,
GTK_STATE_FLAG_NORMAL,// | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_FOCUSED,
&color);
gtk_widget_override_color(window,
GTK_STATE_FLAG_NORMAL,// | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_FOCUSED,
&color);
*/
#endif
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(clicked), NULL);
GtkWidget* fixed_container = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(window), fixed_container);
GtkWidget* button = gtk_button_new_with_label("button1");
gtk_widget_set_size_request(button, 100, 100);
gtk_container_add(GTK_CONTAINER(fixed_container), button);
screen_changed(window, NULL, NULL);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
gboolean supports_alpha = FALSE;
static void screen_changed(GtkWidget *widget, GdkScreen *old_screen, gpointer userdata)
{
/* To check if the display supports alpha channels, get the colormap */
# ifdef USE_GTK_VERSION_2_0
GdkScreen *screen = gtk_widget_get_screen(widget);
GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
if (!colormap)
{
printf("Your screen does not support alpha channels!\n");
colormap = gdk_screen_get_rgb_colormap(screen);
supports_alpha = FALSE;
}
else
{
printf("Your screen supports alpha channels!\n");
supports_alpha = TRUE;
}
gtk_widget_set_colormap(widget, colormap);
#endif
/*
gtk_widget_override_background_color(widget,
GTK_STATE_FLAG_NORMAL,// | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_FOCUSED,
&color);
gtk_widget_override_color(widget,
GTK_STATE_FLAG_NORMAL,// | GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_FOCUSED,
&color);
*/
}
static gboolean expose(GtkWidget *widget, GdkEventExpose *event, gpointer userdata)
{
return FALSE;
# if USE_GTK_VERSION_3_0
cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
# elif USE_GTK_VERSION_2_0
cairo_t *cr = gdk_cairo_create(widget->window);
# endif
if (TRUE == supports_alpha)
cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.3); /* transparent */
else
cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); /* opaque white */
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
cairo_destroy(cr);
return FALSE;
}
static void clicked(GtkWindow *win, GdkEventButton *event, gpointer user_data)
{
/* toggle window manager frames */
gtk_window_set_decorated(win, !gtk_window_get_decorated(win));
}