From 4325aaecf2f43fa6d6bf0e652c8981963350301a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 4 Aug 2015 23:24:28 +0200 Subject: [PATCH] [DEV] UPDATE at gale architecture (BAD display) --- ewol/Dimension.cpp | 316 ------ ewol/Dimension.h | 212 ---- ewol/compositing/Area.cpp | 4 +- ewol/compositing/Area.h | 7 +- ewol/compositing/Drawing.cpp | 4 +- ewol/compositing/Drawing.h | 4 +- ewol/compositing/Image.cpp | 10 +- ewol/compositing/Image.h | 4 +- ewol/compositing/Shaper.cpp | 6 +- ewol/compositing/Shaper.h | 4 +- ewol/compositing/Sprite.h | 1 - ewol/compositing/Text.cpp | 8 +- ewol/compositing/TextBase.cpp | 4 +- ewol/compositing/TextBase.h | 2 +- ewol/compositing/TextDF.cpp | 8 +- ewol/context/Android/Context.cpp | 904 ----------------- ewol/context/Context.cpp | 667 ++++-------- ewol/context/Context.h | 211 +--- ewol/context/Fps.h | 141 --- ewol/context/IOs/AppDelegate.h | 20 - ewol/context/IOs/AppDelegate.mm | 97 -- ewol/context/IOs/Context.cpp | 273 ----- ewol/context/IOs/Context.h | 40 - ewol/context/IOs/Interface.h | 24 - ewol/context/IOs/Interface.m | 31 - ewol/context/IOs/OpenglView.h | 41 - ewol/context/IOs/OpenglView.mm | 281 ------ ewol/context/InputManager.cpp | 72 +- ewol/context/InputManager.h | 16 +- ewol/context/MacOs/AppDelegate.h | 16 - ewol/context/MacOs/AppDelegate.mm | 76 -- ewol/context/MacOs/Context.h | 30 - ewol/context/MacOs/Context.mm | 246 ----- ewol/context/MacOs/Interface.h | 24 - ewol/context/MacOs/Interface.mm | 104 -- ewol/context/MacOs/OpenglView.h | 21 - ewol/context/MacOs/OpenglView.mm | 70 -- ewol/context/MacOs/Windows.h | 39 - ewol/context/MacOs/Windows.mm | 443 -------- ewol/context/Windows/Context.cpp | 503 ---------- ewol/context/X11/Context.cpp | 1336 ------------------------- ewol/context/clipBoard.cpp | 130 --- ewol/context/clipBoard.h | 84 -- ewol/context/commandLine.cpp | 40 - ewol/context/commandLine.h | 48 - ewol/context/cursor.cpp | 45 - ewol/context/cursor.h | 50 - ewol/context/directFB/Context.cpp | 494 --------- ewol/event/Entry.cpp | 2 +- ewol/event/Entry.h | 32 +- ewol/event/Input.h | 30 +- ewol/ewol.cpp | 15 +- ewol/ewol.h | 3 + ewol/key/Special.cpp | 214 ---- ewol/key/Special.h | 121 --- ewol/key/key.h | 19 - ewol/key/keyboard.cpp | 80 -- ewol/key/keyboard.h | 84 -- ewol/key/status.cpp | 38 - ewol/key/status.h | 47 - ewol/key/type.cpp | 28 - ewol/key/type.h | 37 - ewol/resource/ColorFile.cpp | 7 +- ewol/resource/ColorFile.h | 4 +- ewol/resource/Colored3DObject.cpp | 25 +- ewol/resource/Colored3DObject.h | 4 +- ewol/resource/ConfigFile.cpp | 8 +- ewol/resource/ConfigFile.h | 4 +- ewol/resource/DistanceFieldFont.cpp | 4 +- ewol/resource/DistanceFieldFont.h | 1 - ewol/resource/FontFreeType.cpp | 6 +- ewol/resource/Image.cpp | 14 +- ewol/resource/Image.h | 1 - ewol/resource/ImageDF.cpp | 6 +- ewol/resource/ImageDF.h | 1 - ewol/resource/Manager.cpp | 193 ---- ewol/resource/Manager.h | 72 -- ewol/resource/Resource.cpp | 42 - ewol/resource/Resource.h | 166 --- ewol/resource/Texture.cpp | 108 ++ ewol/resource/Texture.h | 52 + ewol/resource/TexturedFont.cpp | 4 +- ewol/resource/TexturedFont.h | 1 - ewol/resource/font/FontBase.h | 8 +- ewol/widget/Button.cpp | 14 +- ewol/widget/ButtonColor.cpp | 8 +- ewol/widget/CheckBox.cpp | 14 +- ewol/widget/ColorBar.cpp | 4 +- ewol/widget/ContextMenu.cpp | 12 +- ewol/widget/Entry.cpp | 54 +- ewol/widget/Entry.h | 4 +- ewol/widget/Image.cpp | 6 +- ewol/widget/Image.h | 16 +- ewol/widget/Joystick.cpp | 8 +- ewol/widget/Label.cpp | 2 +- ewol/widget/List.h | 2 +- ewol/widget/ListFileSystem.cpp | 4 +- ewol/widget/ListFileSystem.h | 2 +- ewol/widget/PopUp.cpp | 2 +- ewol/widget/Scroll.cpp | 64 +- ewol/widget/Scroll.h | 2 +- ewol/widget/Sizer.h | 6 +- ewol/widget/Slider.cpp | 4 +- ewol/widget/Spacer.cpp | 2 +- ewol/widget/Widget.cpp | 85 +- ewol/widget/Widget.h | 39 +- ewol/widget/WidgetScrolled.cpp | 97 +- ewol/widget/WidgetScrolled.h | 2 +- ewol/widget/Windows.cpp | 26 +- ewol/widget/Windows.h | 5 +- ewol/widget/meta/Parameter.cpp | 6 +- ewol/widget/meta/ParameterList.cpp | 2 +- ewol/widget/meta/StdPopUp.cpp | 10 +- lutin_ewol.py | 20 +- sample/001_HelloWord/appl/Main.cpp | 2 +- sample/001_HelloWord/appl/Windows.cpp | 1 + 116 files changed, 829 insertions(+), 8388 deletions(-) delete mode 100644 ewol/Dimension.cpp delete mode 100644 ewol/Dimension.h delete mode 100644 ewol/context/Android/Context.cpp delete mode 100644 ewol/context/Fps.h delete mode 100644 ewol/context/IOs/AppDelegate.h delete mode 100644 ewol/context/IOs/AppDelegate.mm delete mode 100644 ewol/context/IOs/Context.cpp delete mode 100644 ewol/context/IOs/Context.h delete mode 100644 ewol/context/IOs/Interface.h delete mode 100644 ewol/context/IOs/Interface.m delete mode 100644 ewol/context/IOs/OpenglView.h delete mode 100644 ewol/context/IOs/OpenglView.mm delete mode 100644 ewol/context/MacOs/AppDelegate.h delete mode 100644 ewol/context/MacOs/AppDelegate.mm delete mode 100644 ewol/context/MacOs/Context.h delete mode 100644 ewol/context/MacOs/Context.mm delete mode 100644 ewol/context/MacOs/Interface.h delete mode 100644 ewol/context/MacOs/Interface.mm delete mode 100644 ewol/context/MacOs/OpenglView.h delete mode 100644 ewol/context/MacOs/OpenglView.mm delete mode 100644 ewol/context/MacOs/Windows.h delete mode 100644 ewol/context/MacOs/Windows.mm delete mode 100644 ewol/context/Windows/Context.cpp delete mode 100644 ewol/context/X11/Context.cpp delete mode 100644 ewol/context/clipBoard.cpp delete mode 100644 ewol/context/clipBoard.h delete mode 100644 ewol/context/commandLine.cpp delete mode 100644 ewol/context/commandLine.h delete mode 100644 ewol/context/cursor.cpp delete mode 100644 ewol/context/cursor.h delete mode 100644 ewol/context/directFB/Context.cpp delete mode 100644 ewol/key/Special.cpp delete mode 100644 ewol/key/Special.h delete mode 100644 ewol/key/key.h delete mode 100644 ewol/key/keyboard.cpp delete mode 100644 ewol/key/keyboard.h delete mode 100644 ewol/key/status.cpp delete mode 100644 ewol/key/status.h delete mode 100644 ewol/key/type.cpp delete mode 100644 ewol/key/type.h delete mode 100644 ewol/resource/Manager.cpp delete mode 100644 ewol/resource/Manager.h delete mode 100644 ewol/resource/Resource.cpp delete mode 100644 ewol/resource/Resource.h create mode 100644 ewol/resource/Texture.cpp create mode 100644 ewol/resource/Texture.h diff --git a/ewol/Dimension.cpp b/ewol/Dimension.cpp deleted file mode 100644 index b993327c..00000000 --- a/ewol/Dimension.cpp +++ /dev/null @@ -1,316 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include - -#undef __class__ -#define __class__ "Dimension" - -// TODO : set this in a super class acced in a statin fuction... -// ratio in milimeter : -static bool isInit = false; -static vec2 ratio(9999999,888888); -static vec2 invRatio(1,1); -static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel); - -static const float inchToMillimeter = 1.0f/25.4f; -static const float footToMillimeter = 1.0f/304.8f; -static const float meterToMillimeter = 1.0f/1000.0f; -static const float centimeterToMillimeter = 1.0f/10.0f; -static const float kilometerToMillimeter = 1.0f/1000000.0f; -static const float millimeterToInch = 25.4f; -static const float millimeterToFoot = 304.8f; -static const float millimeterToMeter =1000.0f; -static const float millimeterToCentimeter = 10.0f; -static const float millimeterToKilometer = 1000000.0f; - - -void ewol::Dimension::init() { - if (true == isInit) { - return; - } - ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch); - ratio = conversion.getMillimeter(); - invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); - windowsSize.set(vec2(200,200), ewol::Dimension::Pixel); - isInit = true; -} - -void ewol::Dimension::unInit() { - isInit = false; - ratio.setValue(9999999,888888); - invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); - windowsSize.set(vec2(9999999,88888), ewol::Dimension::Pixel); -} - -void ewol::Dimension::setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type) { - ewol::Dimension::init(); - EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type); - ewol::Dimension conversion(_ratio, _type); - EWOL_INFO(" == > " << conversion); - ratio = conversion.getMillimeter(); - invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); - EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio); -} - -void ewol::Dimension::setPixelWindowsSize(const vec2& _size) { - windowsSize = _size; - EWOL_VERBOSE("Set a new Windows property size " << windowsSize << "px"); -} - -vec2 ewol::Dimension::getWindowsSize(enum ewol::Dimension::distance _type) { - return windowsSize.get(_type); -} - -float ewol::Dimension::getWindowsDiag(enum ewol::Dimension::distance _type) { - vec2 size = ewol::Dimension::getWindowsSize(_type); - return size.length(); -} - -ewol::Dimension::Dimension() : - m_data(0,0), - m_type(ewol::Dimension::Pixel) { - // notinh to do ... -} - -ewol::Dimension::Dimension(const vec2& _size, enum ewol::Dimension::distance _type) : - m_data(0,0), - m_type(ewol::Dimension::Pixel) { - set(_size, _type); -} - -void ewol::Dimension::set(std::string _config) { - m_data.setValue(0,0); - m_type = ewol::Dimension::Pixel; - enum distance type = ewol::Dimension::Pixel; - if (etk::end_with(_config, "%", false) == true) { - type = ewol::Dimension::Pourcent; - _config.erase(_config.size()-1, 1); - } else if (etk::end_with(_config, "px",false) == true) { - type = ewol::Dimension::Pixel; - _config.erase(_config.size()-2, 2); - } else if (etk::end_with(_config, "ft",false) == true) { - type = ewol::Dimension::foot; - _config.erase(_config.size()-2, 2); - } else if (etk::end_with(_config, "in",false) == true) { - type = ewol::Dimension::Inch; - _config.erase(_config.size()-2, 2); - } else if (etk::end_with(_config, "km",false) == true) { - type = ewol::Dimension::Kilometer; - _config.erase(_config.size()-2, 2); - } else if (etk::end_with(_config, "mm",false) == true) { - type = ewol::Dimension::Millimeter; - _config.erase(_config.size()-2, 2); - } else if (etk::end_with(_config, "cm",false) == true) { - type = ewol::Dimension::Centimeter; - _config.erase(_config.size()-2, 2); - } else if (etk::end_with(_config, "m",false) == true) { - type = ewol::Dimension::Meter; - _config.erase(_config.size()-1, 1); - } else { - EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\""); - return; - } - vec2 tmp = _config; - set(tmp, type); - EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this ); -} - -ewol::Dimension::~Dimension() { - // nothing to do ... -} - -ewol::Dimension::operator std::string() const { - std::string str; - str = get(getType()); - - switch(getType()) { - case ewol::Dimension::Pourcent: - str += "%"; - break; - case ewol::Dimension::Pixel: - str += "px"; - break; - case ewol::Dimension::Meter: - str += "m"; - break; - case ewol::Dimension::Centimeter: - str += "cm"; - break; - case ewol::Dimension::Millimeter: - str += "mm"; - break; - case ewol::Dimension::Kilometer: - str += "km"; - break; - case ewol::Dimension::Inch: - str += "in"; - break; - case ewol::Dimension::foot: - str += "ft"; - break; - } - return str; -} - -vec2 ewol::Dimension::get(enum ewol::Dimension::distance _type) const { - switch(_type) { - case ewol::Dimension::Pourcent: - return getPourcent(); - case ewol::Dimension::Pixel: - return getPixel(); - case ewol::Dimension::Meter: - return getMeter(); - case ewol::Dimension::Centimeter: - return getCentimeter(); - case ewol::Dimension::Millimeter: - return getMillimeter(); - case ewol::Dimension::Kilometer: - return getKilometer(); - case ewol::Dimension::Inch: - return getInch(); - case ewol::Dimension::foot: - return getFoot(); - } - return vec2(0,0); -} - -void ewol::Dimension::set(const vec2& _size, enum ewol::Dimension::distance _type) { - // set min max on input to limit error : - vec2 size(std::avg(0.0f,_size.x(),9999999.0f), - std::avg(0.0f,_size.y(),9999999.0f)); - switch(_type) { - case ewol::Dimension::Pourcent: { - vec2 size2(std::avg(0.0f,_size.x(),100.0f), - std::avg(0.0f,_size.y(),100.0f)); - m_data = vec2(size2.x()*0.01f, size2.y()*0.01f); - //EWOL_VERBOSE("Set % : " << size2 << " == > " << m_data); - break; - } - case ewol::Dimension::Pixel: - m_data = size; - break; - case ewol::Dimension::Meter: - m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y()); - break; - case ewol::Dimension::Centimeter: - m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y()); - break; - case ewol::Dimension::Millimeter: - m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y()); - break; - case ewol::Dimension::Kilometer: - m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y()); - break; - case ewol::Dimension::Inch: - m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y()); - break; - case ewol::Dimension::foot: - m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y()); - break; - } - m_type = _type; -} - -vec2 ewol::Dimension::getPixel() const { - if (m_type!=ewol::Dimension::Pourcent) { - return m_data; - } else { - vec2 windDim = windowsSize.getPixel(); - vec2 res = vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y()); - //EWOL_DEBUG("Get % : " << m_data << " / " << windDim << " == > " << res); - return res; - } -} - -vec2 ewol::Dimension::getPourcent() const { - if (m_type!=ewol::Dimension::Pourcent) { - vec2 windDim = windowsSize.getPixel(); - //EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ... - //printf(" windows dimention : %f,%f", windDim.x(),windDim.y()); - //printf(" data : %f,%f", m_data.x(),m_data.y()); - return vec2((m_data.x()/windDim.x())*100.0f, (m_data.y()/windDim.y())*100.0f); - } - return vec2(m_data.x()*100.0f, m_data.y()*100.0f);; -} - -vec2 ewol::Dimension::getMeter() const { - return ewol::Dimension::getMillimeter()*millimeterToMeter; -} - -vec2 ewol::Dimension::getCentimeter() const { - return ewol::Dimension::getMillimeter()*millimeterToCentimeter; -} - -vec2 ewol::Dimension::getMillimeter() const { - return ewol::Dimension::getPixel()*invRatio; -} - -vec2 ewol::Dimension::getKilometer() const { - return ewol::Dimension::getMillimeter()*millimeterToKilometer; -} - -vec2 ewol::Dimension::getInch() const { - return ewol::Dimension::getMillimeter()*millimeterToInch; -} - -vec2 ewol::Dimension::getFoot() const { - return ewol::Dimension::getMillimeter()*millimeterToFoot; -} - -std::ostream& ewol::operator <<(std::ostream& _os, enum ewol::Dimension::distance _obj) { - switch(_obj) { - case ewol::Dimension::Pourcent: - _os << "%"; - break; - case ewol::Dimension::Pixel: - _os << "px"; - break; - case ewol::Dimension::Meter: - _os << "m"; - break; - case ewol::Dimension::Centimeter: - _os << "cm"; - break; - case ewol::Dimension::Millimeter: - _os << "mm"; - break; - case ewol::Dimension::Kilometer: - _os << "km"; - break; - case ewol::Dimension::Inch: - _os << "in"; - break; - case ewol::Dimension::foot: - _os << "ft"; - break; - } - return _os; -} - -std::ostream& ewol::operator <<(std::ostream& _os, const ewol::Dimension& _obj) { - _os << _obj.get(_obj.getType()) << _obj.getType(); - return _os; -} - -namespace etk { - template<> std::string to_string(const ewol::Dimension& _obj) { - return _obj; - } - template<> std::u32string to_u32string(const ewol::Dimension& _obj) { - return etk::to_u32string(etk::to_string(_obj)); - } - template<> bool from_string(ewol::Dimension& _variableRet, const std::string& _value) { - _variableRet = ewol::Dimension(_value); - return true; - } - template<> bool from_string(ewol::Dimension& _variableRet, const std::u32string& _value) { - return from_string(_variableRet, etk::to_string(_value)); - } -}; diff --git a/ewol/Dimension.h b/ewol/Dimension.h deleted file mode 100644 index 9939d8ed..00000000 --- a/ewol/Dimension.h +++ /dev/null @@ -1,212 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_DIMENSION_H__ -#define __EWOL_DIMENSION_H__ - -#include -#include -#include - -namespace ewol { - /** - * @brief in the dimention class we store the data as the more usefull unit (pixel) - * but one case need to be dynamic the %, then when requested in % the register the % value - */ - class Dimension { - public: - enum distance { - Pourcent=0, - Pixel, - Meter, - Centimeter, - Millimeter, - Kilometer, - Inch, - foot, - }; - private: - vec2 m_data; - enum distance m_type; - public: - /** - * @brief Constructor (default :0,0 mode pixel) - */ - Dimension(); - /** - * @brief Constructor - * @param[in] _size Requested dimention - * @param[in] _type Unit of the Dimention - */ - Dimension(const vec2& _size, enum ewol::Dimension::distance _type=ewol::Dimension::Pixel); - /** - * @brief Constructor - * @param[in] _config dimension configuration. - */ - Dimension(const std::string& _config) : - m_data(0,0), - m_type(ewol::Dimension::Pixel) { - set(_config); - }; - /** - * @brief Constructor - * @param[in] _config dimension configuration. - */ - Dimension(const char* _config) : - m_data(0,0), - m_type(ewol::Dimension::Pixel) { - set(_config); - }; - /** - * @brief Destructor - */ - ~Dimension(); - - /** - * @brief string cast : - */ - operator std::string() const; - - /** - * @brief get the current dimention in requested type - * @param[in] _type Type of unit requested. - * @return dimention requested. - */ - vec2 get(enum distance _type) const; - /** - * @brief set the current dimention in requested type - * @param[in] _size Dimention to set - * @param[in] _type Type of unit requested. - */ - void set(const vec2& _size, enum distance _type); - - private: - /** - * @brief set the current dimention in requested type - * @param[in] _config dimension configuration. - */ - void set(std::string _config); - public: - /** - * @brief get the current dimention in pixel - * @return dimention in Pixel - */ - vec2 getPixel() const; - /** - * @brief get the current dimention in Pourcent - * @return dimention in Pourcent - */ - vec2 getPourcent() const; - /** - * @brief get the current dimention in Meter - * @return dimention in Meter - */ - vec2 getMeter() const; - /** - * @brief get the current dimention in Centimeter - * @return dimention in Centimeter - */ - vec2 getCentimeter() const; - /** - * @brief get the current dimention in Millimeter - * @return dimention in Millimeter - */ - vec2 getMillimeter() const; - /** - * @brief get the current dimention in Kilometer - * @return dimention in Kilometer - */ - vec2 getKilometer() const; - /** - * @brief get the current dimention in Inch - * @return dimention in Inch - */ - vec2 getInch() const; - /** - * @brief get the current dimention in Foot - * @return dimention in Foot - */ - vec2 getFoot() const; - /***************************************************** - * = assigment - *****************************************************/ - const Dimension& operator= (const Dimension& _obj ) { - if (this!=&_obj) { - m_data = _obj.m_data; - m_type = _obj.m_type; - } - return *this; - } - /***************************************************** - * == operator - *****************************************************/ - bool operator == (const Dimension& _obj) const { - if( m_data == _obj.m_data - && m_type == _obj.m_type) { - return true; - } - return false; - } - /***************************************************** - * != operator - *****************************************************/ - bool operator!= (const Dimension& _obj) const { - if( m_data != _obj.m_data - || m_type != _obj.m_type) { - return true; - } - return false; - } - /** - * @breif get the dimension type - * @return the type - */ - enum distance getType() const { - return m_type; - }; - public : // Global static access : - /** - * @brief basic init - */ - static void init(); - /** - * @brief basic un-init - */ - static void unInit(); - /** - * @brief set the Milimeter ratio for calculation - * @param[in] Ratio Milimeter ration for the screen calculation interpolation - * @param[in] type Unit type requested. - * @note: same as @ref setPixelPerInch (internal manage convertion) - */ - static void setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type); - /** - * @brief set the current Windows size - * @param[in] size size of the current windows in pixel. - */ - static void setPixelWindowsSize(const vec2& _size); - /** - * @brief get the Windows size in the request unit - * @param[in] type Unit type requested. - * @return the requested size - */ - static vec2 getWindowsSize(enum ewol::Dimension::distance _type); - /** - * @brief get the Windows diagonal size in the request unit - * @param[in] type Unit type requested. - * @return the requested size - */ - static float getWindowsDiag(enum ewol::Dimension::distance _type); - - }; - std::ostream& operator <<(std::ostream& _os, enum ewol::Dimension::distance _obj); - std::ostream& operator <<(std::ostream& _os, const ewol::Dimension& _obj); -}; - -#endif - diff --git a/ewol/compositing/Area.cpp b/ewol/compositing/Area.cpp index 9e672fe3..e18d9c70 100644 --- a/ewol/compositing/Area.cpp +++ b/ewol/compositing/Area.cpp @@ -22,7 +22,7 @@ ewol::compositing::Area::Area(const ivec2& _size) : m_GLtexture(-1), m_GLtexID(-1), m_resource(nullptr) { - m_resource = gale::resource::Texture::create(); + m_resource = ewol::resource::Texture::create(); m_resource->setImageSize(_size); m_resource->flush(); loadProgram(); @@ -71,7 +71,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) { // color : m_GLprogram->sendAttribute(m_GLColor, m_coordColor); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); } diff --git a/ewol/compositing/Area.h b/ewol/compositing/Area.h index 2adc4020..6870c4c9 100644 --- a/ewol/compositing/Area.h +++ b/ewol/compositing/Area.h @@ -13,7 +13,8 @@ #include #include #include -#include +#include +#include namespace ewol { namespace compositing { @@ -29,7 +30,7 @@ namespace ewol { int32_t m_GLtexture; //!< openGL id on the element (Texture position) int32_t m_GLtexID; //!< openGL id on the element (texture ID) private: - std::shared_ptr m_resource; //!< texture resources + std::shared_ptr m_resource; //!< texture resources std::vector m_coord; //!< internal coord of the object std::vector m_coordTex; //!< internal texture coordinate for every point std::vector > m_coordColor; //!< internal color of the different point @@ -90,9 +91,11 @@ namespace ewol { */ void print(const ivec2& _size); + /* egami::Image& get() { return m_resource->get(); }; + */ void flush() { m_resource->flush(); }; diff --git a/ewol/compositing/Drawing.cpp b/ewol/compositing/Drawing.cpp index 013f25c9..506dadef 100644 --- a/ewol/compositing/Drawing.cpp +++ b/ewol/compositing/Drawing.cpp @@ -285,7 +285,7 @@ void ewol::compositing::Drawing::loadProgram() { // remove previous loading ... in case unLoadProgram(); // oad the new ... - m_GLprogram = ewol::resource::Program::create("DATA:color3.prog"); + m_GLprogram = gale::resource::Program::create("DATA:color3.prog"); // get the shader resource : if (nullptr != m_GLprogram ) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); @@ -316,7 +316,7 @@ void ewol::compositing::Drawing::draw(bool _disableDepthTest) { // color : m_GLprogram->sendAttribute(m_GLColor, m_coordColor); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); } diff --git a/ewol/compositing/Drawing.h b/ewol/compositing/Drawing.h index dfdff3a8..7dfab715 100644 --- a/ewol/compositing/Drawing.h +++ b/ewol/compositing/Drawing.h @@ -13,7 +13,7 @@ #include #include -#include +#include namespace ewol { @@ -28,7 +28,7 @@ namespace ewol { etk::Color<> m_color; //!< The text foreground color etk::Color<> m_colorBg; //!< The text background color private: - std::shared_ptr m_GLprogram; //!< pointer on the opengl display program + std::shared_ptr m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLMatrixPosition; //!< position matrix diff --git a/ewol/compositing/Image.cpp b/ewol/compositing/Image.cpp index aa60a2cb..67dda957 100644 --- a/ewol/compositing/Image.cpp +++ b/ewol/compositing/Image.cpp @@ -43,9 +43,9 @@ void ewol::compositing::Image::loadProgram() { m_GLPosition = 0; m_GLprogram.reset(); if (m_distanceFieldMode == true) { - m_GLprogram = ewol::resource::Program::create("DATA:texturedDF.prog"); + m_GLprogram = gale::resource::Program::create("DATA:texturedDF.prog"); } else { - m_GLprogram = ewol::resource::Program::create("DATA:textured3D.prog"); + m_GLprogram = gale::resource::Program::create("DATA:textured3D.prog"); } if (m_GLprogram != nullptr) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); @@ -71,9 +71,9 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) { return; } if (_disableDepthTest == true) { - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_depthTest); } else { - gale::openGL::enable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::enable(gale::openGL::flag_depthTest); } // set Matrix : translation/positionMatrix mat4 tmpMatrix = gale::openGL::getMatrix()*m_matrixApply; @@ -98,7 +98,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) { // color : m_GLprogram->sendAttribute(m_GLColor, m_coordColor); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); } diff --git a/ewol/compositing/Image.h b/ewol/compositing/Image.h index ec9e8545..af844d5e 100644 --- a/ewol/compositing/Image.h +++ b/ewol/compositing/Image.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -29,7 +29,7 @@ namespace ewol { etk::Color<> m_color; //!< The text foreground color float m_angle; //!< Angle to set at the axes private: - std::shared_ptr m_GLprogram; //!< pointer on the opengl display program + std::shared_ptr m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLColor; //!< openGL id on the element (color buffer) diff --git a/ewol/compositing/Shaper.cpp b/ewol/compositing/Shaper.cpp index ed73cca2..6019559c 100644 --- a/ewol/compositing/Shaper.cpp +++ b/ewol/compositing/Shaper.cpp @@ -118,7 +118,7 @@ void ewol::compositing::Shaper::loadProgram() { } // get the shader resource : m_GLPosition = 0; - m_GLprogram = ewol::resource::Program::create(tmpFilename); + m_GLprogram = gale::resource::Program::create(tmpFilename); if (m_GLprogram != nullptr) { m_GLPosition = m_GLprogram->getAttribute("EW_coord2d"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation"); @@ -202,8 +202,8 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) { m_GLprogram->setTexture0(m_GLtexID, m_resourceTexture->getId()); } // Request the draw of the elements : - //gale::openGL::drawArrays(GL_TRIANGLES, 0, SHAPER_NB_MAX_VERTEX); - gale::openGL::drawArrays(GL_TRIANGLE_STRIP, 0, m_nbVertexToDisplay); + //gale::openGL::drawArrays(gale::openGL::render_triangle, 0, SHAPER_NB_MAX_VERTEX); + gale::openGL::drawArrays(gale::openGL::render_triangleStrip, 0, m_nbVertexToDisplay); m_GLprogram->unUse(); } diff --git a/ewol/compositing/Shaper.h b/ewol/compositing/Shaper.h index 0322ec84..fd70d786 100644 --- a/ewol/compositing/Shaper.h +++ b/ewol/compositing/Shaper.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -55,7 +55,7 @@ namespace ewol { int32_t m_confColorFile; //!< ConfigFile opengGl color file Name int32_t m_confImageFile; //!< ConfigFile opengGl program Name // openGL shaders programs: - std::shared_ptr m_GLprogram; //!< pointer on the opengl display program + std::shared_ptr m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLPropertyPos; //!< openGL id on the element (simple ratio position in the widget : ____/-----\_____ on vec2(X,Y)) diff --git a/ewol/compositing/Sprite.h b/ewol/compositing/Sprite.h index 2588f790..363b56cb 100644 --- a/ewol/compositing/Sprite.h +++ b/ewol/compositing/Sprite.h @@ -11,7 +11,6 @@ #include #include -#include namespace ewol { namespace compositing { diff --git a/ewol/compositing/Text.cpp b/ewol/compositing/Text.cpp index 1216776e..8d1bae5a 100644 --- a/ewol/compositing/Text.cpp +++ b/ewol/compositing/Text.cpp @@ -44,7 +44,7 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en return; } if (_enableDepthTest == true) { - gale::openGL::enable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::enable(gale::openGL::flag_depthTest); } // set Matrix : translation/positionMatrix mat4 projMatrix = gale::openGL::getMatrix(); @@ -63,10 +63,10 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en // color : m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); if (_enableDepthTest == true) { - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_depthTest); } } @@ -102,7 +102,7 @@ void ewol::compositing::Text::drawD(bool _disableDepthTest) { // color : m_GLprogram->sendAttribute(m_GLColor, m_coordColor); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); } diff --git a/ewol/compositing/TextBase.cpp b/ewol/compositing/TextBase.cpp index 9977d3c8..ab5a49c3 100644 --- a/ewol/compositing/TextBase.cpp +++ b/ewol/compositing/TextBase.cpp @@ -53,8 +53,8 @@ ewol::compositing::TextBase::~TextBase() { void ewol::compositing::TextBase::loadProgram(const std::string& _shaderName) { // get the shader resource : m_GLPosition = 0; - std::shared_ptr old = m_GLprogram; - m_GLprogram = ewol::resource::Program::create(_shaderName); + std::shared_ptr old = m_GLprogram; + m_GLprogram = gale::resource::Program::create(_shaderName); if (m_GLprogram != nullptr) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLColor = m_GLprogram->getAttribute("EW_color"); diff --git a/ewol/compositing/TextBase.h b/ewol/compositing/TextBase.h index 57a89c7a..fb58ec96 100644 --- a/ewol/compositing/TextBase.h +++ b/ewol/compositing/TextBase.h @@ -77,7 +77,7 @@ namespace ewol { float m_stopTextPos; //!< end of the alignement (when a string is too hight it cut at the word previously this virtual line and the center is perform with this one) enum aligneMode m_alignement; //!< Current Alignement mode (justify/left/right ...) protected: - std::shared_ptr m_GLprogram; //!< pointer on the opengl display program + std::shared_ptr m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLColor; //!< openGL id on the element (color buffer) diff --git a/ewol/compositing/TextDF.cpp b/ewol/compositing/TextDF.cpp index fb588446..d378624b 100644 --- a/ewol/compositing/TextDF.cpp +++ b/ewol/compositing/TextDF.cpp @@ -55,7 +55,7 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _ return; } if (_enableDepthTest == true) { - gale::openGL::enable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::enable(gale::openGL::flag_depthTest); } // set Matrix : translation/positionMatrix mat4 projMatrix = gale::openGL::getMatrix(); @@ -72,10 +72,10 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _ m_GLprogram->sendAttribute(m_GLColor, m_coordColor); m_GLprogram->sendAttribute(m_GLglyphLevel, m_glyphLevel); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); if (_enableDepthTest == true) { - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_depthTest); } } @@ -110,7 +110,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) { m_GLprogram->sendAttribute(m_GLColor, m_coordColor); m_GLprogram->sendAttribute(m_GLglyphLevel, m_glyphLevel); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, m_coord.size()); m_GLprogram->unUse(); } diff --git a/ewol/context/Android/Context.cpp b/ewol/context/Android/Context.cpp deleted file mode 100644 index 34687c45..00000000 --- a/ewol/context/Android/Context.cpp +++ /dev/null @@ -1,904 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* include auto generated file */ -#include -#include - - -int64_t ewol::getTime() { - struct timeval now; - gettimeofday(&now, nullptr); - //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); -} - - -// jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include - -std::mutex g_interfaceMutex; - - -class AndroidContext : public ewol::Context { - public: - enum application { - appl_unknow, - appl_application, - appl_wallpaper - }; - private: - enum application m_javaApplicationType; - // get a resources from the java environement : - JNIEnv* m_JavaVirtualMachinePointer; //!< the JVM - jclass m_javaClassEwol; //!< main activity class (android ...) - jclass m_javaClassEwolCallback; - jobject m_javaObjectEwolCallback; - jmethodID m_javaMethodEwolCallbackStop; //!< Stop function identifier - jmethodID m_javaMethodEwolCallbackEventNotifier; //!< basic methode to call ... - jmethodID m_javaMethodEwolCallbackKeyboardUpdate; //!< basic methode to call ... - jmethodID m_javaMethodEwolCallbackOrientationUpdate; - jmethodID m_javaMethodEwolActivitySetTitle; - jmethodID m_javaMethodEwolActivityOpenURI; - jmethodID m_javaMethodEwolActivitySetClipBoardString; - jmethodID m_javaMethodEwolActivityGetClipBoardString; - jclass m_javaDefaultClassString; //!< default string class - int32_t m_currentHeight; - ewol::key::Special m_guiKeyBoardSpecialKeyMode;//!< special key of the android system : - bool m_clipBoardOwnerStd; - private: - bool safeInitMethodID(jmethodID& _mid, jclass& _cls, const char* _name, const char* _sign) { - _mid = m_JavaVirtualMachinePointer->GetMethodID(_cls, _name, _sign); - if(_mid == nullptr) { - EWOL_ERROR("C->java : Can't find the method " << _name); - /* remove access on the virtual machine : */ - m_JavaVirtualMachinePointer = nullptr; - return false; - } - return true; - } - public: - AndroidContext(ewol::context::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) : - ewol::Context(_application), - m_javaApplicationType(_typeAPPL), - m_JavaVirtualMachinePointer(nullptr), - m_javaClassEwol(0), - m_javaClassEwolCallback(0), - m_javaObjectEwolCallback(0), - m_javaMethodEwolCallbackStop(0), - m_javaMethodEwolCallbackEventNotifier(0), - m_javaMethodEwolCallbackKeyboardUpdate(0), - m_javaMethodEwolCallbackOrientationUpdate(0), - m_javaMethodEwolActivitySetTitle(0), - m_javaMethodEwolActivityOpenURI(0), - m_javaMethodEwolActivitySetClipBoardString(0), - m_javaMethodEwolActivityGetClipBoardString(0), - m_javaDefaultClassString(0), - m_currentHeight(0), - m_clipBoardOwnerStd(false) { - EWOL_DEBUG("*******************************************"); - if (m_javaApplicationType == appl_application) { - EWOL_DEBUG("** set JVM Pointer (application) **"); - } else { - EWOL_DEBUG("** set JVM Pointer (LiveWallpaper) **"); - } - EWOL_DEBUG("*******************************************"); - m_JavaVirtualMachinePointer = _env; - // get default needed all time elements : - if (nullptr != m_JavaVirtualMachinePointer) { - EWOL_DEBUG("C->java : try load org/ewol/Ewol class"); - m_javaClassEwol = m_JavaVirtualMachinePointer->FindClass("org/ewol/Ewol" ); - if (m_javaClassEwol == 0) { - EWOL_ERROR("C->java : Can't find org/ewol/Ewol class"); - // remove access on the virtual machine : - m_JavaVirtualMachinePointer = nullptr; - return; - } - /* The object field extends Activity and implement EwolCallback */ - m_javaClassEwolCallback = m_JavaVirtualMachinePointer->GetObjectClass(_objCallback); - if(m_javaClassEwolCallback == nullptr) { - EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class"); - // remove access on the virtual machine : - m_JavaVirtualMachinePointer = nullptr; - return; - } - bool functionCallbackIsMissing = false; - bool ret= false; - ret = safeInitMethodID(m_javaMethodEwolActivitySetTitle, - m_javaClassEwolCallback, - "titleSet", - "(Ljava/lang/String;)V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : titleSet"); - functionCallbackIsMissing = true; - } - ret = safeInitMethodID(m_javaMethodEwolActivityOpenURI, - m_javaClassEwolCallback, - "openURI", - "(Ljava/lang/String;)V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : openURI"); - functionCallbackIsMissing = true; - } - - ret = safeInitMethodID(m_javaMethodEwolCallbackStop, - m_javaClassEwolCallback, - "stop", - "()V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : stop"); - functionCallbackIsMissing = true; - } - - ret = safeInitMethodID(m_javaMethodEwolCallbackEventNotifier, - m_javaClassEwolCallback, - "eventNotifier", - "([Ljava/lang/String;)V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : eventNotifier"); - functionCallbackIsMissing = true; - } - - ret = safeInitMethodID(m_javaMethodEwolCallbackKeyboardUpdate, - m_javaClassEwolCallback, - "keyboardUpdate", - "(Z)V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : keyboardUpdate"); - functionCallbackIsMissing = true; - } - - ret = safeInitMethodID(m_javaMethodEwolCallbackOrientationUpdate, - m_javaClassEwolCallback, - "orientationUpdate", - "(I)V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : orientationUpdate"); - functionCallbackIsMissing = true; - } - - ret = safeInitMethodID(m_javaMethodEwolActivitySetClipBoardString, - m_javaClassEwolCallback, - "setClipBoardString", - "(Ljava/lang/String;)V"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : setClipBoardString"); - functionCallbackIsMissing = true; - } - - ret = safeInitMethodID(m_javaMethodEwolActivityGetClipBoardString, - m_javaClassEwolCallback, - "getClipBoardString", - "()Ljava/lang/String;"); - if (ret == false) { - jvm_basics::checkExceptionJavaVM(_env); - EWOL_ERROR("system can not start without function : getClipBoardString"); - functionCallbackIsMissing = true; - } - - m_javaObjectEwolCallback = _env->NewGlobalRef(_objCallback); - //javaObjectEwolCallbackAndActivity = objCallback; - if (m_javaObjectEwolCallback == nullptr) { - functionCallbackIsMissing = true; - } - - m_javaDefaultClassString = m_JavaVirtualMachinePointer->FindClass("java/lang/String" ); - if (m_javaDefaultClassString == 0) { - EWOL_ERROR("C->java : Can't find java/lang/String" ); - // remove access on the virtual machine : - m_JavaVirtualMachinePointer = nullptr; - functionCallbackIsMissing = true; - } - if (functionCallbackIsMissing == true) { - EWOL_CRITICAL(" mission one function ==> system can not work withut it..."); - } - } - } - - ~AndroidContext() { - // TODO ... - } - - void unInit(JNIEnv* _env) { - _env->DeleteGlobalRef(m_javaObjectEwolCallback); - m_javaObjectEwolCallback = nullptr; - } - - int32_t run() { - // might never be called !!! - return -1; - } - - void stop() { - EWOL_DEBUG("C->java : send message to the java : STOP REQUESTED"); - int status; - if(!java_attach_current_thread(&status)) { - return; - } - //Call java ... - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolCallbackStop); - // manage execption : - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } - - void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - // this is to force the local system to think we have the buffer - // TODO : remove this 2 line when code will be writen - m_clipBoardOwnerStd = true; - switch (_clipboardID) { - case ewol::context::clipBoard::clipboardSelection: - // NOTE : Windows does not support the middle button the we do it internaly - // just transmit an event , we have the data in the system - OS_ClipBoardArrive(_clipboardID); - break; - case ewol::context::clipBoard::clipboardStd: - if (false == m_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 - OS_ClipBoardArrive(_clipboardID); - } - break; - default: - EWOL_ERROR("Request an unknow ClipBoard ..."); - break; - } - } - - void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - switch (_clipboardID) { - case ewol::context::clipBoard::clipboardSelection: - // NOTE : nothing to do : Windows deas ot supported Middle button - break; - case ewol::context::clipBoard::clipboardStd: - - // Request the clipBoard : - EWOL_DEBUG("C->java : set clipboard"); - if (m_javaApplicationType == appl_application) { - int status; - if(!java_attach_current_thread(&status)) { - return; - } - //Call java ... - jstring data = m_JavaVirtualMachinePointer->NewStringUTF(ewol::context::clipBoard::get(_clipboardID).c_str()); - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolActivityGetClipBoardString, data); - m_JavaVirtualMachinePointer->DeleteLocalRef(data); - // manage execption : - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } else { - EWOL_ERROR("C->java : can not set clipboard"); - } - break; - default: - EWOL_ERROR("Request an unknow ClipBoard ..."); - break; - } - } - private: - bool java_attach_current_thread(int *_rstatus) { - EWOL_DEBUG("C->java : call java"); - if (jvm_basics::getJavaVM() == nullptr) { - EWOL_ERROR("C->java : JVM not initialised"); - m_JavaVirtualMachinePointer = nullptr; - return false; - } - *_rstatus = jvm_basics::getJavaVM()->GetEnv((void **) &m_JavaVirtualMachinePointer, JNI_VERSION_1_6); - if (*_rstatus == JNI_EDETACHED) { - JavaVMAttachArgs lJavaVMAttachArgs; - lJavaVMAttachArgs.version = JNI_VERSION_1_6; - lJavaVMAttachArgs.name = "EwolNativeThread"; - lJavaVMAttachArgs.group = nullptr; - int status = jvm_basics::getJavaVM()->AttachCurrentThread(&m_JavaVirtualMachinePointer, &lJavaVMAttachArgs); - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - if (status != JNI_OK) { - EWOL_ERROR("C->java : AttachCurrentThread failed : " << status); - m_JavaVirtualMachinePointer = nullptr; - return false; - } - } - return true; - } - - void java_detach_current_thread(int _status) { - if(_status == JNI_EDETACHED) { - jvm_basics::getJavaVM()->DetachCurrentThread(); - m_JavaVirtualMachinePointer = nullptr; - } - } - - void sendJavaKeyboardUpdate(jboolean _showIt) { - int status; - if(!java_attach_current_thread(&status)) { - return; - } - //Call java ... - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolCallbackKeyboardUpdate, _showIt); - // manage execption : - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } - void keyboardShow() { - sendJavaKeyboardUpdate(JNI_TRUE); - }; - void keyboardHide() { - sendJavaKeyboardUpdate(JNI_FALSE); - }; - - // mode 0 : auto; 1 landscape, 2 portrait - void forceOrientation(enum ewol::orientation _orientation) { - int status; - if(!java_attach_current_thread(&status)) { - return; - } - jint param = (jint)_orientation; - - //Call java ... - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolCallbackOrientationUpdate, param); - - // manage execption : - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } - - void setTitle(const std::string& _title) { - EWOL_DEBUG("C->java : send message to the java : \"" << _title << "\""); - if (m_javaApplicationType == appl_application) { - int status; - if(!java_attach_current_thread(&status)) { - return; - } - //Call java ... - jstring title = m_JavaVirtualMachinePointer->NewStringUTF(_title.c_str()); - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolActivitySetTitle, title); - m_JavaVirtualMachinePointer->DeleteLocalRef(title); - // manage execption : - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } else { - EWOL_ERROR("C->java : can not set title on appliation that is not real application"); - } - } - - void openURL(const std::string& _url) { - EWOL_DEBUG("C->java : send message to the java : open URL'" << _url << "'"); - int status; - if(!java_attach_current_thread(&status)) { - return; - } - //Call java ... - jstring url = m_JavaVirtualMachinePointer->NewStringUTF(_url.c_str()); - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolActivityOpenURI, url); - m_JavaVirtualMachinePointer->DeleteLocalRef(url); - // manage execption : - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } - - void sendSystemMessage(const char* _dataString) { - EWOL_DEBUG("C->java : send message to the java : \"" << _dataString << "\""); - int status; - if(!java_attach_current_thread(&status)) { - return; - } - EWOL_DEBUG("C->java : 222"); - if (nullptr == _dataString) { - EWOL_ERROR("C->java : No data to send ..."); - return; - } - EWOL_DEBUG("C->java : 333"); - // create the string to the java - jstring jstr = m_JavaVirtualMachinePointer->NewStringUTF(_dataString); - if (jstr == 0) { - EWOL_ERROR("C->java : Out of memory" ); - return; - } - EWOL_DEBUG("C->java : 444"); - // create argument list - jobjectArray args = m_JavaVirtualMachinePointer->NewObjectArray(1, m_javaDefaultClassString, jstr); - if (args == 0) { - EWOL_ERROR("C->java : Out of memory" ); - return; - } - EWOL_DEBUG("C->java : 555"); - //Call java ... - m_JavaVirtualMachinePointer->CallVoidMethod(m_javaObjectEwolCallback, m_javaMethodEwolCallbackEventNotifier, args); - - EWOL_DEBUG("C->java : 666"); - jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer); - java_detach_current_thread(status); - } - public: - void OS_SetInputMotion(int _pointerID, const vec2& _pos) { - ewol::Context::OS_SetInputMotion(_pointerID, vec2(_pos.x(),m_currentHeight-_pos.y()) ); - } - - void OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos) { - ewol::Context::OS_SetInputState(_pointerID, _isDown, vec2(_pos.x(),m_currentHeight-_pos.y()) ); - } - - void OS_SetMouseMotion(int _pointerID, const vec2& _pos) { - ewol::Context::OS_SetMouseMotion(_pointerID, vec2(_pos.x(),m_currentHeight-_pos.y()) ); - } - - void OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos) { - ewol::Context::OS_SetMouseState(_pointerID, _isDown, vec2(_pos.x(),m_currentHeight-_pos.y()) ); - } - - void ANDROID_SetKeyboard(char32_t _myChar, bool _isDown, bool _isARepeateKey=false) { - 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; - m_guiKeyBoardSpecialKeyMode.update(move, _isDown); - OS_SetKeyboardMove(m_guiKeyBoardSpecialKeyMode, move, _isDown, _isARepeateKey); - } - - void OS_Resize(const vec2& _size) { - m_currentHeight = _size.y(); - ewol::Context::OS_Resize(_size); - } -}; - -static std::vector s_listInstance; -ewol::context::Application* s_applicationInit = NULL; - -extern "C" { - /* Call to initialize the graphics state */ - void Java_org_ewol_Ewol_EWparamSetArchiveDir(JNIEnv* _env, - jclass _cls, - jint _id, - jint _mode, - jstring _myString) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - //EWOL_CRITICAL(" call with ID : " << _id); - // direct setting of the date in the string system ... - jboolean isCopy; - const char* str = _env->GetStringUTFChars(_myString, &isCopy); - s_listInstance[_id]->setArchiveDir(_mode, str); - if (isCopy == JNI_TRUE) { - // from here str is reset ... - _env->ReleaseStringUTFChars(_myString, str); - str = nullptr; - } - } - - // declare main application instance like an application: - int main(int argc, char**argv); - jint Java_org_ewol_Ewol_EWsetJavaVirtualMachineStart(JNIEnv* _env, - jclass _classBase, - jobject _objCallback, - int _typeApplication) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Creating EWOL context **"); - EWOL_DEBUG("*******************************************"); - AndroidContext* tmpContext = nullptr; - s_applicationInit = NULL; - ewol::context::Application* localApplication = NULL; - // call the basic init of all application (that call us ...) - main(0,NULL); - localApplication = s_applicationInit; - s_applicationInit = NULL; - if (org_ewol_EwolConstants_EWOL_APPL_TYPE_ACTIVITY == _typeApplication) { - tmpContext = new AndroidContext(localApplication, _env, _classBase, _objCallback, AndroidContext::appl_application); - } else if (org_ewol_EwolConstants_EWOL_APPL_TYPE_WALLPAPER == _typeApplication) { - tmpContext = new AndroidContext(localApplication, _env, _classBase, _objCallback, AndroidContext::appl_wallpaper); - } else { - EWOL_CRITICAL(" try to create an instance with no apply type: " << _typeApplication); - return -1; - } - if (nullptr == tmpContext) { - EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.size()-1)); - return -1; - } - // for future case : all time this ... - s_listInstance.push_back(tmpContext); - int32_t newID = s_listInstance.size()-1; - return newID; - } - - void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** remove JVM Pointer **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0) { - EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); - return; - } - if (nullptr == s_listInstance[_id]) { - EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ..."); - return; - } - s_listInstance[_id]->unInit(_env); - delete(s_listInstance[_id]); - s_listInstance[_id]=nullptr; - } - void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG(" == > Touch Event"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - jvm_basics::checkExceptionJavaVM(_env); - } - - void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on Create **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - //s_listInstance[_id]->init(); - } - - void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on Start **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - //SendSystemMessage(" testmessages ... "); - } - void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on Re-Start **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - } - void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on resume **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_Resume(); - } - void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on pause **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - // All the openGl has been destroyed ... - s_listInstance[_id]->getResourcesManager().contextHasBeenDestroyed(); - s_listInstance[_id]->OS_Suspend(); - } - void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on Stop **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_Stop(); - } - void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id) { - std::unique_lock lock(g_interfaceMutex); - EWOL_DEBUG("*******************************************"); - EWOL_DEBUG("** Activity on Destroy **"); - EWOL_DEBUG("*******************************************"); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - //s_listInstance[_id]->UnInit(); - } - - - - /* ********************************************************************************************** - * ** IO section : - * ********************************************************************************************** */ - void Java_org_ewol_Ewol_EWinputEventMotion(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _pointerID, - jfloat _x, - jfloat _y) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y)); - } - - void Java_org_ewol_Ewol_EWinputEventState(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _pointerID, - jboolean _isUp, - jfloat _x, - jfloat _y) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y)); - } - - void Java_org_ewol_Ewol_EWmouseEventMotion(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _pointerID, - jfloat _x, - jfloat _y) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y)); - } - - void Java_org_ewol_Ewol_EWmouseEventState(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _pointerID, - jboolean _isUp, - jfloat _x, - jfloat _y) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y)); - } - - void Java_org_ewol_Ewol_EWunknowEvent(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _pointerID) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - EWOL_DEBUG("Unknown IO event : " << _pointerID << " ???"); - } - - void Java_org_ewol_Ewol_EWkeyboardEventMove(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _type, - jboolean _isdown) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - EWOL_DEBUG("IO keyboard Move event : \"" << _type << "\" is down=" << _isdown); - s_listInstance[_id]->ANDROID_SetKeyboardMove(_type, _isdown); - } - - void Java_org_ewol_Ewol_EWkeyboardEventKey(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _uniChar, - jboolean _isdown) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - EWOL_DEBUG("IO keyboard Key event : \"" << _uniChar << "\" is down=" << _isdown); - s_listInstance[_id]->ANDROID_SetKeyboard(_uniChar, _isdown); - } - - void Java_org_ewol_Ewol_EWdisplayPropertyMetrics(JNIEnv* _env, - jobject _thiz, - jint _id, - jfloat _ratioX, - jfloat _ratioY) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - // set the internal system ratio properties ... - ewol::Dimension::setPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch); - } - - // TODO : set a return true or false if we want to grep this event ... - bool Java_org_ewol_Ewol_EWkeyboardEventKeySystem(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _keyVal, - jboolean _isdown) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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 false; - } - switch (_keyVal) { - case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP: - 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); - 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); - 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); - 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); - 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); - 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_ERROR("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown); - break; - } - return false; - } - - - /* ********************************************************************************************** - * ** Renderer section : - * ********************************************************************************************** */ - void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env, - jobject _thiz, - jint _id) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - } - - void Java_org_ewol_Ewol_EWrenderResize(JNIEnv* _env, - jobject _thiz, - jint _id, - jint _w, - jint _h) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_Resize(vec2(_w, _h)); - } - - // TODO : Return true or false to not redraw when the under draw has not be done (processing gain of time) - void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env, - jobject _thiz, - jint _id) { - std::unique_lock lock(g_interfaceMutex); - if( _id >= (int32_t)s_listInstance.size() - || _id<0 - || nullptr == 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; - } - s_listInstance[_id]->OS_Draw(true); - } -}; - - -int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { - s_applicationInit = _application; - return 0; -} diff --git a/ewol/context/Context.cpp b/ewol/context/Context.cpp index e01019de..8be0f2a0 100644 --- a/ewol/context/Context.cpp +++ b/ewol/context/Context.cpp @@ -19,11 +19,12 @@ #include #include -#include #include +#include +#include + #include -#include #include #include #include @@ -31,7 +32,6 @@ #include #include -#include @@ -58,13 +58,6 @@ ewol::Context& ewol::getContext() { } - -void ewol::Context::setInitImage(const std::string& _fileName) { - //m_initDisplayImageName = _fileName; -} - - - /** * @brief set the curent interface. * @note this lock the main mutex @@ -84,57 +77,11 @@ void ewol::Context::unLockContext() { } -namespace ewol { - class eSystemMessage { - public: - enum theadMessage { - msgNone, - msgInit, - msgRecalculateSize, - msgResize, - msgHide, - msgShow, - - msgInputMotion, - msgInputState, - - msgKeyboardKey, - msgKeyboardMove, - - msgClipboardArrive - }; - public : - // specify the message type - enum theadMessage TypeMessage; - // can not set a union ... - enum ewol::context::clipBoard::clipboardListe clipboardID; - // InputId - enum ewol::key::type inputType; - int32_t inputId; - // generic dimentions - vec2 dimention; - // keyboard events : - bool repeateKey; //!< special flag for the repeating key on the PC interface - bool stateIsDown; - char32_t keyboardChar; - enum ewol::key::keyboard keyboardMove; - ewol::key::Special keyboardSpecial; - - eSystemMessage() : - TypeMessage(msgNone), - clipboardID(ewol::context::clipBoard::clipboardStd), - inputType(ewol::key::typeUnknow), - inputId(-1), - dimention(0,0), - repeateKey(false), - stateIsDown(false), - keyboardChar(0), - keyboardMove(ewol::key::keyboardUnknow) - { - - } - }; -}; + +void ewol::Context::setInitImage(const std::string& _fileName) { + //m_initDisplayImageName = _fileName; +} + void ewol::Context::inputEventTransfertWidget(std::shared_ptr _source, @@ -151,216 +98,38 @@ void ewol::Context::inputEventUnGrabPointer() { m_input.unGrabPointer(); } -void ewol::Context::processEvents() { - int32_t nbEvent = 0; - //EWOL_DEBUG(" ******** Event"); - ewol::eSystemMessage* data = nullptr; - while (m_msgSystem.count()>0) { - nbEvent++; - if (data != nullptr) { - delete(data); - data = nullptr; - } - m_msgSystem.wait(data); - //EWOL_DEBUG("EVENT"); - switch (data->TypeMessage) { - case eSystemMessage::msgInit: - // this is due to the openGL context - /*bool returnVal = */ - m_application->init(*this, m_initStepId); - m_initStepId++; - break; - case eSystemMessage::msgRecalculateSize: - forceRedrawAll(); - break; - case eSystemMessage::msgResize: - //EWOL_DEBUG("Receive MSG : THREAD_RESIZE"); - m_windowsSize = data->dimention; - ewol::Dimension::setPixelWindowsSize(m_windowsSize); - forceRedrawAll(); - break; - case eSystemMessage::msgInputMotion: - //EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); - m_input.motion(data->inputType, data->inputId, data->dimention); - break; - case eSystemMessage::msgInputState: - //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); - m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention); - break; - case eSystemMessage::msgKeyboardKey: - case eSystemMessage::msgKeyboardMove: - //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); - // store the keyboard special key status for mouse event... - m_input.setLastKeyboardSpecial(data->keyboardSpecial); - if (nullptr != m_windowsCurrent) { - if (false == m_windowsCurrent->onEventShortCut(data->keyboardSpecial, - data->keyboardChar, - data->keyboardMove, - data->stateIsDown) ) { - // get the current focused Widget : - std::shared_ptr tmpWidget = m_widgetManager.focusGet(); - if (nullptr != tmpWidget) { - // check if the widget allow repeating key events. - //EWOL_DEBUG("repeating test :" << data->repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data->stateIsDown); - if( false == data->repeateKey - || ( true == data->repeateKey - && true == tmpWidget->getKeyboardRepeate()) ) { - // check Widget shortcut - if (false == tmpWidget->onEventShortCut(data->keyboardSpecial, - data->keyboardChar, - data->keyboardMove, - data->stateIsDown) ) { - // generate the direct event ... - if (data->TypeMessage == eSystemMessage::msgKeyboardKey) { - ewol::event::EntrySystem tmpEntryEvent(ewol::key::keyboardChar, - ewol::key::statusUp, - data->keyboardSpecial, - data->keyboardChar); - if(true == data->stateIsDown) { - tmpEntryEvent.m_event.setStatus(ewol::key::statusDown); - } - tmpWidget->systemEventEntry(tmpEntryEvent); - } else { // THREAD_KEYBORAD_MOVE - EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data->keyboardMove << " " << data->stateIsDown); - ewol::event::EntrySystem tmpEntryEvent(data->keyboardMove, - ewol::key::statusUp, - data->keyboardSpecial, - 0); - if(true == data->stateIsDown) { - tmpEntryEvent.m_event.setStatus(ewol::key::statusDown); - } - tmpWidget->systemEventEntry(tmpEntryEvent); - } - } else { - EWOL_DEBUG("remove Repeate key ..."); - } - } - } - } - } - break; - case eSystemMessage::msgClipboardArrive: - { - std::shared_ptr tmpWidget = m_widgetManager.focusGet(); - if (tmpWidget != nullptr) { - tmpWidget->onEventClipboard(data->clipboardID); - } - } - break; - case eSystemMessage::msgHide: - EWOL_DEBUG("Receive MSG : msgHide"); - //guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move); - //gui_uniqueWindows->SysOnHide(); - break; - case eSystemMessage::msgShow: - EWOL_DEBUG("Receive MSG : msgShow"); - //guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move); - //gui_uniqueWindows->SysOnShow(); - break; - default: - EWOL_DEBUG("Receive MSG : UNKNOW"); - break; - } - } -} -void ewol::Context::setArchiveDir(int _mode, const char* _str) { - switch(_mode) { - case 0: - EWOL_DEBUG("Directory APK : path=" << _str); - etk::setBaseFolderData(_str); - break; - case 1: - EWOL_DEBUG("Directory mode=FILE path=" << _str); - etk::setBaseFolderDataUser(_str); - break; - case 2: - EWOL_DEBUG("Directory mode=CACHE path=" << _str); - etk::setBaseFolderCache(_str); - break; - case 3: - EWOL_DEBUG("Directory mode=EXTERNAL_CACHE path=" << _str); - break; - default: - EWOL_DEBUG("Directory mode=???? path=" << _str); - break; - } -} - - - -ewol::Context::Context(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) : - //m_application(std::make_shared(_application)), - m_application(_application), - m_objectManager(*this), - m_previousDisplayTime(0), - m_input(*this), -#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__IOs)) - m_displayFps(true), -#else - m_displayFps(false), -#endif - m_FpsSystemEvent( "Event ", false), - m_FpsSystemContext("Context ", false), - m_FpsSystem( "Draw ", true), - m_FpsFlush( "Flush ", false), - m_windowsCurrent(nullptr), - m_windowsSize(320,480), - m_initStepId(0) { - // set a basic - etk::thread::setName("ewol"); - if (m_application == nullptr) { - EWOL_CRITICAL("Can not start context with no Application ==> rtfm ..."); - } - m_commandLine.parse(_argc, _argv); +void ewol::Context::onCreate(gale::Context& _context) { + lockContext(); EWOL_INFO(" == > Ewol system init (BEGIN)"); // Add basic ewol translation: ewol::translate::addPath("ewol", "DATA:translate/ewol/"); ewol::translate::autoDetectLanguage(); - // Reset the random system to be sure have real random values... - etk::tool::resetRandom(); - // set the curent interface : - lockContext(); // By default we set 2 themes (1 color and 1 shape ...) : etk::theme::setNameDefault("GUI", "shape/square/"); etk::theme::setNameDefault("COLOR", "color/black/"); - // parse the debug level: - for(int32_t iii = 0; iii < m_commandLine.size() ; ++iii) { - if (m_commandLine.get(iii) == "--ewol-fps") { - m_displayFps=true; - } else if ( m_commandLine.get(iii) == "-h" - || m_commandLine.get(iii) == "--help") { + // parse for help: + for(int32_t iii = 0; iii < _context.getCmd().size() ; ++iii) { + if ( _context.getCmd().get(iii) == "-h" + || _context.getCmd().get(iii) == "--help") { EWOL_PRINT("ewol - help : "); EWOL_PRINT(" " << etk::getApplicationName() << " [options]"); - EWOL_PRINT(" --ewol-fps: Display the current fps of the display"); EWOL_PRINT(" -h/--help: Display this help"); EWOL_PRINT(" example:"); - EWOL_PRINT(" " << etk::getApplicationName() << " --ewol-fps"); + EWOL_PRINT(" " << etk::getApplicationName() << " --help"); // this is a global help system does not remove it continue; } else { continue; } - m_commandLine.remove(iii); + _context.getCmd().remove(iii); --iii; } - //etk::cout.setOutputFile(true); EWOL_INFO("EWOL v:" << ewol::getVersion()); EWOL_INFO("Build Date: " << date::getYear() << "/" << date::getMonth() << "/" << date::getDay() << " " << date::getHour() << "h" << date::getMinute()); - // TODO : remove this ... - etk::initDefaultFolder("ewolApplNoName"); - // request the init of the application in the main context of openGL ... - { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - } else { - data->TypeMessage = eSystemMessage::msgInit; - m_msgSystem.post(data); - } - } // force a recalculation + /* requestUpdateSize(); #if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__) forceOrientation(ewol::screenLandscape); @@ -369,16 +138,74 @@ ewol::Context::Context(ewol::context::Application* _application, int32_t _argc, #else forceOrientation(ewol::screenAuto); #endif - // release the curent interface : - unLockContext(); + */ EWOL_INFO(" == > Ewol system init (END)"); + unLockContext(); } -ewol::Context::~Context() { - EWOL_INFO(" == > Ewol system Un-Init (BEGIN)"); - // TODO : Clean the message list ... - // set the curent interface : +void ewol::Context::onStart(gale::Context& _context) { lockContext(); + if (m_application == nullptr) { + // TODO : Request exit of the application .... with error ... + unLockContext(); + return; + } + for (int32_t iii=0; iiigetNbStepInit(); ++iii) { + m_application->init(*this, iii); + } + unLockContext(); +} + +void ewol::Context::onResume(gale::Context& _context) { + lockContext(); + unLockContext(); +} + +void ewol::Context::onRegenerateDisplay(gale::Context& _context) { + lockContext(); + EWOL_INFO("REGENERATE_DISPLAY"); + // check if the user selected a windows + if (m_windowsCurrent == nullptr) { + EWOL_INFO("No windows ..."); + unLockContext(); + return; + } + // Redraw all needed elements + m_windowsCurrent->onRegenerateDisplay(); + if (m_widgetManager.isDrawingNeeded() == true) { + markDrawingIsNeeded(); + } + //markDrawingIsNeeded(); + unLockContext(); +} + +void ewol::Context::onDraw(gale::Context& _context) { + lockContext(); + EWOL_INFO("DRAW"); + // clean internal data... + m_objectManager.cleanInternalRemoved(); + // real draw... + if (m_windowsCurrent == nullptr) { + return; + } + m_windowsCurrent->sysDraw(); + unLockContext(); +} + +void ewol::Context::onPause(gale::Context& _context) { + lockContext(); + unLockContext(); +} + +void ewol::Context::onStop(gale::Context& _context) { + lockContext(); + m_application->unInit(*this); + unLockContext(); +} + +void ewol::Context::onDestroy(gale::Context& _context) { + lockContext(); + EWOL_INFO(" == > Ewol system Un-Init (BEGIN)"); // Remove current windows m_windowsCurrent.reset(); // clean all widget and sub widget with their resources: @@ -386,193 +213,150 @@ ewol::Context::~Context() { // call application to uninit m_application->unInit(*this); m_application.reset(); - // clean all messages - m_msgSystem.clean(); // internal clean elements m_objectManager.cleanInternalRemoved(); - m_resourceManager.cleanInternalRemoved(); EWOL_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing"); m_objectManager.displayListObject(); - // Resource is an lower element as objects ... - m_resourceManager.unInit(); // now All must be removed !!! m_objectManager.unInit(); - // release the curent interface : - unLockContext(); EWOL_INFO(" == > Ewol system Un-Init (END)"); + unLockContext(); } -void ewol::Context::requestUpdateSize() { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); +void ewol::Context::onPointer(enum gale::key::type _type, + int32_t _pointerID, + const vec2& _pos, + gale::key::status _state) { + lockContext(); + switch (_state) { + case gale::key::status_move: + //EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); + m_input.motion(_type, _pointerID, _pos); + break; + case gale::key::status_down: + case gale::key::status_downRepeate: + //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); + m_input.state(_type, _pointerID, true, _pos); + break; + case gale::key::status_up: + //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); + m_input.state(_type, _pointerID, false, _pos); + break; + default: + EWOL_DEBUG("Unknow state : " << _state); + break; + } + unLockContext(); +} +void ewol::Context::onKeyboard(gale::key::Special& _special, + enum gale::key::keyboard _type, + char32_t _value, + gale::key::status _state) { + lockContext(); + // store the keyboard special key status for mouse event... + m_input.setLastKeyboardSpecial(_special); + if (m_windowsCurrent == nullptr) { + // No windows ... + unLockContext(); return; } - data->TypeMessage = eSystemMessage::msgRecalculateSize; - m_msgSystem.post(data); -} - -void ewol::Context::OS_Resize(const vec2& _size) { - // TODO : Better in the thread ... == > but generate some init error ... - ewol::Dimension::setPixelWindowsSize(_size); - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); + bool repeate = (_state == gale::key::status_downRepeate); + bool isDown = (_state == gale::key::status_downRepeate) + || (_state == gale::key::status_down); + if (m_windowsCurrent->onEventShortCut(_special, + _value, + _type, + isDown) == true) { + // Keep a shortcut ... + unLockContext(); return; } - data->TypeMessage = eSystemMessage::msgResize; - data->dimention = _size; - m_msgSystem.post(data); -} -void ewol::Context::OS_Move(const vec2& _pos) { - /* - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - data->TypeMessage = eSystemMessage::msgResize; - data->resize.w = w; - data->resize.h = h; - m_msgSystem.Post(data); - */ -} - -void ewol::Context::OS_SetInputMotion(int _pointerID, const vec2& _pos ) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); + // get the current focused Widget : + std::shared_ptr tmpWidget = m_widgetManager.focusGet(); + if (tmpWidget == nullptr) { + // no Widget ... + unLockContext(); return; } - data->TypeMessage = eSystemMessage::msgInputMotion; - data->inputType = ewol::key::typeFinger; - data->inputId = _pointerID; - data->dimention = _pos; - m_msgSystem.post(data); -} - -void ewol::Context::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos ) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; + // check if the widget allow repeating key events. + //EWOL_DEBUG("repeating test :" << data->repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data->stateIsDown); + if( repeate == false + || ( repeate == true + && tmpWidget->getKeyboardRepeate() == true) ) { + // check Widget shortcut + if (tmpWidget->onEventShortCut(_special, + _value, + _type, + isDown) == false) { + // generate the direct event ... + if (_type == gale::key::keyboard_char) { + ewol::event::EntrySystem tmpEntryEvent(gale::key::keyboard_char, + gale::key::status_up, + _special, + _value); + if(isDown == true) { + tmpEntryEvent.m_event.setStatus(gale::key::status_down); + } + tmpWidget->systemEventEntry(tmpEntryEvent); + } else { // THREAD_KEYBORAD_MOVE + EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << _type << " " << _state); + ewol::event::EntrySystem tmpEntryEvent(_type, + gale::key::status_up, + _special, + 0); + if(isDown == true) { + tmpEntryEvent.m_event.setStatus(gale::key::status_down); + } + tmpWidget->systemEventEntry(tmpEntryEvent); + } + } else { + EWOL_DEBUG("remove Repeate key ..."); + } } - data->TypeMessage = eSystemMessage::msgInputState; - data->inputType = ewol::key::typeFinger; - data->inputId = _pointerID; - data->stateIsDown = _isDown; - data->dimention = _pos; - m_msgSystem.post(data); + unLockContext(); } -void ewol::Context::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; +/* +void ewol::Context::processEvents() { + case eSystemMessage::msgResize: + //EWOL_DEBUG("Receive MSG : THREAD_RESIZE"); + m_windowsSize = data->dimention; + ewol::Dimension::setPixelWindowsSize(m_windowsSize); + forceRedrawAll(); + break; +*/ + +void ewol::Context::onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId) { + lockContext(); + std::shared_ptr tmpWidget = m_widgetManager.focusGet(); + if (tmpWidget != nullptr) { + tmpWidget->onEventClipboard(_clipboardId); } - data->TypeMessage = eSystemMessage::msgInputMotion; - data->inputType = ewol::key::typeMouse; - data->inputId = _pointerID; - data->dimention = _pos; - m_msgSystem.post(data); + unLockContext(); } -void ewol::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos ) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; + +ewol::Context::Context(ewol::context::Application* _application) : + //m_application(std::make_shared(_application)), + m_application(_application), + m_objectManager(*this), + m_input(*this), + m_windowsCurrent(nullptr), + m_initStepId(0) { + if (m_application == nullptr) { + EWOL_CRITICAL("Can not start context with no Application ==> rtfm ..."); } - data->TypeMessage = eSystemMessage::msgInputState; - data->inputType = ewol::key::typeMouse; - data->inputId = _pointerID; - data->stateIsDown = _isDown; - data->dimention = _pos; - m_msgSystem.post(data); } -void ewol::Context::OS_SetKeyboard(ewol::key::Special& _special, - char32_t _myChar, - bool _isDown, - bool _isARepeateKey) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; - } - data->TypeMessage = eSystemMessage::msgKeyboardKey; - data->stateIsDown = _isDown; - data->keyboardChar = _myChar; - data->keyboardSpecial = _special; - data->repeateKey = _isARepeateKey; - m_msgSystem.post(data); -} - -void ewol::Context::OS_SetKeyboardMove(ewol::key::Special& _special, - enum ewol::key::keyboard _move, - bool _isDown, - bool _isARepeateKey) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; - } - data->TypeMessage = eSystemMessage::msgKeyboardMove; - data->stateIsDown = _isDown; - data->keyboardMove = _move; - data->keyboardSpecial = _special; - data->repeateKey = _isARepeateKey; - m_msgSystem.post(data); -} - -void ewol::Context::OS_Hide() { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; - } - data->TypeMessage = eSystemMessage::msgHide; - m_msgSystem.post(data); -} - -void ewol::Context::OS_Show() { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; - } - data->TypeMessage = eSystemMessage::msgShow; - m_msgSystem.post(data); -} - - -void ewol::Context::OS_ClipBoardArrive(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - ewol::eSystemMessage *data = new ewol::eSystemMessage(); - if (data == nullptr) { - EWOL_ERROR("allocationerror of message"); - return; - } - data->TypeMessage = eSystemMessage::msgClipboardArrive; - data->clipboardID = _clipboardID; - m_msgSystem.post(data); -} - -void ewol::Context::clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - // just transmit an event , we have the data in the system - OS_ClipBoardArrive(_clipboardID); -} - -void ewol::Context::clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - // nothing to do, data is already copyed in the EWOL clipborad center +ewol::Context::~Context() { + // nothing to do ... } +#if 0 bool ewol::Context::OS_Draw(bool _displayEveryTime) { int64_t currentTime = ewol::getTime(); // this is to prevent the multiple display at the a high frequency ... - #if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__Windows)) - if(currentTime - m_previousDisplayTime < 1000000/120) { - usleep(1000); - return false; - } - #endif m_previousDisplayTime = currentTime; // process the events @@ -596,11 +380,7 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) { } // call all the widget that neded to do something periodicly m_objectManager.timeCall(currentTime); - // check if the user selected a windows - if (nullptr != m_windowsCurrent) { - // Redraw all needed elements - m_windowsCurrent->onRegenerateDisplay(); - } + if (m_displayFps == true) { m_FpsSystemEvent.incrementCounter(); m_FpsSystemEvent.toc(); @@ -655,12 +435,6 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) { // release open GL Context gale::openGL::unLock(); } - if (m_displayFps == true) { - m_FpsSystemEvent.draw(); - m_FpsSystemContext.draw(); - m_FpsSystem.draw(); - m_FpsFlush.draw(); - } { // set the curent interface : lockContext(); @@ -677,14 +451,12 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) { } return hasDisplayDone; } +#endif void ewol::Context::resetIOEvent() { m_input.newLayerSet(); } -void ewol::Context::OS_OpenGlContextDestroy() { - m_resourceManager.contextHasBeenDestroyed(); -} void ewol::Context::setWindows(const std::shared_ptr& _windows) { // remove current focus : @@ -706,9 +478,9 @@ void ewol::Context::forceRedrawAll() { if (m_windowsCurrent == nullptr) { return; } - m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y())); + // TODO: m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y())); } - +/* void ewol::Context::OS_Stop() { // set the curent interface : lockContext(); @@ -765,48 +537,9 @@ void ewol::Context::OS_Background() { // release the curent interface : unLockContext(); } - +*/ void ewol::Context::stop() { } -void ewol::Context::setSize(const vec2& _size) { - EWOL_INFO("setSize: NOT implemented ..."); -}; - -void ewol::Context::setPos(const vec2& _pos) { - EWOL_INFO("setPos: NOT implemented ..."); -} - -void ewol::Context::hide() { - EWOL_INFO("hide: NOT implemented ..."); -}; - -void ewol::Context::show() { - EWOL_INFO("show: NOT implemented ..."); -} - -void ewol::Context::setTitle(const std::string& _title) { - EWOL_INFO("setTitle: NOT implemented ..."); -} - -void ewol::Context::keyboardShow() { - EWOL_INFO("keyboardShow: NOT implemented ..."); -} - - -void ewol::Context::keyboardHide() { - EWOL_INFO("keyboardHide: NOT implemented ..."); -} - - -bool ewol::Context::systemKeyboradEvent(enum ewol::key::keyboardSystem _key, bool _down) { - if (m_windowsCurrent == nullptr) { - return false; - } - lockContext(); - bool ret = m_windowsCurrent->onEventHardwareInput(_key, _down); - unLockContext(); - return ret; -} \ No newline at end of file diff --git a/ewol/context/Context.h b/ewol/context/Context.h index ee2e5f11..4a1fd501 100644 --- a/ewol/context/Context.h +++ b/ewol/context/Context.h @@ -9,48 +9,34 @@ #ifndef __EWOL_CONTEXT_H__ #define __EWOL_CONTEXT_H__ -#include +#include +#include +#include +#include +#include + #include #include -#include #include -#include #include #include #include -#include #include -#include #include -#include #include namespace ewol { - /** - * @not-in-doc - */ - class eSystemMessage; - /** - * @not-in-doc - */ - enum orientation{ - screenAuto = 0, - screenLandscape, - screenPortrait - }; - - class Context/* : private ewol::object::RemoveEvent */{ + // Here we hereted from the gale application to be agnostic of the OW where we work ... + class Context : public gale::Application { private: std::shared_ptr m_application; //!< Application handle public: std::shared_ptr getApplication() { return m_application; } - private: - ewol::context::CommandLine m_commandLine; //!< Start command line information public: - ewol::context::CommandLine& getCmd() { - return m_commandLine; + gale::context::CommandLine& getCmd() { + return gale::getContext().getCmd(); }; private: ewol::context::ConfigFont m_configFont; //!< global font configuration @@ -70,15 +56,15 @@ namespace ewol { ewol::widget::Manager& getWidgetManager() { return m_widgetManager; }; - private: - ewol::resource::Manager m_resourceManager; //!< global resources Manager public: - ewol::resource::Manager& getResourcesManager() { - return m_resourceManager; + gale::resource::Manager& getResourcesManager() { + return gale::getContext().getResourcesManager(); }; public: - Context(ewol::context::Application* _application, int32_t _argc=0, const char* _argv[]=nullptr); + Context(ewol::context::Application* _application); virtual ~Context(); + private: + ewol::context::InputManager m_input; protected: /** * @brief set the curent interface. @@ -90,72 +76,31 @@ namespace ewol { * @note this un-lock the main mutex */ void unLockContext(); - private: - int64_t m_previousDisplayTime; // this is to limit framerate ... in case... - ewol::context::InputManager m_input; - etk::Fifo m_msgSystem; - bool m_displayFps; - ewol::context::Fps m_FpsSystemEvent; - ewol::context::Fps m_FpsSystemContext; - ewol::context::Fps m_FpsSystem; - ewol::context::Fps m_FpsFlush; - /** - * @brief Processing all the event arrived ... (commoly called in draw function) - */ - void processEvents(); - public: - virtual void setArchiveDir(int _mode, const char* _str); + public: // herited function: + virtual void onCreate(gale::Context& _context); + virtual void onStart(gale::Context& _context); + virtual void onResume(gale::Context& _context); + virtual void onRegenerateDisplay(gale::Context& _context); + virtual void onDraw(gale::Context& _context); + virtual void onPause(gale::Context& _context); + virtual void onStop(gale::Context& _context); + virtual void onDestroy(gale::Context& _context); + virtual void onPointer(enum gale::key::type _type, + int32_t _pointerID, + const vec2& _pos, + gale::key::status _state); + virtual void onKeyboard(gale::key::Special& _special, + enum gale::key::keyboard _type, + char32_t _value, + gale::key::status _state); + virtual void onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId); - virtual void OS_SetInputMotion(int _pointerID, const vec2& _pos); - virtual void OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos); - - virtual void OS_SetMouseMotion(int _pointerID, const vec2& _pos); - virtual void OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos); - - virtual void OS_SetKeyboard(ewol::key::Special& _special, - char32_t _myChar, - bool _isDown, - bool _isARepeateKey=false); - virtual void OS_SetKeyboardMove(ewol::key::Special& _special, - enum ewol::key::keyboard _move, - bool _isDown, - bool _isARepeateKey=false); - /** - * @brief The current context is suspended - */ - virtual void OS_Suspend(); - /** - * @brief The current context is resumed - */ - virtual void OS_Resume(); - - /** - * @brief The current context is set in foreground (framerate is maximum speed) - */ - virtual void OS_Foreground(); - /** - * @brief The current context is set in background (framerate is slowing down (max fps)/5 # 4fps) - */ - virtual void OS_Background(); - - void requestUpdateSize(); - - // return true if a flush is needed - bool OS_Draw(bool _displayEveryTime); public: /** * @brief reset event management for the IO like Input ou Mouse or keyborad */ void resetIOEvent(); - /** - * @brief The OS inform that the openGL constext has been destroy == > use to automaticly reload the texture and other thinks ... - */ - void OS_OpenGlContextDestroy(); - /** - * @brief The OS Inform that the Window has been killed - */ - void OS_Stop(); /** * @brief The application request that the Window will be killed */ @@ -173,52 +118,7 @@ namespace ewol { * @return the current handle on the windows (can be null) */ std::shared_ptr getWindows(); - private: - vec2 m_windowsSize; //!< current size of the system - public: - /** - * @brief get the current windows size - * @return the current size ... - */ - const vec2& getSize() { - return m_windowsSize; - }; - /** - * @brief The OS inform that the current windows has change his size. - * @param[in] _size new size of the windows. - */ - virtual void OS_Resize(const vec2& _size); - /** - * @brief The application request a change of his curent size. - * @param[in] _size new Requested size of the windows. - */ - virtual void setSize(const vec2& _size); - /** - * @brief The OS inform that the current windows has change his position. - * @param[in] _pos New position of the Windows. - */ - void OS_Move(const vec2& _pos); - /** - * @brief The Application request that the current windows will change his position. - * @param[in] _pos New position of the Windows requested. - */ - virtual void setPos(const vec2& _pos); - /** - * @brief The OS inform that the Windows is now Hidden. - */ - void OS_Hide(); - /** - * @brief The Application request that the Windows will be Hidden. - */ - virtual void hide(); - /** - * @brief The OS inform that the Windows is now visible. - */ - void OS_Show(); - /** - * @brief The Application request that the Windows will be visible. - */ - virtual void show(); + /** * @brief Redraw all the windows */ @@ -240,16 +140,7 @@ namespace ewol { * @brief This fonction un-lock the pointer properties to move in relative instead of absolute */ void inputEventUnGrabPointer(); - - /** - * @brief display the virtal keyboard (for touch system only) - */ - virtual void keyboardShow(); - /** - * @brief Hide the virtal keyboard (for touch system only) - */ - virtual void keyboardHide(); - + #if 0 /** * @brief Inform the Gui that we want to have a copy of the clipboard * @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here @@ -265,16 +156,9 @@ namespace ewol { * @param[in] Id of the clipboard */ void OS_ClipBoardArrive(enum ewol::context::clipBoard::clipboardListe _clipboardID); - /** - * @brief set the new title of the windows - * @param[in] title New desired title - */ - virtual void setTitle(const std::string& _title); - /** - * @brief Open an URL on an eternal brother. - * @param[in] _url URL to open. - */ - virtual void openURL(const std::string& _url) { }; + #endif + + #if 0 /** * @brief force the screen orientation (availlable on portable elements ... * @param[in] _orientation Selected orientation. @@ -286,25 +170,14 @@ namespace ewol { * @param[in] _forcedPosition the position where the mouse might be reset at every events ... */ virtual void grabPointerEvents(bool _isGrabbed, const vec2& _forcedPosition) { }; - /** - * @brief set the cursor display type. - * @param[in] _newCursor selected new cursor. - */ - virtual void setCursor(enum ewol::context::cursorDisplay _newCursor) { }; - /** - * @brief set the Icon of the program - * @param[in] _inputFile new filename icon of the curent program. - */ - virtual void setIcon(const std::string& _inputFile) { }; + /** * @brief get the curent time in micro-second * @note : must be implemented in all system OS implementation * @return The curent time of the process */ static int64_t getTime(); - private: - // TODO : set user argument here .... - + #endif public: /** * @brief This is the only one things the User might done in his main(); @@ -329,13 +202,15 @@ namespace ewol { */ void setInitImage(const std::string& _fileName); protected: + # if 0 /** * @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); + virtual bool systemKeyboradEvent(enum gale:key::keyboardSystem _key, bool _down); + #endif }; /** * @brief From everyware in the program, we can get the context inteface. diff --git a/ewol/context/Fps.h b/ewol/context/Fps.h deleted file mode 100644 index 01a089fe..00000000 --- a/ewol/context/Fps.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_FPS_H__ -#define __EWOL_FPS_H__ - -namespace ewol { - namespace context { - /** - * @brief This class is designed to count the number of frame per second in the main renderer system - * @not-in-doc - */ - class Fps { - // display every second ... - #define DISPLAY_PERIODE_US (1000000) - private: - int64_t startTime; - int64_t nbCallTime; - int64_t nbDisplayTime; - int64_t min; - int64_t avg; - int64_t max; - int64_t min_idle; - int64_t avg_idle; - int64_t max_idle; - int64_t ticTime; - bool display; - bool drwingDone; - const char * m_displayName; - bool m_displayFPS; - public: - /** - * @brief Constructor - */ - Fps(const char * displayName, bool displayFPS) { - startTime = -1; - nbCallTime = 0; - nbDisplayTime = 0; - min = 99999999999999LL; - avg = 0; - max = 0; - min_idle = 99999999999999LL; - avg_idle = 0; - max_idle = 0; - ticTime = 0; - display = false; - drwingDone = false; - m_displayName = displayName; - m_displayFPS = displayFPS; - } - /** - * @brief Destructor - */ - ~Fps() { - - } - /** - * @brief this might be call every time a diplay start - */ - void tic() { - int64_t currentTime = ewol::getTime(); - ticTime = currentTime; - nbCallTime++; - if (startTime<0) { - startTime = currentTime; - } - //EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime)); - if ( (currentTime - startTime) > DISPLAY_PERIODE_US) { - display = true; - } - } - /** - * @brief this might be call every time a diplay stop, it do the display every second - * @param[in] displayTime display curent time of the frame. - */ - void toc(bool displayTime = false) { - int64_t currentTime = ewol::getTime(); - int64_t processTimeLocal = (currentTime - ticTime); - if (displayTime == true) { - EWOL_PRINT(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms "); - } - if (drwingDone) { - min = std::min(min, processTimeLocal); - max = std::max(max, processTimeLocal); - avg += processTimeLocal; - drwingDone = false; - } else { - min_idle = std::min(min_idle, processTimeLocal); - max_idle = std::max(max_idle, processTimeLocal); - avg_idle += processTimeLocal; - } - } - /** - * @brief this might be call when a display is really done - */ - void incrementCounter() { - nbDisplayTime++; - drwingDone = true; - } - /** - * @brief draw debug display ... - */ - void draw() { - if (true == display) { - if (nbDisplayTime>0) { - EWOL_PRINT(m_displayName << " : Active : " - << (float)((float)min / 1000.0) << "ms " - << (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms " - << (float)((float)max / 1000.0) << "ms "); - } - if (nbCallTime-nbDisplayTime>0) { - EWOL_PRINT(m_displayName << " : idle : " - << (float)((float)min_idle / 1000.0) << "ms " - << (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms " - << (float)((float)max_idle / 1000.0) << "ms "); - } - if (true == m_displayFPS) { - EWOL_PRINT("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps"); - } - max = 0; - min = 99999999999999LL; - avg = 0; - max_idle = 0; - min_idle = 99999999999999LL; - avg_idle = 0; - nbCallTime = 0; - nbDisplayTime = 0; - startTime = -1; - display = false; - } - } - }; - }; -}; -#endif - diff --git a/ewol/context/IOs/AppDelegate.h b/ewol/context/IOs/AppDelegate.h deleted file mode 100644 index 602aab4a..00000000 --- a/ewol/context/IOs/AppDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#import -@class OpenglView; - -@interface AppDelegate : UIResponder { - UIWindow *window; - OpenglView *glView; -} - -@property (nonatomic, retain) IBOutlet UIWindow *window; -@property (nonatomic, retain) IBOutlet OpenglView *glView; - -@end diff --git a/ewol/context/IOs/AppDelegate.mm b/ewol/context/IOs/AppDelegate.mm deleted file mode 100644 index 5eb14304..00000000 --- a/ewol/context/IOs/AppDelegate.mm +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#import -#include "ewol/context/IOs/Interface.h" - -#import -#import -#include -#include - -@implementation AppDelegate - -@synthesize window; -@synthesize glView; - -- (void)applicationDidFinishLaunching:(UIApplication *)application { - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - NSLog(@"Start with screeen bounds : %fx%f\n", screenBounds.size.width, screenBounds.size.height); - CGSize currentSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale); - //screenBounds.size.width *= screenScale; - //screenBounds.size.height *= screenScale; - NSLog(@"Start with screeen bounds : %fx%f\n", screenBounds.size.width, screenBounds.size.height); - window = [[UIWindow alloc] initWithFrame:screenBounds]; - window.contentMode = UIViewContentModeRedraw; - glView = [[OpenglView alloc] initWithFrame:window.bounds]; - glView.contentMode = UIViewContentModeRedraw; - [window addSubview:glView]; - [window makeKeyAndVisible]; - // Create interface of ewol here .... - NSLog(@"CREATE EWOL interface creation\n"); - IOs::createInterface(); - IOs::resize(currentSize.width, currentSize.height); - IOs::start(); -} -/* - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - { - // Override point for customization after application launch. - return YES; - } - */ - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - EWOL_INFO("move windows in applicationWillResignActive"); - [glView speedSlow]; - IOs::background(); -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - EWOL_INFO("move windows in applicationDidEnterBackground"); - [glView stopDisplayLink]; - IOs::suspend(); -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - EWOL_INFO("move windows in applicationWillEnterForeground"); - IOs::resume(); - [glView startDisplayLink]; -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - EWOL_INFO("move windows in applicationDidBecomeActive"); - [glView speedNormal]; - IOs::foreground(); -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - // Create interface of ewol here .... - EWOL_INFO("move windows in applicationWillTerminate"); - IOs::stop(); - IOs::releaseInterface(); -} - - -/* - - (void)dealloc { - [window release]; - [glView release]; - [super dealloc]; - } - */ - -@end diff --git a/ewol/context/IOs/Context.cpp b/ewol/context/IOs/Context.cpp deleted file mode 100644 index 0b5a7b66..00000000 --- a/ewol/context/IOs/Context.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - - -int64_t ewol::getTime() { - struct timespec now; - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - now.tv_sec = mts.tv_sec; - now.tv_nsec = mts.tv_nsec; - //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_nsec/(int64_t)1000); -} - -#undef __class__ -#define __class__ "MacOSInterface" - - - -class MacOSInterface : public ewol::Context { -private: - ewol::key::Special m_guiKeyBoardMode; -public: - MacOSInterface(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) : - ewol::Context(_application, _argc, _argv) { - // nothing to do ... - } - - int32_t Run() { - - return 0; - } - virtual void stop() { - mm_exit(); - } -public: - //interface MacOS : - - bool MAC_Draw(bool _displayEveryTime) { - return OS_Draw(_displayEveryTime); - } - void MAC_Resize(float _x, float _y) { - OS_Resize(vec2(_x,_y)); - } - void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) { - OS_SetMouseState(_id, _isDown, vec2(_x, _y)); - } - void MAC_SetMouseMotion(int32_t _id, float _x, float _y) { - OS_SetMouseMotion(_id, vec2(_x, _y)); - } - void MAC_SetInputState(int32_t _id, bool _isDown, float _x, float _y) { - OS_SetInputState(_id, _isDown, vec2(_x, _y)); - } - void MAC_SetInputMotion(int32_t _id, float _x, float _y) { - OS_SetInputMotion(_id, vec2(_x, _y)); - } - void MAC_SetKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) { - if (_unichar == u32char::Delete) { - _unichar = u32char::Suppress; - } else if (_unichar == u32char::Suppress) { - _unichar = u32char::Delete; - } - if (_unichar == u32char::CarrierReturn) { - _unichar = u32char::Return; - } - //EWOL_DEBUG("key: " << _unichar << " up=" << !_isDown); - if (_unichar <= 4) { - enum ewol::key::keyboard move; - switch(_unichar) { - case 0: - move = ewol::key::keyboardUp; - break; - case 1: - move = ewol::key::keyboardDown; - break; - case 2: - move = ewol::key::keyboardLeft; - break; - case 3: - move = ewol::key::keyboardRight; - break; - } - OS_SetKeyboardMove(_keyboardMode, move, !_isDown, _isAReapeateKey); - } else { - OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey); - } - } - void MAC_SetKeyboardMove(ewol::key::Special& _special, - enum ewol::key::keyboard _move, - bool _isDown) { - OS_SetKeyboardMove(_special, _move, _isDown); - } - void openURL(const std::string& _url) { - mm_openURL(_url.c_str()); - } -}; - - -MacOSInterface* interface = nullptr; - - - -bool IOs::draw(bool _displayEveryTime) { - if (interface == nullptr) { - return false; - } - return interface->MAC_Draw(_displayEveryTime); -} - -void IOs::resize(float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_Resize(_x, _y); -} - - -void IOs::setMouseState(int32_t _id, bool _isDown, float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_SetMouseState(_id, _isDown, _x, _y); -} - -void IOs::setMouseMotion(int32_t _id, float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_SetMouseMotion(_id, _x, _y); -} - -void IOs::setInputState(int32_t _id, bool _isDown, float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_SetInputState(_id, _isDown, _x, _y); -} - -void IOs::setInputMotion(int32_t _id, float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_SetInputMotion(_id, _x, _y); -} - -void IOs::setKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) { - if (interface == nullptr) { - return; - } - interface->MAC_SetKeyboard(_keyboardMode, _unichar, _isDown, _isAReapeateKey); -} - -void IOs::setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::keyboard _move, bool _isDown) { - if (interface == nullptr) { - return; - } - interface->MAC_SetKeyboardMove(_keyboardMode, _move, _isDown); -} - -void IOs::start() { - if (interface == nullptr) { - return; - } - //interface->OS_Start(); -} - -void IOs::resume() { - if (interface == nullptr) { - return; - } - interface->OS_Resume(); -} - -void IOs::suspend() { - if (interface == nullptr) { - return; - } - interface->OS_Suspend(); -} - -void IOs::stop() { - if (interface == nullptr) { - return; - } - interface->OS_Stop(); -} -void IOs::background() { - if (interface == nullptr) { - return; - } - interface->OS_Background(); -} -void IOs::foreground() { - if (interface == nullptr) { - return; - } - interface->OS_Foreground(); -} - - -static int l_argc = 0; -static const char **l_argv = nullptr; -static ewol::context::Application* l_application; -/** - * @brief Main of the program - * @param std IO - * @return std IO - */ -int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { - l_argc = _argc; - l_argv = _argv; - l_application = _application; - return mm_main(_argc, _argv); -} - -// Creat and relaese ewol::Context interface: -void IOs::createInterface() { - etk::init(l_argc, l_argv); - EWOL_INFO("Create new interface"); - interface = new MacOSInterface(l_application, l_argc, l_argv); - l_application = nullptr; - if (nullptr == interface) { - EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); - return; - } -} - -void IOs::releaseInterface() { - if (interface != nullptr) { - EWOL_INFO("Remove interface"); - } - delete(interface); - interface = nullptr; -} - - - - - - diff --git a/ewol/context/IOs/Context.h b/ewol/context/IOs/Context.h deleted file mode 100644 index 6b48f650..00000000 --- a/ewol/context/IOs/Context.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __MAC_OS_CONTEXT_H__ -#define __MAC_OS_CONTEXT_H__ - -#include - -namespace IOs { - // Create and relaese ewol::Context interface: - void createInterface(); - void releaseInterface(); - // return true if a flush is needed - bool draw(bool _displayEveryTime); - /** - * @brief The OS inform that the current windows has change his size. - * @param[in] _size new size of the windows. - */ - void resize(float _x, float _y); - void setMouseState(int32_t _id, bool _isDown, float _x, float _y); - void setMouseMotion(int32_t _id, float _x, float _y); - void setInputState(int32_t _id, bool _isDown, float _x, float _y); - void setInputMotion(int32_t _id, float _x, float _y); - void setKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey); - void setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::keyboard _move, bool _isDown); - void start(); - void stop(); - void foreground(); - void background(); - void resume(); - void suspend(); -}; - - -#endif \ No newline at end of file diff --git a/ewol/context/IOs/Interface.h b/ewol/context/IOs/Interface.h deleted file mode 100644 index 885bf0c1..00000000 --- a/ewol/context/IOs/Interface.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_MM_INTERFACE_H__ -#define __EWOL_MM_INTERFACE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -int mm_main(int _argc, const char *_argv[]); -void mm_exit(); -void mm_openURL(const char *_url); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ewol/context/IOs/Interface.m b/ewol/context/IOs/Interface.m deleted file mode 100644 index 681e44c1..00000000 --- a/ewol/context/IOs/Interface.m +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#import -#import -//#import "AppDelegate.h" - - - -int mm_main(int argc, const char *argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, (char**)argv, nil, NSStringFromClass([AppDelegate class])); - } - // return no error - return 0; -} - -void mm_exit(void) { - [[NSThread mainThread] cancel]; -} - -void mm_openURL(const char *_url) { - NSString* url = [[NSString alloc] initWithUTF8String:_url]; - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; -} - diff --git a/ewol/context/IOs/OpenglView.h b/ewol/context/IOs/OpenglView.h deleted file mode 100644 index 2cf99c46..00000000 --- a/ewol/context/IOs/OpenglView.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// EAGLView.h -// OpenGLBasics -// -// Created by Charlie Key on 6/24/09. -// - - -#import -#import -#include -#include - -/* - This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass. - The view content is basically an EAGL surface you render your OpenGL scene into. - Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. - */ -@interface OpenglView : UIView { -@private - CAEAGLLayer* _eaglLayer; - - EAGLContext *_context; - GLuint _colorRenderBuffer; - GLuint _depthRenderBuffer; - - /* OpenGL names for the renderbuffer and framebuffers used to render to this view */ - GLuint viewRenderbuffer, viewFramebuffer; - - /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */ - GLuint depthRenderbuffer; - CGSize m_currentSize; - CADisplayLink* displayLink; //!< link to start and stop display of the view... - int deltaDisplay; - int displayCounter; -} -- (void)stopDisplayLink; -- (void)startDisplayLink; -- (void)speedSlow; -- (void)speedNormal; -@end diff --git a/ewol/context/IOs/OpenglView.mm b/ewol/context/IOs/OpenglView.mm deleted file mode 100644 index 66f6d32c..00000000 --- a/ewol/context/IOs/OpenglView.mm +++ /dev/null @@ -1,281 +0,0 @@ -// -// EAGLView.m -// OpenGLBasics -// -// Created by Charlie Key on 6/24/09. -// - -#import -#import -#include -#include - - -#include -#include - -#import "OpenglView.h" -#include - - -@interface OpenglView () -@end - - -@implementation OpenglView - -// You must implement this method (it does not work without it) -+ (Class)layerClass { - return [CAEAGLLayer class]; -} - -- (NSString *) platform { - size_t size; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *machine = (char*)malloc(size); - sysctlbyname("hw.machine", machine, &size, NULL, 0); - NSString *platform = [NSString stringWithUTF8String:machine]; - free(machine); - return platform; -} - -- (NSString *) platformString { - NSString *platform = [self platform]; - if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G"; - if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G"; - if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS"; - if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4"; - if ([platform isEqualToString:@"iPhone3,3"]) return @"Verizon iPhone 4"; - if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S"; - if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5 (GSM)"; - if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)"; - if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)"; - if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)"; - if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)"; - if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)"; - if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G"; - if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G"; - if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G"; - if ([platform isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G"; - if ([platform isEqualToString:@"iPod5,1"]) return @"iPod Touch 5G"; - if ([platform isEqualToString:@"iPad1,1"]) return @"iPad"; - if ([platform isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)"; - if ([platform isEqualToString:@"iPad2,2"]) return @"iPad 2 (GSM)"; - if ([platform isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)"; - if ([platform isEqualToString:@"iPad2,4"]) return @"iPad 2 (WiFi)"; - if ([platform isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)"; - if ([platform isEqualToString:@"iPad2,6"]) return @"iPad Mini (GSM)"; - if ([platform isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)"; - if ([platform isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)"; - if ([platform isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)"; - if ([platform isEqualToString:@"iPad3,3"]) return @"iPad 3 (GSM)"; - if ([platform isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)"; - if ([platform isEqualToString:@"iPad3,5"]) return @"iPad 4 (GSM)"; - if ([platform isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)"; - if ([platform isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)"; - if ([platform isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)"; - if ([platform isEqualToString:@"iPad4,4"]) return @"iPad mini 2G (WiFi)"; - if ([platform isEqualToString:@"iPad4,5"]) return @"iPad mini 2G (Cellular)"; - if ([platform isEqualToString:@"i386"]) return @"Simulator"; - if ([platform isEqualToString:@"x86_64"]) return @"Simulator"; - return platform; -} -- (float)getScreenPPP { - NSString *platform = [self platform]; - if ([platform isEqualToString:@"iPhone1,1"]) return 326.0f; //@"iPhone 1G"; - if ([platform isEqualToString:@"iPhone1,2"]) return 326.0f; //@"iPhone 3G"; - if ([platform isEqualToString:@"iPhone2,1"]) return 326.0f; //@"iPhone 3GS"; - if ([platform isEqualToString:@"iPhone3,1"]) return 326.0f; //@"iPhone 4"; - if ([platform isEqualToString:@"iPhone3,3"]) return 326.0f; //@"Verizon iPhone 4"; - if ([platform isEqualToString:@"iPhone4,1"]) return 326.0f; //@"iPhone 4S"; - if ([platform isEqualToString:@"iPhone5,1"]) return 326.0f; //@"iPhone 5 (GSM)"; - if ([platform isEqualToString:@"iPhone5,2"]) return 326.0f; //@"iPhone 5 (GSM+CDMA)"; - if ([platform isEqualToString:@"iPhone5,3"]) return 326.0f; //@"iPhone 5c (GSM)"; - if ([platform isEqualToString:@"iPhone5,4"]) return 326.0f; //@"iPhone 5c (GSM+CDMA)"; - if ([platform isEqualToString:@"iPhone6,1"]) return 326.0f; //@"iPhone 5s (GSM)"; - if ([platform isEqualToString:@"iPhone6,2"]) return 326.0f; //@"iPhone 5s (GSM+CDMA)"; - if ([platform isEqualToString:@"iPod1,1"]) return 326.0f; //@"iPod Touch 1G"; - if ([platform isEqualToString:@"iPod2,1"]) return 326.0f; //@"iPod Touch 2G"; - if ([platform isEqualToString:@"iPod3,1"]) return 326.0f; //@"iPod Touch 3G"; - if ([platform isEqualToString:@"iPod4,1"]) return 326.0f; //@"iPod Touch 4G"; - if ([platform isEqualToString:@"iPod5,1"]) return 326.0f; //@"iPod Touch 5G"; - if ([platform isEqualToString:@"iPad1,1"]) return 264.0f; //@"iPad"; - if ([platform isEqualToString:@"iPad2,1"]) return 264.0f; //@"iPad 2 (WiFi)"; - if ([platform isEqualToString:@"iPad2,2"]) return 264.0f; //@"iPad 2 (GSM)"; - if ([platform isEqualToString:@"iPad2,3"]) return 264.0f; //@"iPad 2 (CDMA)"; - if ([platform isEqualToString:@"iPad2,4"]) return 264.0f; //@"iPad 2 (WiFi)"; - if ([platform isEqualToString:@"iPad2,5"]) return 163.0f; //@"iPad Mini (WiFi)"; - if ([platform isEqualToString:@"iPad2,6"]) return 163.0f; //@"iPad Mini (GSM)"; - if ([platform isEqualToString:@"iPad2,7"]) return 163.0f; //@"iPad Mini (GSM+CDMA)"; - if ([platform isEqualToString:@"iPad3,1"]) return 264.0f; //@"iPad 3 (WiFi)"; - if ([platform isEqualToString:@"iPad3,2"]) return 264.0f; //@"iPad 3 (GSM+CDMA)"; - if ([platform isEqualToString:@"iPad3,3"]) return 264.0f; //@"iPad 3 (GSM)"; - if ([platform isEqualToString:@"iPad3,4"]) return 264.0f; //@"iPad 4 (WiFi)"; - if ([platform isEqualToString:@"iPad3,5"]) return 264.0f; //@"iPad 4 (GSM)"; - if ([platform isEqualToString:@"iPad3,6"]) return 264.0f; //@"iPad 4 (GSM+CDMA)"; - if ([platform isEqualToString:@"iPad4,1"]) return 264.0f; //@"iPad Air (WiFi)"; - if ([platform isEqualToString:@"iPad4,2"]) return 264.0f; //@"iPad Air (Cellular)"; - if ([platform isEqualToString:@"iPad4,4"]) return 326.0f; //@"iPad mini 2G (WiFi)"; - if ([platform isEqualToString:@"iPad4,5"]) return 326.0f; //@"iPad mini 2G (Cellular)"; - if ([platform isEqualToString:@"i386"]) return 200.0f; //@"Simulator"; - if ([platform isEqualToString:@"x86_64"]) return 326.0f; //@"Simulator"; - return 326.0f; -} - -- (void)setNeedsDisplay { - EWOL_INFO("**** setNeedsDisplay:" << vec2(self.frame.size.width, self.frame.size.height)); - // TODO : SIZE change ... - -} -- (void)configureAspectRatio { - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - m_currentSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale); - //self.frame.size = m_currentSize; - - EWOL_INFO("**** screen size:" << vec2(m_currentSize.width, m_currentSize.height)); - float ratio = [self getScreenPPP]; - EWOL_INFO("**** pixel ratio: " << ratio); - ewol::Dimension::setPixelRatio(vec2(1.0f/ratio, 1.0f/ratio), ewol::Dimension::Inch); - IOs::resize(m_currentSize.width, m_currentSize.height); - CGRect localBounds = [self bounds]; - EWOL_INFO("**** localBounds:" << vec2(localBounds.size.width, localBounds.size.height)); - -} -- (void)setupLayer { - _eaglLayer = (CAEAGLLayer*) self.layer; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - _eaglLayer.contentsScale = screenScale; - _eaglLayer.opaque = YES; -} - -- (void)setupContext { - EAGLRenderingAPI api = kEAGLRenderingAPIOpenGLES2; - _context = [[EAGLContext alloc] initWithAPI:api]; - if (!_context) { - NSLog(@"Failed to initialize OpenGLES 2.0 context"); - exit(1); - } - if (![EAGLContext setCurrentContext:_context]) { - NSLog(@"Failed to set current OpenGL context"); - exit(1); - } -} - - -- (void)setupRenderBuffer { - glGenRenderbuffers(1, &_colorRenderBuffer); - glBindRenderbuffer(GL_RENDERBUFFER, _colorRenderBuffer); - [_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:_eaglLayer]; -} - -- (void)setupDepthBuffer { - glGenRenderbuffers(1, &_depthRenderBuffer); - glBindRenderbuffer(GL_RENDERBUFFER, _depthRenderBuffer); - CGFloat screenScale = [[UIScreen mainScreen] scale]; - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, self.frame.size.width*screenScale, self.frame.size.height*screenScale); -} - -- (void)setupFrameBuffer { - GLuint framebuffer; - glGenFramebuffers(1, &framebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _colorRenderBuffer); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBuffer); -} - -- (void)render:(CADisplayLink*)displayLink { - displayCounter++; - if (displayCounter >= deltaDisplay) { - displayCounter = 0; - IOs::draw(true); - [_context presentRenderbuffer:GL_RENDERBUFFER]; - } -} - -- (void)speedSlow { - deltaDisplay = 5; -} - -- (void)speedNormal { - deltaDisplay = 1; -} - -- (void)startDisplayLink { - if (displayLink != NULL) { - return; - } - displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render:)]; - [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; -} - -- (void)stopDisplayLink { - if (displayLink == NULL) { - return; - } - [displayLink removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; - displayLink = NULL; -} - -- (id)initWithFrame:(CGRect)frame { - deltaDisplay = 1; - displayCounter = 0; - NSLog(@"INIT with size : %fx%f, %fx%f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); - self = [super initWithFrame:frame]; - self.contentScaleFactor = 1.0f; - // TODO : Enable multi touch ==> but this generate many sub errors ... 3 touch can be appear in 1 event ... - //self.multipleTouchEnabled = YES; - if (self) { - [self configureAspectRatio]; - [self setupLayer]; - [self setupContext]; - [self setupDepthBuffer]; - [self setupRenderBuffer]; - [self setupFrameBuffer]; - [self startDisplayLink]; - } - return self; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - UITouch *touch = [touches anyObject]; - CGPoint touchLocation = [touch locationInView:self]; - CGRect localBounds = [self bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - vec2 positionEvent(touchLocation.x*screenScale, (localBounds.size.height - touchLocation.y)*screenScale); - EWOL_DEBUG(touches.count << " touchesBegan: " << positionEvent); - IOs::setInputState(1, true, positionEvent.x(), positionEvent.y()); -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - UITouch *touch = [touches anyObject]; - CGPoint touchLocation = [touch locationInView:self]; - CGRect localBounds = [self bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - vec2 positionEvent(touchLocation.x*screenScale, (localBounds.size.height - touchLocation.y)*screenScale); - EWOL_DEBUG(touches.count << " touchesEnded: " << positionEvent); - IOs::setInputState(1, false, positionEvent.x(), positionEvent.y()); -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - UITouch *touch = [touches anyObject]; - CGPoint touchLocation = [touch locationInView:self]; - CGRect localBounds = [self bounds]; - CGFloat screenScale = [[UIScreen mainScreen] scale]; - vec2 positionEvent(touchLocation.x*screenScale, (localBounds.size.height - touchLocation.y)*screenScale); - EWOL_DEBUG(touches.count << " touchesMoved: " << positionEvent); - IOs::setInputMotion(1, positionEvent.x(), positionEvent.y()); -} - -- (void)layoutSubviews { - [EAGLContext setCurrentContext:_context]; -} - -- (void)dealloc { - if ([EAGLContext currentContext] == _context) { - [EAGLContext setCurrentContext:nil]; - } -} - - -@end diff --git a/ewol/context/InputManager.cpp b/ewol/context/InputManager.cpp index b3b9dda2..168a1e29 100644 --- a/ewol/context/InputManager.cpp +++ b/ewol/context/InputManager.cpp @@ -41,13 +41,13 @@ void ewol::context::InputManager::setDpi(int32_t newDPI) { calculateLimit(); } -bool ewol::context::InputManager::localEventInput(enum ewol::key::type _type, +bool ewol::context::InputManager::localEventInput(enum gale::key::type _type, std::shared_ptr _destWidget, int32_t _IdInput, - enum ewol::key::status _status, + enum gale::key::status _status, vec2 _pos) { if (nullptr != _destWidget) { - if (_type == ewol::key::typeMouse || _type == ewol::key::typeFinger) { + if (_type == gale::key::type_mouse || _type == gale::key::type_finger) { // create the system Event : ewol::event::InputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0, m_specialKey); // TODO : set the real ID ... // generate the event : @@ -61,7 +61,7 @@ bool ewol::context::InputManager::localEventInput(enum ewol::key::type _type, void ewol::context::InputManager::abortElement(InputPoperty *_eventTable, int32_t _idInput, - enum ewol::key::type _type) { + enum gale::key::type _type) { if (nullptr == _eventTable) { return; } @@ -69,7 +69,7 @@ void ewol::context::InputManager::abortElement(InputPoperty *_eventTable, localEventInput(_type, _eventTable[_idInput].curentWidgetEvent.lock(), _eventTable[_idInput].destinationInputId, - ewol::key::statusAbort, + gale::key::status_abort, _eventTable[_idInput].posEvent); } } @@ -104,23 +104,23 @@ void ewol::context::InputManager::transfertEvent(std::shared_ptr _ if (tmpWidget == _source) { // inform the widget that it does not receive the event now EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent); - localEventInput(ewol::key::typeFinger, tmpWidget, m_eventInputSaved[iii].destinationInputId, ewol::key::statusAbort, m_eventInputSaved[iii].posEvent); + localEventInput(gale::key::type_finger, tmpWidget, m_eventInputSaved[iii].destinationInputId, gale::key::status_abort, m_eventInputSaved[iii].posEvent); // set the new widget ... m_eventInputSaved[iii].curentWidgetEvent = _destination; // inform the widget that he receive the event property now... EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent); - localEventInput(ewol::key::typeFinger, _destination, m_eventInputSaved[iii].destinationInputId, ewol::key::statusTransfert, m_eventInputSaved[iii].posEvent); + localEventInput(gale::key::type_finger, _destination, m_eventInputSaved[iii].destinationInputId, gale::key::status_transfert, m_eventInputSaved[iii].posEvent); } tmpWidget = m_eventMouseSaved[iii].curentWidgetEvent.lock(); if (tmpWidget == _source) { // inform the widget that it does not receive the event now EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent); - localEventInput(ewol::key::typeMouse, tmpWidget, m_eventMouseSaved[iii].destinationInputId, ewol::key::statusAbort, m_eventMouseSaved[iii].posEvent); + localEventInput(gale::key::type_mouse, tmpWidget, m_eventMouseSaved[iii].destinationInputId, gale::key::status_abort, m_eventMouseSaved[iii].posEvent); // set the new widget ... m_eventMouseSaved[iii].curentWidgetEvent = _destination; // inform the widget that he receive the event property now... EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent); - localEventInput(ewol::key::typeMouse, _destination, m_eventMouseSaved[iii].destinationInputId, ewol::key::statusTransfert, m_eventMouseSaved[iii].posEvent); + localEventInput(gale::key::type_mouse, _destination, m_eventMouseSaved[iii].destinationInputId, gale::key::status_transfert, m_eventMouseSaved[iii].posEvent); } } } @@ -130,22 +130,24 @@ void ewol::context::InputManager::grabPointer(std::shared_ptr _wid return; } m_grabWidget = _widget; + /* TODO : m_context.grabPointerEvents(true, _widget->getOrigin() + ivec2(_widget->getSize().x()/2.0f, _widget->getSize().y()/2.0f) ); + */ } void ewol::context::InputManager::unGrabPointer() { m_grabWidget.reset(); - m_context.grabPointerEvents(false, vec2(0,0)); + // TODO: m_context.grabPointerEvents(false, vec2(0,0)); } void ewol::context::InputManager::newLayerSet() { for(int32_t iii=0; iii _destWidget, int32_t _realInputId) { - if (_type == ewol::key::typeFinger) { + if (_type == gale::key::type_finger) { int32_t lastMinimum = 0; for(int32_t iii=0; iii the it was finger event ... -void ewol::context::InputManager::motion(enum ewol::key::type _type, +void ewol::context::InputManager::motion(enum gale::key::type _type, int _pointerID, vec2 _pos) { EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos); @@ -198,9 +200,9 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, return; } InputPoperty *eventTable = nullptr; - if (_type == ewol::key::typeMouse) { + if (_type == gale::key::type_mouse) { eventTable = m_eventMouseSaved; - } else if (_type == ewol::key::typeFinger) { + } else if (_type == gale::key::type_finger) { eventTable = m_eventInputSaved; } else { EWOL_ERROR("Unknown type of event"); @@ -213,7 +215,7 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, } std::shared_ptr tmpWindows = m_context.getWindows(); // special case for the mouse event 0 that represent the hover event of the system : - if (_type == ewol::key::typeMouse && _pointerID == 0) { + if (_type == gale::key::type_mouse && _pointerID == 0) { // this event is all time on the good widget ... and manage the enter and leave ... // NOTE : the "layer widget" force us to get the widget at the specific position all the time : std::shared_ptr tmpWidget; @@ -237,7 +239,7 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.lock(), eventTable[_pointerID].destinationInputId, - ewol::key::statusLeave, + gale::key::status_leave, _pos); } if (eventTable[_pointerID].isInside == false) { @@ -259,7 +261,7 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, - ewol::key::statusEnter, + gale::key::status_enter, _pos); } EVENT_DEBUG("GUI : Input ID=" << _pointerID @@ -269,7 +271,7 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, - ewol::key::statusMove, + gale::key::status_move, _pos); } else if (true == eventTable[_pointerID].isUsed) { if (true == eventTable[_pointerID].isInside) { @@ -285,7 +287,7 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.lock(), eventTable[_pointerID].destinationInputId, - ewol::key::statusLeave, + gale::key::status_leave, _pos); } } else { @@ -301,7 +303,7 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.lock(), eventTable[_pointerID].destinationInputId, - ewol::key::statusEnter, + gale::key::status_enter, _pos); } } @@ -312,12 +314,12 @@ void ewol::context::InputManager::motion(enum ewol::key::type _type, localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.lock(), eventTable[_pointerID].destinationInputId, - ewol::key::statusMove, + gale::key::status_move, _pos); } } -void ewol::context::InputManager::state(enum ewol::key::type _type, +void ewol::context::InputManager::state(enum gale::key::type _type, int _pointerID, bool _isDown, vec2 _pos) @@ -330,10 +332,10 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, // convert position in open-GL coordonates ... InputPoperty *eventTable = nullptr; InputLimit localLimit; - if (_type == ewol::key::typeMouse) { + if (_type == gale::key::type_mouse) { eventTable = m_eventMouseSaved; localLimit = m_eventMouseLimit; - } else if (_type == ewol::key::typeFinger) { + } else if (_type == gale::key::type_finger) { eventTable = m_eventInputSaved; localLimit = m_eventInputLimit; } else { @@ -373,7 +375,7 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.lock(), eventTable[_pointerID].destinationInputId, - ewol::key::statusDown, + gale::key::status_down, _pos); } else { // Mark it used : @@ -388,7 +390,7 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, // get destination widget : if(nullptr != tmpWindows) { if ( tmpWidget != nullptr - && _type == ewol::key::typeMouse) { + && _type == gale::key::type_mouse) { eventTable[_pointerID].curentWidgetEvent = tmpWidget; } else { eventTable[_pointerID].curentWidgetEvent = tmpWindows->getWidgetAtPos(_pos); @@ -412,7 +414,7 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, - ewol::key::statusDown, + gale::key::status_down, _pos); } } else { @@ -437,7 +439,7 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, localEventInput(_type, tmpWidget, _pointerID, - ewol::key::statusUp, + gale::key::status_up, _pos); // generate event (single) if( abs(eventTable[_pointerID].downStart.x() - _pos.x()) < localLimit.DpiOffset @@ -455,7 +457,7 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, } // in grab mode the single to quinte event are not generated .... if( ( m_grabWidget.lock() == nullptr - || _type != ewol::key::typeMouse ) + || _type != gale::key::type_mouse ) && eventTable[_pointerID].nbClickEvent < nbClickMax) { // generate event SINGLE : eventTable[_pointerID].nbClickEvent++; @@ -466,7 +468,7 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, - (enum ewol::key::status)(ewol::key::statusSingle + eventTable[_pointerID].nbClickEvent-1), + (enum gale::key::status)(gale::key::status_single + eventTable[_pointerID].nbClickEvent-1), _pos); if( eventTable[_pointerID].nbClickEvent >= nbClickMax) { eventTable[_pointerID].nbClickEvent = 0; @@ -479,10 +481,10 @@ void ewol::context::InputManager::state(enum ewol::key::type _type, localEventInput(_type, tmpWidget, _pointerID, - ewol::key::statusUpAfter, + gale::key::status_upAfter, _pos); // specific for tuch event - if (_type == ewol::key::typeFinger) { + if (_type == gale::key::type_finger) { cleanElement(eventTable, _pointerID); } } diff --git a/ewol/context/InputManager.h b/ewol/context/InputManager.h index 2e9a09d6..ce561608 100644 --- a/ewol/context/InputManager.h +++ b/ewol/context/InputManager.h @@ -55,7 +55,7 @@ namespace ewol { void calculateLimit(); InputPoperty m_eventInputSaved[MAX_MANAGE_INPUT]; InputPoperty m_eventMouseSaved[MAX_MANAGE_INPUT]; - void abortElement(InputPoperty* _eventTable, int32_t _idInput, enum ewol::key::type _type); + void abortElement(InputPoperty* _eventTable, int32_t _idInput, enum gale::key::type _type); void cleanElement(InputPoperty* _eventTable, int32_t _idInput); /** * @brief generate the event on the destinated widget. @@ -66,10 +66,10 @@ namespace ewol { * @param[in] _pos position of the event * @return true if event has been greped */ - bool localEventInput(enum ewol::key::type _type, + bool localEventInput(enum gale::key::type _type, std::shared_ptr _destWidget, int32_t _IdInput, - enum ewol::key::status _typeEvent, + enum gale::key::status _typeEvent, vec2 _pos); /** * @brief convert the system event id in the correct EWOL id depending of the system management mode @@ -80,7 +80,7 @@ namespace ewol { * @param[in] _realInputId system Id * @return the ewol input id */ - int32_t localGetDestinationId(enum ewol::key::type _type, + int32_t localGetDestinationId(enum gale::key::type _type, std::shared_ptr _destWidget, int32_t _realInputId); private: @@ -91,8 +91,8 @@ namespace ewol { void setDpi(int32_t _newDPI); // note if id<0 == > the it was finger event ... - void motion(enum ewol::key::type _type, int _pointerID, vec2 _pos ); - void state(enum ewol::key::type _type, int _pointerID, bool _isDown, vec2 _pos); + void motion(enum gale::key::type _type, int _pointerID, vec2 _pos ); + void state(enum gale::key::type _type, int _pointerID, bool _isDown, vec2 _pos); public: /** * @brief a new layer on the windows is set == > might remove all the property of the current element ... @@ -114,9 +114,9 @@ namespace ewol { */ void unGrabPointer(); private: - ewol::key::Special m_specialKey; + gale::key::Special m_specialKey; public: - void setLastKeyboardSpecial(const ewol::key::Special& _specialKey) { + void setLastKeyboardSpecial(const gale::key::Special& _specialKey) { m_specialKey = _specialKey; } }; diff --git a/ewol/context/MacOs/AppDelegate.h b/ewol/context/MacOs/AppDelegate.h deleted file mode 100644 index 2615f46d..00000000 --- a/ewol/context/MacOs/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#import - -@interface MacOsAppDelegate : NSObject - -@property (assign) IBOutlet NSWindow *window; -- (void)sendEvent:(NSEvent *)event; -- (void)applicationWillResignActive:(MacOsAppDelegate *)application; -@end diff --git a/ewol/context/MacOs/AppDelegate.mm b/ewol/context/MacOs/AppDelegate.mm deleted file mode 100644 index c83185d5..00000000 --- a/ewol/context/MacOs/AppDelegate.mm +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#import -#import - -#include - -@implementation MacOsAppDelegate -@synthesize window=_window; - -- (BOOL)application:(MacOsAppDelegate *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - OpenGLView *view=[[OpenGLView alloc]initWithFrame:[[NSScreen mainScreen] frame]]; - return YES; -} - -- (void)applicationWillResignActive:(MacOsAppDelegate *)application { - /* - Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - */ - EWOL_INFO("move windows in applicationWillResignActive"); -} - -- (void)applicationDidEnterBackground:(MacOsAppDelegate *)application { - /* - Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - */ - EWOL_INFO("move windows in applicationDidEnterBackground"); -} - -- (void)applicationWillEnterForeground:(MacOsAppDelegate *)application { - /* - Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - */ - EWOL_INFO("move windows in applicationWillEnterForeground"); -} - -- (void)applicationDidBecomeActive:(MacOsAppDelegate *)application { - /* - Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - */ - EWOL_INFO("move windows in applicationDidBecomeActive"); -} - -- (void)applicationWillTerminate:(MacOsAppDelegate *)application { - /* - Called when the application is about to terminate. - Save data if appropriate. - See also applicationDidEnterBackground:. - */ - EWOL_INFO("move windows in applicationWillTerminate"); -} - -- (void)dealloc { - [_window release]; - [super dealloc]; -} - - -- (void)sendEvent:(NSEvent *)event { - EWOL_WARNING(" EVENT ... "); -} - - -@end - - - diff --git a/ewol/context/MacOs/Context.h b/ewol/context/MacOs/Context.h deleted file mode 100644 index 3a62c5c2..00000000 --- a/ewol/context/MacOs/Context.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __MAC_OS_CONTEXT_H__ -#define __MAC_OS_CONTEXT_H__ - -#include - -namespace MacOs { - // return true if a flush is needed - bool draw(bool _displayEveryTime); - /** - * @brief The OS inform that the current windows has change his size. - * @param[in] _size new size of the windows. - */ - void resize(float _x, float _y); - void setMouseState(int32_t _id, bool _isDown, float _x, float _y); - void setMouseMotion(int32_t _id, float _x, float _y); - void setKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey); - void setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::keyboard _move, bool _isDown, bool _isAReapeateKey); - void stopRequested(); - void setRedrawCallback(const std::function& _func); -}; - -#endif \ No newline at end of file diff --git a/ewol/context/MacOs/Context.mm b/ewol/context/MacOs/Context.mm deleted file mode 100644 index 0a09c284..00000000 --- a/ewol/context/MacOs/Context.mm +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - -#import - -int64_t ewol::getTime() { - struct timespec now; - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - now.tv_sec = mts.tv_sec; - now.tv_nsec = mts.tv_nsec; - //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_nsec/(int64_t)1000); -} - -#undef __class__ -#define __class__ "MacOSInterface" - - - -class MacOSInterface : public ewol::Context { - private: - ewol::key::Special m_guiKeyBoardMode; - public: - MacOSInterface(ewol::context::Application* _application, int _argc, const char* _argv[]) : - ewol::Context(_application, _argc, _argv) { - mm_main(_argc, _argv); - } - - int32_t Run() { - return mm_run(); - } - public: - //interface MacOS : - - bool MAC_Draw(bool _displayEveryTime) { - return OS_Draw(_displayEveryTime); - } - void MAC_Resize(float _x, float _y) { - OS_Resize(vec2(_x,_y)); - } - void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) { - OS_SetMouseState(_id, _isDown, vec2(_x, _y)); - } - void MAC_SetMouseMotion(int32_t _id, float _x, float _y) { - OS_SetMouseMotion(_id, vec2(_x, _y)); - } - void MAC_SetKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) { - if (char32_t(_unichar) == u32char::Delete) { - _unichar = u32char::Suppress; - } else if (char32_t(_unichar) == u32char::Suppress) { - _unichar = u32char::Delete; - } - if (char32_t(_unichar) == u32char::CarrierReturn) { - _unichar = u32char::Return; - } - //EWOL_DEBUG("key: " << _unichar << " up=" << !_isDown); - if (_unichar <= 4) { - enum ewol::key::keyboard move; - switch(_unichar) { - case 0: - move = ewol::key::keyboardUp; - break; - case 1: - move = ewol::key::keyboardDown; - break; - case 2: - move = ewol::key::keyboardLeft; - break; - case 3: - move = ewol::key::keyboardRight; - break; - } - OS_SetKeyboardMove(_keyboardMode, move, !_isDown, _isAReapeateKey); - } else { - OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey); - } - } - void MAC_SetKeyboardMove(ewol::key::Special& _special, - enum ewol::key::keyboard _move, - bool _isDown, - bool _isAReapeateKey) { - OS_SetKeyboardMove(_special, _move, _isDown, _isAReapeateKey); - } - void openURL(const std::string& _url) { - std::string req = "open " + _url; - system(req.c_str()); - } - void MAC_Stop() { - OS_Stop(); - } - void stop() { - mm_stopApplication(); - } - void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - if (_clipboardID == ewol::context::clipBoard::clipboardStd) { - NSPasteboard* myPasteboard = [NSPasteboard generalPasteboard]; - NSString* myString = [myPasteboard stringForType:NSPasteboardTypeString]; - std::string val([myString UTF8String]); - ewol::context::clipBoard::setSystem(_clipboardID, val); - if (val.size() != 0) { - OS_ClipBoardArrive(_clipboardID); - } - } else { - ewol::Context::clipBoardGet(_clipboardID); - } - } - void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - if (_clipboardID == ewol::context::clipBoard::clipboardStd) { - NSPasteboard* myPasteboard = [NSPasteboard generalPasteboard]; - [myPasteboard clearContents]; - //EWOL_ERROR(" copy: " << ewol::context::clipBoard::get(_clipboardID)); - NSString *text = [[NSString alloc] initWithUTF8String:ewol::context::clipBoard::get(_clipboardID).c_str()]; - BOOL err = [myPasteboard setString:text forType:NSPasteboardTypeString]; - if (err == FALSE) { - EWOL_ERROR("copy to clipboard can not be done ..."); - } - } else { - ewol::Context::clipBoardSet(_clipboardID); - } - } - -}; - - -MacOSInterface* interface = nullptr; - - - -bool MacOs::draw(bool _displayEveryTime) { - if (interface == nullptr) { - return false; - } - return interface->MAC_Draw(_displayEveryTime); -} - -void MacOs::resize(float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_Resize(_x, _y); -} - - -void MacOs::setMouseState(int32_t _id, bool _isDown, float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_SetMouseState(_id, _isDown, _x, _y); -} - -void MacOs::setMouseMotion(int32_t _id, float _x, float _y) { - if (interface == nullptr) { - return; - } - interface->MAC_SetMouseMotion(_id, _x, _y); -} - -void MacOs::setKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) { - if (interface == nullptr) { - return; - } - interface->MAC_SetKeyboard(_keyboardMode, _unichar, _isDown, _isAReapeateKey); -} - -void MacOs::setKeyboardMove(ewol::key::Special& _keyboardMode, enum ewol::key::keyboard _move, bool _isDown, bool _isAReapeateKey) { - if (interface == nullptr) { - return; - } - interface->MAC_SetKeyboardMove(_keyboardMode, _move, _isDown, _isAReapeateKey); -} - -void MacOs::stopRequested() { - if (interface == nullptr) { - return; - } - interface->MAC_Stop(); -} - -void MacOs::setRedrawCallback(const std::function& _func) { - if (interface == nullptr) { - return; - } - interface->getWidgetManager().setCallbackonRedrawNeeded(_func); -} - -/** - * @brief Main of the program - * @param std IO - * @return std IO - */ -int ewol::run(ewol::context::Application* _application, int _argc, const char* _argv[]) { - etk::init(_argc, _argv); - interface = new MacOSInterface(_application, _argc, _argv); - if (nullptr == interface) { - EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); - return -2; - } - - int32_t retValue = interface->Run(); - EWOL_INFO("Stop running"); - delete(interface); - interface = nullptr; - return retValue; -} - - - - - - - diff --git a/ewol/context/MacOs/Interface.h b/ewol/context/MacOs/Interface.h deleted file mode 100644 index 845038a3..00000000 --- a/ewol/context/MacOs/Interface.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_MM_INTERFACE_H__ -#define __EWOL_MM_INTERFACE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -int mm_main(int _argc, const char* _argv[]); -int mm_run(); -void mm_stopApplication(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ewol/context/MacOs/Interface.mm b/ewol/context/MacOs/Interface.mm deleted file mode 100644 index f8b6d0ba..00000000 --- a/ewol/context/MacOs/Interface.mm +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ -#include "Context.h" -#import -#include "ewol/context/MacOs/Interface.h" - -#import -#import -#import -#import - -id window = nil; - -void callbackSomeThingToDo() { - //EWOL_CRITICAL("ksdjlkqjsdlfkjsqdlkfjslqkdjflqksjdf"); - [window UpdateScreenRequested]; -} - -int mm_main(int _argc, const char* _argv[]) { - [NSAutoreleasePool new]; - - [NSApplication sharedApplication]; - // set the quit policy and all stadard for Mac - [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - - // --------------------------------------------------------------- - // -- basic menu bar creation : - // --------------------------------------------------------------- - // set the basic menu bar (stadard on Mac OSX) - id menubar = [[NSMenu new] autorelease]; - //add an item - id appMenuItem = [[NSMenuItem new] autorelease]; - // add the item to the menu bar: - [menubar addItem:appMenuItem]; - // set the main menu in the menu bar ... - [NSApp setMainMenu:menubar]; - - id appMenu = [[NSMenu new] autorelease]; - id appName = [[NSProcessInfo processInfo] processName]; - // create the label to qui the application : - id quitTitle = [@"Quit " stringByAppendingString:appName]; - // create the item to quit the appllication with META+q at shortCut - id quitMenuItem = [ [ [NSMenuItem alloc] initWithTitle:quitTitle - action:@selector(stop:) keyEquivalent:@"q"] autorelease]; - - // add the item to the menu: - [appMenu addItem:quitMenuItem]; - // set the application menu to the main app menu ... - [appMenuItem setSubmenu:appMenu]; - - // --------------------------------------------------------------- - // -- basic windows creation : - // --------------------------------------------------------------- - // create a windows of size 800/600 - window = [ [ [EwolMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) - styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO] - autorelease]; - [window setAcceptsMouseMovedEvents:YES]; - //id window = [ [MacOsAppDelegate alloc] autorelease]; - - // set the windows at a specific position : - [window cascadeTopLeftFromPoint:NSMakePoint(50,50)]; - // set the windows resizable - [window setStyleMask:[window styleMask] | NSResizableWindowMask]; - // oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask]; - // set the title - [window setTitle:appName]; - - [window setAcceptsMouseMovedEvents:YES]; - // ??? - [window makeKeyAndOrderFront:nil]; - [NSApp activateIgnoringOtherApps:YES]; - - NSRect window_frame = [window frame]; - - OpenGLView* view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)]; - NSTrackingArea *track = [[NSTrackingArea alloc] initWithRect:window_frame options: NSTrackingMouseMoved | NSTrackingActiveWhenFirstResponder | NSTrackingActiveInKeyWindow - owner:window userInfo:nil]; - [view addTrackingArea:track]; - [window setContentView:view]; - [view setAutoresizesSubviews:YES]; - return 0; -} - -int mm_run(void) { - //MacOs::setRedrawCallback(std::bind(callbackSomeThingToDo)); - [NSApp run]; - EWOL_DEBUG("END of application"); - // return no error - return 0; -} - -void mm_stopApplication() { - EWOL_DEBUG("NSApp terminate start."); - [window closeRequestEwol]; - [NSApp stop:nil]; - EWOL_DEBUG("NSApp terminate done"); -} - diff --git a/ewol/context/MacOs/OpenglView.h b/ewol/context/MacOs/OpenglView.h deleted file mode 100644 index 1154bf76..00000000 --- a/ewol/context/MacOs/OpenglView.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#import -#import -#import - - -@interface OpenGLView : NSOpenGLView { - NSTimer* _refreshTimer; - bool _redraw; -} -- (void)prepareOpenGL; -- (void)drawRect:(NSRect) bounds; -- (void)UpdateScreenRequested; -@end diff --git a/ewol/context/MacOs/OpenglView.mm b/ewol/context/MacOs/OpenglView.mm deleted file mode 100644 index 8fec1d55..00000000 --- a/ewol/context/MacOs/OpenglView.mm +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#import -#include -#include -#include -#include - - -@implementation OpenGLView - - -- (void) prepareOpenGL { - EWOL_INFO("prepare"); - GLint swapInt = 1; - [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; - // set system dpi size : - NSScreen *screen = [NSScreen mainScreen]; - NSDictionary *description = [screen deviceDescription]; - NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue]; - CGSize displayPhysicalSize = CGDisplayScreenSize([[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); - - ewol::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width, - (float)displayPixelSize.height/(float)displayPhysicalSize.height), - ewol::Dimension::Millimeter); - _refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ; - _redraw = true; - -} -- (void)UpdateScreenRequested { - _redraw = true; -} - --(void) drawRect: (NSRect) bounds { - if ( ! _refreshTimer ) { - _refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ; - EWOL_WARNING("create timer ... "); - } - MacOs::draw(false); -} - -/** - * Service the animation timer. - */ -- (void) animationTimerFired: (NSTimer *) timer { - if (_redraw == true) { - //_redraw = false; - [self setNeedsDisplay:YES]; - //EWOL_WARNING("view refresh ..." ); - } -} - --(void)reshape { - EWOL_INFO("view reshape (" << [self frame].size.width << "," << [self frame].size.height << ")" ); - // window resize; width and height are in pixel coordinates - // but they are floats - float width = [self frame].size.width; - float height = [self frame].size.height; - MacOs::resize(width,height); -} - -@end - diff --git a/ewol/context/MacOs/Windows.h b/ewol/context/MacOs/Windows.h deleted file mode 100644 index 6ea8de69..00000000 --- a/ewol/context/MacOs/Windows.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#import -#import - -@interface EwolMainWindows : NSWindow { - OpenGLView* _view; -} -+ (id)alloc; -- (id)init; -+ (void)dealloc; -+ (void)performClose:(id)sender; -// All mouse events: -- (void)mouseDown:(NSEvent *) event; -- (void)mouseDragged:(NSEvent *) event; -- (void)mouseUp:(NSEvent *)event; -- (void)mouseMoved:(NSEvent *)event; -- (void)mouseEntered:(NSEvent *)event; -- (void)mouseExited:(NSEvent *)event; -- (void)rightMouseDown:(NSEvent *)event; -- (void)rightMouseDragged:(NSEvent *)event; -- (void)rightMouseUp:(NSEvent *)event; -- (void)otherMouseDown:(NSEvent *)event; -- (void)otherMouseDragged:(NSEvent *)event; -- (void)otherMouseUp:(NSEvent *)event; -// keyboard eevnts: -- (void)keyDown:(NSEvent *)theEvent; -- (void)flagsChanged:(NSEvent *)theEvent; -- (void)closeRequestEwol; -- (void)UpdateScreenRequested; -@end - - diff --git a/ewol/context/MacOs/Windows.mm b/ewol/context/MacOs/Windows.mm deleted file mode 100644 index dd4e2183..00000000 --- a/ewol/context/MacOs/Windows.mm +++ /dev/null @@ -1,443 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#import -#include -#include - -#include - -@implementation EwolMainWindows - -+ (id)alloc { - id windowsID = [super alloc]; - EWOL_DEBUG("ALLOCATE ..."); - return windowsID; -} - -- (id)init { - id windowsID = [super init]; - - //[NSApp setDelegate: self]; - - EWOL_DEBUG("INIT ..."); - // set the windows at a specific position : - [windowsID cascadeTopLeftFromPoint:NSMakePoint(50,50)]; - EWOL_DEBUG("ALLOCATE ..."); - // set the windows resizable - [windowsID setStyleMask:[windowsID styleMask] | NSResizableWindowMask]; - EWOL_DEBUG("ALLOCATE ..."); - // oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask]; - // set the title - id appName = [[NSProcessInfo processInfo] processName]; - EWOL_DEBUG("ALLOCATE ..."); - [windowsID setTitle:appName]; - EWOL_DEBUG("ALLOCATE ..."); - - [windowsID setAcceptsMouseMovedEvents:YES]; - EWOL_DEBUG("ALLOCATE ..."); - // ??? - [windowsID makeKeyAndOrderFront:nil]; - EWOL_DEBUG("ALLOCATE ..."); - [NSApp activateIgnoringOtherApps:YES]; - EWOL_DEBUG("ALLOCATE ..."); - - NSRect window_frame = [windowsID frame]; - EWOL_DEBUG("ALLOCATE ..."); - - _view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)]; - EWOL_DEBUG("ALLOCATE ..."); - [windowsID setContentView:_view]; - EWOL_DEBUG("ALLOCATE ..."); - [_view setAutoresizesSubviews:YES]; - EWOL_DEBUG("ALLOCATE ..."); - - // Override point for customization after application launch. - //[window addSubview:view]; - //[window addChildWindow:view]; - //[window makeKeyAndVisible]; - - //[windowsID setDelegate:view]; - EWOL_DEBUG("ALLOCATE ..."); - return windowsID; -} - - -+ (void)dealloc { - EWOL_ERROR("FREE ..."); - //[_window release]; - [super dealloc]; -} - -+ (void)performClose:(id)sender { - EWOL_ERROR("perform close ..."); -} - -static ewol::key::Special guiKeyBoardMode; - - --(void)localKeyEvent:(NSEvent*)theEvent isDown:(bool)_isDown { - bool thisIsAReapeateKey = false; - if ([theEvent isARepeat]) { - thisIsAReapeateKey = true; - } - NSString *str = [theEvent charactersIgnoringModifiers]; - // TODO : set if for every char in the string !!! - unichar c = [str characterAtIndex:0]; - EWOL_VERBOSE("Key Event " << c << " = '" << char(c) << "' isDown=" << _isDown); - bool find = true; - enum ewol::key::keyboard keyInput; - switch (c) { - case 63232: keyInput = ewol::key::keyboardUp; break; - case 63233: keyInput = ewol::key::keyboardDown; break; - case 63234: keyInput = ewol::key::keyboardLeft; break; - case 63235: keyInput = ewol::key::keyboardRight; break; - case 63276: keyInput = ewol::key::keyboardPageUp; break; - case 63277: keyInput = ewol::key::keyboardPageDown; break; - case 63273: keyInput = ewol::key::keyboardStart; break; - case 63275: keyInput = ewol::key::keyboardEnd; break; - /* - case 78: keyInput = ewol::key::keyboardStopDefil; break; - case 127: keyInput = ewol::key::keyboardWait; break; - */ - case 63302: - find = false; - keyInput = ewol::key::keyboardInsert; - if(_isDown == false) { - if (true == guiKeyBoardMode.getInsert()) { - guiKeyBoardMode.setInsert(false); - } else { - guiKeyBoardMode.setInsert(true); - } - } - EWOL_VERBOSE("Key Event " << c << " = '" << char(c) << "' isDown=" << _isDown); - MacOs::setKeyboardMove(guiKeyBoardMode, keyInput, true, thisIsAReapeateKey); - EWOL_VERBOSE("Key Event " << c << " = '" << char(c) << "' isDown=" << !_isDown); - MacOs::setKeyboardMove(guiKeyBoardMode, keyInput, false, thisIsAReapeateKey); - break; - //case 84: keyInput = ewol::key::keyboardCenter; break; // Keypad - case 63236: keyInput = ewol::key::keyboardF1; break; - case 63237: keyInput = ewol::key::keyboardF2; break; - case 63238: keyInput = ewol::key::keyboardF3; break; - case 63239: keyInput = ewol::key::keyboardF4; break; - case 63240: keyInput = ewol::key::keyboardF5; break; - case 63241: keyInput = ewol::key::keyboardF6; break; - case 63242: keyInput = ewol::key::keyboardF7; break; - case 63243: keyInput = ewol::key::keyboardF8; break; - case 63244: keyInput = ewol::key::keyboardF9; break; - case 63245: keyInput = ewol::key::keyboardF10; break; - case 63246: keyInput = ewol::key::keyboardF11; break; - case 63247: keyInput = ewol::key::keyboardF12; break; - case 63272: // Suppress - find = false; - MacOs::setKeyboard(guiKeyBoardMode, u32char::Delete, _isDown, thisIsAReapeateKey); - if (true == thisIsAReapeateKey) { - MacOs::setKeyboard(guiKeyBoardMode, u32char::Delete, !_isDown, thisIsAReapeateKey); - } - break; - default: - find = false; - { - if (guiKeyBoardMode.getAlt() == true) { - // special keyboard transcription ... - str = [theEvent characters]; - c = [str characterAtIndex:0]; - } - EWOL_VERBOSE("Key Event " << c << " = '" << char(c) << "' isDown=" << _isDown); - MacOs::setKeyboard(guiKeyBoardMode, c, _isDown, thisIsAReapeateKey); - if (true==thisIsAReapeateKey) { - MacOs::setKeyboard(guiKeyBoardMode, c, !_isDown, thisIsAReapeateKey); - } - } - break; - } - if (find == true) { - EWOL_VERBOSE("eventKey Move type : " << keyInput ); - MacOs::setKeyboardMove(guiKeyBoardMode, keyInput, _isDown, thisIsAReapeateKey); - if (true == thisIsAReapeateKey) { - MacOs::setKeyboardMove(guiKeyBoardMode, keyInput, !_isDown, thisIsAReapeateKey); - } - } - -} - -- (void)keyDown:(NSEvent *)theEvent { - [self localKeyEvent:theEvent isDown:true]; -} - -- (void)keyUp:(NSEvent *)theEvent { - [self localKeyEvent:theEvent isDown:false]; -} - -- (void)flagsChanged:(NSEvent *)theEvent { - if (([theEvent modifierFlags] & NSAlphaShiftKeyMask) != 0) { - EWOL_VERBOSE("NSAlphaShiftKeyMask"); - if (guiKeyBoardMode.getCapsLock() == false) { - guiKeyBoardMode.setCapsLock(true); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCapLock, true, false); - } - } else { - if (guiKeyBoardMode.getCapsLock() == true) { - guiKeyBoardMode.setCapsLock(false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCapLock, false, false); - } - } - - if (([theEvent modifierFlags] & NSShiftKeyMask) != 0) { - EWOL_VERBOSE("NSShiftKeyMask"); - if (guiKeyBoardMode.getShift() == false) { - guiKeyBoardMode.setShift(true); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardShiftLeft, true, false); - } - } else { - if (guiKeyBoardMode.getShift() == true) { - guiKeyBoardMode.setShift(false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardShiftLeft, false, false); - } - } - - if (([theEvent modifierFlags] & NSControlKeyMask) != 0) { - //EWOL_VERBOSE("NSControlKeyMask"); - if (guiKeyBoardMode.getCtrl() == false) { - EWOL_VERBOSE("NSControlKeyMask DOWN"); - guiKeyBoardMode.setCtrl(true); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, true, false); - } - } else { - if (guiKeyBoardMode.getCtrl() == true) { - EWOL_VERBOSE("NSControlKeyMask UP"); - guiKeyBoardMode.setCtrl(false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, false, false); - } - } - - if (([theEvent modifierFlags] & NSAlternateKeyMask) != 0) { - EWOL_VERBOSE("NSAlternateKeyMask"); - if (guiKeyBoardMode.getAlt() == false) { - guiKeyBoardMode.setAlt(true); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardAlt, true, false); - } - } else { - if (guiKeyBoardMode.getAlt() == true) { - guiKeyBoardMode.setAlt(false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardAlt, false, false); - } - } - - if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) { - EWOL_VERBOSE("NSCommandKeyMask"); - if (guiKeyBoardMode.getMeta() == false) { - guiKeyBoardMode.setMeta(true); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardMetaLeft, true, false); - } - } else { - if (guiKeyBoardMode.getMeta() == true) { - guiKeyBoardMode.setMeta(false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardMetaLeft, false, false); - } - } - - if (([theEvent modifierFlags] & NSNumericPadKeyMask) != 0) { - EWOL_VERBOSE("NSNumericPadKeyMask"); - if (guiKeyBoardMode.getNumLock() == false) { - guiKeyBoardMode.setNumLock(true); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardNumLock, true, false); - } - } else { - if (guiKeyBoardMode.getNumLock() == true) { - guiKeyBoardMode.setNumLock(false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardNumLock, false, false); - } - } - if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) { - EWOL_VERBOSE("NSHelpKeyMask"); - } - if (([theEvent modifierFlags] & NSFunctionKeyMask) != 0) { - EWOL_VERBOSE("NSFunctionKeyMask"); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardContextMenu, true, false); - MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardContextMenu, false, false); - } - EWOL_VERBOSE("EVENT : " << int32_t([theEvent modifierFlags])); -} - -// this generate all the event entry availlable ==> like a big keep focus ... -- (BOOL)acceptsFirstResponder { - return YES; -} -- (BOOL)becomeFirstResponder { - return YES; -} - --(void)mouseMoved:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("mouseMoved : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseMotion(0, point.x, point.y); -} --(void)mouseEntered:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_INFO("mouseEntered : " << (float)point.x << " " << (float)point.y); -} --(void)mouseExited:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_INFO("mouseExited : " << (float)point.x << " " << (float)point.y); -} - --(void)mouseDown:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("mouseDown : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseState(1, true, point.x, point.y); -} --(void)mouseDragged:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("mouseDragged : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseMotion(1, point.x, point.y); -} --(void)mouseUp:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("mouseUp : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseState(1, false, point.x, point.y); -} --(void)rightMouseDown:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("rightMouseDown : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseState(3, true, point.x, point.y); -} --(void)rightMouseDragged:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("rightMouseDragged : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseMotion(3, point.x, point.y); -} --(void)rightMouseUp:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("rightMouseUp : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseState(3, false, point.x, point.y); -} --(void)otherMouseDown:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - int32_t btNumber = [event buttonNumber]; - switch (btNumber) { - case 2: // 2 : Middle button - btNumber = 2; - break; - case 3: // 3 : border button DOWN - btNumber = 8; - break; - case 4: // 4 : border button UP - btNumber = 9; - break; - case 5: // 5 : horizontal scroll Right to left - btNumber = 11; - break; - case 6: // 6 : horizontal scroll left to Right - btNumber = 10; - break; - case 7: // 7 : Red button - btNumber = 12; - break; - default: - btNumber = 15; - break; - } - EWOL_VERBOSE("otherMouseDown : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseState(btNumber, true, point.x, point.y); -} --(void)otherMouseDragged:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - int32_t btNumber = [event buttonNumber]; - switch (btNumber) { - case 2: // 2 : Middle button - btNumber = 2; - break; - case 3: // 3 : border button DOWN - btNumber = 8; - break; - case 4: // 4 : border button UP - btNumber = 9; - break; - case 5: // 5 : horizontal scroll Right to left - btNumber = 11; - break; - case 6: // 6 : horizontal scroll left to Right - btNumber = 10; - break; - case 7: // 7 : Red button - btNumber = 12; - break; - default: - btNumber = 15; - break; - } - EWOL_VERBOSE("otherMouseDragged : " << (float)point.x << " " << (float)point.y); - MacOs::setMouseMotion(btNumber, point.x, point.y); -} --(void)otherMouseUp:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - int32_t btNumber = [event buttonNumber]; - EWOL_VERBOSE("otherMouseUp: id=" << btNumber ); - switch (btNumber) { - case 2: // 2 : Middle button - btNumber = 2; - break; - case 3: // 3 : border button DOWN - btNumber = 8; - break; - case 4: // 4 : border button UP - btNumber = 9; - break; - case 5: // 5 : horizontal scroll Right to left - btNumber = 11; - break; - case 6: // 6 : horizontal scroll left to Right - btNumber = 10; - break; - case 7: // 7 : Red button - btNumber = 12; - break; - default: - btNumber = 15; - break; - } - EWOL_VERBOSE("otherMouseUp : " << (float)point.x << " " << (float)point.y << " bt id=" << btNumber ); - MacOs::setMouseState(btNumber, false, point.x, point.y); -} -- (void)scrollWheel:(NSEvent *)event { - NSPoint point = [event locationInWindow]; - EWOL_VERBOSE("scrollWheel : " << (float)point.x << " " << (float)point.y << " delta(" << (float)([event deltaX]) << "," << (float)([event deltaY]) << ")"); - float deltaY = [event deltaY]; - int32_t idEvent = 4; - if (deltaY < 0) { - idEvent = 5; - } - if (fabs(deltaY) < 0.1f) { - return; - } - for (float iii=fabs(deltaY) ; iii>=0.0f ; iii-=1.0f) { - MacOs::setMouseState(idEvent, true , point.x, point.y); - MacOs::setMouseState(idEvent, false, point.x, point.y); - } -} - -- (void)closeRequestEwol { - EWOL_VERBOSE("closeRequestEwol: BEGIN"); - [super close]; - EWOL_VERBOSE("closeRequestEwol: END"); -} - -- (void)close { - EWOL_VERBOSE("close:"); - MacOs::stopRequested(); -} - -- (void)UpdateScreenRequested { - [_view UpdateScreenRequested]; -} -@end - - - diff --git a/ewol/context/Windows/Context.cpp b/ewol/context/Windows/Context.cpp deleted file mode 100644 index 75798f46..00000000 --- a/ewol/context/Windows/Context.cpp +++ /dev/null @@ -1,503 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - - - -int64_t ewol::getTime() { - struct timeval now; - gettimeofday(&now, nullptr); - //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); -} - - -#undef __class__ -#define __class__ "ContextWindows" - - -class WindowsContext : public ewol::Context { - private: - int32_t m_currentHeight = 0; - bool m_inputIsPressed[MAX_MANAGE_INPUT]; - ewol::key::Special m_guiKeyBoardMode; - bool m_run = true; - bool m_clipBoardOwnerStd = false; - public: - WindowsContext(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) : - ewol::Context(_application, _argc, _argv) { - for (int32_t iii=0; iiiWndProcReal(_hWnd, _message, _wParam, _lParam); - return 0; - } - - LRESULT CALLBACK WndProcReal(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) { - bool buttonIsDown = true; - int32_t mouseButtonId = 0; - ivec2 pos; - // to know all _message : http://wiki.winehq.org/List_Of_Windows__messages - switch (_message) { - /* ************************************************************************** - * Gui event - * **************************************************************************/ - case WM_CREATE: - EWOL_DEBUG("WM_CREATE"); - return 0; - case WM_CLOSE: - EWOL_DEBUG("WM_CLOSE"); - PostQuitMessage( 0 ); - return 0; - case WM_DESTROY: - EWOL_DEBUG("WM_DESTROY"); - return 0; - case WM_MOVE: - EWOL_DEBUG("WM_MOVE"); - return 0; - case WM_SIZE: - EWOL_DEBUG("WM_SIZE"); - return 0; - /* - case WM_GETMINMAXINFO: - { - MINMAXINFO* tmpVal = (MINMAXINFO*)lParam; - EWOL_DEBUG("WM_GETMINMAXINFO : "); - EWOL_DEBUG(" ptMaxSize : " << tmpVal->ptMaxSize.x << "," << tmpVal->ptMaxSize.y << ")"); - EWOL_DEBUG(" ptMaxPosition : " << tmpVal->ptMaxPosition.x << "," << tmpVal->ptMaxPosition.y << ")"); - EWOL_DEBUG(" ptMinTrackSize : " << tmpVal->ptMinTrackSize.x << "," << tmpVal->ptMinTrackSize.y << ")"); - EWOL_DEBUG(" ptMaxTrackSize : " << tmpVal->ptMaxTrackSize.x << "," << tmpVal->ptMaxTrackSize.y << ")"); - } - return 0; - */ - case WM_WINDOWPOSCHANGING: { - WINDOWPOS* tmpVal = (WINDOWPOS*)_lParam; - if (nullptr != tmpVal) { - //EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")"); - // in windows system, we need to remove the size of the border elements : - int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); - int title_size = GetSystemMetrics(SM_CYCAPTION); - m_currentHeight = tmpVal->cy - 2*border_thickness - title_size; - OS_Resize(vec2(tmpVal->cx-2*border_thickness, m_currentHeight)); - } - return 0; - } - // these message are not parse by us ... - case WM_SETCURSOR: // Call the windows if we want the mouse event : - case WM_NCHITTEST: // inform the application the position of the mouse is moving - return DefWindowProc( _hWnd, _message, _wParam, _lParam ); - - /* ************************************************************************** - * Keyboard management - * **************************************************************************/ - case WM_KEYUP: - buttonIsDown = false; - case WM_KEYDOWN: { - char32_t tmpChar = 0; - enum ewol::key::keyboard keyInput; - switch (_wParam) { - //case 80: // keypad - case VK_UP: keyInput = ewol::key::keyboardUp; break; - //case 83: // keypad - case VK_LEFT: keyInput = ewol::key::keyboardLeft; break; - //case 85: // keypad - case VK_RIGHT: keyInput = ewol::key::keyboardRight; break; - //case 88: // keypad - case VK_DOWN: keyInput = ewol::key::keyboardDown; break; - //case 81: // keypad - case VK_PRIOR: keyInput = ewol::key::keyboardPageUp; break; - //case 89: // keypad - case VK_NEXT: keyInput = ewol::key::keyboardPageDown; break; - //case 79: // keypad - case VK_HOME: keyInput = ewol::key::keyboardStart; break; - //case 87: // keypad - case VK_END: keyInput = ewol::key::keyboardEnd; break; - //case VK_: keyInput = ewol::key::keyboardStopDefil; break; - case VK_PAUSE: keyInput = ewol::key::keyboardWait; break; - //case 90: // keypad - case VK_INSERT: - keyInput = ewol::key::keyboardInsert; - m_guiKeyBoardMode.setInsert(buttonIsDown); - break; - case VK_F1: keyInput = ewol::key::keyboardF1; break; - case VK_F2: keyInput = ewol::key::keyboardF2; break; - case VK_F3: keyInput = ewol::key::keyboardF3; break; - case VK_F4: keyInput = ewol::key::keyboardF4; break; - case VK_F5: keyInput = ewol::key::keyboardF5; break; - case VK_F6: keyInput = ewol::key::keyboardF6; break; - case VK_F7: keyInput = ewol::key::keyboardF7; break; - case VK_F8: keyInput = ewol::key::keyboardF8; break; - case VK_F9: keyInput = ewol::key::keyboardF9; break; - case VK_F10: keyInput = ewol::key::keyboardF10; break; - case VK_F11: keyInput = ewol::key::keyboardF11; break; - case VK_F12: - case VK_F13: - case VK_F14: - case VK_F15: - case VK_F16: - case VK_F17: - case VK_F18: - case VK_F19: - case VK_F20: - case VK_F21: - case VK_F22: - case VK_F23: - case VK_F24: keyInput = ewol::key::keyboardF12; break; - case VK_CAPITAL: - keyInput = ewol::key::keyboardCapLock; - m_guiKeyBoardMode.setCapsLock(buttonIsDown); - break; - case VK_SHIFT: - case VK_LSHIFT: - keyInput = ewol::key::keyboardShiftLeft; - m_guiKeyBoardMode.setShift(buttonIsDown); - break; - case VK_RSHIFT: - keyInput = ewol::key::keyboardShiftRight; - m_guiKeyBoardMode.setShift(buttonIsDown); - break; - case VK_CONTROL: - case VK_LCONTROL: - keyInput = ewol::key::keyboardCtrlLeft; - m_guiKeyBoardMode.setCtrl(buttonIsDown); - break; - case VK_RCONTROL: - keyInput = ewol::key::keyboardCtrlRight; - m_guiKeyBoardMode.setCtrl(buttonIsDown); - break; - case VK_LWIN: - keyInput = ewol::key::keyboardMetaLeft; - m_guiKeyBoardMode.setMeta(buttonIsDown); - break; - case VK_RWIN: - keyInput = ewol::key::keyboardMetaRight; - m_guiKeyBoardMode.setMeta(buttonIsDown); - break; - case VK_MENU: - case VK_LMENU: - keyInput = ewol::key::keyboardAlt; - m_guiKeyBoardMode.setAlt(buttonIsDown); - break; - case VK_RMENU: - keyInput = ewol::key::keyboardAltGr; - m_guiKeyBoardMode.setAltGr(buttonIsDown); - break; - //case : keyInput = ewol::key::keyboardContextMenu; break; - case VK_NUMLOCK: - keyInput = ewol::key::keyboardNumLock; - m_guiKeyBoardMode.setNumLock(buttonIsDown); - break; - case VK_BACK: // DEL - tmpChar = 0x08; - break; - // TODO : Really strang, need to understand why ... - case 46: // Suppr - tmpChar = 0x7F; - break; - case VK_TAB: // special case for TAB - tmpChar = 0x09; - break; - case VK_RETURN: // special case for TAB - tmpChar = '\n'; - break; - default: - { - BYTE kbd[256]; - GetKeyboardState(kbd); - const int BUFFER_LENGTH = 8; //Length of the buffer - WCHAR chars[BUFFER_LENGTH]; - - ToUnicode(_wParam, _lParam, kbd, chars,BUFFER_LENGTH,0); - tmpChar = utf8::convertChar32((char*)chars); - } - break; - } - EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam); - if (tmpChar == 0) { - //EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) ); - OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, buttonIsDown); - } else { - OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, buttonIsDown); - } - return 0; - } - /* ************************************************************************** - * Mouse management - * **************************************************************************/ - case WM_LBUTTONUP: - buttonIsDown = false; - case WM_LBUTTONDOWN: - mouseButtonId = 1; - pos.setValue(GET_X_LPARAM(_lParam), - m_currentHeight-GET_Y_LPARAM(_lParam)); - m_inputIsPressed[mouseButtonId] = buttonIsDown; - OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y())); - return 0; - - case WM_MBUTTONUP: - buttonIsDown = false; - case WM_MBUTTONDOWN: - mouseButtonId = 2; - pos.setValue(GET_X_LPARAM(_lParam), - m_currentHeight-GET_Y_LPARAM(_lParam)); - m_inputIsPressed[mouseButtonId] = buttonIsDown; - OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y())); - return 0; - - case WM_RBUTTONUP: - buttonIsDown = false; - case WM_RBUTTONDOWN: - mouseButtonId = 3; - pos.setValue(GET_X_LPARAM(_lParam), - m_currentHeight-GET_Y_LPARAM(_lParam)); - m_inputIsPressed[mouseButtonId] = buttonIsDown; - OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y())); - return 0; - - case WM_MOUSEWHEEL: - if (_wParam & 0x200000) { - EWOL_DEBUG("event SCROOL UP"); - mouseButtonId = 4; - } else { - EWOL_DEBUG("event SCROOL DOWN"); - mouseButtonId = 5; - } - pos.setValue(GET_X_LPARAM(_lParam), - m_currentHeight-GET_Y_LPARAM(_lParam)); - OS_SetMouseState(mouseButtonId, true, vec2(pos.x(),pos.y())); - OS_SetMouseState(mouseButtonId, false, vec2(pos.x(),pos.y())); - return 0; - - case WM_MOUSEHOVER: - case WM_MOUSEMOVE: - pos.setValue(GET_X_LPARAM(_lParam), - m_currentHeight-GET_Y_LPARAM(_lParam)); - for (int32_t iii=0; iiirun(); - delete(localInterface); - localInterface = nullptr; - return retValue; -} - diff --git a/ewol/context/X11/Context.cpp b/ewol/context/X11/Context.cpp deleted file mode 100644 index 2a76211b..00000000 --- a/ewol/context/X11/Context.cpp +++ /dev/null @@ -1,1336 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#if defined(__TARGET_OS__Linux) -#include -#elif defined(__TARGET_OS__MacOs) -#include -#endif - -#include -#include - -/* -#define GUI_LOCK() XLockDisplay(m_display) -#define GUI_UNLOCK() XUnlockDisplay(m_display) -*/ -bool hasDisplay = false; -//#define DEBUG_X11_EVENT -#ifdef DEBUG_X11_EVENT - #define X11_DEBUG EWOL_DEBUG - #define X11_VERBOSE EWOL_VERBOSE - #define X11_INFO EWOL_INFO - #define X11_CRITICAL EWOL_CRITICAL -#else - #define X11_DEBUG EWOL_VERBOSE - #define X11_VERBOSE EWOL_VERBOSE - #define X11_INFO EWOL_VERBOSE - #define X11_CRITICAL EWOL_VERBOSE -#endif - -int64_t ewol::getTime() { - struct timespec now; - int ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { - // Error to get the time ... - now.tv_sec = time(nullptr); - now.tv_nsec = 0; - } - //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_nsec/(int64_t)1000); -} - -// attributes for a single buffered visual in RGBA format with at least 4 bits per color and a 16 bit depth buffer -static int attrListSgl[] = { - GLX_RGBA, - GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, - GLX_BLUE_SIZE, 4, - GLX_DEPTH_SIZE, 16, - None -}; - -// attributes for a double buffered visual in RGBA format with at least 4 bits per color and a 16 bit depth buffer -static int attrListDbl[] = { - GLX_RGBA, - GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, - GLX_BLUE_SIZE, 4, - GLX_DEPTH_SIZE, 16, - None -}; - -extern "C" { - typedef struct Hints { - unsigned long flags; - unsigned long functions; - unsigned long decorations; - long inputMode; - unsigned long status; - } Hints; -} - -#include - -#include - -#undef __class__ -#define __class__ "x11Interface" - -class X11Interface : public ewol::Context { - private: - ewol::key::Special m_guiKeyBoardMode; - // for double and triple click selection, we need to save the previous click up and down position , and the previous time ... - Atom m_delAtom; - Display* m_display; - Window m_WindowHandle; - XIM m_xim; - XIC m_xic; - int32_t m_originX; - int32_t m_originY; - int32_t m_cursorEventX; - int32_t m_cursorEventY; - int32_t m_currentHeight; - int32_t m_currentWidth; - XVisualInfo* m_visual; - bool m_doubleBuffered; - bool m_run; - //forcing the position - bool m_grabAllEvent; //!< grab mode enable... - vec2 m_forcePos; //!< position to reset the cursor - bool m_positionChangeRequested; //!< the position modifiquation has been requested - vec2 m_curentGrabDelta; //!< the position in X11 will arrive by pool - bool m_inputIsPressed[MAX_MANAGE_INPUT]; - // internal copy of the clipBoard ... - bool m_clipBoardRequestPrimary; //!< if false : request the copy/past buffer, if true : request current selection - bool m_clipBoardOwnerPrimary; //!< we are the owner of the current selection - bool m_clipBoardOwnerStd; //!< we are the owner of the current copy buffer - // Atom access... - Atom XAtomeSelection; - Atom XAtomeClipBoard; - Atom XAtomeTargetString; - Atom XAtomeTargetStringUTF8; - Atom XAtomeTargetTarget; - Atom XAtomeEWOL; - Atom XAtomeDeleteWindows; - enum ewol::context::cursorDisplay m_currentCursor; //!< select the current cursor to display : - char32_t m_lastKeyPressed; //!< The last element key presed... - public: - X11Interface(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) : - ewol::Context(_application, _argc, _argv), - m_display(nullptr), - m_originX(0), - m_originY(0), - m_cursorEventX(0), - m_cursorEventY(0), - m_currentHeight(0), - m_currentWidth(0), - m_visual(nullptr), - m_doubleBuffered(0), - m_run(false), - m_grabAllEvent(false), - m_forcePos(0,0), - m_positionChangeRequested(false), - m_curentGrabDelta(0,0), - m_clipBoardRequestPrimary(false), - m_clipBoardOwnerPrimary(false), - m_clipBoardOwnerStd(false), - XAtomeSelection(0), - XAtomeClipBoard(0), - XAtomeTargetString(0), - XAtomeTargetStringUTF8(0), - XAtomeTargetTarget(0), - XAtomeEWOL(0), - XAtomeDeleteWindows(0), - m_currentCursor(ewol::context::cursorArrow), - m_lastKeyPressed(0) { - X11_INFO("X11:INIT"); - for (int32_t iii=0; iii Kill Requested ..."); - OS_Stop(); - m_run = false; - } - break; - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Selection AREA // - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - case SelectionClear: { - // Selection has been done on an other program == > clear ours ... - X11_INFO("X11 event SelectionClear"); - #ifdef DEBUG_X11_EVENT - { - XSelectionRequestEvent *req=&(event.xselectionrequest); - if (req->property == 0) { - EWOL_ERROR("Get nullptr ATOM ... property"); - break; - } - if (req->target == 0) { - EWOL_ERROR("Get nullptr ATOM ... target"); - break; - } - char * atomNameProperty = XGetAtomName(m_display, req->property); - char * atomNameTarget = XGetAtomName(m_display, req->target); - EWOL_INFO("X11 property: \"" << atomNameProperty << "\""); - EWOL_INFO("X11 target: \"" << atomNameTarget << "\""); - if (atomNameProperty != nullptr) { - XFree(atomNameProperty); - } - if (atomNameTarget != nullptr) { - XFree(atomNameTarget); - } - } - #endif - if (true == m_clipBoardOwnerPrimary) { - m_clipBoardOwnerPrimary = false; - } else if (true == m_clipBoardOwnerStd) { - m_clipBoardOwnerStd = false; - } else { - EWOL_ERROR("X11 event SelectionClear == > but no selection requested anymore ..."); - } - break; - } - case SelectionNotify: - X11_INFO("X11 event SelectionNotify"); - if (event.xselection.property == None) { - EWOL_VERBOSE(" == > no data ..."); - } else { - unsigned char *buf = 0; - Atom type; - int format; - unsigned long nitems, bytes; - XGetWindowProperty(m_display, - m_WindowHandle, - event.xselection.property, - 0, // offset - (~0L), // length - False, // delete - AnyPropertyType, // reg_type - &type,// *actual_type_return, - &format,// *actual_format_return - &nitems,// *nitems_return - &bytes, // *bytes_after_return - &buf// **prop_return); - ); - if (true == m_clipBoardRequestPrimary) { - std::string tmpppp((char*)buf); - ewol::context::clipBoard::setSystem(ewol::context::clipBoard::clipboardSelection, tmpppp); - // just transmit an event , we have the data in the system - OS_ClipBoardArrive(ewol::context::clipBoard::clipboardSelection); - } else { - std::string tmpppp((char*)buf); - ewol::context::clipBoard::setSystem(ewol::context::clipBoard::clipboardStd, tmpppp); - // just transmit an event , we have the data in the system - OS_ClipBoardArrive(ewol::context::clipBoard::clipboardStd); - } - } - break; - case SelectionRequest: { - X11_INFO("X11 event SelectionRequest"); - XSelectionRequestEvent *req=&(event.xselectionrequest); - #ifdef DEBUG_X11_EVENT - { - if (req->property == 0) { - EWOL_ERROR("Get nullptr ATOM ... property"); - break; - } - if (req->selection == 0) { - EWOL_ERROR("Get nullptr ATOM ... selection"); - break; - } - if (req->target == 0) { - EWOL_ERROR("Get nullptr ATOM ... target"); - break; - } - char * atomNameProperty = XGetAtomName(m_display, req->property); - char * atomNameSelection = XGetAtomName(m_display, req->selection); - char * atomNameTarget = XGetAtomName(m_display, req->target); - EWOL_INFO(" from: " << atomNameProperty << " request=" << atomNameSelection << " in " << atomNameTarget); - if (nullptr != atomNameProperty) { XFree(atomNameProperty); } - if (nullptr != atomNameSelection) { XFree(atomNameSelection); } - if (nullptr != atomNameTarget) { XFree(atomNameTarget); } - } - #endif - - std::string tmpData = ""; - if (req->selection == XAtomeSelection) { - tmpData = ewol::context::clipBoard::get(ewol::context::clipBoard::clipboardSelection); - } else if (req->selection == XAtomeClipBoard) { - tmpData = ewol::context::clipBoard::get(ewol::context::clipBoard::clipboardStd); - } - const char * magatTextToSend = tmpData.c_str(); - Atom listOfAtom[4]; - if(strlen(magatTextToSend) == 0 ) { - respond.xselection.property= None; - } else if(XAtomeTargetTarget == req->target) { - // We need to generate the list of the possibles target element of atom - int32_t nbAtomSupported = 0; - listOfAtom[nbAtomSupported++] = XAtomeTargetTarget; - listOfAtom[nbAtomSupported++] = XAtomeTargetString; - listOfAtom[nbAtomSupported++] = XAtomeTargetStringUTF8; - listOfAtom[nbAtomSupported++] = None; - XChangeProperty( m_display, - req->requestor, - req->property, - XA_ATOM, - 32, - PropModeReplace, - (unsigned char*)listOfAtom, - nbAtomSupported ); - respond.xselection.property=req->property; - EWOL_INFO(" == > Respond ... (test)"); - } else if(XAtomeTargetString == req->target) { - XChangeProperty( m_display, - req->requestor, - req->property, - req->target, - 8, - PropModeReplace, - (unsigned char*)magatTextToSend, - strlen(magatTextToSend)); - respond.xselection.property=req->property; - EWOL_INFO(" == > Respond ..."); - } else if (XAtomeTargetStringUTF8 == req->target) { - XChangeProperty( m_display, - req->requestor, - req->property, - req->target, - 8, - PropModeReplace, - (unsigned char*)magatTextToSend, - strlen(magatTextToSend)); - respond.xselection.property=req->property; - EWOL_INFO(" == > Respond ..."); - } else { - respond.xselection.property= None; - } - respond.xselection.type= SelectionNotify; - respond.xselection.display= req->display; - respond.xselection.requestor= req->requestor; - respond.xselection.selection=req->selection; - respond.xselection.target= req->target; - respond.xselection.time = req->time; - XSendEvent (m_display, req->requestor,0,0,&respond); - // flush the message on the pipe ... - XFlush (m_display); - break; - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////// - case Expose: - X11_INFO("X11 event Expose"); - specialEventThatNeedARedraw=true; - break; - case GraphicsExpose: - X11_INFO("X11 event GraphicsExpose"); - specialEventThatNeedARedraw=true; - break; - case NoExpose: - X11_INFO("X11 event NoExpose"); - break; - case CreateNotify: - X11_INFO("X11 event CreateNotify"); - break; - case DestroyNotify: - X11_INFO("X11 event DestroyNotify"); - break; - case GravityNotify: - X11_INFO("X11 event GravityNotify"); - break; - case VisibilityNotify: - X11_INFO("X11 event VisibilityNotify"); - break; - case CirculateNotify: - X11_INFO("X11 event CirculateNotify"); - break; - case ReparentNotify: - X11_INFO("X11 event ReparentNotify"); - break; - case PropertyNotify: - specialEventThatNeedARedraw=true; - X11_INFO("X11 event PropertyNotify"); - break; - case ConfigureNotify: - specialEventThatNeedARedraw=true; - X11_INFO("X11 event ConfigureNotify"); - if (m_display == event.xconfigure.display) { - //EWOL_INFO("X11 event ConfigureNotify event=" << (int32_t)event.xconfigure.event << " Window=" << (int32_t)event.xconfigure.window << " above=" << (int32_t)event.xconfigure.above << " border_width=" << (int32_t)event.xconfigure.border_width ); - m_originX = event.xconfigure.x; - m_originY = event.xconfigure.y; - X11_INFO("X11 configure windows position : (" << m_originX << "," << m_originY << ")"); - m_currentHeight = event.xconfigure.height; - m_currentWidth = event.xconfigure.width; - X11_INFO("X11 configure windows size : (" << m_currentHeight << "," << m_currentWidth << ")"); - OS_Resize(vec2(event.xconfigure.width, event.xconfigure.height)); - } - break; - case ButtonPress: - X11_INFO("X11 event ButtonPress"); - m_cursorEventX = event.xbutton.x; - m_cursorEventY = (m_currentHeight-event.xbutton.y); - if (event.xbutton.button < MAX_MANAGE_INPUT) { - m_inputIsPressed[event.xbutton.button] = true; - } - OS_SetMouseState(event.xbutton.button, true, vec2(event.xbutton.x, m_cursorEventY)); - break; - case ButtonRelease: - X11_INFO("X11 event ButtonRelease"); - m_cursorEventX = event.xbutton.x; - m_cursorEventY = (m_currentHeight-event.xbutton.y); - if (event.xbutton.button < MAX_MANAGE_INPUT) { - m_inputIsPressed[event.xbutton.button] = false; - } - OS_SetMouseState(event.xbutton.button, false, vec2(event.xbutton.x, m_cursorEventY)); - break; - case EnterNotify: - X11_INFO("X11 event EnterNotify"); - m_cursorEventX = event.xcrossing.x; - m_cursorEventY = (m_currentHeight-event.xcrossing.y); - //EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (float)event.xcrossing.x << "," << (float)event.xcrossing.y << ")"); - //gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (float)event.xcrossing.x, (float)event.xcrossing.y); - m_curentGrabDelta -= vec2(m_originX, -m_originY); - EWOL_VERBOSE("change grab delta of : " << vec2(m_originX, m_originY) ); - break; - case LeaveNotify: - X11_INFO("X11 event LeaveNotify"); - m_cursorEventX = event.xcrossing.x; - m_cursorEventY = (m_currentHeight-event.xcrossing.y); - //EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (float)event.xcrossing.x << "," << (float)event.xcrossing.y << ")"); - m_curentGrabDelta += vec2(m_originX, -m_originY); - EWOL_VERBOSE("change grab delta of : " << vec2(m_originX, m_originY) ); - break; - case MotionNotify: - X11_INFO("X11 event MotionNotify"); - if( true == m_grabAllEvent - && event.xmotion.x == (int32_t)m_forcePos.x() - && event.xmotion.y == (int32_t)m_forcePos.y()) { - X11_VERBOSE("X11 reject mouse move (grab mode)"); - // we get our requested position... - m_positionChangeRequested = false; - m_curentGrabDelta = vec2(0,0); - } else { - m_cursorEventX = event.xmotion.x; - m_cursorEventY = (m_currentHeight-event.xmotion.y); - if(true == m_grabAllEvent) { - m_cursorEventX -= m_forcePos.x(); - m_cursorEventY -= (m_currentHeight-m_forcePos.y()); - } - vec2 newDelta = vec2(m_cursorEventX, m_cursorEventY); - if(true == m_grabAllEvent) { - m_cursorEventX -= m_curentGrabDelta.x(); - m_cursorEventY -= m_curentGrabDelta.y(); - } - m_curentGrabDelta = newDelta; - // For compatibility of the Android system : - bool findOne = false; - for (int32_t iii=0; iii= 0) { - // repeated kay from previous element : - if (count>0) { - // transform it in unicode - m_lastKeyPressed = utf8::convertChar32(buf); - } - X11_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << m_lastKeyPressed); - OS_SetKeyboard(m_guiKeyBoardMode, m_lastKeyPressed, (event.type == KeyPress), thisIsAReapeateKey); - if (true == thisIsAReapeateKey) { - OS_SetKeyboard(m_guiKeyBoardMode, m_lastKeyPressed, !(event.type == KeyPress), thisIsAReapeateKey); - } - } else { - EWOL_WARNING("Unknow event Key : " << event.xkey.keycode << " res='" << buf << "' repeate=" << thisIsAReapeateKey); - } - } - break; - } - if (true == find) { - //EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) ); - OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, (event.type == KeyPress), thisIsAReapeateKey); - if (true == thisIsAReapeateKey) { - OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, !(event.type == KeyPress), thisIsAReapeateKey); - } - } - } - break; - } - //case DestroyNotify: - // break; - case MapNotify: - X11_INFO("X11 event : MapNotify"); - specialEventThatNeedARedraw=true; - OS_Show(); - break; - case UnmapNotify: - X11_INFO("X11 event : UnmapNotify"); - specialEventThatNeedARedraw=true; - OS_Hide(); - break; - default: - X11_INFO("X11 event : " << event.type << " = \"???\""); - break; - } - } - if(true == m_run) { - if (m_doubleBuffered && hasDisplay) { - glXSwapBuffers(m_display, m_WindowHandle); - XSync(m_display,0); - } - // draw after switch the previous windows ... - //EWOL_DEBUG("specialEventThatNeedARedraw"<visual, AllocNone); - - attr.border_pixel = 0; - attr.event_mask = StructureNotifyMask - | SubstructureNotifyMask - | EnterWindowMask - | LeaveWindowMask - | ExposureMask - | ButtonPressMask - | ButtonReleaseMask - | OwnerGrabButtonMask - | KeyPressMask - | KeyReleaseMask - | PointerMotionMask - | FocusChangeMask - | SubstructureRedirectMask; - - // set no background at the gui - attr.background_pixmap = None; - - // select internal attribute - attr_mask = CWBackPixmap | CWColormap | CWBorderPixel | CWEventMask; - // Create the window - int32_t tmp_width = 640;//DisplayWidth(m_display, DefaultScreen(m_display))/2; - int32_t tmp_height = 480;//DisplayHeight(m_display, DefaultScreen(m_display))/2; - OS_Resize(vec2(tmp_width, tmp_height)); - x=20; - y=20; - m_originX = x; - m_originY = y; - EWOL_INFO("X11 request creating windows at pos=(" << m_originX << "," << m_originY << ") size=(" << tmp_width << "," << tmp_height << ")" ); - // Real create of the window - m_WindowHandle = XCreateWindow(m_display, - Xroot, - x, y, tmp_width, tmp_height, - 1, - m_visual->depth, - InputOutput, - m_visual->visual, - attr_mask, &attr); - - if( !m_WindowHandle ) { - EWOL_CRITICAL("Couldn't create the window"); - exit(-1); - } - - /* Configure it... (ok, ok, this next bit isn't "minimal") */ - textprop.value = (unsigned char*)title; - textprop.encoding = XA_STRING; - textprop.format = 8; - textprop.nitems = strlen(title); - - hints.x = x; - hints.y = y; - hints.width = tmp_width; - hints.height = tmp_height; - hints.flags = USPosition|USSize; - - StartupState = XAllocWMHints(); - StartupState->initial_state = NormalState; - StartupState->flags = StateHint; - - XSetWMProperties(m_display, m_WindowHandle,&textprop, &textprop,/* Window title/icon title*/ - nullptr, 0,/* Argv[], argc for program*/ - &hints, /* Start position/size*/ - StartupState,/* Iconised/not flag */ - nullptr); - - XFree(StartupState); - - /* open it, wait for it to appear */ - XMapWindow(m_display, m_WindowHandle); - //XIfEvent(m_display, &event, WaitForMapNotify, (char*)&m_WindowHandle); - - - m_xim = XOpenIM(m_display, nullptr, NULL, NULL); - if (m_xim == nullptr) { - EWOL_ERROR("Could not open input method"); - return false; - } - /* - XIMStyles *styles=nullptr; - char* failed_arg = XGetIMValues(m_xim, XNQueryInputStyle, &styles, nullptr); - if (failed_arg != nullptr) { - EWOL_ERROR("XIM Can't get styles"); - return false; - } - for (int32_t iii=0; iiicount_styles; ++iii) { - EWOL_INFO("style " << styles->supported_styles[iii]); - } - */ - m_xic = XCreateIC(m_xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, m_WindowHandle, nullptr); - if (m_xic == nullptr) { - EWOL_ERROR("Could not open IC"); - return false; - } - - XSetICFocus(m_xic); - - // set the kill atom so we get a message when the user tries to close the window - if ((m_delAtom = XInternAtom(m_display, "WM_DELETE_WINDOW", 0)) != None) { - XSetWMProtocols(m_display, m_WindowHandle, &m_delAtom, 1); - } - - vec2 tmpSize(400, 300); - OS_Resize(tmpSize); - - return true; - } - /****************************************************************************************/ - void setIcon(const std::string& _inputFile) { - egami::Image dataImage; - // load data - if (false == egami::load(dataImage, _inputFile)) { - EWOL_ERROR("Error when loading Icon"); - return; - } - int32_t depth = DefaultDepth(m_display, DefaultScreen(m_display) ); - EWOL_DEBUG("X11 Create icon size=(" << dataImage.getWidth() << "," << dataImage.getHeight() << ") depth=" << depth); - switch(depth) { - case 8: - EWOL_CRITICAL("Not manage pixmap in 8 bit... == > no icon ..."); - return; - case 16: - break; - case 24: - break; - case 32: - break; - default: - EWOL_CRITICAL("Unknow thys type of bitDepth : " << depth); - return; - } - char* tmpVal = new char[4*dataImage.getWidth()*dataImage.getHeight()]; - if (nullptr == tmpVal) { - EWOL_CRITICAL("Allocation error ..."); - return; - } - char* tmpPointer = tmpVal; - switch(depth) { - case 16: - for(ivec2 pos(0,0); pos.y() tmpColor = dataImage.get(pos); - int16_t tmpVal = (((uint16_t)((uint16_t)tmpColor.r()>>3))<<11) - + (((uint16_t)((uint16_t)tmpColor.g()>>2))<<5) - + ((uint16_t)((uint16_t)tmpColor.b()>>3)); - *tmpPointer++ = (uint8_t)(tmpVal>>8); - *tmpPointer++ = (uint8_t)(tmpVal&0x00FF); - } - } - break; - case 24: - for(ivec2 pos(0,0); pos.y() tmpColor = dataImage.get(pos); - *tmpPointer++ = tmpColor.b(); - *tmpPointer++ = tmpColor.g(); - *tmpPointer++ = tmpColor.r(); - tmpPointer++; - } - } - break; - case 32: - for(ivec2 pos(0,0); pos.y() tmpColor = dataImage.get(pos); - *tmpPointer++ = tmpColor.a(); - *tmpPointer++ = tmpColor.b(); - *tmpPointer++ = tmpColor.g(); - *tmpPointer++ = tmpColor.r(); - } - } - break; - default: - return; - } - - XImage* myImage = XCreateImage(m_display, - m_visual->visual, - depth, - ZPixmap, - 0, - (char*)tmpVal, - dataImage.getWidth(), - dataImage.getHeight(), - 32, - 0); - - Pixmap tmpPixmap = XCreatePixmap(m_display, m_WindowHandle, dataImage.getWidth(), dataImage.getHeight(), depth); - switch(tmpPixmap) { - case BadAlloc: - EWOL_ERROR("X11: BadAlloc"); - break; - case BadDrawable: - EWOL_ERROR("X11: BadDrawable"); - break; - case BadValue: - EWOL_ERROR("X11: BadValue"); - break; - default: - EWOL_DEBUG("Create Pixmap OK"); - break; - } - GC tmpGC = DefaultGC(m_display, DefaultScreen(m_display) ); - int error = XPutImage(m_display, tmpPixmap, tmpGC, myImage, 0, 0, 0, 0, dataImage.getWidth(), dataImage.getHeight()); - switch(error) { - case BadDrawable: - EWOL_ERROR("X11: BadDrawable"); - break; - case BadGC: - EWOL_ERROR("X11: BadGC"); - break; - case BadMatch: - EWOL_ERROR("X11: BadMatch"); - break; - case BadValue: - EWOL_ERROR("X11: BadValue"); - break; - default: - EWOL_DEBUG("insert image OK"); - break; - } - // allocate a WM hints structure. - XWMHints* win_hints = XAllocWMHints(); - if (!win_hints) { - EWOL_ERROR("XAllocWMHints - out of memory"); - return; - } - // initialize the structure appropriately. first, specify which size hints we want to fill in. in our case - setting the icon's pixmap. - win_hints->flags = IconPixmapHint; - // next, specify the desired hints data. in our case - supply the icon's desired pixmap. - win_hints->icon_pixmap = tmpPixmap; - // pass the hints to the window manager. - XSetWMHints(m_display, m_WindowHandle, win_hints); - EWOL_INFO(" == > might be done "); - // finally, we can free the WM hints structure. - XFree(win_hints); - - // Note when we free the pixmap ... the icon is removed ... == > this is a real memory leek ... - //XFreePixmap(m_display, tmpPixmap); - - myImage->data = nullptr; - XDestroyImage(myImage); - delete[] tmpVal; - - } - /****************************************************************************************/ - static void setVSync(bool _sync) { - // Function pointer for the wgl extention function we need to enable/disable - typedef int32_t (APIENTRY *PFNWGLSWAPINTERVALPROC)( int ); - PFNWGLSWAPINTERVALPROC wglSwapIntervalEXT = 0; - const char *extensions = (char*)glGetString( GL_EXTENSIONS ); - if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 ) { - EWOL_ERROR("Can not set the vertical synchronisation status" << _sync << " (1)"); - return; - } else { - wglSwapIntervalEXT = (PFNWGLSWAPINTERVALPROC)glXGetProcAddress( (const GLubyte *)"wglSwapIntervalEXT" ); - if(wglSwapIntervalEXT) { - wglSwapIntervalEXT(_sync); - } else { - EWOL_ERROR("Can not set the vertical synchronisation status" << _sync << " (2)"); - } - } - } - /****************************************************************************************/ - bool createOGlContext() { - X11_INFO("X11:CreateOGlContext"); - /* create a GLX context */ - GLXContext RenderContext = glXCreateContext(m_display, m_visual, 0, GL_TRUE); - /* connect the glx-context to the window */ - glXMakeCurrent(m_display, m_WindowHandle, RenderContext); - if (glXIsDirect(m_display, RenderContext)) { - EWOL_INFO("XF86 DRI enabled\n"); - } else { - EWOL_INFO("XF86 DRI NOT available\n"); - } - - // enable vertical synchronisation : (some computer has synchronisation disable) - setVSync(true); - - return true; - } - /****************************************************************************************/ - void setTitle(const std::string& _title) { - X11_INFO("X11: set Title (START)"); - XTextProperty tp; - tp.value = (unsigned char *)_title.c_str(); - tp.encoding = XA_WM_NAME; - tp.format = 8; - tp.nitems = strlen((const char*)tp.value); - XSetWMName(m_display, m_WindowHandle, &tp); - XStoreName(m_display, m_WindowHandle, (const char*)tp.value); - XSetIconName(m_display, m_WindowHandle, (const char*)tp.value); - XSetWMIconName(m_display, m_WindowHandle, &tp); - X11_INFO("X11: set Title (END)"); - } - - void openURL(const std::string& _url) { - std::string req = "xdg-open "; - req += _url; - system(req.c_str()); - return; - } - /****************************************************************************************/ - void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - switch (_clipboardID) { - case ewol::context::clipBoard::clipboardSelection: - if (false == m_clipBoardOwnerPrimary) { - m_clipBoardRequestPrimary = true; - // generate a request on X11 - XConvertSelection(m_display, - XAtomeSelection, - XAtomeTargetStringUTF8, - XAtomeEWOL, - m_WindowHandle, - CurrentTime); - } else { - // just transmit an event , we have the data in the system - OS_ClipBoardArrive(_clipboardID); - } - break; - case ewol::context::clipBoard::clipboardStd: - if (false == m_clipBoardOwnerStd) { - m_clipBoardRequestPrimary = false; - // generate a request on X11 - XConvertSelection(m_display, - XAtomeClipBoard, - XAtomeTargetStringUTF8, - XAtomeEWOL, - m_WindowHandle, - CurrentTime); - } else { - // just transmit an event , we have the data in the system - OS_ClipBoardArrive(_clipboardID); - } - break; - default: - EWOL_ERROR("Request an unknow ClipBoard ..."); - break; - } - } - /****************************************************************************************/ - void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - switch (_clipboardID) { - case ewol::context::clipBoard::clipboardSelection: - // Request the selection : - if (false == m_clipBoardOwnerPrimary) { - XSetSelectionOwner(m_display, XAtomeSelection, m_WindowHandle, CurrentTime); - m_clipBoardOwnerPrimary = true; - } - break; - case ewol::context::clipBoard::clipboardStd: - // Request the clipBoard : - if (false == m_clipBoardOwnerStd) { - XSetSelectionOwner(m_display, XAtomeClipBoard, m_WindowHandle, CurrentTime); - m_clipBoardOwnerStd = true; - } - break; - default: - EWOL_ERROR("Request an unknow ClipBoard ..."); - break; - } - } -}; - - -/** - * @brief Main of the program - * @param std IO - * @return std IO - */ -int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) { - etk::init(_argc, _argv); - X11Interface* interface = new X11Interface(_application, _argc, _argv); - if (interface == nullptr) { - EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); - return -2; - } - int32_t retValue = interface->run(); - delete(interface); - interface = nullptr; - return retValue; -} diff --git a/ewol/context/clipBoard.cpp b/ewol/context/clipBoard.cpp deleted file mode 100644 index 0f8dc979..00000000 --- a/ewol/context/clipBoard.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - -#include -#include -#include - -#undef __class__ -#define __class__ "ClipBoard" - - -/* -note: copy id data : - 0 : copy standard - [1..9] : copy internal - 10 : middle button -*/ -//!< Local copy of the clipboards -static std::string myCopy[ewol::context::clipBoard::clipboardCount]; - -static const char* clipboardDescriptionString[ewol::context::clipBoard::clipboardCount+1] = { - "clipboard0", - "clipboard1", - "clipboard2", - "clipboard3", - "clipboard4", - "clipboard5", - "clipboard6", - "clipboard7", - "clipboard8", - "clipboard9", - "clipboardStd", - "clipboardSelection", - "clipboardCount" -}; - -std::ostream& ewol::operator <<(std::ostream& _os, const enum ewol::context::clipBoard::clipboardListe _obj) { - if (_obj >= 0 && _obj = ewol::context::clipBoard::clipboardCount) { - EWOL_WARNING("request ClickBoard id error"); - return; - } - - ewol::context::clipBoard::setSystem(_clipboardID, _data); - - if( ewol::context::clipBoard::clipboardStd == _clipboardID - || ewol::context::clipBoard::clipboardSelection == _clipboardID) { - ewol::getContext().clipBoardSet(_clipboardID); - } -} - - -void ewol::context::clipBoard::request(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { - EWOL_WARNING("request ClickBoard id error"); - return; - } - - if( ewol::context::clipBoard::clipboardStd == _clipboardID - || ewol::context::clipBoard::clipboardSelection == _clipboardID) { - ewol::getContext().clipBoardGet(_clipboardID); - } else { - // generate an event on the main thread ... - ewol::getContext().OS_ClipBoardArrive(_clipboardID); - } -} - - -void ewol::context::clipBoard::setSystem(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data) { - if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { - EWOL_WARNING("request ClickBoard id error"); - return; - } - // Copy datas ... - myCopy[_clipboardID] = _data; -} - - -const std::string& ewol::context::clipBoard::get(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - static const std::string emptyString(""); - if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { - EWOL_WARNING("request ClickBoard id error"); - return emptyString; - } - // Copy datas ... - return myCopy[_clipboardID]; -} - - - - - diff --git a/ewol/context/clipBoard.h b/ewol/context/clipBoard.h deleted file mode 100644 index d3d1e1e7..00000000 --- a/ewol/context/clipBoard.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_CLIPBOARD_H__ -#define __EWOL_CLIPBOARD_H__ - -#include - -// TODO : Remove this ... ==> set it in the context .... -namespace ewol { - namespace context { - namespace clipBoard { - enum clipboardListe { - clipboard0, //!< internal clipboard 0 - clipboard1, //!< internal clipboard 1 - clipboard2, //!< internal clipboard 2 - clipboard3, //!< internal clipboard 3 - clipboard4, //!< internal clipboard 4 - clipboard5, //!< internal clipboard 5 - clipboard6, //!< internal clipboard 6 - clipboard7, //!< internal clipboard 7 - clipboard8, //!< internal clipboard 8 - clipboard9, //!< internal clipboard 9 - clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer - clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button - clipboardCount, //!< Total number of clipboard - }; - - /** - * @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change - * @param[in] _clipboardID Select the specific ID of the clipboard - * @param[in] _data The string that might be send to the clipboard - */ - void set(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data); - /** - * @brief Call system to request the current clipboard. - * @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread, - * we need the call the system to send us the buffer, this is really ambigous, but the widget (who has focus) receive the - * notification of the arrival of this buffer id - * @param[in] _clipboardID the needed clipboard ID - */ - void request(enum ewol::context::clipBoard::clipboardListe _clipboardID); - /** - * @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the - * Gui abstraction to set the buffer we receive. The end user must not use it. - * @param[in] _clipboardID selected clipboard ID - * @param[in] _data new buffer data - */ - void setSystem(enum ewol::context::clipBoard::clipboardListe _clipboardID,const std::string& _data); - /** - * @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in - * the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it. - * @note if we call this fuction withoutcallin @ref ewol::context::clipBoard::Request, we only get the previous clipboard - * @param[in] _clipboardID selected clipboard ID - * @return the requested buffer - */ - const std::string& get(enum ewol::context::clipBoard::clipboardListe _clipboardID); - - // internal section - - /** - * @brief initialize the clipboard system (done by ewol) - */ - void init(); - /** - * @brief Un-Initialize the clipboard system (done by ewol) - */ - void unInit(); - }; - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - std::ostream& operator <<(std::ostream& _os, const enum ewol::context::clipBoard::clipboardListe _obj); -}; - -#endif - - diff --git a/ewol/context/commandLine.cpp b/ewol/context/commandLine.cpp deleted file mode 100644 index 52e44a8c..00000000 --- a/ewol/context/commandLine.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include -#include - -void ewol::context::CommandLine::parse(int32_t _argc, const char* _argv[]) { - for (int32_t i=1 ; i<_argc; i++) { - EWOL_INFO("commandLine : \"" << _argv[i] << "\"" ); - m_listArgs.push_back(_argv[i]); - } -} - -int32_t ewol::context::CommandLine::size() { - return m_listArgs.size(); -} - -const std::string& ewol::context::CommandLine::get(int32_t _id) { - static const std::string errorArg(""); - if ( _id < 0 - && _id >= (int64_t)m_listArgs.size()) { - return errorArg; - } - return m_listArgs[_id]; -} - -void ewol::context::CommandLine::add(const std::string& _newElement) { - m_listArgs.push_back(_newElement); -} - -void ewol::context::CommandLine::remove(int32_t _id) { - m_listArgs.erase(m_listArgs.begin()+_id); -} - diff --git a/ewol/context/commandLine.h b/ewol/context/commandLine.h deleted file mode 100644 index 22a4cc82..00000000 --- a/ewol/context/commandLine.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_COMMAND_LINE_H__ -#define __EWOL_COMMAND_LINE_H__ - -#include - -namespace ewol { - namespace context { - class CommandLine { - private: - std::vector m_listArgs; //!< list of all argument parsed - public: - /** - * @brief Parse the command line parameters - */ - void parse(int32_t _argc, const char* _argv[]); - /** - * @brief get the number of element in the Command line - * @return the number of element - */ - int32_t size(); - /** - * @brief get an element with a specific ID - * @return _id The cmdLine Id element - */ - const std::string& get(int32_t _id); - /** - * @brief add one element at the Command line - * @param[in] _newElement String in the input that might be added. - */ - void add(const std::string& _newElement); - /** - * @brief remove an element - * @param[in] _id Id of the element - */ - void remove(int32_t _id); - }; - }; -}; - -#endif diff --git a/ewol/context/cursor.cpp b/ewol/context/cursor.cpp deleted file mode 100644 index 206f06f5..00000000 --- a/ewol/context/cursor.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - -static const char* cursorDescriptionString[ewol::context::cursorCount+1] = { - "cursorArrow", - "cursorLeftArrow", - "cursorInfo", - "cursorDestroy", - "cursorHelp", - "cursorCycle", - "cursorSpray", - "cursorWait", - "cursorText", - "cursorCrossHair", - "cursorSlideUpDown", - "cursorSlideLeftRight", - "cursorResizeUp", - "cursorResizeDown", - "cursorResizeLeft", - "cursorResizeRight", - "cursorCornerTopLeft", - "cursorCornerTopRight", - "cursorCornerButtomLeft", - "cursorCornerButtomRight", - "cursorNone", - "cursorCount" -}; - -std::ostream& ewol::operator <<(std::ostream& _os, const enum ewol::context::cursorDisplay _obj) { - if (_obj >= 0 && _obj - -namespace ewol { - namespace context { - enum cursorDisplay { - cursorArrow, // this is the normal arrow ... - cursorLeftArrow, - cursorInfo, - cursorDestroy, - cursorHelp, - cursorCycle, - cursorSpray, - cursorWait, - cursorText, - cursorCrossHair, - cursorSlideUpDown, //!< change the position (slide) vertical - cursorSlideLeftRight, //!< change the position (slide) horizontal - cursorResizeUp, - cursorResizeDown, - cursorResizeLeft, - cursorResizeRight, - cursorCornerTopLeft, - cursorCornerTopRight, - cursorCornerButtomLeft, - cursorCornerButtomRight, - cursorNone, - // just for the count: - cursorCount - }; - }; - /** - * @brief Debug operator To display the curent element in a Human readable information - */ - std::ostream& operator <<(std::ostream& _os, const enum ewol::context::cursorDisplay _obj); -}; - -#endif - - diff --git a/ewol/context/directFB/Context.cpp b/ewol/context/directFB/Context.cpp deleted file mode 100644 index 3fcae692..00000000 --- a/ewol/context/directFB/Context.cpp +++ /dev/null @@ -1,494 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -/* - notes : - sudo edn /etc/udev/rules.d/framebuffer.rules - KERNEL == "fb0", OWNER="root", MODE="0660" - sudo usermod -a -G video username - sudo usermod -a -G tty username - sudo fbset -i - sudo chmod o+wr /dev/fb0 - - - http://mail.directfb.org/pipermail/directfb-users/2010-February/002115.html - on X11 : - http://stackoverflow.com/questions/521957/how-to-develop-a-directfb-app-without-leaving-x-11-environment - $ sudo apt-get install libdirectfb-extra # for Debian and Ubuntu, anyhow - $ cat ~/.directfbrc - system=x11 - force-windowed -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - - -int64_t guiInterface::getTime() { - struct timespec now; - int ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { - // Error to get the time ... - now.tv_sec = time(nullptr); - now.tv_nsec = 0; - } - //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_nsec/(int64_t)1000); -} - -#undef __class__ -#define __class__ "guiInterface" - - -static ewol::SpecialKey guiKeyBoardMode; - -bool inputIsPressed[20]; -bool m_run = true; -bool m_grabAllEvent = false; - - -// the super interface -IDirectFB *dfb = nullptr; - -// the primary surface (surface of primary layer) -IDirectFBSurface *primary = nullptr; - -// the GL context -IDirectFBGL *primary_gl = nullptr; - -// event buffer -IDirectFBEventBuffer *events = nullptr; - -static int screen_width =800; -static int screen_height = 600; - - -/** - * @brief set the new title of the windows - * @param title New desired title - * @return --- - */ -void guiInterface::setTitle(std::string& title) { - // TODO : ... -} - - -void guiInterface::setIcon(std::string inputFile) { - // TODO : ... -} - - -void DirectFB_Init(int argc, const char *argv[]) { - EWOL_INFO("DirectFB init (START)"); - DFBResult err; - DFBSurfaceDescription dsc; - - EWOL_INFO("call DirectFBInit"); - int argc2 = 1; - err = DirectFBInit(&argc2, (char***)&argv); - if (DFB_OK!=err) { - EWOL_ERROR("DirectFBInit"); - DirectFBErrorFatal("DirectFBInit", err); - exit(-1); - } - EWOL_INFO("call DirectFBCreate"); - // create the super interface - err = DirectFBCreate(&dfb); - if (DFB_OK!=err) { - EWOL_ERROR("DirectFBCreate"); - DirectFBErrorFatal("DirectFBCreate", err); - exit(-1); - } - - EWOL_INFO("call setCooperativeLevel"); - // set our cooperative level to DFSCL_FULLSCREEN for exclusive access to the primary layer - dfb->setCooperativeLevel(dfb, DFSCL_FULLSCREEN); - //dfb->setCooperativeLevel(dfb, DFSCL_NORMAL); - - // get the primary surface, i.e. the surface of the primary layer we have exclusive access to - dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS);// | DSDESC_PIXELFORMAT); - //dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE | DSCAPS_DEPTH); // DSCAPS_SHARED - dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE | DSCAPS_GL);// | DSCAPS_FLIPPING); - //dsc.caps = (DFBSurfaceCapabilities) (DSCAPS_SUBSURFACE | DSCAPS_VIDEOONLY | DSCAPS_PREMULTIPLIED | DSCAPS_FLIPPING); - - - dsc.pixelformat = DSPF_ARGB; - dsc.width = 600; - dsc.height = 400; - - EWOL_INFO("call CreateSurface"); - err = dfb->CreateSurface(dfb, &dsc, &primary); - if (DFB_OK!=err) { - EWOL_ERROR("dfb->CreateSurface"); - DirectFBErrorFatal("dfb->CreateSurface", err); - exit(-1); - } - - primary->setBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL); - primary->setPorterDuff( primary, DSPD_ADD ); - primary->setDstBlendFunction(primary, DSBF_SRCALPHA); - primary->setDrawingFlags(primary, DSDRAW_BLEND); - - primary->Blit(primary, primary, nullptr, 0, 0); - - - EWOL_INFO("call getSize"); - // get the size of the surface and fill it - err = primary->getSize(primary, &screen_width, &screen_height); - if (DFB_OK!=err) { - EWOL_ERROR("primary->getSize"); - DirectFBErrorFatal("primary->getSize", err); - exit(-1); - } - - - EWOL_INFO("call CreateInputEventBuffer"); - // create an event buffer for all devices with these caps - err = dfb->CreateInputEventBuffer(dfb, (DFBInputDeviceCapabilities)(DICAPS_KEYS | DICAPS_AXES), DFB_FALSE, &events); - if (DFB_OK!=err) { - EWOL_ERROR("dfb->CreateInputEventBuffer"); - DirectFBErrorFatal("CreateInputEventBuffer", err); - exit(-1); - } - - EWOL_INFO("call Flip"); - primary->Flip(primary, nullptr, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC); - - // NOTE : we need to force it on X11 display ... - EWOL_INFO("call getGL"); - // get the GL context - err = primary->getGL(primary, &primary_gl); - if (DFB_OK!=err) { - EWOL_ERROR("primary->getGL"); - DirectFBErrorFatal("GetGL", err); - exit(-1); - } - - EWOL_INFO("DirectFB init (STOP)"); -} - -void DirectFB_UnInit() { - // release our interfaces to shutdown DirectFB - primary_gl->release(primary_gl); - primary->release(primary); - events->release(events); - dfb->release(dfb); -} - -void DirectFB_Run() { - EWOL_INFO("X11 configure windows size : (" << screen_height << "," << screen_width << ")"); - eSystem::Resize(screen_width, screen_height); - - DFBResult err; - int32_t position = 0; - while (true == m_run) { - DFBInputEvent evt; - unsigned long t; - /* - primary->setColor (primary, 0x00, 0x00, 0x00, 0xFF); - primary->FillRectangle(primary, 0, 0, screen_width, screen_height); - primary->setColor (primary, 0xFF, (uint8_t)position, 0x00, 0xFF); - primary->FillRectangle(primary, position, position, 300, 300); - primary->Flip(primary, nullptr, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC); - position++; - if (position>600) { - position = 0; - } - */ - if(true == m_run) { - err = primary_gl->Lock(primary_gl); - if (DFB_OK!=err) { - EWOL_ERROR("primary_gl->Lock"); - DirectFBErrorFatal("primary_gl->Lock", err); - } - // TODO : set at false - bool hasDisplay = eSystem::draw(true); - if (true == hasDisplay) { - glFinish(); - } - err = primary_gl->Unlock(primary_gl); - if (DFB_OK!=err) { - EWOL_ERROR("primary_gl->Unlock"); - DirectFBErrorFatal("primary_gl->Unlock", err); - } - primary->Flip(primary, nullptr, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC); - } - - while (events->getEvent(events, DFB_EVENT(&evt)) == DFB_OK) { - switch (evt.type) { - default: - case DIET_UNKNOWN: /* unknown event */ - EWOL_DEBUG("event unknown type : " << evt.type << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ..."); - break; - case DIET_KEYPRESS: /* a key is been pressed */ - case DIET_KEYRELEASE: /* a key is been released */ - { - bool isPressed = (evt.type == DIET_KEYPRESS); - //EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ..."); - if( 1 <= evt.key_symbol && evt.key_symbol <= 0x7F ) { - eSystem::setKeyboard(guiKeyBoardMode, evt.key_symbol, isPressed, false); - } else { - EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " == > not managed key"); - } - } - break; - case DIET_AXISMOTION: /* mouse/joystick movement */ - { - /* - if (evt.flags & DIEF_AXISREL) { - switch (evt.axis) { - case DIAI_X: - //view_roty += evt.axisrel / 2.0; - break; - case DIAI_Y: - //view_rotx += evt.axisrel / 2.0; - break; - case DIAI_Z: - //view_rotz += evt.axisrel / 2.0; - break; - default: - ; - } - } - */ - EWOL_DEBUG("event mouse motion flag" << (char)evt.flags << " axis=" << evt.axis << " value=" << evt.axisrel); - } - break; - case DIET_BUTTONPRESS: /* a (mouse) button is been pressed */ - case DIET_BUTTONRELEASE: /* a (mouse) button is been released */ - { - bool isPressed = (evt.type == DIET_KEYPRESS); - EWOL_DEBUG("event mouse event pressed=" << isPressed << " flag" << (char)evt.flags << " axis=" << evt.axis << " value=" << evt.axisrel); - } - break; - /* - case DIET_KEYPRESS: - switch (evt.key_symbol) { - case DIKS_ESCAPE: - m_run = false; - break; - case DIKS_CURSOR_UP: - //inc_rotx = 5.0; - break; - case DIKS_CURSOR_DOWN: - //inc_rotx = -5.0; - break; - case DIKS_CURSOR_LEFT: - //inc_roty = 5.0; - break; - case DIKS_CURSOR_RIGHT: - //inc_roty = -5.0; - break; - case DIKS_PAGE_UP: - //inc_rotz = 5.0; - break; - case DIKS_PAGE_DOWN: - //inc_rotz = -5.0; - break; - default: - ; - } - break; - case DIET_KEYRELEASE: - switch (evt.key_symbol) { - case DIKS_CURSOR_UP: - //inc_rotx = 0; - break; - case DIKS_CURSOR_DOWN: - //inc_rotx = 0; - break; - case DIKS_CURSOR_LEFT: - //inc_roty = 0; - break; - case DIKS_CURSOR_RIGHT: - //inc_roty = 0; - break; - case DIKS_PAGE_UP: - //inc_rotz = 0; - break; - case DIKS_PAGE_DOWN: - //inc_rotz = 0; - break; - default: - ; - } - break; - case DIET_AXISMOTION: - if (evt.flags & DIEF_AXISREL) { - switch (evt.axis) { - case DIAI_X: - //view_roty += evt.axisrel / 2.0; - break; - case DIAI_Y: - //view_rotx += evt.axisrel / 2.0; - break; - case DIAI_Z: - //view_rotz += evt.axisrel / 2.0; - break; - default: - ; - } - } - break; - default: - ; - */ - } - } - } - // Note : if we not stop like this the system break ... - exit(-1); -}; - - -// ------------------------------------------------------------------------- -// ClipBoard AREA : -// ------------------------------------------------------------------------- - - -void guiInterface::ClipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - // TODO : ... -} - - -void guiInterface::ClipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) { - // TODO : ... -} - - - -#undef __class__ -#define __class__ "guiInterface" - - -void guiInterface::Stop() { - EWOL_INFO("X11-API: Stop"); - m_run = false; -} - -void guiInterface::KeyboardShow() { - // nothing to do : No keyboard on computer ... -} - - -void guiInterface::KeyboardHide() { - // nothing to do : No keyboard on computer ... -} - - -void guiInterface::changeSize(ivec2 _size) { - // TODO : ... -} - - -void guiInterface::changePos(ivec2 _pos) { - // TODO : ... -} - - -void guiInterface::getAbsPos(ivec2& _pos) { - // TODO : ... -} - - -void guiInterface::setCursor(enum ewol::cursorDisplay _newCursor) { - // TODO : ... -} - -void guiInterface::GrabPointerEvents(bool _isGrabbed, vec2 _forcedPosition) { - // TODO : ... -} - - -/** - * @brief Main of the program - * @param std IO - * @return std IO - */ -int guiInterface::main(int argc, const char *argv[]) { - EWOL_INFO("Main (START)"); - for (int32_t iii=0; iii -#include +#include namespace ewol { namespace event { class Entry { private: - enum ewol::key::keyboard m_type; //!< type of hardware event - enum ewol::key::status m_status; //!< status of hardware event - ewol::key::Special m_specialKey; //!< input key status (prevent change in time..) + enum gale::key::keyboard m_type; //!< type of hardware event + enum gale::key::status m_status; //!< status of hardware event + gale::key::Special m_specialKey; //!< input key status (prevent change in time..) char32_t m_unicodeData; //!< Unicode data (in some case) public: - Entry(enum ewol::key::keyboard _type, - enum ewol::key::status _status, - ewol::key::Special _specialKey, + Entry(enum gale::key::keyboard _type, + enum gale::key::status _status, + gale::key::Special _specialKey, char32_t _char) : m_type(_type), m_status(_status), @@ -31,22 +31,22 @@ namespace ewol { m_unicodeData(_char) { }; - void setType(enum ewol::key::keyboard _type) { + void setType(enum gale::key::keyboard _type) { m_type = _type; }; - inline const enum ewol::key::keyboard& getType() const { + inline const enum gale::key::keyboard& getType() const { return m_type; }; - void setStatus(enum ewol::key::status _status) { + void setStatus(enum gale::key::status _status) { m_status = _status; }; - inline const enum ewol::key::status& getStatus() const { + inline const enum gale::key::status& getStatus() const { return m_status; }; - void setSpecialKey(const ewol::key::Special& _specialKey) { + void setSpecialKey(const gale::key::Special& _specialKey) { m_specialKey = _specialKey; }; - inline const ewol::key::Special& getSpecialKey() const { + inline const gale::key::Special& getSpecialKey() const { return m_specialKey; }; void setChar(char32_t _char) { @@ -60,9 +60,9 @@ namespace ewol { class EntrySystem { public: - EntrySystem(enum ewol::key::keyboard _type, - enum ewol::key::status _status, - ewol::key::Special _specialKey, + EntrySystem(enum gale::key::keyboard _type, + enum gale::key::status _status, + gale::key::Special _specialKey, char32_t _char) : m_event(_type, _status, _specialKey, _char) { diff --git a/ewol/event/Input.h b/ewol/event/Input.h index 609d61ae..32e84656 100644 --- a/ewol/event/Input.h +++ b/ewol/event/Input.h @@ -15,17 +15,17 @@ namespace ewol { namespace event { class Input { private: - enum ewol::key::type m_type; - enum ewol::key::status m_status; + enum gale::key::type m_type; + enum gale::key::status m_status; uint8_t m_inputId; vec2 m_pos; - ewol::key::Special m_specialKey; //!< input key status (prevent change in time..) + gale::key::Special m_specialKey; //!< input key status (prevent change in time..) public: - Input(enum ewol::key::type _type, - enum ewol::key::status _status, + Input(enum gale::key::type _type, + enum gale::key::status _status, uint8_t _id, const vec2& _pos, - ewol::key::Special _specialKey): + gale::key::Special _specialKey): m_type(_type), m_status(_status), m_inputId(_id), @@ -33,16 +33,16 @@ namespace ewol { m_specialKey(_specialKey) { }; - void setType(enum ewol::key::type _type) { + void setType(enum gale::key::type _type) { m_type = _type; }; - inline const enum ewol::key::type& getType() const { + inline const enum gale::key::type& getType() const { return m_type; }; - void setStatus(enum ewol::key::status _status) { + void setStatus(enum gale::key::status _status) { m_status = _status; }; - inline const enum ewol::key::status& getStatus() const { + inline const enum gale::key::status& getStatus() const { return m_status; }; void setId(uint8_t _id) { @@ -57,10 +57,10 @@ namespace ewol { inline const vec2& getPos() const { return m_pos; }; - void setSpecialKey(const ewol::key::Special& _specialKey) { + void setSpecialKey(const gale::key::Special& _specialKey) { m_specialKey = _specialKey; }; - inline const ewol::key::Special& getSpecialKey() const { + inline const gale::key::Special& getSpecialKey() const { return m_specialKey; }; /** @@ -74,13 +74,13 @@ namespace ewol { class InputSystem { public: - InputSystem(enum ewol::key::type _type, - enum ewol::key::status _status, + InputSystem(enum gale::key::type _type, + enum gale::key::status _status, uint8_t _id, const vec2& _pos, std::shared_ptr _dest, int32_t _realIdEvent, - ewol::key::Special _specialKey) : + gale::key::Special _specialKey) : m_event(_type, _status, _id, _pos, _specialKey), m_dest(_dest), m_realIdEvent(_realIdEvent) { }; diff --git a/ewol/ewol.cpp b/ewol/ewol.cpp index 4c2cf6c5..f93a8c04 100644 --- a/ewol/ewol.cpp +++ b/ewol/ewol.cpp @@ -9,10 +9,11 @@ #include #include #include +#include -#include +#include #include -#include +#include #include #undef __class__ @@ -48,4 +49,14 @@ std::string ewol::getBoardType() { std::string ewol::getVersion() { return EWOL_VERSION; } +int64_t ewol::getTime() { + return gale::getTime(); +} + +int32_t ewol::run(ewol::context::Application* _application, + int32_t _argc, + const char* _argv[]) { + return gale::run(new ewol::Context(_application), _argc, _argv); +} + diff --git a/ewol/ewol.h b/ewol/ewol.h index 9998d144..be9abc9e 100644 --- a/ewol/ewol.h +++ b/ewol/ewol.h @@ -36,16 +36,19 @@ namespace ewol { * @return The current time * @note is implemented by the OS implementation cf renderer/X11/... */ + // TODO : Remove ... int64_t getTime(); /** * @brief get compilation mode (release/debug) * @return the string of the mode of commpilation */ + // TODO : Remove ... std::string getCompilationMode(); /** * @brief get the board type (Android/Linux/MacOs/...) * @return the string of the mode of commpilation */ + // TODO : Remove ... std::string getBoardType(); }; diff --git a/ewol/key/Special.cpp b/ewol/key/Special.cpp deleted file mode 100644 index 18a786a8..00000000 --- a/ewol/key/Special.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - -#define EWOL_FLAG_KEY_CAPS_LOCK 0x00000001 -#define EWOL_FLAG_KEY_SHIFT 0x00000002 -#define EWOL_FLAG_KEY_CTRL 0x00000004 -#define EWOL_FLAG_KEY_META 0x00000008 -#define EWOL_FLAG_KEY_ALT 0x00000010 -#define EWOL_FLAG_KEY_ALTGR 0x00000020 -#define EWOL_FLAG_KEY_NUM_LOCK 0x00000040 -#define EWOL_FLAG_KEY_INSERT 0x00000080 - -// TODO : Update to support the Left and right of some key ... - -ewol::key::Special::Special() : - m_value(0) { - -} -void ewol::key::Special::update(enum ewol::key::keyboard _move, bool _isDown) { - switch (_move) { - case keyboardInsert: - setInsert(_isDown); - break; - case keyboardCapLock: - setCapsLock(_isDown); - break; - case keyboardShiftLeft: - case keyboardShiftRight: - setShift(_isDown); - break; - case keyboardCtrlLeft: - case keyboardCtrlRight: - setCtrl(_isDown); - break; - case keyboardMetaLeft: - case keyboardMetaRight: - setMeta(_isDown); - break; - case keyboardAlt: - setAlt(_isDown); - break; - case keyboardAltGr: - setAltGr(_isDown); - break; - case keyboardNumLock: - setNumLock(_isDown); - break; - default: - break; - } -} - -bool ewol::key::Special::getCapsLock() const { - if ((m_value & EWOL_FLAG_KEY_CAPS_LOCK) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setCapsLock(bool _value) { - if ((m_value & EWOL_FLAG_KEY_CAPS_LOCK) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_CAPS_LOCK; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_CAPS_LOCK; - } - } -} - -bool ewol::key::Special::getShift() const { - if ((m_value & EWOL_FLAG_KEY_SHIFT) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setShift(bool _value) { - if ((m_value & EWOL_FLAG_KEY_SHIFT) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_SHIFT; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_SHIFT; - } - } -} - -bool ewol::key::Special::getCtrl() const { - if ((m_value & EWOL_FLAG_KEY_CTRL) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setCtrl(bool _value) { - if ((m_value & EWOL_FLAG_KEY_CTRL) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_CTRL; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_CTRL; - } - } -} - -bool ewol::key::Special::getMeta() const { - if ((m_value & EWOL_FLAG_KEY_META) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setMeta(bool _value) { - if ((m_value & EWOL_FLAG_KEY_META) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_META; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_META; - } - } -} - -bool ewol::key::Special::getAlt() const { - if ((m_value & EWOL_FLAG_KEY_ALT) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setAlt(bool _value) { - if ((m_value & EWOL_FLAG_KEY_ALT) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_ALT; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_ALT; - } - } -} - -bool ewol::key::Special::getAltGr() const { - if ((m_value & EWOL_FLAG_KEY_ALTGR) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setAltGr(bool _value) { - if ((m_value & EWOL_FLAG_KEY_ALTGR) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_ALTGR; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_ALTGR; - } - } -} - -bool ewol::key::Special::getNumLock() const { - if ((m_value & EWOL_FLAG_KEY_NUM_LOCK) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setNumLock(bool _value) { - if ((m_value & EWOL_FLAG_KEY_NUM_LOCK) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_NUM_LOCK; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_NUM_LOCK; - } - } -} - -bool ewol::key::Special::getInsert() const { - if ((m_value & EWOL_FLAG_KEY_INSERT) != 0) { - return true; - } - return false; -} -void ewol::key::Special::setInsert(bool _value) { - if ((m_value & EWOL_FLAG_KEY_INSERT) != 0) { - if (_value == false) { - m_value -= EWOL_FLAG_KEY_INSERT; - } - } else { - if (_value == true) { - m_value += EWOL_FLAG_KEY_INSERT; - } - } -} - -std::ostream& ewol::key::operator <<(std::ostream& _os, const ewol::key::Special _obj) { - _os << " capLock=" << _obj.getCapsLock(); - _os << " shift=" << _obj.getShift(); - _os << " ctrl=" << _obj.getCtrl(); - _os << " meta=" << _obj.getMeta(); - _os << " alt=" << _obj.getAlt(); - _os << " altGr=" << _obj.getAltGr(); - _os << " verNum=" << _obj.getNumLock(); - _os << " insert=" << _obj.getInsert(); - return _os; -} diff --git a/ewol/key/Special.h b/ewol/key/Special.h deleted file mode 100644 index 272e35ed..00000000 --- a/ewol/key/Special.h +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_KEY_SPECIAL_H__ -#define __EWOL_KEY_SPECIAL_H__ - -#include -#include - -namespace ewol { - namespace key { - /** - * @brief This class consider generic special keyborad key (insert, control, shift ...) - */ - class Special { - private: - uint32_t m_value; - public: - /** - * @brief Main constructor - */ - Special(); - /** - * @brief get the current CapLock Status - * @return The CapLock value - */ - bool getCapsLock() const; - /** - * @brief set the current CapLock Status - * @param[in] _value The new CapLock value - */ - void setCapsLock(bool _value); - /** - * @brief Get the current Shift key status - * @return The Shift value - */ - bool getShift() const; - /** - * @brief Set the current Shift key status - * @param[in] _value The new Shift value - */ - void setShift(bool _value); - /** - * @brief Get the Current Control key status - * @return The Control value - */ - bool getCtrl() const; - /** - * @brief Set the Current Control key status - * @param[in] _value The new Control value - */ - void setCtrl(bool _value); - /** - * @brief Get the current Meta key status (also named windows or apple key) - * @return The Meta value (name Windows key, apple key, command key ...) - */ - bool getMeta() const; - /** - * @brief Set the current Meta key status (also named windows or apple key) - * @param[in] _value The new Meta value (name Windows key, apple key, command key ...) - */ - void setMeta(bool _value); - /** - * @brief Get the current Alt key status - * @return The Alt value - */ - bool getAlt() const; - /** - * @brief Set the current Alt key status - * @param[in] _value The new Alt value - */ - void setAlt(bool _value); - /** - * @brief Get the current Alt-Gr key status - * @return The Alt-gr value (does not exist on MacOs) - */ - bool getAltGr() const; - /** - * @brief Set the current Alt-Gr key status - * @param[in] _value The new Alt-gr value (does not exist on MacOs) - */ - void setAltGr(bool _value); - /** - * @brief Get the current Ver-num key status - * @return The Numerical Lock value - */ - bool getNumLock() const; - /** - * @brief Set the current Ver-num key status - * @param[in] _value The new Numerical Lock value - */ - void setNumLock(bool _value); - /** - * @brief Get the current Intert key status - * @return The Insert value - */ - bool getInsert() const; - /** - * @brief Set the current Intert key status - * @param[in] _value The new Insert value - */ - void setInsert(bool _value); - /** - * @brief Update the internal value with the input moving key. - * @param[in] _move Moving key. - * @param[in] _isFown The Key is pressed or not. - */ - void update(enum ewol::key::keyboard _move, bool _isDown); - }; - std::ostream& operator <<(std::ostream& _os, const ewol::key::Special _obj); - }; -}; - -#endif - - diff --git a/ewol/key/key.h b/ewol/key/key.h deleted file mode 100644 index b455a72f..00000000 --- a/ewol/key/key.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_KEY_H__ -#define __EWOL_KEY_H__ - -#include -#include -#include -#include - -#endif - - diff --git a/ewol/key/keyboard.cpp b/ewol/key/keyboard.cpp deleted file mode 100644 index 997e2115..00000000 --- a/ewol/key/keyboard.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - -static const char* keyboardDescriptionString[ewol::key::keyboardCount+1] = { - "keyboardUnknow", - "keyboardChar", - "keyboardLeft", - "keyboardRight", - "keyboardUp", - "keyboardDown", - "keyboardPageUp", - "keyboardPageDown", - "keyboardStart", - "keyboardEnd", - "keyboardPrint", - "keyboardStopDefil", - "keyboardWait", - "keyboardInsert", - "keyboardF1", - "keyboardF2", - "keyboardF3", - "keyboardF4", - "keyboardF5", - "keyboardF6", - "keyboardF7", - "keyboardF8", - "keyboardF9", - "keyboardF10", - "keyboardF11", - "keyboardF12", - "keyboardCapLock", - "keyboardShiftLeft", - "keyboardShiftRight", - "keyboardCtrlLeft", - "keyboardCtrlRight", - "keyboardMetaLeft", - "keyboardMetaRight", - "keyboardAlt", - "keyboardAltGr", - "keyboardContextMenu", - "keyboardNumLock", - "keyboardCount" -}; - -std::ostream& ewol::key::operator <<(std::ostream& _os, const enum ewol::key::keyboard _obj) { - if (_obj >= 0 && _obj = 0 && _obj - -namespace ewol { - namespace key { - /** - * @brief Keybord event or joystick event - * @warning If you modify Id of these element check the java interface file of constant : EwolConstant.java - */ - enum keyboard { - keyboardUnknow = 0, //!< Unknown keyboard key - keyboardChar, //!< Char input is arrived ... - keyboardLeft, //!< Left key <-- - keyboardRight, //!< Right key --> - keyboardUp, //!< Up key ^ - keyboardDown, //!< Down key \/ - keyboardPageUp, //!< Page Up key - keyboardPageDown, //!< page down key - keyboardStart, //!< Start key - keyboardEnd, //!< End key - keyboardPrint, //!< print screen key. - keyboardStopDefil, //!< Stop display key. - keyboardWait, //!< Wait key. - keyboardInsert, //!< insert key. - keyboardF1, //!< F1 key. - keyboardF2, //!< F2 key. - keyboardF3, //!< F3 key. - keyboardF4, //!< F4 key. - keyboardF5, //!< F5 key. - keyboardF6, //!< F6 key. - keyboardF7, //!< F7 key. - keyboardF8, //!< F8 key. - keyboardF9, //!< F9 key. - keyboardF10, //!< F10 key. - keyboardF11, //!< F11 key. - keyboardF12, //!< F12 key. - keyboardCapLock, //!< Capital Letter Lock key. - keyboardShiftLeft, //!< Shift left key. - keyboardShiftRight, //!< Shift right key. - keyboardCtrlLeft, //!< Control left key. - keyboardCtrlRight, //!< Control right key. - keyboardMetaLeft, //!< Meta left key (apple key or windows key). - keyboardMetaRight, //!< Meta right key (apple key or windows key). - keyboardAlt, //!< Alt key. - keyboardAltGr, //!< Alt ground key. - keyboardContextMenu, //!< Contextual menu key. - keyboardNumLock, //!< Numerical Lock key. - keyboardCount //!< number of posible key - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - std::ostream& operator <<(std::ostream& _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 - }; - std::ostream& operator <<(std::ostream& _os, const enum ewol::key::keyboardSystem _obj); - }; -}; - - - -#endif - - diff --git a/ewol/key/status.cpp b/ewol/key/status.cpp deleted file mode 100644 index 6764f3d6..00000000 --- a/ewol/key/status.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - -static const char* statusDescriptionString[ewol::key::statusCount+1] = { - "statusUnknow", - "statusDown", - "statusMove", - "statusSingle", - "statusDouble", - "statusTriple", - "statusQuad", - "statusQuinte", - "statusUp", - "statusUpAfter", - "statusEnter", - "statusLeave", - "statusAbort", - "statusTransfert", - "statusCount" -}; - -std::ostream& ewol::key::operator <<(std::ostream& _os, const enum ewol::key::status _obj) { - if (_obj >= 0 && _obj - -namespace ewol { - namespace key { - /** - * @brief Keybord event or joyestick event - */ - enum status { - statusUnknow = 0, - statusDown, // availlable on Keyboard too - statusMove, - statusSingle, - statusDouble, - statusTriple, - statusQuad, - statusQuinte, - statusUp, // availlable on Keyboard too - statusUpAfter, // mouse input & finger input this appear after the single event (depending on some case...) - statusEnter, - statusLeave, - statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events) - statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event) - statusCount, // number max of imput possible - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - std::ostream& operator <<(std::ostream& _os, const enum ewol::key::status _obj); - }; -}; - - - -#endif - - diff --git a/ewol/key/type.cpp b/ewol/key/type.cpp deleted file mode 100644 index 66b3ea44..00000000 --- a/ewol/key/type.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include - - -static const char* typeDescriptionString[ewol::key::typeCount+1] = { - "typeUnknow", - "typeMouse", - "typeFinger", - "typeStylet", - "typeCount" -}; - -std::ostream& ewol::operator <<(std::ostream& _os, const enum ewol::key::type _obj) { - if (_obj >= 0 && _obj < ewol::key::typeCount) { - _os << typeDescriptionString[_obj]; - } else { - _os << "[ERROR]"; - } - return _os; -} - diff --git a/ewol/key/type.h b/ewol/key/type.h deleted file mode 100644 index a81f6cd6..00000000 --- a/ewol/key/type.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __EWOL_KEY_TYPE_H__ -#define __EWOL_KEY_TYPE_H__ - -#include - -namespace ewol { - namespace key { - /** - * @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different - */ - enum type { - typeUnknow = 0, //!< Unknow input Type - typeMouse, //!< Mouse type - typeFinger, //!< Finger type - typeStylet, //!< Stylet type - typeCount //!< number of types - }; - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - std::ostream& operator <<(std::ostream& _os, const enum ewol::key::type _obj); -}; - - - -#endif - - diff --git a/ewol/resource/ColorFile.cpp b/ewol/resource/ColorFile.cpp index 750b8450..a6e71061 100644 --- a/ewol/resource/ColorFile.cpp +++ b/ewol/resource/ColorFile.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -18,13 +17,13 @@ ewol::resource::ColorFile::ColorFile() : - ewol::Resource(), + gale::Resource(), m_errorColor(etk::color::orange) { - addObjectType("ewol::ColorFile"); + addResourceType("ewol::ColorFile"); } void ewol::resource::ColorFile::init(const std::string& _filename) { - ewol::Resource::init(_filename); + gale::Resource::init(_filename); EWOL_DEBUG("CF : load \"" << _filename << "\""); reload(); EWOL_DEBUG("List of all color : " << m_list.getKeys()); diff --git a/ewol/resource/ColorFile.h b/ewol/resource/ColorFile.h index 3b152c49..0338632f 100644 --- a/ewol/resource/ColorFile.h +++ b/ewol/resource/ColorFile.h @@ -13,14 +13,14 @@ #include #include #include -#include +#include namespace ewol { namespace resource { /** * @brief ColorFile is a Resource designed to be specific with the theme (for example black, or white or orange ...) */ - class ColorFile : public ewol::Resource { + class ColorFile : public gale::Resource { private: etk::Hash > m_list; //!< List of all color in the file etk::Color m_errorColor; //!< Error returned color diff --git a/ewol/resource/Colored3DObject.cpp b/ewol/resource/Colored3DObject.cpp index 4e2bc412..05875319 100644 --- a/ewol/resource/Colored3DObject.cpp +++ b/ewol/resource/Colored3DObject.cpp @@ -8,7 +8,8 @@ #include #include -#include +#include +#include #undef __class__ #define __class__ "resource::Colored3DObject" @@ -16,11 +17,11 @@ ewol::resource::Colored3DObject::Colored3DObject() : m_GLprogram(nullptr) { - addObjectType("ewol::Colored3DObject"); + addResourceType("ewol::Colored3DObject"); } void ewol::resource::Colored3DObject::init() { - ewol::Resource::init(); + gale::Resource::init(); // get the shader resource : m_GLPosition = 0; m_GLprogram = gale::resource::Program::create("DATA:simple3D.prog"); @@ -48,7 +49,7 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, return; } if (true == _depthtest) { - gale::openGL::enable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::enable(gale::openGL::flag_depthTest); if (false == _updateDepthBuffer) { glDepthMask(GL_FALSE); } @@ -65,7 +66,7 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, // color : m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, _vertices.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, _vertices.size()); m_GLprogram->unUse(); // Request the draw od the elements : //glDrawArrays(GL_LINES, 0, vertices.size()); @@ -74,7 +75,7 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, if (false == _updateDepthBuffer) { glDepthMask(GL_TRUE); } - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_depthTest); } } @@ -91,7 +92,7 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, return; } if (true == _depthtest) { - gale::openGL::enable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::enable(gale::openGL::flag_depthTest); if (false == _updateDepthBuffer) { glDepthMask(GL_FALSE); } @@ -108,13 +109,13 @@ void ewol::resource::Colored3DObject::draw(std::vector& _vertices, // color : m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color); // Request the draw od the elements : - gale::openGL::drawArrays(GL_TRIANGLES, 0, _vertices.size()); + gale::openGL::drawArrays(gale::openGL::render_triangle, 0, _vertices.size()); m_GLprogram->unUse(); if (true == _depthtest) { if (false == _updateDepthBuffer) { glDepthMask(GL_TRUE); } - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_depthTest); } } @@ -131,7 +132,7 @@ void ewol::resource::Colored3DObject::drawLine(std::vector& _vertices, return; } if (true == _depthtest) { - gale::openGL::enable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::enable(gale::openGL::flag_depthTest); if (false == _updateDepthBuffer) { glDepthMask(GL_FALSE); } @@ -148,13 +149,13 @@ void ewol::resource::Colored3DObject::drawLine(std::vector& _vertices, // color : m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color); // Request the draw od the elements : - gale::openGL::drawArrays(GL_LINES, 0, _vertices.size()); + gale::openGL::drawArrays(gale::openGL::render_line, 0, _vertices.size()); m_GLprogram->unUse(); if (true == _depthtest) { if (false == _updateDepthBuffer) { glDepthMask(GL_TRUE); } - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_depthTest); } } diff --git a/ewol/resource/Colored3DObject.h b/ewol/resource/Colored3DObject.h index f2aac551..6f684d80 100644 --- a/ewol/resource/Colored3DObject.h +++ b/ewol/resource/Colored3DObject.h @@ -10,13 +10,13 @@ #define __COLORED_3D_OBJECT_H__ #include -#include +#include #include #include namespace ewol { namespace resource { - class Colored3DObject : public ewol::Resource { + class Colored3DObject : public gale::Resource { protected: std::shared_ptr m_GLprogram; int32_t m_GLPosition; diff --git a/ewol/resource/ConfigFile.cpp b/ewol/resource/ConfigFile.cpp index fdf32f2c..3f31c4cb 100644 --- a/ewol/resource/ConfigFile.cpp +++ b/ewol/resource/ConfigFile.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -20,12 +20,12 @@ ewol::resource::ConfigFile::ConfigFile() : - ewol::Resource() { - addObjectType("ewol::ConfigFile"); + gale::Resource() { + addResourceType("ewol::ConfigFile"); } void ewol::resource::ConfigFile::init(const std::string& _filename) { - ewol::Resource::init(_filename); + gale::Resource::init(_filename); EWOL_DEBUG("SFP : load \"" << _filename << "\""); reload(); } diff --git a/ewol/resource/ConfigFile.h b/ewol/resource/ConfigFile.h index a0bcb048..7a8749dd 100644 --- a/ewol/resource/ConfigFile.h +++ b/ewol/resource/ConfigFile.h @@ -13,11 +13,11 @@ #include #include #include -#include +#include namespace ewol { namespace resource { - class ConfigFile : public ewol::Resource { + class ConfigFile : public gale::Resource { private: ejson::Document m_doc; etk::Hash> m_list; diff --git a/ewol/resource/DistanceFieldFont.cpp b/ewol/resource/DistanceFieldFont.cpp index 5cae8478..518b4a04 100644 --- a/ewol/resource/DistanceFieldFont.cpp +++ b/ewol/resource/DistanceFieldFont.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -28,7 +28,7 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() : ewol::resource::Texture(), m_borderSize(10), m_textureBorderSize(0,0) { - addObjectType("ewol::resource::DistanceFieldFont"); + addResourceType("ewol::resource::DistanceFieldFont"); m_font = nullptr; m_lastGlyphPos.setValue(1,1); m_lastRawHeigh = 0; diff --git a/ewol/resource/DistanceFieldFont.h b/ewol/resource/DistanceFieldFont.h index 8fbf312a..c14bedae 100644 --- a/ewol/resource/DistanceFieldFont.h +++ b/ewol/resource/DistanceFieldFont.h @@ -11,7 +11,6 @@ #include #include -#include #include namespace ewol { diff --git a/ewol/resource/FontFreeType.cpp b/ewol/resource/FontFreeType.cpp index ef10875d..775a89c5 100644 --- a/ewol/resource/FontFreeType.cpp +++ b/ewol/resource/FontFreeType.cpp @@ -11,12 +11,12 @@ #include -#include +#include #include #include #include -#include +#include #undef __class__ #define __class__ "resource::FontFreeType" @@ -53,7 +53,7 @@ void ewol::resource::freeTypeUnInit() { } ewol::resource::FontFreeType::FontFreeType() { - addObjectType("ewol::FontFreeType"); + addResourceType("ewol::FontFreeType"); m_init = false; m_FileBuffer = nullptr; m_FileSize = 0; diff --git a/ewol/resource/Image.cpp b/ewol/resource/Image.cpp index 79eda1a9..3db190ac 100644 --- a/ewol/resource/Image.cpp +++ b/ewol/resource/Image.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -18,7 +18,7 @@ #define __class__ "resource::TextureFile" ewol::resource::TextureFile::TextureFile() { - addObjectType("ewol::resource::Image"); + addResourceType("ewol::resource::Image"); } @@ -104,21 +104,21 @@ std::shared_ptr ewol::resource::TextureFile::create EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size); std::shared_ptr object = nullptr; - std::shared_ptr object2 = getManager().localKeep(TmpFilename); - if (nullptr != object2) { + std::shared_ptr object2 = getManager().localKeep(TmpFilename); + if (object2 != nullptr) { object = std::dynamic_pointer_cast(object2); - if (nullptr == object) { + if (object == nullptr) { EWOL_CRITICAL("Request resource file : '" << TmpFilename << "' With the wrong type (dynamic cast error)"); return nullptr; } } - if (nullptr != object) { + if (object != nullptr) { return object; } EWOL_INFO("CREATE: TextureFile: '" << TmpFilename << "' size=" << _size); // need to crate a new one ... object = std::shared_ptr(new ewol::resource::TextureFile()); - if (nullptr == object) { + if (object == nullptr) { EWOL_ERROR("allocation error of a resource : " << _filename); return nullptr; } diff --git a/ewol/resource/Image.h b/ewol/resource/Image.h index 0992cc41..bbf9ce46 100644 --- a/ewol/resource/Image.h +++ b/ewol/resource/Image.h @@ -13,7 +13,6 @@ #include #include #include -#include namespace ewol { namespace resource { diff --git a/ewol/resource/ImageDF.cpp b/ewol/resource/ImageDF.cpp index 3af97e6c..ccb9c764 100644 --- a/ewol/resource/ImageDF.cpp +++ b/ewol/resource/ImageDF.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include @@ -19,7 +19,7 @@ #define __class__ "resource::TextureFile" ewol::resource::ImageDF::ImageDF() { - addObjectType("ewol::resource::ImageDF"); + addResourceType("ewol::resource::ImageDF"); } @@ -193,7 +193,7 @@ std::shared_ptr ewol::resource::ImageDF::create(const s EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size); std::shared_ptr object = nullptr; - std::shared_ptr object2 = getManager().localKeep("DF__" + TmpFilename); + std::shared_ptr object2 = getManager().localKeep("DF__" + TmpFilename); if (nullptr != object2) { object = std::dynamic_pointer_cast(object2); if (nullptr == object) { diff --git a/ewol/resource/ImageDF.h b/ewol/resource/ImageDF.h index c2648450..a6696687 100644 --- a/ewol/resource/ImageDF.h +++ b/ewol/resource/ImageDF.h @@ -14,7 +14,6 @@ #include #include #include -#include namespace ewol { namespace resource { diff --git a/ewol/resource/Manager.cpp b/ewol/resource/Manager.cpp deleted file mode 100644 index 7b15bde2..00000000 --- a/ewol/resource/Manager.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include -#include -#include -#include -#include -#include - - - -ewol::resource::Manager::Manager() : - m_contextHasBeenRemoved(true) { - // nothing to do ... -} - -ewol::resource::Manager::~Manager() { - bool hasError = false; - if (m_resourceListToUpdate.size()!=0) { - EWOL_ERROR("Must not have anymore resources to update !!!"); - hasError = true; - } - // TODO : Remove unneeded elements - if (m_resourceList.size()!=0) { - EWOL_ERROR("Must not have anymore resources !!!"); - hasError = true; - } - if (true == hasError) { - EWOL_ERROR("Check if the function UnInit has been called !!!"); - } -} - -void ewol::resource::Manager::unInit() { - display(); - m_resourceListToUpdate.clear(); - // remove all resources ... - auto it(m_resourceList.begin()); - while(it != m_resourceList.end()) { - std::shared_ptr tmpRessource = (*it).lock(); - if (tmpRessource != nullptr) { - EWOL_WARNING("Find a resource that is not removed : [" << tmpRessource->getId() << "]" - << "=\"" << tmpRessource->getName() << "\" " - << tmpRessource.use_count() << " elements"); - } - m_resourceList.erase(it); - it = m_resourceList.begin(); - } - m_resourceList.clear(); -} - -void ewol::resource::Manager::display() { - EWOL_INFO("Resources loaded : "); - // remove all resources ... - for (auto &it : m_resourceList) { - std::shared_ptr tmpRessource = it.lock(); - if (tmpRessource != nullptr) { - EWOL_INFO(" [" << tmpRessource->getId() << "]" - << tmpRessource->getObjectType() - << "=\"" << tmpRessource->getName() << "\" " - << tmpRessource.use_count() << " elements"); - } - } - EWOL_INFO("Resources ---"); -} - -void ewol::resource::Manager::reLoadResources() { - EWOL_INFO("------------- Resources re-loaded -------------"); - // remove all resources ... - if (m_resourceList.size() != 0) { - for (size_t jjj=0; jjj tmpRessource = it.lock(); - if(tmpRessource != nullptr) { - if (jjj == tmpRessource->getResourceLevel()) { - tmpRessource->reload(); - EWOL_INFO(" [" << tmpRessource->getId() << "]="<< tmpRessource->getObjectType()); - } - } - } - } - } - // TODO : UNderstand why it is set here ... - //ewol::requestUpdateSize(); - EWOL_INFO("------------- Resources -------------"); -} - -void ewol::resource::Manager::update(const std::shared_ptr& _object) { - // chek if not added before - for (auto &it : m_resourceListToUpdate) { - if ( it != nullptr - && it == _object) { - // just prevent some double add ... - return; - } - } - // add it ... - m_resourceListToUpdate.push_back(_object); -} - -// Specific to load or update the data in the openGl context == > system use only -void ewol::resource::Manager::updateContext() { - if (m_contextHasBeenRemoved == true) { - // need to update all ... - m_contextHasBeenRemoved = false; - if (m_resourceList.size() != 0) { - for (size_t jjj=0; jjj tmpRessource = it.lock(); - if( tmpRessource != nullptr - && jjj == tmpRessource->getResourceLevel()) { - //EWOL_DEBUG("Update context named : " << l_resourceList[iii]->getName()); - tmpRessource->updateContext(); - } - } - } - } - } else { - if (m_resourceListToUpdate.size() != 0) { - for (size_t jjj=0; jjjgetResourceLevel()) { - it->updateContext(); - } - } - } - } - } - // Clean the update list - m_resourceListToUpdate.clear(); -} - -// in this case, it is really too late ... -void ewol::resource::Manager::contextHasBeenDestroyed() { - for (auto &it : m_resourceList) { - std::shared_ptr tmpRessource = it.lock(); - if (tmpRessource != nullptr) { - tmpRessource->removeContextToLate(); - } - } - // no context preent ... - m_contextHasBeenRemoved = true; -} - -// internal generic keeper ... -std::shared_ptr ewol::resource::Manager::localKeep(const std::string& _filename) { - EWOL_VERBOSE("KEEP (DEFAULT) : file : '" << _filename << "' in " << m_resourceList.size() << " resources"); - for (auto &it : m_resourceList) { - std::shared_ptr tmpRessource = it.lock(); - if (tmpRessource != nullptr) { - if (tmpRessource->getName() == _filename) { - return tmpRessource; - } - } - } - return nullptr; -} - -// internal generic keeper ... -void ewol::resource::Manager::localAdd(const std::shared_ptr& _object) { - //Add ... find empty slot - for (auto &it : m_resourceList) { - std::shared_ptr tmpRessource = it.lock(); - if (tmpRessource == nullptr) { - it = _object; - return; - } - } - // add at the end if no slot is free - m_resourceList.push_back(_object); -} - -// in case of error ... -void ewol::resource::Manager::cleanInternalRemoved() { - //EWOL_INFO("remove object in Manager"); - updateContext(); - for (auto it(m_resourceList.begin()); it!=m_resourceList.end(); ++it) { - if ((*it).expired() == true) { - m_resourceList.erase(it); - it = m_resourceList.begin(); - } - } -} diff --git a/ewol/resource/Manager.h b/ewol/resource/Manager.h deleted file mode 100644 index 2a8bf023..00000000 --- a/ewol/resource/Manager.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#ifndef __RESOURCES_MANAGER_H__ -#define __RESOURCES_MANAGER_H__ - -#include -#include -#include -#include -#include - -namespace ewol { - namespace resource { - class Manager{ - private: - std::list> m_resourceList; - std::vector> m_resourceListToUpdate; - bool m_contextHasBeenRemoved; - public: - /** - * @brief initialize the internal variable - */ - Manager(); - /** - * @brief Uninitiamize the resource manager, free all resources previously requested - * @note when not free == > generate warning, because the segfault can appear after... - */ - virtual ~Manager(); - /** - * @brief remove all resources (un-init) out of the destructor (due to the system implementation) - */ - void unInit(); - /** - * @brief display in the log all the resources loaded ... - */ - void display(); - /** - * @brief Reload all resources from files, and send there in openGL card if needed. - * @note If file is reference at THEME:XXX:filename if the Theme change the file will reload the newOne - */ - void reLoadResources(); - /** - * @brief Call by the system to send all the needed data on the graphic card chen they change ... - * @param[in] _object The resources that might be updated - */ - void update(const std::shared_ptr& _object); - /** - * @brief Call by the system chen the openGL Context has been unexpectially removed == > This reload all the texture, VBO and other .... - */ - void updateContext(); - /** - * @brief This is to inform the resources manager that we have no more openGl context ... - */ - void contextHasBeenDestroyed(); - public: - // internal API to extent eResources in extern Soft - std::shared_ptr localKeep(const std::string& _filename); - void localAdd(const std::shared_ptr& _object); - virtual void cleanInternalRemoved(); - }; - }; -}; - - -#endif - diff --git a/ewol/resource/Resource.cpp b/ewol/resource/Resource.cpp deleted file mode 100644 index cf1cb416..00000000 --- a/ewol/resource/Resource.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -#include -#include -#include -#include -#include -#include - -void ewol::Resource::init() { - ewol::Object::init(); -} - -void ewol::Resource::init(const std::string& _name) { - ewol::Object::init(_name); -} - -void ewol::Resource::updateContext() { - EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << shared_from_this().use_count() << " time(s)"); -} - -void ewol::Resource::removeContext() { - EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << shared_from_this().use_count() << " time(s)"); -} - -void ewol::Resource::removeContextToLate() { - EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << shared_from_this().use_count() << " time(s)"); -} - -void ewol::Resource::reload() { - EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << shared_from_this().use_count() << " time(s)"); -} - -ewol::resource::Manager& ewol::Resource::getManager() { - return ewol::getContext().getResourcesManager(); -} \ No newline at end of file diff --git a/ewol/resource/Resource.h b/ewol/resource/Resource.h deleted file mode 100644 index d35427f8..00000000 --- a/ewol/resource/Resource.h +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -#ifndef __RESOURCES_H__ -#define __RESOURCES_H__ - -#include -#include -#include -#include - -#define MAX_RESOURCE_LEVEL (5) - -#define DECLARE_RESOURCE_FACTORY(className) \ - template static std::shared_ptr create( T&& ... all ) { \ - std::shared_ptr object(new className()); \ - if (object == nullptr) { \ - EWOL_ERROR("Factory resource error"); \ - return nullptr; \ - } \ - object->init(std::forward(all)... ); \ - if (object->objectHasBeenCorectlyInit() == false) { \ - EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ - } \ - getManager().localAdd(object); \ - return object; \ - } - -#define DECLARE_RESOURCE_NAMED_FACTORY(className) \ - template static std::shared_ptr create(const std::string& _name, T&& ... all ) { \ - std::shared_ptr object; \ - std::shared_ptr object2; \ - if (_name != "" && _name != "---") { \ - object2 = getManager().localKeep(_name); \ - } \ - if (object2 != nullptr) { \ - object = std::dynamic_pointer_cast(object2); \ - if (object == nullptr) { \ - EWOL_CRITICAL("Request resource file : '" << _name << "' With the wrong type (dynamic cast error)"); \ - return nullptr; \ - } \ - } \ - if (object != nullptr) { \ - return object; \ - } \ - object = std::shared_ptr(new className()); \ - if (object == nullptr) { \ - EWOL_ERROR("allocation error of a resource : " << _name); \ - return nullptr; \ - } \ - object->init(_name, std::forward(all)... ); \ - if (object->objectHasBeenCorectlyInit() == false) { \ - EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ - } \ - getManager().localAdd(object); \ - return object; \ - } - -#define DECLARE_RESOURCE_SINGLE_FACTORY(className,uniqueName) \ - template static std::shared_ptr create(T&& ... all ) { \ - std::shared_ptr object; \ - std::shared_ptr object2 = getManager().localKeep(uniqueName); \ - if (object2 != nullptr) { \ - object = std::dynamic_pointer_cast(object2); \ - if (object == nullptr) { \ - EWOL_CRITICAL("Request resource file : '" << uniqueName << "' With the wrong type (dynamic cast error)"); \ - return nullptr; \ - } \ - } \ - if (object != nullptr) { \ - return object; \ - } \ - object = std::shared_ptr(new className()); \ - if (object == nullptr) { \ - EWOL_ERROR("allocation error of a resource : " << uniqueName); \ - return nullptr; \ - } \ - object->init(uniqueName, std::forward(all)... ); \ - if (object->objectHasBeenCorectlyInit() == false) { \ - EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ - } \ - getManager().localAdd(object); \ - return object; \ - } - -namespace ewol { - namespace resource { - class Manager; - }; - /** - * @brief A Resource is a generic interface to have an instance that have things that can be used by many people, ad have some hardware dependency. - * For example of resources : - * :** Shaders: openGL display interface. - * :** Texture: openGL imega interface. - * :** Font: Single file interface to store many glyphe ==> reduce the number of parallele loaded files. - * :** ConfigFile: simple widget configuration files - * :** ... - */ - class Resource : public ewol::Object { - protected: - /** - * @brief generic protected contructor (use factory to create this class) - */ - Resource() : - m_resourceLevel(MAX_RESOURCE_LEVEL-1) { - addObjectType("ewol::Resource"); - setStatusResource(true); - }; - /** - * @brief Initialisation of the class and previous classes. - * @param[in] _name Name of the resource. - */ - void init(); - //! @previous - void init(const std::string& _name); - public: - //! geenric destructor - virtual ~Resource() { - - }; - protected: - uint8_t m_resourceLevel; //!< Level of the resource ==> for update priority [0..5] 0 must be update first. - public: - /** - * @brief Get the current resource level; - * @return value in [0..5] - */ - uint8_t getResourceLevel() { - return m_resourceLevel; - }; - /** - * @brief Call when need to send data on the harware (openGL) - * @note This is done asynchronously with the create of the Resource. - */ - virtual void updateContext(); - /** - * @brief The current OpenGl context is removing ==> remove yout own system data - */ - virtual void removeContext(); - /** - * @brief The notification of the Context removing is too late, we have no more acces on the OpenGl context (thank you Android). - * Juste update your internal state - */ - virtual void removeContextToLate(); - /** - * @brief User request the reload of all resources (usefull when the file depend on DATA:GUI:xxx ... - */ - virtual void reload(); - protected: - /** - * @brief Get the current resource Manager - */ - static ewol::resource::Manager& getManager(); - }; -}; - -#include - -#endif - diff --git a/ewol/resource/Texture.cpp b/ewol/resource/Texture.cpp new file mode 100644 index 00000000..1a18de8f --- /dev/null +++ b/ewol/resource/Texture.cpp @@ -0,0 +1,108 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license APACHE v2.0 (see license file) + */ + +#include +#include +#include +#include +#include +#include + +#undef __class__ +#define __class__ "resource::Texture" + +/** + * @brief get the next power 2 if the input + * @param[in] value Value that we want the next power of 2 + * @return result value + */ +static int32_t nextP2(int32_t _value) { + int32_t val=1; + for (int32_t iii=1; iii<31; iii++) { + if (_value <= val) { + return val; + } + val *=2; + } + EWOL_CRITICAL("impossible CASE...."); + return val; +} + + +void ewol::resource::Texture::init(const std::string& _filename) { + gale::Resource::init(_filename); +} +void ewol::resource::Texture::init() { + gale::Resource::init(); +} + +ewol::resource::Texture::Texture() { + addResourceType("ewol::compositing::Texture"); + m_loaded = false; + m_texId = 0; + m_endPointSize.setValue(1.0,1.0); +} + +ewol::resource::Texture::~Texture() { + removeContext(); +} + +void ewol::resource::Texture::updateContext() { + if (false == m_loaded) { + // Request a new texture at openGl : + glGenTextures(1, &m_texId); + } + // in all case we set the texture properties : + // TODO : check error ??? + glBindTexture(GL_TEXTURE_2D, m_texId); + // TODO : Check error ??? + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + //--- mode nearest + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + //--- Mode linear + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + EWOL_INFO("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << " OGl_Id=" < #include -#include namespace ewol { namespace font { diff --git a/ewol/resource/font/FontBase.h b/ewol/resource/font/FontBase.h index cd237c15..6faa746d 100644 --- a/ewol/resource/font/FontBase.h +++ b/ewol/resource/font/FontBase.h @@ -14,19 +14,19 @@ #include #include #include -#include +#include #include namespace ewol { namespace resource { - class FontBase : public ewol::Resource { + class FontBase : public gale::Resource { public: FontBase() { - addObjectType("ewol::FontFreeType"); + addResourceType("ewol::FontFreeType"); } void init(const std::string& _fontName) { - ewol::Resource::init(_fontName); + gale::Resource::init(_fontName); }; virtual ~FontBase() { }; diff --git a/ewol/widget/Button.cpp b/ewol/widget/Button.cpp index d6821ce0..4c7948b3 100644 --- a/ewol/widget/Button.cpp +++ b/ewol/widget/Button.cpp @@ -101,8 +101,8 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) { if(ewol::widget::Button::lockAccess == m_lock) { return false; } - if( ewol::key::statusLeave == _event.getStatus() - || ewol::key::statusAbort == _event.getStatus()) { + if( gale::key::status_leave == _event.getStatus() + || gale::key::status_abort == _event.getStatus()) { m_mouseHover = false; m_buttonPressed = false; } else { @@ -121,19 +121,19 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) { EWOL_VERBOSE("Event on BT ... mouse hover : " << m_mouseHover); if (true == m_mouseHover) { if (1 == _event.getId()) { - if(ewol::key::statusDown == _event.getStatus()) { + if(gale::key::status_down == _event.getStatus()) { EWOL_VERBOSE(getName() << " : Generate event : " << signalDown); signalDown.emit(); m_buttonPressed = true; markToRedraw(); } - if(ewol::key::statusUp == _event.getStatus()) { + if(gale::key::status_up == _event.getStatus()) { EWOL_VERBOSE(getName() << " : Generate event : " << signalUp); signalUp.emit(); m_buttonPressed = false; markToRedraw(); } - if(ewol::key::statusSingle == _event.getStatus()) { + if(gale::key::status_single == _event.getStatus()) { if( ( m_value.get() == true && ewol::widget::Button::lockWhenPressed == m_lock) || ( m_value.get() == false @@ -165,8 +165,8 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Button::onEventEntry(const ewol::event::Entry& _event) { //EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); - if( _event.getType() == ewol::key::keyboardChar - && _event.getStatus() == ewol::key::statusDown + if( _event.getType() == gale::key::keyboard_char + && _event.getStatus() == gale::key::status_down && _event.getChar() == '\r') { signalEnter.emit(); return true; diff --git a/ewol/widget/ButtonColor.cpp b/ewol/widget/ButtonColor.cpp index d0ad664f..72271e52 100644 --- a/ewol/widget/ButtonColor.cpp +++ b/ewol/widget/ButtonColor.cpp @@ -137,7 +137,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() { bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) { bool previousHoverState = m_mouseHover; - if(ewol::key::statusLeave == _event.getStatus()) { + if(gale::key::status_leave == _event.getStatus()) { m_mouseHover = false; m_buttonPressed = false; } else { @@ -157,15 +157,15 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) { //EWOL_DEBUG("Event on BT ... mouse position : " << m_mouseHover); if (true == m_mouseHover) { if (1 == _event.getId()) { - if(ewol::key::statusDown == _event.getStatus()) { + if(gale::key::status_down == _event.getStatus()) { m_buttonPressed = true; markToRedraw(); } - if(ewol::key::statusUp == _event.getStatus()) { + if(gale::key::status_up == _event.getStatus()) { m_buttonPressed = false; markToRedraw(); } - if(ewol::key::statusSingle == _event.getStatus()) { + if(gale::key::status_single == _event.getStatus()) { m_buttonPressed = false; m_mouseHover = false; // create a context menu : diff --git a/ewol/widget/CheckBox.cpp b/ewol/widget/CheckBox.cpp index f4a191ce..11bd37ba 100644 --- a/ewol/widget/CheckBox.cpp +++ b/ewol/widget/CheckBox.cpp @@ -105,8 +105,8 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) { EWOL_VERBOSE("Event on BT : " << _event); bool previousHoverState = m_mouseHover; - if( ewol::key::statusLeave == _event.getStatus() - || ewol::key::statusAbort == _event.getStatus()) { + if( gale::key::status_leave == _event.getStatus() + || gale::key::status_abort == _event.getStatus()) { m_mouseHover = false; m_buttonPressed = false; } else { @@ -126,19 +126,19 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) { EWOL_VERBOSE("Event on BT ... mouse hover : " << m_mouseHover); if (true == m_mouseHover) { if (1 == _event.getId()) { - if(ewol::key::statusDown == _event.getStatus()) { + if(gale::key::status_down == _event.getStatus()) { EWOL_VERBOSE(getName() << " : Generate event : " << signalDown); signalDown.emit(); m_buttonPressed = true; markToRedraw(); } - if(ewol::key::statusUp == _event.getStatus()) { + if(gale::key::status_up == _event.getStatus()) { EWOL_VERBOSE(getName() << " : Generate event : " << signalUp); signalUp.emit(); m_buttonPressed = false; markToRedraw(); } - if(ewol::key::statusSingle == _event.getStatus()) { + if(gale::key::status_single == _event.getStatus()) { // inverse value : setValue((m_value)?false:true); EWOL_VERBOSE(getName() << " : Generate event : " << signalPressed); @@ -159,8 +159,8 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::CheckBox::onEventEntry(const ewol::event::Entry& _event) { //EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); - if( _event.getType() == ewol::key::keyboardChar - && _event.getStatus() == ewol::key::statusDown + if( _event.getType() == gale::key::keyboard_char + && _event.getStatus() == gale::key::status_down && _event.getChar() == '\r') { signalEnter.emit(); return true; diff --git a/ewol/widget/ColorBar.cpp b/ewol/widget/ColorBar.cpp index 4ba95fa6..69fe3989 100644 --- a/ewol/widget/ColorBar.cpp +++ b/ewol/widget/ColorBar.cpp @@ -170,8 +170,8 @@ bool ewol::widget::ColorBar::onEventInput(const ewol::event::Input& _event) { if (1 == _event.getId()) { relativePos.setValue( std::avg(0.0f, m_size.x(),relativePos.x()), std::avg(0.0f, m_size.y(),relativePos.y()) ); - if( ewol::key::statusSingle == _event.getStatus() - || ewol::key::statusMove == _event.getStatus()) { + if( gale::key::status_single == _event.getStatus() + || gale::key::status_move == _event.getStatus()) { // nothing to do ... m_currentUserPos.setValue( relativePos.x()/m_size.x(), relativePos.y()/m_size.y() ); diff --git a/ewol/widget/ContextMenu.cpp b/ewol/widget/ContextMenu.cpp index 061181a1..48c3d517 100644 --- a/ewol/widget/ContextMenu.cpp +++ b/ewol/widget/ContextMenu.cpp @@ -204,12 +204,12 @@ bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) { if (nullptr != ewol::widget::Container::getWidgetAtPos(_event.getPos())) { return false; } - if( _event.getStatus() == ewol::key::statusDown - || _event.getStatus() == ewol::key::statusMove - || _event.getStatus() == ewol::key::statusSingle - || _event.getStatus() == ewol::key::statusUp - || _event.getStatus() == ewol::key::statusEnter - || _event.getStatus() == ewol::key::statusLeave ) { + if( _event.getStatus() == gale::key::status_down + || _event.getStatus() == gale::key::status_move + || _event.getStatus() == gale::key::status_single + || _event.getStatus() == gale::key::status_up + || _event.getStatus() == gale::key::status_enter + || _event.getStatus() == gale::key::status_leave ) { // Auto-remove ... autoDestroy(); return true; diff --git a/ewol/widget/Entry.cpp b/ewol/widget/Entry.cpp index 09029652..3c575426 100644 --- a/ewol/widget/Entry.cpp +++ b/ewol/widget/Entry.cpp @@ -234,7 +234,7 @@ void ewol::widget::Entry::removeSelected() { } -void ewol::widget::Entry::copySelectionToClipBoard(enum ewol::context::clipBoard::clipboardListe _clipboardID) { +void ewol::widget::Entry::copySelectionToClipBoard(enum gale::context::clipBoard::clipboardListe _clipboardID) { if (m_displayCursorPosSelection == m_displayCursorPos) { // nothing to cut ... return; @@ -247,19 +247,19 @@ void ewol::widget::Entry::copySelectionToClipBoard(enum ewol::context::clipBoard } // Copy std::string tmpData = std::string(m_data, pos1, pos2); - ewol::context::clipBoard::set(_clipboardID, tmpData); + gale::context::clipBoard::set(_clipboardID, tmpData); } bool ewol::widget::Entry::onEventInput(const ewol::event::Input& _event) { //EWOL_DEBUG("Event on Entry ... type=" << (int32_t)type << " id=" << IdInput); if (1 == _event.getId()) { - if (ewol::key::statusSingle == _event.getStatus()) { + if (gale::key::status_single == _event.getStatus()) { keepFocus(); signalClick.emit(); //nothing to do ... return true; - } else if (ewol::key::statusDouble == _event.getStatus()) { + } else if (gale::key::status_double == _event.getStatus()) { keepFocus(); // select word m_displayCursorPosSelection = m_displayCursorPos-1; @@ -302,42 +302,42 @@ bool ewol::widget::Entry::onEventInput(const ewol::event::Input& _event) { } } // Copy to clipboard Middle ... - copySelectionToClipBoard(ewol::context::clipBoard::clipboardSelection); + copySelectionToClipBoard(gale::context::clipBoard::clipboardSelection); markToRedraw(); - } else if (ewol::key::statusTriple == _event.getStatus()) { + } else if (gale::key::status_triple == _event.getStatus()) { keepFocus(); m_displayCursorPosSelection = 0; m_displayCursorPos = m_data->size(); - } else if (ewol::key::statusDown == _event.getStatus()) { + } else if (gale::key::status_down == _event.getStatus()) { keepFocus(); updateCursorPosition(_event.getPos()); markToRedraw(); - } else if (ewol::key::statusMove == _event.getStatus()) { + } else if (gale::key::status_move == _event.getStatus()) { keepFocus(); updateCursorPosition(_event.getPos(), true); markToRedraw(); - } else if (ewol::key::statusUp == _event.getStatus()) { + } else if (gale::key::status_up == _event.getStatus()) { keepFocus(); updateCursorPosition(_event.getPos(), true); // Copy to clipboard Middle ... - copySelectionToClipBoard(ewol::context::clipBoard::clipboardSelection); + copySelectionToClipBoard(gale::context::clipBoard::clipboardSelection); markToRedraw(); } } - else if( ewol::key::typeMouse == _event.getType() + else if( gale::key::type_mouse == _event.getType() && _event.getId() == 2) { - if( _event.getStatus() == ewol::key::statusDown - || _event.getStatus() == ewol::key::statusMove - || _event.getStatus() == ewol::key::statusUp) { + if( _event.getStatus() == gale::key::status_down + || _event.getStatus() == gale::key::status_move + || _event.getStatus() == gale::key::status_up) { keepFocus(); // updatethe cursor position : updateCursorPosition(_event.getPos()); } // Paste current selection only when up button - if (_event.getStatus() == ewol::key::statusUp) { + if (_event.getStatus() == gale::key::status_up) { keepFocus(); // middle button => past data... - ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardSelection); + gale::context::clipBoard::request(gale::context::clipBoard::clipboardSelection); } } return false; @@ -345,8 +345,8 @@ bool ewol::widget::Entry::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) { - if (_event.getType() == ewol::key::keyboardChar) { - if(_event.getStatus() == ewol::key::statusDown) { + if (_event.getType() == gale::key::keyboard_char) { + if(_event.getStatus() == gale::key::status_down) { // remove curent selected data ... removeSelected(); if( _event.getChar() == '\n' @@ -387,19 +387,19 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) { } return false; } else { - if(_event.getStatus() == ewol::key::statusDown) { + if(_event.getStatus() == gale::key::status_down) { switch (_event.getType()) { - case ewol::key::keyboardLeft: + case gale::key::keyboard_left: m_displayCursorPos--; break; - case ewol::key::keyboardRight: + case gale::key::keyboard_right: m_displayCursorPos++; break; - case ewol::key::keyboardStart: + case gale::key::keyboard_start: m_displayCursorPos = 0; break; - case ewol::key::keyboardEnd: + case gale::key::keyboard_end: m_displayCursorPos = m_data->size(); break; default: @@ -437,7 +437,7 @@ void ewol::widget::Entry::setInternalValue(const std::string& _newData) { markToRedraw(); } -void ewol::widget::Entry::onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) { +void ewol::widget::Entry::onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID) { // remove curent selected data ... removeSelected(); // get current selection / Copy : @@ -469,17 +469,17 @@ void ewol::widget::Entry::onCallbackEntryClean() { } void ewol::widget::Entry::onCallbackCut() { - copySelectionToClipBoard(ewol::context::clipBoard::clipboardStd); + copySelectionToClipBoard(gale::context::clipBoard::clipboardStd); removeSelected(); signalModify.emit(m_data); } void ewol::widget::Entry::onCallbackCopy() { - copySelectionToClipBoard(ewol::context::clipBoard::clipboardStd); + copySelectionToClipBoard(gale::context::clipBoard::clipboardStd); } void ewol::widget::Entry::onCallbackPaste() { - ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd); + gale::context::clipBoard::request(gale::context::clipBoard::clipboardStd); } void ewol::widget::Entry::onCallbackSelect(bool _all) { diff --git a/ewol/widget/Entry.h b/ewol/widget/Entry.h index f5e88760..6a202396 100644 --- a/ewol/widget/Entry.h +++ b/ewol/widget/Entry.h @@ -140,7 +140,7 @@ namespace ewol { * @brief Copy the selected data on the specify clipboard * @param[in] _clipboardID Selected clipboard */ - virtual void copySelectionToClipBoard(enum ewol::context::clipBoard::clipboardListe _clipboardID); + virtual void copySelectionToClipBoard(enum gale::context::clipBoard::clipboardListe _clipboardID); /** * @brief remove the selected area * @note This request a regeneration of the display @@ -167,7 +167,7 @@ namespace ewol { virtual void onRegenerateDisplay(); virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventEntry(const ewol::event::Entry& _event); - virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID); + virtual void onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID); virtual void calculateMinMaxSize(); protected: // Derived function virtual void onDraw(); diff --git a/ewol/widget/Image.cpp b/ewol/widget/Image.cpp index 9fa8a37d..6002f696 100644 --- a/ewol/widget/Image.cpp +++ b/ewol/widget/Image.cpp @@ -34,7 +34,7 @@ ewol::widget::Image::Image() : } } -void ewol::widget::Image::init(const std::string& _file, const ewol::Dimension& _border) { +void ewol::widget::Image::init(const std::string& _file, const gale::Dimension& _border) { ewol::Widget::init(); set(_file, _border); } @@ -44,7 +44,7 @@ ewol::widget::Image::~Image() { } -void ewol::widget::Image::set(const std::string& _file, const ewol::Dimension& _border) { +void ewol::widget::Image::set(const std::string& _file, const gale::Dimension& _border) { EWOL_VERBOSE("Set Image : " << _file << " border=" << _border); m_border.set(_border); m_fileName.set(_file); @@ -132,7 +132,7 @@ void ewol::widget::Image::calculateMinMaxSize() { bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) { //EWOL_DEBUG("Event on BT ..."); if (_event.getId() == 1) { - if(ewol::key::statusSingle == _event.getStatus()) { + if(gale::key::status_single == _event.getStatus()) { signalPressed.emit(); return true; } diff --git a/ewol/widget/Image.h b/ewol/widget/Image.h index bede5c6d..7c6d8dc1 100644 --- a/ewol/widget/Image.h +++ b/ewol/widget/Image.h @@ -37,7 +37,7 @@ namespace ewol { */ Image(); void init(const std::string& _file="", - const ewol::Dimension& _border=ewol::Dimension(vec2(0,0),ewol::Dimension::Millimeter)); + const gale::Dimension& _border=gale::Dimension(vec2(0,0),gale::Dimension::Millimeter)); public: DECLARE_WIDGET_FACTORY(Image, "Image"); /** @@ -49,7 +49,7 @@ namespace ewol { * @param[in] _file Filaneme of the new image * @param[in] _border New border size to set */ - void set(const std::string& _file, const ewol::Dimension& _border); + void set(const std::string& _file, const gale::Dimension& _border); protected: ewol::parameter::Value m_fileName; //!< file name of the image. public: @@ -68,33 +68,33 @@ namespace ewol { return m_fileName; }; protected: - ewol::parameter::Value m_border; //!< border to add at the image. + ewol::parameter::Value m_border; //!< border to add at the image. public: /** * @brief set tge Border size around the image * @param[in] _border New border size to set */ - void setBorder(const ewol::Dimension& _border); + void setBorder(const gale::Dimension& _border); /** * @brief get the current border request at the image * @return the border size */ - const ewol::Dimension& getBorder() const { + const gale::Dimension& getBorder() const { return m_border; }; protected: - ewol::parameter::Value m_imageSize; //!< border to add at the image. + ewol::parameter::Value m_imageSize; //!< border to add at the image. public: /** * @brief set tge Border size around the image * @param[in] _size New border size to set */ - void setImageSize(const ewol::Dimension& _size); + void setImageSize(const gale::Dimension& _size); /** * @brief get the current border request at the image * @return the border size */ - const ewol::Dimension& getImageSize() const { + const gale::Dimension& getImageSize() const { return m_imageSize; }; protected: diff --git a/ewol/widget/Joystick.cpp b/ewol/widget/Joystick.cpp index b4be3bea..539f7f80 100644 --- a/ewol/widget/Joystick.cpp +++ b/ewol/widget/Joystick.cpp @@ -117,8 +117,8 @@ Tangent Function: tan(teta) = Opposite / Adjacent bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) { /* if (1 == IdInput) { - if( ewol::key::statusDown == typeEvent - || ewol::key::statusMove == typeEvent) { + if( gale::key::status_down == typeEvent + || gale::key::status_move == typeEvent) { // get local relative position vec2 relativePos = relativePosition(pos); float sizeElement = m_size.x*m_ratio; @@ -143,7 +143,7 @@ bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) { m_displayPos.y = sin(m_angle)*m_distance; } markToRedraw(); - if(ewol::key::statusDown == typeEvent) { + if(gale::key::status_down == typeEvent) { signalEnable.emit(); } else { std::string tmp = std::string("distance=") + std::string(m_distance) + std::string("angle=") + std::string(m_angle+M_PI/2); @@ -152,7 +152,7 @@ bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) { //teta += M_PI/2; //EWOL_DEBUG("TETA = " << (m_angle*180/M_PI) << " deg distance = " << m_distance); return true; - } else if( ewol::key::statusUp == typeEvent) { + } else if( gale::key::status_up == typeEvent) { if( true == m_lock && m_distance == 1) { // nothing to do ... diff --git a/ewol/widget/Label.cpp b/ewol/widget/Label.cpp index c118c78c..5ad82318 100644 --- a/ewol/widget/Label.cpp +++ b/ewol/widget/Label.cpp @@ -122,7 +122,7 @@ void ewol::widget::Label::onRegenerateDisplay() { bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) { //EWOL_DEBUG("Event on Label ..."); if (1 == _event.getId()) { - if (ewol::key::statusSingle == _event.getStatus()) { + if (gale::key::status_single == _event.getStatus()) { // nothing to do ... signalPressed.emit(); return true; diff --git a/ewol/widget/List.h b/ewol/widget/List.h index 067f7bd5..faffa819 100644 --- a/ewol/widget/List.h +++ b/ewol/widget/List.h @@ -68,7 +68,7 @@ namespace ewol { } return false; }; - virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) { + virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) { return false; } /** diff --git a/ewol/widget/ListFileSystem.cpp b/ewol/widget/ListFileSystem.cpp index b987d111..45f24e07 100644 --- a/ewol/widget/ListFileSystem.cpp +++ b/ewol/widget/ListFileSystem.cpp @@ -159,7 +159,7 @@ bool ewol::widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput, - enum ewol::key::status _typeEvent, + enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, @@ -172,7 +172,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput, offset = 2; } } - if (_typeEvent == ewol::key::statusSingle) { + if (_typeEvent == gale::key::status_single) { EWOL_VERBOSE("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw ); if (1 == _IdInput) { int32_t previousRaw = m_selectedLine; diff --git a/ewol/widget/ListFileSystem.h b/ewol/widget/ListFileSystem.h index f37bb22f..643e8fce 100644 --- a/ewol/widget/ListFileSystem.h +++ b/ewol/widget/ListFileSystem.h @@ -44,7 +44,7 @@ namespace ewol { virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); virtual uint32_t getNuberOfRaw(); virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); - virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); + virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); protected: std::vector m_list; //!< List of all element in the path. (they are filtered) /** diff --git a/ewol/widget/PopUp.cpp b/ewol/widget/PopUp.cpp index 8f900e96..dfde20f0 100644 --- a/ewol/widget/PopUp.cpp +++ b/ewol/widget/PopUp.cpp @@ -29,7 +29,7 @@ ewol::widget::PopUp::PopUp() : void ewol::widget::PopUp::init(const std::string& _shaperName) { ewol::widget::Container::init(); m_shaper.setString(_shaperName); - setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent)); + setMinSize(gale::Dimension(vec2(80,80),gale::Dimension::Pourcent)); m_userExpand.set(bvec2(false, false)); } ewol::widget::PopUp::~PopUp() { diff --git a/ewol/widget/Scroll.cpp b/ewol/widget/Scroll.cpp index 5edb9531..836b853a 100644 --- a/ewol/widget/Scroll.cpp +++ b/ewol/widget/Scroll.cpp @@ -20,7 +20,7 @@ ewol::widget::Scroll::Scroll() : m_highSpeedStartPos(0,0), m_highSpeedMode(speedModeDisable), m_highSpeedButton(-1), - m_highSpeedType(ewol::key::typeUnknow) { + m_highSpeedType(gale::key::type_unknow) { addObjectType("ewol::widget::Scroll"); } @@ -113,7 +113,7 @@ void ewol::widget::Scroll::onRegenerateDisplay() { bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { //ewol::event::Input _event = event; - //_event.setType(ewol::key::typeFinger); + //_event.setType(gale::key::type_finger); vec2 relativePos = relativePosition(_event.getPos()); vec2 scrollOffset(0,0); vec2 scrollSize(0,0); @@ -123,17 +123,17 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { } EWOL_VERBOSE("Get Event on scroll : " << _event); relativePos.setY(m_size.y() - relativePos.y()); - if( _event.getType() == ewol::key::typeMouse - && ( ewol::key::typeUnknow == m_highSpeedType - || ewol::key::typeMouse == m_highSpeedType ) ) { + if( _event.getType() == gale::key::type_mouse + && ( gale::key::type_unknow == m_highSpeedType + || gale::key::type_mouse == m_highSpeedType ) ) { if( _event.getId() == 1 - && _event.getStatus() == ewol::key::statusDown) { + && _event.getStatus() == gale::key::status_down) { // check if selected the scrolling position whth the scrolling bar ... if (relativePos.x() >= (m_size.x()-SCROLL_BAR_SPACE)) { if( m_size.y() < scrollSize.y() || scrollOffset.y() != 0) { m_highSpeedMode = speedModeEnableVertical; - m_highSpeedType = ewol::key::typeMouse; + m_highSpeedType = gale::key::type_mouse; m_highSpeedStartPos.setX(relativePos.x()); m_highSpeedStartPos.setY(scrollOffset.y() / scrollSize.y() * (m_size.y()-SCROLL_BAR_SPACE*2)); m_highSpeedButton = 1; @@ -150,7 +150,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { if( m_size.x() < scrollSize.x() || scrollOffset.x()!=0) { m_highSpeedMode = speedModeEnableHorizontal; - m_highSpeedType = ewol::key::typeMouse; + m_highSpeedType = gale::key::type_mouse; m_highSpeedStartPos.setX(scrollOffset.x() / scrollSize.x() * (m_size.x()-SCROLL_BAR_SPACE*2)); m_highSpeedStartPos.setY(relativePos.y()); m_highSpeedButton = 1; @@ -166,7 +166,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { } return false; } else if( _event.getId() == 4 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { if(m_size.y() < scrollSize.y()) { scrollOffset.setY(scrollOffset.y()-m_pixelScrolling); scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y()))); @@ -177,7 +177,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } } else if( _event.getId() == 5 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { if(m_size.y() < scrollSize.y()) { scrollOffset.setY(scrollOffset.y()+m_pixelScrolling); scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->y()))); @@ -188,28 +188,28 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } }else if (_event.getId() == 2) { - if (_event.getStatus() == ewol::key::statusDown) { + if (_event.getStatus() == gale::key::status_down) { m_highSpeedMode = speedModeInit; - m_highSpeedType = ewol::key::typeMouse; + m_highSpeedType = gale::key::type_mouse; m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y()); m_highSpeedButton = 2; // not really use... == > just keep some informations return false; } } else if( m_highSpeedMode != speedModeDisable - && _event.getStatus() == ewol::key::statusLeave) { + && _event.getStatus() == gale::key::status_leave) { m_highSpeedMode = speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; markToRedraw(); return true; } if ( _event.getId() == m_highSpeedButton && m_highSpeedMode != speedModeDisable) { - if (_event.getStatus() == ewol::key::statusUp) { + if (_event.getStatus() == gale::key::status_up) { if (m_highSpeedMode == speedModeInit) { // TODO : generate back the down event ... m_highSpeedMode = speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; return false; } else { m_highSpeedMode = speedModeGrepEndEvent; @@ -217,15 +217,15 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } } else if (m_highSpeedMode == speedModeGrepEndEvent) { - if (_event.getStatus() == ewol::key::statusSingle) { + if (_event.getStatus() == gale::key::status_single) { m_highSpeedMode = speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; m_highSpeedButton = -1; markToRedraw(); } return true; } else if( m_highSpeedMode == speedModeInit - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { // wait that the cursor move more than 10 px to enable it : if( abs(relativePos.x() - m_highSpeedStartPos.x()) > 10 || abs(relativePos.y() - m_highSpeedStartPos.y()) > 10 ) { @@ -257,7 +257,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } if( m_highSpeedMode == speedModeEnableHorizontal - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { scrollOffset.setX((int32_t)(scrollSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2))); scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*m_limit->x() ))); markToRedraw(); @@ -267,7 +267,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } if( m_highSpeedMode == speedModeEnableVertical - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { scrollOffset.setY((int32_t)(scrollSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2))); scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*m_limit->x()))); markToRedraw(); @@ -277,25 +277,25 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } } - } else if( ewol::key::typeFinger == _event.getType() - && ( ewol::key::typeUnknow == m_highSpeedType - || ewol::key::typeFinger == m_highSpeedType ) ) { + } else if( gale::key::type_finger == _event.getType() + && ( gale::key::type_unknow == m_highSpeedType + || gale::key::type_finger == m_highSpeedType ) ) { if (1 == _event.getId()) { EWOL_VERBOSE("event: " << _event); - if (ewol::key::statusDown == _event.getStatus()) { + if (gale::key::status_down == _event.getStatus()) { m_highSpeedMode = speedModeInit; - m_highSpeedType = ewol::key::typeFinger; + m_highSpeedType = gale::key::type_finger; m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y()); EWOL_VERBOSE("SCROOL == > INIT pos=" << m_highSpeedStartPos << " && curent scrollOffset=" << scrollOffset); return true; - } else if (ewol::key::statusUpAfter == _event.getStatus()) { + } else if (gale::key::status_upAfter == _event.getStatus()) { m_highSpeedMode = speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; EWOL_VERBOSE("SCROOL == > DISABLE"); markToRedraw(); return true; } else if ( m_highSpeedMode == speedModeInit - && ewol::key::statusMove == _event.getStatus()) { + && gale::key::status_move == _event.getStatus()) { // wait that the cursor move more than 10 px to enable it : if( abs(relativePos.x() - m_highSpeedStartPos.x()) > 10 || abs(relativePos.y() - m_highSpeedStartPos.y()) > 10 ) { @@ -308,7 +308,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } if ( m_highSpeedMode == speedModeEnableFinger - && ewol::key::statusMove == _event.getStatus()) { + && gale::key::status_move == _event.getStatus()) { EWOL_VERBOSE("SCROOL == > INIT scrollOffset=" << scrollOffset.y() << " relativePos=" << relativePos.y() << " m_highSpeedStartPos=" << m_highSpeedStartPos.y()); //scrollOffset.x = (int32_t)(scrollSize.x * x / m_size.x); if (m_limit->x() != 0.0f) { @@ -332,9 +332,9 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { return true; } } else if ( m_highSpeedMode != speedModeDisable - && ewol::key::statusLeave == _event.getStatus()) { + && gale::key::status_leave == _event.getStatus()) { m_highSpeedMode = speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; EWOL_VERBOSE("SCROOL == > DISABLE"); markToRedraw(); return true; diff --git a/ewol/widget/Scroll.h b/ewol/widget/Scroll.h index 5b0c471f..5940b5af 100644 --- a/ewol/widget/Scroll.h +++ b/ewol/widget/Scroll.h @@ -38,7 +38,7 @@ namespace ewol { vec2 m_highSpeedStartPos; enum highSpeedMode m_highSpeedMode; int32_t m_highSpeedButton; - enum ewol::key::type m_highSpeedType; + enum gale::key::type m_highSpeedType; protected: Scroll(); void init(const std::string& _shaperName="THEME:GUI:WidgetScrolled.json"); diff --git a/ewol/widget/Sizer.h b/ewol/widget/Sizer.h index 46968f41..81c12374 100644 --- a/ewol/widget/Sizer.h +++ b/ewol/widget/Sizer.h @@ -60,20 +60,20 @@ namespace ewol { return m_mode; } private: - ewol::parameter::Value m_borderSize; //!< Border size needed for all the display + ewol::parameter::Value m_borderSize; //!< Border size needed for all the display public: /** * @brief set the current border size of the current element: * @param[in] _newBorderSize The border size to set (0 if not used) */ - void setBorderSize(const ewol::Dimension& _newBorderSize) { + void setBorderSize(const gale::Dimension& _newBorderSize) { m_borderSize.set(_newBorderSize); } /** * @brief get the current border size of the current element: * @return the border size (0 if not used) */ - const ewol::Dimension& getBorderSize() const { + const gale::Dimension& getBorderSize() const { return m_borderSize; }; public: diff --git a/ewol/widget/Slider.cpp b/ewol/widget/Slider.cpp index 1e6e47ad..f10e3701 100644 --- a/ewol/widget/Slider.cpp +++ b/ewol/widget/Slider.cpp @@ -77,8 +77,8 @@ bool ewol::widget::Slider::onEventInput(const ewol::event::Input& _event) { vec2 relativePos = relativePosition(_event.getPos()); //EWOL_DEBUG("Event on Slider ..." << _event); if (1 == _event.getId()) { - if( ewol::key::statusSingle == _event.getStatus() - || ewol::key::statusMove == _event.getStatus()) { + if( gale::key::status_single == _event.getStatus() + || gale::key::status_move == _event.getStatus()) { // get the new position : EWOL_VERBOSE("Event on Slider (" << relativePos.x() << "," << relativePos.y() << ")"); float oldValue = m_value.get(); diff --git a/ewol/widget/Spacer.cpp b/ewol/widget/Spacer.cpp index fb43fe42..a472f2aa 100644 --- a/ewol/widget/Spacer.cpp +++ b/ewol/widget/Spacer.cpp @@ -17,7 +17,7 @@ ewol::widget::Spacer::Spacer() : m_color(*this, "color", etk::color::none, "background of the spacer") { addObjectType("ewol::widget::Spacer"); - m_userMinSize = ewol::Dimension(vec2(10,10)); + m_userMinSize = gale::Dimension(vec2(10,10)); setCanHaveFocus(false); } diff --git a/ewol/widget/Widget.cpp b/ewol/widget/Widget.cpp index 13dadfaa..d5ed4e6c 100644 --- a/ewol/widget/Widget.cpp +++ b/ewol/widget/Widget.cpp @@ -10,7 +10,8 @@ #include #include #include -#include +#include +#include #include #undef __class__ @@ -93,8 +94,8 @@ ewol::Widget::Widget() : m_offset(0,0), m_zoom(1.0f), m_origin(0,0), - m_userMinSize(*this, "min-size", ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel), "User minimum size"), - m_userMaxSize(*this, "max-size", ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel), "User maximum size"), + m_userMinSize(*this, "min-size", gale::Dimension(vec2(0,0),gale::Dimension::Pixel), "User minimum size"), + m_userMaxSize(*this, "max-size", gale::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),gale::Dimension::Pixel), "User maximum size"), m_userExpand(*this, "expand", bvec2(false,false), "Request the widget Expand size wile space is available"), m_userFill(*this, "fill", bvec2(false,false), "Fill the widget available size"), m_hide(*this, "hide", false, "The widget start hided"), @@ -106,7 +107,7 @@ ewol::Widget::Widget() : signalShortcut(*this, "shortcut"), m_needRegenerateDisplay(true), m_grabCursor(false), - m_cursorDisplay(ewol::context::cursorArrow), + m_cursorDisplay(gale::context::cursor_arrow), signalAnnimationStart(*this, "annimation-start"), signalAnnimationRatio(*this, "annimation-ratio"), signalAnnimationStop(*this, "annimation-stop"), @@ -379,7 +380,7 @@ vec2 ewol::Widget::getCalculateMaxSize() { } void ewol::Widget::setNoMinSize() { - m_userMinSize.set(ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel)); + m_userMinSize.set(gale::Dimension(vec2(0,0),gale::Dimension::Pixel)); } void ewol::Widget::checkMinSize() { @@ -389,7 +390,7 @@ void ewol::Widget::checkMinSize() { } void ewol::Widget::setNoMaxSize() { - m_userMaxSize.set(ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel)); + m_userMaxSize.set(gale::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),gale::Dimension::Pixel)); } void ewol::Widget::checkMaxSize() { @@ -450,59 +451,59 @@ void ewol::Widget::shortCutAdd(const std::string& _descriptiveString, const std: tmpElement->specialKey.setMeta(true); } if(_descriptiveString.find("F12") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF12; + tmpElement->keyboardMoveValue = gale::key::keyboard_f12; } else if(_descriptiveString.find("F11") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF11; + tmpElement->keyboardMoveValue = gale::key::keyboard_f11; } else if(_descriptiveString.find("F10") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF10; + tmpElement->keyboardMoveValue = gale::key::keyboard_f10; } else if(_descriptiveString.find("F9") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF9; + tmpElement->keyboardMoveValue = gale::key::keyboard_f9; } else if(_descriptiveString.find("F8") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF8; + tmpElement->keyboardMoveValue = gale::key::keyboard_f8; } else if(_descriptiveString.find("F7") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF7; + tmpElement->keyboardMoveValue = gale::key::keyboard_f7; } else if(_descriptiveString.find("F6") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF6; + tmpElement->keyboardMoveValue = gale::key::keyboard_f6; } else if(_descriptiveString.find("F5") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF5; + tmpElement->keyboardMoveValue = gale::key::keyboard_f5; } else if(_descriptiveString.find("F4") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF4; + tmpElement->keyboardMoveValue = gale::key::keyboard_f4; } else if(_descriptiveString.find("F3") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF3; + tmpElement->keyboardMoveValue = gale::key::keyboard_f3; } else if(_descriptiveString.find("F2") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF2; + tmpElement->keyboardMoveValue = gale::key::keyboard_f2; } else if(_descriptiveString.find("F1") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardF1; + tmpElement->keyboardMoveValue = gale::key::keyboard_f1; } else if(_descriptiveString.find("LEFT") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardLeft; + tmpElement->keyboardMoveValue = gale::key::keyboard_left; } else if(_descriptiveString.find("RIGHT") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardRight; + tmpElement->keyboardMoveValue = gale::key::keyboard_right; } else if(_descriptiveString.find("UP") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardUp; + tmpElement->keyboardMoveValue = gale::key::keyboard_up; } else if(_descriptiveString.find("DOWN") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardDown; + tmpElement->keyboardMoveValue = gale::key::keyboard_down; } else if(_descriptiveString.find("PAGE_UP") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardPageUp; + tmpElement->keyboardMoveValue = gale::key::keyboard_pageUp; } else if(_descriptiveString.find("PAGE_DOWN") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardPageDown; + tmpElement->keyboardMoveValue = gale::key::keyboard_pageDown; } else if(_descriptiveString.find("START") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardStart; + tmpElement->keyboardMoveValue = gale::key::keyboard_start; } else if(_descriptiveString.find("END") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardEnd; + tmpElement->keyboardMoveValue = gale::key::keyboard_end; } else if(_descriptiveString.find("PRINT") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardPrint; + tmpElement->keyboardMoveValue = gale::key::keyboard_print; } else if(_descriptiveString.find("ARRET_DEFIL") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardStopDefil; + tmpElement->keyboardMoveValue = gale::key::keyboard_stopDefil; } else if(_descriptiveString.find("WAIT") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardWait; + tmpElement->keyboardMoveValue = gale::key::keyboard_wait; } else if(_descriptiveString.find("INSERT") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardInsert; + tmpElement->keyboardMoveValue = gale::key::keyboard_insert; } else if(_descriptiveString.find("CAPLOCK") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardCapLock; + tmpElement->keyboardMoveValue = gale::key::keyboard_capLock; } else if(_descriptiveString.find("CONTEXT_MENU") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardContextMenu; + tmpElement->keyboardMoveValue = gale::key::keyboard_contextMenu; } else if(_descriptiveString.find("NUM_LOCK") != std::string::npos) { - tmpElement->keyboardMoveValue = ewol::key::keyboardNumLock; + tmpElement->keyboardMoveValue = gale::key::keyboard_numLock; } else { tmpElement->unicodeValue = _descriptiveString[_descriptiveString.size() -1]; } @@ -533,9 +534,9 @@ void ewol::Widget::shortCutClean() { m_localShortcut.clear(); } -bool ewol::Widget::onEventShortCut(ewol::key::Special& _special, +bool ewol::Widget::onEventShortCut(gale::key::Special& _special, char32_t _unicodeValue, - enum ewol::key::keyboard _kbMove, + enum gale::key::keyboard _kbMove, bool _isDown) { if (_unicodeValue >= 'A' && _unicodeValue <= 'Z') { _unicodeValue += 'a' - 'A'; @@ -547,7 +548,7 @@ bool ewol::Widget::onEventShortCut(ewol::key::Special& _special, && m_localShortcut[iii]->specialKey.getCtrl() == _special.getCtrl() && m_localShortcut[iii]->specialKey.getAlt() == _special.getAlt() && m_localShortcut[iii]->specialKey.getMeta() == _special.getMeta() - && ( ( m_localShortcut[iii]->keyboardMoveValue == ewol::key::keyboardUnknow + && ( ( m_localShortcut[iii]->keyboardMoveValue == gale::key::keyboard_unknow && m_localShortcut[iii]->unicodeValue == _unicodeValue) || ( m_localShortcut[iii]->keyboardMoveValue == _kbMove && m_localShortcut[iii]->unicodeValue == 0) @@ -581,13 +582,13 @@ bool ewol::Widget::getGrabStatus() { return m_grabCursor; } -void ewol::Widget::setCursor(enum ewol::context::cursorDisplay _newCursor) { +void ewol::Widget::setCursor(enum gale::context::cursor _newCursor) { EWOL_DEBUG("Change Cursor in " << _newCursor); m_cursorDisplay = _newCursor; getContext().setCursor(m_cursorDisplay); } -enum ewol::context::cursorDisplay ewol::Widget::getCursor() { +enum gale::context::cursor ewol::Widget::getCursor() { return m_cursorDisplay; } @@ -647,7 +648,7 @@ void ewol::Widget::onParameterChangeValue(const ewol::parameter::Ref& _paramPoin } if (error == true) { EWOL_ERROR("Can not set a 'min size' > 'max size' reset to maximum ..."); - m_userMaxSize = ewol::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),ewol::Dimension::Pixel); + m_userMaxSize = gale::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),gale::Dimension::Pixel); } requestUpdateSize(); } else if (_paramPointer == m_userMinSize) { @@ -663,9 +664,9 @@ void ewol::Widget::onParameterChangeValue(const ewol::parameter::Ref& _paramPoin } if (error == true) { EWOL_ERROR("Can not set a 'min size' > 'max size' set nothing ..."); - m_userMinSize = ewol::Dimension(vec2(0,0),ewol::Dimension::Pixel); + m_userMinSize = gale::Dimension(vec2(0,0),gale::Dimension::Pixel); } - requestUpdateSize(); + // TODO : requestUpdateSize(); } else if (_paramPointer == m_annimationTypeStart) { } else if (_paramPointer == m_annimationTimeStart) { @@ -678,7 +679,7 @@ void ewol::Widget::onParameterChangeValue(const ewol::parameter::Ref& _paramPoin } void ewol::Widget::requestUpdateSize() { - getContext().requestUpdateSize(); + // TODO : getContext().requestUpdateSize(); } ewol::widget::Manager& ewol::Widget::getWidgetManager() { diff --git a/ewol/widget/Widget.h b/ewol/widget/Widget.h index 4fdb79aa..b88c342d 100644 --- a/ewol/widget/Widget.h +++ b/ewol/widget/Widget.h @@ -15,7 +15,8 @@ #include #include -#include +#include +#include namespace ewol { class Widget; @@ -24,9 +25,9 @@ namespace ewol { class Windows; }; }; -#include -#include -#include +#include +#include +#include #include #include #include @@ -101,13 +102,13 @@ namespace ewol { class EventShortCut { public: std::string message; //!< data link with the event - ewol::key::Special specialKey; //!< special board key + gale::key::Special specialKey; //!< special board key char32_t unicodeValue; //!< 0 if not used - enum ewol::key::keyboard keyboardMoveValue; //!< ewol::EVENT_KB_MOVE_TYPE_NONE if not used + enum gale::key::keyboard keyboardMoveValue; //!< ewol::EVENT_KB_MOVE_TYPE_NONE if not used EventShortCut() { message = ""; unicodeValue = 0; - keyboardMoveValue = ewol::key::keyboardUnknow; + keyboardMoveValue = gale::key::keyboard_unknow; }; virtual ~EventShortCut() { }; }; @@ -228,13 +229,13 @@ namespace ewol { */ virtual vec2 getOrigin(); protected: - ewol::parameter::Value m_userMinSize; //!< user define the minimum size of the widget + ewol::parameter::Value m_userMinSize; //!< user define the minimum size of the widget public: /** * @brief User set the minimum size he want to set the display * @param[in] _size set minimum size (none : 0) */ - void setMinSize(const ewol::Dimension& _size) { + void setMinSize(const gale::Dimension& _size) { m_userMinSize.set(_size); } /** @@ -245,7 +246,7 @@ namespace ewol { * @brief get the current calculated min size * @return the size requested */ - const ewol::Dimension& getMinSize() { + const gale::Dimension& getMinSize() { return m_userMinSize.get(); }; /** @@ -255,13 +256,13 @@ namespace ewol { */ virtual void checkMinSize(); protected: - ewol::parameter::Value m_userMaxSize; //!< user define the maximum size of the widget + ewol::parameter::Value m_userMaxSize; //!< user define the maximum size of the widget public: /** * @brief User set the maximum size he want to set the display * @param[in] _size The new maximum size requested (vec2(0,0) to unset) */ - void setMaxSize(const ewol::Dimension& _size) { + void setMaxSize(const gale::Dimension& _size) { m_userMaxSize.set(_size); } /** @@ -272,7 +273,7 @@ namespace ewol { * @brief get the current maximum size * @return the size requested */ - const ewol::Dimension& getMaxSize() { + const gale::Dimension& getMaxSize() { return m_userMaxSize.get(); }; /** @@ -552,7 +553,7 @@ namespace ewol { * @note : need to have focus ... * @param[in] mode Mode of data requested */ - virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) { }; + virtual void onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID) { }; // ---------------------------------------------------------------------------------------------------------------- // -- Shortcut : management of the shortcut @@ -588,9 +589,9 @@ namespace ewol { * @return false if the event has not been used. * @note To prevent some error when you get an event get it if it is down and Up ... == > like this it could not generate some ununderstanding error. */ - virtual bool onEventShortCut(ewol::key::Special& _special, + virtual bool onEventShortCut(gale::key::Special& _special, char32_t _unicodeValue, - enum ewol::key::keyboard _kbMove, + enum gale::key::keyboard _kbMove, bool _isDown); // ---------------------------------------------------------------------------------------------------------------- // -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... @@ -650,18 +651,18 @@ namespace ewol { */ virtual bool getGrabStatus(); private: - enum ewol::context::cursorDisplay m_cursorDisplay; + enum gale::context::cursor m_cursorDisplay; public: /** * @brief set the cursor display type. * @param[in] _newCursor selected new cursor. */ - virtual void setCursor(enum ewol::context::cursorDisplay _newCursor); + virtual void setCursor(enum gale::context::cursor _newCursor); /** * @brief get the currrent cursor. * @return the type of the cursor. */ - virtual enum ewol::context::cursorDisplay getCursor(); + virtual enum gale::context::cursor getCursor(); public: // Derived function virtual bool loadXML(const std::shared_ptr& _node); protected: // Derived function diff --git a/ewol/widget/WidgetScrolled.cpp b/ewol/widget/WidgetScrolled.cpp index 5b272da2..8865e150 100644 --- a/ewol/widget/WidgetScrolled.cpp +++ b/ewol/widget/WidgetScrolled.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include @@ -24,7 +24,7 @@ ewol::widget::WidgetScrolled::WidgetScrolled() : m_pixelScrolling = 20; m_highSpeedMode = ewol::widget::Scroll::speedModeDisable; m_scroollingMode = scroolModeNormal; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; m_highSpeedButton = -1; m_limitScrolling = 0.5; @@ -87,17 +87,17 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event ewol::Padding paddingV = m_shaperV.getPadding(); ewol::Padding paddingH = m_shaperH.getPadding(); if (m_scroollingMode == scroolModeNormal) { - if ( _event.getType() == ewol::key::typeMouse - && ( m_highSpeedType == ewol::key::typeUnknow - || m_highSpeedType == ewol::key::typeMouse) ) { + if ( _event.getType() == gale::key::type_mouse + && ( m_highSpeedType == gale::key::type_unknow + || m_highSpeedType == gale::key::type_mouse) ) { if ( _event.getId() == 1 - && _event.getStatus() == ewol::key::statusDown) { + && _event.getStatus() == gale::key::status_down) { // check if selected the scrolling position whth the scrolling bar ... if (relativePos.x() >= (m_size.x()-paddingV.x())) { if( m_size.y() < m_maxSize.y() || m_originScrooled.y() != 0) { m_highSpeedMode = ewol::widget::Scroll::speedModeEnableVertical; - m_highSpeedType = ewol::key::typeMouse; + m_highSpeedType = gale::key::type_mouse; m_highSpeedStartPos.setX(relativePos.x()); m_highSpeedStartPos.setY(m_originScrooled.y() / m_maxSize.y() * (m_size.y()-paddingV.yButtom()*2)); m_highSpeedButton = 1; @@ -111,7 +111,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event if( m_size.x() < m_maxSize.x() || m_originScrooled.x()!=0) { m_highSpeedMode = ewol::widget::Scroll::speedModeEnableHorizontal; - m_highSpeedType = ewol::key::typeMouse; + m_highSpeedType = gale::key::type_mouse; m_highSpeedStartPos.setX(m_originScrooled.x() / m_maxSize.x() * (m_size.x()-paddingH.xLeft()*2)); m_highSpeedStartPos.setY(relativePos.y()); m_highSpeedButton = 1; @@ -124,7 +124,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event } return false; } else if ( _event.getId() == 4 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { if (true == _event.getSpecialKey().getCtrl()) { changeZoom(1); /* @@ -143,7 +143,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event } } } else if ( _event.getId() == 5 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { if (true == _event.getSpecialKey().getCtrl()) { changeZoom(-1); /* @@ -162,7 +162,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event } } } else if ( _event.getId() == 11 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { // Scrool Left if(m_size.x() < m_maxSize.x() || m_originScrooled.x()!=0 @@ -173,7 +173,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event return true; } } else if ( _event.getId() == 10 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { // Scrool Right if(m_size.x() < m_maxSize.x() || m_originScrooled.x()!=0 @@ -186,44 +186,44 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event }else if (_event.getId() == 2) { /* if (true == ewol::isSetCtrl()) { - if (ewol::key::statusDown == typeEvent) { + if (gale::key::status_down == typeEvent) { float zoom = 1.0; setZoom(zoom); } } else */{ - if (_event.getStatus() == ewol::key::statusDown) { + if (_event.getStatus() == gale::key::status_down) { m_highSpeedMode = ewol::widget::Scroll::speedModeInit; - m_highSpeedType = ewol::key::typeMouse; + m_highSpeedType = gale::key::type_mouse; m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y()); m_highSpeedButton = 2; return true; } } } else if ( m_highSpeedMode != ewol::widget::Scroll::speedModeDisable - && _event.getStatus() == ewol::key::statusLeave) { + && _event.getStatus() == gale::key::status_leave) { m_highSpeedMode = ewol::widget::Scroll::speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; markToRedraw(); return true; } if ( _event.getId() == m_highSpeedButton && m_highSpeedMode != ewol::widget::Scroll::speedModeDisable) { - if (_event.getStatus() == ewol::key::statusUpAfter) { + if (_event.getStatus() == gale::key::status_upAfter) { m_highSpeedMode = ewol::widget::Scroll::speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; return false; } else if (m_highSpeedMode == ewol::widget::Scroll::speedModeGrepEndEvent) { - if (_event.getStatus() == ewol::key::statusSingle) { + if (_event.getStatus() == gale::key::status_single) { m_highSpeedMode = ewol::widget::Scroll::speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; m_highSpeedButton = -1; markToRedraw(); } return true; - } else if (_event.getStatus() == ewol::key::statusUp) { + } else if (_event.getStatus() == gale::key::status_up) { return true; } else if ( m_highSpeedMode == ewol::widget::Scroll::speedModeInit - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { // wait that the cursor move more than 10 px to enable it : if( abs(relativePos.x() - m_highSpeedStartPos.x()) > 10 || abs(relativePos.y() - m_highSpeedStartPos.y()) > 10 ) { @@ -252,23 +252,23 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event return true; } if ( m_highSpeedMode == ewol::widget::Scroll::speedModeEnableHorizontal - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { m_originScrooled.setX((int32_t)(m_maxSize.x() * (relativePos.x()-paddingH.xLeft()) / (m_size.x()-paddingH.x()))); m_originScrooled.setX(std::avg(0.0f, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling))); markToRedraw(); return true; } if ( m_highSpeedMode == ewol::widget::Scroll::speedModeEnableVertical - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { m_originScrooled.setY((int32_t)(m_maxSize.y() * (relativePos.y()-paddingV.yButtom()) / (m_size.y()-paddingV.y()))); m_originScrooled.setY(std::avg(0.0f, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling))); markToRedraw(); return true; } } - } else if ( _event.getType() == ewol::key::typeFinger - && ( m_highSpeedType == ewol::key::typeUnknow - || m_highSpeedType == ewol::key::typeFinger) ) { + } else if ( _event.getType() == gale::key::type_finger + && ( m_highSpeedType == gale::key::type_unknow + || m_highSpeedType == gale::key::type_finger) ) { if (m_singleFingerMode == false) { // *********************** // ** Two finger mode : ** @@ -277,9 +277,9 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event return false; } int32_t idTable = _event.getId()-1; - if (_event.getStatus() == ewol::key::statusDown) { + if (_event.getStatus() == gale::key::status_down) { m_fingerPresent[idTable] = true; - } else if (_event.getStatus() == ewol::key::statusUpAfter) { + } else if (_event.getStatus() == gale::key::status_upAfter) { m_fingerPresent[idTable] = false; } if (m_fingerScoolActivated == false) { @@ -294,7 +294,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event if (m_fingerScoolActivated == true) { // 1: scroll... // 2: remove all unneeded sub event ... ==> maybe a better methode ... - if (_event.getStatus() == ewol::key::statusMove) { + if (_event.getStatus() == gale::key::status_move) { m_originScrooled.setX(m_originScrooled.x() - (relativePos.x() - m_fingerMoveStartPos[idTable].x())*0.5f); m_originScrooled.setY(m_originScrooled.y() - (relativePos.y() - m_fingerMoveStartPos[idTable].y())*0.5f); m_originScrooled.setX(std::avg(0.0f, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling))); @@ -305,7 +305,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event } if ( m_fingerPresent[0] == false && m_fingerPresent[1] == false) { - if (_event.getStatus() == ewol::key::statusUpAfter) { + if (_event.getStatus() == gale::key::status_upAfter) { // TODO : Reset event ... m_fingerScoolActivated = false; _event.reset(); @@ -319,20 +319,20 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event // ************************** if (_event.getId() == 1) { EWOL_VERBOSE("event 1 " << _event); - if (_event.getStatus() == ewol::key::statusDown) { + if (_event.getStatus() == gale::key::status_down) { m_highSpeedMode = ewol::widget::Scroll::speedModeInit; - m_highSpeedType = ewol::key::typeFinger; + m_highSpeedType = gale::key::type_finger; m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y()); EWOL_VERBOSE("SCROOL == > INIT"); return true; - } else if (_event.getStatus() == ewol::key::statusUpAfter) { + } else if (_event.getStatus() == gale::key::status_upAfter) { m_highSpeedMode = ewol::widget::Scroll::speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; EWOL_VERBOSE("SCROOL == > DISABLE"); markToRedraw(); return true; } else if ( m_highSpeedMode == ewol::widget::Scroll::speedModeInit - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { // wait that the cursor move more than 10 px to enable it : if( abs(relativePos.x() - m_highSpeedStartPos.x()) > 10 || abs(relativePos.y() - m_highSpeedStartPos.y()) > 10 ) { @@ -344,7 +344,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event } return true; } if ( m_highSpeedMode == ewol::widget::Scroll::speedModeEnableFinger - && _event.getStatus() == ewol::key::statusMove) { + && _event.getStatus() == gale::key::status_move) { //m_originScrooled.x = (int32_t)(m_maxSize.x * x / m_size.x); m_originScrooled.setX(m_originScrooled.x() - (relativePos.x() - m_highSpeedStartPos.x())); m_originScrooled.setY(m_originScrooled.y() - (relativePos.y() - m_highSpeedStartPos.y())); @@ -356,9 +356,9 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event return true; } } else if ( m_highSpeedMode == ewol::widget::Scroll::speedModeDisable - && _event.getStatus() == ewol::key::statusLeave) { + && _event.getStatus() == gale::key::status_leave) { m_highSpeedMode = ewol::widget::Scroll::speedModeDisable; - m_highSpeedType = ewol::key::typeUnknow; + m_highSpeedType = gale::key::type_unknow; EWOL_VERBOSE("SCROOL == > DISABLE"); markToRedraw(); return true; @@ -366,13 +366,13 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event } } } else if (m_scroollingMode == scroolModeCenter) { - if (_event.getType() == ewol::key::typeMouse) { + if (_event.getType() == gale::key::type_mouse) { float tmp1=m_size.x() / m_maxSize.y(); float tmp2=m_size.y() / m_maxSize.x(); //EWOL_INFO(" elements Zoom : " << tmp1 << " " << tmp2); tmp1 = std::min(tmp1, tmp2); if ( _event.getId() == 4 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { m_zoom -= 0.1; if (tmp1 < 1.0) { m_zoom = std::max(tmp1, m_zoom); @@ -382,7 +382,7 @@ bool ewol::widget::WidgetScrolled::onEventInput(const ewol::event::Input& _event markToRedraw(); return true; } else if ( _event.getId() == 5 - && _event.getStatus() == ewol::key::statusUp) { + && _event.getStatus() == gale::key::status_up) { m_zoom += 0.1; if (tmp1 > 1.0) { m_zoom = std::min(tmp1, m_zoom); @@ -411,10 +411,7 @@ void ewol::widget::WidgetScrolled::systemDraw(const ewol::DrawProperty& _display gale::openGL::push(); if (m_scroollingMode == scroolModeCenter) { // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left - glViewport( m_origin.x(), - m_origin.y(), - m_size.x(), - m_size.y()); + gale::openGL::setViewPort(m_origin, m_size); mat4 tmpProjection = etk::matOrtho(-m_size.x()/2, m_size.x()/2, -m_size.y()/2, m_size.y()/2, -1, 1); mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1.0) ); mat4 tmpTranslate = etk::matTranslate(vec3(-m_maxSize.x()/2, -m_maxSize.y()/2, -1.0) ); @@ -425,11 +422,7 @@ void ewol::widget::WidgetScrolled::systemDraw(const ewol::DrawProperty& _display onDraw(); } if (m_scroollingMode == scroolModeGame) { // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left - glViewport( m_origin.x(), - m_origin.y(), - m_size.x(), - m_size.y()); - + gale::openGL::setViewPort(m_origin, m_size); mat4 tmpProjection = etk::matOrtho(-m_size.x()/2, m_size.x()/2, -m_size.y()/2, m_size.y()/2, -1, 1); mat4 tmpTranslate = etk::matTranslate(vec3( -m_maxSize.x()/2, -m_maxSize.y()/2, -1.0) ); mat4 tmpMat = tmpProjection * tmpTranslate; diff --git a/ewol/widget/WidgetScrolled.h b/ewol/widget/WidgetScrolled.h index 2c0fd09d..e13c3b96 100644 --- a/ewol/widget/WidgetScrolled.h +++ b/ewol/widget/WidgetScrolled.h @@ -42,7 +42,7 @@ namespace ewol { vec2 m_highSpeedStartPos; enum Scroll::highSpeedMode m_highSpeedMode; int32_t m_highSpeedButton; - enum ewol::key::type m_highSpeedType; + enum gale::key::type m_highSpeedType; private: // finger section: bool m_singleFingerMode; //!< in many case the moving in a subwidget is done with one finger, it is enought ==> the user select... public: diff --git a/ewol/widget/Windows.cpp b/ewol/widget/Windows.cpp index 3cc49c36..4e97c312 100644 --- a/ewol/widget/Windows.cpp +++ b/ewol/widget/Windows.cpp @@ -9,7 +9,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -72,22 +73,21 @@ std::shared_ptr ewol::widget::Windows::getWidgetAtPos(const vec2& } void ewol::widget::Windows::sysDraw() { - //EWOL_DEBUG("Drow on (" << m_size.x << "," << m_size.y << ")"); + //EWOL_DEBUG("Drow on " << m_size); // set the size of the open GL system - glViewport(0,0,m_size.x(),m_size.y()); - - gale::openGL::disable(gale::openGL::FLAG_DITHER); - //gale::openGL::disable(gale::openGL::FLAG_BLEND); - gale::openGL::disable(gale::openGL::FLAG_STENCIL_TEST); - gale::openGL::disable(gale::openGL::FLAG_ALPHA_TEST); - gale::openGL::disable(gale::openGL::FLAG_FOG); + gale::openGL::setViewPort(vec2(0,0), m_size); + gale::openGL::disable(gale::openGL::flag_dither); + //gale::openGL::disable(gale::openGL::flag_blend); + gale::openGL::disable(gale::openGL::flag_stencilTest); + gale::openGL::disable(gale::openGL::flag_alphaTest); + gale::openGL::disable(gale::openGL::flag_fog); #if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__IOs)) glPixelZoom(1.0,1.0); #endif - gale::openGL::disable(gale::openGL::FLAG_TEXTURE_2D); - gale::openGL::disable(gale::openGL::FLAG_DEPTH_TEST); + gale::openGL::disable(gale::openGL::flag_texture2D); + gale::openGL::disable(gale::openGL::flag_depthTest); - gale::openGL::enable(gale::openGL::FLAG_BLEND); + gale::openGL::enable(gale::openGL::flag_blend); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // clear the matrix system : @@ -99,7 +99,7 @@ void ewol::widget::Windows::sysDraw() { displayProp.m_origin.setValue(0,0); displayProp.m_size = m_size; systemDraw(displayProp); - gale::openGL::disable(gale::openGL::FLAG_BLEND); + gale::openGL::disable(gale::openGL::flag_blend); return; } diff --git a/ewol/widget/Windows.h b/ewol/widget/Windows.h index 37a34cbd..a56f0bc0 100644 --- a/ewol/widget/Windows.h +++ b/ewol/widget/Windows.h @@ -126,10 +126,11 @@ namespace ewol { createPopUpMessage(messageTypeCritical, _message); } - - virtual bool onEventHardwareInput(const ewol::key::keyboardSystem& _event, bool _down) { + /* TODO : + virtual bool onEventHardwareInput(const gale::key::keyboardSystem& _event, bool _down) { return false; }; + */ }; }; }; diff --git a/ewol/widget/meta/Parameter.cpp b/ewol/widget/meta/Parameter.cpp index 2be06985..f88add33 100644 --- a/ewol/widget/meta/Parameter.cpp +++ b/ewol/widget/meta/Parameter.cpp @@ -36,9 +36,9 @@ void ewol::widget::Parameter::init() { std::shared_ptr mySizerHori = nullptr; std::shared_ptr mySpacer = nullptr; #ifdef __TARGET_OS__Android - setMinSize(ewol::Dimension(vec2(90, 90), ewol::Dimension::Pourcent)); + setMinSize(gale::Dimension(vec2(90, 90), gale::Dimension::Pourcent)); #else - setMinSize(ewol::Dimension(vec2(80, 80), ewol::Dimension::Pourcent)); + setMinSize(gale::Dimension(vec2(80, 80), gale::Dimension::Pourcent)); #endif mySizerVert = ewol::widget::Sizer::create(widget::Sizer::modeVert); @@ -85,7 +85,7 @@ void ewol::widget::Parameter::init() { EWOL_ERROR("Can not allocate widget == > display might be in error"); } else { mySpacer->setExpand(bvec2(false,false)); - mySpacer->setMinSize(ewol::Dimension(vec2(10,0))); + mySpacer->setMinSize(gale::Dimension(vec2(10,0))); mySizerHori->subWidgetAdd(mySpacer); } diff --git a/ewol/widget/meta/ParameterList.cpp b/ewol/widget/meta/ParameterList.cpp index 4d3cd2c3..901ba662 100644 --- a/ewol/widget/meta/ParameterList.cpp +++ b/ewol/widget/meta/ParameterList.cpp @@ -174,7 +174,7 @@ bool ewol::widget::ParameterList::onEventInput(const ewol::event::Input& _event) // nothing to do ... done on upper widet ... return true; } - if (_event.getId() == 1 && _event.getStatus() == ewol::key::statusSingle) { + if (_event.getId() == 1 && _event.getStatus() == gale::key::status_single) { vec2 relativePos = relativePosition(_event.getPos()); // corection for the openGl abstraction relativePos.setY(m_size.y() - relativePos.y()); diff --git a/ewol/widget/meta/StdPopUp.cpp b/ewol/widget/meta/StdPopUp.cpp index f607c43b..43929ed8 100644 --- a/ewol/widget/meta/StdPopUp.cpp +++ b/ewol/widget/meta/StdPopUp.cpp @@ -21,7 +21,7 @@ ewol::widget::StdPopUp::StdPopUp() : m_comment(nullptr), m_subBar(nullptr) { addObjectType("ewol::widget::StdPopUp"); - setMinSize(ewol::Dimension(vec2(20,10),ewol::Dimension::Pourcent)); + setMinSize(gale::Dimension(vec2(20,10),gale::Dimension::Pourcent)); } void ewol::widget::StdPopUp::init() { @@ -44,12 +44,12 @@ void ewol::widget::StdPopUp::init() { mySpacer = ewol::widget::Spacer::create(); mySpacer->setExpand(bvec2(true,false)); mySpacer->setColor(etk::Color<>(0x88, 0x88, 0x88, 0xFF)); - mySpacer->setMinSize(ewol::Dimension(vec2(0,3),ewol::Dimension::Pixel)); + mySpacer->setMinSize(gale::Dimension(vec2(0,3),gale::Dimension::Pixel)); mySizerVert->subWidgetAdd(mySpacer); mySpacer = ewol::widget::Spacer::create(); mySpacer->setExpand(bvec2(true,false)); - mySpacer->setMinSize(ewol::Dimension(vec2(0,5),ewol::Dimension::Pixel)); + mySpacer->setMinSize(gale::Dimension(vec2(0,5),gale::Dimension::Pixel)); mySizerVert->subWidgetAdd(mySpacer); m_comment = ewol::widget::Label::create("No Label"); @@ -58,13 +58,13 @@ void ewol::widget::StdPopUp::init() { mySpacer = ewol::widget::Spacer::create(); mySpacer->setExpand(bvec2(true,false)); - mySpacer->setMinSize(ewol::Dimension(vec2(0,5),ewol::Dimension::Pixel)); + mySpacer->setMinSize(gale::Dimension(vec2(0,5),gale::Dimension::Pixel)); mySizerVert->subWidgetAdd(mySpacer); mySpacer = ewol::widget::Spacer::create(); mySpacer->setExpand(bvec2(true,false)); mySpacer->setColor(etk::Color<>(0x88, 0x88, 0x88, 0xFF)); - mySpacer->setMinSize(ewol::Dimension(vec2(0,3),ewol::Dimension::Pixel)); + mySpacer->setMinSize(gale::Dimension(vec2(0,3),gale::Dimension::Pixel)); mySizerVert->subWidgetAdd(mySpacer); m_title = ewol::widget::Label::create("Message"); diff --git a/lutin_ewol.py b/lutin_ewol.py index 3ac7e616..da26ab98 100644 --- a/lutin_ewol.py +++ b/lutin_ewol.py @@ -26,7 +26,6 @@ def create(target): 'ewol/ewol.cpp', 'ewol/debug.cpp', 'ewol/Padding.cpp', - 'ewol/Dimension.cpp', 'ewol/translate.cpp' ]) @@ -45,11 +44,8 @@ def create(target): # context : myModule.add_src_file([ - 'ewol/context/clipBoard.cpp', - 'ewol/context/commandLine.cpp', 'ewol/context/ConfigFont.cpp', 'ewol/context/Context.cpp', - 'ewol/context/cursor.cpp', 'ewol/context/InputManager.cpp' ]) @@ -60,14 +56,6 @@ def create(target): 'ewol/event/Input.cpp' ]) - # Key properties : - myModule.add_src_file([ - 'ewol/key/keyboard.cpp', - 'ewol/key/Special.cpp', - 'ewol/key/status.cpp', - 'ewol/key/type.cpp' - ]) - # object : myModule.add_src_file([ 'ewol/object/Manager.cpp', @@ -85,11 +73,6 @@ def create(target): 'ewol/signal/Base.cpp' ]) - # OpenGL interface : - myModule.add_src_file([ - 'ewol/openGL/openGL.cpp' - ]) - # resources : myModule.add_src_file([ 'ewol/resource/Colored3DObject.cpp', @@ -98,8 +81,7 @@ def create(target): 'ewol/resource/FontFreeType.cpp', 'ewol/resource/Image.cpp', 'ewol/resource/ImageDF.cpp', - 'ewol/resource/Manager.cpp', - 'ewol/resource/Resource.cpp', + 'ewol/resource/Texture.cpp', 'ewol/resource/TexturedFont.cpp', 'ewol/resource/DistanceFieldFont.cpp' ]) diff --git a/sample/001_HelloWord/appl/Main.cpp b/sample/001_HelloWord/appl/Main.cpp index 49b711c8..cad4b1ae 100644 --- a/sample/001_HelloWord/appl/Main.cpp +++ b/sample/001_HelloWord/appl/Main.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/sample/001_HelloWord/appl/Windows.cpp b/sample/001_HelloWord/appl/Windows.cpp index 5d35ce31..16d06399 100644 --- a/sample/001_HelloWord/appl/Windows.cpp +++ b/sample/001_HelloWord/appl/Windows.cpp @@ -18,6 +18,7 @@ appl::Windows::Windows() { addObjectType("appl::Windows"); } void appl::Windows::init() { + ewol::widget::Windows::init(); setTitle("example 001_HelloWord"); std::shared_ptr tmpWidget = ewol::widget::Label::create(); if (tmpWidget == nullptr) {