better buffer display and select the good folder in the open file

This commit is contained in:
Edouard Dupin 2012-04-29 15:19:36 +02:00
parent a0f3beba5c
commit 21b786f920
3 changed files with 11 additions and 6 deletions

View File

@ -293,7 +293,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
int32_t letterWidth = ewol::GetWidth(fontId, "A");
int32_t letterHeight = ewol::GetHeight(fontId);
int32_t displayStartLineId = offsetY / letterHeight;
int32_t displayStartLineId = offsetY / letterHeight - 1;
displayStartLineId = etk_max(0, displayStartLineId);
uint32_t y = - offsetY + displayStartLineId*letterHeight;
// update the display position with the scroll ofset :
int32_t displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId);
@ -311,7 +313,6 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
colorInformation_ts * HLColor = NULL;
uint32_t y = 0;
int32_t iii, new_i;
// Get color :
Colorize * myColor = ColorizeManager::Get("normal");

View File

@ -156,9 +156,7 @@ void CodeView::OnRegenerateDisplay(void)
m_OObjectTextBoldItalic[m_currentCreateId].Clear();
m_OObjectsColored[ m_currentCreateId].Clear();
APPL_WARNING("plop");
if (true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) {
APPL_WARNING("ploppppppp");
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);

View File

@ -68,7 +68,7 @@ MainWindows::MainWindows(void)
myMenu = new ewol::Menu();
mySizerHori->SubWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->AddTitle("File");
(void)myMenu->Add(idMenuFile, "New", "iconEdn.bmp", ednMsgGuiNew);
(void)myMenu->Add(idMenuFile, "New", "", ednMsgGuiNew);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuFile, "Open", "icon/Load.svg", ednMsgGuiOpen);
(void)myMenu->Add(idMenuFile, "Close", "icon/Close.svg", ednMsgGuiClose, "current");
@ -214,7 +214,13 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
tmpWidget->SetTitle("Open Files ...");
tmpWidget->SetValidateLabel("Open");
// TODO : Set the good folder ...
Buffer * myBuffer = BufferManager::Get(BufferManager::GetSelected());
if (NULL!=myBuffer) {
etk::File tmpFile = myBuffer->GetFileName();
tmpWidget->SetFolder(tmpFile.GetFolder());
} else {
// nothing to do : just open the basic folder
}
//tmpWidget->SetFolder("/");
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);