Upgrade display distance fiead

This commit is contained in:
Edouard DUPIN 2012-09-14 17:22:39 +02:00
parent 236784a6d3
commit db7b31dc61
15 changed files with 222 additions and 202 deletions

2
Build

@ -1 +1 @@
Subproject commit f0785e65dcabf471d1a60282522738ff2ff00903
Subproject commit a42715960bdb78614c78830517b112cb88cd3627

@ -1 +1 @@
Subproject commit b3f1a97a28cce551e8685216a68e77a68904dde5
Subproject commit 4c16ddcbd7f37fc84a663484a1a7388188ceaa79

View File

@ -32,18 +32,23 @@ endif
LOCAL_EXPORT_LDLIBS += -ldl -llog
FILE_ABSTRACTION:=$(LOCAL_PATH)/ewol/os/AndroidAbstractionBase.cpp
FILE_ABSTRACTION_DEST:=ewol/os/AndroidAbstraction.cpp
FILE_ABSTRACTION:=$(LOCAL_PATH)/ewol/os/gui.Android.base.cpp
FILE_ABSTRACTION_DEST:=ewol/os/gui.Android.cpp
EWOL_TMP_PATH:=$(LOCAL_PATH)
$(FILE_ABSTRACTION_DEST): $(FILE_ABSTRACTION)
@mkdir -p $(dir $(EWOL_TMP_PATH)/$@)
@cp -f $(FILE_ABSTRACTION) $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_ORG_TYPE__|$(call convert-special-char,$(CONFIG___EWOL_APPL_ORGANISATION_TYPE__))|" $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_VENDOR__|$(call convert-special-char,$(CONFIG___EWOL_APPL_COMPAGNY__))|" $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_NAME__|$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))|" $(EWOL_TMP_PATH)/$@
@sed -i "s|__PROJECT_PACKAGE__|$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))|" $(EWOL_TMP_PATH)/$@
$(shell rm $(FILE_ABSTRACTION_DEST) $(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST))
$(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST): $(FILE_ABSTRACTION)
$(Q)mkdir -p $(dir $@)
$(Q)cp -f $(FILE_ABSTRACTION) $@
$(Q)sed -i "s|__PROJECT_ORG_TYPE__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_ORGANISATION_TYPE__)))|" $@
$(Q)sed -i "s|__PROJECT_VENDOR__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_COMPAGNY__)))|" $@
$(Q)sed -i "s|__PROJECT_NAME__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__)))|" $@
$(Q)sed -i "s|__PROJECT_PACKAGE__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__)))|" $@
$(FILE_ABSTRACTION_DEST): $(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST)
# this is the abstraction file for Android
@ -52,7 +57,7 @@ LOCAL_PREREQUISITES := $(FILE_ABSTRACTION_DEST)
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := ewol/os/gui.Android.cpp $(FILE_ABSTRACTION_DEST) $(FILE_LIST)
LOCAL_SRC_FILES := ewol/os/gui.Android.cpp $(FILE_LIST)
include $(BUILD_STATIC_LIBRARY)

View File

@ -15,7 +15,7 @@ menu "General"
config __EWOL_APPL_NAME__
prompt "Application Name"
string
default "Ewol"
default "Ewol__"
help
This is the application name

View File

@ -168,6 +168,10 @@ void ewol::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destina
eSystem::InputEventTransfertWidget(source, destination);
}
void ewol::ForceOrientation(ewol::orientation_te orientation)
{
guiInterface::ForceOrientation(orientation);
}
// ------------------------------------------------------------------------

View File

@ -83,6 +83,12 @@ namespace ewol {
* @return ---
*/
void InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination);
typedef enum {
SCREEN_ORIENTATION_AUTO = 0,
SCREEN_ORIENTATION_LANDSCAPE,
SCREEN_ORIENTATION_PORTRAIT,
} orientation_te;
void ForceOrientation(ewol::orientation_te orientation);
};
#else

View File

