[DEV] code style step 1

This commit is contained in:
2013-10-07 22:04:21 +02:00
parent 211c253116
commit d677075e16
45 changed files with 1890 additions and 1890 deletions

View File

@@ -22,20 +22,20 @@
static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
{
etk::Vector<appl::dataBufferStruct *> tmpList = list;
list.Clear();
for(int32_t iii=0; iii<tmpList.Size(); iii++) {
list.clear();
for(int32_t iii=0; iii<tmpList.size(); iii++) {
if (NULL != tmpList[iii]) {
int32_t findPos = 0;
for(int32_t jjj=0; jjj<list.Size(); jjj++) {
for(int32_t jjj=0; jjj<list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (list[jjj]!=NULL) {
if (tmpList[iii]->m_bufferName.GetNameFile() > list[jjj]->m_bufferName.GetNameFile()) {
if (tmpList[iii]->m_bufferName.getNameFile() > list[jjj]->m_bufferName.GetNameFile()) {
findPos = jjj+1;
}
}
}
//EWOL_DEBUG("position="<<findPos);
list.Insert(findPos, tmpList[iii]);
list.insert(findPos, tmpList[iii]);
}
}
}
@@ -44,7 +44,7 @@ static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
BufferView::BufferView(void)
{
SetCanHaveFocus(true);
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferListChange);
RegisterMultiCast(ednMsgBufferState);
RegisterMultiCast(ednMsgBufferId);
@@ -54,37 +54,37 @@ BufferView::BufferView(void)
BufferView::~BufferView(void)
{
RemoveAllElement();
removeAllElement();
}
void BufferView::RemoveAllElement(void)
void BufferView::removeAllElement(void)
{
for(int32_t iii=0; iii<m_list.Size(); iii++) {
for(int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = NULL;
}
}
m_list.Clear();
m_list.clear();
}
void BufferView::OnReceiveMessage(const ewol::EMessage& _msg)
void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::List::OnReceiveMessage(_msg);
if (_msg.GetMessage() == ednMsgBufferListChange) {
widget::List::onReceiveMessage(_msg);
if (_msg.getMessage() == ednMsgBufferListChange) {
// clean The list
RemoveAllElement();
// Get all the buffer name and properties:
int32_t nbBufferOpen = BufferManager::Size();
removeAllElement();
// get all the buffer name and properties:
int32_t nbBufferOpen = BufferManager::size();
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
if (BufferManager::Exist(iii)) {
BufferText* tmpBuffer = BufferManager::Get(iii);
BufferText* tmpBuffer = BufferManager::get(iii);
if (NULL != tmpBuffer) {
bool isModify = tmpBuffer->IsModify();
etk::FSNode name = tmpBuffer->GetFileName();
bool isModify = tmpBuffer->isModify();
etk::FSNode name = tmpBuffer->getFileName();
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
if (NULL != tmpElement) {
m_list.PushBack(tmpElement);
m_list.pushBack(tmpElement);
} else {
APPL_ERROR("Allocation error of the tmp buffer list element");
}
@@ -94,63 +94,63 @@ void BufferView::OnReceiveMessage(const ewol::EMessage& _msg)
if (true == globals::OrderTheBufferList() ) {
SortElementList(m_list);
}
MarkToRedraw();
}else if (_msg.GetMessage() == ednMsgBufferId) {
m_selectedIdRequested = BufferManager::GetSelected();
MarkToRedraw();
}else if (_msg.GetMessage() == ednMsgBufferState) {
// Update list of modify section ...
for (int32_t iii=0; iii<m_list.Size(); iii++) {
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferId) {
m_selectedIdRequested = BufferManager::getSelected();
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferState) {
// update list of modify section ...
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
m_list[iii]->m_isModify = BufferManager::Get(m_list[iii]->m_bufferID)->IsModify();
m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify();
}
}
MarkToRedraw();
markToRedraw();
}
}
etk::Color<> BufferView::GetBasicBG(void)
etk::Color<> BufferView::getBasicBG(void)
{
return ColorizeManager::Get(COLOR_LIST_BG_1);
return ColorizeManager::get(COLOR_LIST_BG_1);
}
uint32_t BufferView::GetNuberOfColomn(void)
uint32_t BufferView::getNuberOfColomn(void)
{
return 1;
}
bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg)
bool BufferView::getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg)
{
myTitle = "Buffers : ";
return true;
}
uint32_t BufferView::GetNuberOfRaw(void)
uint32_t BufferView::getNuberOfRaw(void)
{
return m_list.Size();
return m_list.size();
}
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg)
bool BufferView::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg)
{
bool isModify;
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1;
// when requested a new display selection ==> reset the previous one ...
// when requested a new display selection == > reset the previous one ...
if (m_selectedIdRequested != -1) {
m_selectedID = -1;
}
if( raw>=0
&& raw<m_list.Size()
if( raw >= 0
&& raw<m_list.size()
&& NULL != m_list[raw]) {
myTextToWrite = m_list[raw]->m_bufferName.GetNameFile();
myTextToWrite = m_list[raw]->m_bufferName.getNameFile();
if (true == m_list[raw]->m_isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY;
} else {
selectFG = COLOR_LIST_TEXT_NORMAL;
}
if (raw%2==0) {
if (raw%2 == 0) {
selectBG = COLOR_LIST_BG_1;
} else {
selectBG = COLOR_LIST_BG_2;
@@ -161,7 +161,7 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
// stop searching
m_selectedIdRequested = -1;
// set the raw visible :
SetRawVisible(m_selectedID);
setRawVisible(m_selectedID);
}
if (m_selectedID == raw) {
selectBG = COLOR_LIST_BG_SELECTED;
@@ -169,23 +169,23 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
} else {
myTextToWrite = "ERROR";
}
fg = ColorizeManager::Get(selectFG);
bg = ColorizeManager::Get(selectBG);
fg = ColorizeManager::get(selectFG);
bg = ColorizeManager::get(selectBG);
return true;
}
bool BufferView::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
bool BufferView::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
{
if (1 == IdInput && typeEvent == ewol::keyEvent::statusSingle) {
APPL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
if( raw>=0
&& raw<m_list.Size()
if( raw >= 0
&& raw<m_list.size()
&& NULL != m_list[raw]) {
m_selectedIdRequested = m_list[raw]->m_bufferID;
SendMultiCast(ednMsgBufferId, m_list[raw]->m_bufferID);
}
}
MarkToRedraw();
markToRedraw();
return false;
}

View File

@@ -46,19 +46,19 @@ class BufferView : public widget::List
BufferView(void);
~BufferView(void);
// Derived function
const char * const GetObjectType(void) { return "ApplBufferView"; };
const char * const getObjectType(void) { return "ApplBufferView"; };
// Derived function
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
protected:
// function call to display the list :
virtual etk::Color<> GetBasicBG(void);
void RemoveAllElement(void);
virtual etk::Color<> getBasicBG(void);
void removeAllElement(void);
// Derived function
virtual uint32_t GetNuberOfColomn(void);
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
virtual uint32_t GetNuberOfRaw(void);
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
virtual bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
virtual uint32_t getNuberOfColomn(void);
virtual bool getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
virtual uint32_t getNuberOfRaw(void);
virtual bool getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
virtual bool onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
};

View File

@@ -23,20 +23,20 @@
#undef __class__
#define __class__ "CodeView"
void CodeView::Init(void)
void CodeView::init(void)
{
m_label = "CodeView is disable ...";
m_bufferID = -1;
m_buttunOneSelected = false;
m_lineNumberList.Clear();
m_lineNumberList.clear();
m_textColorFg = etk::color::black;
m_textColorBg = etk::color::black;
m_textColorBg.SetA(0x40);
SetCanHaveFocus(true);
m_textColorBg.setA(0x40);
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferId);
RegisterMultiCast(ednMsgGuiCopy);
RegisterMultiCast(ednMsgGuiPaste);
@@ -49,7 +49,7 @@ void CodeView::Init(void)
RegisterMultiCast(ednMsgGuiFind);
RegisterMultiCast(ednMsgGuiReplace);
RegisterMultiCast(ednMsgGuiGotoLine);
SetLimitScrolling(0.2);
setLimitScrolling(0.2);
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
@@ -63,12 +63,12 @@ void CodeView::Init(void)
CodeView::CodeView(etk::UString fontName, int32_t fontSize) :
m_displayText(fontName, fontSize)
{
Init();
init();
}
CodeView::CodeView(void)
{
Init();
init();
}
CodeView::~CodeView(void)
@@ -81,78 +81,78 @@ CodeView::~CodeView(void)
* @brief Check if the number of reference buffer is good or not ...
* @param[in] bufferID id of the current Buffer that needed to have a reference
*/
void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
void CodeView::updateNumberOfLineReference(int32_t bufferID)
{
vec2 tmpCoord(0,0);
if (m_lineNumberList.Size()<=bufferID) {
if (m_lineNumberList.size() <= bufferID) {
// update the number of elements :
for (int32_t iii=m_lineNumberList.Size(); iii <= bufferID; iii++) {
for (int32_t iii=m_lineNumberList.size(); iii <= bufferID; iii++) {
// add start line at 0 :
m_lineNumberList.PushBack(tmpCoord);
m_lineNumberList.pushBack(tmpCoord);
}
}
}
bool CodeView::CalculateMinSize(void)
bool CodeView::calculateMinSize(void)
{
m_minSize.setValue(50,50);
return true;
}
void CodeView::CalculateMaxSize(void)
void CodeView::calculateMaxSize(void)
{
m_maxSize.setX(2048);
int32_t letterHeight = m_displayText.CalculateSize(etk::UniChar('A')).y();
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
int32_t letterHeight = m_displayText.calculateSize(etk::UniChar('A')).y();
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
m_maxSize.setY(tmpBuffer->GetNumberOfLine() * letterHeight);
m_maxSize.setY(tmpBuffer->getNumberOfLine() * letterHeight);
} else {
m_maxSize.setY(50);
}
}
void CodeView::OnDraw(void)
void CodeView::onDraw(void)
{
m_displayDrawing.Draw();
m_displayText.Draw();
WidgetScrooled::OnDraw();
m_displayDrawing.draw();
m_displayText.draw();
WidgetScrooled::onDraw();
}
void CodeView::OnRegenerateDisplay(void)
void CodeView::onRegenerateDisplay(void)
{
if (true == NeedRedraw()) {
int64_t startTime = ewol::GetTime();
if (true == needRedraw()) {
int64_t startTime = ewol::getTime();
// For the scrooling windows
CalculateMaxSize();
m_displayDrawing.Clear();
m_displayText.Clear();
calculateMaxSize();
m_displayDrawing.clear();
m_displayText.clear();
// Reset the background :
m_displayDrawing.SetPos(vec3(-2048, -2048, 0));
m_displayDrawing.SetColor(ColorizeManager::Get(COLOR_CODE_BASIC_BG));
m_displayDrawing.RectangleWidth(vec3(4096, 4096, 0) );
// reset the background :
m_displayDrawing.setPos(vec3(-2048, -2048, 0));
m_displayDrawing.setColor(ColorizeManager::get(COLOR_CODE_BASIC_BG));
m_displayDrawing.rectangleWidth(vec3(4096, 4096, 0) );
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if( NULL != tmpBuffer
&& true == tmpBuffer->NeedToUpdateDisplayPosition() ) {
vec2 borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
&& true == tmpBuffer->needToUpdateDisplayPosition() ) {
vec2 borderWidth = BufferManager::get(m_bufferID)->getBorderSize();
bool centerRequested = false;
// TODO : set it back ...
vec2 currentPosition = BufferManager::Get(m_bufferID)->GetPosition(999/*m_OObjectTextNormal.GetFontID()*/, centerRequested);
SetScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
vec2 currentPosition = BufferManager::get(m_bufferID)->getPosition(999/*m_OObjectTextNormal.getFontID()*/, centerRequested);
setScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
} // else : nothing to do ...
// generate the objects :
if (-1 == m_bufferID) {
m_displayText.SetTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayDrawing.SetColor(0x00000022);
m_displayDrawing.SetPos(vec3(10, 0, 0));
m_displayDrawing.Rectangle(vec3((int32_t)m_size.x()-20, 1500, 0) );
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayDrawing.setColor(0x00000022);
m_displayDrawing.setPos(vec3(10, 0, 0));
m_displayDrawing.rectangle(vec3((int32_t)m_size.x()-20, 1500, 0) );
m_displayText.SetRelPos(vec3(10, 0, 0));
m_displayText.setRelPos(vec3(10, 0, 0));
// nothing to display :
etk::UString tmpString("<br/>\n"
"<font color=\"red\">\n"
@@ -167,71 +167,71 @@ void CodeView::OnRegenerateDisplay(void)
" No Buffer Availlable to display\n"
" </i>\n"
"</font>\n");
m_displayText.SetPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.ForceLineReturn();
m_displayText.PrintDecorated(tmpString);
m_displayText.setPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.forceLineReturn();
m_displayText.printDecorated(tmpString);
} else {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Display(m_displayText, m_originScrooled.x(), m_originScrooled.y(), m_size.x(), m_size.y());
tmpBuffer->display(m_displayText, m_originScrooled.x(), m_originScrooled.y(), m_size.x(), m_size.y());
}
// set the current size of the windows
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
setMaxSize(BufferManager::get(m_bufferID)->getMaxSize());
}
int64_t stopTime = ewol::GetTime();
int64_t stopTime = ewol::getTime();
APPL_DEBUG("Display Code Generation = " << stopTime - startTime << " micro-s");
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
WidgetScrooled::onRegenerateDisplay();
}
}
bool CodeView::OnEventEntry(const ewol::EventEntry& _event)
bool CodeView::onEventEntry(const ewol::EventEntry& _event)
{
if (_event.GetType() == ewol::keyEvent::keyboardChar) {
if (_event.getType() == ewol::keyEvent::keyboardChar) {
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (_event.GetStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_event.getStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->AddChar(_event.GetChar());
tmpBuffer->addChar(_event.getChar());
}
MarkToRedraw();
markToRedraw();
}
return true;
}
// move events ...
if (_event.GetStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_event.getStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->cursorMove(_event.GetType());
tmpBuffer->cursorMove(_event.getType());
}
MarkToRedraw();
markToRedraw();
}
return true;
}
void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
void CodeView::onEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
{
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Paste(_clipboardID);
}
MarkToRedraw();
markToRedraw();
}
bool CodeView::OnEventInput(const ewol::EventInput& _event)
bool CodeView::onEventInput(const ewol::EventInput& _event)
{
vec2 relativePos = RelativePosition(_event.GetPos());
//APPL_DEBUG("Event at pos : " << _event.GetPos() << " ==> " << relativePos );
vec2 relativePos = relativePosition(_event.getPos());
//APPL_DEBUG("Event at pos : " << _event.getPos() << " == > " << relativePos );
// corection for the openGl abstraction
//relativePos.y = m_size.y - relativePos.y;
vec2 limitedPos = relativePos;
limitedPos.setValue(etk_avg(1, limitedPos.x(), m_size.x()-1),
etk_avg(1, limitedPos.y(), m_size.y()-1));
if (true == WidgetScrooled::OnEventInput(_event)) {
KeepFocus();
if (true == WidgetScrooled::onEventInput(_event)) {
keepFocus();
// nothing to do ... done on upper widget ...
return true;
}
@@ -240,51 +240,51 @@ bool CodeView::OnEventInput(const ewol::EventInput& _event)
return false;
}
if (1 == _event.GetId()) {
if (1 == _event.getId()) {
if (ewol::keyEvent::typeMouse == _event.GetType()) {
if (ewol::keyEvent::statusDown == _event.GetStatus()) {
if (ewol::keyEvent::typeMouse == _event.getType()) {
if (ewol::keyEvent::statusDown == _event.getStatus()) {
m_buttunOneSelected = true;
KeepFocus();
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
keepFocus();
// TODO : set something good
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
MarkToRedraw();
} else if (ewol::keyEvent::statusUp == _event.GetStatus()) {
markToRedraw();
} else if (ewol::keyEvent::statusUp == _event.getStatus()) {
m_buttunOneSelected = false;
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Copy(ewol::clipBoard::clipboardSelection);
}
MarkToRedraw();
markToRedraw();
}
}
if (ewol::keyEvent::statusSingle == _event.GetStatus()) {
if (ewol::keyEvent::typeMouse == _event.GetType()) {
KeepFocus();
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
if (ewol::keyEvent::typeMouse == _event.getType()) {
keepFocus();
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
MarkToRedraw();
markToRedraw();
} else {
// nothing to do ...
}
} else if (ewol::keyEvent::statusDouble == _event.GetStatus()) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (ewol::keyEvent::statusDouble == _event.getStatus()) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEventDouble();
}
MarkToRedraw();
} else if (ewol::keyEvent::statusTriple == _event.GetStatus()) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
markToRedraw();
} else if (ewol::keyEvent::statusTriple == _event.getStatus()) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEventTriple();
}
MarkToRedraw();
} else if (ewol::keyEvent::statusMove == _event.GetStatus()) {
markToRedraw();
} else if (ewol::keyEvent::statusMove == _event.getStatus()) {
if (true == m_buttunOneSelected) {
int xxx, yyy;
xxx = relativePos.x();
@@ -296,185 +296,185 @@ bool CodeView::OnEventInput(const ewol::EventInput& _event)
yyy = 0;
}
//APPL_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
// TODO : set something good
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseSelectFromCursorTo(limitedPos);
}
MarkToRedraw();
markToRedraw();
}
}
} else if (2 == _event.GetId()) {
if (ewol::keyEvent::statusSingle == _event.GetStatus()) {
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (2 == _event.getId()) {
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
// TODO : set something good
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
ewol::clipBoard::Request(ewol::clipBoard::clipboardSelection);
KeepFocus();
keepFocus();
}
}
return true;
}
void CodeView::OnReceiveMessage(const ewol::EMessage& _msg)
void CodeView::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::WidgetScrooled::OnReceiveMessage(_msg);
APPL_DEBUG("Extern Event : " << _msg.GetCaller() << " type : " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\"");
widget::WidgetScrooled::onReceiveMessage(_msg);
APPL_DEBUG("Extern Event : " << _msg.getCaller() << " type : " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\"");
if(_msg.GetMessage() == ednMsgBufferId) {
if(_msg.getMessage() == ednMsgBufferId) {
//keep the reference of the display offset :
if( m_bufferID >=0
&& m_bufferID < m_lineNumberList.Size()) {
if( m_bufferID >= 0
&& m_bufferID < m_lineNumberList.size()) {
m_lineNumberList[m_bufferID] = m_originScrooled;
}
int32_t bufferID = 0;
sscanf(_msg.GetData().c_str(), "%d", &bufferID);
sscanf(_msg.getData().c_str(), "%d", &bufferID);
APPL_INFO("Select a new Buffer ... " << bufferID);
// set the new buffer ID
m_bufferID = bufferID;
// update the start display position...
UpdateNumberOfLineReference(m_bufferID);
updateNumberOfLineReference(m_bufferID);
// set back if needed the display position ...
if( m_bufferID >=0
&& m_bufferID < m_lineNumberList.Size()) {
if( m_bufferID >= 0
&& m_bufferID < m_lineNumberList.size()) {
m_originScrooled = m_lineNumberList[m_bufferID];
}
} else if (_msg.GetMessage() == ednMsgGuiCopy) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiCopy) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Copy(ewol::clipBoard::clipboardStd);
}
} else if (_msg.GetMessage() == ednMsgGuiCut) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiCut) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Cut(ewol::clipBoard::clipboardStd);
}
} else if (_msg.GetMessage() == ednMsgGuiPaste) {
} else if (_msg.getMessage() == ednMsgGuiPaste) {
ewol::clipBoard::Request(ewol::clipBoard::clipboardStd);
} else if (_msg.GetMessage() == ednMsgGuiUndo) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiUndo) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Undo();
}
} else if (_msg.GetMessage() == ednMsgGuiRedo) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiRedo) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Redo();
}
} else if (_msg.GetMessage() == ednMsgGuiRm) {
} else if (_msg.getMessage() == ednMsgGuiRm) {
// data : "Word" "Line" "Paragraph"
if (_msg.GetData() == "Word") {
APPL_WARNING(" on event " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\" ==> not coded" );
} else if (_msg.GetData() == "Line") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_msg.getData() == "Word") {
APPL_WARNING(" on event " << _msg.getMessage() << " data=\"" << _msg.GetData() << "\" == > not coded" );
} else if (_msg.getData() == "Line") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->RemoveLine();
tmpBuffer->removeLine();
}
} else if (_msg.GetData() == "Paragraph") {
APPL_WARNING(" on event " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\" ==> not coded" );
} else if (_msg.getData() == "Paragraph") {
APPL_WARNING(" on event " << _msg.getMessage() << " data=\"" << _msg.GetData() << "\" == > not coded" );
} else {
APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
APPL_ERROR(" on event " << _msg.getMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
}
} else if (_msg.GetMessage() == ednMsgGuiSelect) {
} else if (_msg.getMessage() == ednMsgGuiSelect) {
// data : "ALL" "NONE"
if (_msg.GetData() == "ALL") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_msg.getData() == "ALL") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SelectAll();
}
} else if (_msg.GetData() == "NONE") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "NONE") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SelectNone();
}
} else {
APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
APPL_ERROR(" on event " << _msg.getMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
}
} else if (_msg.GetMessage() == ednMsgGuiChangeCharset) {
} else if (_msg.getMessage() == ednMsgGuiChangeCharset) {
// data : "UTF-8" "ISO-8859-1" "ISO-8859-15"
if (_msg.GetData() == "UTF-8") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_msg.getData() == "UTF-8") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SetCharset(unicode::EDN_CHARSET_UTF8);
tmpBuffer->setCharset(unicode::EDN_CHARSET_UTF8);
}
} else if (_msg.GetData() == "ISO-8859-1") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "ISO-8859-1") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_1);
tmpBuffer->setCharset(unicode::EDN_CHARSET_ISO_8859_1);
}
} else if (_msg.GetData() == "ISO-8859-15") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "ISO-8859-15") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_15);
tmpBuffer->setCharset(unicode::EDN_CHARSET_ISO_8859_15);
}
} else {
APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
APPL_ERROR(" on event " << _msg.getMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
}
} else if (_msg.GetMessage() == ednMsgGuiFind) {
} else if (_msg.getMessage() == ednMsgGuiFind) {
etk::UString myDataString;
SearchData::GetSearch(myDataString);
if (_msg.GetData() == "Next") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
SearchData::getSearch(myDataString);
if (_msg.getData() == "Next") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
tmpBuffer->Search(myDataString, false, SearchData::getCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
} else if (_msg.GetData() == "Previous") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "Previous") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
tmpBuffer->Search(myDataString, true, SearchData::getCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
}
} else if (_msg.GetMessage() == ednMsgGuiReplace) {
} else if (_msg.getMessage() == ednMsgGuiReplace) {
etk::UString myDataString;
SearchData::GetReplace(myDataString);
if (_msg.GetData() == "Normal") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
SearchData::getReplace(myDataString);
if (_msg.getData() == "Normal") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Replace(myDataString);
}
} else if (_msg.GetData() == "All") {
} else if (_msg.getData() == "All") {
}
} else if (_msg.GetMessage() == ednMsgGuiGotoLine) {
} else if (_msg.getMessage() == ednMsgGuiGotoLine) {
int32_t lineID = 0;
sscanf(_msg.GetData().c_str(), "%d", &lineID);
sscanf(_msg.getData().c_str(), "%d", &lineID);
APPL_INFO("Goto line : " << lineID);
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->JumpAtLine(lineID);
}
}
// Force redraw of the widget
MarkToRedraw();
// force redraw of the widget
markToRedraw();
}
void CodeView::OnGetFocus(void)
void CodeView::onGetFocus(void)
{
/*
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_bufferID);
ewol::widgetMessageMultiCast::Send(getWidgetId(), ednMsgBufferId, m_bufferID);
*/
ShowKeyboard();
APPL_INFO("Focus - In");
}
void CodeView::OnLostFocus(void)
void CodeView::onLostFocus(void)
{
HideKeyboard();
APPL_INFO("Focus - out");
}
void CodeView::SetFontSize(int32_t size)
void CodeView::setFontSize(int32_t size)
{
m_displayText.SetFontSize(size);
SetScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
m_displayText.setFontSize(size);
setScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
}
void CodeView::SetFontName(etk::UString fontName)
void CodeView::setFontName(etk::UString fontName)
{
m_displayText.SetFontName(fontName);
m_displayText.setFontName(fontName);
}

