Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f0cda0de78 | |||
e21e7e7c21 | |||
cd84475aea | |||
71fa38d61e | |||
fdd4ddf978 | |||
f610c23638 |
@@ -16,6 +16,7 @@ LOCAL_SRC_FILES := ewolAndroidAbstraction.cpp \
|
||||
LOCAL_LDLIBS := -llog -landroid
|
||||
|
||||
LOCAL_CFLAGS := -D__PLATFORM__Android \
|
||||
-D__MODE__Touch \
|
||||
-DEWOL_USE_FREE_TYPE \
|
||||
-DETK_DEBUG_LEVEL=3 \
|
||||
-DEDN_DEBUG_LEVEL=3 \
|
||||
|
@@ -45,7 +45,7 @@ Buffer::Buffer()
|
||||
static int32_t fileBasicID = 0;
|
||||
m_fileModify = true;
|
||||
m_haveName = false;
|
||||
etk::String mString = "Untitle - ";
|
||||
etk::UString mString = "Untitle - ";
|
||||
mString += fileBasicID++;
|
||||
SetFileName(mString);
|
||||
m_haveName = false;
|
||||
@@ -270,22 +270,22 @@ void Buffer::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void Buffer::AddChar(char * UTF8data)
|
||||
void Buffer::AddChar(uniChar_t unicodeData)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
void Buffer::Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
|
||||
void Buffer::Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
void Buffer::Replace(etk::String &data)
|
||||
void Buffer::Replace(etk::UString &data)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
int32_t Buffer::FindLine(etk::String &data)
|
||||
int32_t Buffer::FindLine(etk::UString &data)
|
||||
{
|
||||
// nothing to do
|
||||
return 0;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#ifndef __BUFFER_H__
|
||||
#define __BUFFER_H__
|
||||
|
||||
#include <etk/String.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/File.h>
|
||||
#include <Display.h>
|
||||
#include <etk/unicode.h>
|
||||
@@ -61,7 +61,7 @@ class Buffer {
|
||||
NameChange();
|
||||
};
|
||||
|
||||
void SetFileName(etk::String &newName)
|
||||
void SetFileName(etk::UString &newName)
|
||||
{
|
||||
m_fileName.SetCompleateName(newName, etk::FILE_TYPE_DIRECT);
|
||||
m_haveName = true;
|
||||
@@ -88,7 +88,7 @@ class Buffer {
|
||||
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||
virtual void ForceReDraw(bool allElement);
|
||||
virtual void AddChar(char * UTF8data);
|
||||
virtual void AddChar(uniChar_t unicodeData);
|
||||
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
||||
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
|
||||
virtual void MouseEvent(int32_t width, int32_t height);
|
||||
@@ -107,9 +107,9 @@ class Buffer {
|
||||
virtual void Copy(int8_t clipboardID);
|
||||
virtual void Cut(int8_t clipboardID);
|
||||
virtual void Paste(int8_t clipboardID);
|
||||
virtual void Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
||||
virtual void Replace(etk::String &data);
|
||||
virtual int32_t FindLine(etk::String &data);
|
||||
virtual void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
||||
virtual void Replace(etk::UString &data);
|
||||
virtual int32_t FindLine(etk::UString &data);
|
||||
virtual void JumpAtLine(int32_t newLine);
|
||||
virtual int32_t GetCurrentLine(void);
|
||||
|
||||
|
@@ -90,13 +90,25 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||
int32_t fontId = OOTextNormal->GetFontID();
|
||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||
|
||||
coord2D_ts textPos;
|
||||
textPos.x = 20;
|
||||
textPos.y = 20;
|
||||
clipping_ts drawClipping;
|
||||
drawClipping.x = 0;
|
||||
drawClipping.y = 0;
|
||||
drawClipping.w = sizeX;
|
||||
drawClipping.h = sizeY;
|
||||
|
||||
myColor = myColorManager->Get("normal");
|
||||
OOTextNormal->SetColor(myColor->GetFG());
|
||||
OOTextNormal->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
|
||||
etk::UString tmpDisplay = "edn - Editeur De N'ours";
|
||||
OOTextBold->Text(textPos, drawClipping, tmpDisplay);
|
||||
|
||||
myColor = myColorManager->Get("commentDoxygen");
|
||||
OOTextNormal->SetColor(myColor->GetFG());
|
||||
OOTextNormal->TextAdd(20, (int32_t)(20 + letterHeight*1.30), "No Buffer Availlable to display", sizeX);
|
||||
textPos.y = (int32_t)(textPos.y + letterHeight*1.30);
|
||||
tmpDisplay = "No Buffer Availlable to display";
|
||||
OOTextNormal->Text(textPos, drawClipping, tmpDisplay);
|
||||
|
||||
|
||||
color_ts bgColor; //!< Text color
|
||||
|
@@ -51,6 +51,8 @@ BufferManager::BufferManager(void)
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiClose);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiSave);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewSelectedId);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
|
||||
|
||||
/*
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
|
||||
@@ -83,7 +85,21 @@ BufferManager::~BufferManager(void)
|
||||
|
||||
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
if (generateEventId == ednMsgGuiNew) {
|
||||
if (generateEventId == ednMsgBufferId) {
|
||||
// select a new buffer ID :
|
||||
if (NULL == data) {
|
||||
EDN_ERROR("Request select buffer ID = NULL ????");
|
||||
} else {
|
||||
int32_t newID = -1;
|
||||
sscanf(data, "%d", &newID);
|
||||
if(true == Exist(newID)) {
|
||||
m_idSelected = newID;
|
||||
} else {
|
||||
m_idSelected = -1;
|
||||
EDN_ERROR("Request a non existant ID : " << newID << " reset to -1...");
|
||||
}
|
||||
}
|
||||
} else if (generateEventId == ednMsgGuiNew) {
|
||||
int32_t newOne = Create();
|
||||
if (-1 != newOne) {
|
||||
m_idSelected = newOne;
|
||||
@@ -134,10 +150,48 @@ bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateE
|
||||
if (NULL == data) {
|
||||
EDN_ERROR("Null data for close file ... ");
|
||||
} else {
|
||||
if (0 == strcmp(data , "current")) {
|
||||
|
||||
} else if (0 == strcmp(data , "All")) {
|
||||
if (0 == strcmp(data , "All")) {
|
||||
|
||||
} else {
|
||||
int32_t closeID = -1;
|
||||
if (0 == strcmp(data , "current")) {
|
||||
closeID = m_idSelected;
|
||||
EDN_DEBUG("Close specific buffer ID" << closeID);
|
||||
} else {
|
||||
// close specific buffer ...
|
||||
sscanf(data, "%d", &closeID);
|
||||
EDN_DEBUG("Close specific buffer ID="<< closeID);
|
||||
}
|
||||
if(true == Exist(closeID)) {
|
||||
// Get the new display buffer
|
||||
if (m_idSelected == closeID) {
|
||||
// Try previous buffer
|
||||
int32_t destBuffer = -1;
|
||||
for(int32_t ii=closeID-1; ii >= 0; ii--) {
|
||||
if (true == Exist(ii) ) {
|
||||
destBuffer = ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// try next buffer
|
||||
if (-1 == destBuffer) {
|
||||
for(int32_t ii=closeID+1; ii < listBuffer.Size(); ii++) {
|
||||
if (true == Exist(ii) ) {
|
||||
destBuffer = ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// set it to the currect display
|
||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, destBuffer);
|
||||
m_idSelected = destBuffer;
|
||||
}
|
||||
// Remove requested buffer
|
||||
Remove(closeID);
|
||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
|
||||
} else {
|
||||
EDN_ERROR("Request Close of a non existant ID : " << closeID);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (generateEventId == ednMsgCodeViewSelectedId) {
|
||||
@@ -160,39 +214,6 @@ bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateE
|
||||
/*
|
||||
switch (id)
|
||||
{
|
||||
case EDN_MSG__BUFF_ID_CLOSE:
|
||||
// Check buffer existence
|
||||
if(true == Exist(dataID)) {
|
||||
// Get the new display buffer
|
||||
if (m_idSelected == dataID) {
|
||||
// Try previous buffer
|
||||
int32_t destBuffer = -1;
|
||||
for(int32_t ii=dataID-1; ii >= 0; ii--) {
|
||||
if (true == Exist(ii) ) {
|
||||
destBuffer = ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
|
||||
// try next buffer
|
||||
if (-1 == destBuffer) {
|
||||
for(int32_t ii=dataID+1; ii < listBuffer.Size(); ii++) {
|
||||
if (true == Exist(ii) ) {
|
||||
destBuffer = ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
|
||||
// set it to the currect display
|
||||
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, destBuffer);
|
||||
}
|
||||
//EDN_DEBUG("Remove : " << dataID);
|
||||
// Remove requested buffer
|
||||
Remove(dataID);
|
||||
}
|
||||
break;
|
||||
case EDN_MSG__BUFF_ID_SAVE:
|
||||
// Check buffer existence
|
||||
if(true == Exist(dataID)) {
|
||||
// If no name ==> request a Gui display ...
|
||||
@@ -342,6 +363,19 @@ uint32_t BufferManager::Size(void)
|
||||
return listBuffer.Size();
|
||||
}
|
||||
|
||||
// nb of opens file Now ...
|
||||
uint32_t BufferManager::SizeOpen(void)
|
||||
{
|
||||
uint32_t jjj = 0;
|
||||
// check if the Buffer existed
|
||||
for (int32_t iii=0; iii<listBuffer.Size(); iii++) {
|
||||
// check if the buffer already existed
|
||||
if (NULL != listBuffer[iii]) {
|
||||
jjj++;
|
||||
}
|
||||
}
|
||||
return jjj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
|
@@ -60,6 +60,7 @@ class BufferManager: public etk::Singleton<BufferManager>, public ewol::Widget
|
||||
int32_t GetId(etk::File &myFile);
|
||||
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||
uint32_t Size(void);
|
||||
uint32_t SizeOpen(void);
|
||||
int32_t WitchBuffer(int32_t iEmeElement);
|
||||
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <BufferText.h>
|
||||
#include <toolsMemory.h>
|
||||
#include <etk/RegExp.h>
|
||||
#include <etk/unicode.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/OObject.h>
|
||||
@@ -137,7 +138,7 @@ BufferText::BufferText(etk::File &fileName) : Buffer(fileName)
|
||||
FILE * myFile = NULL;
|
||||
// try to open the file. if not existed, new file
|
||||
|
||||
myFile = fopen(fileName.GetCompleateName().c_str(), "r");
|
||||
myFile = fopen(fileName.GetCompleateName().Utf8Data(), "r");
|
||||
if (NULL != myFile) {
|
||||
m_EdnBuf.DumpFrom(myFile);
|
||||
// close the input file
|
||||
@@ -165,7 +166,7 @@ void BufferText::Save(void)
|
||||
{
|
||||
EDN_INFO("Save File : \"" << GetFileName() << "\"" );
|
||||
FILE * myFile = NULL;
|
||||
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
|
||||
myFile = fopen(GetFileName().GetCompleateName().Utf8Data(), "w");
|
||||
if (NULL != myFile) {
|
||||
m_EdnBuf.DumpIn(myFile);
|
||||
fclose(myFile);
|
||||
@@ -246,7 +247,19 @@ void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObjec
|
||||
OOColored->SetColor(myColorManager->Get(COLOR_LIST_BG_2));
|
||||
OOColored->Rectangle( 0, positionY, sizeX+0.5*SEPARATION_SIZE_LINE_NUMBER, sizeY);
|
||||
OOText->SetColor(myColorManager->Get(COLOR_CODE_LINE_NUMBER));
|
||||
OOText->TextAdd(1, positionY, tmpLineNumber, -1);
|
||||
|
||||
|
||||
coord2D_ts textPos;
|
||||
textPos.x = 1;
|
||||
textPos.y = positionY;
|
||||
clipping_ts drawClipping;
|
||||
drawClipping.x = 0;
|
||||
drawClipping.y = 0;
|
||||
drawClipping.w = sizeX;
|
||||
drawClipping.h = sizeY;
|
||||
// TODO : Remove this unreallistic leak of time
|
||||
etk::UString tmppp = tmpLineNumber;
|
||||
OOText->Text(textPos, drawClipping, tmppp);
|
||||
}
|
||||
|
||||
#define CURSOR_WIDTH (5)
|
||||
@@ -390,6 +403,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||
|
||||
uniChar_t displayChar[MAX_EXP_CHAR_LEN];
|
||||
memset(displayChar, 0, sizeof(uniChar_t)*MAX_EXP_CHAR_LEN);
|
||||
etk::UString myStringToDisplay;
|
||||
// draw the lineNumber :
|
||||
int32_t currentLineID = m_displayStartLineId+1;
|
||||
EDN_VERBOSE("Start display of text buffer [" << m_displayStartBufferPos<< ".." << mylen << "]");
|
||||
@@ -468,7 +482,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||
}
|
||||
}
|
||||
OOTextSelected->SetColor(selectColor->GetFG());
|
||||
drawSize = OOTextSelected->TextAdd(textPos, drawClippingTextArea, displayChar);
|
||||
// TODO : Remove this unreallistic leak of time
|
||||
myStringToDisplay = displayChar;
|
||||
drawSize = OOTextSelected->Text(textPos, drawClippingTextArea, myStringToDisplay);
|
||||
if (true == haveBg ) {
|
||||
OOColored->Rectangle(textPos.x, y, drawSize, letterHeight, drawClippingTextArea);
|
||||
}
|
||||
@@ -1035,102 +1051,94 @@ void BufferText::UpdateWindowsPosition(bool centerPage)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void BufferText::AddChar(char * UTF8data)
|
||||
void BufferText::AddChar(uniChar_t unicodeData)
|
||||
{
|
||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||
bool SelectionIsRect;
|
||||
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
||||
|
||||
int32_t size=strlen(UTF8data);
|
||||
bool actionDone = false;
|
||||
if (1==size) {
|
||||
if (UTF8data[0] == 0x09) {
|
||||
if (false == haveSelectionActive) {
|
||||
if (unicodeData == 0x09) {
|
||||
if (false == haveSelectionActive) {
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(0x09);
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+1, true);
|
||||
} else {
|
||||
// Indent depend of the multiline in the selection ...
|
||||
// count the number of line :
|
||||
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
|
||||
if (0 == nbSelectedLines) {
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(0x09);
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+1, true);
|
||||
} else {
|
||||
// Indent depend of the multiline in the selection ...
|
||||
// count the number of line :
|
||||
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
|
||||
if (0 == nbSelectedLines) {
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(0x09);
|
||||
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, tmpVect);
|
||||
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
|
||||
} else {
|
||||
if (true == ewol::IsSetShift() ) {
|
||||
m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY);
|
||||
} else {
|
||||
m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
actionDone = true;
|
||||
} else if (UTF8data[0] == '\n') {
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
if (true == ewol::IsSetShift()) {
|
||||
tmpVect.PushBack('\r');
|
||||
} else {
|
||||
tmpVect.PushBack('\n');
|
||||
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
|
||||
if (true == globals::IsSetAutoIndent() ) {
|
||||
int32_t l_lineStart;
|
||||
// Get the begin of the line or the begin of the line befor selection
|
||||
if (false == haveSelectionActive) {
|
||||
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||
} else {
|
||||
l_lineStart = m_EdnBuf.StartOfLine(SelectionStart);
|
||||
}
|
||||
// add same characters in the temporar buffer
|
||||
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
|
||||
if (' ' == m_EdnBuf[kk]) {
|
||||
tmpVect.PushBack(' ');
|
||||
} else if('\t' == m_EdnBuf[kk]) {
|
||||
tmpVect.PushBack('\t');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set temporary buffer in the real buffer
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+tmpVect.Size(), true);
|
||||
} else {
|
||||
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, tmpVect);
|
||||
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
|
||||
}
|
||||
actionDone = true;
|
||||
} else if (UTF8data[0] == 0x7F ) {
|
||||
//EDN_INFO("keyEvent : <Suppr> pos=" << m_cursorPos);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Remove(m_cursorPos, m_cursorPos+1);
|
||||
} else {
|
||||
m_EdnBuf.RemoveSelected(SELECTION_PRIMARY);
|
||||
SetInsertPosition(SelectionStart, true);
|
||||
if (true == ewol::IsSetShift() ) {
|
||||
m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY);
|
||||
} else {
|
||||
m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY);
|
||||
}
|
||||
}
|
||||
actionDone = true;
|
||||
} else if (UTF8data[0] == 0x08) {
|
||||
//EDN_INFO("keyEvent : <Del> pos=" << m_cursorPos);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Remove(m_cursorPos-1, m_cursorPos);
|
||||
SetInsertPosition(m_cursorPos-1, true);
|
||||
} else {
|
||||
m_EdnBuf.RemoveSelected(SELECTION_PRIMARY);
|
||||
SetInsertPosition(SelectionStart, true);
|
||||
}
|
||||
actionDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (false == actionDone) {
|
||||
} else if (unicodeData == '\n') {
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
if (true == ewol::IsSetShift()) {
|
||||
tmpVect.PushBack('\r');
|
||||
} else {
|
||||
tmpVect.PushBack('\n');
|
||||
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
|
||||
if (true == globals::IsSetAutoIndent() ) {
|
||||
int32_t l_lineStart;
|
||||
// Get the begin of the line or the begin of the line befor selection
|
||||
if (false == haveSelectionActive) {
|
||||
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||
} else {
|
||||
l_lineStart = m_EdnBuf.StartOfLine(SelectionStart);
|
||||
}
|
||||
// add same characters in the temporar buffer
|
||||
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
|
||||
if (' ' == m_EdnBuf[kk]) {
|
||||
tmpVect.PushBack(' ');
|
||||
} else if('\t' == m_EdnBuf[kk]) {
|
||||
tmpVect.PushBack('\t');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set temporary buffer in the real buffer
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+tmpVect.Size(), true);
|
||||
} else {
|
||||
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, tmpVect);
|
||||
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
|
||||
}
|
||||
} else if (unicodeData == 0x7F ) {
|
||||
//EDN_INFO("keyEvent : <Suppr> pos=" << m_cursorPos);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Remove(m_cursorPos, m_cursorPos+1);
|
||||
} else {
|
||||
m_EdnBuf.RemoveSelected(SELECTION_PRIMARY);
|
||||
SetInsertPosition(SelectionStart, true);
|
||||
}
|
||||
} else if (unicodeData == 0x08) {
|
||||
//EDN_INFO("keyEvent : <Del> pos=" << m_cursorPos);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Remove(m_cursorPos-1, m_cursorPos);
|
||||
SetInsertPosition(m_cursorPos-1, true);
|
||||
} else {
|
||||
m_EdnBuf.RemoveSelected(SELECTION_PRIMARY);
|
||||
SetInsertPosition(SelectionStart, true);
|
||||
}
|
||||
} else {
|
||||
// normal adding char ...
|
||||
if (true == m_EdnBuf.GetUTF8Mode()) {
|
||||
char tmpUTF8[16];
|
||||
unicode::convertUnicodeToUtf8(unicodeData, tmpUTF8);
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
int32_t localOfset = strlen(UTF8data);
|
||||
tmpVect.PushBack((int8_t*)UTF8data, localOfset);
|
||||
int32_t localOfset = strlen(tmpUTF8);
|
||||
tmpVect.PushBack((int8_t*)tmpUTF8, localOfset);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+localOfset, true);
|
||||
@@ -1141,7 +1149,7 @@ void BufferText::AddChar(char * UTF8data)
|
||||
} else {
|
||||
// convert in the Good ISO format :
|
||||
char output_ISO;
|
||||
convertUtf8ToIso(m_EdnBuf.GetCharsetType(), UTF8data, output_ISO);
|
||||
unicode::convertUnicodeToIso(m_EdnBuf.GetCharsetType(), unicodeData, output_ISO);
|
||||
//printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(output_ISO);
|
||||
@@ -1160,16 +1168,17 @@ void BufferText::AddChar(char * UTF8data)
|
||||
}
|
||||
|
||||
|
||||
int32_t BufferText::FindLine(etk::String &data)
|
||||
int32_t BufferText::FindLine(etk::UString &data)
|
||||
{
|
||||
if ( 0 == data.Size()) {
|
||||
EDN_WARNING("no search data");
|
||||
return 0;
|
||||
}
|
||||
EDN_INFO("Search data line : \"" << data << "\"");
|
||||
etk::VectorType<int8_t> mVectSearch;
|
||||
etk::VectorType<uniChar_t> mVectSearch;
|
||||
mVectSearch = data.GetVector();
|
||||
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
|
||||
/*
|
||||
int32_t foundPos;
|
||||
bool findSomething = m_EdnBuf.SearchForward(0, mVectSearch, &foundPos, true);
|
||||
// if find data :
|
||||
@@ -1178,6 +1187,9 @@ int32_t BufferText::FindLine(etk::String &data)
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
EDN_TODO("Remove for now ...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BufferText::JumpAtLine(int32_t newLine)
|
||||
@@ -1204,7 +1216,7 @@ int32_t BufferText::GetCurrentLine(void)
|
||||
|
||||
|
||||
|
||||
void BufferText::Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
|
||||
void BufferText::Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp)
|
||||
{
|
||||
EDN_INFO("Search data : \"" << data << "\"");
|
||||
|
||||
@@ -1225,8 +1237,10 @@ void BufferText::Search(etk::String &data, bool back, bool caseSensitive, bool w
|
||||
EDN_WARNING("no search data");
|
||||
return;
|
||||
}
|
||||
etk::VectorType<int8_t> mVectSearch;
|
||||
etk::VectorType<uniChar_t> mVectSearch;
|
||||
mVectSearch = data.GetVector();
|
||||
EDN_TODO("Remove for now ...");
|
||||
/*
|
||||
if (false == back) {
|
||||
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
|
||||
int32_t foundPos;
|
||||
@@ -1264,44 +1278,21 @@ void BufferText::Search(etk::String &data, bool back, bool caseSensitive, bool w
|
||||
UpdateWindowsPosition();
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE : Need to be use in the highligner and the current buffer when we select Regular Expression ...
|
||||
/*
|
||||
// Test avec le truc de regExp :
|
||||
char * myBuf = m_EdnBuf.GetRange(0, m_EdnBuf.Size());
|
||||
regexp *compiledRE;
|
||||
char *compileMsg;
|
||||
|
||||
compiledRE = CompileRE(data.GetDirectPointer(), &compileMsg, REDFLT_STANDARD);
|
||||
if (compiledRE == NULL) {
|
||||
EDN_ERROR("RegExpression : \"" << data.GetDirectPointer() << "\" error named : \"" << compileMsg << "\"" );
|
||||
} else {
|
||||
EDN_DEBUG("RegExpression : \"" << data.GetDirectPointer() << "\" OK ... ");
|
||||
if (true == ExecRE(compiledRE, NULL, myBuf, NULL, false, '\0', '\0', NULL, NULL)) {
|
||||
EDN_INFO(" ==> top_branch=" << compiledRE->top_branch << "; extentpBW=" << (int32_t)(compiledRE->extentpBW - myBuf) << "; extentpFW=" << (int32_t)(compiledRE->extentpFW - myBuf));
|
||||
} else {
|
||||
EDN_INFO(" ==> not fined ... ");
|
||||
}
|
||||
}
|
||||
|
||||
// free copy of buffer ...
|
||||
if (myBuf != NULL) {
|
||||
free(myBuf);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void BufferText::Replace(etk::String &data)
|
||||
void BufferText::Replace(etk::UString &data)
|
||||
{
|
||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||
bool SelectionIsRect;
|
||||
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
||||
if (true == haveSelectionActive) {
|
||||
// Replace Data :
|
||||
etk::VectorType<int8_t> myData = data.GetVector();
|
||||
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, myData);
|
||||
SetInsertPosition(SelectionStart + myData.Size());
|
||||
etk::VectorType<uniChar_t> myData = data.GetVector();
|
||||
EDN_TODO("Remove for now ...");
|
||||
//m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, myData);
|
||||
//SetInsertPosition(SelectionStart + myData.Size());
|
||||
}
|
||||
SetModify(true);
|
||||
}
|
||||
@@ -1317,13 +1308,15 @@ void BufferText::Replace(etk::String &data)
|
||||
*/
|
||||
void BufferText::Copy(int8_t clipboardID)
|
||||
{
|
||||
etk::VectorType<int8_t> mVect;
|
||||
etk::VectorType<uniChar_t> mVect;
|
||||
// get the curent selected data
|
||||
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 :
|
||||
ClipBoard::Set(clipboardID, mVect);
|
||||
//ClipBoard::Set(clipboardID, mVect);
|
||||
EDN_TODO("Remove for now ...");
|
||||
}
|
||||
|
||||
|
||||
@@ -1366,7 +1359,10 @@ void BufferText::Cut(int8_t clipboardID)
|
||||
*/
|
||||
void BufferText::Paste(int8_t clipboardID)
|
||||
{
|
||||
etk::VectorType<int8_t> mVect;
|
||||
etk::VectorType<uniChar_t> mVect;
|
||||
|
||||
EDN_TODO("Remove for now ...");
|
||||
/*
|
||||
// copy data from the click board :
|
||||
ClipBoard::Get(clipboardID, mVect);
|
||||
|
||||
@@ -1383,7 +1379,7 @@ void BufferText::Paste(int8_t clipboardID)
|
||||
m_EdnBuf.Insert(m_cursorPos, mVect);
|
||||
m_cursorPos += mVect.Size();
|
||||
}
|
||||
|
||||
*/
|
||||
UpdateWindowsPosition();
|
||||
ForceReDraw(true);
|
||||
SetModify(true);
|
||||
|
@@ -54,7 +54,7 @@ class BufferText : public Buffer {
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY);
|
||||
void ForceReDraw(bool allElement);
|
||||
void AddChar(char * UTF8data);
|
||||
void AddChar(uniChar_t unicodeData);
|
||||
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
||||
void MouseSelectFromCursorTo(int32_t width, int32_t height);
|
||||
void MouseEvent(int32_t width, int32_t height);
|
||||
@@ -67,9 +67,9 @@ class BufferText : public Buffer {
|
||||
void Cut(int8_t clipboardID);
|
||||
void Paste(int8_t clipboardID);
|
||||
|
||||
void Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
||||
void Replace(etk::String &data);
|
||||
int32_t FindLine(etk::String &data);
|
||||
void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
||||
void Replace(etk::UString &data);
|
||||
int32_t FindLine(etk::UString &data);
|
||||
void JumpAtLine(int32_t newLine);
|
||||
int32_t GetCurrentLine(void);
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#define __class__ "Colorize"
|
||||
|
||||
|
||||
Colorize::Colorize( etk::String &newColorName)
|
||||
Colorize::Colorize( etk::UString &newColorName)
|
||||
{
|
||||
|
||||
m_colorFG.red=0;
|
||||
@@ -85,14 +85,14 @@ void Colorize::SetName(const char *newColorName)
|
||||
ColorName = newColorName;
|
||||
}
|
||||
|
||||
void Colorize::SetName(etk::String &newColorName)
|
||||
void Colorize::SetName(etk::UString &newColorName)
|
||||
{
|
||||
//EDN_INFO("color change name : \"%s\" ==> \"%s\"",ColorName.c_str(), newColorName.c_str());
|
||||
ColorName = newColorName;
|
||||
}
|
||||
|
||||
|
||||
etk::String Colorize::GetName(void)
|
||||
etk::UString Colorize::GetName(void)
|
||||
{
|
||||
return ColorName;
|
||||
}
|
||||
|
@@ -31,12 +31,12 @@ class Colorize {
|
||||
public:
|
||||
// Constructeur
|
||||
Colorize(void);
|
||||
Colorize(etk::String &newColorName);
|
||||
Colorize(etk::UString &newColorName);
|
||||
~Colorize(void);
|
||||
|
||||
void SetName(etk::String &newColorName);
|
||||
void SetName(etk::UString &newColorName);
|
||||
void SetName(const char *newColorName);
|
||||
etk::String GetName(void);
|
||||
etk::UString GetName(void);
|
||||
void SetFgColor(const char *myColor);
|
||||
void SetBgColor(const char *myColor);
|
||||
|
||||
@@ -50,10 +50,10 @@ class Colorize {
|
||||
bool GetItalic(void);
|
||||
bool GetBold(void);
|
||||
|
||||
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName.c_str() << "\"" << " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<","<< m_colorFG.alpha /*<<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
|
||||
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName << "\"" << " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<","<< m_colorFG.alpha /*<<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
|
||||
|
||||
private:
|
||||
etk::String ColorName; //!< curent color Name
|
||||
etk::UString ColorName; //!< curent color Name
|
||||
color_ts m_colorFG;
|
||||
color_ts m_colorBG;
|
||||
|
||||
|
@@ -61,9 +61,9 @@ bool ColorizeManager::OnEventAreaExternal(int32_t widgetID, const char * generat
|
||||
case EDN_MSG__RELOAD_COLOR_FILE:
|
||||
{
|
||||
// Reaload File
|
||||
// TODO : Check this : Pb in the recopy etk::String element
|
||||
etk::String plop = m_fileColor;
|
||||
LoadFile(plop.c_str());
|
||||
// TODO : Check this : Pb in the recopy etk::UString element
|
||||
etk::UString plop = m_fileColor;
|
||||
LoadFile(plop);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -72,11 +72,13 @@ bool ColorizeManager::OnEventAreaExternal(int32_t widgetID, const char * generat
|
||||
}
|
||||
|
||||
|
||||
void ColorizeManager::LoadFile(etk::String &xmlFilename)
|
||||
void ColorizeManager::LoadFile(etk::UString &xmlFilename)
|
||||
{
|
||||
LoadFile(xmlFilename.c_str());
|
||||
// TODO : Remove this
|
||||
LoadFile(xmlFilename.Utf8Data());
|
||||
}
|
||||
|
||||
// TODO : Remove this ...
|
||||
void ColorizeManager::LoadFile(const char * xmlFilename)
|
||||
{
|
||||
// Remove all old color :
|
||||
@@ -273,11 +275,12 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
|
||||
//SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
|
||||
}
|
||||
|
||||
// TODO : Remove this ...
|
||||
Colorize *ColorizeManager::Get(const char *colorName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listMyColor.Size(); i++) {
|
||||
etk::String elementName = listMyColor[i]->GetName();
|
||||
etk::UString elementName = listMyColor[i]->GetName();
|
||||
if (elementName == colorName) {
|
||||
return listMyColor[i];
|
||||
}
|
||||
@@ -287,9 +290,10 @@ Colorize *ColorizeManager::Get(const char *colorName)
|
||||
return errorColor;
|
||||
}
|
||||
|
||||
Colorize *ColorizeManager::Get(etk::String &colorName)
|
||||
Colorize *ColorizeManager::Get(etk::UString &colorName)
|
||||
{
|
||||
return Get(colorName.c_str());
|
||||
// TODO : Remove this
|
||||
return Get(colorName.Utf8Data());
|
||||
}
|
||||
|
||||
color_ts & ColorizeManager::Get(basicColor_te myColor)
|
||||
@@ -302,20 +306,23 @@ color_ts & ColorizeManager::Get(basicColor_te myColor)
|
||||
}
|
||||
|
||||
|
||||
// TODO : Remove this ...
|
||||
bool ColorizeManager::Exist(const char *colorName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listMyColor.Size(); i++) {
|
||||
etk::String elementName = listMyColor[i]->GetName();
|
||||
etk::UString elementName = listMyColor[i]->GetName();
|
||||
if (elementName == colorName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool ColorizeManager::Exist(etk::String &colorName)
|
||||
|
||||
bool ColorizeManager::Exist(etk::UString &colorName)
|
||||
{
|
||||
return Exist(colorName.c_str());
|
||||
// TODO : Remove this
|
||||
return Exist(colorName.Utf8Data());
|
||||
}
|
||||
|
||||
void ColorizeManager::DisplayListOfColor(void)
|
||||
@@ -323,7 +330,7 @@ void ColorizeManager::DisplayListOfColor(void)
|
||||
int32_t i;
|
||||
EDN_INFO(PFX"List of ALL COLOR : ");
|
||||
for (i=0; i<listMyColor.Size(); i++) {
|
||||
//etk::String elementName = listMyColor[i]->GetName();
|
||||
//etk::UString elementName = listMyColor[i]->GetName();
|
||||
//EDN_INFO(i << " : \"" << elementName.c_str() << "\"" );
|
||||
listMyColor[i]->Display(i);
|
||||
}
|
||||
|
@@ -61,17 +61,17 @@ class ColorizeManager: public etk::Singleton<ColorizeManager>, public ewol::Widg
|
||||
public:
|
||||
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
public:
|
||||
void LoadFile(etk::String &xmlFilename);
|
||||
void LoadFile(etk::UString &xmlFilename);
|
||||
void LoadFile(const char * xmlFilename);
|
||||
Colorize * Get(const char *colorName);
|
||||
Colorize * Get(etk::String &colorName);
|
||||
Colorize * Get(etk::UString &colorName);
|
||||
color_ts & Get(basicColor_te myColor);
|
||||
bool Exist(etk::String &colorName);
|
||||
bool Exist(etk::UString &colorName);
|
||||
bool Exist(const char *colorName);
|
||||
void DisplayListOfColor(void);
|
||||
|
||||
private:
|
||||
etk::String m_fileColor;
|
||||
etk::UString m_fileColor;
|
||||
etk::VectorType<Colorize*> listMyColor; //!< List of ALL Color
|
||||
Colorize * errorColor;
|
||||
color_ts basicColors[COLOR_NUMBER_MAX];
|
||||
|
@@ -81,7 +81,7 @@ uint32_t BufferView::GetNuberOfColomn(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool BufferView::GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg)
|
||||
bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg)
|
||||
{
|
||||
myTitle = "Buffers : ";
|
||||
return true;
|
||||
@@ -90,28 +90,33 @@ bool BufferView::GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, co
|
||||
uint32_t BufferView::GetNuberOfRaw(void)
|
||||
{
|
||||
if (NULL != m_bufferManager) {
|
||||
return m_bufferManager->Size();
|
||||
return m_bufferManager->SizeOpen();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg)
|
||||
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg)
|
||||
{
|
||||
etk::File name;
|
||||
bool isModify;
|
||||
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||
basicColor_te selectBG = COLOR_LIST_BG_1;
|
||||
if (m_bufferManager->Exist(raw)) {
|
||||
isModify = m_bufferManager->Get(raw)->IsModify();
|
||||
name = m_bufferManager->Get(raw)->GetFileName();
|
||||
|
||||
// transforme the ID in the real value ...
|
||||
int32_t realID = m_bufferManager->WitchBuffer(raw+1);
|
||||
if (m_bufferManager->Exist(realID)) {
|
||||
isModify = m_bufferManager->Get(realID)->IsModify();
|
||||
name = m_bufferManager->Get(realID)->GetFileName();
|
||||
char *tmpModify = (char*)" ";
|
||||
if (true == isModify) {
|
||||
tmpModify = (char*)"M";
|
||||
}
|
||||
char name2[1024] = "";
|
||||
sprintf(name2, "[%2d](%s) %s", raw, tmpModify, name.GetShortFilename().c_str() );
|
||||
|
||||
myTextToWrite = name2;
|
||||
myTextToWrite = "[";
|
||||
myTextToWrite += realID;
|
||||
myTextToWrite += "](";
|
||||
myTextToWrite += tmpModify;
|
||||
myTextToWrite += ") ";
|
||||
myTextToWrite += name.GetShortFilename();
|
||||
|
||||
if (true == isModify) {
|
||||
selectFG = COLOR_LIST_TEXT_MODIFY;
|
||||
@@ -231,7 +236,6 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
|
||||
monDrawer.Flush();
|
||||
lineID ++;
|
||||
}
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
@@ -40,15 +40,14 @@ class BufferView : public ewol::List
|
||||
// Constructeur
|
||||
BufferView(void);
|
||||
~BufferView(void);
|
||||
//GtkWidget *GetMainWidget(void);
|
||||
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
protected:
|
||||
// function call to display the list :
|
||||
virtual color_ts GetBasicBG(void);
|
||||
virtual uint32_t GetNuberOfColomn(void);
|
||||
virtual bool GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg);
|
||||
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg);
|
||||
virtual uint32_t GetNuberOfRaw(void);
|
||||
virtual bool GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg);
|
||||
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg);
|
||||
virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y);
|
||||
private:
|
||||
// r<>cup<75>ration des proprieter g<>n<EFBFBD>ral...
|
||||
|
@@ -70,30 +70,6 @@ CodeView::CodeView(void)
|
||||
m_textColorBg.alpha = 0.25;
|
||||
SetCanHaveFocus(true);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
|
||||
|
||||
|
||||
//old
|
||||
/*
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSave);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSaveAs);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSelectAll);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentRemoveLine);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentUnSelect);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentCopy);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentCut);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentPaste);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentFindPrevious);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentFindNext);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentFindOldNext);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentReplace);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentReplaceAll);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentClose);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentUndo);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentRedo);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentGotoLine);
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSetCharset);
|
||||
*/
|
||||
}
|
||||
|
||||
CodeView::~CodeView(void)
|
||||
@@ -110,7 +86,7 @@ bool CodeView::CalculateMinSize(void)
|
||||
|
||||
void CodeView::CalculateMaxSize(void)
|
||||
{
|
||||
m_maxSize.x = 4096;
|
||||
m_maxSize.x = 2048;
|
||||
int32_t letterHeight = ewol::GetHeight(m_fontNormal);
|
||||
m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight;
|
||||
}
|
||||
@@ -150,11 +126,11 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
|
||||
bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
|
||||
{
|
||||
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
|
||||
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
||||
m_bufferManager->Get(m_bufferID)->AddChar(UTF8_data);
|
||||
m_bufferManager->Get(m_bufferID)->AddChar(unicodeData);
|
||||
MarkToReedraw();
|
||||
}
|
||||
return true;
|
||||
@@ -181,53 +157,29 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
||||
}
|
||||
x -= m_origin.x;
|
||||
y -= m_origin.y;
|
||||
/*
|
||||
etk::String type = (int)typeEvent;
|
||||
switch (typeEvent)
|
||||
{
|
||||
case ewol::EVENT_INPUT_TYPE_DOWN:
|
||||
type = "EVENT_INPUT_TYPE_DOWN";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_MOVE:
|
||||
type = "EVENT_INPUT_TYPE_MOVE";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_SINGLE:
|
||||
type = "EVENT_INPUT_TYPE_SINGLE";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_DOUBLE:
|
||||
type = "EVENT_INPUT_TYPE_DOUBLE";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_TRIPLE:
|
||||
type = "EVENT_INPUT_TYPE_TRIPLE";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_UP:
|
||||
type = "EVENT_INPUT_TYPE_UP";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_ENTER:
|
||||
type = "EVENT_INPUT_TYPE_ENTER";
|
||||
break;
|
||||
case ewol::EVENT_INPUT_TYPE_LEAVE:
|
||||
type = "EVENT_INPUT_TYPE_LEAVE";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
EDN_DEBUG("Event : " << IdInput << " type : " << type << " position(" << x << "," << y << ")");
|
||||
*/
|
||||
if (1 == IdInput) {
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_buttunOneSelected = true;
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
||||
MarkToReedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_buttunOneSelected = false;
|
||||
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
|
||||
MarkToReedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
// nothing to do ...
|
||||
#ifndef __MODE__Touch
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_buttunOneSelected = true;
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
||||
MarkToReedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_buttunOneSelected = false;
|
||||
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
|
||||
MarkToReedraw();
|
||||
} else
|
||||
#endif
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
#ifdef __MODE__Touch
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
||||
MarkToReedraw();
|
||||
#else
|
||||
// nothing to do ...
|
||||
#endif
|
||||
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
||||
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
|
||||
@@ -260,22 +212,6 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
}
|
||||
}
|
||||
// TODO : No mere used here ... ==> set in the scrooled windows ...
|
||||
/*
|
||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
|
||||
{
|
||||
//EDN_INFO("mouse-event GDK_SCROLL_UP");
|
||||
m_bufferManager->Get(m_bufferID)->ScrollUp();
|
||||
MarkToReedraw();
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
|
||||
{
|
||||
//EDN_INFO("mouse-event GDK_SCROLL_DOWN");
|
||||
m_bufferManager->Get(m_bufferID)->ScrollDown();
|
||||
MarkToReedraw();
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -396,21 +332,21 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
|
||||
break;
|
||||
case EDN_MSG__CURRENT_FIND_PREVIOUS:
|
||||
{
|
||||
etk::String myDataString;
|
||||
etk::UString myDataString;
|
||||
SearchData::GetSearch(myDataString);
|
||||
m_bufferManager->Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
|
||||
}
|
||||
break;
|
||||
case EDN_MSG__CURRENT_FIND_NEXT:
|
||||
{
|
||||
etk::String myDataString;
|
||||
etk::UString myDataString;
|
||||
SearchData::GetSearch(myDataString);
|
||||
m_bufferManager->Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
|
||||
}
|
||||
break;
|
||||
case EDN_MSG__CURRENT_REPLACE:
|
||||
{
|
||||
etk::String myDataString;
|
||||
etk::UString myDataString;
|
||||
SearchData::GetReplace(myDataString);
|
||||
m_bufferManager->Get(m_bufferID)->Replace(myDataString);
|
||||
}
|
||||
@@ -467,7 +403,7 @@ void CodeView::SetFontSize(int32_t size)
|
||||
m_fontSize = size;
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameNormal(etk::String fontName)
|
||||
void CodeView::SetFontNameNormal(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
@@ -475,7 +411,7 @@ void CodeView::SetFontNameNormal(etk::String fontName)
|
||||
}
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBold(etk::String fontName)
|
||||
void CodeView::SetFontNameBold(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
@@ -483,7 +419,7 @@ void CodeView::SetFontNameBold(etk::String fontName)
|
||||
}
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameItalic(etk::String fontName)
|
||||
void CodeView::SetFontNameItalic(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
@@ -491,7 +427,7 @@ void CodeView::SetFontNameItalic(etk::String fontName)
|
||||
}
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBoldItalic(etk::String fontName)
|
||||
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include <MsgBroadcast.h>
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/widget/WidgetScrolled.h>
|
||||
|
||||
class CodeView :public ewol::WidgetScrooled
|
||||
@@ -43,7 +42,7 @@ class CodeView :public ewol::WidgetScrooled
|
||||
virtual ~CodeView(void);
|
||||
virtual bool CalculateMinSize(void);
|
||||
private:
|
||||
etk::String m_label;
|
||||
etk::UString m_label;
|
||||
color_ts m_textColorFg; //!< Text color
|
||||
color_ts m_textColorBg; //!< Background color
|
||||
BufferManager * m_bufferManager;
|
||||
@@ -55,7 +54,7 @@ class CodeView :public ewol::WidgetScrooled
|
||||
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
public:
|
||||
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
|
||||
virtual void OnGetFocus(void);
|
||||
virtual void OnLostFocus(void);
|
||||
@@ -67,10 +66,10 @@ class CodeView :public ewol::WidgetScrooled
|
||||
int32_t m_fontBoldItalic;
|
||||
public:
|
||||
void SetFontSize(int32_t size);
|
||||
void SetFontNameNormal(etk::String fontName);
|
||||
void SetFontNameBold(etk::String fontName);
|
||||
void SetFontNameItalic(etk::String fontName);
|
||||
void SetFontNameBoldItalic(etk::String fontName);
|
||||
void SetFontNameNormal(etk::UString fontName);
|
||||
void SetFontNameBold(etk::UString fontName);
|
||||
void SetFontNameItalic(etk::UString fontName);
|
||||
void SetFontNameBoldItalic(etk::UString fontName);
|
||||
private:
|
||||
void CalculateMaxSize(void);
|
||||
};
|
||||
|
@@ -195,9 +195,9 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
|
||||
return false;
|
||||
}
|
||||
// get the filename :
|
||||
etk::String tmpData = tmpWidget->GetCompleateFileName();
|
||||
etk::UString tmpData = tmpWidget->GetCompleateFileName();
|
||||
EDN_DEBUG("Request opening the file : " << tmpData);
|
||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgOpenFile, tmpData.c_str());
|
||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgOpenFile, tmpData);
|
||||
PopUpWidgetPop();
|
||||
} else if (generateEventId == ednMsgGuiSaveAs) {
|
||||
if (NULL == data) {
|
||||
@@ -218,8 +218,8 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
|
||||
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
|
||||
tmpWidget->SetTitle("Save Files As...");
|
||||
tmpWidget->SetValidateLabel("Save");
|
||||
etk::String folder = "/home/";
|
||||
etk::String fileName = "";
|
||||
etk::UString folder = "/home/";
|
||||
etk::UString fileName = "";
|
||||
if (true == myBuffer->HaveName()) {
|
||||
etk::File tmpName = myBuffer->GetFileName();
|
||||
folder = tmpName.GetFolder();
|
||||
@@ -237,6 +237,23 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
|
||||
}
|
||||
}
|
||||
} else if (generateEventId == ednEventPopUpFileSaveAs) {
|
||||
// get widget:
|
||||
ewol::FileChooser * tmpWidget = (ewol::FileChooser*)ewol::widgetManager::Get(widgetID);
|
||||
if (NULL == tmpWidget) {
|
||||
EDN_ERROR("impossible to get pop_upWidget " << widgetID);
|
||||
PopUpWidgetPop();
|
||||
return false;
|
||||
}
|
||||
// get the filename :
|
||||
etk::UString tmpData = tmpWidget->GetCompleateFileName();
|
||||
EDN_DEBUG("Request Saving As file : " << tmpData);
|
||||
|
||||
BufferManager * myMng = BufferManager::getInstance();
|
||||
myMng->Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);
|
||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiSave, m_currentSavingAsIdBuffer);
|
||||
|
||||
//ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgOpenFile, tmpData);
|
||||
|
||||
PopUpWidgetPop();
|
||||
}
|
||||
return true;
|
||||
@@ -261,7 +278,7 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
|
||||
// select the program icone
|
||||
GError *err = NULL;
|
||||
etk::String iconeFile;
|
||||
etk::UString iconeFile;
|
||||
iconeFile = "/usr/share/edn/images/icone.png";
|
||||
|
||||
GdkPixbuf * icone = gdk_pixbuf_new_from_file(iconeFile.c_str(), &err);
|
||||
@@ -286,7 +303,7 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
GtkWidget *hboxMenu = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start( GTK_BOX (vbox), hboxMenu, FALSE, FALSE, 0);
|
||||
// Add Exit boutton
|
||||
etk::String ExitIconeFile;
|
||||
etk::UString ExitIconeFile;
|
||||
ExitIconeFile = "/usr/share/edn/images/delete-24px.png";
|
||||
// TODO : find a good way to change the size of an image
|
||||
GtkWidget *myImageQuit = gtk_image_new_from_file(ExitIconeFile.c_str());
|
||||
@@ -340,7 +357,7 @@ MainWindows::~MainWindows(void)
|
||||
|
||||
void MainWindows::SetTitle(etk::File &fileName, bool isModify)
|
||||
{
|
||||
etk::String tmp = "";
|
||||
etk::UString tmp = "";
|
||||
if (fileName.GetShortFilename() != "") {
|
||||
tmp += fileName.GetShortFilename();
|
||||
tmp += " - ";
|
||||
@@ -364,7 +381,7 @@ void MainWindows::SetTitle(etk::File &fileName, bool isModify)
|
||||
|
||||
void MainWindows::SetNoTitle(void)
|
||||
{
|
||||
etk::String tmp = "Edn";
|
||||
etk::UString tmp = "Edn";
|
||||
//gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
|
||||
//gtk_label_set_text(GTK_LABEL(m_internalTitleLabel), tmp.c_str());
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ static void CB_menuInternal(GtkMenuItem *menu_item, gpointer data)
|
||||
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_UTF8);
|
||||
} else if (myPointer == MSG_LoadColorWhite) {
|
||||
ColorizeManager * myColorSystem = ColorizeManager::getInstance();
|
||||
etk::String homedir;
|
||||
etk::UString homedir;
|
||||
# ifdef NDEBUG
|
||||
homedir = "/usr/share/edn/";
|
||||
# else
|
||||
@@ -89,7 +89,7 @@ static void CB_menuInternal(GtkMenuItem *menu_item, gpointer data)
|
||||
myColorSystem->LoadFile(homedir);
|
||||
} else if (myPointer == MSG_LoadColorBlack) {
|
||||
ColorizeManager * myColorSystem = ColorizeManager::getInstance();
|
||||
etk::String homedir;
|
||||
etk::UString homedir;
|
||||
# ifdef NDEBUG
|
||||
homedir = "/usr/share/edn/";
|
||||
# else
|
||||
|
@@ -195,7 +195,7 @@ void Search::Display(GtkWindow *parent)
|
||||
gtk_widget_set_sensitive(m_CkMatchCase, true);
|
||||
}
|
||||
// Remove data form the search
|
||||
etk::String myDataString = "";
|
||||
etk::UString myDataString = "";
|
||||
SearchData::SetSearch(myDataString);
|
||||
gtk_entry_set_text(GTK_ENTRY(m_searchEntry), myDataString.c_str());
|
||||
if (0 == strlen(myDataString.c_str())) {
|
||||
@@ -321,7 +321,7 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
|
||||
// update research data
|
||||
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
|
||||
if (NULL != testData) {
|
||||
etk::String myDataString = testData;
|
||||
etk::UString myDataString = testData;
|
||||
SearchData::SetSearch(myDataString);
|
||||
if (0 == strlen(testData)) {
|
||||
self->m_haveSearchData = false;
|
||||
@@ -347,7 +347,7 @@ void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
|
||||
// update replace data
|
||||
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
|
||||
if (NULL != testData) {
|
||||
etk::String myDataString = testData;
|
||||
etk::UString myDataString = testData;
|
||||
SearchData::SetReplace(myDataString);
|
||||
if (0 == strlen(testData)) {
|
||||
self->m_haveReplaceData = false;
|
||||
|
@@ -31,13 +31,13 @@
|
||||
#define __class__ "SearchData"
|
||||
|
||||
|
||||
static etk::String m_findRequest = "";
|
||||
static etk::UString m_findRequest = "";
|
||||
|
||||
void SearchData::SetSearch(etk::String &myData)
|
||||
void SearchData::SetSearch(etk::UString &myData)
|
||||
{
|
||||
m_findRequest = myData;
|
||||
}
|
||||
void SearchData::GetSearch(etk::String &myData)
|
||||
void SearchData::GetSearch(etk::UString &myData)
|
||||
{
|
||||
myData = m_findRequest;
|
||||
}
|
||||
@@ -49,12 +49,12 @@ bool SearchData::IsSearchEmpty(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static etk::String m_replaceRequest = "";
|
||||
void SearchData::SetReplace(etk::String &myData)
|
||||
static etk::UString m_replaceRequest = "";
|
||||
void SearchData::SetReplace(etk::UString &myData)
|
||||
{
|
||||
m_replaceRequest = myData;
|
||||
}
|
||||
void SearchData::GetReplace(etk::String &myData)
|
||||
void SearchData::GetReplace(etk::UString &myData)
|
||||
{
|
||||
myData = m_replaceRequest;
|
||||
}
|
||||
|
@@ -30,11 +30,11 @@
|
||||
|
||||
namespace SearchData
|
||||
{
|
||||
void SetSearch(etk::String &myData);
|
||||
void GetSearch(etk::String &myData);
|
||||
void SetSearch(etk::UString &myData);
|
||||
void GetSearch(etk::UString &myData);
|
||||
bool IsSearchEmpty(void);
|
||||
void SetReplace(etk::String &myData);
|
||||
void GetReplace(etk::String &myData);
|
||||
void SetReplace(etk::UString &myData);
|
||||
void GetReplace(etk::UString &myData);
|
||||
bool IsReplaceEmpty(void);
|
||||
void SetCase(bool value);
|
||||
bool GetCase(void);
|
||||
|
@@ -131,7 +131,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
||||
idSelected = dataID;
|
||||
}
|
||||
Buffer *myBuffer = BufferManager::getInstance()->Get(idSelected);
|
||||
etk::String tmpString = "Save as file : ";
|
||||
etk::UString tmpString = "Save as file : ";
|
||||
tmpString += myBuffer->GetFileName().GetShortFilename().c_str();
|
||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
@@ -142,7 +142,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
||||
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
|
||||
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
etk::String myfilename;
|
||||
etk::UString myfilename;
|
||||
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
|
||||
|
||||
myBuffer->SetFileName(myfilename);
|
||||
|
@@ -45,7 +45,7 @@ void Highlight::ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*>
|
||||
|
||||
|
||||
|
||||
Highlight::Highlight(etk::String &xmlFilename)
|
||||
Highlight::Highlight(etk::UString &xmlFilename)
|
||||
{
|
||||
TiXmlDocument XmlDocument;
|
||||
|
||||
@@ -99,7 +99,7 @@ Highlight::Highlight(etk::String &xmlFilename)
|
||||
const char *myData = child->ToElement()->GetText();
|
||||
if (NULL != myData) {
|
||||
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
|
||||
etk::String * myEdnData = new etk::String(myData);
|
||||
etk::UString * myEdnData = new etk::UString(myData);
|
||||
m_listExtentions.PushBack(myEdnData);
|
||||
}
|
||||
} else if (!strcmp(child->Value(), "pass1")) {
|
||||
@@ -180,7 +180,7 @@ void Highlight::ReloadColor(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool Highlight::HasExtention(etk::String &ext)
|
||||
bool Highlight::HasExtention(etk::UString &ext)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<m_listExtentions.Size(); i++) {
|
||||
@@ -194,7 +194,7 @@ bool Highlight::HasExtention(etk::String &ext)
|
||||
bool Highlight::FileNameCompatible(etk::File &fileName)
|
||||
{
|
||||
int32_t i;
|
||||
etk::String extention;
|
||||
etk::UString extention;
|
||||
if (true == fileName.HasExtention() ) {
|
||||
extention = "*.";
|
||||
extention += fileName.GetExtention();
|
||||
|
@@ -50,9 +50,9 @@ extern "C" {
|
||||
class Highlight {
|
||||
public:
|
||||
// Constructeur
|
||||
Highlight(etk::String &xmlFilename);
|
||||
Highlight(etk::UString &xmlFilename);
|
||||
~Highlight(void);
|
||||
bool HasExtention(etk::String &ext);
|
||||
bool HasExtention(etk::UString &ext);
|
||||
bool FileNameCompatible(etk::File &fileName);
|
||||
void Display(void);
|
||||
void ReloadColor(void);
|
||||
@@ -67,8 +67,8 @@ class Highlight {
|
||||
EdnVectorBuf &buffer);
|
||||
private:
|
||||
void ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*> &mListPatern, int32_t level);
|
||||
etk::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
etk::VectorType<etk::String*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
etk::VectorType<etk::UString*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
etk::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
|
||||
etk::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
|
||||
};
|
||||
|
@@ -91,7 +91,7 @@ bool HighlightManager::Exist(etk::File &fileName)
|
||||
|
||||
void HighlightManager::loadLanguages(void)
|
||||
{
|
||||
etk::String xmlFilename = "lang_c.xml";
|
||||
etk::UString xmlFilename = "lang_c.xml";
|
||||
Highlight *myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
class HighlightManager;
|
||||
|
||||
#include <etk/Singleton.h>
|
||||
#include <etk/UString.h>
|
||||
#include <MsgBroadcast.h>
|
||||
#include <Highlight.h>
|
||||
#include <ewol/Widget.h>
|
||||
|
@@ -50,12 +50,12 @@ HighlightPattern::~HighlightPattern(void)
|
||||
delete(m_regExpStop);
|
||||
}
|
||||
|
||||
void HighlightPattern::SetPaternStart(etk::String ®Exp)
|
||||
void HighlightPattern::SetPaternStart(etk::UString ®Exp)
|
||||
{
|
||||
m_regExpStart->SetRegExp(regExp);
|
||||
}
|
||||
|
||||
void HighlightPattern::SetPaternStop(etk::String ®Exp)
|
||||
void HighlightPattern::SetPaternStop(etk::UString ®Exp)
|
||||
{
|
||||
if (regExp.Size() != 0) {
|
||||
m_regExpStop->SetRegExp(regExp);
|
||||
@@ -65,17 +65,17 @@ void HighlightPattern::SetPaternStop(etk::String ®Exp)
|
||||
}
|
||||
}
|
||||
|
||||
void HighlightPattern::SetEscapeChar(etk::String &EscapeChar)
|
||||
void HighlightPattern::SetEscapeChar(etk::UString &EscapeChar)
|
||||
{
|
||||
if (EscapeChar.Size()>0) {
|
||||
m_escapeChar = EscapeChar.c_str()[0];
|
||||
m_escapeChar = EscapeChar[0];
|
||||
} else {
|
||||
m_escapeChar = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HighlightPattern::SetColor(etk::String &colorName)
|
||||
void HighlightPattern::SetColor(etk::UString &colorName)
|
||||
{
|
||||
m_colorName = colorName;
|
||||
ColorizeManager *myColorManager = ColorizeManager::getInstance();
|
||||
@@ -140,7 +140,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
|
||||
//--------------------------------------------------------------------------------------------
|
||||
// process attribute
|
||||
const char *highLightName = child->ToElement()->Attribute("name");
|
||||
etk::String myEdnDataTmp = "???";
|
||||
etk::UString myEdnDataTmp = "???";
|
||||
if (NULL != highLightName) {
|
||||
myEdnDataTmp = highLightName;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
|
||||
const char *myData = xChild->GetText();
|
||||
if (myData) {
|
||||
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::String myEdnData = myData;
|
||||
etk::UString myEdnData = myData;
|
||||
SetColor(myEdnData);
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
|
||||
const char *myData = xChild->GetText();
|
||||
if (myData) {
|
||||
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::String myEdnData = myData;
|
||||
etk::UString myEdnData = myData;
|
||||
SetPaternStart(myEdnData);
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
|
||||
const char *myData = xChild->GetText();
|
||||
if (myData) {
|
||||
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::String myEdnData = myData;
|
||||
etk::UString myEdnData = myData;
|
||||
SetPaternStop(myEdnData);
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
|
||||
const char *myData = xChild->GetText();
|
||||
if (myData) {
|
||||
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
etk::String myEdnData = myData;
|
||||
etk::UString myEdnData = myData;
|
||||
SetEscapeChar(myEdnData);
|
||||
}
|
||||
}
|
||||
|
@@ -51,13 +51,13 @@ class HighlightPattern {
|
||||
HighlightPattern(void);
|
||||
~HighlightPattern(void);
|
||||
|
||||
void SetName(etk::String &name) { m_paternName = name;};
|
||||
etk::String GetName(void) { return m_paternName;};
|
||||
void SetName(etk::UString &name) { m_paternName = name;};
|
||||
etk::UString GetName(void) { return m_paternName;};
|
||||
|
||||
void SetPaternStart(etk::String ®Exp);
|
||||
void SetPaternStop(etk::String ®Exp);
|
||||
void SetColor(etk::String &colorName);
|
||||
void SetEscapeChar(etk::String &EscapeChar);
|
||||
void SetPaternStart(etk::UString ®Exp);
|
||||
void SetPaternStop(etk::UString ®Exp);
|
||||
void SetColor(etk::UString &colorName);
|
||||
void SetEscapeChar(etk::UString &EscapeChar);
|
||||
void SetMultiline(bool enable) { m_multiline = enable; };
|
||||
|
||||
void SetLevel(int32_t newLevel) { m_level = newLevel; };
|
||||
@@ -73,14 +73,14 @@ class HighlightPattern {
|
||||
|
||||
private:
|
||||
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
|
||||
etk::String m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||
etk::String m_colorName; //!< Current color name
|
||||
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||
etk::UString m_colorName; //!< Current color name
|
||||
Colorize * m_color; //!< Link to the color manager
|
||||
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
|
||||
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
|
||||
bool m_haveStopPatern; //!< Stop patern presence
|
||||
bool m_multiline; //!< The patern is multiline
|
||||
char m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
||||
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
||||
etk::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
|
||||
// etk::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
|
||||
};
|
||||
|
@@ -72,7 +72,7 @@ CTagsManager::~CTagsManager(void)
|
||||
*/
|
||||
}
|
||||
|
||||
etk::String CTagsManager::GetFolder(etk::String &inputString)
|
||||
etk::UString CTagsManager::GetFolder(etk::UString &inputString)
|
||||
{
|
||||
/*
|
||||
char tmpVal[4096];
|
||||
@@ -82,7 +82,7 @@ etk::String CTagsManager::GetFolder(etk::String &inputString)
|
||||
if (NULL == ptr) {
|
||||
ptr = strrchr(tmpVal, '\\');
|
||||
}
|
||||
etk::String out = "./";
|
||||
etk::UString out = "./";
|
||||
if (NULL != ptr) {
|
||||
*ptr = '\0';
|
||||
out = tmpVal;
|
||||
@@ -90,7 +90,7 @@ etk::String CTagsManager::GetFolder(etk::String &inputString)
|
||||
}
|
||||
return out;
|
||||
*/
|
||||
etk::String out = "./";
|
||||
etk::UString out = "./";
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ void CTagsManager::JumpTo(void)
|
||||
|
||||
// For all tags : Save in an internal Structure :
|
||||
do {
|
||||
etk::String destinationFilename = m_tagFolderBase;
|
||||
etk::UString destinationFilename = m_tagFolderBase;
|
||||
destinationFilename += entry.file;
|
||||
etk::File myfile = destinationFilename;
|
||||
TagListFind_ts myStruct;
|
||||
|
@@ -58,9 +58,9 @@ class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
|
||||
int32_t MultipleJump(void);
|
||||
void JumpTo(void);
|
||||
void PrintTag(const tagEntry *entry, bool small);
|
||||
etk::String GetFolder(etk::String &inputString);
|
||||
etk::String m_tagFolderBase;
|
||||
etk::String m_tagFilename;
|
||||
etk::UString GetFolder(etk::UString &inputString);
|
||||
etk::UString m_tagFolderBase;
|
||||
etk::UString m_tagFilename;
|
||||
tagFile * m_ctagFile;
|
||||
// history system
|
||||
void AddToHistory(int32_t bufferID);
|
||||
|
@@ -31,12 +31,12 @@
|
||||
#include <ColorizeManager.h>
|
||||
#include <HighlightManager.h>
|
||||
#include <ClipBoard.h>
|
||||
#include <etk/String.h>
|
||||
#include <WindowsManager.h>
|
||||
#include <Search.h>
|
||||
#include <unistd.h>
|
||||
#include <readtags.h>
|
||||
#include <CTagsManager.h>
|
||||
#include <etk/UString.h>
|
||||
#include <ewol/WidgetMessageMultiCast.h>
|
||||
|
||||
MainWindows * basicWindows = NULL;
|
||||
@@ -47,12 +47,28 @@ MainWindows * basicWindows = NULL;
|
||||
*/
|
||||
void APP_Init(void)
|
||||
{
|
||||
etk::UString myTmpString("test <20>l<EFBFBD>mentaire...");
|
||||
|
||||
EDN_CRITICAL("essay de UString : " << myTmpString);
|
||||
|
||||
myTmpString = "TT...SDFSDFSDFQAEZqsdgfqsdfqskdj";
|
||||
|
||||
EDN_CRITICAL("essay de UString : " << myTmpString);
|
||||
|
||||
myTmpString += "19";
|
||||
|
||||
EDN_CRITICAL("essay de UString : " << myTmpString);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EDN_INFO("==> Init Edn (START)");
|
||||
ewol::ChangeSize(800, 600);
|
||||
|
||||
// set the default Path of the application :
|
||||
#ifdef PLATFORM_Linux
|
||||
etk::String homedir;
|
||||
etk::UString homedir;
|
||||
#ifdef NDEBUG
|
||||
homedir = "/usr/share/"PROJECT_NAME"/";
|
||||
#else
|
||||
@@ -65,7 +81,8 @@ void APP_Init(void)
|
||||
homedir += "/assets/";
|
||||
}
|
||||
#endif
|
||||
SetBaseFolderData(homedir.c_str());
|
||||
// TODO : Remove the Utf8Data
|
||||
SetBaseFolderData(homedir.Utf8Data());
|
||||
SetBaseFolderDataUser("~/."PROJECT_NAME"/");
|
||||
SetBaseFolderCache("/tmp/"PROJECT_NAME"/");
|
||||
#endif
|
||||
@@ -92,8 +109,8 @@ void APP_Init(void)
|
||||
// set color and other trucs...
|
||||
ColorizeManager *myColorManager = NULL;
|
||||
myColorManager = ColorizeManager::getInstance();
|
||||
etk::String homedir = "color_white.xml";
|
||||
myColorManager->LoadFile( homedir.c_str() );
|
||||
etk::UString homedir = "color_white.xml";
|
||||
myColorManager->LoadFile( homedir.Utf8Data() );
|
||||
myColorManager->DisplayListOfColor();
|
||||
|
||||
HighlightManager *myHighlightManager = NULL;
|
||||
@@ -124,7 +141,8 @@ void APP_Init(void)
|
||||
|
||||
for( int32_t iii=0 ; iii<ewol::CmdLineNb(); iii++) {
|
||||
EDN_INFO("need load file : \"" << ewol::CmdLineGet(iii) << "\"" );
|
||||
ewol::widgetMessageMultiCast::Send(-1, ednMsgOpenFile, ewol::CmdLineGet(iii).c_str());
|
||||
etk::UString tmpppp = ewol::CmdLineGet(iii);
|
||||
ewol::widgetMessageMultiCast::Send(-1, ednMsgOpenFile, tmpppp);
|
||||
}
|
||||
EDN_INFO("==> Init Edn (END)");
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
int32_t i;
|
||||
/*
|
||||
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
|
||||
etk::String ploppp;
|
||||
etk::UString ploppp;
|
||||
if (NULL != m_HLDataPass1[i].patern ) {
|
||||
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
|
||||
}
|
||||
@@ -105,7 +105,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
//EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
|
||||
/*
|
||||
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
|
||||
etk::String ploppp;
|
||||
etk::UString ploppp;
|
||||
if (NULL != m_HLDataPass1[i].patern ) {
|
||||
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
}
|
||||
/*
|
||||
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
|
||||
etk::String ploppp;
|
||||
etk::UString ploppp;
|
||||
if (NULL != m_HLDataPass1[i].patern ) {
|
||||
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#define __MSG_BROADCAST_H__
|
||||
|
||||
#include <tools_debug.h>
|
||||
#include <etk/String.h>
|
||||
#include <etk/UString.h>
|
||||
|
||||
|
||||
// new list of edn event generic :
|
||||
|
@@ -59,7 +59,7 @@ extern const char * ednLog;
|
||||
# define EDN_VERBOSE(data) do {}while(0)
|
||||
#endif
|
||||
|
||||
#define EDN_TODO(data) DRAW_WARNING("TODO : " << data)
|
||||
#define EDN_TODO(data) ETK_WARNING(ednLog, "TODO : " << data)
|
||||
|
||||
#define EDN_ASSERT(cond, data) ETK_ASSERT(ednLog, cond, data)
|
||||
|
||||
|
Reference in New Issue
Block a user