display of the special font work....

This commit is contained in:
Edouard Dupin 2012-09-07 16:31:49 +02:00
parent 3bdc96097c
commit dab060c4fe
8 changed files with 297 additions and 98 deletions

View File

@ -41,8 +41,11 @@ typedef struct{
uint32_t diplayableLine; //!< NB Line that can be displayed uint32_t diplayableLine; //!< NB Line that can be displayed
}infoStatBuffer_ts; }infoStatBuffer_ts;
//#define TEXT_DISPLAY_TYPE OObject2DTextColored #ifdef __VIDEO__OPENGL_ES_2
#define TEXT_DISPLAY_TYPE OObject2DTextShader #define TEXT_DISPLAY_TYPE OObject2DTextShader
#else
#define TEXT_DISPLAY_TYPE OObject2DTextColored
#endif
class Buffer { class Buffer {
public: public:
@ -82,12 +85,17 @@ class Buffer {
public: public:
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate) {}; virtual void GetInfo(infoStatBuffer_ts &infoToUpdate) {};
virtual void SetLineDisplay(uint32_t lineNumber) {}; virtual void SetLineDisplay(uint32_t lineNumber) {};
#ifdef __VIDEO__OPENGL_ES_2
virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
#else
virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal, virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
ewol::TEXT_DISPLAY_TYPE& OOTextBold, ewol::TEXT_DISPLAY_TYPE& OOTextBold,
ewol::TEXT_DISPLAY_TYPE& OOTextItalic, ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic, ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY) ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
#endif
{ {
return ERR_NONE; return ERR_NONE;
} }

View File

@ -67,32 +67,55 @@ BufferEmpty::~BufferEmpty(void)
* @return --- * @return ---
* *
*/ */
#ifdef __VIDEO__OPENGL_ES_2
int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOText,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
#else
int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal, int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
ewol::TEXT_DISPLAY_TYPE& OOTextBold, ewol::TEXT_DISPLAY_TYPE& OOTextBold,
ewol::TEXT_DISPLAY_TYPE& OOTextItalic, ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic, ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY) ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
#endif
{ {
// Get color : // Get color :
Colorize *myColor = NULL; Colorize *myColor = NULL;
int32_t letterHeight = OOTextNormal.GetHeight(); #ifdef __VIDEO__OPENGL_ES_2
int32_t letterHeight = OOText.GetHeight();
#else
int32_t letterHeight = OOTextNormal.GetHeight();
#endif
Vector2D<float> textPos; Vector2D<float> textPos;
textPos.x = 20; textPos.x = 20;
textPos.y = sizeY - 20 - letterHeight; textPos.y = sizeY - 20 - letterHeight;
etk::UString tmpDisplay ; etk::UString tmpDisplay ;
/*
myColor = ColorizeManager::Get("normal"); myColor = ColorizeManager::Get("normal");
OOTextBold.SetColor(myColor->GetFG()); tmpDisplay = "edn - Editeur De N'ours";
etk::UString tmpDisplay = "edn - Editeur De N'ours"; #ifdef __VIDEO__OPENGL_ES_2
OOTextBold.Text(textPos, tmpDisplay); OOText.SetColor(myColor->GetFG());
*/ OOText.SetBold(true);
OOText.SetItalic(false);
OOText.Text(textPos, tmpDisplay);
#else
OOTextBold.SetColor(myColor->GetFG());
OOTextBold.Text(textPos, tmpDisplay);
#endif
myColor = ColorizeManager::Get("commentDoxygen"); myColor = ColorizeManager::Get("commentDoxygen");
OOTextNormal.SetColor(myColor->GetFG());
textPos.y = (int32_t)(textPos.y - letterHeight*1.30); textPos.y = (int32_t)(textPos.y - letterHeight*1.30);
tmpDisplay = "No Buffer Availlable to display"; tmpDisplay = "No Buffer Availlable to display";
OOTextNormal.Text(textPos, tmpDisplay); #ifdef __VIDEO__OPENGL_ES_2
OOText.SetBold(false);
OOText.SetItalic(false);
OOText.SetColor(myColor->GetFG());
OOText.Text(textPos, tmpDisplay);
#else
OOTextNormal.SetColor(myColor->GetFG());
OOTextNormal.Text(textPos, tmpDisplay);
#endif
OOColored.SetColor(draw::color::white); OOColored.SetColor(draw::color::white);
OOColored.Rectangle( 0, 0, sizeX, sizeY); OOColored.Rectangle( 0, 0, sizeX, sizeY);

View File

@ -32,11 +32,17 @@ class BufferEmpty : public Buffer {
public: public:
BufferEmpty(void); BufferEmpty(void);
virtual ~BufferEmpty(void); virtual ~BufferEmpty(void);
#ifdef __VIDEO__OPENGL_ES_2
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
#else
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal, int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
ewol::TEXT_DISPLAY_TYPE& OOTextBold, ewol::TEXT_DISPLAY_TYPE& OOTextBold,
ewol::TEXT_DISPLAY_TYPE& OOTextItalic, ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic, ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY); ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
#endif
}; };