View File

@@ -21,7 +21,7 @@
class CodeView :public widget::WidgetScrooled
{
public:
void Init(void);
void init(void);
CodeView(etk::UString fontName, int32_t fontSize);
CodeView(void);
virtual ~CodeView(void);
@@ -32,27 +32,27 @@ class CodeView :public widget::WidgetScrooled
int32_t m_bufferID;
bool m_buttunOneSelected;
etk::Vector<vec2 > m_lineNumberList;
void UpdateNumberOfLineReference(int32_t bufferID);
void updateNumberOfLineReference(int32_t bufferID);
// drawing elements :
ewol::Text m_displayText;
ewol::Drawing m_displayDrawing;
ewol::drawing m_displayDrawing;
public:
void SetFontSize(int32_t size);
void SetFontName(etk::UString fontName);
void setFontSize(int32_t size);
void setFontName(etk::UString fontName);
private:
void CalculateMaxSize(void);
void calculateMaxSize(void);
protected: // derived function
virtual void OnDraw(void);
virtual void onDraw(void);
public: // Derived function
const char * const GetObjectType(void) { return "ApplCodeView"; };
virtual bool CalculateMinSize(void);
virtual void OnRegenerateDisplay(void);
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual bool OnEventInput(const ewol::EventInput& _event);
virtual bool OnEventEntry(const ewol::EventEntry& _event);
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
const char * const getObjectType(void) { return "ApplCodeView"; };
virtual bool calculateMinSize(void);
virtual void onRegenerateDisplay(void);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual bool onEventInput(const ewol::EventInput& _event);
virtual bool onEventEntry(const ewol::EventEntry& _event);
virtual void onEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void onGetFocus(void);
virtual void onLostFocus(void);
};
#endif

