[DEV] change the input and entry event function

This commit is contained in:
Edouard DUPIN 2013-05-08 12:13:49 +02:00
parent e325bffc5e
commit b55be0aeca
8 changed files with 56 additions and 91 deletions

View File

@ -21,6 +21,8 @@
<!-- hightline description : -->
<color name="type" FG="#376d0a" bold="yes"/>
<color name="memberClass" FG="#005A00" bold="yes"/>
<color name="inputFunction" FG="#B80000" bold="yes" italic="yes"/>
<color name="storageKeyword" FG="#466cb4"/>
<color name="number" FG="#007b00"/>
<color name="systemFunction" FG="#acaa00"/>

View File

@ -89,7 +89,7 @@
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<start>\@const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum\@</start>
<start>\@inline|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum\@</start>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
@ -107,6 +107,14 @@
<color>macro</color>
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
</rule>
<rule name="CPP member">
<color>memberClass</color>
<start>\@m_[A-Za-z_0-9]*\@</start>
</rule>
<rule name="function input">
<color>inputFunction</color>
<start>\@_[A-Za-z_0-9]*\@</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start>

View File

@ -167,7 +167,7 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
* @return The character at buffer position "pos"
*
*/
int8_t EdnBuf::operator[] (int32_t pos)
int8_t EdnBuf::operator[] (int32_t pos) const
{
int8_t res = m_data.Get(pos);
return res;

View File

@ -65,7 +65,7 @@ class EdnBuf {
bool DumpIn( etk::FSNode &file);
bool DumpFrom( etk::FSNode &file);
// replace with operator [] ...
int8_t operator[] (int32_t);
int8_t operator[] (int32_t) const;
int32_t Insert( int32_t pos, etk::Vector<int8_t> &insertText);
int32_t Insert( int32_t pos, etk::UString &insertText);
int32_t Replace( int32_t start, int32_t end, etk::Vector<int8_t> &insertText);

View File

@ -51,17 +51,13 @@ class BufferView : public widget::List
protected:
// function call to display the list :
virtual draw::Color GetBasicBG(void);
void RemoveAllElement(void);
// Derived function
virtual uint32_t GetNuberOfColomn(void);
// Derived function
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
// Derived function
virtual uint32_t GetNuberOfRaw(void);
// Derived function
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
// Derived function
virtual bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
void RemoveAllElement(void);
};

View File

@ -80,7 +80,6 @@ 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
* @return ---
*/
void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
{
@ -188,38 +187,30 @@ void CodeView::OnRegenerateDisplay(void)
}
bool CodeView::OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData)
bool CodeView::OnEventEntry(const ewol::EventEntry& _event)
{
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (typeEvent == ewol::keyEvent::statusDown) {
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 (NULL!=tmpBuffer) {
tmpBuffer->AddChar(_event.GetChar());
}
MarkToRedraw();
}
return true;
}
// move events ...
if (_event.GetStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->AddChar(unicodeData);
tmpBuffer->cursorMove(_event.GetType());
}
MarkToRedraw();
}
return true;
}
bool CodeView::OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent)
{
if (typeEvent == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->cursorMove(moveTypeEvent);
}
MarkToRedraw();
}
return true;
}
/**
* @brief Event on a past event ==> this event is asynchronous due to all system does not support direct getting datas
* @note : need to have focus ...
* @param[in] mode Mode of data requested
* @return ---
*/
void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID)
{
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
@ -229,25 +220,17 @@ void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID)
MarkToRedraw();
}
/**
* @brief Event on an input of this Widget
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
* @param[in] pos Absolute position of the event
* @return true the event is used
* @return false the event is not used
*/
bool CodeView::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, const vec2& pos)
bool CodeView::OnEventInput(const ewol::EventInput& _event)
{
vec2 relativePos = RelativePosition(pos);
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;
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(type, IdInput, typeEvent, pos)) {
if (true == WidgetScrooled::OnEventInput(_event)) {
ewol::widgetManager::FocusKeep(this);
// nothing to do ... done on upper widget ...
return true;
@ -257,9 +240,10 @@ bool CodeView::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol:
return false;
}
if (1 == IdInput) {
#ifndef __MODE__Touch
if (ewol::keyEvent::statusDown == typeEvent) {
if (1 == _event.GetId()) {
if (ewol::keyEvent::typeMouse == _event.GetType()) {
if (ewol::keyEvent::statusDown == _event.GetStatus()) {
m_buttunOneSelected = true;
ewol::widgetManager::FocusKeep(this);
// TODO : Set something good
@ -268,39 +252,39 @@ bool CodeView::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol:
tmpBuffer->MouseEvent(limitedPos);
}
MarkToRedraw();
} else if (ewol::keyEvent::statusUp == typeEvent) {
} else if (ewol::keyEvent::statusUp == _event.GetStatus()) {
m_buttunOneSelected = false;
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Copy(ewol::clipBoard::clipboardSelection);
}
MarkToRedraw();
} else
#endif
if (ewol::keyEvent::statusSingle == typeEvent) {
#ifdef __MODE__Touch
}
}
if (ewol::keyEvent::statusSingle == _event.GetStatus()) {
if (ewol::keyEvent::typeMouse == _event.GetType()) {
ewol::widgetManager::FocusKeep(this);
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
MarkToRedraw();
#else
} else {
// nothing to do ...
#endif
} else if (ewol::keyEvent::statusDouble == typeEvent) {
}
} else if (ewol::keyEvent::statusDouble == _event.GetStatus()) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEventDouble();
}
MarkToRedraw();
} else if (ewol::keyEvent::statusTriple == typeEvent) {
} else if (ewol::keyEvent::statusTriple == _event.GetStatus()) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEventTriple();
}
MarkToRedraw();
} else if (ewol::keyEvent::statusMove == typeEvent) {
} else if (ewol::keyEvent::statusMove == _event.GetStatus()) {
if (true == m_buttunOneSelected) {
int xxx, yyy;
xxx = relativePos.x();
@ -320,8 +304,8 @@ bool CodeView::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol:
MarkToRedraw();
}
}
} else if (2 == IdInput) {
if (ewol::keyEvent::statusSingle == typeEvent) {
} else if (2 == _event.GetId()) {
if (ewol::keyEvent::statusSingle == _event.GetStatus()) {
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (NULL!=tmpBuffer) {
@ -334,15 +318,6 @@ bool CodeView::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol:
return true;
}
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
{
widget::WidgetScrooled::OnReceiveMessage(CallerObject, eventId, data);

View File

@ -40,23 +40,13 @@ class CodeView :public widget::WidgetScrooled
// drawing elements :
ewol::Text m_displayText;
ewol::Drawing m_displayDrawing;
public:
// Derived function
public: // Derived function
virtual void OnRegenerateDisplay(void);
// Derived function
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data);
public:
// Derived function
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent,const vec2& pos);
// Derived function
virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData);
// Derived function
virtual bool OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent);
// Derived function
virtual bool OnEventInput(const ewol::EventInput& _event);
virtual bool OnEventEntry(const ewol::EventEntry& _event);
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
// Derived function
virtual void OnGetFocus(void);
// Derived function
virtual void OnLostFocus(void);
public:
void SetFontSize(int32_t size);

View File

@ -28,7 +28,7 @@ namespace appl {
class TagFileList : public widget::List
{
private:
int32_t m_selectedLine;
int32_t m_selectedLine;
etk::Vector<appl::TagListElement*> m_list;
public:
TagFileList(void);
@ -40,21 +40,15 @@ namespace appl {
uint32_t GetNuberOfRaw(void);
bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
// herited function
const char * const GetObjectType(void) { return "TagFileList"; };
public:
/**
* @brief Add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
* @return ---
*/
void Add(etk::UString& file, int32_t line);
void Add(etk::UString& file, int32_t line);
};
};