diff --git a/sources/appl/Gui/TagFileList.cpp b/sources/appl/Gui/TagFileList.cpp index 43cfe5c..f2b714f 100644 --- a/sources/appl/Gui/TagFileList.cpp +++ b/sources/appl/Gui/TagFileList.cpp @@ -22,16 +22,23 @@ appl::TagFileList::TagFileList(void) { addEventId(applEventCtagsListSelect); addEventId(applEventCtagsListValidate); 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) { for (int32_t iii=0; iii appl::TagFileList::getBasicBG(void) { @@ -61,26 +68,14 @@ bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _ } else { _myTextToWrite = "ERROR"; } - _fg = etk::color::black; + _fg = m_colorProperty->get(m_colorIdText); if (_raw % 2) { - if (_colomn%2 == 0) { - _bg = 0xFFFFFF00; - } else { - _bg = 0xFFFFFF10; - } + _bg = m_colorProperty->get(m_colorIdBackground1); } else { - if (_colomn%2 == 0) { - _bg = 0xBFBFBFFF; - } else { - _bg = 0xCFCFCFFF; - } + _bg = m_colorProperty->get(m_colorIdBackground2); } if (m_selectedLine == _raw) { - if (_colomn%2 == 0) { - _bg = 0x8F8FFFFF; - } else { - _bg = 0x7F7FFFFF; - } + _bg = m_colorProperty->get(m_colorIdBackgroundSelected); } return true; }; diff --git a/sources/appl/Gui/TagFileList.h b/sources/appl/Gui/TagFileList.h index e49c8b6..f3e177a 100644 --- a/sources/appl/Gui/TagFileList.h +++ b/sources/appl/Gui/TagFileList.h @@ -11,6 +11,7 @@ #include #include +#include extern const char * const applEventCtagsListSelect; @@ -35,6 +36,12 @@ namespace appl { private: int32_t m_selectedLine; std::vector 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: TagFileList(void); ~TagFileList(void); diff --git a/sources/appl/Gui/TextViewer.cpp b/sources/appl/Gui/TextViewer.cpp index 1a8bd2b..65c8ce4 100644 --- a/sources/appl/Gui/TextViewer.cpp +++ b/sources/appl/Gui/TextViewer.cpp @@ -70,6 +70,18 @@ appl::TextViewer::~TextViewer(void) { 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) { m_displayText.setFontSize(m_displayText.getSize() + _range); markToRedraw(); diff --git a/sources/appl/Gui/TextViewer.h b/sources/appl/Gui/TextViewer.h index e2563df..07c43b8 100644 --- a/sources/appl/Gui/TextViewer.h +++ b/sources/appl/Gui/TextViewer.h @@ -198,6 +198,11 @@ namespace appl { */ bool isSelectedLast(void); 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 * @return true if a display buffer is present, false otherwise. diff --git a/sources/appl/TextPluginCtags.cpp b/sources/appl/TextPluginCtags.cpp index d95b775..69a5963 100644 --- a/sources/appl/TextPluginCtags.cpp +++ b/sources/appl/TextPluginCtags.cpp @@ -177,12 +177,18 @@ bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer, ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser(); if (NULL == tmpWidget) { APPL_ERROR("Can not allocate widget == > display might be in error"); - } else { - tmpWidget->setTitle("Open Exuberant Ctags file"); - tmpWidget->setValidateLabel("Open"); - ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); - tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn); + return true; } + tmpWidget->setTitle("Open Exuberant Ctags file"); + 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); + tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn); return true; } else if (_msg.getMessage() == eventJumpDestination) { if (_textDrawer.hasBuffer() == false) { diff --git a/sources/appl/TextPluginCtags.h b/sources/appl/TextPluginCtags.h index e120e24..4e1464c 100644 --- a/sources/appl/TextPluginCtags.h +++ b/sources/appl/TextPluginCtags.h @@ -16,6 +16,9 @@ #include #include +// create ctags file : "ctags-exuberant --fields=n -R" +// --fields=n add the line number needed for this software version .. + namespace appl { class TextPluginCtags : public appl::TextViewerPlugin { private: