[DEV] Change the ETK vector and matrix

This commit is contained in:
Edouard Dupin 2012-10-26 16:56:53 +02:00
parent 708e8794a0
commit 2031631b77
9 changed files with 39 additions and 38 deletions

View File

@ -121,19 +121,19 @@ bool Buffer::NeedToUpdateDisplayPosition(void)
return tmpVal; return tmpVal;
} }
Vector2D<float> Buffer::GetBorderSize(void) etk::Vector2D<float> Buffer::GetBorderSize(void)
{ {
Vector2D<float> tmpVal; etk::Vector2D<float> tmpVal;
tmpVal.x = 30; tmpVal.x = 30;
tmpVal.y = 30; tmpVal.y = 30;
return tmpVal; return tmpVal;
} }
Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested) etk::Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested)
{ {
centerRequested = false; centerRequested = false;
Vector2D<float> tmpVal; etk::Vector2D<float> tmpVal;
tmpVal.x = 0; tmpVal.x = 0;
tmpVal.y = 0; tmpVal.y = 0;
return tmpVal; return tmpVal;

View File

@ -27,7 +27,7 @@
#define __BUFFER_H__ #define __BUFFER_H__
#include <etk/UString.h> #include <etk/UString.h>
#include <etk/File.h> #include <etk/os/File.h>
#include <etk/unicode.h> #include <etk/unicode.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
@ -101,8 +101,8 @@ class Buffer {
} }
virtual void AddChar(uniChar_t unicodeData) {}; virtual void AddChar(uniChar_t unicodeData) {};
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent) {}; virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent) {};
virtual void MouseSelectFromCursorTo(Vector2D<float> pos) {}; virtual void MouseSelectFromCursorTo(etk::Vector2D<float> pos) {};
virtual void MouseEvent(Vector2D<float> pos) {}; virtual void MouseEvent(etk::Vector2D<float> pos) {};
virtual void MouseEventDouble(void) {}; virtual void MouseEventDouble(void) {};
virtual void MouseEventTriple(void) {}; virtual void MouseEventTriple(void) {};
virtual void RemoveLine(void) {}; virtual void RemoveLine(void) {};
@ -127,15 +127,15 @@ class Buffer {
// moving with cursor change position: // moving with cursor change position:
private: private:
bool m_updatePositionRequested; //!< if a position xhange in the windows ... bool m_updatePositionRequested; //!< if a position xhange in the windows ...
Vector2D<float> m_maximumSize; //!< current maxSize of the buffer etk::Vector2D<float> m_maximumSize; //!< current maxSize of the buffer
protected: protected:
void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; }; void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; };
void SetMaximumSize(Vector2D<float> maxSize) { m_maximumSize = maxSize; }; void SetMaximumSize(etk::Vector2D<float> maxSize) { m_maximumSize = maxSize; };
public: public:
bool NeedToUpdateDisplayPosition(void); bool NeedToUpdateDisplayPosition(void);
virtual Vector2D<float> GetBorderSize(void); // this is to requested the minimum size for the buffer that is not consider as visible ... virtual etk::Vector2D<float> GetBorderSize(void); // this is to requested the minimum size for the buffer that is not consider as visible ...
virtual Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested); virtual etk::Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
Vector2D<float> GetMaxSize(void) { return m_maximumSize; }; etk::Vector2D<float> GetMaxSize(void) { return m_maximumSize; };
protected: protected:
bool m_fileModify; //!< bool m_fileModify; //!<
// naming // naming

View File

@ -87,7 +87,7 @@ int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
int32_t letterHeight = OOTextNormal.GetHeight(); int32_t letterHeight = OOTextNormal.GetHeight();
#endif #endif
Vector2D<float> textPos; etk::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 ;

View File

