[DEV] update ctags

This commit is contained in:
Edouard DUPIN 2014-05-12 21:10:45 +02:00
parent 0c6151283b
commit 7acd5127eb
6 changed files with 53 additions and 25 deletions

View File

@ -22,16 +22,23 @@ appl::TagFileList::TagFileList(void) {
addEventId(applEventCtagsListSelect); addEventId(applEventCtagsListSelect);
addEventId(applEventCtagsListValidate); addEventId(applEventCtagsListValidate);
setMouseLimit(1); setMouseLimit(1);
// Load color properties: (use file list to be generic ...)
m_colorProperty = ewol::resource::ColorFile::keep("THEME:COLOR:ListFileSystem.json");
if (m_colorProperty != NULL) {
m_colorIdText = m_colorProperty->request("text");
m_colorIdBackground1 = m_colorProperty->request("background1");
m_colorIdBackground2 = m_colorProperty->request("background2");
m_colorIdBackgroundSelected = m_colorProperty->request("selected");
}
} }
appl::TagFileList::~TagFileList(void) { 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]); delete(m_list[iii]);
m_list[iii] = NULL; m_list[iii] = NULL;
} }
} ewol::resource::ColorFile::release(m_colorProperty);
} }
etk::Color<> appl::TagFileList::getBasicBG(void) { etk::Color<> appl::TagFileList::getBasicBG(void) {
@ -61,26 +68,14 @@ bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _
} else { } else {
_myTextToWrite = "ERROR"; _myTextToWrite = "ERROR";
} }
_fg = etk::color::black; _fg = m_colorProperty->get(m_colorIdText);
if (_raw % 2) { if (_raw % 2) {
if (_colomn%2 == 0) { _bg = m_colorProperty->get(m_colorIdBackground1);
_bg = 0xFFFFFF00;
} else { } else {
_bg = 0xFFFFFF10; _bg = m_colorProperty->get(m_colorIdBackground2);
}
} else {
if (_colomn%2 == 0) {
_bg = 0xBFBFBFFF;
} else {
_bg = 0xCFCFCFFF;
}
} }
if (m_selectedLine == _raw) { if (m_selectedLine == _raw) {
if (_colomn%2 == 0) { _bg = m_colorProperty->get(m_colorIdBackgroundSelected);
_bg = 0x8F8FFFFF;
} else {
_bg = 0x7F7FFFFF;
}
} }
return true; return true;
}; };

View File

@ -11,6 +11,7 @@
#include <appl/debug.h> #include <appl/debug.h>
#include <ewol/widget/List.h> #include <ewol/widget/List.h>
#include <ewol/resource/ColorFile.h>
extern const char * const applEventCtagsListSelect; extern const char * const applEventCtagsListSelect;
@ -35,6 +36,12 @@ namespace appl {
private: private:
int32_t m_selectedLine; int32_t m_selectedLine;
std::vector<appl::TagListElement*> m_list; std::vector<appl::TagListElement*> m_list;
protected:
ewol::resource::ColorFile* m_colorProperty; //!< theme color property.
int32_t m_colorIdText; //!< Color of the text.
int32_t m_colorIdBackground1; //!< Color of the Background.
int32_t m_colorIdBackground2; //!< Color of the Background 2.
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
public: public:
TagFileList(void); TagFileList(void);
~TagFileList(void); ~TagFileList(void);

View File

@ -70,6 +70,18 @@ appl::TextViewer::~TextViewer(void) {
appl::ViewerManager::release(m_viewerManager); appl::ViewerManager::release(m_viewerManager);
} }
std::string appl::TextViewer::getBufferPath(void) {
if (m_buffer == NULL) {
return "";
}
std::string filename = m_buffer->getFileName();
size_t pos = filename.rfind('/');
if (pos == std::string::npos) {
return "";
}
return std::string(filename, 0, pos);
}
void appl::TextViewer::changeZoom(float _range) { void appl::TextViewer::changeZoom(float _range) {
m_displayText.setFontSize(m_displayText.getSize() + _range); m_displayText.setFontSize(m_displayText.getSize() + _range);
markToRedraw(); markToRedraw();

View File

@ -198,6 +198,11 @@ namespace appl {
*/ */
bool isSelectedLast(void); bool isSelectedLast(void);
public: public:
/**
* @brief get the path of the current buffer
* @return Path of the buffer (remove the ended name)
*/
virtual std::string getBufferPath(void);
/** /**
* @brief Check if the buffer is availlable * @brief Check if the buffer is availlable
* @return true if a display buffer is present, false otherwise. * @return true if a display buffer is present, false otherwise.

View File

@ -177,12 +177,18 @@ bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer,
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser(); ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser();
if (NULL == tmpWidget) { 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 { return true;
}
tmpWidget->setTitle("Open Exuberant Ctags file"); tmpWidget->setTitle("Open Exuberant Ctags file");
tmpWidget->setValidateLabel("Open"); tmpWidget->setValidateLabel("Open");
// try to get the current folder :
std::string path = _textDrawer.getBufferPath();
APPL_ERROR("get path : '" << path << "'");
if (path != "") {
tmpWidget->setFolder(path);
}
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn); tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn);
}
return true; return true;
} else if (_msg.getMessage() == eventJumpDestination) { } else if (_msg.getMessage() == eventJumpDestination) {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {

View File

@ -16,6 +16,9 @@
#include <appl/TextPlugin.h> #include <appl/TextPlugin.h>
#include <appl/ctags/readtags.h> #include <appl/ctags/readtags.h>
// create ctags file : "ctags-exuberant --fields=n -R"
// --fields=n add the line number needed for this software version ..
namespace appl { namespace appl {
class TextPluginCtags : public appl::TextViewerPlugin { class TextPluginCtags : public appl::TextViewerPlugin {
private: private: