[DEV] first good vertion from many time...
This commit is contained in:
@@ -40,6 +40,7 @@ static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
|
||||
}
|
||||
|
||||
BufferView::BufferView(void) {
|
||||
addObjectType("appl::BufferView");
|
||||
setCanHaveFocus(true);
|
||||
registerMultiCast(ednMsgBufferListChange);
|
||||
registerMultiCast(ednMsgBufferState);
|
||||
|
@@ -121,6 +121,7 @@ const char* l_smoothMax = "tmpEvent_maxChange";
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
MainWindows::MainWindows(void) {
|
||||
addObjectType("appl::MainWindows");
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
widget::Sizer * mySizerVert = NULL;
|
||||
widget::Sizer * mySizerVert2 = NULL;
|
||||
@@ -232,12 +233,8 @@ MainWindows::MainWindows(void) {
|
||||
(void)myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
|
||||
(void)myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
|
||||
int32_t idMenugDisplay = myMenu->addTitle("Display");
|
||||
(void)myMenu->add(idMenugDisplay, "Charset UTF-8", "", ednMsgGuiChangeCharset, "UTF-8");
|
||||
(void)myMenu->add(idMenugDisplay, "Charset ISO-8859-1", "", ednMsgGuiChangeCharset, "ISO-8859-1");
|
||||
(void)myMenu->add(idMenugDisplay, "Charset ISO-8859-15", "", ednMsgGuiChangeCharset, "ISO-8859-15");
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenugDisplay, "Color Black", "", ednMsgGuiChangeColor, "Black");
|
||||
(void)myMenu->add(idMenugDisplay, "Color White", "", ednMsgGuiChangeColor, "White");
|
||||
(void)myMenu->add(idMenugDisplay, "Color Black", "", appl::MsgNameGuiChangeColor, "colorBlack/");
|
||||
(void)myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "colorWhite/");
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
|
||||
|
||||
@@ -281,6 +278,7 @@ MainWindows::MainWindows(void) {
|
||||
registerMultiCast(ednMsgBufferState);
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(ednMsgGuiReloadShader);
|
||||
registerMultiCast(appl::MsgNameGuiChangeColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -337,6 +335,10 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||
tmpSubWidget = new ParameterAboutGui();
|
||||
tmpWidget->menuAdd("About", "", tmpSubWidget);
|
||||
}
|
||||
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
|
||||
etk::theme::setName("COLOR", _msg.getData());
|
||||
ewol::getContext().getResourcesManager().reLoadResources();
|
||||
ewol::getContext().forceRedrawAll();
|
||||
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
|
||||
ewol::getContext().getResourcesManager().reLoadResources();
|
||||
ewol::getContext().forceRedrawAll();
|
||||
|
@@ -35,6 +35,7 @@ Search::Search(void) :
|
||||
widget::Sizer(widget::Sizer::modeHori),
|
||||
m_searchEntry(NULL),
|
||||
m_replaceEntry(NULL) {
|
||||
addObjectType("appl::Search");
|
||||
m_forward = false;
|
||||
// TODO : change the mode of creating interface :
|
||||
/*
|
||||
|
@@ -17,6 +17,7 @@ extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-
|
||||
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||
|
||||
appl::TagFileList::TagFileList(void) {
|
||||
addObjectType("appl::TagFileList");
|
||||
m_selectedLine = -1;
|
||||
addEventId(applEventCtagsListSelect);
|
||||
addEventId(applEventCtagsListValidate);
|
||||
|
@@ -30,8 +30,8 @@ extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
||||
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||
|
||||
|
||||
appl::TagFileSelection::TagFileSelection(void)
|
||||
{
|
||||
appl::TagFileSelection::TagFileSelection(void) {
|
||||
addObjectType("appl::TagFileSelection");
|
||||
addEventId(applEventctagsSelection);
|
||||
addEventId(applEventctagsCancel);
|
||||
|
||||
|
@@ -21,15 +21,23 @@
|
||||
#undef __class__
|
||||
#define __class__ "TextViewer"
|
||||
|
||||
#define tic() \
|
||||
int64_t startTime = ewol::getTime();
|
||||
|
||||
#define toc(comment) \
|
||||
int64_t endTime = ewol::getTime(); \
|
||||
int64_t processTimeLocal = (endTime - startTime); \
|
||||
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
|
||||
|
||||
appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
||||
m_buffer(NULL),
|
||||
m_displayText(_fontName, _fontSize),
|
||||
m_insertMode(false) {
|
||||
addObjectType("appl::TextViewer");
|
||||
setCanHaveFocus(true);
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(ednMsgGuiRm);
|
||||
registerMultiCast(ednMsgGuiSelect);
|
||||
registerMultiCast(ednMsgGuiChangeCharset);
|
||||
registerMultiCast(ednMsgGuiFind);
|
||||
registerMultiCast(ednMsgGuiReplace);
|
||||
registerMultiCast(ednMsgGuiGotoLine);
|
||||
@@ -95,6 +103,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
||||
if (false == needRedraw()) {
|
||||
return;
|
||||
}
|
||||
//tic();
|
||||
// For the scrooling windows
|
||||
m_displayDrawing.clear();
|
||||
m_displayText.clear();
|
||||
@@ -188,7 +197,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
||||
iii<nbLine;
|
||||
++iii) {
|
||||
char tmpLineNumber[50];
|
||||
sprintf(tmpLineNumber, "%*d", nbChar, iii);
|
||||
sprintf(tmpLineNumber, "%*d", nbChar, iii+1);
|
||||
m_displayText.print(tmpLineNumber);
|
||||
m_displayText.forceLineReturn();
|
||||
if (m_displayText.getPos().y() < -20.0f ) {
|
||||
@@ -282,7 +291,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
||||
m_maxSize.setX(maxSizeX+m_originScrooled.x());
|
||||
m_maxSize.setY((float)nbLines*tmpLetterSize.y());
|
||||
}
|
||||
|
||||
//toc("Display time : ");
|
||||
// call the herited class...
|
||||
WidgetScrooled::onRegenerateDisplay();
|
||||
}
|
||||
@@ -350,6 +359,8 @@ bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event) {
|
||||
// move events ...
|
||||
if (_event.getStatus() == ewol::keyEvent::statusDown) {
|
||||
bool needUpdatePosition = true;
|
||||
// selection when shift is set:
|
||||
m_buffer->setSelectMode(_event.getSpecialKey().isSetShift());
|
||||
// check selection event ...
|
||||
switch(_event.getType()) {
|
||||
case ewol::keyEvent::keyboardLeft:
|
||||
@@ -370,11 +381,11 @@ bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event) {
|
||||
break;
|
||||
case ewol::keyEvent::keyboardPageUp:
|
||||
//APPL_INFO("keyEvent : <PAGE-UP>");
|
||||
//TextDMoveUp(m_displaySize.y());
|
||||
moveCursorUp(15); // TODO : Set the real number of line ...
|
||||
break;
|
||||
case ewol::keyEvent::keyboardPageDown:
|
||||
//APPL_INFO("keyEvent : <PAGE-DOWN>");
|
||||
//TextDMoveDown(m_displaySize.y());
|
||||
moveCursorDown(15); // TODO : Set the real number of line ...
|
||||
break;
|
||||
case ewol::keyEvent::keyboardStart:
|
||||
//APPL_INFO("keyEvent : <Start of line>");
|
||||
@@ -396,6 +407,7 @@ bool appl::TextViewer::onEventInput(const ewol::EventInput& _event) {
|
||||
if (_event.getId() != 0) {
|
||||
keepFocus();
|
||||
}
|
||||
//tic();
|
||||
if (m_buffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -431,17 +443,23 @@ bool appl::TextViewer::onEventInput(const ewol::EventInput& _event) {
|
||||
// mouse selection :
|
||||
if (_event.getType() == ewol::keyEvent::typeMouse) {
|
||||
if (_event.getStatus() == ewol::keyEvent::statusDown) {
|
||||
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
|
||||
moveCursor(newPos);
|
||||
m_buffer->setSelectMode(true);
|
||||
markToRedraw();
|
||||
return true;
|
||||
//if (_event.getSpecialKey().isSetShift() == false) {
|
||||
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
|
||||
moveCursor(newPos);
|
||||
m_buffer->setSelectMode(true);
|
||||
markToRedraw();
|
||||
return true;
|
||||
//}
|
||||
} else if (_event.getStatus() == ewol::keyEvent::statusUp) {
|
||||
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
|
||||
moveCursor(newPos);
|
||||
m_buffer->setSelectMode(false);
|
||||
// TODO : Copy selection :
|
||||
//tmpBuffer->Copy(ewol::clipBoard::clipboardSelection);
|
||||
// Copy selection :
|
||||
std::string value;
|
||||
m_buffer->copy(value);
|
||||
if (value.size() != 0) {
|
||||
ewol::clipBoard::set(ewol::clipBoard::clipboardSelection, value);
|
||||
}
|
||||
markToRedraw();
|
||||
return true;
|
||||
}
|
||||
@@ -518,7 +536,10 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
|
||||
m_displayText.forceLineReturn();
|
||||
countColomn = 0;
|
||||
} else {
|
||||
m_displayText.print(stringToDisplay[kkk]);
|
||||
//note : Without this condithion the time od selection change to 0.6 ms to 8ms ...
|
||||
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
||||
m_displayText.print(stringToDisplay[kkk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
||||
@@ -548,7 +569,7 @@ void appl::TextViewer::onEventClipboard(enum ewol::clipBoard::clipboardListe _cl
|
||||
|
||||
void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||
widget::WidgetScrooled::onReceiveMessage(_msg);
|
||||
//APPL_DEBUG("receive msg: " << _msg);
|
||||
APPL_VERBOSE("receive msg: " << _msg);
|
||||
// First call plugin
|
||||
if (appl::textPluginManager::onReceiveMessage(*this, _msg) == true) {
|
||||
markToRedraw();
|
||||
@@ -614,15 +635,46 @@ void appl::TextViewer::setFontName(const std::string& _fontName) {
|
||||
m_displayText.setFontName(_fontName);
|
||||
}
|
||||
|
||||
void appl::TextViewer::updateScrolling(void) {
|
||||
if (m_buffer == NULL) {
|
||||
return;
|
||||
}
|
||||
vec2 realCursorPosition(0,0);
|
||||
uint32_t lineId = m_buffer->getCursorLinesId();
|
||||
m_displayText.clear();
|
||||
m_displayText.forceLineReturn();
|
||||
float lineSize = -m_displayText.getPos().y();
|
||||
for (size_t iii=0; iii<lineId; ++iii) {
|
||||
m_displayText.forceLineReturn();
|
||||
}
|
||||
realCursorPosition.setY(-m_displayText.getPos().y());
|
||||
realCursorPosition.setX(getScreenSize(m_buffer->getStartLine(m_buffer->cursor())+1, m_buffer->cursor())-10);
|
||||
APPL_VERBOSE("position=" << realCursorPosition << " scrool=" << m_originScrooled << " size" << m_size);
|
||||
if (realCursorPosition.x() < m_originScrooled.x()-lineSize*2.0f) {
|
||||
m_originScrooled.setX(realCursorPosition.x()-lineSize*2.0f);
|
||||
} else if (realCursorPosition.x() > m_originScrooled.x()+m_size.x()-lineSize*2.0f-10) {
|
||||
m_originScrooled.setX(realCursorPosition.x()-m_size.x()+lineSize*2.0f+10);
|
||||
}
|
||||
if (realCursorPosition.y() < m_originScrooled.y()+lineSize*2.0f) {
|
||||
m_originScrooled.setY(realCursorPosition.y()-lineSize*2.0f);
|
||||
} else if (realCursorPosition.y() > m_originScrooled.y()+m_size.y()-lineSize*2.0f) {
|
||||
m_originScrooled.setY(realCursorPosition.y()-m_size.y()+lineSize*2.0f);
|
||||
}
|
||||
realCursorPosition.setMin(vec2(0,0));
|
||||
|
||||
}
|
||||
|
||||
bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
|
||||
if (m_buffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
markToRedraw();
|
||||
if (appl::textPluginManager::onCursorMove(*this, _pos) == true) {
|
||||
updateScrolling();
|
||||
return true;
|
||||
}
|
||||
m_buffer->moveCursor((esize_t)_pos);
|
||||
updateScrolling();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -68,8 +68,11 @@ namespace appl {
|
||||
private:
|
||||
bool m_insertMode; //!< the insert mode is enable
|
||||
public:
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Update the scrolling position from the cursor position,
|
||||
* it might be be all time in the display screen.
|
||||
*/
|
||||
void updateScrolling(void);
|
||||
// TODO : Doc : write data on buffer
|
||||
bool moveCursor(const appl::Buffer::Iterator& _pos);
|
||||
bool write(const std::string& _data);
|
||||
|
@@ -18,6 +18,7 @@ static const char* s_closeDone = "close-done";
|
||||
appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
addObjectType("appl::WorkerCloseAllFile");
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
|
||||
|
@@ -26,6 +26,7 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
m_buffer(NULL),
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
addObjectType("appl::WorkerCloseFile");
|
||||
addEventId(eventCloseDone);
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
|
@@ -18,6 +18,7 @@ static const char* s_saveAsDone = "save-as-done";
|
||||
appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
addObjectType("appl::WorkerSaveAllFile");
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
|
||||
|
@@ -21,6 +21,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
m_bufferName(_bufferName),
|
||||
m_chooser(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
addObjectType("appl::WorkerSaveFile");
|
||||
addEventId(eventSaveDone);
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
|
Reference in New Issue
Block a user