remove the last singleton to create the basic namespace

This commit is contained in:
Edouard Dupin 2012-02-20 20:30:26 +01:00
parent a943ddd4f7
commit 9f2718f97a
17 changed files with 226 additions and 302 deletions

View File

@ -28,9 +28,50 @@
#include <tools_globals.h>
#include <BufferManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/WidgetManager.h>
#undef __class__
#define __class__ "BufferManager"
#define __class__ "classBufferManager"
class classBufferManager: public ewol::Widget
{
public:
// Constructeur
classBufferManager(void);
~classBufferManager(void);
public:
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
private:
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
// open curent filename
int32_t Open(etk::File &myFile);
bool Remove(int32_t BufferID);
public:
int32_t GetSelected(void) { return m_idSelected;};
//void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
private:
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
};
// Constructeur
/**
@ -41,7 +82,7 @@
* @return ---
*
*/
BufferManager::BufferManager(void)
classBufferManager::classBufferManager(void)
{
// nothing to do ...
BufferNotExiste = new BufferEmpty();
@ -52,14 +93,6 @@ BufferManager::BufferManager(void)
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiSave);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewSelectedId);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
/*
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerCloseAll);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerClose);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSave);
*/
}
/**
@ -70,20 +103,20 @@ BufferManager::BufferManager(void)
* @return ---
*
*/
BufferManager::~BufferManager(void)
classBufferManager::~classBufferManager(void)
{
//clean All Buffer
EDN_INFO("~BufferManager::RemoveAll();");
EDN_INFO("~classBufferManager::RemoveAll();");
RemoveAll();
// clear The list of Buffer
EDN_INFO("~BufferManager::listBuffer.Clear();");
EDN_INFO("~classBufferManager::listBuffer.Clear();");
listBuffer.Clear();
EDN_INFO("~BufferManager::delete(BufferNotExiste);");
EDN_INFO("~classBufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste);
}
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
bool classBufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
{
if (generateEventId == ednMsgBufferId) {
// select a new buffer ID :
@ -243,7 +276,7 @@ bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateE
* @return ---
*
*/
void BufferManager::RemoveAll(void)
void classBufferManager::RemoveAll(void)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
@ -262,7 +295,7 @@ void BufferManager::RemoveAll(void)
* @return The ID of the curent buffer where the file is loaded
*
*/
int32_t BufferManager::Create(void)
int32_t classBufferManager::Create(void)
{
// allocate a new Buffer
Buffer *myBuffer = new BufferText();
@ -283,7 +316,7 @@ int32_t BufferManager::Create(void)
* @todo : check if this file is not curently open and return the old ID
*
*/
int32_t BufferManager::Open(etk::File &myFile)
int32_t classBufferManager::Open(etk::File &myFile)
{
// TODO : Check here if the file is already open ==> and display it if needed
// allocate a new Buffer
@ -295,7 +328,7 @@ int32_t BufferManager::Open(etk::File &myFile)
Buffer * BufferManager::Get(int32_t BufferID)
Buffer * classBufferManager::Get(int32_t BufferID)
{
// possible special case : -1;
if (-1 >= BufferID) {
@ -316,7 +349,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
}
bool BufferManager::Exist(int32_t BufferID)
bool classBufferManager::Exist(int32_t BufferID)
{
if (-1 >= BufferID) {
return false;
@ -332,7 +365,7 @@ bool BufferManager::Exist(int32_t BufferID)
}
bool BufferManager::Exist(etk::File &myFile )
bool classBufferManager::Exist(etk::File &myFile )
{
if (-1 == GetId(myFile)) {
return false;
@ -341,7 +374,7 @@ bool BufferManager::Exist(etk::File &myFile )
}
int32_t BufferManager::GetId(etk::File &myFile)
int32_t classBufferManager::GetId(etk::File &myFile)
{
int32_t iii;
// check if the Buffer existed
@ -358,13 +391,13 @@ int32_t BufferManager::GetId(etk::File &myFile)
// 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 classBufferManager::Size(void)
{
return listBuffer.Size();
}
// nb of opens file Now ...
uint32_t BufferManager::SizeOpen(void)
uint32_t classBufferManager::SizeOpen(void)
{
uint32_t jjj = 0;
// check if the Buffer existed
@ -385,7 +418,7 @@ uint32_t BufferManager::SizeOpen(void)
* @return ---
*
*/
bool BufferManager::Remove(int32_t BufferID)
bool classBufferManager::Remove(int32_t BufferID)
{
if (-1 >= BufferID) {
return false;
@ -423,7 +456,7 @@ bool BufferManager::Remove(int32_t BufferID)
* @return ---
*
*/
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
@ -439,7 +472,105 @@ int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace part :
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static classBufferManager * localManager = NULL;
void BufferManager::Init(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> already exist, just unlink the previous ...");
localManager = NULL;
}
localManager = new classBufferManager();
if (NULL == localManager) {
EWOL_CRITICAL("Allocation of classBufferManager not done ...");
}
}
void BufferManager::UnInit(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return;
}
ewol::widgetManager::MarkWidgetToBeRemoved(localManager);
localManager = NULL;
}
int32_t BufferManager::GetSelected(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return -1;
}
return localManager->GetSelected();
}
Buffer * BufferManager::Get(int32_t BufferID)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return NULL;
}
return localManager->Get(BufferID);
}
bool BufferManager::Exist(int32_t BufferID)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(BufferID);
}
bool BufferManager::Exist(etk::File &myFile)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(myFile);
}
int32_t BufferManager::GetId(etk::File &myFile)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return -1;
}
return localManager->GetId(myFile);
}
uint32_t BufferManager::Size(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return 0;
}
return localManager->Size();
}
uint32_t BufferManager::SizeOpen(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return 0;
}
return localManager->SizeOpen();
}
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return -1;
}
return localManager->WitchBuffer(iEmeElement);
}

