sys: rework internal compilation ok

This commit is contained in:
Edouard Dupin 2011-09-18 13:35:24 +02:00
parent 7fbfe1f86a
commit 03484cc85d
8 changed files with 173 additions and 148 deletions

View File

@ -53,7 +53,10 @@ Buffer::Buffer()
tmpAnchor.m_idAnchor = -1; tmpAnchor.m_idAnchor = -1;
tmpAnchor.m_lineId = 0; tmpAnchor.m_lineId = 0;
tmpAnchor.m_bufferPos = 0; tmpAnchor.m_bufferPos = 0;
m_AnchorList .PushBack(tmpAnchor); m_AnchorList.PushBack(tmpAnchor);
m_lineWidth = 10;
m_lineHeight = 10;
} }
/** /**
@ -158,7 +161,7 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
* @return --- * @return ---
* *
*/ */
void Buffer::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_ts &displayStart, position_ts &displaySize) void Buffer::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
{ {
return; return;
} }
@ -174,10 +177,9 @@ void Buffer::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_t
* @todo : Set the move up and DOWN... * @todo : Set the move up and DOWN...
* *
*/ */
position_ts Buffer::MouseSelectFromCursorTo(int32_t width, int32_t height) void Buffer::MouseSelectFromCursorTo(int32_t width, int32_t height)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
@ -190,10 +192,9 @@ position_ts Buffer::MouseSelectFromCursorTo(int32_t width, int32_t height)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::MouseEvent(int32_t width, int32_t height) void Buffer::MouseEvent(int32_t width, int32_t height)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
/** /**
@ -204,10 +205,9 @@ position_ts Buffer::MouseEvent(int32_t width, int32_t height)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::MouseEventDouble(void) void Buffer::MouseEventDouble(void)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
/** /**
@ -218,10 +218,9 @@ position_ts Buffer::MouseEventDouble(void)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::MouseEventTriple(void) void Buffer::MouseEventTriple(void)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
@ -260,10 +259,9 @@ void Buffer::ScrollUp(void)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::cursorMove(int32_t gtkKey) void Buffer::cursorMove(int32_t gtkKey)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
/** /**
@ -274,22 +272,19 @@ position_ts Buffer::cursorMove(int32_t gtkKey)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::AddChar(char * UTF8data) void Buffer::AddChar(char * UTF8data)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
position_ts Buffer::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp) void Buffer::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
position_ts Buffer::Replace(Edn::String &data) void Buffer::Replace(Edn::String &data)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
int32_t Buffer::FindLine(Edn::String &data) int32_t Buffer::FindLine(Edn::String &data)
@ -298,10 +293,9 @@ int32_t Buffer::FindLine(Edn::String &data)
return 0; return 0;
} }
position_ts Buffer::JumpAtLine(int32_t newLine) void Buffer::JumpAtLine(int32_t newLine)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
@ -341,10 +335,9 @@ void Buffer::Copy(int8_t clipboardID)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::Cut(int8_t clipboardID) void Buffer::Cut(int8_t clipboardID)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
@ -356,40 +349,34 @@ position_ts Buffer::Cut(int8_t clipboardID)
* @return --- * @return ---
* *
*/ */
position_ts Buffer::Paste(int8_t clipboardID) void Buffer::Paste(int8_t clipboardID)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
position_ts Buffer::RemoveLine(void) void Buffer::RemoveLine(void)
{ {
position_ts tmp = {0,0}; // nothing to do;
return tmp;
} }
position_ts Buffer::SelectAll(void) void Buffer::SelectAll(void)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
position_ts Buffer::SelectNone(void) void Buffer::SelectNone(void)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
position_ts Buffer::Undo(void) void Buffer::Undo(void)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
position_ts Buffer::Redo(void) void Buffer::Redo(void)
{ {
position_ts tmp = {0,0}; // nothing to do
return tmp;
} }
@ -426,7 +413,7 @@ void Buffer::AnchorRm(int32_t anchorID)
} }
bool Buffer::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor, position_ts &size, int32_t sizePixelX, int32_t sizePixelY) bool Buffer::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
{ {
EDN_ERROR("AnchorID="<< anchorID << " Main buffer ==> can not manage Anchor (type buffer specific)"); EDN_ERROR("AnchorID="<< anchorID << " Main buffer ==> can not manage Anchor (type buffer specific)");
return false; return false;
@ -440,6 +427,32 @@ bool Buffer::AnchorNext(bufferAnchor_ts & anchor)
} }
void Buffer::AnchorSetSize(int32_t anchorID, int32_t sizePixelX, int32_t sizePixelY)
{
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
m_AnchorList[localID].m_displaySize.x = sizePixelX / m_lineWidth;
m_AnchorList[localID].m_displaySize.y = sizePixelY / m_lineHeight;
}
}
void Buffer::AnchorSetStartOffset(int32_t anchorID, int32_t offsetX, int32_t offsetY)
{
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
m_AnchorList[localID].m_displayStart.x += offsetX;
if (0<m_AnchorList[localID].m_displayStart.x) {
m_AnchorList[localID].m_displayStart.x = 0;
}
m_AnchorList[localID].m_displayStart.y += offsetY;
if (0<m_AnchorList[localID].m_displayStart.y) {
m_AnchorList[localID].m_displayStart.y = 0;
}
}
}
int32_t Buffer::AnchorRealId(int32_t anchorID) int32_t Buffer::AnchorRealId(int32_t anchorID)
{ {
//EDN_DEBUG("Get real ID : " << anchorID << " in the anchor list size()=" << m_AnchorList.Size()); //EDN_DEBUG("Get real ID : " << anchorID << " in the anchor list size()=" << m_AnchorList.Size());

View File

@ -44,18 +44,23 @@ extern "C"
}infoStatBuffer_ts; }infoStatBuffer_ts;
typedef struct { typedef struct {
int32_t m_idAnchor; int32_t m_idAnchor; //!< reference id of the anchor (real id of the upper displayer of CodeView)
int32_t m_lineId; bool m_curent; //!< set at true if the anchor is a reference with the curent display
int32_t m_bufferPos; int32_t m_lineId; //!< first line ID to display
int32_t m_bufferPos; //!< position of the first lineId
position_ts m_displayStart; //!< start display position
position_ts m_displaySize; //!< size of the curent display
} bufferAnchorReference_ts; } bufferAnchorReference_ts;
typedef struct { typedef struct {
int32_t m_lineNumber; position_ts m_displayStart; //!< start display position
int32_t m_nbIterationMax; position_ts m_displaySize; //!< size of the curent display
int32_t m_posStart; int32_t m_lineNumber; //!< current line-number id
int32_t m_posStop; int32_t m_nbIterationMax; //!< number of cycle needed to end the dispalay
int32_t m_selectionPosStart; int32_t m_posStart; //!< position of the start of the line
int32_t m_selectionPosStop; int32_t m_posStop; //!< position of the end of the line
int32_t m_selectionPosStart; //!< position of the selection start
int32_t m_selectionPosStop; //!< position of the selection stop
} bufferAnchor_ts; } bufferAnchor_ts;
} }
@ -99,19 +104,19 @@ class Buffer {
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate); virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
virtual void SetLineDisplay(uint32_t lineNumber); virtual void SetLineDisplay(uint32_t lineNumber);
virtual void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_ts &displayStart, position_ts &displaySize); virtual void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
// return the new cursor position ... // return the new cursor position ...
virtual position_ts AddChar(char * UTF8data); virtual void AddChar(char * UTF8data);
virtual position_ts cursorMove(int32_t gtkKey); virtual void cursorMove(int32_t gtkKey);
virtual position_ts MouseSelectFromCursorTo(int32_t width, int32_t height); virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
virtual position_ts MouseEvent(int32_t width, int32_t height); virtual void MouseEvent(int32_t width, int32_t height);
virtual position_ts MouseEventDouble(void); virtual void MouseEventDouble(void);
virtual position_ts MouseEventTriple(void); virtual void MouseEventTriple(void);
virtual position_ts RemoveLine(void); virtual void RemoveLine(void);
virtual position_ts SelectAll(void); virtual void SelectAll(void);
virtual position_ts SelectNone(void); virtual void SelectNone(void);
virtual position_ts Undo(void); virtual void Undo(void);
virtual position_ts Redo(void); virtual void Redo(void);
virtual void SetCharset(charset_te newCharset) {}; virtual void SetCharset(charset_te newCharset) {};
@ -120,12 +125,12 @@ class Buffer {
//virtual void SelectAll(void); //virtual void SelectAll(void);
virtual void Copy(int8_t clipboardID); virtual void Copy(int8_t clipboardID);
virtual position_ts Cut(int8_t clipboardID); virtual void Cut(int8_t clipboardID);
virtual position_ts Paste(int8_t clipboardID); virtual void Paste(int8_t clipboardID);
virtual position_ts Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp); virtual void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
virtual position_ts Replace(Edn::String &data); virtual void Replace(Edn::String &data);
virtual int32_t FindLine(Edn::String &data); virtual int32_t FindLine(Edn::String &data);
virtual position_ts JumpAtLine(int32_t newLine); virtual void JumpAtLine(int32_t newLine);
virtual int32_t GetCurrentLine(void); virtual int32_t GetCurrentLine(void);
protected: protected:
@ -138,10 +143,14 @@ class Buffer {
public: public:
void AnchorAdd(int32_t anchorID); void AnchorAdd(int32_t anchorID);
void AnchorRm(int32_t anchorID); void AnchorRm(int32_t anchorID);
virtual bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor, position_ts &size, int32_t sizePixelX, int32_t sizePixelY); virtual bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
virtual bool AnchorNext(bufferAnchor_ts & anchor); virtual bool AnchorNext(bufferAnchor_ts & anchor);
void AnchorSetSize(int32_t anchorID, int32_t sizePixelX, int32_t sizePixelY);
void AnchorSetStartOffset(int32_t anchorID, int32_t offsetX, int32_t offsetY);
protected: protected:
int32_t m_lineWidth;
int32_t m_lineHeight;
int32_t AnchorRealId(int32_t anchorID); int32_t AnchorRealId(int32_t anchorID);
Edn::VectorType<bufferAnchorReference_ts> m_AnchorList; //!< list of all line anchor in the current buffer Edn::VectorType<bufferAnchorReference_ts> m_AnchorList; //!< list of all line anchor in the current buffer

