[DEV] add correct version for Admods and back button and image part display

This commit is contained in:
Edouard DUPIN 2014-04-06 18:45:45 +02:00
parent 6a36013460
commit 32d55bcdc6
18 changed files with 206 additions and 44 deletions

2
build

@ -1 +1 @@
Subproject commit b48a5672b6c3a981160bb5ec61df46cde8d823a9
Subproject commit b7cc1ef456bc7635a1eff57f8c3e0919adb6b7a8

2
external/airtaudio vendored

@ -1 +1 @@
Subproject commit b30ff7808fe7205aa166dc4a856566a6ecfd9b85
Subproject commit 7ea04602a2cbf9b2ae26ff7ba1d338d773a413db

2
external/ogg vendored

@ -1 +1 @@
Subproject commit d0f4c63e4571e022cad80a25a9386483546aa334
Subproject commit 841f407905ad4f2d3434c20c4f3b4b4eec9ebdeb

View File

@ -82,8 +82,8 @@ public class Ewol {
EWaudioPlayback(instanceID, bufferData, frames, nbChannels);
}
public void keyboardEventKeySystem(int keyVal, boolean isDown) {
EWkeyboardEventKeySystem(instanceID, keyVal, isDown);
public boolean keyboardEventKeySystem(int keyVal, boolean isDown) {
return EWkeyboardEventKeySystem(instanceID, keyVal, isDown);
}
// renderer Event :
public void renderInit() {
@ -127,7 +127,7 @@ public class Ewol {
// Audio section ...
public native void EWaudioPlayback(int instanceId, short[] bufferData, int frames, int nbChannels);
private native void EWkeyboardEventKeySystem(int instanceId, int keyVal, boolean isDown);
private native boolean EWkeyboardEventKeySystem(int instanceId, int keyVal, boolean isDown);
// renderer Event :
private native void EWrenderInit(int instanceId);
private native void EWrenderResize(int instanceId, int w, int h);

View File

@ -47,15 +47,13 @@ import java.io.IOException;
import org.ewol.Ewol;
/**
* @brief Class :
*
*/
public abstract class EwolActivity extends Activity implements EwolCallback, EwolConstants {
private static Context mContext;
private EwolSurfaceViewGL mGLView;
protected EwolSurfaceViewGL mGLView = null;
private Ewol EWOL;
// clipboard section
private String tmpClipBoard; // TODO : Remove this ==> clipboard acces does not work
@ -63,6 +61,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
private EwolAudioTask mStreams;
private Thread mAudioThread;
private boolean mAudioStarted;
static {
try {
System.loadLibrary("ewol");

View File

@ -216,27 +216,24 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
Log.i("Surface GL", "get event : " + keyCode + " is down : " + isDown);
switch(keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, isDown);
return false;
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, isDown);
case KeyEvent.KEYCODE_VOLUME_UP:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, isDown);
return false;
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, isDown);
case KeyEvent.KEYCODE_MENU:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, isDown);
return false;
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, isDown);
case KeyEvent.KEYCODE_CAMERA:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, isDown);
return false;
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, isDown);
case KeyEvent.KEYCODE_HOME:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, isDown);
return false;
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, isDown);
case KeyEvent.KEYCODE_POWER:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, isDown);
return false;
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, isDown);
case KeyEvent.KEYCODE_BACK:
// the back key is wrapped in the <esc> key to simplify PC validation ...
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_BACK, isDown);
/*
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_BACK, isDown);
return false;
*/
case KeyEvent.KEYCODE_DEL:
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_DEL, isDown);
return true;

View File

@ -5,6 +5,7 @@
*
* @license BSD v3 (see license file)
*/
package org.ewol;
import android.app.ActivityManager;
@ -209,3 +210,5 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
return false;
}
}

View File

