[DEBUG] correction of the mouse position adter TAB
This commit is contained in:
parent
60903845c1
commit
16bf6e7648
@ -35,7 +35,6 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
|||||||
addObjectType("appl::TextViewer");
|
addObjectType("appl::TextViewer");
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
registerMultiCast(ednMsgBufferId);
|
registerMultiCast(ednMsgBufferId);
|
||||||
registerMultiCast(ednMsgGuiRm);
|
|
||||||
registerMultiCast(ednMsgGuiSelect);
|
registerMultiCast(ednMsgGuiSelect);
|
||||||
registerMultiCast(ednMsgGuiFind);
|
registerMultiCast(ednMsgGuiFind);
|
||||||
registerMultiCast(ednMsgGuiReplace);
|
registerMultiCast(ednMsgGuiReplace);
|
||||||
@ -43,8 +42,6 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
|||||||
registerMultiCast(appl::MsgSelectNewFile);
|
registerMultiCast(appl::MsgSelectNewFile);
|
||||||
setLimitScrolling(0.2);
|
setLimitScrolling(0.2);
|
||||||
|
|
||||||
shortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
|
|
||||||
shortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
|
|
||||||
shortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
|
shortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
|
||||||
shortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
shortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
||||||
|
|
||||||
@ -521,14 +518,12 @@ void appl::TextViewer::mouseEventDouble(void) {
|
|||||||
moveCursor(endPos);
|
moveCursor(endPos);
|
||||||
m_buffer->setSelectionPos(beginPos);
|
m_buffer->setSelectionPos(beginPos);
|
||||||
}
|
}
|
||||||
// TODO : copy(ewol::clipBoard::clipboardSelection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::mouseEventTriple(void) {
|
void appl::TextViewer::mouseEventTriple(void) {
|
||||||
//m_selectMode = false;
|
//m_selectMode = false;
|
||||||
moveCursor(m_buffer->getEndLine(m_buffer->cursor()));
|
moveCursor(m_buffer->getEndLine(m_buffer->cursor()));
|
||||||
m_buffer->setSelectionPos(m_buffer->getStartLine(m_buffer->cursor()));
|
m_buffer->setSelectionPos(m_buffer->getStartLine(m_buffer->cursor()));
|
||||||
// TODO : copy(ewol::clipBoard::clipboardSelection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativePos) {
|
appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativePos) {
|
||||||
@ -546,7 +541,6 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
|
|||||||
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
||||||
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
||||||
if (stringToDisplay[kkk] == etk::UChar::Return) {
|
if (stringToDisplay[kkk] == etk::UChar::Return) {
|
||||||
// TODO : Remove this, use the automatic line manager ...
|
|
||||||
m_displayText.forceLineReturn();
|
m_displayText.forceLineReturn();
|
||||||
countColomn = 0;
|
countColomn = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -554,21 +548,23 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
|
|||||||
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
||||||
m_displayText.print(stringToDisplay[kkk]);
|
m_displayText.print(stringToDisplay[kkk]);
|
||||||
}
|
}
|
||||||
|
++countColomn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
||||||
if (-_relativePos.y() < positionCurentDisplay.y()+tmpLetterSize.y()) {
|
if (-_relativePos.y() < positionCurentDisplay.y()+tmpLetterSize.y()) {
|
||||||
//APPL_DEBUG("line position : " << _textDrawer.getPos() << " " << positionCurentDisplay );
|
APPL_VERBOSE("line position : '" << (char)(*it) << "' = '" << stringToDisplay << "' n=" << countColomn << " " <<positionCurentDisplay.x() << " < " << _relativePos.x() << " < " << m_displayText.getPos().x() );
|
||||||
if ( _relativePos.x() >= positionCurentDisplay.x()
|
if ( _relativePos.x() >= positionCurentDisplay.x()
|
||||||
&& _relativePos.x() < m_displayText.getPos().x() ) {
|
&& _relativePos.x() < m_displayText.getPos().x() ) {
|
||||||
|
APPL_VERBOSE("find ...");
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// previous line ...
|
||||||
return --it;
|
return --it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
positionCurentDisplay = m_displayText.getPos();
|
positionCurentDisplay = m_displayText.getPos();
|
||||||
countColomn += stringToDisplay.size();
|
|
||||||
}
|
}
|
||||||
return m_buffer->end();
|
return m_buffer->end();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user