SYS: Buffer anchor mechanism first step
This commit is contained in:
parent
bdc4793955
commit
2712d4f67d
1
Makefile
1
Makefile
@ -178,6 +178,7 @@ CXXFILES+= CustumWidget/BufferView/BufferView.cpp \
|
||||
|
||||
# Basic Interface :
|
||||
CXXFILES+= Buffer/Buffer.cpp \
|
||||
Buffer/BufferAnchor.cpp \
|
||||
Buffer/BufferText.cpp \
|
||||
Buffer/BufferEmpty.cpp \
|
||||
Buffer/BufferManager.cpp \
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
38
Sources/Buffer/BufferAnchor.cpp
Normal file
38
Sources/Buffer/BufferAnchor.cpp
Normal 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
56
Sources/Buffer/BufferAnchor.h
Normal file
56
Sources/Buffer/BufferAnchor.h
Normal 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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
@ -99,7 +99,6 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
|
||||
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
|
||||
//EDN_INFO("Select a new Buffer ... " << dataID);
|
||||
m_bufferID = dataID;
|
||||
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
|
||||
// request the dispplay of the curent Editor
|
||||
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
|
||||
break;
|
||||
@ -197,6 +196,7 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
||||
# ifdef USE_GTK_VERSION_3_0
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation(widget, &allocation);
|
||||
EDN_INFO("GTK+ request a diplay of : "<< allocation.width <<"px * "<< allocation.height <<"px");
|
||||
bool needRedrawAll = false;
|
||||
if (self->m_shawableAreaX != allocation.width) {
|
||||
needRedrawAll = true;
|
||||
@ -207,6 +207,7 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
||||
self->m_shawableAreaY = allocation.height;
|
||||
}
|
||||
# elif defined( USE_GTK_VERSION_2_0)
|
||||
EDN_INFO("GTK+ request a diplay of : "<< widget->allocation.width <<"px * "<< widget->allocation.height <<"px");
|
||||
bool needRedrawAll = false;
|
||||
if (self->m_shawableAreaX != widget->allocation.width) {
|
||||
needRedrawAll = true;
|
||||
@ -217,26 +218,15 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
||||
self->m_shawableAreaY = widget->allocation.height;
|
||||
}
|
||||
# endif
|
||||
if (true == needRedrawAll) {
|
||||
//updateScrollElement();
|
||||
self->m_bufferManager->Get(self->m_bufferID)->ForceReDraw(true);
|
||||
}
|
||||
EDN_INFO("Request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
|
||||
/*
|
||||
EDN_INFO("widget width=%d", widget->allocation.width);
|
||||
EDN_INFO("widget height=%d", widget->allocation.height);
|
||||
*/
|
||||
EDN_INFO("Edn request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
|
||||
|
||||
//EDN_INFO("BufferView Display");
|
||||
// Get the color Manager :
|
||||
ColorizeManager *myColorManager = NULL;
|
||||
myColorManager = ColorizeManager::getInstance();
|
||||
|
||||
//(void)m_bufferManager->Get(m_bufferID)->Display(m_displayParameters, m_shawableAreaX, m_shawableAreaY);
|
||||
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
|
||||
//EDN_INFO("Display buffer ID = " << m_bufferID);
|
||||
(void)self->m_bufferManager->Get(self->m_bufferID)->Display(monDrawer);
|
||||
// EDN_WARNING("Must display here ... ");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -250,22 +240,15 @@ gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer data)
|
||||
# ifdef USE_GTK_VERSION_3_0
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation(widget, &allocation);
|
||||
int32_t size_x = allocation.width;
|
||||
int32_t size_y = allocation.height;
|
||||
|
||||
EDN_INFO("GTK+ request a diplay of : "<< allocation.width <<"px * "<< allocation.height <<"px");
|
||||
self->m_shawableAreaX = allocation.width;
|
||||
self->m_shawableAreaY = allocation.height;
|
||||
# elif defined( USE_GTK_VERSION_2_0)
|
||||
int32_t size_x = widget->allocation.width;
|
||||
int32_t size_y = widget->allocation.height;
|
||||
|
||||
EDN_INFO("GTK+ request a diplay of : "<< widget->allocation.width <<"px * "<< widget->allocation.height <<"px");
|
||||
self->m_shawableAreaX = widget->allocation.width;
|
||||
self->m_shawableAreaY = widget->allocation.height;
|
||||
# endif
|
||||
EDN_INFO("Request a diplay of : "<< size_x <<"px * "<< size_y <<"px");
|
||||
|
||||
gtk_widget_queue_draw( widget );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# action a faire (ordonner par révision) :
|
||||
* 0.2.X :
|
||||
- gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre)
|
||||
- gui : Mise en place d'un display ligne par ligne
|
||||
- gui : display partielle de la fenetre
|
||||
- gui : ascenceur quand nécessaire
|
||||
- gui : Demander la création de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
|
||||
- sys : Mise en place des colorisation de base pour le
|
||||
|
Loading…
x
Reference in New Issue
Block a user