View File

@@ -35,14 +35,14 @@
namespace appl
{
etk::UString GetVersion(void)
etk::UString getVersion(void)
{
#define FIRST_YEAR (2010)
etk::UString tmpOutput = (date::GetYear()-FIRST_YEAR);
etk::UString tmpOutput = (date::getYear()-FIRST_YEAR);
tmpOutput += ".";
tmpOutput += date::GetMonth();
tmpOutput += date::getMonth();
tmpOutput += ".";
tmpOutput += date::GetDay();
tmpOutput += date::getDay();
return tmpOutput;
}
@@ -65,25 +65,25 @@ class ParameterAboutGui : public widget::Sizer
mySpacer = new widget::Spacer();
if (NULL == mySpacer) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->SetExpand(bvec2(true,true));
SubWidgetAdd(mySpacer);
mySpacer->setExpand(bvec2(true,true));
subWidgetAdd(mySpacer);
}
etk::UString tmpLabel = "<left>";
tmpLabel += " <b>Editeur De N'ours</b> : v:";
tmpLabel += appl::GetVersion();
tmpLabel += appl::getVersion();
tmpLabel += "<br/>";
tmpLabel += " <b>Build Time</b> : ";
tmpLabel += date::GetYear();
tmpLabel += date::getYear();
tmpLabel += "/";
tmpLabel += date::GetMonth();
tmpLabel += date::getMonth();
tmpLabel += "/";
tmpLabel += date::GetDay();
tmpLabel += date::getDay();
tmpLabel += " ";
tmpLabel += date::GetHour();
tmpLabel += date::getHour();
tmpLabel += "h";
tmpLabel += date::GetMinute();
tmpLabel += date::getMinute();
tmpLabel += "<br/>";
tmpLabel += " <b>Website</b> : https://github.com/HeeroYui/edn<br/>";
tmpLabel += " <b>License</b> : GPL v3<br/>";
@@ -95,10 +95,10 @@ class ParameterAboutGui : public widget::Sizer
tmpLabel += "</left>";
widget::Label* myLabel = new widget::Label(tmpLabel);
if (NULL == myLabel) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myLabel->SetExpand(bvec2(true,false));
SubWidgetAdd(myLabel);
myLabel->setExpand(bvec2(true,false));
subWidgetAdd(myLabel);
}
};
@@ -126,117 +126,117 @@ MainWindows::MainWindows(void)
widget::Menu * myMenu = NULL;
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
SetSubWidget(mySizerVert);
setSubWidget(mySizerVert);
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
mySizerVert->SubWidgetAdd(mySizerHori);
mySizerVert->subWidgetAdd(mySizerHori);
myBufferView = new BufferView();
myBufferView->SetExpand(bvec2(false,true));
myBufferView->SetFill(bvec2(true,true));
mySizerHori->SubWidgetAdd(myBufferView);
myBufferView->setExpand(bvec2(false,true));
myBufferView->setFill(bvec2(true,true));
mySizerHori->subWidgetAdd(myBufferView);
mySizerVert2 = new widget::Sizer(widget::Sizer::modeVert);
mySizerHori->SubWidgetAdd(mySizerVert2);
mySizerHori->subWidgetAdd(mySizerVert2);
// main buffer Area :
myTextView = new appl::TextViewer("FreeSerif;FreeMono;DejaVuSansMono", 11);
myTextView->SetExpand(bvec2(true,true));
myTextView->SetFill(bvec2(true,true));
mySizerVert2->SubWidgetAdd(myTextView);
myTextView->setExpand(bvec2(true,true));
myTextView->setFill(bvec2(true,true));
mySizerVert2->subWidgetAdd(myTextView);
/*
myCodeView = new CodeView("FreeMono;DejaVuSansMono", 11);
myCodeView->SetExpand(bvec2(true,true));
myCodeView->SetFill(bvec2(true,true));
mySizerVert2->SubWidgetAdd(myCodeView);
myCodeView->setExpand(bvec2(true,true));
myCodeView->setFill(bvec2(true,true));
mySizerVert2->subWidgetAdd(myCodeView);
*/
// search area :
Search * mySearch = new Search();
mySizerVert2->SubWidgetAdd(mySearch);
mySizerVert2->subWidgetAdd(mySearch);
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
{
widget::Sizer * mySizerHori2 = new widget::Sizer(widget::Sizer::modeHori);
mySizerVert2->SubWidgetAdd(mySizerHori2);
mySizerVert2->subWidgetAdd(mySizerHori2);
widget::CheckBox* tmpCheck = new widget::CheckBox("smooth");
mySizerHori2->SubWidgetAdd(tmpCheck);
tmpCheck->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_smoothChick);
mySizerHori2->subWidgetAdd(tmpCheck);
tmpCheck->registerOnEvent(this, ewolEventCheckBoxClicked, l_smoothChick);
widget::Slider* tmpSlider = new widget::Slider();
mySizerHori2->SubWidgetAdd(tmpSlider);
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMin);
tmpSlider->SetExpand(bvec2(true,false));
tmpSlider->SetMin(0);
tmpSlider->SetMax(1000);
tmpSlider->SetValue(0450);
mySizerHori2->subWidgetAdd(tmpSlider);
tmpSlider->registerOnEvent(this, ewolEventSliderChange, l_smoothMin);
tmpSlider->setExpand(bvec2(true,false));
tmpSlider->setMin(0);
tmpSlider->setMax(1000);
tmpSlider->setValue(0450);
tmpSliderMin = tmpSlider;
tmpSlider = new widget::Slider();
mySizerHori2->SubWidgetAdd(tmpSlider);
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMax);
tmpSlider->SetExpand(bvec2(true,false));
tmpSlider->SetMin(0);
tmpSlider->SetMax(1000);
tmpSlider->SetValue(0550);
mySizerHori2->subWidgetAdd(tmpSlider);
tmpSlider->registerOnEvent(this, ewolEventSliderChange, l_smoothMax);
tmpSlider->setExpand(bvec2(true,false));
tmpSlider->setMin(0);
tmpSlider->setMax(1000);
tmpSlider->setValue(0550);
tmpSliderMax = tmpSlider;
}
#endif
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
mySizerVert->SubWidgetAdd(mySizerHori);
mySizerVert->subWidgetAdd(mySizerHori);
myMenu = new widget::Menu();
mySizerHori->SubWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->AddTitle("File");
(void)myMenu->Add(idMenuFile, "New", "", ednMsgGuiNew);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuFile, "Open", "THEME:GUI:Load.svg", ednMsgGuiOpen);
(void)myMenu->Add(idMenuFile, "Close", "THEME:GUI:Close.svg", ednMsgGuiClose, "current");
(void)myMenu->Add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
(void)myMenu->Add(idMenuFile, "Save", "THEME:GUI:Save.svg", ednMsgGuiSave, "current");
(void)myMenu->Add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
(void)myMenu->AddSpacer();
//(void)myMenu->Add(idMenuFile, "Exit", "", ednMsgGuiExit);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuFile, "Properties", "THEME:GUI:Parameter.svg", ednMsgProperties);
int32_t idMenuEdit = myMenu->AddTitle("Edit");
(void)myMenu->Add(idMenuEdit, "Undo", "THEME:GUI:Undo.svg", ednMsgGuiUndo);
(void)myMenu->Add(idMenuEdit, "Redo", "THEME:GUI:Redo.svg", ednMsgGuiRedo);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
(void)myMenu->Add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
(void)myMenu->Add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
(void)myMenu->Add(idMenuEdit, "Remove", "", ednMsgGuiRm);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
(void)myMenu->Add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
(void)myMenu->Add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
int32_t idMenuSearch = myMenu->AddTitle("Search");
(void)myMenu->Add(idMenuSearch, "Search", "THEME:GUI:Search.svg", ednMsgGuiSearch);
(void)myMenu->Add(idMenuSearch, "Replace", "THEME:GUI:Replace.svg", ednMsgGuiReplace);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
(void)myMenu->Add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
(void)myMenu->Add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
(void)myMenu->Add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
int32_t idMenuCTags = myMenu->AddTitle("C-tags");
(void)myMenu->Add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
(void)myMenu->Add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
(void)myMenu->Add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
(void)myMenu->Add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
int32_t idMenugDisplay = myMenu->AddTitle("Display");
(void)myMenu->Add(idMenugDisplay, "Charset UTF-8", "", ednMsgGuiChangeCharset, "UTF-8");
(void)myMenu->Add(idMenugDisplay, "Charset ISO-8859-1", "", ednMsgGuiChangeCharset, "ISO-8859-1");
(void)myMenu->Add(idMenugDisplay, "Charset ISO-8859-15", "", ednMsgGuiChangeCharset, "ISO-8859-15");
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenugDisplay, "Color Black", "", ednMsgGuiChangeColor, "Black");
(void)myMenu->Add(idMenugDisplay, "Color White", "", ednMsgGuiChangeColor, "White");
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenugDisplay, "Reload OpenGl Shader", "", ednMsgGuiReloadShader);
mySizerHori->subWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->addTitle("File");
(void)myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.svg", ednMsgGuiOpen);
(void)myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.svg", ednMsgGuiClose, "current");
(void)myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
(void)myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.svg", ednMsgGuiSave, "current");
(void)myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
(void)myMenu->addSpacer();
//(void)myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.svg", ednMsgProperties);
int32_t idMenuEdit = myMenu->addTitle("Edit");
(void)myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.svg", ednMsgGuiUndo);
(void)myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.svg", ednMsgGuiRedo);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
(void)myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
(void)myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
(void)myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
(void)myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
(void)myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
int32_t idMenuSearch = myMenu->addTitle("Search");
(void)myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.svg", ednMsgGuiSearch);
(void)myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.svg", ednMsgGuiReplace);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
(void)myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
(void)myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
(void)myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
int32_t idMenuCTags = myMenu->addTitle("C-tags");
(void)myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
(void)myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
(void)myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
(void)myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
int32_t idMenugDisplay = myMenu->addTitle("Display");
(void)myMenu->add(idMenugDisplay, "Charset UTF-8", "", ednMsgGuiChangeCharset, "UTF-8");
(void)myMenu->add(idMenugDisplay, "Charset ISO-8859-1", "", ednMsgGuiChangeCharset, "ISO-8859-1");
(void)myMenu->add(idMenugDisplay, "Charset ISO-8859-15", "", ednMsgGuiChangeCharset, "ISO-8859-15");
(void)myMenu->addSpacer();
(void)myMenu->add(idMenugDisplay, "Color Black", "", ednMsgGuiChangeColor, "Black");
(void)myMenu->add(idMenugDisplay, "Color White", "", ednMsgGuiChangeColor, "White");
(void)myMenu->addSpacer();
(void)myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
m_widgetLabelFileName = new widget::Label("<left>FileName</left>");
m_widgetLabelFileName->SetExpand(bvec2(true,false));
m_widgetLabelFileName->SetFill(bvec2(false,true));;
mySizerHori->SubWidgetAdd(m_widgetLabelFileName);
m_widgetLabelFileName->setExpand(bvec2(true,false));
m_widgetLabelFileName->setFill(bvec2(false,true));;
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
// add generic shortcut ...
@@ -283,102 +283,102 @@ const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
void MainWindows::OnReceiveMessage(const ewol::EMessage& _msg)
void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
{
ewol::Windows::OnReceiveMessage(_msg);
ewol::Windows::onReceiveMessage(_msg);
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
// Open file Section ...
if (_msg.GetMessage() == ednMsgGuiOpen) {
widget::FileChooser* tmpWidget = new widget::FileChooser();
tmpWidget->SetTitle("Open Files ...");
tmpWidget->SetValidateLabel("Open");
if (BufferManager::GetSelected()!=-1) {
BufferText * myBuffer = BufferManager::Get(BufferManager::GetSelected());
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" == > data=\"" << data << "\"" );
// open file Section ...
if (_msg.getMessage() == ednMsgGuiOpen) {
widget::fileChooser* tmpWidget = new widget::FileChooser();
tmpWidget->setTitle("Open files ...");
tmpWidget->setValidateLabel("Open");
if (BufferManager::getSelected()!=-1) {
BufferText * myBuffer = BufferManager::get(BufferManager::GetSelected());
if (NULL!=myBuffer) {
etk::FSNode tmpFile = myBuffer->GetFileName();
tmpWidget->SetFolder(tmpFile.GetNameFolder());
etk::FSNode tmpFile = myBuffer->getFileName();
tmpWidget->setFolder(tmpFile.getNameFolder());
}
}
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
} else if (_msg.GetMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.GetData());
SendMultiCast(ednMsgOpenFile, _msg.GetData());
} else if (_msg.GetMessage() == ednMsgGuiSaveAs) {
if (_msg.GetData() == "") {
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.getData());
SendMultiCast(ednMsgOpenFile, _msg.getData());
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
if (_msg.getData() == "") {
APPL_ERROR("Null data for Save As file ... ");
} else {
m_currentSavingAsIdBuffer = -1;
if (_msg.GetData() == "current") {
m_currentSavingAsIdBuffer = BufferManager::GetSelected();
if (_msg.getData() == "current") {
m_currentSavingAsIdBuffer = BufferManager::getSelected();
} else {
sscanf(_msg.GetData().c_str(), "%d", &m_currentSavingAsIdBuffer);
sscanf(_msg.getData().c_str(), "%d", &m_currentSavingAsIdBuffer);
}
if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) {
APPL_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
} else {
BufferText* myBuffer = BufferManager::Get(m_currentSavingAsIdBuffer);
widget::FileChooser* tmpWidget = new widget::FileChooser();
BufferText* myBuffer = BufferManager::get(m_currentSavingAsIdBuffer);
widget::fileChooser* tmpWidget = new widget::FileChooser();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->SetTitle("Save Files As...");
tmpWidget->SetValidateLabel("Save");
tmpWidget->setTitle("Save files As...");
tmpWidget->setValidateLabel("Save");
etk::UString folder = "/home/";
etk::UString fileName = "";
if (true == myBuffer->HaveName()) {
etk::FSNode tmpName = myBuffer->GetFileName();
folder = tmpName.GetNameFolder();
fileName = tmpName.GetNameFile();
if (true == myBuffer->haveName()) {
etk::FSNode tmpName = myBuffer->getFileName();
folder = tmpName.getNameFolder();
fileName = tmpName.getNameFile();
}
tmpWidget->SetFolder(folder);
tmpWidget->SetFileName(fileName);
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
tmpWidget->setFolder(folder);
tmpWidget->setFileName(fileName);
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
}
}
}
} else if (_msg.GetMessage() == ednEventPopUpFileSaveAs) {
} else if (_msg.getMessage() == ednEventPopUpFileSaveAs) {
// get the filename :
etk::UString tmpData = _msg.GetData();
etk::UString tmpData = _msg.getData();
APPL_DEBUG("Request Saving As file : " << tmpData);
BufferManager::Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);
BufferManager::get(m_currentSavingAsIdBuffer)->setFileName(tmpData);
SendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
} else if( _msg.GetMessage() == ednMsgBufferState
|| _msg.GetMessage() == ednMsgBufferId) {
} else if( _msg.getMessage() == ednMsgBufferState
|| _msg.getMessage() == ednMsgBufferId) {
// the buffer change we need to update the widget string
BufferText* tmpBuffer = BufferManager::Get(BufferManager::GetSelected());
BufferText* tmpBuffer = BufferManager::get(BufferManager::GetSelected());
if (NULL != tmpBuffer) {
etk::FSNode compleateName = tmpBuffer->GetFileName();
bool isModify = tmpBuffer->IsModify();
etk::UString directName = compleateName.GetName();
etk::FSNode compleateName = tmpBuffer->getFileName();
bool isModify = tmpBuffer->isModify();
etk::UString directName = compleateName.getName();
if (true == isModify) {
directName += " *";
}
if (NULL != m_widgetLabelFileName) {
m_widgetLabelFileName->SetLabel(etk::UString("<left>") + directName + "</left>");
m_widgetLabelFileName->setLabel(etk::UString("<left>") + directName + "</left>");
}
etk::UString windowsTitle = "edn - ";
windowsTitle += directName;
SetTitle(windowsTitle);
setTitle(windowsTitle);
return;
} else {
m_widgetLabelFileName->SetLabel("");
SetTitle("edn");
m_widgetLabelFileName->setLabel("");
setTitle("edn");
}
return;
// TODO : Set the Title ....
} else if (_msg.GetMessage() == ednMsgProperties) {
// TODO : set the Title ....
} else if (_msg.getMessage() == ednMsgProperties) {
// Request the parameter GUI
widget::Parameter* tmpWidget = new widget::Parameter();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->SetTitle("Properties");
PopUpWidgetPush(tmpWidget);
tmpWidget->setTitle("Properties");
popUpWidgetPush(tmpWidget);
tmpWidget->MenuAddGroup("Editor");
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
tmpWidget->MenuAdd("Editor", "", tmpSubWidget);
@@ -389,19 +389,19 @@ void MainWindows::OnReceiveMessage(const ewol::EMessage& _msg)
tmpSubWidget = new ParameterAboutGui();
tmpWidget->MenuAdd("About", "", tmpSubWidget);
}
} else if (_msg.GetMessage() == ednMsgGuiReloadShader) {
ewol::GetContext().GetResourcesManager().ReLoadResources();
ewol::GetContext().ForceRedrawAll();
} else if (_msg.GetMessage() == ednMsgGuiExit) {
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
ewol::getContext().getResourcesManager().ReLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiExit) {
// TODO ...
}
return;
}
void MainWindows::OnObjectRemove(ewol::EObject * _removeObject)
void MainWindows::onObjectRemove(ewol::EObject * _removeObject)
{
ewol::Windows::OnObjectRemove(_removeObject);
ewol::Windows::onObjectRemove(_removeObject);
if (m_widgetLabelFileName == _removeObject) {
m_widgetLabelFileName = NULL;
}

View File

@@ -27,9 +27,9 @@ class MainWindows : public ewol::Windows
MainWindows(void);
~MainWindows(void);
public: // Derived function
virtual const char * const GetObjectType(void) { return "MainWindows"; };
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void OnObjectRemove(ewol::EObject * _removeObject);
virtual const char * const getObjectType(void) { return "MainWindows"; };
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual void onObjectRemove(ewol::EObject * _removeObject);
};
#define EDN_CAST_MAIN_WINDOWS(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_MAIN_WINDOWS,MainWindows,curentPointer)

