SYS: Buffer anchor mechanism first step

This commit is contained in:
2011-09-11 22:46:36 +02:00
parent bdc4793955
commit 2712d4f67d
9 changed files with 113 additions and 85 deletions

View File

@@ -235,7 +235,6 @@ void Buffer::ScrollUp(void)
// nothing to do
}
/**
* @brief
*
@@ -244,13 +243,6 @@ void Buffer::ScrollUp(void)
* @return ---
*
*/
void Buffer::ForceReDraw(bool allElement)
{
// nothing to do
}
void Buffer::cursorMove(int32_t gtkKey)
{
// nothing to do

View File

@@ -30,7 +30,7 @@
#include "Display.h"
#include "charset.h"
#include "Edn.h"
#include "BufferAnchor.h"
typedef struct{
uint32_t nbTotalLine; //!< Number of line in the buffer
@@ -82,7 +82,6 @@ class Buffer {
virtual void SetLineDisplay(uint32_t lineNumber);
virtual int32_t Display(DrawerManager &drawer);
virtual void ForceReDraw(bool allElement);
virtual void AddChar(char * UTF8data);
virtual void cursorMove(int32_t gtkKey);
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);

View File

@@ -0,0 +1,38 @@
/**
*******************************************************************************
* @file BufferAnchor.cpp
* @brief Editeur De N'ours : anchor on a secific buffer (Sources)
* @author Edouard DUPIN
* @date 11/09/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 "BufferAnchor.h"
BufferAnchor::BufferAnchor(void)
{
}
BufferAnchor::~BufferAnchor(void)
{
}

View File

@@ -0,0 +1,56 @@
/**
*******************************************************************************
* @file BufferAnchor.h
* @brief Editeur De N'ours : anchor on a secific buffer (header)
* @author Edouard DUPIN
* @date 11/09/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_ANCHOR_H__
#define __BUFFER_ANCHOR_H__
#include "Display.h"
#include "charset.h"
#include "Edn.h"
class BufferAnchor
{
public :
BufferAnchor(void);
~BufferAnchor(void);
MoveAnchor(int32_t offsetLine);
//BufModification(...);
DisplayUpdateFirstLine(void);
DisplayUpdateNextLine(void);
private :
int32_t m_lineId;
int32_t m_bufferPos;
public:
int32_t m_lineNumber;
int32_t m_posStart;
int32_t m_posStop;
int32_t m_selectionPosStart;
int32_t m_selectionPosStop;
};
#endif

View File

@@ -52,7 +52,6 @@ extern "C"
*/
void BufferText::BasicInit(void)
{
NeedToCleanEndPage = true;
// set the first element that is displayed
m_displayStartBufferPos = 0;
@@ -72,7 +71,6 @@ void BufferText::BasicInit(void)
m_displayStart.y = 0;
m_displaySize.x = 200;
m_displaySize.y = 20;
m_displayLocalSyntax.idSequence = -1;
}
@@ -660,7 +658,6 @@ void BufferText::ScrollUp(void)
*/
void BufferText::MoveUpDown(int32_t ofset)
{
m_displayLocalSyntax.idSequence = -1;
if (ofset >= 0) {
int32_t nbLine = m_EdnBuf.NumberOfLines();
if (m_displayStart.y+ofset+3 > nbLine) {
@@ -683,21 +680,6 @@ void BufferText::MoveUpDown(int32_t ofset)
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void BufferText::ForceReDraw(bool allElement)
{
NeedToCleanEndPage = true;
//m_displayLocalSyntax.idSequence = -1;
}
void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;

View File

@@ -35,37 +35,7 @@ typedef enum {
CURSOR_DISPLAY_MODE_INSERT,
CURSOR_DISPLAY_MODE_NOT_FOCUS,
} cursorDisplayMode_te;
#if 0
class colorPalette {
private :
ColorizeManager * m_colorManager;
public :
color_ts & colorSpace;
color_ts & colorTab;
color_ts & colorLineNumber;
Colorize * colorNormal;
Colorize * colorSel;
Colorize * colorCurrent;
public :
colorPalette(void):
m_colorManager(ColorizeManager::getInstance()),
colorSpace(m_colorManager->Get(COLOR_CODE_SPACE)),
colorTab(m_colorManager->Get(COLOR_CODE_TAB)),
colorLineNumber(m_colorManager->Get(COLOR_CODE_LINE_NUMBER)),
{
/*
ColorizeManager * m_colorManager = ColorizeManager::getInstance();
colorSpace = m_colorManager->Get(COLOR_CODE_SPACE);
colorTab = m_colorManager->Get(COLOR_CODE_TAB);
colorLineNumber = m_colorManager->Get(COLOR_CODE_LINE_NUMBER);
*/
colorNormal = m_colorManager->Get("normal");
colorSel = m_colorManager->Get("SelectedText");
}
} colorPalette_ts;
#endif
class BufferText : public Buffer {
public:
@@ -78,7 +48,6 @@ class BufferText : public Buffer {
void SetLineDisplay(uint32_t lineNumber);
int32_t Display(DrawerManager &drawer);
void ForceReDraw(bool allElement);
void AddChar(char * UTF8data);
void cursorMove(int32_t gtkKey);
void MouseSelectFromCursorTo(int32_t width, int32_t height);
@@ -107,25 +76,32 @@ class BufferText : public Buffer {
protected:
void NameChange(void);
// anchor section
public:
void AnchorAdd(int32_t anchorID);
void AnchorRm(int32_t anchorID);
private:
Edn::VectorType<BufferAnchor *> m_AnchorList; //!< list of all line anchor in the current buffer
private:
// Display
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
ColorizeManager * myColorManager; //!< for the background color :
int32_t m_nbColoneForLineNumber; //!< number of colomn use for linenumber display
// Direct buffer IO
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
position_ts m_displayStart; //!< position where the display is starting
position_ts m_displaySize; //!< number of char displayable in the screan
int32_t m_displayStartBufferPos; //!< position where the buffer start
// Cursor :
int32_t m_cursorPos; //!< position in the buffer of the cursor
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
bool m_cursorOn; //!< the blink of the cursor ...
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
displayHLData_ts m_displayLocalSyntax; //!< for the display of the local elements (display HL mode)
// internal function
void BasicInit(void);
void UpdateWindowsPosition(bool centerPage = false);
@@ -147,6 +123,7 @@ class BufferText : public Buffer {
void DrawLineNumber(DrawerManager &drawer, int32_t lineNumber);
void UpdatePointerNumber(void);
void DrawLine(DrawerManager &drawer, int32_t lineNumber, int32_t startPos, int32_t endPos, int32_t selStartPos, int32_t selEndPos);
//void DrawLine(DrawerManager &drawer, int32_t lineNumber, int32_t startPos, int32_t endPos, int32_t selStartPos, int32_t selEndPos);
};