View File

@ -277,6 +277,12 @@ int32_t BufferText::GetNumberOfLine(void)
* @return * @return
* *
*/ */
#ifdef __VIDEO__OPENGL_ES_2
int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOText,
ewol::OObject2DColored& OOColored,
int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY)
#else
int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal, int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
ewol::TEXT_DISPLAY_TYPE& OOTextBold, ewol::TEXT_DISPLAY_TYPE& OOTextBold,
ewol::TEXT_DISPLAY_TYPE& OOTextItalic, ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
@ -284,14 +290,19 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
ewol::OObject2DColored& OOColored, ewol::OObject2DColored& OOColored,
int32_t offsetX, int32_t offsetY, int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY) int32_t sizeX, int32_t sizeY)
#endif
{ {
int32_t selStart, selEnd, selRectStart, selRectEnd; int32_t selStart, selEnd, selRectStart, selRectEnd;
bool selIsRect; bool selIsRect;
int32_t selHave; int32_t selHave;
int32_t letterWidth = OOTextNormal.GetSize("A").x; #ifdef __VIDEO__OPENGL_ES_2
int32_t letterHeight = OOTextNormal.GetHeight(); int32_t letterWidth = OOText.GetSize("A").x;
int32_t letterHeight = OOText.GetHeight();
#else
int32_t letterWidth = OOTextNormal.GetSize("A").x;
int32_t letterHeight = OOTextNormal.GetHeight();
#endif
int32_t displayStartLineId = offsetY / letterHeight - 1; int32_t displayStartLineId = offsetY / letterHeight - 1;
displayStartLineId = etk_max(0, displayStartLineId); displayStartLineId = etk_max(0, displayStartLineId);
uint32_t y = - offsetY + displayStartLineId*letterHeight; uint32_t y = - offsetY + displayStartLineId*letterHeight;
@ -316,11 +327,12 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
// Get color : // Get color :
Colorize * myColor = ColorizeManager::Get("normal"); Colorize * myColor = ColorizeManager::Get("normal");
Colorize * myColorSel = ColorizeManager::Get("SelectedText"); Colorize * myColorSel = ColorizeManager::Get("SelectedText");
draw::Color & myColorSpace = ColorizeManager::Get(COLOR_CODE_SPACE); draw::Color & myColorSpace = ColorizeManager::Get(COLOR_CODE_SPACE);
draw::Color & myColorTab = ColorizeManager::Get(COLOR_CODE_TAB); draw::Color & myColorTab = ColorizeManager::Get(COLOR_CODE_TAB);
Colorize * selectColor = NULL; Colorize * selectColor = NULL;
#ifndef __VIDEO__OPENGL_ES_2
ewol::TEXT_DISPLAY_TYPE* OOTextSelected = NULL; ewol::TEXT_DISPLAY_TYPE* OOTextSelected = NULL;
#endif
int mylen = m_EdnBuf.Size(); int mylen = m_EdnBuf.Size();
int32_t x_base=nbColoneForLineNumber*letterWidth; int32_t x_base=nbColoneForLineNumber*letterWidth;
int32_t idX = 0; int32_t idX = 0;
@ -349,9 +361,14 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
y = sizeY - y; y = sizeY - y;
y -= letterHeight; y -= letterHeight;
OOTextNormal.clippingDisable();
OOColored.clippingDisable(); OOColored.clippingDisable();
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y); #ifdef __VIDEO__OPENGL_ES_2
OOText.clippingDisable();
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
#else
OOTextNormal.clippingDisable();
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
#endif
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER; int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
clipping_ts drawClipping; clipping_ts drawClipping;
@ -366,10 +383,14 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
drawClippingTextArea.w = sizeX - drawClipping.x; drawClippingTextArea.w = sizeX - drawClipping.x;
drawClippingTextArea.h = sizeY; drawClippingTextArea.h = sizeY;
OOTextNormal.clippingSet(drawClippingTextArea); #ifdef __VIDEO__OPENGL_ES_2
OOTextBold.clippingSet(drawClippingTextArea); OOText.clippingSet(drawClippingTextArea);
OOTextItalic.clippingSet(drawClippingTextArea); #else
OOTextBoldItalic.clippingSet(drawClippingTextArea); OOTextNormal.clippingSet(drawClippingTextArea);
OOTextBold.clippingSet(drawClippingTextArea);
OOTextItalic.clippingSet(drawClippingTextArea);
OOTextBoldItalic.clippingSet(drawClippingTextArea);
#endif
OOColored.clippingSet(drawClippingTextArea); OOColored.clippingSet(drawClippingTextArea);
// Clear the line intexation : // Clear the line intexation :
@ -434,25 +455,34 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
haveBg = selectColor->HaveBg(); haveBg = selectColor->HaveBg();
} }
} }
if (true == selectColor->GetItalic() ) { #ifdef __VIDEO__OPENGL_ES_2
if (true == selectColor->GetBold() ) { tmpElementProperty.m_ySize = OOText.GetHeight();
OOTextSelected = &OOTextBoldItalic; OOText.SetColor(selectColor->GetFG());
OOText.SetBold(selectColor->GetBold());
OOText.SetItalic(selectColor->GetItalic());
myStringToDisplay = displayChar;
drawSize = OOText.Text(textPos, myStringToDisplay);
#else
if (true == selectColor->GetItalic() ) {
if (true == selectColor->GetBold() ) {
OOTextSelected = &OOTextBoldItalic;
} else {
OOTextSelected = &OOTextItalic;
}
} else { } else {
OOTextSelected = &OOTextItalic; if (true == selectColor->GetBold() ) {
OOTextSelected = &OOTextBold;
} else {
OOTextSelected = &OOTextNormal;
}
} }
} else { tmpElementProperty.m_ySize = OOTextSelected->GetHeight();
if (true == selectColor->GetBold() ) { //tmpElementProperty.m_yOffset += tmpElementProperty.m_ySize;
OOTextSelected = &OOTextBold; OOTextSelected->SetColor(selectColor->GetFG());
} else { // TODO : Remove this unreallistic leak of time
OOTextSelected = &OOTextNormal; myStringToDisplay = displayChar;
} drawSize = OOTextSelected->Text(textPos, myStringToDisplay);
} #endif
tmpElementProperty.m_ySize = OOTextSelected->GetHeight();
//tmpElementProperty.m_yOffset += tmpElementProperty.m_ySize;
OOTextSelected->SetColor(selectColor->GetFG());
// TODO : Remove this unreallistic leak of time
myStringToDisplay = displayChar;
drawSize = OOTextSelected->Text(textPos, myStringToDisplay);
//APPL_DEBUG("add element : " << tmpElementProperty.m_yOffset << "," << tmpElementProperty.m_xOffset); //APPL_DEBUG("add element : " << tmpElementProperty.m_yOffset << "," << tmpElementProperty.m_xOffset);
m_elmentList.PushBack(tmpElementProperty); m_elmentList.PushBack(tmpElementProperty);
@ -477,10 +507,18 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
y -= letterHeight; y -= letterHeight;
displayLines++; displayLines++;
currentLineID++; currentLineID++;
OOTextNormal.clippingDisable();
OOColored.clippingDisable(); OOColored.clippingDisable();
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y); #ifdef __VIDEO__OPENGL_ES_2
OOTextNormal.clippingEnable(); OOText.clippingDisable();
OOText.SetBold(false);
OOText.SetItalic(false);
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
OOText.clippingEnable();
#else
OOTextNormal.clippingDisable();
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
OOTextNormal.clippingEnable();
#endif
OOColored.clippingEnable(); OOColored.clippingEnable();
// add elements : // add elements :
m_elmentList.PushBack(tmpElementProperty); m_elmentList.PushBack(tmpElementProperty);