View File

@@ -37,7 +37,7 @@ Search::Search(void) :
m_replaceEntry(NULL)
{
m_forward = false;
// TODO : Change the mode of creating interface :
// TODO : change the mode of creating interface :
/*
<composer>
<sizer mode="hori" expand="true,false" fill="true" lock="true">
@@ -70,114 +70,114 @@ Search::Search(void) :
widget::Button * myButtonImage = NULL;
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
widget::Image* tmpImage = new widget::Image("THEME:GUI:Remove.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventHideBt);
SubWidgetAdd(myButtonImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventHideBt);
subWidgetAdd(myButtonImage);
}
m_searchEntry = new widget::Entry();
if (NULL == m_searchEntry) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
m_searchEntry->RegisterOnEvent(this, widget::Entry::eventModify, l_eventSearchEntry);
m_searchEntry->RegisterOnEvent(this, widget::Entry::eventEnter, l_eventSearchEntryEnter);
m_searchEntry->SetExpand(bvec2(true,false));
m_searchEntry->SetFill(bvec2(true,false));
SubWidgetAdd(m_searchEntry);
m_searchEntry->registerOnEvent(this, widget::Entry::eventModify, l_eventSearchEntry);
m_searchEntry->registerOnEvent(this, widget::Entry::eventEnter, l_eventSearchEntryEnter);
m_searchEntry->setExpand(bvec2(true,false));
m_searchEntry->setFill(bvec2(true,false));
subWidgetAdd(m_searchEntry);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
widget::Image* tmpImage = new widget::Image("THEME:GUI:Search.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventSearchBt);
SubWidgetAdd(myButtonImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventSearchBt);
subWidgetAdd(myButtonImage);
}
m_replaceEntry = new widget::Entry();
if (NULL == m_replaceEntry) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
m_replaceEntry->RegisterOnEvent(this, widget::Entry::eventModify, l_eventReplaceEntry);
m_replaceEntry->RegisterOnEvent(this, widget::Entry::eventEnter, l_eventReplaceEntryEnter);
m_replaceEntry->SetExpand(bvec2(true,false));
m_replaceEntry->SetFill(bvec2(true,false));
SubWidgetAdd(m_replaceEntry);
m_replaceEntry->registerOnEvent(this, widget::Entry::eventModify, l_eventReplaceEntry);
m_replaceEntry->registerOnEvent(this, widget::Entry::eventEnter, l_eventReplaceEntryEnter);
m_replaceEntry->setExpand(bvec2(true,false));
m_replaceEntry->setFill(bvec2(true,false));
subWidgetAdd(m_replaceEntry);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
widget::Image* tmpImage = new widget::Image("THEME:GUI:Replace.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventReplaceBt);
SubWidgetAdd(myButtonImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventReplaceBt);
subWidgetAdd(myButtonImage);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
myButtonImage->SetToggleMode(true);
myButtonImage->setToggleMode(true);
widget::Image* tmpImage = new widget::Image("THEME:GUI:CaseSensitive.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
tmpImage = new widget::Image("THEME:GUI:CaseSensitive.svg"); // TODO : Set color on Image .... 0xFFFFFF5F
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidgetToggle(tmpImage);
tmpImage = new widget::Image("THEME:GUI:CaseSensitive.svg"); // TODO : set color on Image .... 0xFFFFFF5F
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidgetToggle(tmpImage);
myButtonImage->SetValue(!SearchData::GetCase());
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventCaseCb);
SubWidgetAdd(myButtonImage);
myButtonImage->setValue(!SearchData::getCase());
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventCaseCb);
subWidgetAdd(myButtonImage);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
myButtonImage->SetToggleMode(true);
myButtonImage->setToggleMode(true);
widget::Image* tmpImage = new widget::Image("THEME:GUI:WrapAround.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
tmpImage = new widget::Image("THEME:GUI:WrapAround.svg"); // TODO : Set color on Image .... 0xFFFFFF5F
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidgetToggle(tmpImage);
tmpImage = new widget::Image("THEME:GUI:WrapAround.svg"); // TODO : set color on Image .... 0xFFFFFF5F
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidgetToggle(tmpImage);
myButtonImage->SetValue(!SearchData::GetWrap());
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventWrapCb);
SubWidgetAdd(myButtonImage);
myButtonImage->setValue(!SearchData::getWrap());
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventWrapCb);
subWidgetAdd(myButtonImage);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error ==> it will missing in the display");
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
myButtonImage->SetToggleMode(true);
myButtonImage->setToggleMode(true);
widget::Image* tmpImage = new widget::Image("THEME:GUI:Up.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
tmpImage = new widget::Image("THEME:GUI:Down.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidgetToggle(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidgetToggle(tmpImage);
myButtonImage->SetValue(!m_forward);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventForwardCb);
SubWidgetAdd(myButtonImage);
myButtonImage->setValue(!m_forward);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventForwardCb);
subWidgetAdd(myButtonImage);
}
RegisterMultiCast(ednMsgGuiSearch);
@@ -191,74 +191,74 @@ Search::~Search(void)
}
void Search::OnReceiveMessage(const ewol::EMessage& _msg)
void Search::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::Sizer::OnReceiveMessage(_msg);
widget::Sizer::onReceiveMessage(_msg);
//APPL_INFO("Search receive message : \"" << eventId << "\" data=\"" << data << "\"");
if ( _msg.GetMessage() == l_eventSearchEntry) {
SearchData::SetSearch(_msg.GetData());
} else if ( _msg.GetMessage() == l_eventSearchEntryEnter) {
SearchData::SetSearch(_msg.GetData());
if (true==m_forward) {
if ( _msg.getMessage() == l_eventSearchEntry) {
SearchData::setSearch(_msg.getData());
} else if ( _msg.getMessage() == l_eventSearchEntryEnter) {
SearchData::setSearch(_msg.getData());
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventReplaceEntry) {
SearchData::SetReplace(_msg.GetData());
} else if ( _msg.GetMessage() == l_eventReplaceEntryEnter) {
SearchData::SetReplace(_msg.GetData());
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
SearchData::setReplace(_msg.getData());
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter) {
SearchData::setReplace(_msg.getData());
SendMultiCast(ednMsgGuiReplace, "Normal");
if (true==m_forward) {
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventSearchBt) {
if (true==m_forward) {
} else if ( _msg.getMessage() == l_eventSearchBt) {
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventReplaceBt) {
} else if ( _msg.getMessage() == l_eventReplaceBt) {
SendMultiCast(ednMsgGuiReplace, "Normal");
if (true==m_forward) {
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventCaseCb) {
if (_msg.GetData() == "1") {
SearchData::SetCase(false);
} else if ( _msg.getMessage() == l_eventCaseCb) {
if (_msg.getData() == "1") {
SearchData::setCase(false);
} else {
SearchData::SetCase(true);
SearchData::setCase(true);
}
} else if ( _msg.GetMessage() == l_eventWrapCb) {
if (_msg.GetData() == "1") {
SearchData::SetWrap(false);
} else if ( _msg.getMessage() == l_eventWrapCb) {
if (_msg.getData() == "1") {
SearchData::setWrap(false);
} else {
SearchData::SetWrap(true);
SearchData::setWrap(true);
}
} else if ( _msg.GetMessage() == l_eventForwardCb) {
if (_msg.GetData() == "1") {
} else if ( _msg.getMessage() == l_eventForwardCb) {
if (_msg.getData() == "1") {
m_forward = false;
} else {
m_forward = true;
}
} else if ( _msg.GetMessage() == l_eventHideBt) {
} else if ( _msg.getMessage() == l_eventHideBt) {
Hide();
} else if ( _msg.GetMessage() == ednMsgGuiSearch) {
if (true == IsHide()) {
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
if (true == isHide()) {
Show();
if (m_searchEntry!= NULL) {
m_searchEntry->KeepFocus();
m_searchEntry->keepFocus();
}
} else {
if( (m_searchEntry!=NULL && true==m_searchEntry->GetFocus())
|| (m_replaceEntry!=NULL && true==m_replaceEntry->GetFocus()) ) {
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
Hide();
} else if (m_searchEntry!= NULL) {
m_searchEntry->KeepFocus();
m_searchEntry->keepFocus();
} else {
Hide();
}
@@ -266,9 +266,9 @@ void Search::OnReceiveMessage(const ewol::EMessage& _msg)
}
}
void Search::OnObjectRemove(ewol::EObject * _removeObject)
void Search::onObjectRemove(ewol::EObject * _removeObject)
{
widget::Sizer::OnObjectRemove(_removeObject);
widget::Sizer::onObjectRemove(_removeObject);
if (_removeObject == m_searchEntry) {
m_searchEntry = NULL;
}

View File

@@ -24,9 +24,9 @@ class Search : public widget::Sizer
Search(void);
~Search(void);
public: // derived function
virtual const char * const GetObjectType(void) { return "ApplSearch"; };
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void OnObjectRemove(ewol::EObject * _removeObject);
virtual const char * const getObjectType(void) { return "ApplSearch"; };
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual void onObjectRemove(ewol::EObject * _removeObject);
};
#endif

View File

@@ -16,34 +16,34 @@
static etk::UString m_findRequest = "";
void SearchData::SetSearch(const etk::UString &myData)
void SearchData::setSearch(const etk::UString &myData)
{
m_findRequest = myData;
}
void SearchData::GetSearch(etk::UString &myData)
void SearchData::getSearch(etk::UString &myData)
{
myData = m_findRequest;
}
bool SearchData::IsSearchEmpty(void)
bool SearchData::isSearchEmpty(void)
{
if(m_findRequest.Size() > 0) {
if(m_findRequest.size() > 0) {
return false;
}
return true;
}
static etk::UString m_replaceRequest = "";
void SearchData::SetReplace(const etk::UString &myData)
void SearchData::setReplace(const etk::UString &myData)
{
m_replaceRequest = myData;
}
void SearchData::GetReplace(etk::UString &myData)
void SearchData::getReplace(etk::UString &myData)
{
myData = m_replaceRequest;
}
bool SearchData::IsReplaceEmpty(void)
bool SearchData::isReplaceEmpty(void)
{
if(m_replaceRequest.Size() > 0) {
if(m_replaceRequest.size() > 0) {
return false;
}
return true;
@@ -51,33 +51,33 @@ bool SearchData::IsReplaceEmpty(void)
static bool m_case = false;
void SearchData::SetCase(bool value)
void SearchData::setCase(bool value)
{
m_case = value;
}
bool SearchData::GetCase(void)
bool SearchData::getCase(void)
{
return m_case;
}
static bool m_wrap = true;
void SearchData::SetWrap(bool value)
void SearchData::setWrap(bool value)
{
m_wrap = value;
}
bool SearchData::GetWrap(void)
bool SearchData::getWrap(void)
{
return m_wrap;
}
static bool m_RegExp = false;
void SearchData::SetRegExp(bool value)
void SearchData::setRegExp(bool value)
{
m_RegExp = value;
}
bool SearchData::GetRegExp(void)
bool SearchData::getRegExp(void)
{
return m_RegExp;
}

View File

@@ -14,18 +14,18 @@
namespace SearchData
{
void SetSearch(const etk::UString &myData);
void GetSearch(etk::UString &myData);
bool IsSearchEmpty(void);
void SetReplace(const etk::UString &myData);
void GetReplace(etk::UString &myData);
bool IsReplaceEmpty(void);
void SetCase(bool value);
bool GetCase(void);
void SetWrap(bool value);
bool GetWrap(void);
void SetRegExp(bool value);
bool GetRegExp(void);
void setSearch(const etk::UString &myData);
void getSearch(etk::UString &myData);
bool isSearchEmpty(void);
void setReplace(const etk::UString &myData);
void getReplace(etk::UString &myData);
bool isReplaceEmpty(void);
void setCase(bool value);
bool getCase(void);
void setWrap(bool value);
bool getWrap(void);
void setRegExp(bool value);
bool getRegExp(void);
}

View File

@@ -20,15 +20,15 @@ extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-
appl::TagFileList::TagFileList(void)
{
m_selectedLine = -1;
AddEventId(applEventCtagsListSelect);
AddEventId(applEventCtagsListValidate);
SetMouseLimit(1);
addEventId(applEventCtagsListSelect);
addEventId(applEventCtagsListValidate);
setMouseLimit(1);
}
appl::TagFileList::~TagFileList(void)
{
for (int32_t iii=0; iii<m_list.Size(); iii++) {
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL != m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = NULL;
@@ -36,26 +36,26 @@ appl::TagFileList::~TagFileList(void)
}
}
etk::Color<> appl::TagFileList::GetBasicBG(void) {
etk::Color<> appl::TagFileList::getBasicBG(void) {
return 0x00000010;
}
uint32_t appl::TagFileList::GetNuberOfColomn(void) {
uint32_t appl::TagFileList::getNuberOfColomn(void) {
return 2;
}
bool appl::TagFileList::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg) {
bool appl::TagFileList::getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg) {
myTitle = "title";
return true;
}
uint32_t appl::TagFileList::GetNuberOfRaw(void) {
return m_list.Size();
uint32_t appl::TagFileList::getNuberOfRaw(void) {
return m_list.size();
}
bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg) {
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
if (0==colomn) {
bool appl::TagFileList::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg) {
if (raw >= 0 && raw < m_list.size() && NULL != m_list[raw]) {
if (0 == colomn) {
myTextToWrite = etk::UString(m_list[raw]->fileLine);
} else {
myTextToWrite = m_list[raw]->filename;
@@ -65,20 +65,20 @@ bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &my
}
fg = etk::color::black;
if (raw % 2) {
if (colomn%2==0) {
if (colomn%2 == 0) {
bg = 0xFFFFFF00;
} else {
bg = 0xFFFFFF10;
}
} else {
if (colomn%2==0) {
if (colomn%2 == 0) {
bg = 0xBFBFBFFF;
} else {
bg = 0xCFCFCFFF;
}
}
if (m_selectedLine == raw) {
if (colomn%2==0) {
if (colomn%2 == 0) {
bg = 0x8F8FFFFF;
} else {
bg = 0x7F7FFFFF;
@@ -88,13 +88,13 @@ bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &my
};
bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
bool appl::TagFileList::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
{
if (typeEvent == ewol::keyEvent::statusSingle) {
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
if (1 == IdInput) {
int32_t previousRaw = m_selectedLine;
if (raw > m_list.Size() ) {
if (raw > m_list.size() ) {
m_selectedLine = -1;
} else {
m_selectedLine = raw;
@@ -103,15 +103,15 @@ bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
if (previousRaw != m_selectedLine) {
event = applEventCtagsListSelect;
}
if( m_selectedLine >=0
&& m_selectedLine < m_list.Size()
if( m_selectedLine >= 0
&& m_selectedLine < m_list.size()
&& NULL != m_list[m_selectedLine] ) {
GenerateEventId(event, etk::UString(m_list[raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
generateEventId(event, etk::UString(m_list[raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
} else {
GenerateEventId(applEventCtagsListUnSelect);
generateEventId(applEventCtagsListUnSelect);
}
// need to regenerate the display of the list :
MarkToRedraw();
markToRedraw();
return true;
}
}
@@ -120,18 +120,18 @@ bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
* @return ---
*/
void appl::TagFileList::Add(etk::UString& file, int32_t line)
void appl::TagFileList::add(etk::UString& file, int32_t line)
{
appl::TagListElement *tmpFile = new appl::TagListElement(file, line);
if (NULL != tmpFile) {
m_list.PushBack(tmpFile);
m_list.pushBack(tmpFile);
}
MarkToRedraw();
markToRedraw();
}

View File

@@ -34,21 +34,21 @@ namespace appl {
TagFileList(void);
~TagFileList(void);
// display API :
virtual etk::Color<> GetBasicBG(void);
uint32_t GetNuberOfColomn(void);
bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
uint32_t GetNuberOfRaw(void);
bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
virtual etk::Color<> getBasicBG(void);
uint32_t getNuberOfColomn(void);
bool getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
uint32_t getNuberOfRaw(void);
bool getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
bool onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
// derived function
const char * const GetObjectType(void) { return "TagFileList"; };
const char * const getObjectType(void) { return "TagFileList"; };
public:
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
*/
void Add(etk::UString& file, int32_t line);
void add(etk::UString& file, int32_t line);
};
};

