change the system to open file message
This commit is contained in:
parent
0341795cbb
commit
d088866891
@ -96,7 +96,7 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
|
|
||||||
myColor = myColorManager->Get("commentDoxygen");
|
myColor = myColorManager->Get("commentDoxygen");
|
||||||
OOTextNormal->SetColor(myColor->GetFG());
|
OOTextNormal->SetColor(myColor->GetFG());
|
||||||
OOTextNormal->TextAdd(20, 20 + letterHeight*1.30, "No Buffer Availlable to display", sizeX);
|
OOTextNormal->TextAdd(20, (int32_t)(20 + letterHeight*1.30), "No Buffer Availlable to display", sizeX);
|
||||||
|
|
||||||
|
|
||||||
color_ts bgColor; //!< Text color
|
color_ts bgColor; //!< Text color
|
||||||
|
@ -47,6 +47,7 @@ BufferManager::BufferManager(void)
|
|||||||
BufferNotExiste = new BufferEmpty();
|
BufferNotExiste = new BufferEmpty();
|
||||||
m_idSelected = -1;
|
m_idSelected = -1;
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiNew);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiNew);
|
||||||
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgOpenFile);
|
||||||
/*
|
/*
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
|
||||||
@ -77,7 +78,7 @@ BufferManager::~BufferManager(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
if (generateEventId == ednMsgGuiNew) {
|
if (generateEventId == ednMsgGuiNew) {
|
||||||
int32_t newOne = Create();
|
int32_t newOne = Create();
|
||||||
@ -85,8 +86,15 @@ bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateE
|
|||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, newOne);
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, newOne);
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
|
||||||
}
|
}
|
||||||
} else if (generateEventId == NULL) {
|
} else if (generateEventId == ednMsgOpenFile) {
|
||||||
|
if (NULL != data) {
|
||||||
|
etk::File myFile(data, etk::FILE_TYPE_DIRECT);
|
||||||
|
int32_t newOne = Open(myFile);
|
||||||
|
if (-1 != newOne) {
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, newOne);
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
switch (id)
|
switch (id)
|
||||||
@ -214,10 +222,7 @@ int32_t BufferManager::Open(etk::File &myFile)
|
|||||||
Buffer *myBuffer = new BufferText(myFile);
|
Buffer *myBuffer = new BufferText(myFile);
|
||||||
// Add at the list of element
|
// Add at the list of element
|
||||||
listBuffer.PushBack(myBuffer);
|
listBuffer.PushBack(myBuffer);
|
||||||
int32_t basicID = listBuffer.Size() - 1;
|
return listBuffer.Size() - 1;
|
||||||
//SendMessage(EDN_MSG__BUFFER_ADD, basicID);
|
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferAdd);
|
|
||||||
return basicID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BUFFER_MANAGER_H__
|
#ifndef __BUFFER_MANAGER_H__
|
||||||
#define __BUFFER_MANAGER_H__
|
#define __BUFFER_MANAGER_H__
|
||||||
|
|
||||||
@ -44,12 +44,14 @@ class BufferManager: public etk::Singleton<BufferManager>, public ewol::Widget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
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
|
// return the ID of the buffer allocated
|
||||||
// create a buffer with no element
|
// create a buffer with no element
|
||||||
int32_t Create(void);
|
int32_t Create(void);
|
||||||
// open curent filename
|
// open curent filename
|
||||||
int32_t Open(etk::File &myFile);
|
int32_t Open(etk::File &myFile);
|
||||||
|
bool Remove(int32_t BufferID);
|
||||||
|
public:
|
||||||
int32_t GetSelected(void) { return m_idSelected;};
|
int32_t GetSelected(void) { return m_idSelected;};
|
||||||
void SetSelected(int32_t id) {m_idSelected = id;};
|
void SetSelected(int32_t id) {m_idSelected = id;};
|
||||||
Buffer * Get(int32_t BufferID);
|
Buffer * Get(int32_t BufferID);
|
||||||
@ -60,7 +62,6 @@ class BufferManager: public etk::Singleton<BufferManager>, public ewol::Widget
|
|||||||
uint32_t Size(void);
|
uint32_t Size(void);
|
||||||
int32_t WitchBuffer(int32_t iEmeElement);
|
int32_t WitchBuffer(int32_t iEmeElement);
|
||||||
|
|
||||||
bool Remove(int32_t BufferID);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -141,13 +141,6 @@ bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
|
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
|
||||||
if ( 0 <= selectBuf) {
|
if ( 0 <= selectBuf) {
|
||||||
m_selectedID = raw;
|
m_selectedID = raw;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (typeEvent == ewol::EVENT_INPUT_TYPE_DOUBLE) {
|
|
||||||
EDN_INFO("Event Double on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
|
||||||
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
|
|
||||||
//EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf);
|
|
||||||
if ( 0 <= selectBuf) {
|
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,15 +171,8 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
|
|||||||
}
|
}
|
||||||
// get the filename :
|
// get the filename :
|
||||||
etk::String tmpData = tmpWidget->GetCompleateFileName();
|
etk::String tmpData = tmpWidget->GetCompleateFileName();
|
||||||
etk::File myfilename = tmpData;
|
|
||||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
|
||||||
if (false == myBufferManager->Exist(myfilename) ) {
|
|
||||||
int32_t openID = myBufferManager->Open(myfilename);
|
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId, openID);
|
|
||||||
} else {
|
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId, myBufferManager->GetId(myfilename));
|
|
||||||
}
|
|
||||||
EDN_DEBUG("Request opening the file : " << tmpData);
|
EDN_DEBUG("Request opening the file : " << tmpData);
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgOpenFile, tmpData.c_str());
|
||||||
PopUpWidgetPop();
|
PopUpWidgetPop();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,7 +47,7 @@ MainWindows * basicWindows = NULL;
|
|||||||
*/
|
*/
|
||||||
void APP_Init(void)
|
void APP_Init(void)
|
||||||
{
|
{
|
||||||
EDN_INFO("Start Edn");
|
EDN_INFO("==> Init Edn (START)");
|
||||||
ewol::ChangeSize(800, 600);
|
ewol::ChangeSize(800, 600);
|
||||||
|
|
||||||
// set the default Path of the application :
|
// set the default Path of the application :
|
||||||
@ -124,15 +124,9 @@ void APP_Init(void)
|
|||||||
|
|
||||||
for( int32_t iii=0 ; iii<ewol::CmdLineNb(); iii++) {
|
for( int32_t iii=0 ; iii<ewol::CmdLineNb(); iii++) {
|
||||||
EDN_INFO("need load file : \"" << ewol::CmdLineGet(iii) << "\"" );
|
EDN_INFO("need load file : \"" << ewol::CmdLineGet(iii) << "\"" );
|
||||||
etk::String tmpString = ewol::CmdLineGet(iii);
|
ewol::widgetMessageMultiCast::Send(-1, ednMsgOpenFile, ewol::CmdLineGet(iii).c_str());
|
||||||
etk::File myfile(tmpString, etk::FILE_TYPE_DIRECT);
|
|
||||||
if (false == myBufferManager->Exist(myfile) ) {
|
|
||||||
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
|
||||||
if (1==iii) {
|
|
||||||
ewol::widgetMessageMultiCast::Send(-1, ednMsgCodeViewCurrentChangeBufferId, idBuffOpened-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
EDN_INFO("==> Init Edn (END)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,6 +135,7 @@ void APP_Init(void)
|
|||||||
*/
|
*/
|
||||||
void APP_UnInit(void)
|
void APP_UnInit(void)
|
||||||
{
|
{
|
||||||
|
EDN_INFO("==> Un-Init Edn (START)");
|
||||||
// Remove windows :
|
// Remove windows :
|
||||||
ewol::DisplayWindows(NULL);
|
ewol::DisplayWindows(NULL);
|
||||||
|
|
||||||
@ -157,6 +152,7 @@ void APP_UnInit(void)
|
|||||||
if (NULL != basicWindows) {
|
if (NULL != basicWindows) {
|
||||||
delete(basicWindows);
|
delete(basicWindows);
|
||||||
}
|
}
|
||||||
EDN_INFO("Stop Edn");
|
basicWindows = NULL;
|
||||||
|
EDN_INFO("==> Un-Init Edn (END)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user