2011-07-20 10:33:24 +02:00
|
|
|
/**
|
|
|
|
*******************************************************************************
|
|
|
|
* @file BufferText.h
|
|
|
|
* @brief Editeur De N'ours : Text Buffer (edit only ASCII text File) (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_TEXT_H__
|
|
|
|
#define __BUFFER_TEXT_H__
|
|
|
|
|
|
|
|
#include "ColorizeManager.h"
|
|
|
|
#include "Buffer.h"
|
|
|
|
#include "EdnBuf.h"
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
CURSOR_DISPLAY_MODE_NORMAL = 259,
|
|
|
|
CURSOR_DISPLAY_MODE_INSERT,
|
|
|
|
CURSOR_DISPLAY_MODE_NOT_FOCUS,
|
|
|
|
} cursorDisplayMode_te;
|
|
|
|
|
|
|
|
class BufferText : public Buffer {
|
|
|
|
public:
|
|
|
|
BufferText(void);
|
2012-01-11 15:26:53 +01:00
|
|
|
BufferText(etk::File &fileName);
|
2011-07-20 10:33:24 +02:00
|
|
|
virtual ~BufferText(void);
|
|
|
|
void Save(void);
|
|
|
|
|
|
|
|
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
|
|
|
void SetLineDisplay(uint32_t lineNumber);
|
|
|
|
|
2012-02-18 15:56:00 +01:00
|
|
|
int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
|
|
|
|
ewol::OObject2DTextColored& OOTextBold,
|
|
|
|
ewol::OObject2DTextColored& OOTextItalic,
|
|
|
|
ewol::OObject2DTextColored& OOTextBoldItalic,
|
|
|
|
ewol::OObject2DColored& OOColored,
|
2012-02-06 17:59:48 +01:00
|
|
|
int32_t offsetX, int32_t offsetY,
|
|
|
|
int32_t sizeX, int32_t sizeY);
|
2012-02-13 18:03:09 +01:00
|
|
|
void AddChar(uniChar_t unicodeData);
|
2012-01-17 15:35:34 +01:00
|
|
|
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
2012-03-01 18:23:45 +01:00
|
|
|
void MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height);
|
|
|
|
void MouseEvent(int32_t fontId, int32_t width, int32_t height);
|
2011-07-20 10:33:24 +02:00
|
|
|
void MouseEventDouble(void);
|
|
|
|
void MouseEventTriple(void);
|
|
|
|
|
|
|
|
void Copy(int8_t clipboardID);
|
|
|
|
void Cut(int8_t clipboardID);
|
|
|
|
void Paste(int8_t clipboardID);
|
|
|
|
|
2012-02-15 16:23:20 +01:00
|
|
|
void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
|
|
|
void Replace(etk::UString &data);
|
|
|
|
int32_t FindLine(etk::UString &data);
|
2011-07-20 10:33:24 +02:00
|
|
|
void JumpAtLine(int32_t newLine);
|
2011-08-24 09:44:10 +02:00
|
|
|
int32_t GetCurrentLine(void);
|
|
|
|
|
2011-07-20 10:33:24 +02:00
|
|
|
void RemoveLine(void);
|
|
|
|
void SelectAll(void);
|
|
|
|
void SelectNone(void);
|
|
|
|
void Undo(void);
|
|
|
|
void Redo(void);
|
2012-01-24 17:54:16 +01:00
|
|
|
void SetCharset(unicode::charset_te newCharset);
|
2012-02-07 18:04:15 +01:00
|
|
|
int32_t GetNumberOfLine(void);
|
2011-08-07 10:47:06 +02:00
|
|
|
protected:
|
|
|
|
void NameChange(void);
|
2011-07-20 10:33:24 +02:00
|
|
|
|
|
|
|
private:
|
2012-03-02 16:42:44 +01:00
|
|
|
int32_t GetLineNumberNumberOfElement(void);
|
2011-07-20 10:33:24 +02:00
|
|
|
|
|
|
|
// Direct buffer IO
|
|
|
|
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
|
2012-07-01 10:13:24 +02:00
|
|
|
Vector2D<float> m_displaySize; //!< number of char displayable in the screan
|
2011-07-20 10:33:24 +02:00
|
|
|
// Cursor :
|
|
|
|
int32_t m_cursorPos; //!< position in the buffer of the cursor
|
|
|
|
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
|
|
|
|
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
|
|
|
|
|
|
|
|
// internal function
|
2012-03-02 16:42:44 +01:00
|
|
|
void BasicInit(void);
|
|
|
|
private:
|
2012-04-24 13:17:04 +02:00
|
|
|
bool m_centerRequested;
|
2012-03-02 16:42:44 +01:00
|
|
|
public:
|
2012-07-01 10:13:24 +02:00
|
|
|
virtual Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
|
2012-03-02 16:42:44 +01:00
|
|
|
private:
|
2011-07-20 10:33:24 +02:00
|
|
|
bool TextDMoveUp(int32_t offset);
|
|
|
|
bool TextDMoveDown(int32_t offset);
|
|
|
|
void SetInsertPosition(int32_t newPosition, bool insertChar = false);
|
|
|
|
|
2012-03-02 09:47:33 +01:00
|
|
|
int32_t GetMousePosition(int32_t fontId, int32_t width, int32_t height);
|
2012-01-15 15:42:01 +01:00
|
|
|
|
2012-03-02 16:42:44 +01:00
|
|
|
void DrawLineNumber(ewol::OObject2DTextColored* 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);
|
2011-07-20 10:33:24 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|