View File

@ -42,7 +42,8 @@
*/ */
BufferEmpty::BufferEmpty() BufferEmpty::BufferEmpty()
{ {
m_lineWidth = Display::GetFontWidth();
m_lineHeight = Display::GetFontHeight();
} }
/** /**
@ -67,7 +68,7 @@ BufferEmpty::~BufferEmpty(void)
* @return --- * @return ---
* *
*/ */
void BufferEmpty::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_ts &displayStart, position_ts &displaySize) void BufferEmpty::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
{ {
EDN_DEBUG("Request draw : " << anchor.m_lineNumber); EDN_DEBUG("Request draw : " << anchor.m_lineNumber);
ColorizeManager * myColorManager = ColorizeManager::getInstance(); ColorizeManager * myColorManager = ColorizeManager::getInstance();
@ -89,13 +90,15 @@ void BufferEmpty::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, posit
bool BufferEmpty::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor, position_ts &size, int32_t sizePixelX, int32_t sizePixelY) bool BufferEmpty::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
{ {
int32_t localID = AnchorRealId(anchorID); int32_t localID = AnchorRealId(anchorID);
if (localID >=0) { if (localID >=0) {
EDN_DEBUG("Request anchor"); EDN_DEBUG("Request anchor");
size.x = sizePixelX / Display::GetFontWidth(); anchor.m_displaySize.x = m_AnchorList[localID].m_displaySize.x;
size.y = sizePixelY / Display::GetFontHeight(); anchor.m_displaySize.y = m_AnchorList[localID].m_displaySize.y;
anchor.m_displayStart.x = m_AnchorList[localID].m_displayStart.x;
anchor.m_displayStart.y = m_AnchorList[localID].m_displayStart.y;
anchor.m_nbIterationMax = 2; anchor.m_nbIterationMax = 2;
anchor.m_lineNumber = m_AnchorList[localID].m_lineId; anchor.m_lineNumber = m_AnchorList[localID].m_lineId;
anchor.m_posStart = -1; anchor.m_posStart = -1;

View File

@ -32,8 +32,8 @@ class BufferEmpty : public Buffer {
public: public:
BufferEmpty(void); BufferEmpty(void);
virtual ~BufferEmpty(void); virtual ~BufferEmpty(void);
void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_ts &displayStart, position_ts &displaySize); void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor, position_ts &size, int32_t sizePixelX, int32_t sizePixelY); bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
bool AnchorNext(bufferAnchor_ts & anchor); bool AnchorNext(bufferAnchor_ts & anchor);
}; };

View File

@ -52,9 +52,6 @@ extern "C"
*/ */
void BufferText::BasicInit(void) void BufferText::BasicInit(void)
{ {
// set the first element that is displayed
m_displayStartBufferPos = 0;
// set the number of the lineNumber; // set the number of the lineNumber;
m_nbColoneForLineNumber = 1; m_nbColoneForLineNumber = 1;
// init the link with the buffer manager // init the link with the buffer manager
@ -66,11 +63,9 @@ void BufferText::BasicInit(void)
m_cursorPos = 0; m_cursorPos = 0;
m_cursorPreferredCol = -1; m_cursorPreferredCol = -1;
m_cursorOn = true; m_cursorOn = true;
//m_cursorMode = CURSOR_DISPLAY_MODE_NORMAL;
m_displayStart.x = 0; m_lineWidth = Display::GetFontWidth();
m_displayStart.y = 0; m_lineHeight = Display::GetFontHeight();
m_displaySize.x = 200;
m_displaySize.y = 20;
} }
@ -231,10 +226,9 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
void BufferText::DrawLineNumber(DrawerManager &drawer, int32_t lineNumber) void BufferText::DrawLineNumber(DrawerManager &drawer, int32_t lineNumber, int32_t positionY)
{ {
int32_t letterHeight = Display::GetFontHeight(); int32_t letterHeight = Display::GetFontHeight();
int32_t positionY = letterHeight * (lineNumber - m_displayStart.y - 1);
char tmpLineNumber[50]; char tmpLineNumber[50];
sprintf(tmpLineNumber, g_pointerForTheDisplayLine[m_nbColoneForLineNumber-1], lineNumber); sprintf(tmpLineNumber, g_pointerForTheDisplayLine[m_nbColoneForLineNumber-1], lineNumber);
drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber); drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber);
@ -267,12 +261,16 @@ void BufferText::UpdatePointerNumber(void)
} }
void BufferText::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_ts &displayStart, position_ts &displaySize) void BufferText::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
{ {
// TODO : Avec ca ca ne peux pas marcher...
position_ts displayStart;
position_ts displaySize;
int32_t letterHeight = Display::GetFontHeight(); int32_t letterHeight = Display::GetFontHeight();
int32_t letterWidth = Display::GetFontWidth(); int32_t letterWidth = Display::GetFontWidth();
int32_t positionY = letterHeight * (anchor.m_lineNumber - displayStart.y - 1); int32_t positionY = letterHeight * (anchor.m_lineNumber - displayStart.y - 1);
int32_t idX = 0; int32_t idX = 0;
int32_t pixelX = m_nbColoneForLineNumber*letterWidth + 3; int32_t pixelX = m_nbColoneForLineNumber*letterWidth + 3;
@ -288,7 +286,7 @@ void BufferText::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, positi
// clean the current Line // clean the current Line
drawer.Rectangle(myColorManager->Get(COLOR_CODE_BASIC_BG), 0, positionY, drawer.GetWidth(), letterHeight); drawer.Rectangle(myColorManager->Get(COLOR_CODE_BASIC_BG), 0, positionY, drawer.GetWidth(), letterHeight);
DrawLineNumber(drawer, anchor.m_lineNumber); DrawLineNumber(drawer, anchor.m_lineNumber, positionY);
bool selHave = anchor.m_selectionPosStart == -1 ? false : true; bool selHave = anchor.m_selectionPosStart == -1 ? false : true;
char displayChar[MAX_EXP_CHAR_LEN]; char displayChar[MAX_EXP_CHAR_LEN];
@ -402,8 +400,9 @@ void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int
if (x < 0) { if (x < 0) {
x = 0; x = 0;
} }
x += m_displayStart.x; // TODO : REWORK
y += m_displayStart.y; //x += m_displayStart.x;
//y += m_displayStart.y;
//EDN_DEBUG("BufferText::GetMousePosition(" << width << "," << height << "); ==> (" << x << "," << y << ")" ); //EDN_DEBUG("BufferText::GetMousePosition(" << width << "," << height << "); ==> (" << x << "," << y << ")" );
} }
@ -582,6 +581,8 @@ void BufferText::ScrollUp(void)
*/ */
void BufferText::MoveUpDown(int32_t ofset) void BufferText::MoveUpDown(int32_t ofset)
{ {
// TODO : REWORK
/*
if (ofset >= 0) { if (ofset >= 0) {
int32_t nbLine = m_EdnBuf.NumberOfLines(); int32_t nbLine = m_EdnBuf.NumberOfLines();
if (m_displayStart.y+ofset+3 > nbLine) { if (m_displayStart.y+ofset+3 > nbLine) {
@ -600,7 +601,7 @@ void BufferText::MoveUpDown(int32_t ofset)
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y); m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y);
} }
} }
*/
} }
@ -786,7 +787,8 @@ void BufferText::cursorMove(int32_t gtkKey)
case GDK_Page_Up: case GDK_Page_Up:
# endif # endif
//EDN_INFO("keyEvent : <PAGE-UP>"); //EDN_INFO("keyEvent : <PAGE-UP>");
TextDMoveUp(m_displaySize.x); // TODO : REWORK
//TextDMoveUp(m_displaySize.x);
break; break;
# ifdef USE_GTK_VERSION_3_0 # ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Page_Down: case GDK_KEY_Page_Down:
@ -794,7 +796,8 @@ void BufferText::cursorMove(int32_t gtkKey)
case GDK_Page_Down: case GDK_Page_Down:
# endif # endif
//EDN_INFO("keyEvent : <PAGE-DOWN>"); //EDN_INFO("keyEvent : <PAGE-DOWN>");
TextDMoveDown(m_displaySize.x); // TODO : REWORK
//TextDMoveDown(m_displaySize.x);
break; break;
# ifdef USE_GTK_VERSION_3_0 # ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Begin: case GDK_KEY_Begin:
@ -833,6 +836,8 @@ void BufferText::cursorMove(int32_t gtkKey)
*/ */
void BufferText::UpdateWindowsPosition(bool centerPage) void BufferText::UpdateWindowsPosition(bool centerPage)
{ {
// TODO : REWORK
/*
if (centerPage == false) { if (centerPage == false) {
// Display position (Y mode): // Display position (Y mode):
//EDN_INFO("BufferText::UpdateWindowsPosition() m_displayStart(" << m_displayStart.x << "," << m_displayStart.y << ") m_displaySize(" << m_displaySize.x << "," <<m_displaySize.y << ")"); //EDN_INFO("BufferText::UpdateWindowsPosition() m_displayStart(" << m_displayStart.x << "," << m_displayStart.y << ") m_displaySize(" << m_displaySize.x << "," <<m_displaySize.y << ")");
@ -875,11 +880,11 @@ void BufferText::UpdateWindowsPosition(bool centerPage)
//EDN_DEBUG(" display size : " << m_displaySize.y); //EDN_DEBUG(" display size : " << m_displaySize.y);
m_displayStart.y = cursorPosition.y - m_displaySize.y/2; m_displayStart.y = cursorPosition.y - m_displaySize.y/2;
m_displayStart.y = edn_max(m_displayStart.y, 0); m_displayStart.y = edn_max(m_displayStart.y, 0);
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y); m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y);
//EDN_DEBUG(" display start : " << m_displayStart.x << "x" << m_displayStart.y); //EDN_DEBUG(" display start : " << m_displayStart.x << "x" << m_displayStart.y);
//EDN_DEBUG(" -------------------------------------------------"); //EDN_DEBUG(" -------------------------------------------------");
} }
*/
} }
@ -891,9 +896,8 @@ void BufferText::UpdateWindowsPosition(bool centerPage)
* @return --- * @return ---
* *
*/ */
position_ts BufferText::AddChar(char * UTF8data) void BufferText::AddChar(char * UTF8data)
{ {
position_ts tmp = {0,0};
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd; int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect; bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd); bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
@ -1037,9 +1041,8 @@ int32_t BufferText::FindLine(Edn::String &data)
} }
} }
position_ts BufferText::JumpAtLine(int32_t newLine) void BufferText::JumpAtLine(int32_t newLine)
{ {
position_ts tmp = {0,0};
int32_t positionLine = m_EdnBuf.CountForwardNLines(0, newLine); int32_t positionLine = m_EdnBuf.CountForwardNLines(0, newLine);
m_EdnBuf.Unselect(SELECTION_PRIMARY); m_EdnBuf.Unselect(SELECTION_PRIMARY);
EDN_DEBUG("jump at the line : " << newLine ); EDN_DEBUG("jump at the line : " << newLine );
@ -1062,9 +1065,8 @@ int32_t BufferText::GetCurrentLine(void)
position_ts BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp) void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{ {
position_ts tmp = {0,0};
EDN_INFO("Search data : \"" << data << "\""); EDN_INFO("Search data : \"" << data << "\"");
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd; int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
@ -1151,9 +1153,8 @@ position_ts BufferText::Search(Edn::String &data, bool back, bool caseSensitive,
} }
position_ts BufferText::Replace(Edn::String &data) void BufferText::Replace(Edn::String &data)
{ {
position_ts tmp = {0,0};
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd; int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect; bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd); bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
@ -1195,10 +1196,8 @@ void BufferText::Copy(int8_t clipboardID)
* @return --- * @return ---
* *
*/ */
position_ts BufferText::Cut(int8_t clipboardID) void BufferText::Cut(int8_t clipboardID)
{ {
position_ts tmp = {0,0};
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd; int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect; bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd); bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
@ -1224,9 +1223,8 @@ position_ts BufferText::Cut(int8_t clipboardID)
* @return --- * @return ---
* *
*/ */
position_ts BufferText::Paste(int8_t clipboardID) void BufferText::Paste(int8_t clipboardID)
{ {
position_ts tmp = {0,0};
Edn::VectorType<int8_t> mVect; Edn::VectorType<int8_t> mVect;
// copy data from the click board : // copy data from the click board :
ClipBoard::Get(clipboardID, mVect); ClipBoard::Get(clipboardID, mVect);
@ -1250,9 +1248,8 @@ position_ts BufferText::Paste(int8_t clipboardID)
} }
position_ts BufferText::Undo(void) void BufferText::Undo(void)
{ {
position_ts tmp = {0,0};
int32_t newPos = m_EdnBuf.Undo(); int32_t newPos = m_EdnBuf.Undo();
if (newPos >= 0) { if (newPos >= 0) {
SetInsertPosition(newPos, true); SetInsertPosition(newPos, true);
@ -1261,9 +1258,8 @@ position_ts BufferText::Undo(void)
} }
} }
position_ts BufferText::Redo(void) void BufferText::Redo(void)
{ {
position_ts tmp = {0,0};
int32_t newPos = m_EdnBuf.Redo(); int32_t newPos = m_EdnBuf.Redo();
if (newPos >= 0) { if (newPos >= 0) {
SetInsertPosition(newPos, true); SetInsertPosition(newPos, true);
@ -1279,16 +1275,19 @@ void BufferText::SetCharset(charset_te newCharset)
} }
bool BufferText::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor, position_ts &size, int32_t sizePixelX, int32_t sizePixelY) bool BufferText::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
{ {
int32_t localID = AnchorRealId(anchorID); int32_t localID = AnchorRealId(anchorID);
if (localID >=0) { if (localID >=0) {
// update internal sise of the width of lineID // update internal sise of the width of lineID
UpdatePointerNumber(); UpdatePointerNumber();
// Updata uper size of display // Updata uper size of display
size.x = sizePixelX / Display::GetFontWidth(); anchor.m_displaySize.x = m_AnchorList[localID].m_displaySize.x;
size.y = sizePixelY / Display::GetFontHeight(); anchor.m_displaySize.y = m_AnchorList[localID].m_displaySize.y;
anchor.m_nbIterationMax = size.y; anchor.m_displayStart.x = m_AnchorList[localID].m_displayStart.x;
anchor.m_displayStart.y = m_AnchorList[localID].m_displayStart.y;
// TODO : Test de display non complet...
anchor.m_nbIterationMax = anchor.m_displaySize.y - 4;
// update to buffer position // update to buffer position
anchor.m_lineNumber = m_AnchorList[localID].m_lineId; anchor.m_lineNumber = m_AnchorList[localID].m_lineId;
anchor.m_posStart = m_AnchorList[localID].m_bufferPos; anchor.m_posStart = m_AnchorList[localID].m_bufferPos;

View File

@ -47,34 +47,34 @@ class BufferText : public Buffer {
void GetInfo(infoStatBuffer_ts &infoToUpdate); void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber); void SetLineDisplay(uint32_t lineNumber);
void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor, position_ts &displayStart, position_ts &displaySize); void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
position_ts AddChar(char * UTF8data); void AddChar(char * UTF8data);
position_ts cursorMove(int32_t gtkKey); void cursorMove(int32_t gtkKey);
position_ts MouseSelectFromCursorTo(int32_t width, int32_t height); void MouseSelectFromCursorTo(int32_t width, int32_t height);
position_ts MouseEvent(int32_t width, int32_t height); void MouseEvent(int32_t width, int32_t height);
position_ts MouseEventDouble(void); void MouseEventDouble(void);
position_ts MouseEventTriple(void); void MouseEventTriple(void);
void ScrollDown(void); void ScrollDown(void);
void ScrollUp(void); void ScrollUp(void);
void Copy(int8_t clipboardID); void Copy(int8_t clipboardID);
position_ts Cut(int8_t clipboardID); void Cut(int8_t clipboardID);
position_ts Paste(int8_t clipboardID); void Paste(int8_t clipboardID);
position_ts Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp); void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
position_ts Replace(Edn::String &data); void Replace(Edn::String &data);
int32_t FindLine(Edn::String &data); int32_t FindLine(Edn::String &data);
position_ts JumpAtLine(int32_t newLine); void JumpAtLine(int32_t newLine);
int32_t GetCurrentLine(void); int32_t GetCurrentLine(void);
position_ts RemoveLine(void); void RemoveLine(void);
position_ts SelectAll(void); void SelectAll(void);
position_ts SelectNone(void); void SelectNone(void);
position_ts Undo(void); void Undo(void);
position_ts Redo(void); void Redo(void);
void SetCharset(charset_te newCharset); void SetCharset(charset_te newCharset);
bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor, position_ts &size, int32_t sizePixelX, int32_t sizePixelY); bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
bool AnchorNext(bufferAnchor_ts & anchor); bool AnchorNext(bufferAnchor_ts & anchor);
protected: protected:
void NameChange(void); void NameChange(void);
@ -115,7 +115,7 @@ class BufferText : public Buffer {
void GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y); void GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y);
void MoveUpDown(int32_t ofset); void MoveUpDown(int32_t ofset);
void DrawLineNumber(DrawerManager &drawer, int32_t lineNumber); void DrawLineNumber(DrawerManager &drawer, int32_t lineNumber, int32_t positionY);
void UpdatePointerNumber(void); void UpdatePointerNumber(void);

View File

@ -240,9 +240,10 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
#endif #endif
bufferAnchor_ts anchor; bufferAnchor_ts anchor;
bool enableToWrite = tmpBuf->AnchorGet(self->m_displayUniqueId, anchor, self->m_displaySize, self->m_shawableAreaX, self->m_shawableAreaY); tmpBuf->AnchorSetSize(self->m_displayUniqueId, self->m_shawableAreaX, self->m_shawableAreaY);
bool enableToWrite = tmpBuf->AnchorGet(self->m_displayUniqueId, anchor);
while (true == enableToWrite) { while (true == enableToWrite) {
tmpBuf->DrawLine(monDrawer, anchor, self->m_displayStart, self->m_displaySize); tmpBuf->DrawLine(monDrawer, anchor);
enableToWrite = tmpBuf->AnchorNext(anchor); enableToWrite = tmpBuf->AnchorNext(anchor);
} }
monDrawer.Flush(); monDrawer.Flush();

View File

@ -55,8 +55,8 @@ class CodeView : public MsgBroadcast
// main windows widget : // main windows widget :
GtkWidget * m_widget; GtkWidget * m_widget;
int32_t m_displayUniqueId; int32_t m_displayUniqueId;
position_ts m_displayStart; //!< position where the display is starting //position_ts m_displayStart; //!< position where the display is starting
position_ts m_displaySize; //!< number of char displayable in the screan //position_ts m_displaySize; //!< number of char displayable in the screan
// récupération des proprieter général... // récupération des proprieter général...
BufferManager * m_bufferManager; BufferManager * m_bufferManager;
ColorizeManager * m_colorManager; ColorizeManager * m_colorManager;