View File

@ -54,7 +54,12 @@ class BufferText : public Buffer {
void GetInfo(infoStatBuffer_ts &infoToUpdate); void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber); void SetLineDisplay(uint32_t lineNumber);
#ifdef __VIDEO__OPENGL_ES_2
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
ewol::OObject2DColored& OOColored,
int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY);
#else
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal, int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
ewol::TEXT_DISPLAY_TYPE& OOTextBold, ewol::TEXT_DISPLAY_TYPE& OOTextBold,
ewol::TEXT_DISPLAY_TYPE& OOTextItalic, ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
@ -62,6 +67,7 @@ class BufferText : public Buffer {
ewol::OObject2DColored& OOColored, ewol::OObject2DColored& OOColored,
int32_t offsetX, int32_t offsetY, int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY); int32_t sizeX, int32_t sizeY);
#endif
void AddChar(uniChar_t unicodeData); void AddChar(uniChar_t unicodeData);
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent); void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
void MouseSelectFromCursorTo(Vector2D<float> pos); void MouseSelectFromCursorTo(Vector2D<float> pos);

View File

@ -41,8 +41,7 @@
#undef __class__ #undef __class__
#define __class__ "CodeView" #define __class__ "CodeView"
void CodeView::Init(void)
CodeView::CodeView(void)
{ {
m_label = "CodeView is disable ..."; m_label = "CodeView is disable ...";
@ -70,6 +69,19 @@ CodeView::CodeView(void)
SetLimitScrolling(0.2); SetLimitScrolling(0.2);
} }
#ifdef __VIDEO__OPENGL_ES_2
CodeView::CodeView(etk::UString fontName, int32_t fontSize) :
m_OObjectText(fontName, fontSize)
{
Init();
}
#endif
CodeView::CodeView(void)
{
Init();
}
CodeView::~CodeView(void) CodeView::~CodeView(void)
{ {
@ -106,7 +118,11 @@ bool CodeView::CalculateMinSize(void)
void CodeView::CalculateMaxSize(void) void CodeView::CalculateMaxSize(void)
{ {
m_maxSize.x = 2048; m_maxSize.x = 2048;
int32_t letterHeight = m_OObjectTextNormal.GetHeight(); #ifdef __VIDEO__OPENGL_ES_2
int32_t letterHeight = m_OObjectText.GetHeight();
#else
int32_t letterHeight = m_OObjectTextNormal.GetHeight();
#endif
m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight; m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight;
} }
@ -114,10 +130,14 @@ void CodeView::CalculateMaxSize(void)
void CodeView::OnDraw(ewol::DrawProperty& displayProp) void CodeView::OnDraw(ewol::DrawProperty& displayProp)
{ {
m_OObjectsColored.Draw(); m_OObjectsColored.Draw();
m_OObjectTextNormal.Draw(); #ifdef __VIDEO__OPENGL_ES_2
m_OObjectTextBold.Draw(); m_OObjectText.Draw();
m_OObjectTextItalic.Draw(); #else
m_OObjectTextBoldItalic.Draw(); m_OObjectTextNormal.Draw();
m_OObjectTextBold.Draw();
m_OObjectTextItalic.Draw();
m_OObjectTextBoldItalic.Draw();
#endif
WidgetScrooled::OnDraw(displayProp); WidgetScrooled::OnDraw(displayProp);
} }
@ -129,10 +149,14 @@ void CodeView::OnRegenerateDisplay(void)
// For the scrooling windows // For the scrooling windows
CalculateMaxSize(); CalculateMaxSize();
m_OObjectTextNormal.Clear(); #ifdef __VIDEO__OPENGL_ES_2
m_OObjectTextBold.Clear(); m_OObjectText.Clear();
m_OObjectTextItalic.Clear(); #else
m_OObjectTextBoldItalic.Clear(); m_OObjectTextNormal.Clear();
m_OObjectTextBold.Clear();
m_OObjectTextItalic.Clear();
m_OObjectTextBoldItalic.Clear();
#endif
m_OObjectsColored.Clear(); m_OObjectsColored.Clear();
@ -145,12 +169,18 @@ void CodeView::OnRegenerateDisplay(void)
} // else : nothing to do ... } // else : nothing to do ...
// generate the objects : // generate the objects :
BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal, #ifdef __VIDEO__OPENGL_ES_2
m_OObjectTextBold, BufferManager::Get(m_bufferID)->Display(m_OObjectText,
m_OObjectTextItalic, m_OObjectsColored,
m_OObjectTextBoldItalic, m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
m_OObjectsColored, #else
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y); BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal,
m_OObjectTextBold,
m_OObjectTextItalic,
m_OObjectTextBoldItalic,
m_OObjectsColored,
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
#endif
// set the current size of the windows // set the current size of the windows
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize()); SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
@ -405,29 +435,41 @@ void CodeView::OnLostFocus(void)
void CodeView::SetFontSize(int32_t size) void CodeView::SetFontSize(int32_t size)
{ {
m_OObjectTextNormal.SetSize(size); #ifdef __VIDEO__OPENGL_ES_2
m_OObjectTextBold.SetSize(size); m_OObjectText.SetSize(size);
m_OObjectTextItalic.SetSize(size); #else
m_OObjectTextBoldItalic.SetSize(size); m_OObjectTextNormal.SetSize(size);
m_OObjectTextBold.SetSize(size);
m_OObjectTextItalic.SetSize(size);
m_OObjectTextBoldItalic.SetSize(size);
#endif
SetScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ... SetScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
} }
void CodeView::SetFontNameNormal(etk::UString fontName) #ifdef __VIDEO__OPENGL_ES_2
{ void CodeView::SetFontName(etk::UString fontName)
m_OObjectTextNormal.SetFont(fontName); {
} m_OObjectText.SetFont(fontName);
}
void CodeView::SetFontNameBold(etk::UString fontName) #else
{ void CodeView::SetFontNameNormal(etk::UString fontName)
m_OObjectTextBold.SetFont(fontName); {
} m_OObjectTextNormal.SetFont(fontName);
}
void CodeView::SetFontNameItalic(etk::UString fontName)
{ void CodeView::SetFontNameBold(etk::UString fontName)
m_OObjectTextItalic.SetFont(fontName); {
} m_OObjectTextBold.SetFont(fontName);
}
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
{ void CodeView::SetFontNameItalic(etk::UString fontName)
m_OObjectTextBoldItalic.SetFont(fontName); {
} m_OObjectTextItalic.SetFont(fontName);
}
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
{
m_OObjectTextBoldItalic.SetFont(fontName);
}
#endif