View File

@ -29,48 +29,22 @@
#include <Buffer.h>
#include <BufferText.h>
#include <BufferEmpty.h>
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include <ewol/Widget.h>
class BufferManager: public etk::Singleton<BufferManager>, public ewol::Widget
namespace BufferManager
{
friend class etk::Singleton<BufferManager>;
// specific for sigleton system...
private:
// Constructeur
BufferManager(void);
~BufferManager(void);
public:
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
private:
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
// open curent filename
int32_t Open(etk::File &myFile);
bool Remove(int32_t BufferID);
public:
int32_t GetSelected(void) { return m_idSelected;};
//void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
private:
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
void Init(void);
void UnInit(void);
int32_t GetSelected(void);
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
};
#endif

View File

@ -26,7 +26,6 @@
#ifndef __COLORIZE_MANAGER_H__
#define __COLORIZE_MANAGER_H__
#include <etk/Singleton.h>
#include <Colorize.h>
#include <MsgBroadcast.h>
#include <ewol/Widget.h>

View File

@ -37,8 +37,6 @@
BufferView::BufferView(void)
{
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
SetCanHaveFocus(true);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferListChange);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferState);
@ -88,10 +86,7 @@ bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, c
uint32_t BufferView::GetNuberOfRaw(void)
{
if (NULL != m_bufferManager) {
return m_bufferManager->SizeOpen();
}
return 0;
return BufferManager::SizeOpen();
}
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg)
@ -102,10 +97,10 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
basicColor_te selectBG = COLOR_LIST_BG_1;
// transforme the ID in the real value ...
int32_t realID = m_bufferManager->WitchBuffer(raw+1);
if (m_bufferManager->Exist(realID)) {
isModify = m_bufferManager->Get(realID)->IsModify();
name = m_bufferManager->Get(realID)->GetFileName();
int32_t realID = BufferManager::WitchBuffer(raw+1);
if (BufferManager::Exist(realID)) {
isModify = BufferManager::Get(realID)->IsModify();
name = BufferManager::Get(realID)->GetFileName();
char *tmpModify = (char*)" ";
if (true == isModify) {
tmpModify = (char*)"M";
@ -142,7 +137,7 @@ bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent,
{
if (1 == IdInput && typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
EDN_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
int32_t selectBuf = BufferManager::WitchBuffer(raw+1);
if ( 0 <= selectBuf) {
m_selectedID = raw;
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);

View File

@ -50,8 +50,6 @@ class BufferView : public ewol::List
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg);
virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y);
private:
// récupération des proprieter général...
BufferManager * m_bufferManager;
int32_t m_selectedID;
};

View File

@ -55,9 +55,6 @@ CodeView::CodeView(void)
m_bufferID = -1;
m_buttunOneSelected = false;
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_textColorFg.red = 0.0;
m_textColorFg.green = 0.0;
m_textColorFg.blue = 0.0;
@ -87,7 +84,7 @@ void CodeView::CalculateMaxSize(void)
{
m_maxSize.x = 2048;
int32_t letterHeight = ewol::GetHeight(m_fontNormal);
m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight;
m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight;
}
@ -123,7 +120,7 @@ void CodeView::OnRegenerateDisplay(void)
// generate the objects :
m_bufferManager->Get(m_bufferID)->Display(m_OObjectTextNormal[m_currentCreateId],
BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal[m_currentCreateId],
m_OObjectTextBold[m_currentCreateId],
m_OObjectTextItalic[m_currentCreateId],
m_OObjectTextBoldItalic[m_currentCreateId],
@ -144,7 +141,7 @@ bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
{
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
m_bufferManager->Get(m_bufferID)->AddChar(unicodeData);
BufferManager::Get(m_bufferID)->AddChar(unicodeData);
MarkToReedraw();
}
return true;
@ -154,7 +151,7 @@ bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent)
{
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
m_bufferManager->Get(m_bufferID)->cursorMove(moveTypeEvent);
BufferManager::Get(m_bufferID)->cursorMove(moveTypeEvent);
MarkToReedraw();
}
return true;
@ -175,11 +172,11 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
m_buttunOneSelected = true;
ewol::widgetManager::FocusKeep(this);
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
BufferManager::Get(m_bufferID)->MouseEvent(x, y);
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
m_buttunOneSelected = false;
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
BufferManager::Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
MarkToReedraw();
} else
#endif
@ -187,18 +184,18 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
#ifdef __MODE__Touch
ewol::widgetManager::FocusKeep(this);
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
BufferManager::Get(m_bufferID)->MouseEvent(x, y);
MarkToReedraw();
#else
// nothing to do ...
#endif
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
BufferManager::Get(m_bufferID)->MouseEventDouble();
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> Triple Clicked");
m_bufferManager->Get(m_bufferID)->MouseEventTriple();
BufferManager::Get(m_bufferID)->MouseEventTriple();
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
if (true == m_buttunOneSelected) {
@ -212,14 +209,14 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
yyy = 0;
}
//EDN_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
m_bufferManager->Get(m_bufferID)->MouseSelectFromCursorTo(xxx, yyy);
BufferManager::Get(m_bufferID)->MouseSelectFromCursorTo(xxx, yyy);
MarkToReedraw();
}
}
} else if (2 == IdInput) {
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
m_bufferManager->Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
BufferManager::Get(m_bufferID)->MouseEvent(x, y);
BufferManager::Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
MarkToReedraw();
ewol::widgetManager::FocusKeep(this);
}
@ -240,7 +237,7 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
sscanf(data, "%d", &bufferID);
EDN_INFO("Select a new Buffer ... " << bufferID);
m_bufferID = bufferID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
BufferManager::Get(m_bufferID)->ForceReDraw(true);
// TODO : need to update the state of the file and the filenames ...
}
// old
@ -250,7 +247,7 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
sscanf(data, "%d", &bufferID);
EDN_INFO("Select a new Buffer ... " << bufferID);
m_bufferID = bufferID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
BufferManager::Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferChangeCurrent, (char*)data);
@ -305,7 +302,7 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
BufferManager::Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
@ -316,51 +313,51 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
break;
case EDN_MSG__CURRENT_REMOVE_LINE:
m_bufferManager->Get(m_bufferID)->RemoveLine();
BufferManager::Get(m_bufferID)->RemoveLine();
break;
case EDN_MSG__CURRENT_SELECT_ALL:
m_bufferManager->Get(m_bufferID)->SelectAll();
BufferManager::Get(m_bufferID)->SelectAll();
break;
case EDN_MSG__CURRENT_UN_SELECT:
m_bufferManager->Get(m_bufferID)->SelectNone();
BufferManager::Get(m_bufferID)->SelectNone();
break;
case EDN_MSG__CURRENT_COPY:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Copy(dataID);
BufferManager::Get(m_bufferID)->Copy(dataID);
break;
case EDN_MSG__CURRENT_CUT:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Cut(dataID);
BufferManager::Get(m_bufferID)->Cut(dataID);
break;
case EDN_MSG__CURRENT_PASTE:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Paste(dataID);
BufferManager::Get(m_bufferID)->Paste(dataID);
break;
case EDN_MSG__CURRENT_FIND_PREVIOUS:
{
etk::UString myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
BufferManager::Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_FIND_NEXT:
{
etk::UString myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
BufferManager::Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_REPLACE:
{
etk::UString myDataString;
SearchData::GetReplace(myDataString);
m_bufferManager->Get(m_bufferID)->Replace(myDataString);
BufferManager::Get(m_bufferID)->Replace(myDataString);
}
break;
case EDN_MSG__CURRENT_REPLACE_ALL:
@ -369,21 +366,21 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
break;
case EDN_MSG__CURRENT_UNDO:
m_bufferManager->Get(m_bufferID)->Undo();
BufferManager::Get(m_bufferID)->Undo();
break;
case EDN_MSG__CURRENT_REDO:
m_bufferManager->Get(m_bufferID)->Redo();
BufferManager::Get(m_bufferID)->Redo();
break;
case EDN_MSG__CURRENT_GOTO_LINE:
if (dataID<0) {
dataID = 0;
}
m_bufferManager->Get(m_bufferID)->JumpAtLine(dataID);
BufferManager::Get(m_bufferID)->JumpAtLine(dataID);
break;
case EDN_MSG__REFRESH_DISPLAY:
break;
case EDN_MSG__CURRENT_SET_CHARSET:
m_bufferManager->Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
BufferManager::Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ... Done under ...

View File

@ -45,7 +45,6 @@ class CodeView :public ewol::WidgetScrooled
etk::UString m_label;
color_ts m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color
BufferManager * m_bufferManager;
int32_t m_bufferID;
bool m_buttunOneSelected;
// drawing elements :

View File

@ -29,7 +29,6 @@
#include <CodeView.h>
#include <ClipBoard.h>
#include <BufferView.h>
#include <AccelKey.h>
#include <ewol/widget/Button.h>
#include <ewol/widget/CheckBox.h>
@ -186,18 +185,17 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
if (NULL == data) {
EDN_ERROR("Null data for Save As file ... ");
} else {
BufferManager * myMng = BufferManager::getInstance();
m_currentSavingAsIdBuffer = -1;
if (0 == strcmp(data , "current")) {
m_currentSavingAsIdBuffer = myMng->GetSelected();
m_currentSavingAsIdBuffer = BufferManager::GetSelected();
} else {
sscanf(data, "%d", &m_currentSavingAsIdBuffer);
}
if (false == myMng->Exist(m_currentSavingAsIdBuffer)) {
if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) {
EDN_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
} else {
Buffer * myBuffer = myMng->Get(m_currentSavingAsIdBuffer);
Buffer * myBuffer = BufferManager::Get(m_currentSavingAsIdBuffer);
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
tmpWidget->SetTitle("Save Files As...");
tmpWidget->SetValidateLabel("Save");
@ -227,8 +225,7 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
etk::UString tmpData = tmpWidget->GetCompleateFileName();
EDN_DEBUG("Request Saving As file : " << tmpData);
BufferManager * myMng = BufferManager::getInstance();
myMng->Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);
BufferManager::Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiSave, m_currentSavingAsIdBuffer);
} else if (generateEventId == ednMsgGuiAbout) {
/*

View File

@ -25,7 +25,6 @@
#include <tools_debug.h>
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include <CodeView.h>

View File

@ -27,14 +27,11 @@
#define __SEARCH_H__
#include <tools_debug.h>
#include <etk/Singleton.h>
class Search: public etk::Singleton<Search>
class Search
{
friend class etk::Singleton<Search>;
// specific for sigleton system...
private:
public:
// Constructeur
Search(void);
~Search(void);

View File

@ -27,7 +27,6 @@
#define __HIGHLIGHT_MANAGER_H__
#include <etk/Singleton.h>
#include <etk/UString.h>
#include <MsgBroadcast.h>
#include <Highlight.h>

View File

@ -34,7 +34,7 @@
#undef __class__
#define __class__ "CTagsManager"
#if 0
/**
* @brief
*
@ -412,4 +412,7 @@ void CTagsManager::PrintTag (const tagEntry *entry, bool small)
}
}
}
*/
*/
#endif

View File

@ -27,7 +27,6 @@
#define __C_TAGS_MANAGER_H__
#include <etk/Singleton.h>
#include <ewol/Widget.h>
#include "MsgBroadcast.h"
#include "readtags.h"
@ -40,7 +39,7 @@ typedef struct{
int32_t lineID;
} TagListFind_ts;
/*
class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
{
friend class etk::Singleton<CTagsManager>;
@ -68,16 +67,6 @@ class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
etk::VectorType<etk::File*> m_historyList;
etk::VectorType<TagListFind_ts> m_currentList;
void JumpAtID(int32_t selectID);
/*
GtkWidget * CreateViewAndModel(void);
static void cb_row (GtkTreeView *p_treeview,
GtkTreePath * p_path,
GtkTreeViewColumn * p_column,
gpointer p_data);
// save data in the list :
GtkListStore * m_listStore;
GtkWidget * m_Dialog;
*/
};
*/
#endif

View File

@ -38,6 +38,7 @@
#include <CTagsManager.h>
#include <etk/UString.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/WidgetManager.h>
MainWindows * basicWindows = NULL;
@ -85,8 +86,8 @@ void APP_Init(void)
// init ALL Singleton :
(void)CTagsManager::getInstance();
(void)BufferManager::getInstance();
//(void)CTagsManager::getInstance();
BufferManager::Init();
// set color and other trucs...
ColorizeManager::Init();
@ -141,18 +142,18 @@ void APP_UnInit(void)
HighlightManager::UnInit();
//Kill all singleton
EDN_INFO("Stop BufferManager");
BufferManager::Kill();
BufferManager::UnInit();
EDN_INFO("Stop ColorizeManager");
ColorizeManager::UnInit();
EDN_INFO("Stop Search");
Search::Kill();
//Search::Kill();
//EDN_INFO("Stop Accel key");
//AccelKey::Kill();
if (NULL != basicWindows) {
delete(basicWindows);
ewol::widgetManager::MarkWidgetToBeRemoved(basicWindows);
basicWindows = NULL;
}
basicWindows = NULL;
EDN_INFO("==> Un-Init Edn (END)");
}