@ -179,7 +179,7 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) :
EWOL_DEBUG(" m_advance =" << m_listElement[iii].property.m_advance );
*/
// generate the distance field from this element ...
tmpUpScaledImage.DistanceField(Vector2D<int32_t>(0,0), m_listElement[iii].property.m_sizeTexture*Vector2D<int32_t>(SPECIAL_UPSCALER,SPECIAL_UPSCALER)+Vector2D<int32_t>(2*SPECIAL_BORDER*SPECIAL_UPSCALER,2*SPECIAL_BORDER*SPECIAL_UPSCALER));
tmpUpScaledImage.DistanceField(Vector2D<int32_t>(0,0), m_listElement[iii].property.m_sizeTexture*Vector2D<int32_t>(SPECIAL_UPSCALER,SPECIAL_UPSCALER)+Vector2D<int32_t>(2*SPECIAL_BORDER*SPECIAL_UPSCALER,2*SPECIAL_BORDER*SPECIAL_UPSCALER), SPECIAL_UPSCALER, SPECIAL_UPSCALER/2);
// copy data with downscaling : (subSampling)
Vector2D<int32_t> tmpPos(0,0);
for (tmpPos.y = 0; tmpPos.y<m_listElement[iii].property.m_sizeTexture.y+2*SPECIAL_BORDER; tmpPos.y++) {
@ -213,7 +213,6 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) :
}
#endif
EWOL_DEBUG("End generation of the Fond bitmap, start adding texture");
//m_data.DistanceField();
Flush();
}

View File

@ -279,6 +279,13 @@ void eSystem::Init(void)
RequestInit();
// force a recalculation
ewol::RequestUpdateSize();
#if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__)
ewol::ForceOrientation(ewol::SCREEN_ORIENTATION_LANDSCAPE);
#elif defined(__EWOL_ANDROID_ORIENTATION_PORTRAIT__)
ewol::ForceOrientation(ewol::SCREEN_ORIENTATION_PORTRAIT);
#else
ewol::ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
#endif
}
EWOL_INFO("==> Ewol System Init (END)");
}

View File

