[DEV] coding style review

This commit is contained in:
2013-10-09 22:00:24 +02:00
parent d677075e16
commit 730f637695
30 changed files with 611 additions and 832 deletions

View File

@@ -15,50 +15,44 @@
#include <ewol/renderer/EObject.h>
#undef __class__
#define __class__ "BufferView"
#define __class__ "BufferView"
static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
{
etk::Vector<appl::dataBufferStruct *> tmpList = list;
list.clear();
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++) {
if (NULL != tmpList[iii]) {
int32_t findPos = 0;
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()) {
findPos = jjj+1;
}
}
}
//EWOL_DEBUG("position="<<findPos);
list.insert(findPos, tmpList[iii]);
if (NULL == tmpList[iii]) {
continue;
}
int32_t findPos = 0;
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (_list[jjj] == NULL) {
continue;
}
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
findPos = jjj+1;
}
}
//EWOL_DEBUG("position="<<findPos);
_list.insert(findPos, tmpList[iii]);
}
}
BufferView::BufferView(void)
{
BufferView::BufferView(void) {
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferListChange);
RegisterMultiCast(ednMsgBufferState);
RegisterMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgBufferListChange);
registerMultiCast(ednMsgBufferState);
registerMultiCast(ednMsgBufferId);
m_selectedID = -1;
m_selectedIdRequested = -1;
}
BufferView::~BufferView(void)
{
BufferView::~BufferView(void) {
removeAllElement();
}
void BufferView::removeAllElement(void)
{
void BufferView::removeAllElement(void) {
for(int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
delete(m_list[iii]);
@@ -68,8 +62,7 @@ void BufferView::removeAllElement(void)
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) {
// clean The list
@@ -77,7 +70,8 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
// get all the buffer name and properties:
int32_t nbBufferOpen = BufferManager::size();
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
if (BufferManager::Exist(iii)) {
if (BufferManager::exist(iii)) {
/*
BufferText* tmpBuffer = BufferManager::get(iii);
if (NULL != tmpBuffer) {
bool isModify = tmpBuffer->isModify();
@@ -89,6 +83,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
APPL_ERROR("Allocation error of the tmp buffer list element");
}
}
*/
}
}
if (true == globals::OrderTheBufferList() ) {
@@ -102,7 +97,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
// 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();
@@ -110,29 +105,24 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
}
etk::Color<> BufferView::getBasicBG(void)
{
etk::Color<> BufferView::getBasicBG(void) {
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)
{
myTitle = "Buffers : ";
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();
}
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;
@@ -140,49 +130,49 @@ bool BufferView::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
if (m_selectedIdRequested != -1) {
m_selectedID = -1;
}
if( raw >= 0
&& raw<m_list.size()
&& NULL != m_list[raw]) {
myTextToWrite = m_list[raw]->m_bufferName.getNameFile();
if( _raw >= 0
&& _raw<m_list.size()
&& NULL != m_list[_raw]) {
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
if (true == m_list[raw]->m_isModify) {
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;
}
// the buffer change of selection ...
if (m_selectedIdRequested == m_list[raw]->m_bufferID) {
m_selectedID = raw;
if (m_selectedIdRequested == m_list[_raw]->m_bufferID) {
m_selectedID = _raw;
// stop searching
m_selectedIdRequested = -1;
// set the raw visible :
setRawVisible(m_selectedID);
}
if (m_selectedID == raw) {
if (m_selectedID == _raw) {
selectBG = COLOR_LIST_BG_SELECTED;
}
} else {
myTextToWrite = "ERROR";
_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()
&& NULL != m_list[raw]) {
m_selectedIdRequested = m_list[raw]->m_bufferID;
SendMultiCast(ednMsgBufferId, m_list[raw]->m_bufferID);
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()
&& NULL != m_list[_raw]) {
m_selectedIdRequested = m_list[_raw]->m_bufferID;
sendMultiCast(ednMsgBufferId, m_list[_raw]->m_bufferID);
}
}
markToRedraw();

View File

@@ -10,7 +10,6 @@
#define __BUFFER_VIEW_H__
#include <appl/Debug.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <appl/globalMsg.h>
#include <ewol/widget/List.h>
@@ -24,11 +23,10 @@ namespace appl
etk::FSNode m_bufferName;
uint32_t m_bufferID;
bool m_isModify;
dataBufferStruct(etk::FSNode& bufferName, int32_t bufferID, bool isModify) :
m_bufferName(bufferName),
m_bufferID(bufferID),
m_isModify(isModify)
{
dataBufferStruct(etk::FSNode& _bufferName, int32_t _bufferID, bool _isModify) :
m_bufferName(_bufferName),
m_bufferID(_bufferID),
m_isModify(_isModify) {
};
~dataBufferStruct(void) { };
@@ -38,9 +36,9 @@ namespace appl
class BufferView : public widget::List
{
private:
int32_t m_selectedIdRequested;
int32_t m_selectedID;
etk::Vector<appl::dataBufferStruct*> m_list;
int32_t m_selectedIdRequested;
int32_t m_selectedID;
etk::Vector<appl::dataBufferStruct*> m_list;
public:
// Constructeur
BufferView(void);
@@ -55,10 +53,10 @@ class BufferView : public widget::List
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 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 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

@@ -10,7 +10,6 @@
#include <appl/Debug.h>
#include <appl/global.h>
#include <MainWindows.h>
#include <CodeView.h>
#include <BufferView.h>
#include <TextViewer.h>
#include <Search.h>
@@ -55,12 +54,10 @@ namespace appl
#include <ewol/widget/Label.h>
#include <ewol/widget/Spacer.h>
class ParameterAboutGui : public widget::Sizer
{
class ParameterAboutGui : public widget::Sizer {
public :
ParameterAboutGui(void) :
widget::Sizer(widget::Sizer::modeVert)
{
widget::Sizer(widget::Sizer::modeVert) {
widget::Spacer* mySpacer = NULL;
mySpacer = new widget::Spacer();
@@ -102,7 +99,9 @@ class ParameterAboutGui : public widget::Sizer
}
};
~ParameterAboutGui(void) { };
~ParameterAboutGui(void) {
};
};
@@ -111,16 +110,14 @@ const char * l_smoothMin = "tmpEvent_minChange";
const char * l_smoothMax = "tmpEvent_maxChange";
#undef __class__
#define __class__ "MainWindows"
#define __class__ "MainWindows"
MainWindows::MainWindows(void)
{
MainWindows::MainWindows(void) {
APPL_DEBUG("CREATE WINDOWS ... ");
widget::Sizer * mySizerVert = NULL;
widget::Sizer * mySizerVert2 = NULL;
widget::Sizer * mySizerHori = NULL;
//ewol::Button * myButton = NULL;
CodeView * myCodeView = NULL;
appl::TextViewer * myTextView = NULL;
BufferView * myBufferView = NULL;
widget::Menu * myMenu = NULL;
@@ -241,40 +238,39 @@ MainWindows::MainWindows(void)
// add generic shortcut ...
// (shift, control, alt, meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString& data)
ShortCutAdd("ctrl+o", ednMsgGuiOpen, "", true);
ShortCutAdd("ctrl+n", ednMsgGuiNew, "", true);
shortCutAdd("ctrl+o", ednMsgGuiOpen, "", true);
shortCutAdd("ctrl+n", ednMsgGuiNew, "", true);
ShortCutAdd("ctrl+s", ednMsgGuiSave, "current", true);
ShortCutAdd("ctrl+shift+s", ednMsgGuiSave, "All", true);
shortCutAdd("ctrl+s", ednMsgGuiSave, "current", true);
shortCutAdd("ctrl+shift+s", ednMsgGuiSave, "All", true);
ShortCutAdd("ctrl+q", ednMsgGuiClose, "current", true);
ShortCutAdd("ctrl+shift+q", ednMsgGuiClose, "All", true);
shortCutAdd("ctrl+q", ednMsgGuiClose, "current", true);
shortCutAdd("ctrl+shift+q", ednMsgGuiClose, "All", true);
ShortCutAdd("ctrl+z", ednMsgGuiUndo, "", true);
ShortCutAdd("ctrl+shift+z", ednMsgGuiRedo, "", true);
shortCutAdd("ctrl+z", ednMsgGuiUndo, "", true);
shortCutAdd("ctrl+shift+z", ednMsgGuiRedo, "", true);
ShortCutAdd("ctrl+l", ednMsgGuiGotoLine, "???", true);
shortCutAdd("ctrl+l", ednMsgGuiGotoLine, "???", true);
ShortCutAdd("ctrl+f", ednMsgGuiSearch, "", true);
ShortCutAdd("F12", ednMsgGuiReloadShader, "", true);
shortCutAdd("ctrl+f", ednMsgGuiSearch, "", true);
shortCutAdd("F12", ednMsgGuiReloadShader, "", true);
ShortCutAdd("ctrl+d", ednMsgGuiCtags, "Jump", true);
shortCutAdd("ctrl+d", ednMsgGuiCtags, "Jump", true);
// Generic event ...
RegisterMultiCast(ednMsgGuiSaveAs);
RegisterMultiCast(ednMsgProperties);
RegisterMultiCast(ednMsgGuiOpen);
registerMultiCast(ednMsgGuiSaveAs);
registerMultiCast(ednMsgProperties);
registerMultiCast(ednMsgGuiOpen);
// to update the title ...
RegisterMultiCast(ednMsgBufferState);
RegisterMultiCast(ednMsgBufferId);
RegisterMultiCast(ednMsgGuiReloadShader);
registerMultiCast(ednMsgBufferState);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiReloadShader);
}
MainWindows::~MainWindows(void)
{
MainWindows::~MainWindows(void) {
}
@@ -283,28 +279,29 @@ 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);
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" == > data=\"" << data << "\"" );
// open file Section ...
if (_msg.getMessage() == ednMsgGuiOpen) {
widget::fileChooser* tmpWidget = new widget::FileChooser();
widget::FileChooser* tmpWidget = new widget::FileChooser();
tmpWidget->setTitle("Open files ...");
tmpWidget->setValidateLabel("Open");
if (BufferManager::getSelected()!=-1) {
BufferText * myBuffer = BufferManager::get(BufferManager::GetSelected());
/*
BufferText * myBuffer = BufferManager::get(BufferManager::getSelected());
if (NULL!=myBuffer) {
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());
sendMultiCast(ednMsgOpenFile, _msg.getData());
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
if (_msg.getData() == "") {
APPL_ERROR("Null data for Save As file ... ");
@@ -316,11 +313,12 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
sscanf(_msg.getData().c_str(), "%d", &m_currentSavingAsIdBuffer);
}
if (false == BufferManager::Exist(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();
widget::FileChooser* tmpWidget = new widget::FileChooser();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
@@ -338,6 +336,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
}
*/
}
}
} else if (_msg.getMessage() == ednEventPopUpFileSaveAs) {
@@ -346,11 +345,12 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
APPL_DEBUG("Request Saving As file : " << tmpData);
BufferManager::get(m_currentSavingAsIdBuffer)->setFileName(tmpData);
SendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
sendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
} 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();
@@ -369,6 +369,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
m_widgetLabelFileName->setLabel("");
setTitle("edn");
}
*/
return;
// TODO : set the Title ....
} else if (_msg.getMessage() == ednMsgProperties) {
@@ -379,18 +380,18 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
} else {
tmpWidget->setTitle("Properties");
popUpWidgetPush(tmpWidget);
tmpWidget->MenuAddGroup("Editor");
tmpWidget->menuAddGroup("Editor");
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
tmpWidget->MenuAdd("Editor", "", tmpSubWidget);
tmpWidget->MenuAdd("Font & Color", "", NULL);
tmpWidget->MenuAdd("Highlight", "", NULL);
tmpWidget->MenuAddGroup("General");
tmpWidget->MenuAdd("Display", "", NULL);
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
tmpWidget->menuAdd("Font & Color", "", NULL);
tmpWidget->menuAdd("Highlight", "", NULL);
tmpWidget->menuAddGroup("General");
tmpWidget->menuAdd("Display", "", NULL);
tmpSubWidget = new ParameterAboutGui();
tmpWidget->MenuAdd("About", "", tmpSubWidget);
tmpWidget->menuAdd("About", "", tmpSubWidget);
}
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
ewol::getContext().getResourcesManager().ReLoadResources();
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiExit) {
// TODO ...
@@ -399,8 +400,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
return;
}
void MainWindows::onObjectRemove(ewol::EObject * _removeObject)
{
void MainWindows::onObjectRemove(ewol::EObject * _removeObject) {
ewol::Windows::onObjectRemove(_removeObject);
if (m_widgetLabelFileName == _removeObject) {
m_widgetLabelFileName = NULL;

View File

@@ -12,13 +12,11 @@
#include <appl/Debug.h>
#include <appl/globalMsg.h>
#include <CodeView.h>
#include <BufferView.h>
#include <BufferManager.h>
#include <ewol/widget/Label.h>
class MainWindows : public ewol::Windows
{
class MainWindows : public ewol::Windows {
private:
int32_t m_currentSavingAsIdBuffer;
widget::Label* m_widgetLabelFileName;

View File

@@ -32,10 +32,9 @@ const char* const l_eventForwardCb = "appl-forward-CheckBox";
const char* const l_eventHideBt = "appl-hide-button";
Search::Search(void) :
widget::Sizer(widget::Sizer::modeHori),
m_searchEntry(NULL),
m_replaceEntry(NULL)
{
widget::Sizer(widget::Sizer::modeHori),
m_searchEntry(NULL),
m_replaceEntry(NULL) {
m_forward = false;
// TODO : change the mode of creating interface :
/*
@@ -180,19 +179,17 @@ Search::Search(void) :
subWidgetAdd(myButtonImage);
}
RegisterMultiCast(ednMsgGuiSearch);
registerMultiCast(ednMsgGuiSearch);
// basicly hiden ...
Hide();
hide();
}
Search::~Search(void)
{
Search::~Search(void) {
}
void Search::onReceiveMessage(const ewol::EMessage& _msg)
{
void Search::onReceiveMessage(const ewol::EMessage& _msg) {
widget::Sizer::onReceiveMessage(_msg);
//APPL_INFO("Search receive message : \"" << eventId << "\" data=\"" << data << "\"");
if ( _msg.getMessage() == l_eventSearchEntry) {
@@ -200,74 +197,73 @@ void Search::onReceiveMessage(const ewol::EMessage& _msg)
} else if ( _msg.getMessage() == l_eventSearchEntryEnter) {
SearchData::setSearch(_msg.getData());
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
sendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
sendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
SearchData::setReplace(_msg.getData());
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter) {
SearchData::setReplace(_msg.getData());
SendMultiCast(ednMsgGuiReplace, "Normal");
sendMultiCast(ednMsgGuiReplace, "Normal");
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
sendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
sendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.getMessage() == l_eventSearchBt) {
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
sendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
sendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.getMessage() == l_eventReplaceBt) {
SendMultiCast(ednMsgGuiReplace, "Normal");
sendMultiCast(ednMsgGuiReplace, "Normal");
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
sendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
sendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.getMessage() == l_eventCaseCb) {
if (_msg.getData() == "1") {
if (_msg.getData() == "true") {
SearchData::setCase(false);
} else {
SearchData::setCase(true);
}
} else if ( _msg.getMessage() == l_eventWrapCb) {
if (_msg.getData() == "1") {
if (_msg.getData() == "true") {
SearchData::setWrap(false);
} else {
SearchData::setWrap(true);
}
} else if ( _msg.getMessage() == l_eventForwardCb) {
if (_msg.getData() == "1") {
if (_msg.getData() == "true") {
m_forward = false;
} else {
m_forward = true;
}
} else if ( _msg.getMessage() == l_eventHideBt) {
Hide();
hide();
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
if (true == isHide()) {
Show();
show();
if (m_searchEntry!= NULL) {
m_searchEntry->keepFocus();
}
} else {
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
Hide();
hide();
} else if (m_searchEntry!= NULL) {
m_searchEntry->keepFocus();
} else {
Hide();
hide();
}
}
}
}
void Search::onObjectRemove(ewol::EObject * _removeObject)
{
void Search::onObjectRemove(ewol::EObject * _removeObject) {
widget::Sizer::onObjectRemove(_removeObject);
if (_removeObject == m_searchEntry) {
m_searchEntry = NULL;

View File

@@ -16,7 +16,7 @@
class Search : public widget::Sizer
{
private:
bool m_forward;
bool m_forward;
widget::Entry * m_searchEntry;
widget::Entry * m_replaceEntry;
public:

View File

@@ -10,15 +10,13 @@
#include <appl/Gui/TagFileList.h>
#undef __class__
#define __class__ "TagFileList"
#define __class__ "TagFileList"
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
appl::TagFileList::TagFileList(void)
{
appl::TagFileList::TagFileList(void) {
m_selectedLine = -1;
addEventId(applEventCtagsListSelect);
addEventId(applEventCtagsListValidate);
@@ -26,8 +24,7 @@ appl::TagFileList::TagFileList(void)
}
appl::TagFileList::~TagFileList(void)
{
appl::TagFileList::~TagFileList(void) {
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL != m_list[iii]) {
delete(m_list[iii]);
@@ -44,8 +41,8 @@ uint32_t appl::TagFileList::getNuberOfColomn(void) {
return 2;
}
bool appl::TagFileList::getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg) {
myTitle = "title";
bool appl::TagFileList::getTitle(int32_t _colomn, etk::UString& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) {
_myTitle = "title";
return true;
}
@@ -53,51 +50,50 @@ 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) {
myTextToWrite = etk::UString(m_list[raw]->fileLine);
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;
_myTextToWrite = m_list[_raw]->filename;
}
} else {
myTextToWrite = "ERROR";
_myTextToWrite = "ERROR";
}
fg = etk::color::black;
if (raw % 2) {
if (colomn%2 == 0) {
bg = 0xFFFFFF00;
_fg = etk::color::black;
if (_raw % 2) {
if (_colomn%2 == 0) {
_bg = 0xFFFFFF00;
} else {
bg = 0xFFFFFF10;
_bg = 0xFFFFFF10;
}
} else {
if (colomn%2 == 0) {
bg = 0xBFBFBFFF;
if (_colomn%2 == 0) {
_bg = 0xBFBFBFFF;
} else {
bg = 0xCFCFCFFF;
_bg = 0xCFCFCFFF;
}
}
if (m_selectedLine == raw) {
if (colomn%2 == 0) {
bg = 0x8F8FFFFF;
if (m_selectedLine == _raw) {
if (_colomn%2 == 0) {
_bg = 0x8F8FFFFF;
} else {
bg = 0x7F7FFFFF;
_bg = 0x7F7FFFFF;
}
}
return true;
};
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) {
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 (_IdInput == 1) {
int32_t previousRaw = m_selectedLine;
if (raw > m_list.size() ) {
if (_raw > m_list.size() ) {
m_selectedLine = -1;
} else {
m_selectedLine = raw;
m_selectedLine = _raw;
}
const char * event = applEventCtagsListValidate;
if (previousRaw != m_selectedLine) {
@@ -106,7 +102,7 @@ bool appl::TagFileList::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
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);
}
@@ -123,11 +119,9 @@ bool appl::TagFileList::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
* @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)
{
appl::TagListElement *tmpFile = new appl::TagListElement(file, 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);
}

View File

@@ -22,11 +22,16 @@ namespace appl {
public:
etk::UString filename;
int32_t fileLine;
TagListElement(etk::UString& file, int32_t line) : filename(file), fileLine(line) {};
~TagListElement(void) {};
TagListElement(etk::UString& _file, int32_t _line) :
filename(_file),
fileLine(_line) {
};
~TagListElement(void) {
};
};
class TagFileList : public widget::List
{
class TagFileList : public widget::List {
private:
int32_t m_selectedLine;
etk::Vector<appl::TagListElement*> m_list;
@@ -36,19 +41,21 @@ namespace appl {
// 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);
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);
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 "appl::TagFileList";
};
public:
/**
* @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

@@ -23,11 +23,11 @@
#undef __class__
#define __class__ "TagFileSelection"
#define __class__ "TagFileSelection"
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
appl::TagFileSelection::TagFileSelection(void)
@@ -54,7 +54,7 @@ appl::TagFileSelection::TagFileSelection(void)
if (NULL == mySizerVert) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->LockExpand(bvec2(true,true));
mySizerVert->lockExpand(bvec2(true,true));
// set it in the pop-up-system :
setSubWidget(mySizerVert);
@@ -124,19 +124,17 @@ appl::TagFileSelection::TagFileSelection(void)
}
appl::TagFileSelection::~TagFileSelection(void)
{
appl::TagFileSelection::~TagFileSelection(void) {
}
void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
{
EWOL_INFO("ctags LIST ... : \"" << _msg.getMessage() << "\" == > data=\"" << _msg.GetData() << "\"" );
void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg) {
EWOL_INFO("ctags LIST ... : " << _msg );
if (_msg.getMessage() == applEventctagsSelection) {
if (m_eventNamed!="") {
generateEventId(applEventctagsSelection, m_eventNamed);
// == > Auto remove ...
AutoDestroy();
autoDestroy();
}
} else if (_msg.getMessage() == applEventCtagsListSelect) {
m_eventNamed = _msg.getData();
@@ -146,11 +144,11 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
} else if (_msg.getMessage() == applEventCtagsListValidate) {
generateEventId(applEventctagsSelection, _msg.getData());
// == > Auto remove ...
AutoDestroy();
autoDestroy();
} else if (_msg.getMessage() == applEventctagsCancel) {
generateEventId(applEventctagsCancel, "");
// == > Auto remove ...
AutoDestroy();
autoDestroy();
}
return;
};
@@ -161,15 +159,13 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
* @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);
// second step find if in all the elements ...

View File

@@ -17,11 +17,10 @@ extern const char * const applEventctagsSelection;
extern const char * const applEventctagsCancel;
namespace appl {
class TagFileSelection : public widget::PopUp
{
class TagFileSelection : public widget::PopUp {
private:
appl::TagFileList* m_listTag;
etk::UString m_eventNamed;
appl::TagFileList* m_listTag;
etk::UString m_eventNamed;
public:
TagFileSelection(void);
virtual ~TagFileSelection(void);

View File

@@ -6,8 +6,6 @@
* @license GPL v3 (see license file)
*/
#include <CodeView.h>
#include <appl/Debug.h>
#include <appl/global.h>
#include <TextViewer.h>
@@ -20,35 +18,34 @@
#include <ewol/renderer/EObject.h>
#undef __class__
#define __class__ "TextViewer"
#define __class__ "TextViewer"
appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
m_buffer(NULL),
m_displayText(_fontName, _fontSize),
m_insertMode(false)
{
m_buffer(NULL),
m_displayText(_fontName, _fontSize),
m_insertMode(false) {
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferId);
RegisterMultiCast(ednMsgGuiCopy);
RegisterMultiCast(ednMsgGuiPaste);
RegisterMultiCast(ednMsgGuiCut);
RegisterMultiCast(ednMsgGuiRedo);
RegisterMultiCast(ednMsgGuiUndo);
RegisterMultiCast(ednMsgGuiRm);
RegisterMultiCast(ednMsgGuiSelect);
RegisterMultiCast(ednMsgGuiChangeCharset);
RegisterMultiCast(ednMsgGuiFind);
RegisterMultiCast(ednMsgGuiReplace);
RegisterMultiCast(ednMsgGuiGotoLine);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiCopy);
registerMultiCast(ednMsgGuiPaste);
registerMultiCast(ednMsgGuiCut);
registerMultiCast(ednMsgGuiRedo);
registerMultiCast(ednMsgGuiUndo);
registerMultiCast(ednMsgGuiRm);
registerMultiCast(ednMsgGuiSelect);
registerMultiCast(ednMsgGuiChangeCharset);
registerMultiCast(ednMsgGuiFind);
registerMultiCast(ednMsgGuiReplace);
registerMultiCast(ednMsgGuiGotoLine);
setLimitScrolling(0.2);
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
ShortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
ShortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
ShortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
ShortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
ShortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
shortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
shortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
shortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
shortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
shortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
shortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
shortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
// by default we load an example object:
@@ -61,34 +58,27 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
}
appl::TextViewer::~TextViewer(void)
{
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();
}
void appl::TextViewer::onRegenerateDisplay(void)
{
void appl::TextViewer::onRegenerateDisplay(void) {
if (false == needRedraw()) {
return;
}
@@ -157,7 +147,7 @@ void appl::TextViewer::onRegenerateDisplay(void)
m_displayText.setPos(positionCurentDisplay);
continue;
}
m_buffer->Expand(countColomn, currentValue, stringToDisplay);
m_buffer->expand(countColomn, currentValue, stringToDisplay);
//APPL_DEBUG("display : '" << currentValue << "' == > '" << stringToDisplay << "'");
//m_displayText.setPos(positionCurentDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
@@ -182,23 +172,19 @@ void appl::TextViewer::onRegenerateDisplay(void)
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) {
if (m_buffer->onEventEntry(_event, m_displayText) == 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());
if (m_buffer != NULL) {
@@ -207,42 +193,34 @@ bool appl::TextViewer::onEventInput(const ewol::EventInput& _event)
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();
}
void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg)
{
void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg) {
// force redraw of the widget
markToRedraw();
}
void appl::TextViewer::onGetFocus(void)
{
ShowKeyboard();
void appl::TextViewer::onGetFocus(void) {
showKeyboard();
APPL_INFO("Focus - In");
}
void appl::TextViewer::onLostFocus(void)
{
HideKeyboard();
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 ...
}
void appl::TextViewer::setFontName(const etk::UString& _fontName)
{
void appl::TextViewer::setFontName(const etk::UString& _fontName) {
m_displayText.setFontName(_fontName);
}

View File

@@ -10,7 +10,6 @@
#define __APPL_TEXT_VIEWER_H__
#include <appl/Debug.h>
#include <CodeView.h>
#include <appl/Buffer/Buffer.h>
#include <appl/globalMsg.h>
@@ -18,17 +17,15 @@
#include <ewol/compositing/Text.h>
#include <ewol/compositing/Drawing.h>
namespace appl
{
class TextViewer : public widget::WidgetScrooled
{
namespace appl {
class TextViewer : public widget::WidgetScrooled {
public:
TextViewer(const etk::UString& _fontName="", int32_t _fontSize=-1);
virtual ~TextViewer(void);
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);