@ -214,7 +214,7 @@ void BufferText::DrawLineNumber(ewol::TEXT_DISPLAY_TYPE* OOText, ewol::OObject2D
OOColored->Rectangle( 0, positionY, sizeX+0.5*SEPARATION_SIZE_LINE_NUMBER, sizeY); OOColored->Rectangle( 0, positionY, sizeX+0.5*SEPARATION_SIZE_LINE_NUMBER, sizeY);
OOText->SetColor(ColorizeManager::Get(COLOR_CODE_LINE_NUMBER)); OOText->SetColor(ColorizeManager::Get(COLOR_CODE_LINE_NUMBER));
Vector2D<float> textPos; etk::Vector2D<float> textPos;
textPos.x = 1; textPos.x = 1;
textPos.y = positionY; textPos.y = positionY;
etk::UString tmppp = tmpLineNumber; etk::UString tmppp = tmpLineNumber;
@ -309,7 +309,7 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
// update the display position with the scroll ofset : // update the display position with the scroll ofset :
int32_t displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId); int32_t displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId);
Vector2D<float> maxSize; etk::Vector2D<float> maxSize;
maxSize.x = 0.0; maxSize.x = 0.0;
maxSize.y = m_EdnBuf.NumberOfLines() * letterHeight; maxSize.y = m_EdnBuf.NumberOfLines() * letterHeight;
int32_t nbColoneForLineNumber = GetLineNumberNumberOfElement(); int32_t nbColoneForLineNumber = GetLineNumberNumberOfElement();
@ -415,7 +415,7 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
int32_t drawSize = 0; int32_t drawSize = 0;
// update display position : // update display position :
Vector2D<float> textPos; etk::Vector2D<float> textPos;
textPos.x = pixelX-offsetX; textPos.x = pixelX-offsetX;
textPos.y = y; textPos.y = y;
// update X pos // update X pos
@ -540,7 +540,7 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
int32_t BufferText::GetMousePosition(Vector2D<float> pos) int32_t BufferText::GetMousePosition(etk::Vector2D<float> pos)
{ {
bool inLineDone=false; bool inLineDone=false;
//APPL_DEBUG("try to find in : " << width << "," << height); //APPL_DEBUG("try to find in : " << width << "," << height);
@ -591,7 +591,7 @@ int32_t BufferText::GetMousePosition(Vector2D<float> pos)
* *
*/ */
// TODO : Simplify selection .... // TODO : Simplify selection ....
void BufferText::MouseEvent(Vector2D<float> pos) void BufferText::MouseEvent(etk::Vector2D<float> pos)
{ {
if (true == ewol::IsSetShift() ) { if (true == ewol::IsSetShift() ) {
MouseSelectFromCursorTo(pos); MouseSelectFromCursorTo(pos);
@ -621,7 +621,7 @@ void BufferText::MouseEvent(Vector2D<float> pos)
* @todo : Set the move up and DOWN... * @todo : Set the move up and DOWN...
* *
*/ */
void BufferText::MouseSelectFromCursorTo(Vector2D<float> pos) void BufferText::MouseSelectFromCursorTo(etk::Vector2D<float> pos)
{ {
// Get the caracter mouse position // Get the caracter mouse position
int32_t newPos = GetMousePosition(pos); int32_t newPos = GetMousePosition(pos);
@ -900,11 +900,11 @@ void BufferText::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
* @return --- * @return ---
* *
*/ */
Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested) etk::Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
{ {
centerRequested = m_centerRequested; centerRequested = m_centerRequested;
m_centerRequested = false; m_centerRequested = false;
Vector2D<float> outputPosition; etk::Vector2D<float> outputPosition;
// Display position (Y mode): // Display position (Y mode):
APPL_INFO("change the position : " << m_cursorPos); APPL_INFO("change the position : " << m_cursorPos);
@ -932,7 +932,7 @@ Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
/* if we request a center : /* if we request a center :
} else { } else {
// center the line at the middle of the screen : // center the line at the middle of the screen :
Vector2D<float> outputPosition; etk::Vector2D<float> outputPosition;
//APPL_DEBUG(" -------------------------------------------------"); //APPL_DEBUG(" -------------------------------------------------");
outputPosition.y = m_EdnBuf.CountLines(0, m_cursorPos); outputPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
//APPL_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << outputPosition.y); //APPL_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << outputPosition.y);

View File

@ -70,8 +70,8 @@ class BufferText : public Buffer {
#endif #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(etk::Vector2D<float> pos);
void MouseEvent(Vector2D<float> pos); void MouseEvent(etk::Vector2D<float> pos);
void MouseEventDouble(void); void MouseEventDouble(void);
void MouseEventTriple(void); void MouseEventTriple(void);
@ -100,7 +100,7 @@ class BufferText : public Buffer {
// Direct buffer IO // Direct buffer IO
EdnBuf m_EdnBuf; //!< buffer associated on this displayer EdnBuf m_EdnBuf; //!< buffer associated on this displayer
Vector2D<float> m_displaySize; //!< number of char displayable in the screan etk::Vector2D<float> m_displaySize; //!< number of char displayable in the screan
// Cursor : // Cursor :
int32_t m_cursorPos; //!< position in the buffer of the cursor int32_t m_cursorPos; //!< position in the buffer of the cursor
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ... int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
@ -112,13 +112,13 @@ class BufferText : public Buffer {
private: private:
bool m_centerRequested; bool m_centerRequested;
public: public:
virtual Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested); virtual etk::Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
private: private:
bool TextDMoveUp(int32_t offset); bool TextDMoveUp(int32_t offset);
bool TextDMoveDown(int32_t offset); bool TextDMoveDown(int32_t offset);
void SetInsertPosition(int32_t newPosition, bool insertChar = false); void SetInsertPosition(int32_t newPosition, bool insertChar = false);
int32_t GetMousePosition(Vector2D<float> pos); int32_t GetMousePosition(etk::Vector2D<float> pos);
void DrawLineNumber(ewol::TEXT_DISPLAY_TYPE* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY); void DrawLineNumber(ewol::TEXT_DISPLAY_TYPE* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
void DrawCursor(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip); void DrawCursor(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip);

View File

@ -104,7 +104,7 @@ CodeView::~CodeView(void)
*/ */
void CodeView::UpdateNumberOfLineReference(int32_t bufferID) void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
{ {
Vector2D<float> tmpCoord; etk::Vector2D<float> tmpCoord;
tmpCoord.x = 0; tmpCoord.x = 0;
tmpCoord.y = 0; tmpCoord.y = 0;
if (m_lineNumberList.Size()<=bufferID) { if (m_lineNumberList.Size()<=bufferID) {
@ -170,10 +170,10 @@ void CodeView::OnRegenerateDisplay(void)
if(true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) { if(true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) {
Vector2D<float> borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize(); etk::Vector2D<float> borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
bool centerRequested = false; bool centerRequested = false;
// TODO : set it back ... // TODO : set it back ...
Vector2D<float> currentPosition = BufferManager::Get(m_bufferID)->GetPosition(999/*m_OObjectTextNormal.GetFontID()*/, centerRequested); etk::Vector2D<float> currentPosition = BufferManager::Get(m_bufferID)->GetPosition(999/*m_OObjectTextNormal.GetFontID()*/, centerRequested);
SetScrollingPositionDynamic(borderWidth, currentPosition, centerRequested); SetScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
} // else : nothing to do ... } // else : nothing to do ...
@ -243,13 +243,13 @@ void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID)
* @return true the event is used * @return true the event is used
* @return false the event is not used * @return false the event is not used
*/ */
bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos) bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos)
{ {
Vector2D<float> relativePos = RelativePosition(pos); etk::Vector2D<float> relativePos = RelativePosition(pos);
// corection for the openGl abstraction // corection for the openGl abstraction
//relativePos.y = m_size.y - relativePos.y; //relativePos.y = m_size.y - relativePos.y;
Vector2D<float> limitedPos = relativePos; etk::Vector2D<float> limitedPos = relativePos;
limitedPos.x = etk_avg(1, limitedPos.x, m_size.x-1); limitedPos.x = etk_avg(1, limitedPos.x, m_size.x-1);
limitedPos.y = etk_avg(1, limitedPos.y, m_size.y-1); limitedPos.y = etk_avg(1, limitedPos.y, m_size.y-1);

View File

@ -58,7 +58,7 @@ class CodeView :public ewol::WidgetScrooled
draw::Color m_textColorBg; //!< Background color draw::Color m_textColorBg; //!< Background color
int32_t m_bufferID; int32_t m_bufferID;
bool m_buttunOneSelected; bool m_buttunOneSelected;
etk::Vector<Vector2D<float> > m_lineNumberList; etk::Vector<etk::Vector2D<float> > m_lineNumberList;
void UpdateNumberOfLineReference(int32_t bufferID); void UpdateNumberOfLineReference(int32_t bufferID);
// drawing elements : // drawing elements :
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD #ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
@ -91,7 +91,7 @@ class CodeView :public ewol::WidgetScrooled
* @return true the event is used * @return true the event is used
* @return false the event is not used * @return false the event is not used
*/ */
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos); virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos);
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent); virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
/** /**

View File

@ -42,7 +42,7 @@ extern "C" {
} colorInformation_ts; } colorInformation_ts;
} }
#include <etk/File.h> #include <etk/os/File.h>
#include <HighlightPattern.h> #include <HighlightPattern.h>
#include <Colorize.h> #include <Colorize.h>
#include <EdnVectorBuf.h> #include <EdnVectorBuf.h>

View File

@ -23,6 +23,7 @@
******************************************************************************* *******************************************************************************
*/ */
#include <etk/Types.h>
#include <etk/UString.h> #include <etk/UString.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/eObject/EObject.h> #include <ewol/eObject/EObject.h>
@ -30,7 +31,7 @@
#include <appl/Debug.h> #include <appl/Debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <etk/File.h> #include <etk/os/File.h>
#include <etk/tool.h> #include <etk/tool.h>
#include <Gui/MainWindows.h> #include <Gui/MainWindows.h>
#include <BufferManager.h> #include <BufferManager.h>
@ -64,7 +65,7 @@ void APP_Init(void)
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)"); APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
#endif #endif
#endif #endif
ewol::ChangeSize(Vector2D<int32_t>(800, 600)); ewol::ChangeSize(etk::Vector2D<int32_t>(800, 600));
etk::InitDefaultFolder(PROJECT_NAME); etk::InitDefaultFolder(PROJECT_NAME);
ewol::font::SetDefaultFont("Font/freefont/FreeSerif.ttf"); ewol::font::SetDefaultFont("Font/freefont/FreeSerif.ttf");