View File

@ -38,7 +38,11 @@
class CodeView :public ewol::WidgetScrooled class CodeView :public ewol::WidgetScrooled
{ {
public: public:
CodeView(void); void Init(void);
#ifdef __VIDEO__OPENGL_ES_2
CodeView(etk::UString fontName, int32_t fontSize);
#endif
CodeView(void);
virtual ~CodeView(void); virtual ~CodeView(void);
/** /**
* @brief Get the current Object type of the EObject * @brief Get the current Object type of the EObject
@ -57,10 +61,14 @@ class CodeView :public ewol::WidgetScrooled
etk::Vector<Vector2D<float> > m_lineNumberList; etk::Vector<Vector2D<float> > m_lineNumberList;
void UpdateNumberOfLineReference(int32_t bufferID); void UpdateNumberOfLineReference(int32_t bufferID);
// drawing elements : // drawing elements :
ewol::TEXT_DISPLAY_TYPE m_OObjectTextNormal; #ifdef __VIDEO__OPENGL_ES_2
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBold; ewol::TEXT_DISPLAY_TYPE m_OObjectText;
ewol::TEXT_DISPLAY_TYPE m_OObjectTextItalic; #else
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBoldItalic; ewol::TEXT_DISPLAY_TYPE m_OObjectTextNormal;
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBold;
ewol::TEXT_DISPLAY_TYPE m_OObjectTextItalic;
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBoldItalic;
#endif
ewol::OObject2DColored m_OObjectsColored; ewol::OObject2DColored m_OObjectsColored;
public: public:
@ -98,10 +106,14 @@ class CodeView :public ewol::WidgetScrooled
virtual void OnLostFocus(void); virtual void OnLostFocus(void);
public: public:
void SetFontSize(int32_t size); void SetFontSize(int32_t size);
void SetFontNameNormal(etk::UString fontName); #ifdef __VIDEO__OPENGL_ES_2
void SetFontNameBold(etk::UString fontName); void SetFontName(etk::UString fontName);
void SetFontNameItalic(etk::UString fontName); #else
void SetFontNameBoldItalic(etk::UString fontName); void SetFontNameNormal(etk::UString fontName);
void SetFontNameBold(etk::UString fontName);
void SetFontNameItalic(etk::UString fontName);
void SetFontNameBoldItalic(etk::UString fontName);
#endif
private: private:
void CalculateMaxSize(void); void CalculateMaxSize(void);
protected: protected:

View File

@ -40,6 +40,7 @@
#include <ewol/widget/ContextMenu.h> #include <ewol/widget/ContextMenu.h>
#include <ewol/widget/PopUp.h> #include <ewol/widget/PopUp.h>
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
#include <ewol/widget/Slider.h>
#include <ewol/widget/Menu.h> #include <ewol/widget/Menu.h>
#include <ewol/widget/meta/FileChooser.h> #include <ewol/widget/meta/FileChooser.h>
#include <ewol/widget/meta/Parameter.h> #include <ewol/widget/meta/Parameter.h>
@ -112,6 +113,16 @@ class ParameterAboutGui : public ewol::SizerVert
}; };
const char * l_smoothChick = "tmpEvent_smooth";
const char * l_smoothMin = "tmpEvent_minChange";
const char * l_smoothMax = "tmpEvent_maxChange";
extern float DF_SoftEdge_min;
extern float DF_SoftEdge_max;
extern int32_t DF_SoftEdge;
ewol::Slider* tmpSliderMin = NULL;
ewol::Slider* tmpSliderMax = NULL;
#undef __class__ #undef __class__
#define __class__ "MainWindows" #define __class__ "MainWindows"
@ -143,21 +154,53 @@ MainWindows::MainWindows(void)
mySizerHori->SubWidgetAdd(mySizerVert2); mySizerHori->SubWidgetAdd(mySizerVert2);
// main buffer Area : // main buffer Area :
myCodeView = new CodeView(); #ifdef __VIDEO__OPENGL_ES_2
myCodeView = new CodeView("Font/freefont/FreeMono.ttf", 24);
#else
myCodeView = new CodeView();
#endif
myCodeView->SetExpendX(true); myCodeView->SetExpendX(true);
myCodeView->SetExpendY(true); myCodeView->SetExpendY(true);
myCodeView->SetFillX(true); myCodeView->SetFillX(true);
myCodeView->SetFillY(true); myCodeView->SetFillY(true);
myCodeView->SetFontSize(48); #ifndef __VIDEO__OPENGL_ES_2
myCodeView->SetFontNameNormal( "Font/freefont/FreeMono.ttf"); myCodeView->SetFontSize(11);
myCodeView->SetFontNameBold( "Font/freefont/FreeMonoBold.ttf"); myCodeView->SetFontNameNormal( "Font/freefont/FreeMono.ttf");
myCodeView->SetFontNameItalic( "Font/freefont/FreeMonoOblique.ttf"); myCodeView->SetFontNameBold( "Font/freefont/FreeMonoBold.ttf");
myCodeView->SetFontNameBoldItalic("Font/freefont/FreeMonoBoldOblique.ttf"); myCodeView->SetFontNameItalic( "Font/freefont/FreeMonoOblique.ttf");
myCodeView->SetFontNameBoldItalic("Font/freefont/FreeMonoBoldOblique.ttf");
#endif
mySizerVert2->SubWidgetAdd(myCodeView); mySizerVert2->SubWidgetAdd(myCodeView);
// search area : // search area :
Search * mySearch = new Search(); Search * mySearch = new Search();
mySizerVert2->SubWidgetAdd(mySearch); mySizerVert2->SubWidgetAdd(mySearch);
{
ewol::SizerHori * mySizerHori2 = new ewol::SizerHori();
mySizerVert2->SubWidgetAdd(mySizerHori2);
ewol::CheckBox* tmpCheck = new ewol::CheckBox("smooth");
mySizerHori2->SubWidgetAdd(tmpCheck);
tmpCheck->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_smoothChick);
ewol::Slider* tmpSlider = new ewol::Slider();
mySizerHori2->SubWidgetAdd(tmpSlider);
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMin);
tmpSlider->SetExpendX(true);
tmpSlider->SetMin(0);
tmpSlider->SetMax(1000);
tmpSlider->SetValue(0450);
tmpSliderMin = tmpSlider;
tmpSlider = new ewol::Slider();
mySizerHori2->SubWidgetAdd(tmpSlider);
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMax);
tmpSlider->SetExpendX(true);
tmpSlider->SetMin(0);
tmpSlider->SetMax(1000);
tmpSlider->SetValue(0550);
tmpSliderMax = tmpSlider;
}
mySizerHori = new ewol::SizerHori(); mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori); mySizerVert->SubWidgetAdd(mySizerHori);
@ -349,9 +392,30 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
tmpSubWidget = new ParameterAboutGui(); tmpSubWidget = new ParameterAboutGui();
tmpWidget->MenuAdd("About", "", tmpSubWidget); tmpWidget->MenuAdd("About", "", tmpSubWidget);
} }
} else if (eventId == l_smoothChick) {
if (data == "true") {
DF_SoftEdge = 1;
} else {
DF_SoftEdge = 0;
}
} else if (eventId == l_smoothMin) {
int32_t newVal = 0;
sscanf(data.c_str(), "%d", &newVal);
DF_SoftEdge_min = (float)newVal / 1000.0;
if (DF_SoftEdge_min>DF_SoftEdge_max) {
DF_SoftEdge_max = DF_SoftEdge_min;
tmpSliderMax->SetValue(DF_SoftEdge_max*1000.0);
}
} else if (eventId == l_smoothMax) {
int32_t newVal = 0;
sscanf(data.c_str(), "%d", &newVal);
DF_SoftEdge_max = (float)newVal / 1000.0;
if (DF_SoftEdge_min>DF_SoftEdge_max) {
DF_SoftEdge_min = DF_SoftEdge_max;
tmpSliderMin->SetValue(DF_SoftEdge_min*1000.0);
}
} }
return; return;
} }