[DEV] Add ctags jumping

This commit is contained in:
2013-11-26 21:22:06 +01:00
parent cc5afe2d55
commit 48260131d3
12 changed files with 218 additions and 339 deletions

View File

@@ -225,11 +225,13 @@ MainWindows::MainWindows(void) {
(void)myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
(void)myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
(void)myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
/* ==> must be in the pluggin list control ...
int32_t idMenuCTags = myMenu->addTitle("C-tags");
(void)myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
(void)myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
(void)myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
(void)myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
*/
int32_t idMenugDisplay = myMenu->addTitle("Display");
(void)myMenu->add(idMenugDisplay, "Color Black", "", appl::MsgNameGuiChangeColor, "colorBlack/");
(void)myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "colorWhite/");

View File

@@ -15,8 +15,7 @@
#include <appl/Buffer.h>
#include <appl/Gui/ViewerManager.h>
class Search : public widget::Composer
{
class Search : public widget::Composer {
private:
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager
bool m_forward;

View File

@@ -55,53 +55,31 @@ appl::TagFileSelection::TagFileSelection(void) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->lockExpand(bvec2(true,true));
mySizerVert->setExpand(bvec2(true,true));
// set it in the pop-up-system :
setSubWidget(mySizerVert);
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
if (NULL == mySizerHori) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->subWidgetAdd(mySizerHori);
mySpacer = new widget::Spacer();
if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->setExpand(bvec2(true,false));
mySizerHori->subWidgetAdd(mySpacer);
}
myWidgetValidate = new widget::Button();
if (NULL == myWidgetValidate) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetValidate->setSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:icon/Load.svg\" fill=\"true\" size=\"70,70mm\"/>\n"
" <label>Jump</label>\n"
" </sizer>\n"
"</composer\n"));
myWidgetValidate->registerOnEvent(this, widget::Button::eventPressed, applEventctagsSelection);
mySizerHori->subWidgetAdd(myWidgetValidate);
}
myWidgetCancel = new widget::Button();
if (NULL == myWidgetCancel) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetCancel->setSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:icon/Remove.svg\" fill=\"true\" size=\"70,70mm\"/>\n"
" <label>Cancel</label>\n"
" </sizer>\n"
"</composer\n"));
myWidgetCancel->registerOnEvent(this, widget::Button::eventPressed, applEventctagsCancel);
mySizerHori->subWidgetAdd(myWidgetCancel);
}
}
widget::Composer* compose = new widget::Composer(widget::Composer::String,
"<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n"
" <spacer expand=\"true,false\"/>\n"
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:Load.svg\" fill=\"true\" size=\"10,10mm\"/>\n"
" <label>Jump</label>\n"
" </sizer>\n"
" </button>\n"
" <button name=\"PLUGIN-CTAGS-cancel\" expand=\"false\" fill=\"true\">"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:Remove.svg\" fill=\"true\" size=\"10,10mm\"/>\n"
" <label>Cancel</label>\n"
" </sizer>\n"
" </button>\n"
"</sizer>\n");
compose->setExpand(bvec2(true,false));
compose->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(compose);
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
m_listTag = new appl::TagFileList();
if (NULL == m_listTag) {
EWOL_ERROR("Can not allocate widget == > display might be in error");

View File

@@ -37,8 +37,9 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiFind);
registerMultiCast(ednMsgGuiReplace);
registerMultiCast(ednMsgGuiGotoLine);
registerMultiCast(appl::MsgSelectGotoLine);
registerMultiCast(appl::MsgSelectNewFile);
registerMultiCast(appl::MsgSelectGotoLineSelect);
setLimitScrolling(0.2);
// load buffer manager:
@@ -585,6 +586,24 @@ void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg) {
if (isSelectedLast() == false) {
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
if (m_buffer == NULL) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
select(it, m_buffer->getEndLine(it));
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
if (m_buffer == NULL) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
moveCursor(it);
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectNewFile) {
// reset scroll:
if (m_buffer != NULL) {