[DEV] Try to simplify the text editor with the buffer system ==> step 1 : remove the multiple type of buffer (text & empty)
This commit is contained in:
parent
37bbf8fccb
commit
cc9fe3ac3f
@ -1,140 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file Buffer.c
|
||||
* @brief Editeur De N'ours : Text Buffer
|
||||
* @author Edouard DUPIN
|
||||
* @date 08/12/2010
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <Buffer.h>
|
||||
#include <BufferManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "Buffer"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
Buffer::Buffer()
|
||||
{
|
||||
static int32_t fileBasicID = 0;
|
||||
m_updatePositionRequested = false;
|
||||
m_fileModify = true;
|
||||
m_haveName = false;
|
||||
etk::UString mString = "Untitle - ";
|
||||
mString += fileBasicID++;
|
||||
EWOL_DEBUG("Create buffer try name : \"" << mString << "\"");
|
||||
SetFileName(mString);
|
||||
m_haveName = false;
|
||||
EWOL_DEBUG("Create buffer with name : " << m_fileName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
Buffer::Buffer(etk::FSNode &newName)
|
||||
{
|
||||
m_fileModify = false;
|
||||
EWOL_DEBUG("Create buffer try name : \"" << newName << "\"");
|
||||
SetFileName(newName);
|
||||
EWOL_DEBUG("Create buffer with name : " << m_fileName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
Buffer::~Buffer(void)
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
bool Buffer::IsModify(void)
|
||||
{
|
||||
return m_fileModify;
|
||||
}
|
||||
|
||||
void Buffer::SetModify(bool status)
|
||||
{
|
||||
if (status != m_fileModify) {
|
||||
m_fileModify = status;
|
||||
// TODO : Remove from here
|
||||
etk::UString data = "Modify";
|
||||
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgBufferState, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
bool Buffer::NeedToUpdateDisplayPosition(void)
|
||||
{
|
||||
bool tmpVal = m_updatePositionRequested;
|
||||
m_updatePositionRequested = false;
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
etk::Vector2D<float> Buffer::GetBorderSize(void)
|
||||
{
|
||||
etk::Vector2D<float> tmpVal;
|
||||
tmpVal.x = 30;
|
||||
tmpVal.y = 30;
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
|
||||
etk::Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested)
|
||||
{
|
||||
centerRequested = false;
|
||||
etk::Vector2D<float> tmpVal;
|
||||
tmpVal.x = 0;
|
||||
tmpVal.y = 0;
|
||||
return tmpVal;
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file Buffer.h
|
||||
* @brief Editeur De N'ours : Text Buffer (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 08/12/2010
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BUFFER_H__
|
||||
#define __BUFFER_H__
|
||||
|
||||
#include <etk/UString.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <etk/unicode.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
|
||||
|
||||
typedef struct{
|
||||
uint32_t nbTotalLine; //!< Number of line in the buffer
|
||||
uint32_t nbTotalColomn; //!< Number of line in the buffer
|
||||
uint32_t startLineDisplay; //!< First line display.
|
||||
uint32_t startColomnDisplay; //!< First Colomn displayed
|
||||
uint32_t diplayableColomn; //!< NB colomn that can be displayed
|
||||
uint32_t diplayableLine; //!< NB Line that can be displayed
|
||||
}infoStatBuffer_ts;
|
||||
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer(void);
|
||||
Buffer(etk::FSNode &newName);
|
||||
virtual ~Buffer(void);
|
||||
|
||||
etk::FSNode GetFileName(void)
|
||||
{
|
||||
return m_fileName;
|
||||
};
|
||||
|
||||
void SetFileName(etk::FSNode &newName)
|
||||
{
|
||||
m_fileName = newName;
|
||||
m_haveName = true;
|
||||
NameChange();
|
||||
};
|
||||
|
||||
void SetFileName(etk::UString &newName)
|
||||
{
|
||||
m_fileName.SetName(newName);
|
||||
m_haveName = true;
|
||||
NameChange();
|
||||
};
|
||||
|
||||
bool HaveName(void)
|
||||
{
|
||||
return m_haveName;
|
||||
}
|
||||
|
||||
virtual void Save(void) {};
|
||||
bool IsModify(void);
|
||||
protected:
|
||||
void SetModify(bool status);
|
||||
virtual void NameChange(void) { /*APPL_DEBUG("check name change ==> no HL change possible");*/};
|
||||
public:
|
||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate) {};
|
||||
virtual void SetLineDisplay(uint32_t lineNumber) {};
|
||||
virtual int32_t Display(ewol::Text& OOText,
|
||||
ewol::Drawing& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
{
|
||||
return ERR_NONE;
|
||||
}
|
||||
virtual void AddChar(uniChar_t unicodeData) {};
|
||||
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent) {};
|
||||
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) {};
|
||||
virtual void SelectAll(void) {};
|
||||
virtual void SelectNone(void) {};
|
||||
virtual void Undo(void) {};
|
||||
virtual void Redo(void) {};
|
||||
virtual void SetCharset(unicode::charset_te newCharset) {};
|
||||
|
||||
//virtual void SelectAll(void);
|
||||
virtual void Copy(ewol::clipBoard::clipboardListe_te clipboardID) {};
|
||||
virtual void Cut(ewol::clipBoard::clipboardListe_te clipboardID) {};
|
||||
virtual void Paste(ewol::clipBoard::clipboardListe_te clipboardID) {};
|
||||
virtual void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp) {};
|
||||
virtual void Replace(etk::UString &data) {};
|
||||
virtual int32_t FindLine(etk::UString &data) { return 0; };
|
||||
virtual void JumpAtLine(int32_t newLine) {};
|
||||
virtual int32_t GetCurrentLine(void) { return 0; };
|
||||
|
||||
virtual int32_t GetNumberOfLine(void) { return 1; };
|
||||
|
||||
// moving with cursor change position:
|
||||
private:
|
||||
bool m_updatePositionRequested; //!< if a position xhange in the windows ...
|
||||
etk::Vector2D<float> m_maximumSize; //!< current maxSize of the buffer
|
||||
protected:
|
||||
void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; };
|
||||
void SetMaximumSize(etk::Vector2D<float> maxSize) { m_maximumSize = maxSize; };
|
||||
public:
|
||||
bool NeedToUpdateDisplayPosition(void);
|
||||
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
|
||||
etk::FSNode m_fileName; //!< filename of the curent buffer
|
||||
bool m_haveName; //!< to know if the file have a name or NOT
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,109 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file BufferEmpty.cpp
|
||||
* @brief Editeur De N'ours : Text Buffer (edit For No buffer Display)
|
||||
* @author Edouard DUPIN
|
||||
* @date 19/01/2011
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <BufferEmpty.h>
|
||||
#include <ColorizeManager.h>
|
||||
#include <MainWindows.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "BufferEmpty"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
BufferEmpty::BufferEmpty()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
BufferEmpty::~BufferEmpty(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
int32_t BufferEmpty::Display(ewol::Text& OOText,
|
||||
ewol::Drawing& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
{
|
||||
// Get color :
|
||||
Colorize *myColor = NULL;
|
||||
|
||||
etk::Vector3D<float> tmpLetterSize = OOText.CalculateSize((uniChar_t)'A');
|
||||
int32_t letterHeight = tmpLetterSize.y;
|
||||
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = 20;
|
||||
textPos.y = sizeY - 20 - letterHeight;
|
||||
etk::UString tmpDisplay ;
|
||||
|
||||
myColor = ColorizeManager::Get("normal");
|
||||
tmpDisplay = "edn - Editeur De N'ours";
|
||||
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.SetPos(etk::Vector3D<float>(textPos.x, textPos.y, 0.0f) );
|
||||
OOText.SetFontMode(ewol::font::Bold);
|
||||
OOText.Print(tmpDisplay);
|
||||
|
||||
myColor = ColorizeManager::Get("commentDoxygen");
|
||||
textPos.y = (int32_t)(textPos.y - letterHeight*1.30);
|
||||
tmpDisplay = "No Buffer Availlable to display";
|
||||
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.SetPos(etk::Vector3D<float>(textPos.x, textPos.y, 0.0f) );
|
||||
OOText.SetFontMode(ewol::font::Regular);
|
||||
OOText.Print(tmpDisplay);
|
||||
|
||||
OOColored.SetColor(draw::color::white);
|
||||
OOText.SetPos(etk::Vector3D<float>(0.0f, 0.0f, 0.0f) );
|
||||
OOColored.RectangleWidth(etk::Vector3D<float>((float)sizeX, (float)sizeY, 0.0f) );
|
||||
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file BufferEmpty.h
|
||||
* @brief Editeur De N'ours : Text Buffer (edit For No buffer Display) (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 19/01/2011
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __BUFFER_EMPTY_H__
|
||||
#define __BUFFER_EMPTY_H__
|
||||
|
||||
#include <Buffer.h>
|
||||
|
||||
class BufferEmpty : public Buffer {
|
||||
public:
|
||||
BufferEmpty(void);
|
||||
virtual ~BufferEmpty(void);
|
||||
int32_t Display(ewol::Text& OOText,
|
||||
ewol::Drawing& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ class classBufferManager: public ewol::EObject
|
||||
public:
|
||||
int32_t GetSelected(void) { return m_idSelected;};
|
||||
//void SetSelected(int32_t id) {m_idSelected = id;};
|
||||
Buffer * Get(int32_t BufferID);
|
||||
BufferText* Get(int32_t BufferID);
|
||||
bool Exist(int32_t BufferID);
|
||||
bool Exist(etk::FSNode &myFile);
|
||||
int32_t GetId(etk::FSNode &myFile);
|
||||
@ -80,11 +80,10 @@ class classBufferManager: public ewol::EObject
|
||||
|
||||
private:
|
||||
|
||||
etk::Vector<Buffer*> listBuffer; //!< element List of the char Elements
|
||||
etk::Vector<BufferText*> listBuffer; //!< element List of the char Elements
|
||||
|
||||
void RemoveAll(void); //!< remove all buffer
|
||||
int32_t m_idSelected;
|
||||
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
|
||||
};
|
||||
|
||||
|
||||
@ -99,8 +98,6 @@ class classBufferManager: public ewol::EObject
|
||||
*/
|
||||
classBufferManager::classBufferManager(void)
|
||||
{
|
||||
// nothing to do ...
|
||||
BufferNotExiste = new BufferEmpty();
|
||||
m_idSelected = -1;
|
||||
RegisterMultiCast(ednMsgGuiNew);
|
||||
RegisterMultiCast(ednMsgOpenFile);
|
||||
@ -126,8 +123,6 @@ classBufferManager::~classBufferManager(void)
|
||||
// clear The list of Buffer
|
||||
APPL_INFO("~classBufferManager::listBuffer.Clear();");
|
||||
listBuffer.Clear();
|
||||
APPL_INFO("~classBufferManager::delete(BufferNotExiste);");
|
||||
delete(BufferNotExiste);
|
||||
}
|
||||
|
||||
|
||||
@ -325,7 +320,7 @@ void classBufferManager::RemoveAll(void)
|
||||
int32_t classBufferManager::Create(void)
|
||||
{
|
||||
// allocate a new Buffer
|
||||
Buffer *myBuffer = new BufferText();
|
||||
BufferText *myBuffer = new BufferText();
|
||||
// Add at the list of element
|
||||
listBuffer.PushBack(myBuffer);
|
||||
int32_t basicID = listBuffer.Size() - 1;
|
||||
@ -347,7 +342,7 @@ int32_t classBufferManager::Open(etk::FSNode &myFile)
|
||||
{
|
||||
if (false == Exist(myFile)) {
|
||||
// allocate a new Buffer
|
||||
Buffer *myBuffer = new BufferText(myFile);
|
||||
BufferText *myBuffer = new BufferText(myFile);
|
||||
// Add at the list of element
|
||||
listBuffer.PushBack(myBuffer);
|
||||
return listBuffer.Size() - 1;
|
||||
@ -359,11 +354,11 @@ int32_t classBufferManager::Open(etk::FSNode &myFile)
|
||||
|
||||
|
||||
|
||||
Buffer * classBufferManager::Get(int32_t BufferID)
|
||||
BufferText * classBufferManager::Get(int32_t BufferID)
|
||||
{
|
||||
// possible special case : -1;
|
||||
if (-1 >= BufferID) {
|
||||
return BufferNotExiste;
|
||||
return NULL;
|
||||
}
|
||||
// check if the Buffer existed
|
||||
if (BufferID < listBuffer.Size()) {
|
||||
@ -376,7 +371,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
|
||||
} else {
|
||||
APPL_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
|
||||
}
|
||||
return BufferNotExiste;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -543,7 +538,7 @@ int32_t BufferManager::GetSelected(void)
|
||||
return localManager->GetSelected();
|
||||
}
|
||||
|
||||
Buffer * BufferManager::Get(int32_t BufferID)
|
||||
BufferText * BufferManager::Get(int32_t BufferID)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
|
||||
|
@ -26,9 +26,7 @@
|
||||
#ifndef __BUFFER_MANAGER_H__
|
||||
#define __BUFFER_MANAGER_H__
|
||||
|
||||
#include <Buffer.h>
|
||||
#include <BufferText.h>
|
||||
#include <BufferEmpty.h>
|
||||
#include <appl/globalMsg.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
@ -37,7 +35,7 @@ namespace BufferManager
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
int32_t GetSelected(void);
|
||||
Buffer * Get(int32_t BufferID);
|
||||
BufferText* Get(int32_t BufferID);
|
||||
bool Exist(int32_t BufferID);
|
||||
bool Exist(etk::FSNode &myFile);
|
||||
int32_t GetId(etk::FSNode &myFile);
|
||||
|
@ -93,6 +93,56 @@ void BufferText::NameChange(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
bool BufferText::IsModify(void)
|
||||
{
|
||||
return m_fileModify;
|
||||
}
|
||||
|
||||
void BufferText::SetModify(bool status)
|
||||
{
|
||||
if (status != m_fileModify) {
|
||||
m_fileModify = status;
|
||||
// TODO : Remove from here
|
||||
etk::UString data = "Modify";
|
||||
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgBufferState, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
bool BufferText::NeedToUpdateDisplayPosition(void)
|
||||
{
|
||||
bool tmpVal = m_updatePositionRequested;
|
||||
m_updatePositionRequested = false;
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
etk::Vector2D<float> BufferText::GetBorderSize(void)
|
||||
{
|
||||
etk::Vector2D<float> tmpVal;
|
||||
tmpVal.x = 30;
|
||||
tmpVal.y = 30;
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
@ -103,6 +153,18 @@ void BufferText::NameChange(void)
|
||||
*/
|
||||
BufferText::BufferText()
|
||||
{
|
||||
|
||||
static int32_t fileBasicID = 0;
|
||||
m_updatePositionRequested = false;
|
||||
m_fileModify = true;
|
||||
m_haveName = false;
|
||||
etk::UString mString = "Untitle - ";
|
||||
mString += fileBasicID++;
|
||||
EWOL_DEBUG("Create buffer try name : \"" << mString << "\"");
|
||||
SetFileName(mString);
|
||||
m_haveName = false;
|
||||
EWOL_DEBUG("Create buffer with name : " << m_fileName );
|
||||
|
||||
BasicInit();
|
||||
SetModify(true);
|
||||
APPL_INFO("New(Empty-Buffer)");
|
||||
@ -117,8 +179,13 @@ BufferText::BufferText()
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
BufferText::BufferText(etk::FSNode &fileName) : Buffer(fileName)
|
||||
BufferText::BufferText(etk::FSNode &fileName)
|
||||
{
|
||||
m_fileModify = false;
|
||||
EWOL_DEBUG("Create buffer try name : \"" << fileName << "\"");
|
||||
SetFileName(fileName);
|
||||
EWOL_DEBUG("Create buffer with name : " << m_fileName );
|
||||
|
||||
BasicInit();
|
||||
NameChange();
|
||||
APPL_INFO("Add Data from file(" << GetFileName() << ")");
|
||||
@ -206,7 +273,7 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
|
||||
|
||||
#define SEPARATION_SIZE_LINE_NUMBER (3)
|
||||
|
||||
void BufferText::DrawLineNumber(ewol::Text* OOText, ewol::Drawing* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY)
|
||||
void BufferText::DrawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY)
|
||||
{
|
||||
char tmpLineNumber[50];
|
||||
sprintf(tmpLineNumber, "%*d", nbColomn, lineNumber);
|
||||
@ -216,23 +283,6 @@ void BufferText::DrawLineNumber(ewol::Text* OOText, ewol::Drawing* OOColored, in
|
||||
OOText->Print(tmpLineNumber);
|
||||
}
|
||||
|
||||
#define CURSOR_WIDTH (5)
|
||||
#define CURSOR_THICKNESS (1.2)
|
||||
void BufferText::DrawCursor(ewol::Drawing* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth)//, clipping_ts &clip)
|
||||
{
|
||||
/*
|
||||
draw::Color & tmpppppp = ColorizeManager::Get(COLOR_CODE_CURSOR);
|
||||
OOColored->SetColor(tmpppppp);
|
||||
if (true == ewol::IsSetInsert()) {
|
||||
OOColored->Rectangle( x, y, letterWidth, letterHeight);
|
||||
} else {
|
||||
OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y) , (int32_t)(x+CURSOR_WIDTH), (int32_t)(y) , CURSOR_THICKNESS);
|
||||
OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), (int32_t)(x+CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS);
|
||||
OOColored->Line( (int32_t)(x) , (int32_t)(y) , (int32_t)(x) , (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief get the number of colomn neede to display lineNumber
|
||||
@ -275,69 +325,10 @@ int32_t BufferText::GetNumberOfLine(void)
|
||||
*
|
||||
*/
|
||||
int32_t BufferText::Display(ewol::Text& OOText,
|
||||
ewol::Drawing& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY)
|
||||
{
|
||||
OOColored.SetPos(etk::Vector3D<float>(-2048, -2048, 0));
|
||||
OOColored.SetColor(ColorizeManager::Get(COLOR_CODE_BASIC_BG));
|
||||
OOColored.RectangleWidth(etk::Vector3D<float>(4096, 4096, 0) );
|
||||
|
||||
# if 0
|
||||
|
||||
|
||||
OOText.SetColor(0x000000FF);
|
||||
OOText.SetColorBg(0x00000000);
|
||||
OOText.Translate(etk::Vector3D<float>(0,sizeY,0) );
|
||||
OOText.SetPos(etk::Vector3D<float>(0,0,0));
|
||||
// the text is all the time writtent upper (due top the openGL system ==> the the first line must be written under ...
|
||||
OOText.ForceLineReturn();
|
||||
// This is use to generate an automatic return when \n is done ... ==> this permit to not know the line height ...
|
||||
OOText.SetTextAlignement(0, sizeX, ewol::Text::alignDisable);
|
||||
|
||||
// Generate MawSize
|
||||
/*
|
||||
maxSize.x = 0.0;
|
||||
maxSize.y = m_EdnBuf.NumberOfLines() * OOText.CalculateSize((uniChar_t)'A').y;
|
||||
*/
|
||||
|
||||
// Clear the line intexation :
|
||||
m_elmentList.Clear();
|
||||
// every char element is register to find the diplay pos when mouse event arrive
|
||||
CharElement tmpElementProperty;
|
||||
// set the first char :
|
||||
//tmpElementProperty.m_LineOffset = OOText.GetPos().y;
|
||||
//tmpElementProperty.m_bufferPos = displayStartBufferPos;
|
||||
//m_elmentList.PushBack(tmpElementProperty);
|
||||
|
||||
|
||||
int32_t displayStartLineId = (float)offsetY / OOText.CalculateSize((uniChar_t)'A').y;
|
||||
// the ofsset is all time negative ...
|
||||
displayStartLineId = etk_max(0, displayStartLineId);
|
||||
APPL_DEBUG(" request offset : " << offsetY << " ==> " << displayStartLineId);
|
||||
// update the display position with the scroll ofset :
|
||||
int32_t currentLineStartPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId);
|
||||
int32_t findPos;
|
||||
etk::UString lineText;
|
||||
while (true == m_EdnBuf.SearchForward(currentLineStartPos, '\n', &findPos) ) {
|
||||
// remember the start line display position in the buffer
|
||||
tmpElementProperty.m_bufferPos = currentLineStartPos;
|
||||
// we did not copy the \n
|
||||
m_EdnBuf.GetRange(currentLineStartPos, findPos-1, lineText);
|
||||
// update the next extract position with the \n removed
|
||||
currentLineStartPos = findPos+1;
|
||||
OOText.Print(lineText);
|
||||
// Remember the last position of the current Line :
|
||||
tmpElementProperty.m_LineOffset = OOText.GetPos().y;
|
||||
// element list is used to manage the current line position
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
|
||||
// go to the start of the line ...
|
||||
OOText.ForceLineReturn();
|
||||
}
|
||||
// TODO : Missing the last line ...
|
||||
|
||||
#else
|
||||
|
||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||
bool selIsRect;
|
||||
@ -400,9 +391,8 @@ int32_t BufferText::Display(ewol::Text& OOText,
|
||||
y = sizeY - y;
|
||||
y -= letterHeight;
|
||||
|
||||
OOColored.SetClippingMode(false);
|
||||
OOText.SetClippingMode(false);
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
DrawLineNumber(&OOText, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||
|
||||
clipping_ts drawClipping;
|
||||
@ -413,8 +403,6 @@ int32_t BufferText::Display(ewol::Text& OOText,
|
||||
|
||||
OOText.SetClippingWidth(etk::Vector3D<float>((float)pixelX, 0.0f, -0.5f),
|
||||
etk::Vector3D<float>((float)(sizeX - drawClipping.x), (float)sizeY, 0.5f) );
|
||||
OOColored.SetClippingWidth(etk::Vector3D<float>(0.0f, 0.0f, -0.5f),
|
||||
etk::Vector3D<float>((float)sizeX, (float)sizeY, 0.5f) );
|
||||
|
||||
// Clear the line intexation :
|
||||
m_elmentList.Clear();
|
||||
@ -426,6 +414,8 @@ int32_t BufferText::Display(ewol::Text& OOText,
|
||||
tmpElementProperty.m_bufferPos = displayStartBufferPos;
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
|
||||
etk::Vector3D<float> tmpCursorPosition(0, 0, -1); //Cursor is display only at the end to be all time over the background ... (-1 in z no cursor)
|
||||
|
||||
float lineMaxSize = 0.0;
|
||||
for (iii=displayStartBufferPos; iii<mylen && displayLines >=0 && y >= -2*letterHeight; iii = new_i) {
|
||||
//APPL_DEBUG("display pos =" << y);
|
||||
@ -455,21 +445,23 @@ int32_t BufferText::Display(ewol::Text& OOText,
|
||||
}
|
||||
}
|
||||
OOText.SetColorBg(draw::color::none);
|
||||
if( true == selHave
|
||||
&& selStart <= iii
|
||||
&& selEnd > iii)
|
||||
if( true == selHave
|
||||
&& selStart <= iii
|
||||
&& selEnd > iii)
|
||||
{
|
||||
selectColor = myColorSel;
|
||||
OOText.SetColorBg(selectColor->GetBG() );
|
||||
} else {
|
||||
if( ' ' == currentChar
|
||||
&& true == globals::IsSetDisplaySpaceChar() )
|
||||
{
|
||||
OOText.SetColorBg(myColorSpace);
|
||||
} else if( '\t' == currentChar
|
||||
&& true == globals::IsSetDisplaySpaceChar() )
|
||||
{
|
||||
OOText.SetColorBg(myColorTab);
|
||||
if(false == selectColor->HaveBg()) {
|
||||
if( (uniChar_t)' ' == currentChar
|
||||
&& true == globals::IsSetDisplaySpaceChar() )
|
||||
{
|
||||
OOText.SetColorBg(myColorSpace);
|
||||
} else if( '\t' == currentChar
|
||||
&& true == globals::IsSetDisplayTabChar() )
|
||||
{
|
||||
OOText.SetColorBg(myColorTab);
|
||||
}
|
||||
} else {
|
||||
OOText.SetColorBg(selectColor->GetBG());
|
||||
}
|
||||
@ -491,8 +483,7 @@ int32_t BufferText::Display(ewol::Text& OOText,
|
||||
idX += displaywidth;
|
||||
// display cursor :
|
||||
if (m_cursorPos == iii) {
|
||||
// display the cursor:
|
||||
DrawCursor(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth);
|
||||
tmpCursorPosition = etk::Vector3D<float>(pixelX - offsetX, y, 0);
|
||||
}
|
||||
lineMaxSize += drawSize;
|
||||
pixelX += drawSize;
|
||||
@ -506,36 +497,32 @@ int32_t BufferText::Display(ewol::Text& OOText,
|
||||
//APPL_DEBUG("display pos =" << y);
|
||||
displayLines++;
|
||||
currentLineID++;
|
||||
OOColored.SetClippingMode(false);
|
||||
OOText.SetClippingMode(false);
|
||||
OOText.SetFontBold(false);
|
||||
OOText.SetFontItalic(false);
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
DrawLineNumber(&OOText, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOText.SetClippingMode(true);
|
||||
OOColored.SetClippingMode(true);
|
||||
// add elements :
|
||||
// add elements :
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
}
|
||||
}
|
||||
//APPL_DEBUG("end at pos buf =" << iii << " / " << m_EdnBuf.Size());
|
||||
// special case : the cursor is at the end of the buffer...
|
||||
if (m_cursorPos == iii) {
|
||||
DrawCursor(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth);//, drawClippingTextArea);
|
||||
tmpCursorPosition = etk::Vector3D<float>(pixelX - offsetX, y, 0);
|
||||
}
|
||||
if (tmpCursorPosition.z!=-1) {
|
||||
// display the cursor:
|
||||
OOText.SetPos(tmpCursorPosition);
|
||||
OOText.SetColor(ColorizeManager::Get(COLOR_CODE_CURSOR));
|
||||
OOText.SetColorBg(ColorizeManager::Get(COLOR_CODE_CURSOR));
|
||||
OOText.PrintCursor(ewol::IsSetInsert());
|
||||
}
|
||||
// set the maximum size for the display ...
|
||||
SetMaximumSize(maxSize);
|
||||
int64_t stopTime2 = ewol::GetTime();
|
||||
APPL_DEBUG("DRAW text (brut) = " << stopTime2 - stopTime << " micro-s");
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef QSDFQSDFSDFQS_QSDFQSDf_QSDFQSDF___QSDFQSDFQ
|
||||
@ -777,7 +764,6 @@ int32_t BufferText::GetMousePosition(etk::Vector2D<float> pos)
|
||||
bool inLineDone=false;
|
||||
//APPL_DEBUG("try to find in : " << width << "," << height);
|
||||
for(int32_t iii=0; iii<m_elmentList.Size()-1; iii++) {
|
||||
/*
|
||||
//APPL_DEBUG("check element : " << m_elmentList[iii].m_yOffset << "<= " << pos.y << " <" << (m_elmentList[iii].m_yOffset + m_elmentList[iii].m_ySize));
|
||||
if(false == inLineDone) {
|
||||
if( pos.y>=m_elmentList[iii].m_yOffset
|
||||
@ -799,10 +785,8 @@ int32_t BufferText::GetMousePosition(etk::Vector2D<float> pos)
|
||||
return m_elmentList[iii].m_bufferPos;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
if (m_elmentList.Size()>0) {
|
||||
/*
|
||||
if(pos.y<m_elmentList[m_elmentList.Size()/2].m_yOffset) {
|
||||
//APPL_DEBUG("Error to get position (return Last)");
|
||||
return m_elmentList[m_elmentList.Size()-1].m_bufferPos;
|
||||
@ -810,7 +794,6 @@ int32_t BufferText::GetMousePosition(etk::Vector2D<float> pos)
|
||||
//APPL_DEBUG("Error to get position (return begin)");
|
||||
return m_elmentList[0].m_bufferPos;
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
APPL_CRITICAL("Error to get position (very bad)");
|
||||
return 0;
|
||||
|
@ -26,8 +26,14 @@
|
||||
#ifndef __BUFFER_TEXT_H__
|
||||
#define __BUFFER_TEXT_H__
|
||||
|
||||
#include <etk/UString.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <etk/unicode.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
|
||||
#include "ColorizeManager.h"
|
||||
#include "Buffer.h"
|
||||
#include "EdnBuf.h"
|
||||
|
||||
typedef enum {
|
||||
@ -46,7 +52,58 @@ class CharElement
|
||||
int32_t m_bufferPos;
|
||||
};
|
||||
|
||||
class BufferText : public Buffer {
|
||||
|
||||
typedef struct{
|
||||
uint32_t nbTotalLine; //!< Number of line in the buffer
|
||||
uint32_t nbTotalColomn; //!< Number of line in the buffer
|
||||
uint32_t startLineDisplay; //!< First line display.
|
||||
uint32_t startColomnDisplay; //!< First Colomn displayed
|
||||
uint32_t diplayableColomn; //!< NB colomn that can be displayed
|
||||
uint32_t diplayableLine; //!< NB Line that can be displayed
|
||||
}infoStatBuffer_ts;
|
||||
|
||||
|
||||
class BufferText
|
||||
{
|
||||
private:
|
||||
bool m_fileModify; //!<
|
||||
// naming
|
||||
etk::FSNode m_fileName; //!< filename of the curent buffer
|
||||
bool m_haveName; //!< to know if the file have a name or NOT
|
||||
bool m_updatePositionRequested; //!< if a position xhange in the windows ...
|
||||
etk::Vector2D<float> m_maximumSize; //!< current maxSize of the buffer
|
||||
public:
|
||||
void SetModify(bool status);
|
||||
virtual etk::Vector2D<float> GetBorderSize(void);
|
||||
void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; };
|
||||
void SetMaximumSize(etk::Vector2D<float> maxSize) { m_maximumSize = maxSize; };
|
||||
bool NeedToUpdateDisplayPosition(void);
|
||||
etk::Vector2D<float> GetMaxSize(void) { return m_maximumSize; };
|
||||
bool IsModify(void);
|
||||
public:
|
||||
etk::FSNode GetFileName(void)
|
||||
{
|
||||
return m_fileName;
|
||||
};
|
||||
|
||||
void SetFileName(etk::FSNode &newName)
|
||||
{
|
||||
m_fileName = newName;
|
||||
m_haveName = true;
|
||||
NameChange();
|
||||
};
|
||||
|
||||
void SetFileName(etk::UString &newName)
|
||||
{
|
||||
m_fileName.SetName(newName);
|
||||
m_haveName = true;
|
||||
NameChange();
|
||||
};
|
||||
|
||||
bool HaveName(void)
|
||||
{
|
||||
return m_haveName;
|
||||
}
|
||||
public:
|
||||
BufferText(void);
|
||||
BufferText(etk::FSNode &fileName);
|
||||
@ -56,7 +113,6 @@ class BufferText : public Buffer {
|
||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||
void SetLineDisplay(uint32_t lineNumber);
|
||||
int32_t Display(ewol::Text& OOText,
|
||||
ewol::Drawing& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY);
|
||||
void AddChar(uniChar_t unicodeData);
|
||||
@ -111,8 +167,7 @@ class BufferText : public Buffer {
|
||||
|
||||
int32_t GetMousePosition(etk::Vector2D<float> pos);
|
||||
|
||||
void DrawLineNumber(ewol::Text* OOText, ewol::Drawing* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
|
||||
void DrawCursor(ewol::Drawing* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth);//, clipping_ts &clip);
|
||||
void DrawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
|
||||
|
||||
};
|
||||
|
||||
|
@ -102,13 +102,16 @@ void BufferView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
|
||||
int32_t nbBufferOpen = BufferManager::Size();
|
||||
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
|
||||
if (BufferManager::Exist(iii)) {
|
||||
bool isModify = BufferManager::Get(iii)->IsModify();
|
||||
etk::FSNode name = BufferManager::Get(iii)->GetFileName();
|
||||
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
|
||||
if (NULL != tmpElement) {
|
||||
m_list.PushBack(tmpElement);
|
||||
} else {
|
||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||
BufferText* tmpBuffer = BufferManager::Get(iii);
|
||||
if (NULL != tmpBuffer) {
|
||||
bool isModify = tmpBuffer->IsModify();
|
||||
etk::FSNode name = tmpBuffer->GetFileName();
|
||||
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
|
||||
if (NULL != tmpElement) {
|
||||
m_list.PushBack(tmpElement);
|
||||
} else {
|
||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,12 @@ void CodeView::CalculateMaxSize(void)
|
||||
{
|
||||
m_maxSize.x = 2048;
|
||||
int32_t letterHeight = m_displayText.CalculateSize('A').y;
|
||||
m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight;
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
m_maxSize.y = tmpBuffer->GetNumberOfLine() * letterHeight;
|
||||
} else {
|
||||
m_maxSize.y = 50;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -147,8 +152,15 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
m_displayDrawing.Clear();
|
||||
m_displayText.Clear();
|
||||
|
||||
if(true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) {
|
||||
etk::Vector2D<float> borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
|
||||
// Reset the background :
|
||||
m_displayDrawing.SetPos(etk::Vector3D<float>(-2048, -2048, 0));
|
||||
m_displayDrawing.SetColor(ColorizeManager::Get(COLOR_CODE_BASIC_BG));
|
||||
m_displayDrawing.RectangleWidth(etk::Vector3D<float>(4096, 4096, 0) );
|
||||
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if( NULL != tmpBuffer
|
||||
&& true == tmpBuffer->NeedToUpdateDisplayPosition() ) {
|
||||
etk::Vector2D<float> borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
|
||||
bool centerRequested = false;
|
||||
// TODO : set it back ...
|
||||
etk::Vector2D<float> currentPosition = BufferManager::Get(m_bufferID)->GetPosition(999/*m_OObjectTextNormal.GetFontID()*/, centerRequested);
|
||||
@ -156,12 +168,62 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
} // else : nothing to do ...
|
||||
|
||||
// generate the objects :
|
||||
BufferManager::Get(m_bufferID)->Display(m_displayText,
|
||||
m_displayDrawing,
|
||||
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
// set the current size of the windows
|
||||
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
|
||||
|
||||
if (-1 == m_bufferID) {
|
||||
m_displayText.SetTextAlignement(10, m_size.x-20, ewol::Text::alignLeft);
|
||||
m_displayDrawing.SetColor(0x00000022);
|
||||
m_displayDrawing.SetPos(etk::Vector3D<float>(10, 0, 0));
|
||||
m_displayDrawing.Rectangle(etk::Vector3D<float>((int32_t)m_size.x-20, 1500, 0) );
|
||||
|
||||
m_displayText.SetRelPos(etk::Vector3D<float>(10, 0, 0));
|
||||
// nothing to display :
|
||||
etk::UString tmpString("<html>\n"
|
||||
" <body>\n"
|
||||
" <br/>\n"
|
||||
" <font color=\"red\">\n"
|
||||
" <b>\n"
|
||||
" edn - Editeur De N'ours\n"
|
||||
" </b>\n"
|
||||
" </font>\n"
|
||||
" <br/>\n"
|
||||
" <br/>\n"
|
||||
" <font color=\"indigo\">\n"
|
||||
" <i>\n"
|
||||
" No Buffer Availlable to display\n"
|
||||
" </i>\n"
|
||||
" </font>\n"
|
||||
|
||||
" <br/><br/><br/>\n"
|
||||
" <center>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0000\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement : <br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
" </center>\n"
|
||||
|
||||
" <br/><br/><br/>\n"
|
||||
" <left>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#0F0\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
" </left>\n"
|
||||
|
||||
" <br/><br/><br/>\n"
|
||||
" <right>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#00F\">Jusqu'à ce moment elle<b> n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non! <br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
" </right>\n"
|
||||
|
||||
" <br/><br/><br/>\n"
|
||||
" <justify>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
" </justify>\n"
|
||||
" </body>\n"
|
||||
"</html>\n");
|
||||
m_displayText.SetPos(etk::Vector3D<float>(0.0f, m_size.y, 0.0f) );
|
||||
m_displayText.ForceLineReturn();
|
||||
m_displayText.PrintDecorated(tmpString);
|
||||
} else {
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Display(m_displayText, m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
}
|
||||
// set the current size of the windows
|
||||
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
|
||||
}
|
||||
int64_t stopTime = ewol::GetTime();
|
||||
APPL_DEBUG("Display Code Generation = " << stopTime - startTime << " micro-s");
|
||||
|
||||
@ -175,7 +237,10 @@ bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
|
||||
{
|
||||
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
|
||||
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
||||
BufferManager::Get(m_bufferID)->AddChar(unicodeData);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->AddChar(unicodeData);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
return true;
|
||||
@ -185,7 +250,10 @@ bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
|
||||
bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent)
|
||||
{
|
||||
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
||||
BufferManager::Get(m_bufferID)->cursorMove(moveTypeEvent);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->cursorMove(moveTypeEvent);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
return true;
|
||||
@ -199,7 +267,10 @@ bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveTy
|
||||
*/
|
||||
void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
{
|
||||
BufferManager::Get(m_bufferID)->Paste(clipboardID);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Paste(clipboardID);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
@ -237,27 +308,42 @@ bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::even
|
||||
m_buttunOneSelected = true;
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
// TODO : Set something good
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(limitedPos);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->MouseEvent(limitedPos);
|
||||
}
|
||||
MarkToRedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_buttunOneSelected = false;
|
||||
BufferManager::Get(m_bufferID)->Copy(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Copy(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||
}
|
||||
MarkToRedraw();
|
||||
} else
|
||||
#endif
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
#ifdef __MODE__Touch
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(limitedPos);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->MouseEvent(limitedPos);
|
||||
}
|
||||
MarkToRedraw();
|
||||
#else
|
||||
// nothing to do ...
|
||||
#endif
|
||||
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
||||
BufferManager::Get(m_bufferID)->MouseEventDouble();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->MouseEventDouble();
|
||||
}
|
||||
MarkToRedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
||||
BufferManager::Get(m_bufferID)->MouseEventTriple();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->MouseEventTriple();
|
||||
}
|
||||
MarkToRedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
if (true == m_buttunOneSelected) {
|
||||
@ -272,14 +358,20 @@ bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::even
|
||||
}
|
||||
//APPL_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
|
||||
// TODO : Set something good
|
||||
BufferManager::Get(m_bufferID)->MouseSelectFromCursorTo(limitedPos);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->MouseSelectFromCursorTo(limitedPos);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
} else if (2 == IdInput) {
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
// TODO : Set something good
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(limitedPos);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->MouseEvent(limitedPos);
|
||||
}
|
||||
ewol::clipBoard::Request(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
}
|
||||
@ -320,21 +412,36 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
m_originScrooled = m_lineNumberList[m_bufferID];
|
||||
}
|
||||
} else if (eventId == ednMsgGuiCopy) {
|
||||
BufferManager::Get(m_bufferID)->Copy(ewol::clipBoard::CLIPBOARD_STD);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Copy(ewol::clipBoard::CLIPBOARD_STD);
|
||||
}
|
||||
} else if (eventId == ednMsgGuiCut) {
|
||||
BufferManager::Get(m_bufferID)->Cut(ewol::clipBoard::CLIPBOARD_STD);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Cut(ewol::clipBoard::CLIPBOARD_STD);
|
||||
}
|
||||
} else if (eventId == ednMsgGuiPaste) {
|
||||
ewol::clipBoard::Request(ewol::clipBoard::CLIPBOARD_STD);
|
||||
} else if (eventId == ednMsgGuiUndo) {
|
||||
BufferManager::Get(m_bufferID)->Undo();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Undo();
|
||||
}
|
||||
} else if (eventId == ednMsgGuiRedo) {
|
||||
BufferManager::Get(m_bufferID)->Redo();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Redo();
|
||||
}
|
||||
} else if (eventId == ednMsgGuiRm) {
|
||||
// data : "Word" "Line" "Paragraph"
|
||||
if (data == "Word") {
|
||||
APPL_WARNING(" on event " << eventId << " data=\"" << data << "\" ==> not coded" );
|
||||
} else if (data == "Line") {
|
||||
BufferManager::Get(m_bufferID)->RemoveLine();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->RemoveLine();
|
||||
}
|
||||
} else if (data == "Paragraph") {
|
||||
APPL_WARNING(" on event " << eventId << " data=\"" << data << "\" ==> not coded" );
|
||||
} else {
|
||||
@ -343,20 +450,35 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
} else if (eventId == ednMsgGuiSelect) {
|
||||
// data : "ALL" "NONE"
|
||||
if (data == "ALL") {
|
||||
BufferManager::Get(m_bufferID)->SelectAll();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->SelectAll();
|
||||
}
|
||||
} else if (data == "NONE") {
|
||||
BufferManager::Get(m_bufferID)->SelectNone();
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->SelectNone();
|
||||
}
|
||||
} else {
|
||||
APPL_ERROR(" on event " << eventId << " unknow data=\"" << data << "\"" );
|
||||
}
|
||||
} else if (eventId == ednMsgGuiChangeCharset) {
|
||||
// data : "UTF-8" "ISO-8859-1" "ISO-8859-15"
|
||||
if (data == "UTF-8") {
|
||||
BufferManager::Get(m_bufferID)->SetCharset(unicode::EDN_CHARSET_UTF8);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->SetCharset(unicode::EDN_CHARSET_UTF8);
|
||||
}
|
||||
} else if (data == "ISO-8859-1") {
|
||||
BufferManager::Get(m_bufferID)->SetCharset(unicode::EDN_CHARSET_ISO_8859_1);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_1);
|
||||
}
|
||||
} else if (data == "ISO-8859-15") {
|
||||
BufferManager::Get(m_bufferID)->SetCharset(unicode::EDN_CHARSET_ISO_8859_15);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_15);
|
||||
}
|
||||
} else {
|
||||
APPL_ERROR(" on event " << eventId << " unknow data=\"" << data << "\"" );
|
||||
}
|
||||
@ -364,15 +486,24 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
etk::UString myDataString;
|
||||
SearchData::GetSearch(myDataString);
|
||||
if (data == "Next") {
|
||||
BufferManager::Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
|
||||
}
|
||||
} else if (data == "Previous") {
|
||||
BufferManager::Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
|
||||
}
|
||||
}
|
||||
} else if (eventId == ednMsgGuiReplace) {
|
||||
etk::UString myDataString;
|
||||
SearchData::GetReplace(myDataString);
|
||||
if (data == "Normal") {
|
||||
BufferManager::Get(m_bufferID)->Replace(myDataString);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->Replace(myDataString);
|
||||
}
|
||||
} else if (data == "All") {
|
||||
|
||||
}
|
||||
@ -380,7 +511,10 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
int32_t lineID = 0;
|
||||
sscanf(data.c_str(), "%d", &lineID);
|
||||
APPL_INFO("Goto line : " << lineID);
|
||||
BufferManager::Get(m_bufferID)->JumpAtLine(lineID);
|
||||
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
|
||||
if (NULL!=tmpBuffer) {
|
||||
tmpBuffer->JumpAtLine(lineID);
|
||||
}
|
||||
}
|
||||
// Force redraw of the widget
|
||||
MarkToRedraw();
|
||||
|
@ -289,7 +289,7 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
tmpWidget->SetTitle("Open Files ...");
|
||||
tmpWidget->SetValidateLabel("Open");
|
||||
if (BufferManager::GetSelected()!=-1) {
|
||||
Buffer * myBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
BufferText * myBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
if (NULL!=myBuffer) {
|
||||
etk::FSNode tmpFile = myBuffer->GetFileName();
|
||||
tmpWidget->SetFolder(tmpFile.GetNameFolder());
|
||||
@ -314,7 +314,7 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) {
|
||||
APPL_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
|
||||
} else {
|
||||
Buffer * myBuffer = BufferManager::Get(m_currentSavingAsIdBuffer);
|
||||
BufferText* myBuffer = BufferManager::Get(m_currentSavingAsIdBuffer);
|
||||
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
|
||||
if (NULL == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
@ -345,7 +345,7 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
} else if( eventId == ednMsgBufferState
|
||||
|| eventId == ednMsgBufferId) {
|
||||
// the buffer change we need to update the widget string
|
||||
Buffer* tmpBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
BufferText* tmpBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
if (NULL != tmpBuffer) {
|
||||
etk::FSNode compleateName = tmpBuffer->GetFileName();
|
||||
bool isModify = tmpBuffer->IsModify();
|
||||
|
@ -226,7 +226,7 @@ void CTagsManager::RegisterHistory(void)
|
||||
{
|
||||
APPL_INFO("save curent filename and position : ");
|
||||
int32_t currentSelected = BufferManager::GetSelected();
|
||||
Buffer* tmpBuf = BufferManager::Get(currentSelected);
|
||||
BufferText* tmpBuf = BufferManager::Get(currentSelected);
|
||||
if (NULL != tmpBuf) {
|
||||
etk::FSNode * bufferFilename = new etk::FSNode();
|
||||
*bufferFilename = tmpBuf->GetFileName();
|
||||
|
@ -28,9 +28,7 @@ FILE_LIST+= appl/Buffer/EdnBuf/EdnBuf.cpp \
|
||||
appl/Buffer/EdnBuf/EdnBuf_History.cpp \
|
||||
appl/Buffer/EdnBuf/EdnBuf_Selection.cpp \
|
||||
appl/Buffer/EdnBuf/EdnBufHistory.cpp \
|
||||
appl/Buffer/Buffer.cpp \
|
||||
appl/Buffer/BufferText.cpp \
|
||||
appl/Buffer/BufferEmpty.cpp \
|
||||
appl/Buffer/BufferManager.cpp
|
||||
|
||||
# Generic color management for the text editor :
|
||||
@ -62,6 +60,7 @@ LOCAL_COPY_FOLDERS := \
|
||||
../data/languages/xml/*.xml:languages/xml/ \
|
||||
../data/theme/default/*.svg:theme/default/
|
||||
|
||||
|
||||
ifneq ($(CONFIG___EWOL_INTEGRATED_FONT__),$(empty))
|
||||
|
||||
LOCAL_COPY_FILES := ../data/Font/freefont/FreeSerif.ttf:fonts/FreeSerif.ttf
|
||||
|
Loading…
x
Reference in New Issue
Block a user