[DEV][CTAGS] integration of the first ewol display version
This commit is contained in:
@@ -66,6 +66,7 @@ void CodeView::Init(void)
|
||||
RegisterMultiCast(ednMsgGuiChangeCharset);
|
||||
RegisterMultiCast(ednMsgGuiFind);
|
||||
RegisterMultiCast(ednMsgGuiReplace);
|
||||
RegisterMultiCast(ednMsgGuiGotoLine);
|
||||
SetLimitScrolling(0.2);
|
||||
}
|
||||
|
||||
@@ -397,21 +398,12 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
} else if (data == "All") {
|
||||
|
||||
}
|
||||
} else if (eventId == ednMsgGuiGotoLine) {
|
||||
int32_t lineID = 0;
|
||||
sscanf(data.c_str(), "%d", &lineID);
|
||||
APPL_INFO("Goto line : " << lineID);
|
||||
BufferManager::Get(m_bufferID)->JumpAtLine(lineID);
|
||||
}
|
||||
/*
|
||||
switch (id)
|
||||
{
|
||||
case APPL_MSG__CURRENT_GOTO_LINE:
|
||||
if (dataID<0) {
|
||||
dataID = 0;
|
||||
}
|
||||
BufferManager::Get(m_bufferID)->JumpAtLine(dataID);
|
||||
break;
|
||||
case APPL_MSG__CURRENT_SET_CHARSET:
|
||||
BufferManager::Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// Force redraw of the widget
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
145
Sources/appl/Gui/TagFileList.cpp
Normal file
145
Sources/appl/Gui/TagFileList.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileList.cpp
|
||||
* @brief Editeur De N'ours : Tags list display to jump (sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <appl/Gui/TagFileList.h>
|
||||
|
||||
extern "C" {
|
||||
// file browsing ...
|
||||
#include <dirent.h>
|
||||
}
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TagFileList"
|
||||
|
||||
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
|
||||
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||
|
||||
|
||||
appl::TagFileList::TagFileList(void)
|
||||
{
|
||||
m_selectedLine = -1;
|
||||
AddEventId(applEventCtagsListSelect);
|
||||
AddEventId(applEventCtagsListValidate);
|
||||
SetMouseLimit(1);
|
||||
}
|
||||
|
||||
|
||||
appl::TagFileList::~TagFileList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
||||
if (NULL != m_list[iii]) {
|
||||
delete(m_list[iii]);
|
||||
m_list[iii] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
draw::Color appl::TagFileList::GetBasicBG(void) {
|
||||
draw::Color bg(0x00000010);
|
||||
return bg;
|
||||
}
|
||||
|
||||
uint32_t appl::TagFileList::GetNuberOfColomn(void) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool appl::TagFileList::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) {
|
||||
myTitle = "title";
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t appl::TagFileList::GetNuberOfRaw(void) {
|
||||
return m_list.Size();
|
||||
}
|
||||
|
||||
bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) {
|
||||
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
|
||||
myTextToWrite = *m_list[raw];
|
||||
} else {
|
||||
myTextToWrite = "ERROR";
|
||||
}
|
||||
fg = draw::color::black;
|
||||
if (raw % 2) {
|
||||
bg = 0xFFFFFF00;
|
||||
} else {
|
||||
bg = 0xBFBFBFFF;
|
||||
}
|
||||
if (m_selectedLine == raw) {
|
||||
bg = 0x8F8FFFFF;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
|
||||
{
|
||||
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
||||
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||
if (1 == IdInput) {
|
||||
int32_t previousRaw = m_selectedLine;
|
||||
if (raw > m_list.Size() ) {
|
||||
m_selectedLine = -1;
|
||||
} else {
|
||||
m_selectedLine = raw;
|
||||
}
|
||||
if (previousRaw != m_selectedLine) {
|
||||
if( m_selectedLine >=0
|
||||
&& m_selectedLine < m_list.Size()
|
||||
&& NULL != m_list[m_selectedLine] ) {
|
||||
GenerateEventId(applEventCtagsListSelect, *m_list[m_selectedLine]);
|
||||
}
|
||||
} else {
|
||||
if( m_selectedLine >=0
|
||||
&& m_selectedLine < m_list.Size()
|
||||
&& NULL != m_list[m_selectedLine] ) {
|
||||
GenerateEventId(applEventCtagsListValidate, *m_list[m_selectedLine]);
|
||||
}
|
||||
}
|
||||
// need to regenerate the display of the list :
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
etk::UString *tmpFile = new etk::UString(file);
|
||||
if (NULL != tmpFile) {
|
||||
m_list.PushBack(tmpFile);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
|
76
Sources/appl/Gui/TagFileList.h
Normal file
76
Sources/appl/Gui/TagFileList.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileList.h
|
||||
* @brief Editeur De N'ours : Tags list display to jump (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __APPL_CTAGS_LIST_H__
|
||||
#define __APPL_CTAGS_LIST_H__
|
||||
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/List.h>
|
||||
|
||||
|
||||
extern const char * const applEventCtagsListSelect;
|
||||
extern const char * const applEventCtagsListValidate;
|
||||
|
||||
namespace appl {
|
||||
class TagFileList : public ewol::List
|
||||
{
|
||||
private:
|
||||
int32_t m_selectedLine;
|
||||
etk::Vector<etk::UString *> m_list;
|
||||
public:
|
||||
TagFileList(void);
|
||||
~TagFileList(void);
|
||||
// display API :
|
||||
virtual draw::Color GetBasicBG(void);
|
||||
uint32_t GetNuberOfColomn(void);
|
||||
bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
|
||||
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::eventInputType_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
|
||||
*/
|
||||
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);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
216
Sources/appl/Gui/TagFileSelection.cpp
Normal file
216
Sources/appl/Gui/TagFileSelection.cpp
Normal file
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileSelection.cpp
|
||||
* @brief Editeur De N'ours : Tags list selection to jump (sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widget/meta/FileChooser.cpp
|
||||
* @brief ewol File chooser meta widget system (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 29/12/2011
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <appl/Gui/TagFileSelection.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Image.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <etk/Vector.h>
|
||||
#include <etk/tool.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TagFileSelection"
|
||||
|
||||
|
||||
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
||||
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||
|
||||
|
||||
appl::TagFileSelection::TagFileSelection(void)
|
||||
{
|
||||
AddEventId(applEventctagsSelection);
|
||||
AddEventId(applEventctagsCancel);
|
||||
|
||||
ewol::Label* myWidgetTitle = NULL;
|
||||
ewol::Button* myWidgetValidate = NULL;
|
||||
ewol::Button* myWidgetCancel = NULL;
|
||||
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Spacer * mySpacer = NULL;
|
||||
#if defined(__TARGET_OS__Android)
|
||||
SetDisplayRatio(0.90);
|
||||
#elif defined(__TARGET_OS__Windows)
|
||||
SetDisplayRatio(0.80);
|
||||
#else
|
||||
SetDisplayRatio(0.80);
|
||||
#endif
|
||||
|
||||
mySizerVert = new ewol::SizerVert();
|
||||
if (NULL == mySizerVert) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySizerVert->LockExpendContamination(true);
|
||||
// set it in the pop-up-system :
|
||||
SubWidgetSet(mySizerVert);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
mySpacer = new ewol::Spacer();
|
||||
if (NULL == mySpacer) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySpacer->SetExpendX(true);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
myWidgetValidate = new ewol::Button("Jump");
|
||||
if (NULL == myWidgetValidate) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
myWidgetValidate->SetImage("icon/Load.svg");
|
||||
myWidgetValidate->RegisterOnEvent(this, ewolEventButtonPressed, applEventctagsSelection);
|
||||
mySizerHori->SubWidgetAdd(myWidgetValidate);
|
||||
}
|
||||
myWidgetCancel = new ewol::Button("Cancel");
|
||||
if (NULL == myWidgetCancel) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
myWidgetCancel->SetImage("icon/Remove.svg");
|
||||
myWidgetCancel->RegisterOnEvent(this, ewolEventButtonPressed, applEventctagsCancel);
|
||||
mySizerHori->SubWidgetAdd(myWidgetCancel);
|
||||
}
|
||||
}
|
||||
m_listTag = new appl::TagFileList();
|
||||
if (NULL == m_listTag) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
//m_widgetListFolder->RegisterOnEvent(this, ewolEventFSFolderValidate, ewolEventFileChooserListFolder);
|
||||
m_listTag->SetExpendX(true);
|
||||
m_listTag->SetExpendY(true);
|
||||
m_listTag->SetFillX(true);
|
||||
m_listTag->SetFillY(true);
|
||||
mySizerVert->SubWidgetAdd(m_listTag);
|
||||
}
|
||||
|
||||
myWidgetTitle = new ewol::Label("Ctags Jump Selection ...");
|
||||
if (NULL == myWidgetTitle) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySizerVert->SubWidgetAdd(myWidgetTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
appl::TagFileSelection::~TagFileSelection(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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 appl::TagFileSelection::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
EWOL_INFO("ctags LIST ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (eventId == applEventctagsSelection) {
|
||||
GenerateEventId(eventId, "???");
|
||||
//==> Auto remove ...
|
||||
AutoDestroy();
|
||||
} else if (eventId == applEventctagsCancel) {
|
||||
//Nothing selected ...
|
||||
//==> Auto remove ...
|
||||
AutoDestroy();
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
* @param[in] jump line id
|
||||
* @return ---
|
||||
*/
|
||||
void appl::TagFileSelection::AddCtagsNewItem(etk::UString file, int32_t line)
|
||||
{
|
||||
if (NULL != m_listTag) {
|
||||
m_listTag->Add(file, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void appl::TagFileSelection::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::PopUp::OnObjectRemove(m_listTag);
|
||||
// second step find if in all the elements ...
|
||||
if(removeObject == m_listTag) {
|
||||
m_listTag = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
79
Sources/appl/Gui/TagFileSelection.h
Normal file
79
Sources/appl/Gui/TagFileSelection.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileSelection.h
|
||||
* @brief Editeur De N'ours : Tags list selection to jump (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __APPL_CTAGS_SELECTION_H__
|
||||
#define __APPL_CTAGS_SELECTION_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <appl/Gui/TagFileList.h>
|
||||
|
||||
extern const char * const applEventctagsSelection;
|
||||
extern const char * const applEventctagsCancel;
|
||||
|
||||
namespace appl {
|
||||
class TagFileSelection : public ewol::PopUp
|
||||
{
|
||||
private:
|
||||
appl::TagFileList* m_listTag;
|
||||
public:
|
||||
TagFileSelection(void);
|
||||
virtual ~TagFileSelection(void);
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
const char * const GetObjectType(void) { return "EwolFileChooser"; };
|
||||
/**
|
||||
* @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 OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void OnObjectRemove(ewol::EObject * removeObject);
|
||||
/**
|
||||
* @brief Add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
* @param[in] jump line id
|
||||
* @return ---
|
||||
*/
|
||||
void AddCtagsNewItem(etk::UString file, int32_t line);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user