View File

@@ -32,8 +32,8 @@ extern const char * const applEventctagsCancel = "appl-event-ctags-
appl::TagFileSelection::TagFileSelection(void)
{
AddEventId(applEventctagsSelection);
AddEventId(applEventctagsCancel);
addEventId(applEventctagsSelection);
addEventId(applEventctagsCancel);
widget::Label* myWidgetTitle = NULL;
widget::Button* myWidgetValidate = NULL;
@@ -43,38 +43,38 @@ appl::TagFileSelection::TagFileSelection(void)
widget::Sizer * mySizerHori = NULL;
widget::Spacer * mySpacer = NULL;
#if defined(__TARGET_OS__Android)
SetMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
#elif defined(__TARGET_OS__Windows)
SetMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#else
SetMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#endif
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
if (NULL == mySizerVert) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->LockExpand(bvec2(true,true));
// set it in the pop-up-system :
SetSubWidget(mySizerVert);
setSubWidget(mySizerVert);
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
if (NULL == mySizerHori) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->SubWidgetAdd(mySizerHori);
mySizerVert->subWidgetAdd(mySizerHori);
mySpacer = new widget::Spacer();
if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->SetExpand(bvec2(true,false));
mySizerHori->SubWidgetAdd(mySpacer);
mySpacer->setExpand(bvec2(true,false));
mySizerHori->subWidgetAdd(mySpacer);
}
myWidgetValidate = new widget::Button();
if (NULL == myWidgetValidate) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetValidate->SetSubWidget(
myWidgetValidate->setSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
@@ -83,14 +83,14 @@ appl::TagFileSelection::TagFileSelection(void)
" </sizer>\n"
"</composer\n"));
myWidgetValidate->RegisterOnEvent(this, widget::Button::eventPressed, applEventctagsSelection);
mySizerHori->SubWidgetAdd(myWidgetValidate);
myWidgetValidate->registerOnEvent(this, widget::Button::eventPressed, applEventctagsSelection);
mySizerHori->subWidgetAdd(myWidgetValidate);
}
myWidgetCancel = new widget::Button();
if (NULL == myWidgetCancel) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetCancel->SetSubWidget(
myWidgetCancel->setSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
@@ -98,27 +98,27 @@ appl::TagFileSelection::TagFileSelection(void)
" <label>Cancel</label>\n"
" </sizer>\n"
"</composer\n"));
myWidgetCancel->RegisterOnEvent(this, widget::Button::eventPressed, applEventctagsCancel);
mySizerHori->SubWidgetAdd(myWidgetCancel);
myWidgetCancel->registerOnEvent(this, widget::Button::eventPressed, applEventctagsCancel);
mySizerHori->subWidgetAdd(myWidgetCancel);
}
}
m_listTag = new appl::TagFileList();
if (NULL == m_listTag) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
m_listTag->RegisterOnEvent(this, applEventCtagsListValidate);
m_listTag->RegisterOnEvent(this, applEventCtagsListSelect);
m_listTag->RegisterOnEvent(this, applEventCtagsListUnSelect);
m_listTag->SetExpand(bvec2(true,true));
m_listTag->SetFill(bvec2(true,true));
mySizerVert->SubWidgetAdd(m_listTag);
m_listTag->registerOnEvent(this, applEventCtagsListValidate);
m_listTag->registerOnEvent(this, applEventCtagsListSelect);
m_listTag->registerOnEvent(this, applEventCtagsListUnSelect);
m_listTag->setExpand(bvec2(true,true));
m_listTag->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(m_listTag);
}
myWidgetTitle = new widget::Label("Ctags Jump Selection ...");
if (NULL == myWidgetTitle) {
EWOL_ERROR("Can not allocate widget ==> display might be in error");
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->SubWidgetAdd(myWidgetTitle);
mySizerVert->subWidgetAdd(myWidgetTitle);
}
}
}
@@ -129,27 +129,27 @@ appl::TagFileSelection::~TagFileSelection(void)
}
void appl::TagFileSelection::OnReceiveMessage(const ewol::EMessage& _msg)
void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
{
EWOL_INFO("ctags LIST ... : \"" << _msg.GetMessage() << "\" ==> data=\"" << _msg.GetData() << "\"" );
if (_msg.GetMessage() == applEventctagsSelection) {
EWOL_INFO("ctags LIST ... : \"" << _msg.getMessage() << "\" == > data=\"" << _msg.GetData() << "\"" );
if (_msg.getMessage() == applEventctagsSelection) {
if (m_eventNamed!="") {
GenerateEventId(applEventctagsSelection, m_eventNamed);
//==> Auto remove ...
generateEventId(applEventctagsSelection, m_eventNamed);
// == > Auto remove ...
AutoDestroy();
}
} else if (_msg.GetMessage() == applEventCtagsListSelect) {
m_eventNamed = _msg.GetData();
} else if (_msg.getMessage() == applEventCtagsListSelect) {
m_eventNamed = _msg.getData();
} else if (_msg.GetMessage() == applEventCtagsListUnSelect) {
} else if (_msg.getMessage() == applEventCtagsListUnSelect) {
m_eventNamed = "";
} else if (_msg.GetMessage() == applEventCtagsListValidate) {
GenerateEventId(applEventctagsSelection, _msg.GetData());
//==> Auto remove ...
} else if (_msg.getMessage() == applEventCtagsListValidate) {
generateEventId(applEventctagsSelection, _msg.getData());
// == > Auto remove ...
AutoDestroy();
} else if (_msg.GetMessage() == applEventctagsCancel) {
GenerateEventId(applEventctagsCancel, "");
//==> Auto remove ...
} else if (_msg.getMessage() == applEventctagsCancel) {
generateEventId(applEventctagsCancel, "");
// == > Auto remove ...
AutoDestroy();
}
return;
@@ -157,21 +157,21 @@ void appl::TagFileSelection::OnReceiveMessage(const ewol::EMessage& _msg)
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
*/
void appl::TagFileSelection::AddCtagsNewItem(etk::UString file, int32_t line)
void appl::TagFileSelection::addCtagsNewItem(etk::UString file, int32_t line)
{
if (NULL != m_listTag) {
m_listTag->Add(file, line);
m_listTag->add(file, line);
}
}
void appl::TagFileSelection::OnObjectRemove(ewol::EObject * _removeObject)
void appl::TagFileSelection::onObjectRemove(ewol::EObject * _removeObject)
{
// First step call parrent :
widget::PopUp::OnObjectRemove(_removeObject);
widget::PopUp::onObjectRemove(_removeObject);
// second step find if in all the elements ...
if(_removeObject == m_listTag) {
m_listTag = NULL;

View File

@@ -26,15 +26,15 @@ namespace appl {
TagFileSelection(void);
virtual ~TagFileSelection(void);
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
*/
void AddCtagsNewItem(etk::UString file, int32_t line);
void addCtagsNewItem(etk::UString file, int32_t line);
public: // herited function
const char * const GetObjectType(void) { return "EwolFileChooser"; };
void OnReceiveMessage(const ewol::EMessage& _msg);
void OnObjectRemove(ewol::EObject * _removeObject);
const char * const getObjectType(void) { return "EwolFileChooser"; };
void onReceiveMessage(const ewol::EMessage& _msg);
void onObjectRemove(ewol::EObject * _removeObject);
};
};

View File

@@ -27,7 +27,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
m_displayText(_fontName, _fontSize),
m_insertMode(false)
{
SetCanHaveFocus(true);
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferId);
RegisterMultiCast(ednMsgGuiCopy);
RegisterMultiCast(ednMsgGuiPaste);
@@ -40,7 +40,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
RegisterMultiCast(ednMsgGuiFind);
RegisterMultiCast(ednMsgGuiReplace);
RegisterMultiCast(ednMsgGuiGotoLine);
SetLimitScrolling(0.2);
setLimitScrolling(0.2);
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
@@ -57,7 +57,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
APPL_ERROR("can not create buffer ... ");
return;
}
m_buffer->LoadFile("./example.txt");
m_buffer->loadFile("./example.txt");
}
@@ -67,44 +67,44 @@ appl::TextViewer::~TextViewer(void)
}
bool appl::TextViewer::CalculateMinSize(void)
bool appl::TextViewer::calculateMinSize(void)
{
m_minSize.setValue(50,50);
return true;
}
void appl::TextViewer::CalculateMaxSize(void)
void appl::TextViewer::calculateMaxSize(void)
{
m_maxSize.setX(256);
m_maxSize.setY(256);
}
void appl::TextViewer::OnDraw(void)
void appl::TextViewer::onDraw(void)
{
m_displayDrawing.Draw();
m_displayText.Draw();
WidgetScrooled::OnDraw();
m_displayDrawing.draw();
m_displayText.draw();
WidgetScrooled::onDraw();
}
void appl::TextViewer::OnRegenerateDisplay(void)
void appl::TextViewer::onRegenerateDisplay(void)
{
if (false == NeedRedraw()) {
if (false == needRedraw()) {
return;
}
// For the scrooling windows
CalculateMaxSize();
m_displayDrawing.Clear();
m_displayText.Clear();
calculateMaxSize();
m_displayDrawing.clear();
m_displayText.clear();
// Reset the background :
m_displayDrawing.SetPos(vec3(0, 0, 0));
m_displayDrawing.SetColor(etk::Color<>(220, 220, 220, 256));
m_displayDrawing.RectangleWidth(m_size);
// reset the background :
m_displayDrawing.setPos(vec3(0, 0, 0));
m_displayDrawing.setColor(etk::Color<>(220, 220, 220, 256));
m_displayDrawing.rectangleWidth(m_size);
if (m_buffer == NULL) {
m_displayText.SetTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayText.SetRelPos(vec3(10, 0, 0));
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayText.setRelPos(vec3(10, 0, 0));
etk::UString tmpString("<br/>\n"
"<font color=\"red\">\n"
" <b>\n"
@@ -118,131 +118,131 @@ void appl::TextViewer::OnRegenerateDisplay(void)
" No Buffer Availlable to display\n"
" </i>\n"
"</font>\n");
m_displayText.SetPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.ForceLineReturn();
m_displayText.PrintDecorated(tmpString);
m_displayText.setPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.forceLineReturn();
m_displayText.printDecorated(tmpString);
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
WidgetScrooled::onRegenerateDisplay();
return;
}
// normal displa of the buffer :
vec3 tmpCursorPosition(0, 0, -1);
// real display ...
etk::Buffer& buf = m_buffer->GetData();
m_displayText.SetColor(etk::Color<>(0, 0, 0, 256));
etk::Buffer& buf = m_buffer->getData();
m_displayText.setColor(etk::Color<>(0, 0, 0, 256));
float countNbLine = 1;
esize_t countColomn = 0;
vec3 tmpLetterSize = m_displayText.CalculateSize((uniChar_t)'A');
vec3 tmpLetterSize = m_displayText.calculateSize((uniChar_t)'A');
vec3 positionCurentDisplay(0.0f, m_size.y()-tmpLetterSize.y(), 0.0f);
m_displayText.SetPos(positionCurentDisplay);
m_displayText.setPos(positionCurentDisplay);
// the siplay string :
etk::UString stringToDisplay;
esize_t bufferElementSize = 0;
etk::UniChar currentValue;
for (int32_t iii=0; iii<buf.Size(); iii+=bufferElementSize) {
if (iii==m_buffer->m_cursorPos) {
for (int32_t iii=0; iii<buf.size(); iii+=bufferElementSize) {
if (iii == m_buffer->m_cursorPos) {
// need to display the cursor :
tmpCursorPosition = positionCurentDisplay;
}
bufferElementSize = m_buffer->Get(iii, currentValue);
bufferElementSize = m_buffer->get(iii, currentValue);
//APPL_DEBUG(" element size : " << iii << " : " << bufferElementSize);
if (currentValue == etk::UniChar::Return) {
countNbLine += 1;
countColomn = 0;
if (bufferElementSize ==0) {
if (bufferElementSize == 0) {
bufferElementSize = 1;
}
positionCurentDisplay.setX(0);
positionCurentDisplay.setY(positionCurentDisplay.y()-tmpLetterSize.y());
m_displayText.SetPos(positionCurentDisplay);
m_displayText.setPos(positionCurentDisplay);
continue;
}
m_buffer->Expand(countColomn, currentValue, stringToDisplay);
//APPL_DEBUG("display : '" << currentValue << "' ==> '" << stringToDisplay << "'");
//m_displayText.SetPos(positionCurentDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.Size(); ++kkk) {
m_displayText.Print(stringToDisplay[kkk]);
//APPL_DEBUG("display : '" << currentValue << "' == > '" << stringToDisplay << "'");
//m_displayText.setPos(positionCurentDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
m_displayText.print(stringToDisplay[kkk]);
}
positionCurentDisplay = m_displayText.GetPos();
countColomn += stringToDisplay.Size();
positionCurentDisplay = m_displayText.getPos();
countColomn += stringToDisplay.size();
if (bufferElementSize ==0) {
if (bufferElementSize == 0) {
bufferElementSize = 1;
}
}
if (tmpCursorPosition.z()!=-1) {
// display the cursor:
//APPL_DEBUG("display cursor at position : " << tmpCursorPosition);
m_displayText.SetPos(tmpCursorPosition);
m_displayText.SetColor(etk::Color<>(0xFF0000FF));
m_displayText.SetColorBg(etk::Color<>(0xFF0000FF));
m_displayText.PrintCursor(m_insertMode);
m_displayText.setPos(tmpCursorPosition);
m_displayText.setColor(etk::Color<>(0xFF0000FF));
m_displayText.setColorBg(etk::Color<>(0xFF0000FF));
m_displayText.printCursor(m_insertMode);
}
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
WidgetScrooled::onRegenerateDisplay();
}
bool appl::TextViewer::OnEventEntry(const ewol::EventEntry& _event)
bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event)
{
if (m_buffer == NULL) {
return false;
}
// just forward event ==> manage directly in the buffer
if (m_buffer->OnEventEntry(_event) == true) {
MarkToRedraw();
// just forward event == > manage directly in the buffer
if (m_buffer->onEventEntry(_event) == true) {
markToRedraw();
return true;
}
return false;
}
bool appl::TextViewer::OnEventInput(const ewol::EventInput& _event)
bool appl::TextViewer::onEventInput(const ewol::EventInput& _event)
{
vec2 relativePos = RelativePosition(_event.GetPos());
vec2 relativePos = relativePosition(_event.getPos());
if (m_buffer != NULL) {
}
KeepFocus();
keepFocus();
return true;
}
void appl::TextViewer::OnEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
void appl::TextViewer::onEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
{
if (m_buffer != NULL) {
//tmpBuffer->Paste(_clipboardID);
}
MarkToRedraw();
markToRedraw();
}
void appl::TextViewer::OnReceiveMessage(const ewol::EMessage& _msg)
void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg)
{
// Force redraw of the widget
MarkToRedraw();
// force redraw of the widget
markToRedraw();
}
void appl::TextViewer::OnGetFocus(void)
void appl::TextViewer::onGetFocus(void)
{
ShowKeyboard();
APPL_INFO("Focus - In");
}
void appl::TextViewer::OnLostFocus(void)
void appl::TextViewer::onLostFocus(void)
{
HideKeyboard();
APPL_INFO("Focus - out");
}
void appl::TextViewer::SetFontSize(int32_t _size)
void appl::TextViewer::setFontSize(int32_t _size)
{
m_displayText.SetFontSize(_size);
SetScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ...
m_displayText.setFontSize(_size);
setScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ...
}
void appl::TextViewer::SetFontName(const etk::UString& _fontName)
void appl::TextViewer::setFontName(const etk::UString& _fontName)
{
m_displayText.SetFontName(_fontName);
m_displayText.setFontName(_fontName);
}

View File

@@ -28,24 +28,24 @@ namespace appl
private:
appl::Buffer* m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
ewol::Text m_displayText; //!< Text display properties.
ewol::Drawing m_displayDrawing; //!< Other diaplay requested.
ewol::drawing m_displayDrawing; //!< Other diaplay requested.
public:
void SetFontSize(int32_t _size);
void SetFontName(const etk::UString& _fontName);
void setFontSize(int32_t _size);
void setFontName(const etk::UString& _fontName);
private:
void CalculateMaxSize(void);
void calculateMaxSize(void);
protected: // derived function
virtual void OnDraw(void);
virtual void onDraw(void);
public: // Derived function
const char * const GetObjectType(void) { return "ApplCodeView"; };
virtual bool CalculateMinSize(void);
virtual void OnRegenerateDisplay(void);
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual bool OnEventInput(const ewol::EventInput& _event);
virtual bool OnEventEntry(const ewol::EventEntry& _event);
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
const char * const getObjectType(void) { return "ApplCodeView"; };
virtual bool calculateMinSize(void);
virtual void onRegenerateDisplay(void);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual bool onEventInput(const ewol::EventInput& _event);
virtual bool onEventEntry(const ewol::EventEntry& _event);
virtual void onEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void onGetFocus(void);
virtual void onLostFocus(void);
private:
bool m_insertMode; //!< the insert mode is enable
};