@ -30,6 +30,7 @@
#include <ewol/Debug.h>
#include <ewol/os/eSystem.h>
#include <ewol/audio/audio.h>
#include <ewol/os/gui.h>
// get a resources from the java environement :
static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM
@ -97,13 +98,14 @@ void SendJava_KeyboardShow(bool showIt)
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
if (status == JNI_EDETACHED) {
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
}
void SendJava_OrientationChange(bool showIt)
// mode 0 : auto; 1 landscape, 2 portrait
void SendJava_OrientationChange(int32_t mode)
{
EWOL_DEBUG("C->java : call java");
if (NULL == g_JavaVM) {
@ -139,8 +141,10 @@ void SendJava_OrientationChange(bool showIt)
return;
}
jint param = mode;
//Call java ...
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_OrientationChange);
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_OrientationChange, param);
// manage execption :
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
@ -149,8 +153,10 @@ void SendJava_OrientationChange(bool showIt)
JavaVirtualMachinePointer->ExceptionClear();
}
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
if (status == JNI_EDETACHED) {
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
}
@ -208,9 +214,10 @@ void SendSystemMessage(const char * dataString)
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
if (status == JNI_EDETACHED) {
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
}
namespace guiAbstraction {
@ -257,9 +264,10 @@ extern "C"
JavaVirtualMachinePointer = env;
// get default needed all time elements :
if (NULL != JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : try load __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class");
javaClassActivity = JavaVirtualMachinePointer->FindClass("__PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__" );
if (javaClassActivity == 0) {
EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class");
EWOL_ERROR("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class");
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
@ -267,28 +275,28 @@ extern "C"
// get the activity object :
javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" );
if (javaClassActivityEntryPoint == 0) {
EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.eventFromCPP" );
EWOL_ERROR("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.eventFromCPP" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_keyboardShow = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardShow", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardShow == 0) {
EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardShow" );
EWOL_ERROR("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardShow" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_keyboardHide = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardHide", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardHide == 0) {
EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardHide" );
EWOL_ERROR("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardHide" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_OrientationChange = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_OrientationChange", "(I)V" );
if (javaClassActivityEntryPoint__CPP_OrientationChange == 0) {
EWOL_DEBUG("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_OrientationChange" );
EWOL_ERROR("C->java : Can't find __PROJECT_ORG_TYPE__/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_OrientationChange" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
@ -299,7 +307,7 @@ extern "C"
javaDefaultClassString = JavaVirtualMachinePointer->FindClass("java/lang/String" );
if (javaDefaultClassString == 0) {
EWOL_DEBUG("C->java : Can't find java/lang/String" );
EWOL_ERROR("C->java : Can't find java/lang/String" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
@ -489,3 +497,138 @@ extern "C"
};
#undef __class__
#define __class__ "guiInterface"
int64_t guiInterface::GetTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec);
}
/**
* @brief Set the new title of the windows
* @param title New desired title
* @return ---
*/
void guiInterface::SetTitle(etk::UString& title)
{
// can not set the title in Android ...
}
// -------------------------------------------------------------------------
// ClipBoard AREA :
// -------------------------------------------------------------------------
bool l_clipBoardOwnerStd = false;
/**
* @brief Inform the Gui that we want to have a copy of the clipboard
* @param ID of the clipboard (STD/SELECTION) only apear here
* @return ---
*/
void guiInterface::ClipBoardGet(ewol::clipBoard::clipboardListe_te clipboardID)
{
// this is to force the local system to think we have the buffer
// TODO : Remove this 2 Line when code will be writen
l_clipBoardOwnerStd = true;
switch (clipboardID)
{
case ewol::clipBoard::CLIPBOARD_SELECTION:
// NOTE : Windows does not support the middle button the we do it internaly
// just transmit an event , we have the data in the system
eSystem::ClipBoardArrive(clipboardID);
break;
case ewol::clipBoard::CLIPBOARD_STD:
if (false == l_clipBoardOwnerStd) {
// Generate a request TO the OS
// TODO : Send the message to the OS "We disire to receive the copy buffer ...
} else {
// just transmit an event , we have the data in the system
eSystem::ClipBoardArrive(clipboardID);
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
/**
* @brief Inform the Gui that we are the new owner of the clipboard
* @param ID of the clipboard (STD/SELECTION) only apear here
* @return ---
*/
void guiInterface::ClipBoardSet(ewol::clipBoard::clipboardListe_te clipboardID)
{
switch (clipboardID)
{
case ewol::clipBoard::CLIPBOARD_SELECTION:
// NOTE : nothing to do : Windows deas ot supported Middle button
break;
case ewol::clipBoard::CLIPBOARD_STD:
// Request the clipBoard :
if (false == l_clipBoardOwnerStd) {
// TODO : Inform the OS that we have the current buffer of copy ...
l_clipBoardOwnerStd = true;
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
void guiInterface::Stop(void)
{
// TODO : send a message to the android system to stop ...
}
// java system to send message :
void SendSystemMessage(const char * dataString);
void SendJava_KeyboardShow(bool showIt);
void guiInterface::KeyboardShow(void)
{
// send a message at the java :
SendJava_KeyboardShow(true);
}
void guiInterface::KeyboardHide(void)
{
// send a message at the java :
SendJava_KeyboardShow(false);
}
void guiInterface::ChangeSize(Vector2D<int32_t> size)
{
// The size can not be change on android platform
}
void guiInterface::ChangePos(Vector2D<int32_t> size)
{
// The position can not be change on Android platform
}
void guiInterface::GetAbsPos(Vector2D<int32_t>& size)
{
size.x = 0;
size.y = 0;
}
/**
* @brief Force the screen orientation (availlable on portable elements ...
* @param orientation Selected orientation.
* @return ---
*/
void guiInterface::ForceOrientation(ewol::orientation_te orientation)
{
SendJava_OrientationChange((int32_t)orientation);
}

View File

@ -1,168 +0,0 @@
/**
*******************************************************************************
* @file guiAndroid.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @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 <jni.h>
#include <sys/time.h>
#include <time.h>
#include <android/log.h>
#include <stdint.h>
#include <ewol/Debug.h>
#include <etk/UString.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/os/gui.h>
#include <ewol/os/eSystem.h>
#include <ewol/ewol.h>
#include <ewol/openGL/openGL.h>
#include <ewol/texture/Texture.h>
#undef __class__
#define __class__ "AndroidJNI"
int64_t guiInterface::GetTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec);
}
/**
* @brief Set the new title of the windows
* @param title New desired title
* @return ---
*/
void guiInterface::SetTitle(etk::UString& title)
{
// can not set the title in Android ...
}
// -------------------------------------------------------------------------
// ClipBoard AREA :
// -------------------------------------------------------------------------
bool l_clipBoardOwnerStd = false;
/**
* @brief Inform the Gui that we want to have a copy of the clipboard
* @param ID of the clipboard (STD/SELECTION) only apear here
* @return ---
*/
void guiInterface::ClipBoardGet(ewol::clipBoard::clipboardListe_te clipboardID)
{
// this is to force the local system to think we have the buffer
// TODO : Remove this 2 Line when code will be writen
l_clipBoardOwnerStd = true;
switch (clipboardID)
{
case ewol::clipBoard::CLIPBOARD_SELECTION:
// NOTE : Windows does not support the middle button the we do it internaly
// just transmit an event , we have the data in the system
eSystem::ClipBoardArrive(clipboardID);
break;
case ewol::clipBoard::CLIPBOARD_STD:
if (false == l_clipBoardOwnerStd) {
// Generate a request TO the OS
// TODO : Send the message to the OS "We disire to receive the copy buffer ...
} else {
// just transmit an event , we have the data in the system
eSystem::ClipBoardArrive(clipboardID);
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
/**
* @brief Inform the Gui that we are the new owner of the clipboard
* @param ID of the clipboard (STD/SELECTION) only apear here
* @return ---
*/
void guiInterface::ClipBoardSet(ewol::clipBoard::clipboardListe_te clipboardID)
{
switch (clipboardID)
{
case ewol::clipBoard::CLIPBOARD_SELECTION:
// NOTE : nothing to do : Windows deas ot supported Middle button
break;
case ewol::clipBoard::CLIPBOARD_STD:
// Request the clipBoard :
if (false == l_clipBoardOwnerStd) {
// TODO : Inform the OS that we have the current buffer of copy ...
l_clipBoardOwnerStd = true;
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
#undef __class__
#define __class__ "guiInterface"
void guiInterface::Stop(void)
{
// TODO : send a message to the android system to stop ...
}
// java system to send message :
void SendSystemMessage(const char * dataString);
void SendJava_KeyboardShow(bool showIt);
void guiInterface::KeyboardShow(void)
{
// send a message at the java :
SendJava_KeyboardShow(true);
}
void guiInterface::KeyboardHide(void)
{
// send a message at the java :
SendJava_KeyboardShow(false);
}
void guiInterface::ChangeSize(Vector2D<int32_t> size)
{
// The size can not be change on android platform
}
void guiInterface::ChangePos(Vector2D<int32_t> size)
{
// The position can not be change on Android platform
}
void guiInterface::GetAbsPos(Vector2D<int32_t>& size)
{
size.x = 0;
size.y = 0;
}

View File

@ -620,3 +620,12 @@ void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
ReleaseDC( hWnd, hDC );
}
/**
* @brief Force the screen orientation (availlable on portable elements ...
* @param orientation Selected orientation.
* @return ---
*/
void guiInterface::ForceOrientation(ewol::orientation_te orientation)
{
// nothing to do ...
}

View File

@ -1188,3 +1188,12 @@ int main(int argc, char *argv[])
return 0;
}
/**
* @brief Force the screen orientation (availlable on portable elements ...
* @param orientation Selected orientation.
* @return ---
*/
void guiInterface::ForceOrientation(ewol::orientation_te orientation)
{
// nothing to do ...
}

View File

@ -95,6 +95,12 @@ namespace guiInterface
* @return ---
*/
void SetTitle(etk::UString& title);
/**
* @brief Force the screen orientation (availlable on portable elements ...
* @param orientation Selected orientation.
* @return ---
*/
void ForceOrientation(ewol::orientation_te orientation);
};

View File

@ -250,7 +250,7 @@ void ewol::Widget::GenDraw(DrawProperty displayProp)
m_size.y);
#ifdef __VIDEO__OPENGL_ES_2
etk::Matrix tmpTranslate = etk::matrix::Translate(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0);
etk::Matrix tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
etk::Matrix tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
etk::Matrix tmpProjection = etk::matrix::Perspective(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1);
etk::Matrix tmpMat = tmpProjection * tmpScale * tmpTranslate;
// set internal matrix system :

@ -1 +1 @@
Subproject commit 76748293c2611769297c2c97ed96dde8368bbbf0
Subproject commit 471ea3cba3bf82e9b9351ea18b6744b06558082d