Add message broadcast system and test the thread system of display

This commit is contained in:
Edouard Dupin 2012-01-31 18:27:35 +01:00
parent d5e64688c7
commit a3b404ec4d
27 changed files with 1116 additions and 1090 deletions

View File

@ -32,11 +32,13 @@
#include <ewol/threadMsg.h>
// declaration of the ewol android abstraction ...
void EWOL_NativeInit(void);
void EWOL_NativeDone(void);
void EWOL_NativeApplicationInit(void);
void EWOL_NativeApplicationUnInit(void);
void EWOL_NativeRender(void);
void EWOL_SystemStart(void);
void EWOL_SystemStop(void);
void EWOL_ThreadSetArchiveDir(int mode, const char* str);
void EWOL_ThreadResize(int w, int h );
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y);
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y);
extern "C"
@ -54,7 +56,7 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnCreate( JNIEnv* env )
{
EDN_DEBUG("Activity On Create");
BaseInit();
EWOL_SystemStart();
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStart( JNIEnv* env )
{
@ -79,7 +81,7 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnDestroy( JNIEnv* env )
{
EDN_DEBUG("Activity On Destroy");
BaseUnInit();
EWOL_SystemStop();
}
@ -92,41 +94,29 @@ extern "C"
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolRenderer_nativeResize( JNIEnv* env, jobject thiz, jint w, jint h )
{
eventResize_ts tmpData;
tmpData.w = w;
tmpData.h = h;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
EWOL_ThreadResize(w, h);
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
eventInputMotion_ts tmpData;
tmpData.pointerID = pointerID;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
EWOL_ThreadEventInputMotion(pointerID, x, y);
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeEventInputState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{
eventInputState_ts tmpData;
tmpData.pointerID = pointerID;
tmpData.state = isUp;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
EWOL_ThreadEventInputState(pointerID, isUp, x, y);
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationInit( JNIEnv* env)
{
ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_INIT);
//ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_INIT);
//EWOL_NativeApplicationInit();
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE___EwolGLSurfaceView_nativeApplicationUnInit( JNIEnv* env)
{
ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_UN_INIT);
//ewol::threadMsg::SendMessage(androidJniMsg, JNI_APP_UN_INIT);
//EWOL_NativeApplicationUnInit();
}

View File

@ -307,7 +307,6 @@ class Bitmap
};
class LoadedTexture
{
public:
@ -315,7 +314,6 @@ class LoadedTexture
int32_t m_nbTimeLoaded;
// openGl configuration :
uint32_t m_openGlTextureID;
int32_t m_target;
int32_t m_level;
int32_t m_internalFormat;
@ -327,6 +325,7 @@ class LoadedTexture
char* m_data;
int32_t m_nbBytes;
bool m_loaded;
bool m_destroy;
};
@ -336,64 +335,69 @@ class LoadedTexture
etk::VectorType<LoadedTexture*> listLoadedTexture;
static bool OGLContextLoaded=false;
#undef __class__
#define __class__ "ewol"
void ewol::TextureOGLContext(bool enable)
void ewol::UpdateTextureContext(void)
{
if (OGLContextLoaded != enable) {
EWOL_INFO("Change Open-GL context property : old=" << OGLContextLoaded << " new=" << enable);
OGLContextLoaded = enable;
if (true == OGLContextLoaded) {
EWOL_INFO(" ==> Set all Texture in openGL memory nb=" << listLoadedTexture.Size());
for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) {
if (NULL != listLoadedTexture[iii]->m_data) {
GLuint textureid;
glGenTextures(1, &textureid);
glBindTexture(listLoadedTexture[iii]->m_target, textureid);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
//--- mode nearest
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//--- Mode linear
glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EWOL_INFO(" [" << iii << "] texture =(" << listLoadedTexture[iii]->m_width << "px," <<
listLoadedTexture[iii]->m_height << "px) in file:" <<
listLoadedTexture[iii]->m_filename << " OGl_Id=" <<textureid);
glTexImage2D(listLoadedTexture[iii]->m_target,
listLoadedTexture[iii]->m_level,
listLoadedTexture[iii]->m_internalFormat,
listLoadedTexture[iii]->m_width,
listLoadedTexture[iii]->m_height,
listLoadedTexture[iii]->m_border,
listLoadedTexture[iii]->m_format,
listLoadedTexture[iii]->m_type,
listLoadedTexture[iii]->m_data);
listLoadedTexture[iii]->m_openGlTextureID = textureid;
listLoadedTexture[iii]->m_loaded = true;
} else {
EWOL_ERROR("Can not load texture with no data ...");
}
}
ewol::ForceRedrawAll();
} else {
EWOL_INFO(" ==> UnSet all Texture in openGL memory nb=" << listLoadedTexture.Size());
for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) {
EWOL_DEBUG(" [" << iii << "] file:" << listLoadedTexture[iii]->m_filename);
bool needRedraw = false;
for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) {
if( NULL != listLoadedTexture[iii]
&& NULL != listLoadedTexture[iii]->m_data)
{
if( false == listLoadedTexture[iii]->m_destroy
&& false == listLoadedTexture[iii]->m_loaded)
{
GLuint textureid;
glGenTextures(1, &textureid);
glBindTexture(listLoadedTexture[iii]->m_target, textureid);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
//--- mode nearest
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//--- Mode linear
glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(listLoadedTexture[iii]->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EWOL_INFO("TEXTURE: Add [" << iii << "]=(" << listLoadedTexture[iii]->m_width << "px," <<
listLoadedTexture[iii]->m_height << "px) in file:" <<
listLoadedTexture[iii]->m_filename << " OGl_Id=" <<textureid);
glTexImage2D(listLoadedTexture[iii]->m_target,
listLoadedTexture[iii]->m_level,
listLoadedTexture[iii]->m_internalFormat,
listLoadedTexture[iii]->m_width,
listLoadedTexture[iii]->m_height,
listLoadedTexture[iii]->m_border,
listLoadedTexture[iii]->m_format,
listLoadedTexture[iii]->m_type,
listLoadedTexture[iii]->m_data);
listLoadedTexture[iii]->m_openGlTextureID = textureid;
listLoadedTexture[iii]->m_loaded = true;
needRedraw = true;
} else if ( true == listLoadedTexture[iii]->m_destroy
&& true == listLoadedTexture[iii]->m_loaded)
{
// Request remove texture ...
EWOL_DEBUG("TEXTURE: Rm [" << iii << "] file:" << listLoadedTexture[iii]->m_filename);
glDeleteTextures(1, &listLoadedTexture[iii]->m_openGlTextureID);
listLoadedTexture[iii]->m_loaded = false;
listLoadedTexture[iii]->m_openGlTextureID = -1;
if (NULL != listLoadedTexture[iii]->m_data) {
delete[] listLoadedTexture[iii]->m_data;
listLoadedTexture[iii]->m_data = NULL;
}
delete(listLoadedTexture[iii]);
listLoadedTexture[iii] = NULL;
}
}
EWOL_INFO(" *** END ***");
}
if (true == needRedraw) {
ewol::ForceRedrawAll();
}
}
int32_t ewol::LoadTexture(int32_t target,
int32_t level,
int32_t internalFormat,
@ -428,37 +432,13 @@ int32_t ewol::LoadTexture(int32_t target,
tmpTex->m_nbBytes = nbBytes;
tmpTex->m_data = new char[tmpTex->m_nbBytes+4096];
tmpTex->m_loaded = false;
tmpTex->m_destroy = false;
if (NULL == tmpTex->m_data) {
EWOL_ERROR("Texture : Data Allocation ERROR... " << filename);
return -1;
}
memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes);
if (true == OGLContextLoaded) {
uint32_t textureid = 0;
glGenTextures(1, &textureid);
glBindTexture(tmpTex->m_target, textureid);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
//--- mode nearest
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//--- Mode linear
glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EWOL_INFO("Set in OpenGl texture =" << tmpTex->m_width << "px different of height=" << tmpTex->m_height << "px in file:" << filename << " in id OGL : " <<textureid);
glTexImage2D(tmpTex->m_target,
tmpTex->m_level,
tmpTex->m_internalFormat,
tmpTex->m_width,
tmpTex->m_height,
tmpTex->m_border,
tmpTex->m_format,
tmpTex->m_type,
tmpTex->m_data);
tmpTex->m_openGlTextureID = textureid;
tmpTex->m_loaded = true;
}
listLoadedTexture.PushBack(tmpTex);
outTextureID = listLoadedTexture.Size()-1;
return outTextureID;
@ -470,9 +450,11 @@ int32_t ewol::LoadTexture(etk::File fileName)
int32_t outTextureID = -1;
if (listLoadedTexture.Size()!=0) {
for (int32_t iii=0; iii<listLoadedTexture.Size(); iii++) {
if (listLoadedTexture[iii]->m_filename == fileName.GetCompleateName()) {
listLoadedTexture[iii]->m_nbTimeLoaded++;
return listLoadedTexture[iii]->m_openGlTextureID;
if (NULL != listLoadedTexture[iii]) {
if (listLoadedTexture[iii]->m_filename == fileName.GetCompleateName()) {
listLoadedTexture[iii]->m_nbTimeLoaded++;
return iii;
}
}
}
}
@ -502,19 +484,14 @@ void ewol::UnLoadTexture(uint32_t textureID)
{
EWOL_INFO("Unload a specific tecture ID=" << textureID);
if (textureID>=0 && (int32_t)textureID<listLoadedTexture.Size()) {
if (NULL == listLoadedTexture[textureID]) {
EWOL_ERROR("Texture : " << textureID << " does not existe anymore...");
return;
}
listLoadedTexture[textureID]->m_nbTimeLoaded--;
if (0 == listLoadedTexture[textureID]->m_nbTimeLoaded) {
EWOL_DEBUG("Remove openGL texture ID=" << textureID << " file:" << listLoadedTexture[textureID]->m_filename);
if (true == listLoadedTexture[textureID]->m_loaded) {
glDeleteTextures(1,&listLoadedTexture[textureID]->m_openGlTextureID);
}
if (NULL != listLoadedTexture[textureID]->m_data) {
delete[] listLoadedTexture[textureID]->m_data;
listLoadedTexture[textureID]->m_data = NULL;
}
delete(listLoadedTexture[textureID]);
listLoadedTexture[textureID] = NULL;
listLoadedTexture.Erase(textureID);
listLoadedTexture[textureID]->m_destroy = true;
}
return;
}

View File

@ -44,6 +44,7 @@ namespace ewol
void UnLoadTexture(uint32_t textureID);
int32_t GetTextureSize(uint32_t textureID);
uint32_t GetTextureGLID(uint32_t textureID);
void UpdateTextureContext(void);
void TextureOGLContext(bool enable);
};

View File

@ -24,6 +24,7 @@
#include <ewol/Widget.h>
#include <ewol/WidgetManager.h>
#include <ewol/WidgetMessageMultiCast.h>
char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
@ -97,6 +98,7 @@ ewol::Widget::Widget(void)
ewol::Widget::~Widget(void)
{
ewol::widgetMessageMultiCast::Rm(GetWidgetId());
ewol::widgetManager::Rm(this);
}
@ -166,7 +168,7 @@ bool ewol::Widget::GenEventInputExternal(const char * generateEventId, etkFloat_
if (NULL == tmpWidget) {
EWOL_ERROR("Try to call an NULL Widget, it might be removed ... id=" << m_externEvent[jjj].widgetCall);
} else {
ended = tmpWidget->OnEventAreaExternal(GetWidgetId(), generateEventId, m_externEvent[jjj].generateEventIdExtern, x, y);
ended = tmpWidget->OnEventAreaExternal(GetWidgetId(), m_externEvent[jjj].generateEventIdExtern, NULL, x, y);
}
if (true == ended) {
break;

View File

@ -272,8 +272,9 @@ namespace ewol {
protected:
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t X, etkFloat_t Y) { return false; };
virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y) { return false; };
public:
// when an event arrive from an other widget, it will arrive here:
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y) { return false; };
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { return false; };
// ----------------------------------------------------------------------------------------------------------------
// -- Keboard event (when one is present or when a graphical is present

View File

@ -0,0 +1,100 @@
/**
*******************************************************************************
* @file ewol/WidgetMessageMulticast.cpp
* @brief basic ewol Widget Message Multi-cast (Sources)
* @author Edouard DUPIN
* @date 31/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 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
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/WidgetManager.h>
#undef __class__
#define __class__ "ewol::WidgetMessageMultiCast"
extern "C" {
typedef struct {
int32_t widgetId;
const char* message;
} messageList_ts;
};
// internal element of the widget manager :
static etk::VectorType<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
void ewol::widgetMessageMultiCast::Init(void)
{
EWOL_INFO("user widget message Multi-Cast");
}
void ewol::widgetMessageMultiCast::UnInit(void)
{
EWOL_INFO("user widget message Multi-Cast");
m_messageList.Clear();
}
void ewol::widgetMessageMultiCast::Add(int32_t widgetId, const char* const message)
{
// TODO : Check if the message exist before ...
messageList_ts tmpMessage;
tmpMessage.widgetId = widgetId;
tmpMessage.message = message;
m_messageList.PushBack(tmpMessage);
}
// TODO : Do this better ...
void ewol::widgetMessageMultiCast::Rm(int32_t widgetId)
{
// send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
if(m_messageList[iii].widgetId != widgetId) {
m_messageList[iii].message = NULL;
m_messageList[iii].widgetId = -1;
}
}
}
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, int32_t data)
{
char tmpData[50];
sprintf(tmpData, "%d", data);
Send(widgetId, message, tmpData);
}
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, const char * data)
{
EWOL_DEBUG("SendMulticast message \"" << message << "\" to :");
// send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
if( m_messageList[iii].message == message
&& m_messageList[iii].widgetId != widgetId)
{
ewol::Widget * tmpWidget = ewol::widgetManager::Get(m_messageList[iii].widgetId);
if (NULL != tmpWidget) {
EWOL_DEBUG(" id = " << m_messageList[iii].widgetId);
// generate event ...
(void)tmpWidget->OnEventAreaExternal(widgetId, m_messageList[iii].message, data, 0, 0);
}
}
}
}

View File

@ -0,0 +1,46 @@
/**
*******************************************************************************
* @file ewol/WidgetMessageMulticast.h
* @brief basic ewol Widget Message Multi-cast (Header)
* @author Edouard DUPIN
* @date 31/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 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
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_WIDGET_MESSAGE_MULTIICAST_H__
#define __EWOL_WIDGET_MESSAGE_MULTIICAST_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject.h>
#include <etk/VectorType.h>
#include <ewol/Widget.h>
namespace ewol {
namespace widgetMessageMultiCast {
void Init( void);
void UnInit(void);
void Add( int32_t widgetId, const char* const message);
void Rm( int32_t widgetId);
void Send(int32_t widgetId, const char* const message, int32_t data);
void Send(int32_t widgetId, const char* const message, const char * data = NULL);
};
};
#endif

View File

@ -27,12 +27,13 @@
#include <ewol/Debug.h>
#include <ewol/threadMsg.h>
#include <ewol/base/MainThread.h>
#include <ewol/base/gui.h>
static ewol::threadMsg::threadMsg_ts androidJniMsg;
static pthread_t androidJniThread;
static pthread_attr_t androidJniThreadAttr;
//static pthread_attr_t androidJniThreadAttr;
enum {
JNI_NONE,
@ -70,83 +71,84 @@ typedef struct {
} eventInputState_ts;
extern int EWOL_appArgC;
extern char *EWOL_appArgV[];
static void* BaseAppEntry(void* param)
{
bool requestEndProcessing = false;
EDN_DEBUG("start Ewol Basic thread ...");
guiAbstraction::Init(0, NULL);
ewol::Init(0, NULL);
APP_Init(0, NULL);
EWOL_DEBUG("BThread Init (START)");
ewol::Init(EWOL_appArgC, EWOL_appArgV);
APP_Init(EWOL_appArgC, EWOL_appArgV);
EWOL_DEBUG("BThread Init (END)");
while(false == requestEndProcessing) {
ewol::threadMsg::threadMsgContent_ts data;
ewol::threadMsg::WaitMessage(androidJniMsg, data);
switch (data.type) {
case JNI_NONE:
EDN_DEBUG("Receive MSG : JNI_NONE");
EWOL_DEBUG("Receive MSG : JNI_NONE");
break;
case JNI_INIT:
EDN_DEBUG("Receive MSG : JNI_INIT");
EWOL_NativeApplicationInit();
EWOL_DEBUG("Receive MSG : JNI_INIT");
//Android : EWOL_NativeApplicationInit();
break;
case JNI_UN_INIT:
EDN_DEBUG("Receive MSG : JNI_UN_INIT");
EWOL_NativeApplicationUnInit();
EWOL_DEBUG("Receive MSG : JNI_UN_INIT");
//Android : EWOL_NativeApplicationUnInit();
requestEndProcessing = true;
break;
case JNI_DONE:
EDN_DEBUG("Receive MSG : JNI_DONE");
EWOL_DEBUG("Receive MSG : JNI_DONE");
break;
case JNI_RESIZE:
EDN_DEBUG("Receive MSG : JNI_RESIZE");
EWOL_DEBUG("Receive MSG : JNI_RESIZE");
{
eventResize_ts * tmpData = (eventResize_ts*)data.data;
EWOL_NativeResize(tmpData->w, tmpData->h);
EWOL_NativeInit();
//Android : EWOL_NativeResize(tmpData->w, tmpData->h);
//Android : EWOL_NativeInit();
}
break;
case JNI_INPUT_MOTION:
EDN_DEBUG("Receive MSG : JNI_INPUT_MOTION");
EWOL_DEBUG("Receive MSG : JNI_INPUT_MOTION");
{
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
//Android : EWOL_NativeEventInputMotion(tmpData->pointerID, tmpData->x, tmpData->y);
}
break;
case JNI_INPUT_STATE:
EDN_DEBUG("Receive MSG : JNI_INPUT_STATE");
EWOL_DEBUG("Receive MSG : JNI_INPUT_STATE");
{
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
//Android : EWOL_NativeEventInputState(tmpData->pointerID, tmpData->state, tmpData->x, tmpData->y);
}
break;
case JNI_DATA_ARCHIVE_DIR:
EDN_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR");
EWOL_DEBUG("Receive MSG : JNI_DATA_ARCHIVE_DIR");
break;
case JNI_APP_INIT:
EDN_DEBUG("Receive MSG : JNI_APP_INIT");
EWOL_DEBUG("Receive MSG : JNI_APP_INIT");
break;
case JNI_APP_UN_INIT:
EDN_DEBUG("Receive MSG : JNI_APP_UN_INIT");
EWOL_DEBUG("Receive MSG : JNI_APP_UN_INIT");
break;
case JNI_APP_RENDERER:
EDN_DEBUG("Receive MSG : JNI_APP_RENDERER");
EWOL_DEBUG("Receive MSG : JNI_APP_RENDERER");
break;
default:
EDN_DEBUG("Receive MSG : UNKNOW");
EWOL_DEBUG("Receive MSG : UNKNOW");
break;
}
}
EDN_DEBUG("End Ewol Basic thread ...");
EWOL_DEBUG("BThread Un-Init (START)");
// unset all windows
ewol::DisplayWindows(NULL);
// call application to uninit
APP_UnInit();
// basic abstraction un-init
guiAbstraction::UnInit();
// uninit Ewol
ewol::UnInit();
EWOL_DEBUG("BThread Un-Init (END)");
pthread_exit(NULL);
}
@ -206,7 +208,7 @@ void EWOL_SystemStop(void)
isGlobalSystemInit = false;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_UN_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
EDN_DEBUG("Wait end of the thread ...");
EWOL_DEBUG("Wait end of the thread ...");
// Wait end of the thread
pthread_join(androidJniThread, NULL);
ewol::threadMsg::UnInit(androidJniMsg);
@ -217,18 +219,29 @@ void EWOL_SystemStop(void)
void EWOL_ThreadResize(int w, int h )
{
eventResize_ts tmpData;
tmpData.w = w;
tmpData.h = h;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
}
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y )
{
eventInputMotion_ts tmpData;
tmpData.pointerID = pointerID;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
}
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y )
{
eventInputState_ts tmpData;
tmpData.pointerID = pointerID;
tmpData.state = isUp;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, JNI_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
}

View File

@ -12,7 +12,7 @@
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
*O
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
@ -35,8 +35,8 @@ void EWOL_SystemStop(void);
void EWOL_ThreadSetArchiveDir(int mode, const char* str);
void EWOL_ThreadResize(int w, int h );
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y );
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y );
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y);
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y);

View File

@ -41,14 +41,8 @@
#undef __class__
#define __class__ "AndroidJNI"
int gAppAlive = 1;
static int sDemoStopped = 0;
static long sTimeOffset = 0;
static int sTimeOffsetInit = 0;
static long sTimeStopped = 0;
int EWOL_appArgC = 0;
char *EWOL_appArgV[] = NULL;
static etkFloat_t m_width = 320;
static etkFloat_t m_height = 480;
@ -84,10 +78,6 @@ bool firstInitDone = false;
void EWOL_NativeInit(void)
{
EWOL_INFO("Init : Start All Application");
gAppAlive = 1;
sDemoStopped = 0;
sTimeOffsetInit = 0;
ewol::TextureOGLContext(true);
firstInitDone = true;
}
@ -97,8 +87,6 @@ void EWOL_NativeResize(int w, int h )
m_width = w;
m_height = h;
EWOL_INFO("Resize w=" << w << " h=" << h);
ewol::TextureOGLContext(false);
ewol::TextureOGLContext(true);
if (NULL != m_uniqueWindows) {
m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height);
m_uniqueWindows->SetOrigin(0.0, 0.0);
@ -109,7 +97,6 @@ void EWOL_NativeResize(int w, int h )
void EWOL_NativeDone(void)
{
EWOL_INFO("Renderer : Close All Application");
ewol::TextureOGLContext(false);
}
void EWOL_NativeEventInputMotion(int pointerID, float x, float y )
@ -265,6 +252,7 @@ static etkFloat_t gTriangleVertices5[] = { 200.0f, 200.0f, 100.0f, 200.0f, 200.0
void Draw(void)
{
ewol::UpdateTextureContext();
//EWOL_DEBUG("redraw (" << m_width << "," << m_height << ")");
if(NULL == m_uniqueWindows) {
// set the size of the open GL system
@ -371,95 +359,9 @@ void Draw(void)
#undef __class__
#define __class__ "guiAbstraction"
static bool guiAbstractionIsInit = false;
//static guiAbstraction::X11systemInterface * myX11Access = NULL;
void guiAbstraction::Init(int32_t argc, char *argv[])
{
if (false == guiAbstractionIsInit) {
// set the gui is init :
guiAbstractionIsInit = true;
EWOL_INFO("INIT for X11 environement");
//myX11Access = new guiAbstraction::X11systemInterface();
} else {
EWOL_CRITICAL("Can not INIT X11 ==> already init before");
}
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Noting to run in android mode ...");
}
void guiAbstraction::Stop(void)
{
if (true == guiAbstractionIsInit) {
//myX11Access->Stop();
} else {
EWOL_CRITICAL("Can not Stop X11 ==> not init ... ");
}
}
void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newOne)
{
if (true == guiAbstractionIsInit) {
Setwindow(newOne);
} else {
EWOL_CRITICAL("Can not set Windows X11 ==> not init ... ");
}
}
void guiAbstraction::UnInit(void)
{
if (true == guiAbstractionIsInit) {
EWOL_INFO("UN-INIT for X11 environement");
//if (NULL != myX11Access) {
// delete(myX11Access);
//}
guiAbstractionIsInit = false;
} else {
EWOL_CRITICAL("Can not Un-Init X11 ==> not init ... ");
}
}
void guiAbstraction::ChangeSize(int32_t w, int32_t h)
{
if (true == guiAbstractionIsInit) {
//myX11Access->ChangeSize(w, h);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::ChangePos(int32_t x, int32_t y)
{
if (true == guiAbstractionIsInit) {
//myX11Access->ChangePos(x, y);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
{
if (true == guiAbstractionIsInit) {
//myX11Access->GetAbsPos(x, y);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
bool guiAbstraction::IsPressedInput(int32_t inputID)
{
//if (true == guiAbstractionIsInit) {
// return myX11Access->IsPressedInput(inputID);
//} else {
// EWOL_CRITICAL("X11 ==> not init ... ");
return false;
//}
Setwindow(newOne);
}
void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
@ -499,13 +401,6 @@ void guiAbstraction::SendKeyboardEvent(bool isDown, etk::String &keyInput)
}
}
// never had main in android ...
/*
int main(int argc, char *argv[])
{
return -1;
}
*/
void glOrtho(GLfloat left,
GLfloat right,

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,6 @@
#include <ewol/Windows.h>
namespace ewol {
void Stop(void);
void DisplayWindows(ewol::Windows * windows);

View File

@ -28,9 +28,9 @@
#include <ewol/WidgetManager.h>
const char * const ewolEventButtonPressed = "ewol Button Pressed";
const char * const ewolEventButtonEnter = "ewol Button Enter";
const char * const ewolEventButtonLeave = "ewol Button Leave";
extern const char * const ewolEventButtonPressed = "ewol Button Pressed";
extern const char * const ewolEventButtonEnter = "ewol Button Enter";
extern const char * const ewolEventButtonLeave = "ewol Button Leave";

View File

@ -29,6 +29,10 @@
#include <ewol/Debug.h>
#include <ewol/Widget.h>
extern const char * const ewolEventButtonPressed;
extern const char * const ewolEventButtonEnter;
extern const char * const ewolEventButtonLeave;
namespace ewol {
class Button :public ewol::Widget
{

View File

@ -29,7 +29,7 @@
#include <ewol/WidgetManager.h>
const char * ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
extern const char * ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
#undef __class__
#define __class__ "ewol::CheckBox"

View File

@ -29,6 +29,8 @@
#include <ewol/Debug.h>
#include <ewol/Widget.h>
extern const char * ewolEventCheckBoxClicked;
namespace ewol {
class CheckBox :public ewol::Widget
{

View File

@ -29,8 +29,8 @@
#include <ewol/ewol.h>
const char * const ewolEventEntryClick = "ewol Entry click";
const char * const ewolEventEntryEnter = "ewol Entry Enter";
extern const char * const ewolEventEntryClick = "ewol Entry click";
extern const char * const ewolEventEntryEnter = "ewol Entry Enter";

View File

@ -29,6 +29,9 @@
#include <ewol/Debug.h>
#include <ewol/Widget.h>
extern const char * const ewolEventEntryClick;
extern const char * const ewolEventEntryEnter;
namespace ewol {
class Entry :public ewol::Widget
{

View File

@ -28,7 +28,7 @@
#include <ewol/WidgetManager.h>
const char * const ewolEventLabelPressed = "ewol Label Pressed";
extern const char * const ewolEventLabelPressed = "ewol Label Pressed";

View File

@ -29,6 +29,8 @@
#include <ewol/Debug.h>
#include <ewol/Widget.h>
extern const char * const ewolEventLabelPressed;
namespace ewol {
class Label :public ewol::Widget
{

View File

@ -54,7 +54,7 @@ void SortList(etk::VectorType<etk::String *> &m_listDirectory)
const char * const ewolEventFileChooserSelectFolder = "ewol event file chooser Select Folder";
const char * const ewolEventFileChooserSelectFolder = "ewol-event-file-chooser-Select-Folder";
class FileChooserFolderList : public ewol::List
{
@ -180,8 +180,8 @@ class FileChooserFolderList : public ewol::List
#undef __class__
#define __class__ "ewol::FileChooser(FileList)"
const char * const ewolEventFileChooserSelectFile = "ewol event file chooser Select File";
const char * const ewolEventFileChooserValidateFile = "ewol event file chooser Validate File";
const char * const ewolEventFileChooserSelectFile = "ewol-event-file-chooser-Select-File";
const char * const ewolEventFileChooserValidateFile = "ewol-event-file-chooser-Validate-File";
class FileChooserFileList : public ewol::List
{
@ -312,8 +312,8 @@ class FileChooserFileList : public ewol::List
#define __class__ "ewol::FileChooser"
const char * const ewolEventFileChooserCancel = "ewol event file chooser cancel";
const char * const ewolEventFileChooserValidate = "ewol event file chooser validate";
extern const char * const ewolEventFileChooserCancel = "ewol-event-file-chooser-cancel";
extern const char * const ewolEventFileChooserValidate = "ewol-event-file-chooser-validate";
ewol::FileChooser::FileChooser(void)
@ -365,7 +365,7 @@ ewol::FileChooser::FileChooser(void)
mySizerHori->SubWidgetAdd(mySpacer);
myListFolder = new FileChooserFolderList();
m_widgetListFolderId = myListFolder->GetWidgetId();
myListFolder->ExternLinkOnEvent("ewol event file chooser Select Folder", GetWidgetId(), ewolEventFileChooserSelectFolder);
myListFolder->ExternLinkOnEvent(ewolEventFileChooserSelectFolder, GetWidgetId(), ewolEventFileChooserSelectFolder);
myListFolder->SetExpendY(true);
myListFolder->SetFillY(true);
mySizerHori->SubWidgetAdd(myListFolder);
@ -374,8 +374,8 @@ ewol::FileChooser::FileChooser(void)
mySizerHori->SubWidgetAdd(mySpacer);
myListFile = new FileChooserFileList();
m_widgetListFileId = myListFile->GetWidgetId();
myListFile->ExternLinkOnEvent("ewol event file chooser Select File", GetWidgetId(), ewolEventFileChooserSelectFile);
myListFile->ExternLinkOnEvent("ewol event file chooser Validate File", GetWidgetId(), ewolEventFileChooserValidateFile);
myListFile->ExternLinkOnEvent(ewolEventFileChooserSelectFile, GetWidgetId(), ewolEventFileChooserSelectFile);
myListFile->ExternLinkOnEvent(ewolEventFileChooserValidateFile, GetWidgetId(), ewolEventFileChooserValidateFile);
myListFile->SetExpendX(true);
myListFile->SetFillX(true);
myListFile->SetExpendY(true);
@ -392,11 +392,11 @@ ewol::FileChooser::FileChooser(void)
mySizerHori->SubWidgetAdd(mySpacer);
myButton = new ewol::Button("Open");
m_widgetValidateId = myButton->GetWidgetId();
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserValidate);
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventFileChooserValidate);
mySizerHori->SubWidgetAdd(myButton);
myButton = new ewol::Button("Cancel");
m_widgetCancelId = myButton->GetWidgetId();
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserCancel);
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventFileChooserCancel);
mySizerHori->SubWidgetAdd(myButton);
// set the default Folder properties:
@ -445,13 +445,13 @@ void ewol::FileChooser::SetFolder(etk::String folder)
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
{
EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << eventExternId << "\"" );
if (ewolEventFileChooserCancel == eventExternId) {
EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
if (ewolEventFileChooserCancel == generateEventId) {
//==> Auto remove ...
} else if (ewolEventFileChooserSelectFolder == eventExternId) {
} else if (ewolEventFileChooserSelectFolder == generateEventId) {
//==> this is an internal event ...
FileChooserFolderList * myListFolder = (FileChooserFolderList *)ewol::widgetManager::Get(m_widgetListFolderId);
etk::String tmpString = myListFolder->GetSelectedLine();
@ -472,20 +472,20 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
UpdateCurrentFolder();
m_hasSelectedFile = false;
return true;
} else if (ewolEventFileChooserSelectFile == eventExternId) {
} else if (ewolEventFileChooserSelectFile == generateEventId) {
m_hasSelectedFile = true;
FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId);
m_file = myListFile->GetSelectedLine();
} else if (ewolEventFileChooserValidateFile == eventExternId) {
} else if (ewolEventFileChooserValidateFile == generateEventId) {
m_hasSelectedFile = true;
FileChooserFileList * myListFile = (FileChooserFileList *)ewol::widgetManager::Get(m_widgetListFileId);
m_file = myListFile->GetSelectedLine();
// select the File ==> generate a validate
return GenEventInputExternal(ewolEventFileChooserValidate, x, y);;
} else if (ewolEventFileChooserValidate == eventExternId && false == m_hasSelectedFile) {
} else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) {
return false;
}
return GenEventInputExternal(eventExternId, x, y);
return GenEventInputExternal(generateEventId, x, y);
};

View File

@ -29,13 +29,16 @@
#include <ewol/Debug.h>
#include <ewol/widget/PopUp.h>
extern const char * const ewolEventFileChooserCancel;
extern const char * const ewolEventFileChooserValidate;
namespace ewol {
class FileChooser : public ewol::PopUp
{
public:
FileChooser(void);
~FileChooser(void);
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y);
void SetTitle(etk::String label);
void SetValidateLabel(etk::String label);
void SetCancelLabel(etk::String label);

View File

@ -46,8 +46,8 @@ extern "C" {
#define __class__ "ewol::Keyboard"
const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide";
const char * const ewolEventKeyEvent = "ewol event internal key event";
extern const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide";
extern const char * const ewolEventKeyEvent = "ewol event internal key event";
ewol::Keyboard::Keyboard(void)

View File

@ -29,6 +29,8 @@
#include <ewol/Debug.h>
#include <ewol/Widget.h>
extern const char * const ewolEventKeyboardHide;
namespace ewol {
typedef enum {
KEYBOARD_MODE_TEXT,

View File

@ -36,12 +36,12 @@
#define __class__ "ewol::StdPopUp"
const char * const ewolEventFileStdPopUpCancel = "ewol event std_pop_up cancel";
const char * const ewolEventFileStdPopUpValidate = "ewol event std_pop_up validate";
const char * const ewolEventFileStdPopUpButton1 = "ewol event std_pop_up BT1";
const char * const ewolEventFileStdPopUpButton2 = "ewol event std_pop_up BT2";
const char * const ewolEventFileStdPopUpButton3 = "ewol event std_pop_up BT3";
const char * const ewolEventFileStdPopUpButton4 = "ewol event std_pop_up BT4";
extern const char * const ewolEventFileStdPopUpCancel = "ewol event std_pop_up cancel";
extern const char * const ewolEventFileStdPopUpValidate = "ewol event std_pop_up validate";
extern const char * const ewolEventFileStdPopUpButton1 = "ewol event std_pop_up BT1";
extern const char * const ewolEventFileStdPopUpButton2 = "ewol event std_pop_up BT2";
extern const char * const ewolEventFileStdPopUpButton3 = "ewol event std_pop_up BT3";
extern const char * const ewolEventFileStdPopUpButton4 = "ewol event std_pop_up BT4";
ewol::FileChooser::FileChooser(void)

View File

@ -29,6 +29,13 @@
#include <ewol/Debug.h>
#include <ewol/widget/PopUp.h>
extern const char * const ewolEventFileStdPopUpCancel;
extern const char * const ewolEventFileStdPopUpValidate;
extern const char * const ewolEventFileStdPopUpButton1;
extern const char * const ewolEventFileStdPopUpButton2;
extern const char * const ewolEventFileStdPopUpButton3;
extern const char * const ewolEventFileStdPopUpButton4;
namespace ewol {
class StdPopUp : public ewol::PopUp
{

View File

@ -3,6 +3,7 @@
FILE_LIST = ewol/ewol.cpp \
ewol/ewolInterne.cpp \
ewol/threadMsg.cpp \
ewol/base/MainThread.cpp \
ewol/Debug.cpp \
ewol/OObject.cpp \
ewol/OObject/2DText.cpp \
@ -14,6 +15,7 @@ FILE_LIST = ewol/ewol.cpp \
ewol/FontFreeType.cpp \
ewol/Widget.cpp \
ewol/WidgetManager.cpp \
ewol/WidgetMessageMultiCast.cpp \
ewol/Windows.cpp \
ewol/widget/Button.cpp \
ewol/widget/Label.cpp \