Save the Display position for every buffer opened to restore the position the next time
This commit is contained in:
parent
277045cde4
commit
bbb1ea0a93
@ -56,6 +56,8 @@ CodeView::CodeView(void)
|
||||
m_bufferID = -1;
|
||||
m_buttunOneSelected = false;
|
||||
|
||||
m_lineNumberList.Clear();
|
||||
|
||||
m_textColorFg = etk::color::color_Black;
|
||||
|
||||
m_textColorBg = etk::color::color_Black;
|
||||
@ -77,6 +79,27 @@ CodeView::~CodeView(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if the number of reference buffer is good or not ...
|
||||
* @param[in] bufferID id of the current Buffer that needed to have a reference
|
||||
* @return ---
|
||||
*/
|
||||
void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
|
||||
{
|
||||
coord2D_ts tmpCoord;
|
||||
tmpCoord.x = 0;
|
||||
tmpCoord.y = 0;
|
||||
if (m_lineNumberList.Size()<=bufferID) {
|
||||
// update the number of elements :
|
||||
for (int32_t iii=m_lineNumberList.Size(); iii <= bufferID; iii++) {
|
||||
// add start line at 0 :
|
||||
m_lineNumberList.PushBack(tmpCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check if the object has the specific type.
|
||||
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||
@ -156,7 +179,8 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
m_OObjectTextBoldItalic[m_currentCreateId].Clear();
|
||||
m_OObjectsColored[ m_currentCreateId].Clear();
|
||||
|
||||
if (true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) {
|
||||
|
||||
if(true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) {
|
||||
coord2D_ts borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
|
||||
bool centerRequested = false;
|
||||
coord2D_ts currentPosition = BufferManager::Get(m_bufferID)->GetPosition(m_OObjectTextNormal[m_currentCreateId].GetFontID(), centerRequested);
|
||||
@ -292,11 +316,23 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
APPL_DEBUG("Extern Event : " << CallerObject << " type : " << eventId << " data=\"" << data << "\"");
|
||||
|
||||
if(eventId == ednMsgBufferId) {
|
||||
//keep the reference of the display offset :
|
||||
if( m_bufferID >=0
|
||||
&& m_bufferID < m_lineNumberList.Size()) {
|
||||
m_lineNumberList[m_bufferID] = m_originScrooled;
|
||||
}
|
||||
int32_t bufferID = 0;
|
||||
sscanf(data.Utf8Data(), "%d", &bufferID);
|
||||
APPL_INFO("Select a new Buffer ... " << bufferID);
|
||||
// set the new buffer ID
|
||||
m_bufferID = bufferID;
|
||||
// TODO : need to update the state of the file and the filenames ...
|
||||
// update the start display position...
|
||||
UpdateNumberOfLineReference(m_bufferID);
|
||||
// set back if needed the display position ...
|
||||
if( m_bufferID >=0
|
||||
&& m_bufferID < m_lineNumberList.Size()) {
|
||||
m_originScrooled = m_lineNumberList[m_bufferID];
|
||||
}
|
||||
} else if (eventId == ednMsgGuiCopy) {
|
||||
BufferManager::Get(m_bufferID)->Copy(ewol::clipBoard::CLIPBOARD_STD);
|
||||
} else if (eventId == ednMsgGuiCut) {
|
||||
|
@ -63,6 +63,8 @@ class CodeView :public ewol::WidgetScrooled
|
||||
color_ts m_textColorBg; //!< Background color
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
etk::VectorType<coord2D_ts> m_lineNumberList;
|
||||
void UpdateNumberOfLineReference(int32_t bufferID);
|
||||
// drawing elements :
|
||||
ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER];
|
||||
|
@ -51,15 +51,15 @@ void APP_Init(void)
|
||||
{
|
||||
#ifdef __PLATFORM__Linux
|
||||
#ifdef MODE_RELEASE
|
||||
APPL_CRITICAL("==> Init "PROJECT_NAME" (START) (Linux) (Release)");
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Release)");
|
||||
#else
|
||||
APPL_CRITICAL("==> Init "PROJECT_NAME" (START) (Linux) (Debug)");
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Debug)");
|
||||
#endif
|
||||
#else
|
||||
#ifdef MODE_RELEASE
|
||||
APPL_CRITICAL("==> Init "PROJECT_NAME" (START) (Android) (Release)");
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Release)");
|
||||
#else
|
||||
APPL_CRITICAL("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
|
||||
#endif
|
||||
#endif
|
||||
ewol::ChangeSize(800, 600);
|
||||
|
Loading…
x
Reference in New Issue
Block a user