[DEV] many small correction

This commit is contained in:
2013-11-21 21:56:22 +01:00
parent 069c457407
commit e15cb8e4b6
6 changed files with 52 additions and 28 deletions

View File

@@ -238,9 +238,9 @@ MainWindows::MainWindows(void) {
(void)myMenu->addSpacer();
(void)myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
m_widgetLabelFileName = new widget::Label("<left>FileName</left>");
m_widgetLabelFileName = new widget::Label("FileName");
m_widgetLabelFileName->setExpand(bvec2(true,false));
m_widgetLabelFileName->setFill(bvec2(false,true));;
m_widgetLabelFileName->setFill(bvec2(true,false));;
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
@@ -279,6 +279,7 @@ MainWindows::MainWindows(void) {
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiReloadShader);
registerMultiCast(appl::MsgNameGuiChangeColor);
registerMultiCast(appl::MsgSelectNewFile);
}
@@ -350,11 +351,23 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
if (_msg.getMessage() == ednMsgGuiNew) {
if (m_bufferManager == NULL) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
if (_msg.getMessage() == appl::MsgSelectNewFile) {
// select a new Buffer ==> change title:
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) {
setTitle("Edn");
if (m_widgetLabelFileName != NULL) {
m_widgetLabelFileName->setLabel("");
}
} else {
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + tmpp->getFileName());
if (m_widgetLabelFileName != NULL) {
m_widgetLabelFileName->setLabel(tmpp->getFileName() + (tmpp->isModify()==true?" *":""));
}
}
} else if (_msg.getMessage() == ednMsgGuiNew) {
(void)m_bufferManager->createNewBuffer();
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.getData());

View File

@@ -696,7 +696,7 @@ void appl::TextViewer::updateScrolling(void) {
m_originScrooled.setY(realCursorPosition.y()-m_size.y()+lineSize*2.0f);
}
m_originScrooled.setMax(vec2(0,0));
// TODO : Limit min position too ...
}
bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
@@ -790,6 +790,7 @@ void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
case moveLetter:
it = m_buffer->cursor();
++it;
APPL_ERROR("Cursor position : " << (esize_t)it);
moveCursor(it);
break;
case moveWord:
@@ -813,6 +814,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
case moveLetter:
it = m_buffer->cursor();;
--it;
APPL_ERROR("Cursor position : " << (esize_t)it);
moveCursor(it);
break;
case moveWord:
@@ -820,7 +822,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
break;
case moveEnd:
it = m_buffer->getStartLine(m_buffer->cursor());
moveCursor(++it);
moveCursor(it);
break;
}
}
@@ -838,12 +840,11 @@ void appl::TextViewer::moveCursorUp(esize_t _nbLine) {
}
// Decide what column to move to, if there's a preferred column use that
if (m_buffer->getFavoriteUpDownPos() < 0) {
// TODO : Remove this +1 !!!
m_buffer->setFavoriteUpDownPos(getScreenSize(lineStartPos+1, m_buffer->cursor()));
m_buffer->setFavoriteUpDownPos(getScreenSize(lineStartPos, m_buffer->cursor()));
}
EWOL_DEBUG("move_up : " << m_buffer->getFavoriteUpDownPos());
// get the previous line
appl::Buffer::Iterator prevLineStartPos = m_buffer->countBackwardNLines(lineStartPos, _nbLine);
appl::Buffer::Iterator prevLineStartPos = m_buffer->countBackwardNLines(lineStartPos-1, _nbLine);
//APPL_INFO("Move line UP result : prevLineStartPos=" << prevLineStartPos);
// get the display char position
appl::Buffer::Iterator newPos = getPosSize(prevLineStartPos, m_buffer->getFavoriteUpDownPos());
@@ -866,8 +867,7 @@ void appl::TextViewer::moveCursorDown(esize_t _nbLine) {
appl::Buffer::Iterator lineStartPos = m_buffer->getStartLine(m_buffer->cursor());
if (m_buffer->getFavoriteUpDownPos() < 0) {
// TODO : Remove this +1 !!!
m_buffer->setFavoriteUpDownPos(getScreenSize(lineStartPos+1, m_buffer->cursor()));
m_buffer->setFavoriteUpDownPos(getScreenSize(lineStartPos, m_buffer->cursor()));
}
EWOL_DEBUG("move down : " << m_buffer->getFavoriteUpDownPos());
// get the next line :