Copy/cut/paste is back
This commit is contained in:
parent
c75fb80736
commit
5e86641caf
@ -589,6 +589,7 @@ void BufferText::MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t
|
|||||||
m_EdnBuf.Select(SELECTION_PRIMARY, selStart, m_cursorPos);
|
m_EdnBuf.Select(SELECTION_PRIMARY, selStart, m_cursorPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Copy(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||||
RequestPositionUpdate();
|
RequestPositionUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,6 +610,7 @@ void BufferText::MouseEventDouble(void)
|
|||||||
m_EdnBuf.Select(SELECTION_PRIMARY, beginPos, endPos);
|
m_EdnBuf.Select(SELECTION_PRIMARY, beginPos, endPos);
|
||||||
m_cursorPos = endPos;
|
m_cursorPos = endPos;
|
||||||
}
|
}
|
||||||
|
Copy(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||||
// no else
|
// no else
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,6 +626,7 @@ void BufferText::MouseEventTriple(void)
|
|||||||
{
|
{
|
||||||
m_EdnBuf.Select(SELECTION_PRIMARY, m_EdnBuf.StartOfLine(m_cursorPos), m_EdnBuf.EndOfLine(m_cursorPos));
|
m_EdnBuf.Select(SELECTION_PRIMARY, m_EdnBuf.StartOfLine(m_cursorPos), m_EdnBuf.EndOfLine(m_cursorPos));
|
||||||
m_cursorPos = m_EdnBuf.EndOfLine(m_cursorPos);
|
m_cursorPos = m_EdnBuf.EndOfLine(m_cursorPos);
|
||||||
|
Copy(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::RemoveLine(void)
|
void BufferText::RemoveLine(void)
|
||||||
@ -632,13 +635,14 @@ void BufferText::RemoveLine(void)
|
|||||||
int32_t stop = m_EdnBuf.EndOfLine(m_cursorPos);
|
int32_t stop = m_EdnBuf.EndOfLine(m_cursorPos);
|
||||||
m_EdnBuf.Remove(start, stop+1);
|
m_EdnBuf.Remove(start, stop+1);
|
||||||
SetInsertPosition(start);
|
SetInsertPosition(start);
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::SelectAll(void)
|
void BufferText::SelectAll(void)
|
||||||
{
|
{
|
||||||
m_EdnBuf.Select(SELECTION_PRIMARY, 0, m_EdnBuf.Size());
|
m_EdnBuf.Select(SELECTION_PRIMARY, 0, m_EdnBuf.Size());
|
||||||
m_cursorPos = m_EdnBuf.Size();
|
m_cursorPos = m_EdnBuf.Size();
|
||||||
|
Copy(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::SelectNone(void)
|
void BufferText::SelectNone(void)
|
||||||
@ -1161,10 +1165,8 @@ void BufferText::Replace(etk::UString &data)
|
|||||||
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
||||||
if (true == haveSelectionActive) {
|
if (true == haveSelectionActive) {
|
||||||
// Replace Data :
|
// Replace Data :
|
||||||
etk::VectorType<uniChar_t> myData = data.GetVector();
|
int32_t size = m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, data);
|
||||||
EDN_TODO("Remove for now ...");
|
SetInsertPosition(SelectionStart + size);
|
||||||
//m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, myData);
|
|
||||||
//SetInsertPosition(SelectionStart + myData.Size());
|
|
||||||
}
|
}
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
@ -1180,16 +1182,13 @@ void BufferText::Replace(etk::UString &data)
|
|||||||
*/
|
*/
|
||||||
void BufferText::Copy(int8_t clipboardID)
|
void BufferText::Copy(int8_t clipboardID)
|
||||||
{
|
{
|
||||||
//etk::VectorType<uniChar_t> mVect;
|
|
||||||
etk::UString mVect;
|
etk::UString mVect;
|
||||||
// get the curent selected data
|
// get the curent selected data
|
||||||
if (true == m_EdnBuf.SelectHasSelection(SELECTION_PRIMARY) ) {
|
if (true == m_EdnBuf.SelectHasSelection(SELECTION_PRIMARY) ) {
|
||||||
m_EdnBuf.GetSelectionText(SELECTION_PRIMARY, mVect);
|
m_EdnBuf.GetSelectionText(SELECTION_PRIMARY, mVect);
|
||||||
EDN_TODO("Remove for now ...");
|
|
||||||
}
|
}
|
||||||
// copy data in the click board :
|
// copy data in the click board :
|
||||||
ewol::clipBoard::Set(clipboardID, mVect);
|
ewol::clipBoard::Set(clipboardID, mVect);
|
||||||
EDN_TODO("Remove for now ...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1231,10 +1230,7 @@ void BufferText::Cut(int8_t clipboardID)
|
|||||||
*/
|
*/
|
||||||
void BufferText::Paste(int8_t clipboardID)
|
void BufferText::Paste(int8_t clipboardID)
|
||||||
{
|
{
|
||||||
//etk::VectorType<uniChar_t> mVect;
|
|
||||||
etk::UString mVect;
|
etk::UString mVect;
|
||||||
EDN_TODO("Remove for now ...");
|
|
||||||
/*
|
|
||||||
// copy data from the click board :
|
// copy data from the click board :
|
||||||
ewol::clipBoard::Get(clipboardID, mVect);
|
ewol::clipBoard::Get(clipboardID, mVect);
|
||||||
|
|
||||||
@ -1244,14 +1240,13 @@ void BufferText::Paste(int8_t clipboardID)
|
|||||||
|
|
||||||
if (true == haveSelectionActive ) {
|
if (true == haveSelectionActive ) {
|
||||||
// replace data
|
// replace data
|
||||||
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, mVect );
|
int32_t size = m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, mVect );
|
||||||
m_cursorPos = SelectionStart + mVect.Size();
|
m_cursorPos = SelectionStart + size;
|
||||||
} else {
|
} else {
|
||||||
// insert data
|
// insert data
|
||||||
m_EdnBuf.Insert(m_cursorPos, mVect);
|
int32_t size = m_EdnBuf.Insert(m_cursorPos, mVect);
|
||||||
m_cursorPos += mVect.Size();
|
m_cursorPos += size;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
RequestPositionUpdate();
|
RequestPositionUpdate();
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <BufferManager.h>
|
#include <BufferManager.h>
|
||||||
#include <ColorizeManager.h>
|
#include <ColorizeManager.h>
|
||||||
#include <HighlightManager.h>
|
#include <HighlightManager.h>
|
||||||
#include <ClipBoard.h>
|
|
||||||
#include <Gui/Search.h>
|
#include <Gui/Search.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <readtags.h>
|
#include <readtags.h>
|
||||||
@ -83,7 +82,6 @@ void APP_Init(void)
|
|||||||
|
|
||||||
// init internal global value
|
// init internal global value
|
||||||
globals::init();
|
globals::init();
|
||||||
ClipBoard::Init();
|
|
||||||
|
|
||||||
|
|
||||||
// init ALL Singleton :
|
// init ALL Singleton :
|
||||||
|
@ -23,79 +23,4 @@
|
|||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tools_globals.h>
|
|
||||||
#include <ClipBoard.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ClipBoard"
|
|
||||||
|
|
||||||
#include <etk/VectorType.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
note: la copy dans le :
|
|
||||||
0 : copy standard
|
|
||||||
[1..9] : copy interne
|
|
||||||
10 : bouton du milieux
|
|
||||||
*/
|
|
||||||
static etk::VectorType<int8_t> mesCopy[TOTAL_OF_CLICKBOARD];
|
|
||||||
|
|
||||||
|
|
||||||
void ClipBoard::Init(void)
|
|
||||||
{
|
|
||||||
EDN_INFO("Initialyse ClipBoards");
|
|
||||||
for(int32_t i=0; i<TOTAL_OF_CLICKBOARD; i++) {
|
|
||||||
mesCopy[i].Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ClipBoard::Set(uint8_t clipboardID, etk::VectorType<int8_t> &data)
|
|
||||||
{
|
|
||||||
// check if ID is correct
|
|
||||||
if(clipboardID >= TOTAL_OF_CLICKBOARD) {
|
|
||||||
EDN_WARNING("request ClickBoard id error");
|
|
||||||
} else if(0 == data.Size()) {
|
|
||||||
EDN_INFO("request a copy of nothing");
|
|
||||||
} else if (COPY_STD == clipboardID) {
|
|
||||||
//GtkClipboard * clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
|
|
||||||
//gtk_clipboard_set_text(clipboard, (const gchar*)&data[0], data.Size() );
|
|
||||||
} else if (COPY_MIDDLE_BUTTON == clipboardID) {
|
|
||||||
//GtkClipboard * clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
|
||||||
//gtk_clipboard_set_text(clipboard, (const gchar*)&data[0], data.Size() );
|
|
||||||
}
|
|
||||||
// Copy datas ...
|
|
||||||
mesCopy[clipboardID] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ClipBoard::Get(uint8_t clipboardID, etk::VectorType<int8_t> &data)
|
|
||||||
{
|
|
||||||
if(clipboardID >= TOTAL_OF_CLICKBOARD) {
|
|
||||||
EDN_WARNING("request ClickBoard id error");
|
|
||||||
} else if (COPY_STD == clipboardID) {
|
|
||||||
/*
|
|
||||||
GtkClipboard * clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD );
|
|
||||||
gchar *text = gtk_clipboard_wait_for_text(clipboard);
|
|
||||||
if (text != NULL) {
|
|
||||||
mesCopy[COPY_STD].Clear();
|
|
||||||
mesCopy[COPY_STD].PushBack((int8_t*)text, strlen(text) );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} else if (COPY_MIDDLE_BUTTON == clipboardID) {
|
|
||||||
/*
|
|
||||||
GtkClipboard * clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY );
|
|
||||||
gchar *text = gtk_clipboard_wait_for_text(clipboard);
|
|
||||||
if (text != NULL) {
|
|
||||||
mesCopy[COPY_MIDDLE_BUTTON].Clear();
|
|
||||||
mesCopy[COPY_MIDDLE_BUTTON].PushBack((int8_t*)text, strlen(text) );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
// Copy datas ...
|
|
||||||
data = mesCopy[clipboardID];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,19 +26,6 @@
|
|||||||
#ifndef __CLIP_BOARD_H__
|
#ifndef __CLIP_BOARD_H__
|
||||||
#define __CLIP_BOARD_H__
|
#define __CLIP_BOARD_H__
|
||||||
|
|
||||||
#include "tools_debug.h"
|
|
||||||
#include "etk/VectorType.h"
|
|
||||||
|
|
||||||
#define TOTAL_OF_CLICKBOARD (11)
|
|
||||||
#define COPY_MIDDLE_BUTTON (10)
|
|
||||||
#define COPY_STD (0)
|
|
||||||
|
|
||||||
namespace ClipBoard
|
|
||||||
{
|
|
||||||
void Init(void);
|
|
||||||
void Set(uint8_t clipboardID, etk::VectorType<int8_t> &data);
|
|
||||||
void Get(uint8_t clipboardID, etk::VectorType<int8_t> &data);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -164,15 +164,23 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::VectorType<int8_t> &outpu
|
|||||||
//EDN_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
|
//EDN_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EdnBuf::GetRange(int32_t start, int32_t end, etk::Ustring &output)
|
void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
|
||||||
{
|
{
|
||||||
// Remove all data ...
|
// Remove all data ...
|
||||||
output = "";
|
output = "";
|
||||||
// import data :
|
// import data :
|
||||||
etk::VectorType<int8_t> &localOutput;
|
etk::VectorType<int8_t> localOutput;
|
||||||
m_data.Get(start, end-start, localOutput);
|
m_data.Get(start, end-start, localOutput);
|
||||||
// transcript in UNICODE ...
|
// transcript in UNICODE ...
|
||||||
// TODO : ldkjqlsdjfqslkjd
|
if (true == m_isUtf8) {
|
||||||
|
localOutput.PushBack('\0');
|
||||||
|
output = (char*)&localOutput[0];
|
||||||
|
} else {
|
||||||
|
etk::VectorType<uniChar_t> tmpUnicodeData;
|
||||||
|
// transform in unicode :
|
||||||
|
convertIsoToUnicode(m_charsetType, localOutput, tmpUnicodeData);
|
||||||
|
output = tmpUnicodeData;
|
||||||
|
}
|
||||||
//EDN_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
|
//EDN_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,18 +209,30 @@ int8_t EdnBuf::operator[] (int32_t pos)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void EdnBuf::Insert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
int32_t EdnBuf::Insert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
||||||
{
|
{
|
||||||
// if pos is not contiguous to existing text, make it
|
// if pos is not contiguous to existing text, make it
|
||||||
pos = edn_average(0, pos, m_data.Size() );
|
pos = edn_average(0, pos, m_data.Size() );
|
||||||
// insert Data
|
// insert Data
|
||||||
insert(pos, insertText);
|
int32_t sizeInsert=LocalInsert(pos, insertText);
|
||||||
|
|
||||||
// Call the redisplay ...
|
// Call the redisplay ...
|
||||||
etk::VectorType<int8_t> deletedText;
|
etk::VectorType<int8_t> deletedText;
|
||||||
eventModification(pos, insertText.Size(), deletedText);
|
eventModification(pos, insertText.Size(), deletedText);
|
||||||
|
return sizeInsert;
|
||||||
}
|
}
|
||||||
|
int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
|
||||||
|
{
|
||||||
|
// if pos is not contiguous to existing text, make it
|
||||||
|
pos = edn_average(0, pos, m_data.Size() );
|
||||||
|
// insert Data
|
||||||
|
int32_t sizeInsert=LocalInsert(pos, insertText);
|
||||||
|
|
||||||
|
// Call the redisplay ...
|
||||||
|
etk::VectorType<int8_t> deletedText;
|
||||||
|
eventModification(pos, insertText.Size(), deletedText);
|
||||||
|
return sizeInsert;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replace data in the buffer
|
* @brief Replace data in the buffer
|
||||||
@ -221,27 +241,46 @@ void EdnBuf::Insert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
|||||||
* @param[in] end Position ended in the buffer
|
* @param[in] end Position ended in the buffer
|
||||||
* @param[in] insertText Test to set in the range [start..end]
|
* @param[in] insertText Test to set in the range [start..end]
|
||||||
*
|
*
|
||||||
* @return ---
|
* @return nb Octet inserted
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void EdnBuf::Replace(int32_t start, int32_t end, etk::VectorType<int8_t> &insertText)
|
int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::VectorType<int8_t> &insertText)
|
||||||
{
|
{
|
||||||
etk::VectorType<int8_t> deletedText;
|
etk::VectorType<int8_t> deletedText;
|
||||||
GetRange(start, end, deletedText);
|
GetRange(start, end, deletedText);
|
||||||
m_data.Replace(start, end-start, insertText);
|
m_data.Replace(start, end-start, insertText);
|
||||||
// update internal elements
|
// update internal elements
|
||||||
eventModification(start, insertText.Size(), deletedText);
|
eventModification(start, insertText.Size(), deletedText);
|
||||||
|
return insertText.Size();
|
||||||
}
|
}
|
||||||
void EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
|
int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
|
||||||
{
|
{
|
||||||
etk::VectorType<int8_t> deletedText;
|
etk::VectorType<int8_t> deletedText;
|
||||||
GetRange(start, end, deletedText);
|
GetRange(start, end, deletedText);
|
||||||
etk::VectorType<int8_t> tmpInsertText;
|
etk::VectorType<int8_t> tmpInsertText;
|
||||||
insertText
|
if (true == m_isUtf8) {
|
||||||
// TODO : Unicode to utf8 ...
|
char * tmpPointer = insertText.Utf8Data();
|
||||||
|
while (*tmpPointer != '\0') {
|
||||||
|
tmpInsertText.PushBack(*tmpPointer++);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
etk::VectorType<unsigned int> tmppp = insertText.GetVector();
|
||||||
|
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
|
||||||
|
}
|
||||||
|
if (tmpInsertText.Size()>0) {
|
||||||
|
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
|
||||||
|
tmpInsertText.PopBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tmpInsertText.Size()>0) {
|
||||||
|
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
|
||||||
|
tmpInsertText.PopBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
m_data.Replace(start, end-start, tmpInsertText);
|
m_data.Replace(start, end-start, tmpInsertText);
|
||||||
// update internal elements
|
// update internal elements
|
||||||
eventModification(start, tmpInsertText.Size(), deletedText);
|
eventModification(start, tmpInsertText.Size(), deletedText);
|
||||||
|
return tmpInsertText.Size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1113,7 +1152,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
|
|||||||
* @return number of element inserted.
|
* @return number of element inserted.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t EdnBuf::insert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
int32_t EdnBuf::LocalInsert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
||||||
{
|
{
|
||||||
// Insert data in buffer
|
// Insert data in buffer
|
||||||
m_data.Insert(pos, insertText);
|
m_data.Insert(pos, insertText);
|
||||||
@ -1122,6 +1161,25 @@ int32_t EdnBuf::insert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
|||||||
// return the number of element inserted ...
|
// return the number of element inserted ...
|
||||||
return insertText.Size();
|
return insertText.Size();
|
||||||
}
|
}
|
||||||
|
int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
|
||||||
|
{
|
||||||
|
etk::VectorType<int8_t> tmpInsertText;
|
||||||
|
if (true == m_isUtf8) {
|
||||||
|
char * tmpPointer = insertText.Utf8Data();
|
||||||
|
while (*tmpPointer != '\0') {
|
||||||
|
tmpInsertText.PushBack(*tmpPointer++);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
etk::VectorType<unsigned int> tmppp = insertText.GetVector();
|
||||||
|
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
|
||||||
|
}
|
||||||
|
if (tmpInsertText.Size()>0) {
|
||||||
|
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
|
||||||
|
tmpInsertText.PopBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return LocalInsert(pos, tmpInsertText);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,9 +90,10 @@ class EdnBuf {
|
|||||||
bool DumpFrom( FILE *myFile);
|
bool DumpFrom( FILE *myFile);
|
||||||
// replace with operator [] ...
|
// replace with operator [] ...
|
||||||
int8_t operator[] (int32_t);
|
int8_t operator[] (int32_t);
|
||||||
void Insert( int32_t pos, etk::VectorType<int8_t> &insertText);
|
int32_t Insert( int32_t pos, etk::VectorType<int8_t> &insertText);
|
||||||
void Insert( int32_t pos, etk::UString &insertText);
|
int32_t Insert( int32_t pos, etk::UString &insertText);
|
||||||
void Replace( int32_t start, int32_t end, etk::UString &insertText);
|
int32_t Replace( int32_t start, int32_t end, etk::VectorType<int8_t> &insertText);
|
||||||
|
int32_t Replace( int32_t start, int32_t end, etk::UString &insertText);
|
||||||
void Remove( int32_t start, int32_t end);
|
void Remove( int32_t start, int32_t end);
|
||||||
int32_t Indent( selectionType_te select);
|
int32_t Indent( selectionType_te select);
|
||||||
int32_t UnIndent( selectionType_te select);
|
int32_t UnIndent( selectionType_te select);
|
||||||
@ -136,8 +137,8 @@ class EdnBuf {
|
|||||||
void GetSelectionText( selectionType_te select, etk::VectorType<int8_t> &text);
|
void GetSelectionText( selectionType_te select, etk::VectorType<int8_t> &text);
|
||||||
void GetSelectionText( selectionType_te select, etk::UString &text);
|
void GetSelectionText( selectionType_te select, etk::UString &text);
|
||||||
void RemoveSelected( selectionType_te select);
|
void RemoveSelected( selectionType_te select);
|
||||||
void ReplaceSelected( selectionType_te select, etk::VectorType<int8_t> &text);
|
int32_t ReplaceSelected( selectionType_te select, etk::VectorType<int8_t> &text);
|
||||||
void ReplaceSelected( selectionType_te select, etk::UString &text);
|
int32_t ReplaceSelected( selectionType_te select, etk::UString &text);
|
||||||
private:
|
private:
|
||||||
// current selection of the buffer
|
// current selection of the buffer
|
||||||
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
|
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
|
||||||
@ -208,7 +209,8 @@ class EdnBuf {
|
|||||||
void eventModification( int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
|
void eventModification( int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
|
||||||
|
|
||||||
|
|
||||||
int32_t insert( int32_t pos, etk::VectorType<int8_t> &insertText);
|
int32_t LocalInsert( int32_t pos, etk::VectorType<int8_t> &insertText);
|
||||||
|
int32_t LocalInsert( int32_t pos, etk::UString &insertText);
|
||||||
|
|
||||||
bool charMatch( char first, char second, bool caseSensitive = true);
|
bool charMatch( char first, char second, bool caseSensitive = true);
|
||||||
};
|
};
|
||||||
|
@ -220,7 +220,7 @@ void EdnBuf::RemoveSelected(selectionType_te select)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void EdnBuf::ReplaceSelected(selectionType_te select, etk::VectorType<int8_t> &text)
|
int32_t EdnBuf::ReplaceSelected(selectionType_te select, etk::VectorType<int8_t> &text)
|
||||||
{
|
{
|
||||||
int32_t start, end, rectStart, rectEnd;
|
int32_t start, end, rectStart, rectEnd;
|
||||||
bool isRect;
|
bool isRect;
|
||||||
@ -228,19 +228,21 @@ void EdnBuf::ReplaceSelected(selectionType_te select, etk::VectorType<int8_t> &t
|
|||||||
|
|
||||||
// No data selected ...
|
// No data selected ...
|
||||||
if (false == isSelected) {
|
if (false == isSelected) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int32_t returnSize = 0;
|
||||||
// Rectangular selection
|
// Rectangular selection
|
||||||
if (true == isRect) {
|
if (true == isRect) {
|
||||||
//ReplaceRect(start, end, rectStart, rectEnd, text);
|
//ReplaceRect(start, end, rectStart, rectEnd, text);
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
} else {
|
} else {
|
||||||
Replace(start, end, text);
|
returnSize = Replace(start, end, text);
|
||||||
}
|
}
|
||||||
// Clean selection
|
// Clean selection
|
||||||
m_selectionList[select].selected = false;
|
m_selectionList[select].selected = false;
|
||||||
|
return returnSize;
|
||||||
}
|
}
|
||||||
void EdnBuf::ReplaceSelected(selectionType_te select, etk::UString &text)
|
int32_t EdnBuf::ReplaceSelected(selectionType_te select, etk::UString &text)
|
||||||
{
|
{
|
||||||
int32_t start, end, rectStart, rectEnd;
|
int32_t start, end, rectStart, rectEnd;
|
||||||
bool isRect;
|
bool isRect;
|
||||||
@ -248,17 +250,19 @@ void EdnBuf::ReplaceSelected(selectionType_te select, etk::UString &text)
|
|||||||
|
|
||||||
// No data selected ...
|
// No data selected ...
|
||||||
if (false == isSelected) {
|
if (false == isSelected) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int32_t returnSize = 0;
|
||||||
// Rectangular selection
|
// Rectangular selection
|
||||||
if (true == isRect) {
|
if (true == isRect) {
|
||||||
//ReplaceRect(start, end, rectStart, rectEnd, text);
|
//ReplaceRect(start, end, rectStart, rectEnd, text);
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
} else {
|
} else {
|
||||||
Replace(start, end, text);
|
returnSize = Replace(start, end, text);
|
||||||
}
|
}
|
||||||
// Clean selection
|
// Clean selection
|
||||||
m_selectionList[select].selected = false;
|
m_selectionList[select].selected = false;
|
||||||
|
return returnSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user