[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;
}
Vector2D<float> Buffer::GetBorderSize(void)
etk::Vector2D<float> Buffer::GetBorderSize(void)
{
Vector2D<float> tmpVal;
etk::Vector2D<float> tmpVal;
tmpVal.x = 30;
tmpVal.y = 30;
return tmpVal;
}
Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested)
etk::Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested)
{
centerRequested = false;
Vector2D<float> tmpVal;
etk::Vector2D<float> tmpVal;
tmpVal.x = 0;
tmpVal.y = 0;
return tmpVal;

View File

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

View File

@ -87,7 +87,7 @@ int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
int32_t letterHeight = OOTextNormal.GetHeight();
#endif
Vector2D<float> textPos;
etk::Vector2D<float> textPos;
textPos.x = 20;
textPos.y = sizeY - 20 - letterHeight;
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);
OOText->SetColor(ColorizeManager::Get(COLOR_CODE_LINE_NUMBER));
Vector2D<float> textPos;
etk::Vector2D<float> textPos;
textPos.x = 1;
textPos.y = positionY;
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 :
int32_t displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId);
Vector2D<float> maxSize;
etk::Vector2D<float> maxSize;
maxSize.x = 0.0;
maxSize.y = m_EdnBuf.NumberOfLines() * letterHeight;
int32_t nbColoneForLineNumber = GetLineNumberNumberOfElement();
@ -415,7 +415,7 @@ int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
int32_t drawSize = 0;
// update display position :
Vector2D<float> textPos;
etk::Vector2D<float> textPos;
textPos.x = pixelX-offsetX;
textPos.y = y;
// 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;
//APPL_DEBUG("try to find in : " << width << "," << height);
@ -591,7 +591,7 @@ int32_t BufferText::GetMousePosition(Vector2D<float> pos)
*
*/
// TODO : Simplify selection ....
void BufferText::MouseEvent(Vector2D<float> pos)
void BufferText::MouseEvent(etk::Vector2D<float> pos)
{
if (true == ewol::IsSetShift() ) {
MouseSelectFromCursorTo(pos);
@ -621,7 +621,7 @@ void BufferText::MouseEvent(Vector2D<float> pos)
* @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
int32_t newPos = GetMousePosition(pos);
@ -900,11 +900,11 @@ void BufferText::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
* @return ---
*
*/
Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
etk::Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
{
centerRequested = m_centerRequested;
m_centerRequested = false;
Vector2D<float> outputPosition;
etk::Vector2D<float> outputPosition;
// Display position (Y mode):
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 :
} else {
// center the line at the middle of the screen :
Vector2D<float> outputPosition;
etk::Vector2D<float> outputPosition;
//APPL_DEBUG(" -------------------------------------------------");
outputPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
//APPL_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << outputPosition.y);

View File

@ -70,8 +70,8 @@ class BufferText : public Buffer {
#endif
void AddChar(uniChar_t unicodeData);
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
void MouseSelectFromCursorTo(Vector2D<float> pos);
void MouseEvent(Vector2D<float> pos);
void MouseSelectFromCursorTo(etk::Vector2D<float> pos);
void MouseEvent(etk::Vector2D<float> pos);
void MouseEventDouble(void);
void MouseEventTriple(void);
@ -100,7 +100,7 @@ class BufferText : public Buffer {
// Direct buffer IO
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 :
int32_t m_cursorPos; //!< position in the buffer of the cursor
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
@ -112,13 +112,13 @@ class BufferText : public Buffer {
private:
bool m_centerRequested;
public:
virtual Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
virtual etk::Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
private:
bool TextDMoveUp(int32_t offset);
bool TextDMoveDown(int32_t offset);
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 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)
{
Vector2D<float> tmpCoord;
etk::Vector2D<float> tmpCoord;
tmpCoord.x = 0;
tmpCoord.y = 0;
if (m_lineNumberList.Size()<=bufferID) {
@ -170,10 +170,10 @@ void CodeView::OnRegenerateDisplay(void)
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;
// 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);
} // else : nothing to do ...
@ -243,13 +243,13 @@ void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID)
* @return true the event is 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
//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.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
int32_t m_bufferID;
bool m_buttunOneSelected;
etk::Vector<Vector2D<float> > m_lineNumberList;
etk::Vector<etk::Vector2D<float> > m_lineNumberList;
void UpdateNumberOfLineReference(int32_t bufferID);
// drawing elements :
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
@ -91,7 +91,7 @@ class CodeView :public ewol::WidgetScrooled
* @return true the event is 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 OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
/**

View File

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

View File

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