@ -589,6 +589,9 @@ class AndroidContext : public ewol::Context {
OS_SetKeyboard(m_guiKeyBoardSpecialKeyMode, _myChar, _isDown, _isARepeateKey);
}
bool ANDROID_systemKeyboradEvent(enum ewol::key::keyboardSystem _key, bool _down) {
return systemKeyboradEvent(_key, _down);
}
void ANDROID_SetKeyboardMove(int _move, bool _isDown, bool _isARepeateKey=false) {
// direct wrapping :
enum ewol::key::keyboard move = (enum ewol::key::keyboard)_move;
@ -956,7 +959,7 @@ extern "C" {
}
// TODO : set a return true or false if we want to grep this event ...
void Java_org_ewol_Ewol_EWkeyboardEventKeySystem(JNIEnv* _env,
bool Java_org_ewol_Ewol_EWkeyboardEventKeySystem(JNIEnv* _env,
jobject _thiz,
jint _id,
jint _keyVal,
@ -967,31 +970,35 @@ extern "C" {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
return false;
}
switch (_keyVal) {
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP:
EWOL_DEBUG("IO keyboard Key system \"VOLUME_UP\" is down=" << _isdown);
break;
EWOL_VERBOSE("IO keyboard Key system \"VOLUME_UP\" is down=" << _isdown);
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemVolumeUp, _isdown);
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_DOWN:
EWOL_DEBUG("IO keyboard Key system \"VOLUME_DOWN\" is down=" << _isdown);
break;
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemVolumeDown, _isdown);
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_MENU:
EWOL_DEBUG("IO keyboard Key system \"MENU\" is down=" << _isdown);
break;
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemMenu, _isdown);
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_CAMERA:
EWOL_DEBUG("IO keyboard Key system \"CAMERA\" is down=" << _isdown);
break;
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemCamera, _isdown);
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_HOME:
EWOL_DEBUG("IO keyboard Key system \"HOME\" is down=" << _isdown);
break;
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemHome, _isdown);
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_POWER:
EWOL_DEBUG("IO keyboard Key system \"POWER\" is down=" << _isdown);
break;
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemPower, _isdown);
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_BACK:
EWOL_DEBUG("IO keyboard Key system \"BACK\" is down=" << _isdown);
return s_listInstance[_id]->ANDROID_systemKeyboradEvent(ewol::key::keyboardSystemBack, _isdown);
default:
EWOL_DEBUG("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
EWOL_ERROR("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
break;
}
return false;
}

View File