View File

@ -1,97 +0,0 @@
/**
*******************************************************************************
* @file AccelKey.cpp
* @brief Editeur De N'ours : Basic Gui Accelerator Key (common for ALL) or nearly (Sources)
* @author Edouard DUPIN
* @date 17/06/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 <AccelKey.h>
#if 0
AccelKey::AccelKey(void)
{
m_accelGroup = gtk_accel_group_new();
}
AccelKey::~AccelKey(void)
{
}
void AccelKey::SetAccel(GtkWidget * widget, char * accelKey)
{
SetAccel(widget, m_accelGroup, accelKey);
}
void AccelKey::SetAccel(GtkWidget * widget, GtkAccelGroup * accel, char * accelKey)
{
guint accel_key = 0;
int32_t accel_mods = 0;
if( NULL==accelKey
|| 0==strlen(accelKey))
{
return;
}
// parsing of the string :
//"ctrl+shift+alt+pomme+s"
//EDN_DEBUG("Parse acxel string : \"" << accelKey << "\"");
char * tmp = strstr(accelKey, "ctrl");
if(NULL != tmp) {
accel_mods |= GDK_CONTROL_MASK;
//EDN_DEBUG(" => find CTRL");
}
tmp = strstr(accelKey, "shift");
if(NULL != tmp) {
accel_mods |= GDK_SHIFT_MASK;
//EDN_DEBUG(" => find SHIFT");
}
tmp = strstr(accelKey, "alt");
if(NULL != tmp) {
accel_mods |= GDK_MOD1_MASK;
//EDN_DEBUG(" => find ALT");
}
tmp = strstr(accelKey, "pomme");
if(NULL != tmp) {
accel_mods |= GDK_MOD2_MASK;
//EDN_DEBUG(" => find POMME");
}
accel_key = accelKey[strlen(accelKey) -1];
//char plop = accel_key;
//EDN_DEBUG(" => find letter : '" << plop << "'");
// Ajout du racourcis clavier :
gtk_widget_add_accelerator( widget, "activate", accel,
accel_key, // key
(GdkModifierType)accel_mods, // modifier keys
GTK_ACCEL_VISIBLE);
}
void AccelKey::LinkCommonAccel(GtkWidget * widget)
{
gtk_window_add_accel_group(GTK_WINDOW(widget), m_accelGroup);
}
void AccelKey::LinkCommonAccel(GtkWindow * widget)
{
gtk_window_add_accel_group(GTK_WINDOW(widget), m_accelGroup);
}
#endif

View File

@ -1,56 +0,0 @@
/**
*******************************************************************************
* @file AccelKey.h
* @brief Editeur De N'ours : Basic Gui Accelerator Key (common for ALL) or nearly (header)
* @author Edouard DUPIN
* @date 17/06/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 __ACCEL_KEY_H__
#define __ACCEL_KEY_H__
#include <tools_debug.h>
#include <etk/Singleton.h>
/*
// need to create a syngleton ...
class AccelKey: public Singleton<AccelKey>
{
friend class Singleton<AccelKey>;
// specific for sigleton system...
private:
// Constructeur
AccelKey(void);
~AccelKey(void);
public:
// for internal Parsing
void SetAccel(GtkWidget * widget, char * accelKey);
// For external parsing
void SetAccel(GtkWidget * widget, GtkAccelGroup * accel, char * accelKey);
void LinkCommonAccel(GtkWidget * widget);
void LinkCommonAccel(GtkWindow * widget);
GtkAccelGroup * GetAccel(void) { return m_accelGroup; };
private:
GtkAccelGroup * m_accelGroup;
};
*/
#endif

View File

@ -26,8 +26,7 @@ FILE_LIST+= edn/tools/EdnTemplate/EdnVectorBuf.cpp \
# Tools internal:
FILE_LIST+= edn/tools/Display/Display.cpp \
edn/tools/ClipBoard/ClipBoard.cpp \
edn/tools/MsgBroadcast/MsgBroadcast.cpp \
edn/tools/MsgBroadcast/AccelKey.cpp
edn/tools/MsgBroadcast/MsgBroadcast.cpp
# Gui:
FILE_LIST+= edn/Gui/BufferView.cpp \