Change the Sting un Unicode management

This commit is contained in:
Edouard Dupin 2012-02-15 16:23:20 +01:00
parent e21e7e7c21
commit f0cda0de78
31 changed files with 199 additions and 173 deletions

View File

@ -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;
@ -275,17 +275,17 @@ 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;

View File

@ -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;
@ -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);

View File

@ -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

View File

@ -138,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
@ -166,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);
@ -247,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)
@ -391,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 << "]");
@ -469,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);
}
@ -1153,16 +1168,17 @@ void BufferText::AddChar(uniChar_t unicodeData)
}
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 :
@ -1171,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)
@ -1197,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 << "\"");
@ -1218,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;
@ -1257,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);
}
@ -1310,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 ...");
}
@ -1359,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);
@ -1376,7 +1379,7 @@ void BufferText::Paste(int8_t clipboardID)
m_EdnBuf.Insert(m_cursorPos, mVect);
m_cursorPos += mVect.Size();
}
*/
UpdateWindowsPosition();
ForceReDraw(true);
SetModify(true);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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];

View File

@ -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;
@ -95,7 +95,7 @@ uint32_t BufferView::GetNuberOfRaw(void)
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;
@ -111,10 +111,12 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWr
if (true == isModify) {
tmpModify = (char*)"M";
}
char name2[1024] = "";
sprintf(name2, "[%2d](%s) %s", realID, 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;

View File

@ -45,9 +45,9 @@ class BufferView : public ewol::List
// 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ération des proprieter général...

View File

@ -332,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);
}
@ -403,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) {
@ -411,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) {
@ -419,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) {
@ -427,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) {

View File

@ -42,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;
@ -66,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);
};

View File

@ -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();
@ -245,14 +245,14 @@ 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 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.c_str());
//ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgOpenFile, tmpData);
PopUpWidgetPop();
}
@ -278,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);
@ -303,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());
@ -357,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 += " - ";
@ -381,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());
}

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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)) )
};

View File

@ -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);

View File

@ -29,6 +29,7 @@
class HighlightManager;
#include <etk/Singleton.h>
#include <etk/UString.h>
#include <MsgBroadcast.h>
#include <Highlight.h>
#include <ewol/Widget.h>

View File

@ -50,12 +50,12 @@ HighlightPattern::~HighlightPattern(void)
delete(m_regExpStop);
}
void HighlightPattern::SetPaternStart(etk::String &regExp)
void HighlightPattern::SetPaternStart(etk::UString &regExp)
{
m_regExpStart->SetRegExp(regExp);
}
void HighlightPattern::SetPaternStop(etk::String &regExp)
void HighlightPattern::SetPaternStop(etk::UString &regExp)
{
if (regExp.Size() != 0) {
m_regExpStop->SetRegExp(regExp);
@ -65,17 +65,17 @@ void HighlightPattern::SetPaternStop(etk::String &regExp)
}
}
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);
}
}

View File

@ -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 &regExp);
void SetPaternStop(etk::String &regExp);
void SetColor(etk::String &colorName);
void SetEscapeChar(etk::String &EscapeChar);
void SetPaternStart(etk::UString &regExp);
void SetPaternStop(etk::UString &regExp);
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 ...
};

View File

@ -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;

View File

@ -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);

View File

@ -31,7 +31,6 @@
#include <ColorizeManager.h>
#include <HighlightManager.h>
#include <ClipBoard.h>
#include <etk/String.h>
#include <WindowsManager.h>
#include <Search.h>
#include <unistd.h>
@ -69,7 +68,7 @@ void APP_Init(void)
// set the default Path of the application :
#ifdef PLATFORM_Linux
etk::String homedir;
etk::UString homedir;
#ifdef NDEBUG
homedir = "/usr/share/"PROJECT_NAME"/";
#else
@ -82,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
@ -109,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;
@ -141,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)");
}

View File

@ -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();
}

View File

@ -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 :

View File

@ -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)