First port of edn on the android platform ==> can do nothing but not crach every 10 second
This commit is contained in:
parent
ee80871434
commit
102e11b74a
19
AndroidManifest.xml
Normal file
19
AndroidManifest.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.heeroyui.ednpackage"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
<application android:label="Edn">
|
||||||
|
<!--android:hasCode="false"-->
|
||||||
|
<!-- classpath-->
|
||||||
|
<activity android:name=".edn"
|
||||||
|
android:label="Edn Text-Editor"
|
||||||
|
android:icon="@drawable/ic_luncher_edn">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
<uses-sdk android:minSdkVersion="4" />
|
||||||
|
</manifest>
|
2
Application.mk
Normal file
2
Application.mk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
APP_BUILD_SCRIPT=$PROJECT/Sources/Android.mk
|
||||||
|
|
85
build.xml
Normal file
85
build.xml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="edn" default="help">
|
||||||
|
|
||||||
|
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||||
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
|
Version Control Systems. -->
|
||||||
|
<loadproperties srcFile="local.properties" />
|
||||||
|
|
||||||
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
|
'android' tool to add properties to it.
|
||||||
|
This is the place to change some Ant specific build properties.
|
||||||
|
Here are some properties you may want to change/update:
|
||||||
|
|
||||||
|
source.dir
|
||||||
|
The name of the source directory. Default is 'src'.
|
||||||
|
out.dir
|
||||||
|
The name of the output directory. Default is 'bin'.
|
||||||
|
|
||||||
|
For other overridable properties, look at the beginning of the rules
|
||||||
|
files in the SDK, at tools/ant/build.xml
|
||||||
|
|
||||||
|
Properties related to the SDK location or the project target should
|
||||||
|
be updated using the 'android' tool with the 'update' action.
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<property file="ant.properties" />
|
||||||
|
|
||||||
|
<!-- The project.properties file is created and updated by the 'android'
|
||||||
|
tool, as well as ADT.
|
||||||
|
|
||||||
|
This contains project specific properties such as project target, and library
|
||||||
|
dependencies. Lower level build properties are stored in ant.properties
|
||||||
|
(or in .classpath for Eclipse projects).
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems. -->
|
||||||
|
<loadproperties srcFile="project.properties" />
|
||||||
|
|
||||||
|
<!-- quick check on sdk.dir -->
|
||||||
|
<fail
|
||||||
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||||
|
unless="sdk.dir"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||||
|
in between standard targets -->
|
||||||
|
<!--
|
||||||
|
<target name="-pre-build">
|
||||||
|
</target>
|
||||||
|
<target name="-pre-compile">
|
||||||
|
</target>
|
||||||
|
|
||||||
|
/* This is typically used for code obfuscation.
|
||||||
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
|
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||||
|
<target name="-post-compile">
|
||||||
|
</target>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
|
To customize existing targets, there are two options:
|
||||||
|
- Customize only one target:
|
||||||
|
- copy/paste the target into this file, *before* the
|
||||||
|
<import> task.
|
||||||
|
- customize it to your needs.
|
||||||
|
- Customize the whole content of build.xml
|
||||||
|
- copy/paste the content of the rules files (minus the top node)
|
||||||
|
into this file, replacing the <import> task.
|
||||||
|
- customize to your needs.
|
||||||
|
|
||||||
|
***********************
|
||||||
|
****** IMPORTANT ******
|
||||||
|
***********************
|
||||||
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||||
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
|
-->
|
||||||
|
<!-- version-tag: 1 -->
|
||||||
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
|
</project>
|
@ -2,19 +2,22 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE := ednpackage
|
|
||||||
LOCAL_STATIC_LIBRARIES := ewol
|
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
|
||||||
|
LOCAL_MODULE := ednpackage
|
||||||
|
LOCAL_STATIC_LIBRARIES := ewol etk tinyxml libzip libpng
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(addprefix $(LOCAL_PATH)/, $(sort $(dir $(FILE_LIST))))
|
||||||
|
|
||||||
LOCAL_SRC_FILES := ewolAndroidAbstraction.cpp \
|
LOCAL_SRC_FILES := ewolAndroidAbstraction.cpp \
|
||||||
$(FILE_LIST)
|
$(FILE_LIST)
|
||||||
|
|
||||||
LOCAL_LDLIBS := -llog -landroid
|
LOCAL_LDLIBS := -llog -landroid
|
||||||
|
|
||||||
|
LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \
|
||||||
|
-DEDN_DEBUG_LEVEL=3
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
|
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
|
||||||
|
@ -6,15 +6,17 @@ include $(CLEAR_VARS)
|
|||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
|
||||||
LOCAL_MODULE := ednn
|
LOCAL_MODULE := ednn
|
||||||
LOCAL_STATIC_LIBRARIES := ewol etk tinyxml libzip libpng
|
LOCAL_STATIC_LIBRARIES := ewol etk tinyxml libzip libpng libfreetype
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := -I$(LOCAL_PATH) $(addprefix -I$(LOCAL_PATH)/, $(sort $(dir $(FILE_LIST))))
|
LOCAL_C_INCLUDES := -I$(LOCAL_PATH) $(addprefix -I$(LOCAL_PATH)/, $(sort $(dir $(FILE_LIST))))
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(FILE_LIST)
|
LOCAL_SRC_FILES := $(FILE_LIST)
|
||||||
|
|
||||||
|
|
||||||
LOCAL_LDLIBS :=
|
LOCAL_LDLIBS :=
|
||||||
|
|
||||||
LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \
|
LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \
|
||||||
-DEDN_DEBUG_LEVEL=3
|
-DEDN_DEBUG_LEVEL=3
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
|
@ -307,7 +307,6 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
|
|
||||||
int32_t fontId = ewol::GetDefaultFontId();
|
int32_t fontId = ewol::GetDefaultFontId();
|
||||||
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
||||||
int32_t spaceWidth = ewol::GetWidth(fontId, " ");
|
|
||||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||||
|
|
||||||
// update the number of element that can be displayed
|
// update the number of element that can be displayed
|
||||||
@ -345,12 +344,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
|
|
||||||
int mylen = m_EdnBuf.Size();
|
int mylen = m_EdnBuf.Size();
|
||||||
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
|
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
|
||||||
uint32_t xx = 0;
|
|
||||||
int32_t idX = 0;
|
int32_t idX = 0;
|
||||||
|
|
||||||
color_ts bgColor;
|
OOColored->SetColor(myColorManager->Get(COLOR_CODE_BASIC_BG));
|
||||||
color_ts & tmpppppp = myColorManager->Get(COLOR_CODE_BASIC_BG);
|
|
||||||
OOColored->SetColor(tmpppppp);
|
|
||||||
OOColored->Rectangle( 0, 0, sizeX, sizeY);
|
OOColored->Rectangle( 0, 0, sizeX, sizeY);
|
||||||
|
|
||||||
int displayLines = 0;
|
int displayLines = 0;
|
||||||
@ -433,7 +429,6 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
pixelX += drawSize;
|
pixelX += drawSize;
|
||||||
// move to next line ...
|
// move to next line ...
|
||||||
if (currentChar=='\n') {
|
if (currentChar=='\n') {
|
||||||
xx = 0;
|
|
||||||
idX =0;
|
idX =0;
|
||||||
pixelX = x_base;
|
pixelX = x_base;
|
||||||
y += letterHeight;
|
y += letterHeight;
|
||||||
|
@ -99,7 +99,6 @@ class BufferText : public Buffer {
|
|||||||
// internal function
|
// internal function
|
||||||
void BasicInit(void);
|
void BasicInit(void);
|
||||||
void UpdateWindowsPosition(bool centerPage = false);
|
void UpdateWindowsPosition(bool centerPage = false);
|
||||||
void displayLineNumber(DrawerManager &drawer);
|
|
||||||
|
|
||||||
void CleanSelectLine(void);
|
void CleanSelectLine(void);
|
||||||
|
|
||||||
|
@ -95,7 +95,33 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
|
|||||||
// allocate the document in the stack
|
// allocate the document in the stack
|
||||||
TiXmlDocument XmlDocument;
|
TiXmlDocument XmlDocument;
|
||||||
// open the curent File
|
// open the curent File
|
||||||
XmlDocument.LoadFile(xmlFilename);
|
etk::File fileName(xmlFilename, etk::FILE_TYPE_DATA);
|
||||||
|
if (false == fileName.Exist()) {
|
||||||
|
EWOL_ERROR("File Does not exist : " << fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int32_t fileSize = fileName.Size();
|
||||||
|
if (0==fileSize) {
|
||||||
|
EWOL_ERROR("This file is empty : " << fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (false == fileName.fOpenRead()) {
|
||||||
|
EWOL_ERROR("Can not open the file : " << fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// allocate data
|
||||||
|
char * fileBuffer = new char[fileSize];
|
||||||
|
if (NULL == fileBuffer) {
|
||||||
|
EWOL_ERROR("Error Memory allocation size=" << fileSize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// load data from the file :
|
||||||
|
fileName.fRead(fileBuffer, 1, fileSize);
|
||||||
|
// close the file:
|
||||||
|
fileName.fClose();
|
||||||
|
// load the XML from the memory
|
||||||
|
XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
|
||||||
|
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" );
|
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" );
|
||||||
if (NULL == root ) {
|
if (NULL == root ) {
|
||||||
EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\"");
|
EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\"");
|
||||||
@ -234,6 +260,9 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
|
|||||||
pNode = pNode->NextSibling();
|
pNode = pNode->NextSibling();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (NULL != fileBuffer) {
|
||||||
|
delete[] fileBuffer;
|
||||||
|
}
|
||||||
SendMessage(EDN_MSG__COLOR_HAS_CHANGE);
|
SendMessage(EDN_MSG__COLOR_HAS_CHANGE);
|
||||||
SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
|
SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ void HighlightManager::loadLanguages(void)
|
|||||||
#else
|
#else
|
||||||
homedir = "./data/";
|
homedir = "./data/";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
etk::String xmlFilename = homedir;
|
etk::String xmlFilename = homedir;
|
||||||
xmlFilename += "lang_c.xml";
|
xmlFilename += "lang_c.xml";
|
||||||
Highlight *myHightline = new Highlight(xmlFilename);
|
Highlight *myHightline = new Highlight(xmlFilename);
|
||||||
@ -138,7 +138,7 @@ void HighlightManager::loadLanguages(void)
|
|||||||
xmlFilename += "lang_java.xml";
|
xmlFilename += "lang_java.xml";
|
||||||
myHightline = new Highlight(xmlFilename);
|
myHightline = new Highlight(xmlFilename);
|
||||||
listHighlight.PushBack(myHightline);
|
listHighlight.PushBack(myHightline);
|
||||||
|
*/
|
||||||
//myHightline->Display();
|
//myHightline->Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ void APP_Init(int argc, char *argv[])
|
|||||||
|
|
||||||
ewol::SetFontFolder("Font");
|
ewol::SetFontFolder("Font");
|
||||||
#ifdef EWOL_USE_FREE_TYPE
|
#ifdef EWOL_USE_FREE_TYPE
|
||||||
//ewol::SetDefaultFont("freefont/FreeMono.ttf", 12);
|
ewol::SetDefaultFont("freefont/FreeMono.ttf", 12);
|
||||||
//ewol::SetDefaultFont("freefont/FreeMonoBold.ttf", 12);
|
//ewol::SetDefaultFont("freefont/FreeMonoBold.ttf", 12);
|
||||||
ewol::SetDefaultFont("ACharmingFont.ttf", 45);
|
//ewol::SetDefaultFont("ACharmingFont.ttf", 45);
|
||||||
//ewol::SetDefaultFont("Monospace/Monospace", 40);
|
//ewol::SetDefaultFont("Monospace/Monospace", 40);
|
||||||
//ewol::SetDefaultFont("unispace.ttf", 12);
|
//ewol::SetDefaultFont("unispace.ttf", 12);
|
||||||
#else
|
#else
|
||||||
@ -84,7 +84,6 @@ void APP_Init(int argc, char *argv[])
|
|||||||
// init internal global value
|
// init internal global value
|
||||||
globals::init();
|
globals::init();
|
||||||
ClipBoard::Init();
|
ClipBoard::Init();
|
||||||
Display::Init();
|
|
||||||
|
|
||||||
|
|
||||||
// init ALL Singleton :
|
// init ALL Singleton :
|
||||||
@ -105,7 +104,7 @@ void APP_Init(int argc, char *argv[])
|
|||||||
homedir = "./data/";
|
homedir = "./data/";
|
||||||
#endif
|
#endif
|
||||||
//homedir += "color_black.xml";
|
//homedir += "color_black.xml";
|
||||||
homedir += "color_white.xml";
|
homedir = "color_white.xml";
|
||||||
myColorManager->LoadFile( homedir.c_str() );
|
myColorManager->LoadFile( homedir.c_str() );
|
||||||
myColorManager->DisplayListOfColor();
|
myColorManager->DisplayListOfColor();
|
||||||
|
|
||||||
@ -138,6 +137,7 @@ void APP_Init(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
etk::File myfile((char *)"licence.txt", etk::FILE_TYPE_DIRECT);
|
etk::File myfile((char *)"licence.txt", etk::FILE_TYPE_DIRECT);
|
||||||
if (false == myBufferManager->Exist(myfile) ) {
|
if (false == myBufferManager->Exist(myfile) ) {
|
||||||
@ -145,6 +145,7 @@ void APP_Init(int argc, char *argv[])
|
|||||||
MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idBuffOpened);
|
MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idBuffOpened);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (NULL == basicWindows) {
|
if (NULL == basicWindows) {
|
||||||
EDN_ERROR("Can not allocate the basic windows");
|
EDN_ERROR("Can not allocate the basic windows");
|
||||||
ewol::Stop();
|
ewol::Stop();
|
||||||
@ -171,8 +172,6 @@ void APP_UnInit(void)
|
|||||||
//Search::kill();
|
//Search::kill();
|
||||||
EDN_INFO("Stop Accel key");
|
EDN_INFO("Stop Accel key");
|
||||||
//AccelKey::kill();
|
//AccelKey::kill();
|
||||||
EDN_INFO("Stop Display");
|
|
||||||
Display::UnInit();
|
|
||||||
if (NULL != basicWindows) {
|
if (NULL != basicWindows) {
|
||||||
delete(basicWindows);
|
delete(basicWindows);
|
||||||
}
|
}
|
||||||
|
@ -26,82 +26,10 @@
|
|||||||
#include <tools_debug.h>
|
#include <tools_debug.h>
|
||||||
#include <tools_globals.h>
|
#include <tools_globals.h>
|
||||||
#include <Display.h>
|
#include <Display.h>
|
||||||
#include <ColorizeManager.h>
|
|
||||||
#include <etk/String.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Display"
|
#define __class__ "Display"
|
||||||
|
|
||||||
|
|
||||||
#define FONT_BOLD_NO (0)
|
|
||||||
#define FONT_BOLD_YES (1)
|
|
||||||
#define FONT_ITALIC_NO (0)
|
|
||||||
#define FONT_ITALIC_YES (1)
|
|
||||||
|
|
||||||
|
|
||||||
// Variables privé du namespace
|
|
||||||
#define POLICE_NAME "Monospace"
|
|
||||||
/*
|
|
||||||
#ifdef USE_GTK_VERSION_3_0
|
|
||||||
#define POLICE_SIZE 15
|
|
||||||
static int32_t m_pangoFontWidth = 9;
|
|
||||||
static int32_t m_pangoFontHeight = 19;
|
|
||||||
#elif USE_GTK_VERSION_2_0
|
|
||||||
*/
|
|
||||||
#define POLICE_SIZE 12
|
|
||||||
static int32_t m_pangoFontWidth = 7;
|
|
||||||
static int32_t m_pangoFontHeight = 15;
|
|
||||||
//#endif
|
|
||||||
/*
|
|
||||||
#define POLICE_SIZE 11
|
|
||||||
static int32_t m_pangoFontWidth = 7;
|
|
||||||
static int32_t m_pangoFontHeight = 11;
|
|
||||||
static cairo_font_face_t * m_cairoFont[2][2] = {{NULL, NULL},{ NULL, NULL}};
|
|
||||||
*/
|
|
||||||
//static cairo_font_face_t * m_cairoFont[2][2] = {{NULL, NULL},{ NULL, NULL}};
|
|
||||||
|
|
||||||
|
|
||||||
void Display::Init(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
|
||||||
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
|
|
||||||
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
|
|
||||||
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
|
|
||||||
if ( NULL == m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]) {
|
|
||||||
EDN_ASSERT(FALSE, "basic font ERROR");
|
|
||||||
}
|
|
||||||
if ( NULL == m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO]) {
|
|
||||||
EDN_ERROR("Italic font error ... link with basic font");
|
|
||||||
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO] = m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO];
|
|
||||||
}
|
|
||||||
if ( NULL == m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES]) {
|
|
||||||
EDN_ERROR("Bold font error ... link with basic font");
|
|
||||||
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES] = m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO];
|
|
||||||
}
|
|
||||||
if ( NULL == m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES]) {
|
|
||||||
EDN_ERROR("Italic & Bold font error ... link with basic font");
|
|
||||||
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES] = m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Display::UnInit(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
// clean the builder...
|
|
||||||
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]);
|
|
||||||
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO]);
|
|
||||||
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES]);
|
|
||||||
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES]);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t Display::GetFontHeight(void)
|
int32_t Display::GetFontHeight(void)
|
||||||
{
|
{
|
||||||
int32_t fontId = ewol::GetDefaultFontId();
|
int32_t fontId = ewol::GetDefaultFontId();
|
||||||
@ -114,540 +42,3 @@ int32_t Display::GetFontWidth(void)
|
|||||||
return ewol::GetWidth(fontId, "A");
|
return ewol::GetWidth(fontId, "A");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void * Display::GetFont(bool bold, bool italic)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if( false == bold
|
|
||||||
&& false == italic) {
|
|
||||||
return m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO];
|
|
||||||
} else if( true == bold
|
|
||||||
&& false == italic) {
|
|
||||||
return m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES];
|
|
||||||
} else if ( false == bold
|
|
||||||
&& true == italic) {
|
|
||||||
return m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO];
|
|
||||||
}
|
|
||||||
return m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES];
|
|
||||||
*/
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "DrawerManager"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DrawerManager constructor : generate a memoryDC where we can draw everything...
|
|
||||||
*
|
|
||||||
* @param [in] window Current windows where the memoryDC must be paint
|
|
||||||
* @param [in] x Current width of the Display
|
|
||||||
* @param [in] y Current Height of the Display
|
|
||||||
*
|
|
||||||
* @note : No exeption
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
DrawerManager::DrawerManager(void * widget, int32_t x, int32_t y)
|
|
||||||
{
|
|
||||||
|
|
||||||
m_size.x = x;
|
|
||||||
m_size.y = y;
|
|
||||||
m_haveWork = false;
|
|
||||||
m_nbElement = 0;
|
|
||||||
// Create the Cairo Element
|
|
||||||
/*
|
|
||||||
# if USE_GTK_VERSION_3_0
|
|
||||||
m_cairo = gdk_cairo_create(gtk_widget_get_window(widget));
|
|
||||||
# elif USE_GTK_VERSION_2_0
|
|
||||||
m_cairo = gdk_cairo_create(widget->window);
|
|
||||||
# endif
|
|
||||||
//cairo_translate(m_cairo, 0, 7);
|
|
||||||
cairo_set_source_rgb(m_cairo, 0, 0, 0);
|
|
||||||
cairo_paint(m_cairo);
|
|
||||||
cairo_set_font_size(m_cairo, POLICE_SIZE);
|
|
||||||
*/
|
|
||||||
m_dataToDisplay[0] = '\0';
|
|
||||||
|
|
||||||
//cairo_scale(m_cairo, 1.0, 1.0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief main DrawerManager destructor : Copy data on the curent screen
|
|
||||||
*
|
|
||||||
* @param ---
|
|
||||||
*
|
|
||||||
* @note : No exeption
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
DrawerManager::~DrawerManager()
|
|
||||||
{
|
|
||||||
//cairo_destroy(m_cairo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Draw Text with the specify color
|
|
||||||
*
|
|
||||||
* This function does not display the text directly, it save it while a flush appare or the y position differ, or the color differ.
|
|
||||||
* This is for the char by char writing ==> more efficient when we write multiple char.
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display data
|
|
||||||
* @param [in] x Horizontal position to display data
|
|
||||||
* @param [in] y Vertical position to display data
|
|
||||||
* @param [in] myText Text to write in UTF8 ...
|
|
||||||
* @param [in] displayBG unused
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::Text(Colorize *SelectColor, int32_t x, int32_t y,const char *myUTF8Text, int32_t len)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
EDN_CHECK_INOUT(NULL!=SelectColor);
|
|
||||||
// check if flush is needed :
|
|
||||||
if (true == m_haveWork) {
|
|
||||||
if( m_pos.y != y
|
|
||||||
|| m_selectColor != SelectColor)
|
|
||||||
{
|
|
||||||
Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check change
|
|
||||||
if (false == m_haveWork) {
|
|
||||||
m_pos.x = x;
|
|
||||||
m_pos.y = y;
|
|
||||||
m_selectColor = SelectColor;
|
|
||||||
}
|
|
||||||
//EDN_WARNING("add data : \"" << myText << "\" x=" << x << " y=" << y );
|
|
||||||
// process :
|
|
||||||
m_haveWork = true;
|
|
||||||
strcat(m_dataToDisplay, myUTF8Text);
|
|
||||||
if (len != -1 ) {
|
|
||||||
m_nbElement+=len;
|
|
||||||
} else {
|
|
||||||
m_nbElement+=strUtf8Len(myUTF8Text);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawerManager::Text(color_ts & SelectColorFg, color_ts & SelectColorBg, int32_t x, int32_t y,const char *myText)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Flush();
|
|
||||||
cairo_set_font_face(m_cairo, Display::GetFont(false, false));
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
DirectRectangle(SelectColorBg, x, y, letterWidth*strlen(myText), letterHeight);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
cairo_move_to(m_cairo, x, y+letterHeight-4);
|
|
||||||
cairo_set_source_rgb(m_cairo, SelectColorFg.red, SelectColorFg.green, SelectColorFg.blue);
|
|
||||||
cairo_show_text(m_cairo, myText);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawerManager::Text(color_ts & SelectColorFg, int32_t x, int32_t y,const char *myText)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Flush();
|
|
||||||
cairo_set_font_face(m_cairo, Display::GetFont(false, false));
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
cairo_move_to(m_cairo, x, y+letterHeight-4);
|
|
||||||
cairo_set_source_rgb(m_cairo, SelectColorFg.red, SelectColorFg.green, SelectColorFg.blue);
|
|
||||||
cairo_show_text(m_cairo, myText);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawerManager::SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32_t nbChar)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Flush();
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
DirectRectangle(SelectColor, x, y, letterWidth*nbChar, letterHeight);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Force de display of the curent Text
|
|
||||||
*
|
|
||||||
* The flush is to be more performent with the Pango display methode...
|
|
||||||
*
|
|
||||||
* @param ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::Flush(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (true == m_haveWork) {
|
|
||||||
//EDN_WARNING("flush : \"" << m_dataToDisplay << "\"" << " bold=" << m_selectColor->GetBold() << " italic=" << m_selectColor->GetItalic());
|
|
||||||
m_haveWork = false;
|
|
||||||
|
|
||||||
cairo_set_font_face(m_cairo, Display::GetFont(m_selectColor->GetBold(), m_selectColor->GetItalic()));
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
if (true == m_selectColor->HaveBg() ) {
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
int32_t stringLen = m_nbElement;
|
|
||||||
// generate Clean BG:
|
|
||||||
DirectRectangle(m_selectColor, m_pos.x, m_pos.y, letterWidth*stringLen, letterHeight);
|
|
||||||
}
|
|
||||||
cairo_move_to(m_cairo, m_pos.x, m_pos.y+letterHeight-4);
|
|
||||||
m_selectColor->ApplyFG(m_cairo);
|
|
||||||
cairo_show_text(m_cairo, m_dataToDisplay);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
|
|
||||||
m_dataToDisplay[0] = '\0';
|
|
||||||
m_nbElement = 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief display a rectangle with the curent bgColor and no border
|
|
||||||
*
|
|
||||||
* This function in the open API to drow the rectangle, it flush the curent Text in the buffer
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display rectangle
|
|
||||||
* @param [in] x Horizontal position to display rectangle
|
|
||||||
* @param [in] y Vertical position to display rectangle
|
|
||||||
* @param [in] width Width of the rectangle
|
|
||||||
* @param [in] height Height of the rectangle
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height)
|
|
||||||
{
|
|
||||||
//Flush();
|
|
||||||
//DirectRectangle(SelectColor, x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Real function to display the rectangle (no flush done (expectially for the Background display)
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display rectangle
|
|
||||||
* @param [in] x Horizontal position to display rectangle
|
|
||||||
* @param [in] y Vertical position to display rectangle
|
|
||||||
* @param [in] width Width of the rectangle
|
|
||||||
* @param [in] height Height of the rectangle
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
EDN_CHECK_INOUT(NULL!=SelectColor);
|
|
||||||
//EDN_INFO("x="<< x <<" y="<< y <<" width="<< width <<" height="<< height);
|
|
||||||
//gdk_draw_rectangle( p_pixmap, SelectColor->GetColorBG(), TRUE, x, y, width, height);
|
|
||||||
// set color
|
|
||||||
SelectColor->ApplyBG(m_cairo);
|
|
||||||
// set postion
|
|
||||||
cairo_rectangle(m_cairo, x, y, width, height);
|
|
||||||
//cairo_stroke(m_cairo);
|
|
||||||
// flush
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
void DrawerManager::DirectRectangle(color_ts &SelectColor, int32_t x, int32_t y, int32_t width, int32_t height)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
cairo_set_source_rgb(m_cairo, SelectColor.red, SelectColor.green, SelectColor.blue);
|
|
||||||
// set postion
|
|
||||||
cairo_rectangle(m_cairo, x, y, width, height);
|
|
||||||
//cairo_stroke(m_cairo);
|
|
||||||
// flush
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clean the curent Windows with the curent color
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display background
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::Clean(Colorize *SelectColor)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
m_haveWork = false;
|
|
||||||
DirectRectangle(SelectColor, 0, 0, m_size.x, m_size.y);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Clean the curent Windows with the curent color
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display background
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::Clean(color_ts & SelectColor)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
m_haveWork = false;
|
|
||||||
DirectRectangle(SelectColor, 0, 0, m_size.x, m_size.y);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Display a cursor with the cortect form.
|
|
||||||
*
|
|
||||||
* Automatic selection of the XML color "cursorColor"
|
|
||||||
*
|
|
||||||
* @param [in] x Horizontal position to display cursor
|
|
||||||
* @param [in] y Vertical position to display cursor
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define CURSOR_WIDTH (4)
|
|
||||||
void DrawerManager::Cursor(int32_t x, int32_t y)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Flush();
|
|
||||||
// get the cursor Color :
|
|
||||||
color_ts myColor = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
|
|
||||||
cairo_set_source_rgb(m_cairo, myColor.red, myColor.green, myColor.blue);
|
|
||||||
|
|
||||||
// draw cursor
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
// depending on the inserting mode
|
|
||||||
if (false == globals::IsSetInsert()) {
|
|
||||||
cairo_set_line_width(m_cairo, 2);
|
|
||||||
cairo_move_to(m_cairo, x-CURSOR_WIDTH, y - letterHeight+1);
|
|
||||||
cairo_rel_line_to(m_cairo, CURSOR_WIDTH*2, 0);
|
|
||||||
cairo_rel_move_to(m_cairo, -CURSOR_WIDTH, 0);
|
|
||||||
cairo_rel_line_to(m_cairo, 0, letterHeight-2);
|
|
||||||
cairo_rel_move_to(m_cairo, -CURSOR_WIDTH, 0);
|
|
||||||
cairo_rel_line_to(m_cairo, CURSOR_WIDTH*2, 0);
|
|
||||||
} else {
|
|
||||||
cairo_set_line_width(m_cairo, 1);
|
|
||||||
cairo_move_to(m_cairo, x, y - letterHeight + 1);
|
|
||||||
cairo_rel_line_to(m_cairo, letterWidth, 0);
|
|
||||||
cairo_rel_line_to(m_cairo, 0, letterHeight);
|
|
||||||
cairo_rel_line_to(m_cairo, -letterWidth, 0);
|
|
||||||
cairo_rel_line_to(m_cairo, 0, -letterHeight);
|
|
||||||
}
|
|
||||||
cairo_stroke(m_cairo);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Display a end of the curent line ...
|
|
||||||
*
|
|
||||||
* Automatic draw the end of line with the curent XML color "cursorColor"
|
|
||||||
*
|
|
||||||
* @param [in] x Horizontal position to display cursor
|
|
||||||
* @param [in] y Vertical position to display cursor
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::EndOfLine(int32_t x, int32_t y)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (true == globals::IsSetDisplayEndOfLine() ) {
|
|
||||||
Flush();
|
|
||||||
// get the cursor Color :
|
|
||||||
color_ts myColor = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
|
|
||||||
cairo_set_source_rgb(m_cairo, myColor.red, myColor.green, myColor.blue);
|
|
||||||
// draw cursor
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
// depending on the inserting mode
|
|
||||||
/*
|
|
||||||
x1 x2
|
|
||||||
y1 | |-----
|
|
||||||
| |-----
|
|
||||||
| |
|
|
||||||
y2 | |
|
|
||||||
*/
|
|
||||||
cairo_set_line_width(m_cairo, 2);
|
|
||||||
cairo_move_to(m_cairo, x, y - letterHeight+1);
|
|
||||||
cairo_rel_line_to(m_cairo, 0, letterHeight);
|
|
||||||
cairo_move_to(m_cairo, x+2, y - letterHeight+1);
|
|
||||||
cairo_rel_line_to(m_cairo, 0, letterHeight);
|
|
||||||
cairo_arc(m_cairo, x+3, y - letterHeight/4*3, 3.0, -3.149/2, 3.149/2);
|
|
||||||
cairo_stroke(m_cairo);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Display a Tabulation with the user form selection.
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display Tabulation
|
|
||||||
* @param [in] x Horizontal position to display cursor
|
|
||||||
* @param [in] y Vertical position to display cursor
|
|
||||||
* @param [in] mbColomn Width of the current Tabulation caracter (in number of Char)
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::Tabulation(Colorize *SelectColor, int32_t x, int32_t y, int32_t mbColomn)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Flush();
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
|
|
||||||
// generate Clean BG:
|
|
||||||
DirectRectangle(SelectColor, x, y-letterHeight, letterWidth*mbColomn, letterHeight);
|
|
||||||
|
|
||||||
// set the pen for the display
|
|
||||||
SelectColor->ApplyFG(m_cairo);
|
|
||||||
|
|
||||||
uint32_t yCalc = y - (letterHeight+1)/2;
|
|
||||||
|
|
||||||
cairo_move_to(m_cairo, x + 3, yCalc);
|
|
||||||
cairo_line_to(m_cairo, x + letterWidth*mbColomn - 2 , yCalc);
|
|
||||||
cairo_rel_line_to(m_cairo, -6 , -2);
|
|
||||||
cairo_move_to(m_cairo, x + letterWidth*mbColomn - 2 , yCalc);
|
|
||||||
cairo_rel_line_to(m_cairo, -6 , +2);
|
|
||||||
|
|
||||||
cairo_stroke(m_cairo);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Display an unknow UTF8 character (a special rectangle)
|
|
||||||
*
|
|
||||||
* @param [in] SelectColor Color that is used to display Tabulation
|
|
||||||
* @param [in] x Horizontal position to display cursor
|
|
||||||
* @param [in] y Vertical position to display cursor
|
|
||||||
* @param [in] utf8Size number of char used by the UTF8 character
|
|
||||||
* @param [in] ValidUtf8 true if the character UTF8 is well encoded
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DrawerManager::UTF8UnknownElement(Colorize *SelectColor, int32_t x, int32_t y, int8_t utf8Size, bool ValidUtf8)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
Flush();
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
|
|
||||||
// generate Clean BG:
|
|
||||||
DirectRectangle(SelectColor, x, y-letterHeight, letterWidth*2, letterHeight);
|
|
||||||
|
|
||||||
SelectColor->ApplyFG(m_cairo);
|
|
||||||
|
|
||||||
/*
|
|
||||||
y1 y2
|
|
||||||
x1 |-------|
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
x2 |-------|
|
|
||||||
*/
|
|
||||||
uint32_t x1 = x + 2;
|
|
||||||
uint32_t x2 = x + letterWidth*2 - 2;
|
|
||||||
uint32_t y1 = y - letterHeight + 2;
|
|
||||||
uint32_t y2 = y - 2;
|
|
||||||
// Box
|
|
||||||
cairo_move_to(m_cairo, x1 , y1);
|
|
||||||
cairo_line_to(m_cairo, x2 , y1);
|
|
||||||
cairo_line_to(m_cairo, x2 , y2);
|
|
||||||
cairo_line_to(m_cairo, x1 , y2);
|
|
||||||
cairo_line_to(m_cairo, x1 , y1);
|
|
||||||
// croix in the middle
|
|
||||||
switch(utf8Size)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
cairo_line_to(m_cairo, x2 , y2);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
cairo_move_to(m_cairo, x1 , y2);
|
|
||||||
cairo_line_to(m_cairo, x2 , y1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cairo_line_to(m_cairo, x2 , y2);
|
|
||||||
cairo_move_to(m_cairo, x1 , y2);
|
|
||||||
cairo_line_to(m_cairo, x2 , y1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (false == ValidUtf8) {
|
|
||||||
cairo_move_to(m_cairo, x1 , y2-2);
|
|
||||||
cairo_line_to(m_cairo, x2 , y2-2);
|
|
||||||
}
|
|
||||||
cairo_stroke(m_cairo);
|
|
||||||
cairo_fill(m_cairo);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Basic axample with cairo and pango...
|
|
||||||
cairo_t *cr;
|
|
||||||
|
|
||||||
cr = gdk_cairo_create(widget->window);
|
|
||||||
|
|
||||||
cairo_translate(cr, 0, 7);
|
|
||||||
|
|
||||||
cairo_set_source_rgb(cr, 0, 0, 0);
|
|
||||||
cairo_paint(cr);
|
|
||||||
|
|
||||||
gint pos = 18;//GTK_CPU(widget)->sel;
|
|
||||||
gint rect = pos / 5;
|
|
||||||
|
|
||||||
cairo_set_source_rgb(cr, 0.2, 0.4, 0);
|
|
||||||
|
|
||||||
gint i;
|
|
||||||
for ( i = 1; i <= 20; i++) {
|
|
||||||
if (i > 20 - rect) {
|
|
||||||
cairo_set_source_rgb(cr, 0.6, 1.0, 0);
|
|
||||||
} else {
|
|
||||||
cairo_set_source_rgb(cr, 0.2, 0.4, 0);
|
|
||||||
}
|
|
||||||
cairo_rectangle(cr, 8, i*4, 30, 3);
|
|
||||||
cairo_rectangle(cr, 42, i*4, 30, 3);
|
|
||||||
cairo_fill(cr);
|
|
||||||
}
|
|
||||||
//----
|
|
||||||
PangoLayout *layout;
|
|
||||||
PangoFontDescription *desc;
|
|
||||||
|
|
||||||
cairo_translate(cr, 10, 20);
|
|
||||||
layout = pango_cairo_create_layout(cr);
|
|
||||||
pango_layout_set_text(layout, "Hello World!", -1);
|
|
||||||
desc = pango_font_description_from_string("Sans Bold 12");
|
|
||||||
pango_layout_set_font_description(layout, desc);
|
|
||||||
pango_font_description_free(desc);
|
|
||||||
|
|
||||||
cairo_set_source_rgb(cr, 0.0, 0.0, 1.0);
|
|
||||||
pango_cairo_update_layout(cr, layout);
|
|
||||||
pango_cairo_show_layout(cr, layout);
|
|
||||||
|
|
||||||
g_object_unref(layout);
|
|
||||||
//-----
|
|
||||||
cairo_destroy(cr);
|
|
||||||
*/
|
|
@ -27,8 +27,6 @@
|
|||||||
#define __TOOLS_DISPLAY_H__
|
#define __TOOLS_DISPLAY_H__
|
||||||
|
|
||||||
#include <tools_debug.h>
|
#include <tools_debug.h>
|
||||||
#include <Colorize.h>
|
|
||||||
#include <ColorizeManager.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,60 +34,10 @@
|
|||||||
*/
|
*/
|
||||||
namespace Display
|
namespace Display
|
||||||
{
|
{
|
||||||
void Init(void);
|
|
||||||
void UnInit(void);
|
|
||||||
//cairo_font_face_t * GetFont(bool bold, bool italic);
|
|
||||||
void * GetFont(bool bold, bool italic);
|
|
||||||
int32_t GetFontHeight(void);
|
int32_t GetFontHeight(void);
|
||||||
int32_t GetFontWidth(void);
|
int32_t GetFontWidth(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_CARACTER_CYCLE (512)
|
|
||||||
/**
|
|
||||||
* class to abstrate the writing on the curent GUI (INTEFACE to be no dependent of the one chosen)
|
|
||||||
*/
|
|
||||||
class DrawerManager;
|
|
||||||
|
|
||||||
class DrawerManager {
|
|
||||||
public:
|
|
||||||
// Constructeur
|
|
||||||
//DrawerManager(GtkWidget * widget, int32_t x, int32_t y);
|
|
||||||
DrawerManager(void * widget, int32_t x, int32_t y);
|
|
||||||
~DrawerManager();
|
|
||||||
|
|
||||||
void Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
|
||||||
void Rectangle(color_ts & SelectColor, int32_t x, int32_t y, int32_t width, int32_t height) {
|
|
||||||
DirectRectangle(SelectColor, x, y, width, height);
|
|
||||||
}
|
|
||||||
void Clean(Colorize *SelectColor);
|
|
||||||
void Clean(color_ts & SelectColor);
|
|
||||||
void Text(Colorize *SelectColor, int32_t x, int32_t y,const char *myUTF8Text, int32_t len = -1);
|
|
||||||
void Text(color_ts & SelectColorFg, color_ts & SelectColorBg, int32_t x, int32_t y,const char *myText);
|
|
||||||
void Text(color_ts & SelectColorFg, int32_t x, int32_t y,const char *myText);
|
|
||||||
void SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32_t nbChar);
|
|
||||||
void Cursor(int32_t x, int32_t y);
|
|
||||||
void EndOfLine(int32_t x, int32_t y);
|
|
||||||
void Tabulation(Colorize *SelectColor, int32_t x, int32_t y, int32_t mbColomn);
|
|
||||||
void UTF8UnknownElement(Colorize *SelectColor, int32_t x, int32_t y, int8_t utf8Size, bool ValidUtf8);
|
|
||||||
void Flush(void);
|
|
||||||
int32_t GetWidth(void) { return m_size.x; };
|
|
||||||
int32_t GetHeight(void) { return m_size.y; };
|
|
||||||
|
|
||||||
private:
|
|
||||||
void DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
|
||||||
void DirectRectangle(color_ts & SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
|
||||||
|
|
||||||
bool m_haveWork; //!< if data might be print (true)
|
|
||||||
char m_dataToDisplay[MAX_CARACTER_CYCLE]; //!< curent string to display
|
|
||||||
uint32_t m_nbElement; //!< nb element in the string
|
|
||||||
position_ts m_pos; //!< position where start the string display (X,Y)
|
|
||||||
Colorize * m_selectColor; //!< curent color to display
|
|
||||||
|
|
||||||
position_ts m_size; //!< Total size
|
|
||||||
//cairo_t * m_cairo; //!< Cairo Layout pointer
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ bool EdnBuf::SelectHasSelection(selectionType_te select)
|
|||||||
*/
|
*/
|
||||||
void EdnBuf::Select(selectionType_te select, int32_t start, int32_t end)
|
void EdnBuf::Select(selectionType_te select, int32_t start, int32_t end)
|
||||||
{
|
{
|
||||||
selection oldSelection = m_selectionList[select];
|
//selection oldSelection = m_selectionList[select];
|
||||||
m_selectionList[select].selected = start != end;
|
m_selectionList[select].selected = start != end;
|
||||||
m_selectionList[select].zeroWidth = (start == end) ? true : false;
|
m_selectionList[select].zeroWidth = (start == end) ? true : false;
|
||||||
m_selectionList[select].rectangular = false;
|
m_selectionList[select].rectangular = false;
|
||||||
@ -77,7 +77,7 @@ void EdnBuf::Select(selectionType_te select, int32_t start, int32_t end)
|
|||||||
*/
|
*/
|
||||||
void EdnBuf::Unselect(selectionType_te select)
|
void EdnBuf::Unselect(selectionType_te select)
|
||||||
{
|
{
|
||||||
selection oldSelection = m_selectionList[select];
|
//selection oldSelection = m_selectionList[select];
|
||||||
m_selectionList[select].selected = false;
|
m_selectionList[select].selected = false;
|
||||||
m_selectionList[select].zeroWidth = false;
|
m_selectionList[select].zeroWidth = false;
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
const char * ednLog = "edn ";
|
const char * ednLog = "edn ";
|
||||||
|
10
local.properties
Normal file
10
local.properties
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# This file is automatically generated by Android Tools.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file must *NOT* be checked in Version Control Systems,
|
||||||
|
# as it contains information specific to your local configuration.
|
||||||
|
|
||||||
|
# location of the SDK. This is only used by Ant
|
||||||
|
# For customization when using a Version Control System, please read the
|
||||||
|
# header note.
|
||||||
|
sdk.dir=/home/heero/dev/perso/android/sdk-r15
|
40
proguard.cfg
Normal file
40
proguard.cfg
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
-optimizationpasses 5
|
||||||
|
-dontusemixedcaseclassnames
|
||||||
|
-dontskipnonpubliclibraryclasses
|
||||||
|
-dontpreverify
|
||||||
|
-verbose
|
||||||
|
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||||
|
|
||||||
|
-keep public class * extends android.app.Activity
|
||||||
|
-keep public class * extends android.app.Application
|
||||||
|
-keep public class * extends android.app.Service
|
||||||
|
-keep public class * extends android.content.BroadcastReceiver
|
||||||
|
-keep public class * extends android.content.ContentProvider
|
||||||
|
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||||
|
-keep public class * extends android.preference.Preference
|
||||||
|
-keep public class com.android.vending.licensing.ILicensingService
|
||||||
|
|
||||||
|
-keepclasseswithmembernames class * {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
public <init>(android.content.Context, android.util.AttributeSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclassmembers class * extends android.app.Activity {
|
||||||
|
public void *(android.view.View);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclassmembers enum * {
|
||||||
|
public static **[] values();
|
||||||
|
public static ** valueOf(java.lang.String);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class * implements android.os.Parcelable {
|
||||||
|
public static final android.os.Parcelable$Creator *;
|
||||||
|
}
|
11
project.properties
Normal file
11
project.properties
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# This file is automatically generated by Android Tools.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file must be checked in Version Control Systems.
|
||||||
|
#
|
||||||
|
# To customize properties used by the Ant build system use,
|
||||||
|
# "ant.properties", and override values to adapt the script to your
|
||||||
|
# project structure.
|
||||||
|
|
||||||
|
# Project target.
|
||||||
|
target=Google Inc.:Google APIs:13
|
BIN
res/drawable/ic_luncher_edn.png
Normal file
BIN
res/drawable/ic_luncher_edn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Loading…
x
Reference in New Issue
Block a user