@ -723,3 +723,14 @@ void ewol::Context::keyboardShow(void) {
void ewol::Context::keyboardHide(void) {
EWOL_INFO("keyboardHide: NOT implemented ...");
}
bool ewol::Context::systemKeyboradEvent(enum ewol::key::keyboardSystem _key, bool _down) {
if (m_windowsCurrent == NULL) {
return false;
}
lockContext();
bool ret = m_windowsCurrent->onEventHardwareInput(_key, _down);
unLockContext();
return ret;
}

View File

@ -337,6 +337,14 @@ namespace ewol {
* @param[in] _fileName Name of the image to load
*/
void setInitImage(const std::string& _fileName);
protected:
/**
* @brief HARDWARE keyboard event from the system
* @param[in] _key event type
* @param[in] _status Up or down status
* @return Keep the event or not
*/
virtual bool systemKeyboradEvent(enum ewol::key::keyboardSystem _key, bool _down);
};
/**
* @brief From everyware in the program, we can get the context inteface.

View File

@ -58,3 +58,23 @@ etk::CCout& ewol::key::operator <<(etk::CCout& _os, const enum ewol::key::keyboa
return _os;
}
static const char* keyboardSystemDescriptionString[ewol::key::keyboardSystemCount+1] = {
"keyboardSystemUnknow",
"keyboardSystemVolumeUp",
"keyboardSystemVolumeDown",
"keyboardSystemMenu",
"keyboardSystemCamera",
"keyboardSystemHome",
"keyboardSystemPower",
"keyboardSystemBack",
"keyboardSystemCount"
};
etk::CCout& ewol::key::operator <<(etk::CCout& _os, const enum ewol::key::keyboardSystem _obj) {
if (_obj >= 0 && _obj <ewol::key::keyboardSystemCount) {
_os << keyboardSystemDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}

View File

@ -62,6 +62,19 @@ namespace ewol {
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::keyboard _obj);
enum keyboardSystem {
keyboardSystemUnknow = 0, //!< Unknown keyboard system key
keyboardSystemVolumeUp, //!< Hardware volume UP key
keyboardSystemVolumeDown, //!< Hardware volume DOWN key
keyboardSystemMenu, //!< Hardware Menu key
keyboardSystemCamera, //!< Hardware Camera key
keyboardSystemHome, //!< Hardware Home key
keyboardSystemPower, //!< Hardware Power key
keyboardSystemBack, //!< Hardware Back key
keyboardSystemCount //!< number of posible System key
};
etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::keyboardSystem _obj);
};
};

View File

@ -337,7 +337,7 @@ ewol::GlyphProperty* ewol::resource::TexturedFont::getGlyphPointer(const char32_
}
ewol::resource::TexturedFont* ewol::resource::TexturedFont::keep(const std::string& _filename) {
EWOL_ERROR("KEEP : TexturedFont : file : '" << _filename << "'");
EWOL_INFO("KEEP : TexturedFont : file : '" << _filename << "'");
ewol::resource::TexturedFont* object = NULL;
ewol::Resource* object2 = getManager().localKeep(_filename);
if (NULL != object2) {
@ -351,7 +351,7 @@ ewol::resource::TexturedFont* ewol::resource::TexturedFont::keep(const std::stri
return object;
}
// need to crate a new one ...
EWOL_ERROR("CREATE: TexturedFont : file : '" << _filename << "'");
EWOL_INFO("CREATE: TexturedFont : file : '" << _filename << "'");
object = new ewol::resource::TexturedFont(_filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << _filename);
@ -365,7 +365,7 @@ void ewol::resource::TexturedFont::release(ewol::resource::TexturedFont*& _objec
if (NULL == _object) {
return;
}
EWOL_ERROR("RELEASE: TexturedFont : file : '" << _object->getName() << "' count=" << _object->getCounter());
EWOL_INFO("RELEASE: TexturedFont : file : '" << _object->getName() << "' count=" << _object->getCounter());
std::string name = _object->getName();
int32_t count = _object->getCounter() - 1;
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);

View File

@ -32,12 +32,16 @@ const char * const ewol::widget::Image::configSize = "size";
const char * const ewol::widget::Image::configBorder = "border";
const char * const ewol::widget::Image::configSource = "src";
const char * const ewol::widget::Image::configDistanceField = "distance-field";
const char * const ewol::widget::Image::configPartStart = "part-start";
const char * const ewol::widget::Image::configPartStop = "part-stop";
ewol::widget::Image::Image(const std::string& _file, const ewol::Dimension& _border) :
m_colorProperty(NULL),
m_colorId(-1),
m_imageSize(vec2(0,0)),
m_keepRatio(true) {
m_imageSize(vec2(0.0f,0.0f)),
m_keepRatio(true),
m_posStart(0.0f,0.0f),
m_posStop(1.0f,1.0f) {
addObjectType("ewol::widget::Image");
addEventId(eventPressed);
registerConfig(configRatio, "bool", NULL, "Keep ratio of the image");
@ -45,6 +49,8 @@ ewol::widget::Image::Image(const std::string& _file, const ewol::Dimension& _bor
registerConfig(configBorder, "Dimension", NULL, "Border of the image");
registerConfig(configSource, "string", "Image source path");
registerConfig(configDistanceField, "bool", "Distance field mode");
registerConfig(configPartStart, "vec2", NULL, "Start display position in the image [0.0 .. 1.0]");
registerConfig(configPartStop, "vec2", NULL, "Stop display position in the image [0.0 .. 1.0]");
m_colorProperty = ewol::resource::ColorFile::keep("THEME:COLOR:Image.json");
if (m_colorProperty != NULL) {
m_colorId = m_colorProperty->request("foreground");
@ -79,13 +85,36 @@ void ewol::widget::Image::setBorder(const ewol::Dimension& _border) {
}
void ewol::widget::Image::setKeepRatio(bool _keep) {
if (m_keepRatio != _keep) {
// copy data :
m_keepRatio = _keep;
// force redraw all :
markToRedraw();
requestUpdateSize();
if (m_keepRatio == _keep) {
return;
}
// copy data :
m_keepRatio = _keep;
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setStartPos(const vec2& _pos) {
if (m_posStart == _pos) {
return;
}
// copy data :
m_posStart = _pos;
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setStopPos(const vec2& _pos) {
if (m_posStop == _pos) {
return;
}
// copy data :
m_posStop = _pos;
// force redraw all :
markToRedraw();
requestUpdateSize();
}
void ewol::widget::Image::setImageSize(const ewol::Dimension& _size) {
@ -128,6 +157,9 @@ void ewol::widget::Image::onRegenerateDisplay(void) {
vec2 imageRealSize = m_minSize - imageBoder;
vec2 imageRealSizeMax = m_size - imageBoder;
vec2 ratioSizeDisplayRequested = m_posStop - m_posStart;
//imageRealSizeMax *= ratioSizeDisplayRequested;
if (m_userFill.x() == true) {
imageRealSize.setX(imageRealSizeMax.x());
} else {
@ -140,7 +172,9 @@ void ewol::widget::Image::onRegenerateDisplay(void) {
}
if (m_keepRatio == true) {
vec2 tmpSize = m_compositing.getRealSize();
float ratio = tmpSize.x() / tmpSize.y();
//float ratio = tmpSize.x() / tmpSize.y();
float ratio = (tmpSize.x()*ratioSizeDisplayRequested.x()) / (tmpSize.y() * ratioSizeDisplayRequested.y());
//float ratioCurrent = (imageRealSize.x()*ratioSizeDisplayRequested.x()) / (imageRealSize.y() * ratioSizeDisplayRequested.y());
float ratioCurrent = imageRealSize.x() / imageRealSize.y();
if (ratio == ratioCurrent) {
// nothing to do ...
@ -157,7 +191,7 @@ void ewol::widget::Image::onRegenerateDisplay(void) {
// set the somposition properties :
m_compositing.setPos(origin);
m_compositing.print(imageRealSize);
m_compositing.printPart(imageRealSize, m_posStart, m_posStop);
//EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize << " origin=" << origin);
EWOL_VERBOSE("Paint Image :" << m_fileName << " realsize=" << m_compositing.getRealSize() << " size=" << imageRealSize);
}
@ -258,6 +292,14 @@ bool ewol::widget::Image::onSetConfig(const ewol::object::Config& _conf) {
setDistanceField(std::stob(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPartStart) {
setStartPos(vec2(_conf.getData()));
return true;
}
if (_conf.getConfig() == configPartStop) {
setStopPos(vec2(_conf.getData()));
return true;
}
return false;
}
@ -285,6 +327,14 @@ bool ewol::widget::Image::onGetConfig(const char* _config, std::string& _result)
_result = std::to_string(getDistanceField());
return true;
}
if (_config == configPartStart) {
_result = (std::string)getStartPos();
return true;
}
if (_config == configPartStop) {
_result = (std::string)getStopPos();
return true;
}
return false;
}

View File

@ -32,6 +32,8 @@ namespace ewol {
static const char * const configBorder;
static const char * const configSource;
static const char * const configDistanceField;
static const char * const configPartStart;
static const char * const configPartStop;
public:
/**
* @brief Main call of recording the widget on the List of "widget named creator"
@ -117,6 +119,36 @@ namespace ewol {
bool getKeepRatio(void) const {
return m_keepRatio;
};
protected:
vec2 m_posStart; //!< position in the image to start the sisplay (when we want not to display all the image)
public:
/**
* @brief set the current 'start' position in the image to display.
* @param[in] _keep The new position in the image vec2([0..1],[0..1])
*/
void setStartPos(const vec2& _pos);
/**
* @brief get the current 'start' position in the image to display.
* @return The Position of the display in image
*/
vec2 getStartPos(void) const {
return m_posStart;
};
protected:
vec2 m_posStop; //!< position in the image to start the sisplay (when we want not to display all the image)
public:
/**
* @brief set the current 'stop' position in the image to display.
* @param[in] _keep The new position in the image vec2([0..1],[0..1])
*/
void setStopPos(const vec2& _pos);
/**
* @brief get the current 'stop' position in the image to display.
* @return The Position of the display in image
*/
vec2 getStopPos(void) const {
return m_posStop;
};
public:
/**
* @brief Set distance field rendering mode

View File

@ -180,6 +180,7 @@ void ewol::Widget::onObjectRemove(ewol::Object* _removeObject) {
void ewol::Widget::hide(void) {
if (m_hide == false) {
EWOL_WARNING("HIDE widget: '" << getName() << "'");
m_hide = true;
markToRedraw();
requestUpdateSize();
@ -188,6 +189,7 @@ void ewol::Widget::hide(void) {
void ewol::Widget::show(void) {
if (m_hide == true) {
EWOL_WARNING("SHOW widget: '" << getName() << "'");
m_hide = false;
markToRedraw();
requestUpdateSize();

View File

@ -201,6 +201,17 @@ void ewol::widget::Windows::popUpWidgetPush(ewol::Widget* _widget) {
getContext().resetIOEvent();
}
void ewol::widget::Windows::popUpWidgetPop(void) {
if (m_popUpWidgetList.size() == 0) {
return;
}
ewol::Widget* widget = m_popUpWidgetList[m_popUpWidgetList.size()-1];
if (widget == NULL) {
return;
}
widget->removeObject();
}
void ewol::widget::Windows::onObjectRemove(ewol::Object* _removeObject) {
// First step call parrent :
ewol::Widget::onObjectRemove(_removeObject);

View File

@ -57,6 +57,10 @@ namespace ewol {
public:
void setSubWidget(ewol::Widget* _widget);
void popUpWidgetPush(ewol::Widget* _widget);
void popUpWidgetPop(void);
size_t popUpCount(void) {
return m_popUpWidgetList.size();
}
private:
etk::Color<float> m_backgroundColor; //!< reset color of the Main windows
public:
@ -121,6 +125,11 @@ namespace ewol {
void displayCriticalMessage(const std::string& _message) {
createPopUpMessage(messageTypeCritical, _message);
}
virtual bool onEventHardwareInput(const ewol::key::keyboardSystem& _event, bool _down) {
return false;
};
};
};
};