Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
ab74a7c516 | |||
1fa86b3b03 | |||
dbade0e4e6 | |||
356d7621ae | |||
896beaa4fd | |||
7b476ebc49 |
10
Makefile
10
Makefile
@@ -290,11 +290,11 @@ install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
|
|||||||
@echo Remove temporary files *.bck
|
@echo Remove temporary files *.bck
|
||||||
@rm -f `find . -name "*.bck"`
|
@rm -f `find . -name "*.bck"`
|
||||||
|
|
||||||
count:
|
count:
|
||||||
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
|
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
|
||||||
|
|
||||||
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
|
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
|
||||||
@echo $(CADRE_HAUT_BAS)
|
@echo $(CADRE_HAUT_BAS)
|
||||||
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
||||||
@echo $(CADRE_HAUT_BAS)
|
@echo $(CADRE_HAUT_BAS)
|
||||||
@echo $(F_ROUGE)"
|
@echo $(F_ROUGE)"
|
||||||
|
@@ -62,8 +62,8 @@ BufferManager::~BufferManager(void)
|
|||||||
EDN_INFO("~BufferManager::RemoveAll();");
|
EDN_INFO("~BufferManager::RemoveAll();");
|
||||||
RemoveAll();
|
RemoveAll();
|
||||||
// clear The list of Buffer
|
// clear The list of Buffer
|
||||||
EDN_INFO("~BufferManager::listBuffer.clear();");
|
EDN_INFO("~BufferManager::listBuffer.Clear();");
|
||||||
listBuffer.clear();
|
listBuffer.Clear();
|
||||||
EDN_INFO("~BufferManager::delete(BufferNotExiste);");
|
EDN_INFO("~BufferManager::delete(BufferNotExiste);");
|
||||||
delete(BufferNotExiste);
|
delete(BufferNotExiste);
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,9 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
{
|
{
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
|
case EDN_MSG__BUFFER_CHANGE_CURRENT:
|
||||||
|
m_idSelected = dataID;
|
||||||
|
break;
|
||||||
case EDN_MSG__NEW:
|
case EDN_MSG__NEW:
|
||||||
{
|
{
|
||||||
int32_t newOne = Create();
|
int32_t newOne = Create();
|
||||||
@@ -81,6 +84,49 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EDN_MSG__BUFF_ID_CLOSE:
|
||||||
|
// Check buffer existence
|
||||||
|
if(true == Exist(dataID)) {
|
||||||
|
// Get the new display buffer
|
||||||
|
if (m_idSelected == dataID) {
|
||||||
|
// Try previous buffer
|
||||||
|
int32_t destBuffer = -1;
|
||||||
|
for(int32_t ii=dataID-1; ii >= 0; ii--) {
|
||||||
|
if (true == Exist(ii) ) {
|
||||||
|
destBuffer = ii;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
|
||||||
|
// try next buffer
|
||||||
|
if (-1 == destBuffer) {
|
||||||
|
for(int32_t ii=dataID+1; ii < listBuffer.Size(); ii++) {
|
||||||
|
if (true == Exist(ii) ) {
|
||||||
|
destBuffer = ii;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
|
||||||
|
// set it to the currect display
|
||||||
|
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, destBuffer);
|
||||||
|
}
|
||||||
|
//EDN_DEBUG("Remove : " << dataID);
|
||||||
|
// Remove requested buffer
|
||||||
|
Remove(dataID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EDN_MSG__BUFF_ID_SAVE:
|
||||||
|
// Check buffer existence
|
||||||
|
if(true == Exist(dataID)) {
|
||||||
|
// If no name ==> request a Gui display ...
|
||||||
|
if (Get(dataID)->HaveName() == false) {
|
||||||
|
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, dataID);
|
||||||
|
} else {
|
||||||
|
Get(dataID)->Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +147,7 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
void BufferManager::RemoveAll(void)
|
void BufferManager::RemoveAll(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<(int32_t)listBuffer.size(); i++) {
|
for (i=0; i<listBuffer.Size(); i++) {
|
||||||
Remove(i);
|
Remove(i);
|
||||||
}
|
}
|
||||||
SendMessage(EDN_MSG__BUFFER_REMOVE_ALL);
|
SendMessage(EDN_MSG__BUFFER_REMOVE_ALL);
|
||||||
@@ -122,8 +168,8 @@ int32_t BufferManager::Create(void)
|
|||||||
// allocate a new Buffer
|
// allocate a new Buffer
|
||||||
Buffer *myBuffer = new BufferText();
|
Buffer *myBuffer = new BufferText();
|
||||||
// Add at the list of element
|
// Add at the list of element
|
||||||
listBuffer.push_back(myBuffer);
|
listBuffer.PushBack(myBuffer);
|
||||||
int32_t basicID = (int32_t)listBuffer.size() - 1;
|
int32_t basicID = listBuffer.Size() - 1;
|
||||||
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
|
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
|
||||||
return basicID;
|
return basicID;
|
||||||
}
|
}
|
||||||
@@ -144,8 +190,8 @@ int32_t BufferManager::Open(Edn::String &filename)
|
|||||||
// allocate a new Buffer
|
// allocate a new Buffer
|
||||||
Buffer *myBuffer = new BufferText(filename);
|
Buffer *myBuffer = new BufferText(filename);
|
||||||
// Add at the list of element
|
// Add at the list of element
|
||||||
listBuffer.push_back(myBuffer);
|
listBuffer.PushBack(myBuffer);
|
||||||
int32_t basicID = (int32_t)listBuffer.size() - 1;
|
int32_t basicID = listBuffer.Size() - 1;
|
||||||
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
|
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
|
||||||
return basicID;
|
return basicID;
|
||||||
}
|
}
|
||||||
@@ -159,7 +205,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
|
|||||||
return BufferNotExiste;
|
return BufferNotExiste;
|
||||||
}
|
}
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
if (BufferID < (int32_t)listBuffer.size()) {
|
if (BufferID < listBuffer.Size()) {
|
||||||
// check if the buffer already existed
|
// check if the buffer already existed
|
||||||
if (NULL != listBuffer[BufferID]) {
|
if (NULL != listBuffer[BufferID]) {
|
||||||
return listBuffer[BufferID];
|
return listBuffer[BufferID];
|
||||||
@@ -167,7 +213,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
|
|||||||
EDN_ERROR("non existing Buffer " << BufferID);
|
EDN_ERROR("non existing Buffer " << BufferID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EDN_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
|
EDN_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
|
||||||
}
|
}
|
||||||
return BufferNotExiste;
|
return BufferNotExiste;
|
||||||
}
|
}
|
||||||
@@ -179,7 +225,7 @@ bool BufferManager::Exist(int32_t BufferID)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
if (BufferID < (int32_t)listBuffer.size()) {
|
if (BufferID < listBuffer.Size()) {
|
||||||
// check if the buffer already existed
|
// check if the buffer already existed
|
||||||
if (NULL != listBuffer[BufferID]) {
|
if (NULL != listBuffer[BufferID]) {
|
||||||
return true;
|
return true;
|
||||||
@@ -193,7 +239,7 @@ int32_t BufferManager::GetId(Edn::String &filename)
|
|||||||
{
|
{
|
||||||
int32_t iii;
|
int32_t iii;
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
for (iii=0; iii < (int32_t)listBuffer.size(); iii++) {
|
for (iii=0; iii < listBuffer.Size(); iii++) {
|
||||||
// check if the buffer already existed
|
// check if the buffer already existed
|
||||||
if (NULL != listBuffer[iii]) {
|
if (NULL != listBuffer[iii]) {
|
||||||
if ( listBuffer[iii]->GetName() == filename) {
|
if ( listBuffer[iii]->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
|
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||||
uint32_t BufferManager::Size(void)
|
uint32_t BufferManager::Size(void)
|
||||||
{
|
{
|
||||||
return listBuffer.size();
|
return listBuffer.Size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -234,7 +280,7 @@ bool BufferManager::Remove(int32_t BufferID)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
if (BufferID < (int32_t)listBuffer.size()) {
|
if (BufferID < listBuffer.Size()) {
|
||||||
// check if the buffer already existed
|
// check if the buffer already existed
|
||||||
if (NULL != listBuffer[BufferID]) {
|
if (NULL != listBuffer[BufferID]) {
|
||||||
// TODO : Check if it saved...
|
// TODO : Check if it saved...
|
||||||
@@ -253,7 +299,7 @@ bool BufferManager::Remove(int32_t BufferID)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EDN_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
|
EDN_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,7 +315,7 @@ bool BufferManager::Remove(int32_t BufferID)
|
|||||||
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
|
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<(int32_t)listBuffer.size(); i++) {
|
for (i=0; i<listBuffer.Size(); i++) {
|
||||||
if (NULL != listBuffer[i]) {
|
if (NULL != listBuffer[i]) {
|
||||||
iEmeElement--;
|
iEmeElement--;
|
||||||
// find the element :
|
// find the element :
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
#include "BufferEmpty.h"
|
#include "BufferEmpty.h"
|
||||||
#include "Singleton.h"
|
#include "Singleton.h"
|
||||||
#include "MsgBroadcast.h"
|
#include "MsgBroadcast.h"
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
|
class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
|
||||||
{
|
{
|
||||||
@@ -65,7 +63,7 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<Buffer*> listBuffer; //!< element List of the char Elements
|
Edn::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
|
||||||
|
|
||||||
void RemoveAll(void); //!< remove all buffer
|
void RemoveAll(void); //!< remove all buffer
|
||||||
int32_t m_idSelected;
|
int32_t m_idSelected;
|
||||||
|
@@ -188,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)
|
gboolean BufferView::CB_displayInit( GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
BufferView * self = reinterpret_cast<BufferView*>(data);
|
BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
@@ -245,12 +245,76 @@ gint BufferView::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpoint
|
|||||||
//BufferView * self = reinterpret_cast<BufferView*>(data);
|
//BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
|
|
||||||
if(event->type == GDK_KEY_PRESS) {
|
if(event->type == GDK_KEY_PRESS) {
|
||||||
gtk_widget_queue_draw( widget );
|
gtk_widget_queue_draw( widget );
|
||||||
}
|
}
|
||||||
return true;
|
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)
|
gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
||||||
{
|
{
|
||||||
BufferView * self = reinterpret_cast<BufferView*>(data);
|
BufferView * self = reinterpret_cast<BufferView*>(data);
|
||||||
@@ -294,16 +358,7 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g
|
|||||||
uint32_t fontHeight = Display::GetFontHeight();
|
uint32_t fontHeight = Display::GetFontHeight();
|
||||||
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
|
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
|
||||||
if ( 0 <= selectBuf) {
|
if ( 0 <= selectBuf) {
|
||||||
// TODO : Find a simple methode
|
self->ViewPopupMenu(widget, event, selectBuf);
|
||||||
int32_t windowsPosX, windowsPosY;
|
|
||||||
gtk_window_get_position(GTK_WINDOW(gtk_widget_get_toplevel(widget)), &windowsPosX, &windowsPosY);
|
|
||||||
//EDN_INFO("windowsPosX=" << windowsPosX << " windowsPosY=" << windowsPosY);
|
|
||||||
int32_t widgetPosX, widgetPosY;
|
|
||||||
gtk_widget_translate_coordinates(widget, gtk_widget_get_toplevel(widget), 0, 0, &widgetPosX, &widgetPosY);
|
|
||||||
//EDN_INFO("widgetPosX=" << widgetPosX << " widgetPosY=" << widgetPosY);
|
|
||||||
self->m_menuContext->Show(self->m_shawableAreaX+2+widgetPosX+windowsPosX, ((int32_t)(event->y / fontHeight)*fontHeight)+(fontHeight/2)+widgetPosY+windowsPosY, false);
|
|
||||||
} else {
|
|
||||||
self->m_menuContext->Hide();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -55,9 +55,14 @@ class BufferView : public MsgBroadcast
|
|||||||
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
|
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
|
||||||
static void CB_EventOnBufferManager(gpointer data);
|
static void CB_EventOnBufferManager(gpointer data);
|
||||||
|
|
||||||
|
static void OnPopupEventShow(GtkWidget *menuitem, gpointer data);
|
||||||
|
static void OnPopupEventClose(GtkWidget *menuitem, gpointer data);
|
||||||
|
static void OnPopupEventSave(GtkWidget *menuitem, gpointer data);
|
||||||
|
static void OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID);
|
||||||
// main windows widget :
|
// main windows widget :
|
||||||
GtkWidget * m_widget;
|
GtkWidget * m_widget;
|
||||||
// r<>cup<75>ration des proprieter g<>n<EFBFBD>ral...
|
// r<>cup<75>ration des proprieter g<>n<EFBFBD>ral...
|
||||||
@@ -67,6 +72,7 @@ class BufferView : public MsgBroadcast
|
|||||||
int32_t m_shawableAreaX;
|
int32_t m_shawableAreaX;
|
||||||
int32_t m_shawableAreaY;
|
int32_t m_shawableAreaY;
|
||||||
int32_t m_selectedID;
|
int32_t m_selectedID;
|
||||||
|
int32_t m_contectMenuSelectID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -105,11 +105,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
|
|||||||
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
|
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
|
||||||
break;
|
break;
|
||||||
case EDN_MSG__CURRENT_SAVE:
|
case EDN_MSG__CURRENT_SAVE:
|
||||||
if (m_bufferManager->Get(m_bufferID)->HaveName() == false) {
|
SendMessage(EDN_MSG__BUFF_ID_SAVE, m_bufferID);
|
||||||
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
|
|
||||||
} else {
|
|
||||||
m_bufferManager->Get(m_bufferID)->Save();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case EDN_MSG__CURRENT_SAVE_AS:
|
case EDN_MSG__CURRENT_SAVE_AS:
|
||||||
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
|
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
|
||||||
@@ -165,9 +161,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
|
|||||||
case EDN_MSG__CURRENT_REPLACE_ALL:
|
case EDN_MSG__CURRENT_REPLACE_ALL:
|
||||||
break;
|
break;
|
||||||
case EDN_MSG__CURRENT_CLOSE:
|
case EDN_MSG__CURRENT_CLOSE:
|
||||||
m_bufferManager->Remove(m_bufferID);
|
SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
|
||||||
m_bufferID = -1;
|
|
||||||
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
|
|
||||||
break;
|
break;
|
||||||
case EDN_MSG__CURRENT_UNDO:
|
case EDN_MSG__CURRENT_UNDO:
|
||||||
m_bufferManager->Get(m_bufferID)->Undo();
|
m_bufferManager->Get(m_bufferID)->Undo();
|
||||||
|
@@ -224,6 +224,8 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
|
|||||||
tmp->AddSeparator();
|
tmp->AddSeparator();
|
||||||
tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true);
|
tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true);
|
||||||
tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true);
|
tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true);
|
||||||
|
tmp->AddSeparator();
|
||||||
|
tmp->AddGen("Goto Line number ...", "ctrl+l", EDN_MSG__GUI_SHOW_GOTO_LINE, true);
|
||||||
// tmp->AddSeparator();
|
// tmp->AddSeparator();
|
||||||
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true);
|
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true);
|
||||||
m_listMenu.PushBack(tmp);
|
m_listMenu.PushBack(tmp);
|
||||||
|
@@ -203,6 +203,44 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EDN_MSG__GUI_SHOW_GOTO_LINE:
|
||||||
|
{
|
||||||
|
// dlg to confirm the quit event :
|
||||||
|
GtkWidget *myDialog = gtk_dialog_new_with_buttons("Goto Line",
|
||||||
|
GTK_WINDOW(m_mainWindow->GetWidget()),
|
||||||
|
GTK_DIALOG_MODAL,
|
||||||
|
"Jump", GTK_RESPONSE_YES,
|
||||||
|
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
|
||||||
|
NULL);
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -68,39 +68,38 @@ void HighlightManager::loadLanguages(void)
|
|||||||
{
|
{
|
||||||
Edn::String homedir;
|
Edn::String homedir;
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
homedir = getenv("HOME");
|
homedir = "/usr/share/edn/";
|
||||||
homedir += "/.edn/";
|
|
||||||
#else
|
#else
|
||||||
homedir = "./";
|
homedir = "./data/";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Edn::String xmlFilename = homedir;
|
Edn::String xmlFilename = homedir;
|
||||||
xmlFilename += "data/lang_c.xml";
|
xmlFilename += "lang_c.xml";
|
||||||
Highlight *myHightline = new Highlight(xmlFilename);
|
Highlight *myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.push_back(myHightline);
|
listHighlight.push_back(myHightline);
|
||||||
|
|
||||||
xmlFilename = homedir;
|
xmlFilename = homedir;
|
||||||
xmlFilename += "data/lang_boo.xml";
|
xmlFilename += "lang_boo.xml";
|
||||||
myHightline = new Highlight(xmlFilename);
|
myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.push_back(myHightline);
|
listHighlight.push_back(myHightline);
|
||||||
|
|
||||||
xmlFilename = homedir;
|
xmlFilename = homedir;
|
||||||
xmlFilename += "data/lang_Makefile.xml";
|
xmlFilename += "lang_Makefile.xml";
|
||||||
myHightline = new Highlight(xmlFilename);
|
myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.push_back(myHightline);
|
listHighlight.push_back(myHightline);
|
||||||
|
|
||||||
xmlFilename = homedir;
|
xmlFilename = homedir;
|
||||||
xmlFilename += "data/lang_asm.xml";
|
xmlFilename += "lang_asm.xml";
|
||||||
myHightline = new Highlight(xmlFilename);
|
myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.push_back(myHightline);
|
listHighlight.push_back(myHightline);
|
||||||
|
|
||||||
xmlFilename = homedir;
|
xmlFilename = homedir;
|
||||||
xmlFilename += "data/lang_xml.xml";
|
xmlFilename += "lang_xml.xml";
|
||||||
myHightline = new Highlight(xmlFilename);
|
myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.push_back(myHightline);
|
listHighlight.push_back(myHightline);
|
||||||
|
|
||||||
xmlFilename = homedir;
|
xmlFilename = homedir;
|
||||||
xmlFilename += "data/lang_php.xml";
|
xmlFilename += "lang_php.xml";
|
||||||
myHightline = new Highlight(xmlFilename);
|
myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.push_back(myHightline);
|
listHighlight.push_back(myHightline);
|
||||||
|
|
||||||
|
@@ -99,10 +99,8 @@ void CTagsManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
{
|
{
|
||||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL,
|
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL,
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
GTK_STOCK_CANCEL, // button text
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_RESPONSE_CANCEL, // response id
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||||
GTK_STOCK_OPEN, // button text
|
|
||||||
GTK_RESPONSE_ACCEPT, // response id
|
|
||||||
NULL); // end button/response list
|
NULL); // end button/response list
|
||||||
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
@@ -167,9 +165,108 @@ 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)
|
void CTagsManager::JumpTo(void)
|
||||||
{
|
{
|
||||||
|
MultipleJump();
|
||||||
if (NULL != m_ctagFile) {
|
if (NULL != m_ctagFile) {
|
||||||
Edn::VectorType<int8_t> data;
|
Edn::VectorType<int8_t> data;
|
||||||
// get the middle button of the clipboard ==> represent the current selection ...
|
// get the middle button of the clipboard ==> represent the current selection ...
|
||||||
|
@@ -47,6 +47,7 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
|
|||||||
private:
|
private:
|
||||||
int32_t m_currentSelectedID;
|
int32_t m_currentSelectedID;
|
||||||
void LoadTagFile(void);
|
void LoadTagFile(void);
|
||||||
|
void MultipleJump(void);
|
||||||
void JumpTo(void);
|
void JumpTo(void);
|
||||||
void PrintTag(const tagEntry *entry);
|
void PrintTag(const tagEntry *entry);
|
||||||
Edn::String GetFolder(Edn::String &inputString);
|
Edn::String GetFolder(Edn::String &inputString);
|
||||||
|
@@ -80,13 +80,13 @@ int main (int argc, char *argv[])
|
|||||||
ColorizeManager *myColorManager = NULL;
|
ColorizeManager *myColorManager = NULL;
|
||||||
myColorManager = ColorizeManager::getInstance();
|
myColorManager = ColorizeManager::getInstance();
|
||||||
Edn::String homedir;
|
Edn::String homedir;
|
||||||
|
//homedir = getenv("HOME");
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
homedir = getenv("HOME");
|
homedir = "/usr/share/edn/";
|
||||||
homedir += "/.edn/";
|
|
||||||
#else
|
#else
|
||||||
homedir = "./";
|
homedir = "./data/";
|
||||||
#endif
|
#endif
|
||||||
homedir += "data/color_black.xml";
|
homedir += "color_black.xml";
|
||||||
myColorManager->LoadFile( homedir.c_str() );
|
myColorManager->LoadFile( homedir.c_str() );
|
||||||
myColorManager->DisplayListOfColor();
|
myColorManager->DisplayListOfColor();
|
||||||
|
|
||||||
@@ -117,6 +117,7 @@ int main (int argc, char *argv[])
|
|||||||
myfile+="/";
|
myfile+="/";
|
||||||
}
|
}
|
||||||
myfile+=(char *)argv[i];
|
myfile+=(char *)argv[i];
|
||||||
|
|
||||||
if (false == myBufferManager->Exist(myfile) ) {
|
if (false == myBufferManager->Exist(myfile) ) {
|
||||||
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
||||||
if (1==i) {
|
if (1==i) {
|
||||||
|
@@ -28,12 +28,15 @@
|
|||||||
#include "tools_globals.h"
|
#include "tools_globals.h"
|
||||||
#include "Edn.h"
|
#include "Edn.h"
|
||||||
|
|
||||||
|
#define MAX_FILE_NAME (10240)
|
||||||
|
|
||||||
Edn::File::File(Edn::String &filename, int32_t LineNumber)
|
Edn::File::File(Edn::String &filename, int32_t LineNumber)
|
||||||
{
|
{
|
||||||
m_lineNumberOpen = 0;
|
m_lineNumberOpen = 0;
|
||||||
SetCompleateName(filename);
|
SetCompleateName(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
|
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
|
||||||
{
|
{
|
||||||
Edn::String tmpString = folder;
|
Edn::String tmpString = folder;
|
||||||
@@ -105,7 +108,17 @@ Edn::String Edn::File::GetCompleateName(void)
|
|||||||
|
|
||||||
void Edn::File::SetCompleateName(Edn::String &newFilename)
|
void Edn::File::SetCompleateName(Edn::String &newFilename)
|
||||||
{
|
{
|
||||||
|
char buf[MAX_FILE_NAME];
|
||||||
|
memset(buf, 0, MAX_FILE_NAME);
|
||||||
|
char * ok;
|
||||||
|
// 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)
|
int32_t Edn::File::GetLineNumber(void)
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
# action a faire (ordonner) :
|
# action a faire (ordonner) :
|
||||||
- sys : la methode de close est mauvaise...
|
- sys : la methode de close est mauvaise...
|
||||||
- gui : Goto line (need only the gui)
|
|
||||||
- ctags : Back simple et multiple
|
- ctags : Back simple et multiple
|
||||||
- ctags : Multiple files
|
- ctags : Multiple files
|
||||||
- sys : search complet, replace complet
|
- sys : search complet, replace complet
|
||||||
@@ -31,7 +30,6 @@
|
|||||||
* matlab
|
* matlab
|
||||||
* java script
|
* java script
|
||||||
* SQL
|
* SQL
|
||||||
* Assembleur
|
|
||||||
- project : list of current files open
|
- project : list of current files open
|
||||||
- gui : demander l'enregistrement avant de fermer (quand c'est n<>cessaire)
|
- 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 ...
|
- gui : demande de cr<63>ation de nouveaux fichier ou quiter l'editeur ...
|
||||||
|
@@ -9,9 +9,23 @@
|
|||||||
<end>\n</end>
|
<end>\n</end>
|
||||||
<EscapeChar>\</EscapeChar>
|
<EscapeChar>\</EscapeChar>
|
||||||
</rule>
|
</rule>
|
||||||
|
<rule name="doubleQuteText">
|
||||||
|
<color>doubleQuoteText</color>
|
||||||
|
<start>"</start>
|
||||||
|
<end>"</end>
|
||||||
|
<EscapeChar>\</EscapeChar>
|
||||||
|
</rule>
|
||||||
|
<rule name="simpleQuteText">
|
||||||
|
<color>doubleQuoteText</color>
|
||||||
|
<start>'</start>
|
||||||
|
<end>'</end>
|
||||||
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
|
<rule name="my keyword">
|
||||||
|
<color>keyword</color>
|
||||||
|
<start>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</start>
|
||||||
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
|
||||||
|
@@ -21,7 +21,6 @@ You can NOT:
|
|||||||
- Add malware in the Sources.
|
- Add malware in the Sources.
|
||||||
- Do something bad with the sources.
|
- Do something bad with the sources.
|
||||||
- Use it to travel in the space with a toaster.
|
- Use it to travel in the space with a toaster.
|
||||||
- Write Java sources code with this software.
|
|
||||||
|
|
||||||
I reserve the right to change this licence. If it change the version of the copy you have keep its own license
|
I reserve the right to change this license. If it change the version of the copy you have keep its own license
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user