Better display

This commit is contained in:
Edouard Dupin 2012-02-19 15:48:08 +01:00
parent f716055c40
commit a4d314723d
8 changed files with 27 additions and 27 deletions

View File

@ -1,9 +1,11 @@
# action a faire (ordonner par révision) : # action a faire (ordonner par révision) :
dans la liste des truc important a refaire dans la liste des truc important a refaire
l'annalyseur d'expression regulière pour le display, le faire ligne par ligne retirer tout les singleton ==> passer par des namespace ==> fonctionnera mieux ...
ne pas regénéré l'affichage des widget quand les taille change finir de netoyer la classe widget
mettre en place le positionnement des élément par matrice ... ==> gain de temps en repaint... netoyer les classe text ...
mettre en pla ce le repositionnement automatique quand on change de buffer
Curseur au bon endroit

View File

@ -264,18 +264,21 @@ void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObjec
#define CURSOR_WIDTH (5) #define CURSOR_WIDTH (5)
#define CURSOR_THICKNESS (1.2) #define CURSOR_THICKNESS (1.2)
void BufferText::CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth) void BufferText::CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip)
{ {
color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR); color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
OOColored->SetColor(tmpppppp); OOColored->SetColor(tmpppppp);
if (true == ewol::IsSetInsert()) { if (true == ewol::IsSetInsert()) {
OOColored->Rectangle( x, y, letterWidth, letterHeight); OOColored->Rectangle( x, y, letterWidth, letterHeight, clip);
} else { } else {
// TODO : Clipping
if (x >= clip.x) {
OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y) , (int32_t)(x+CURSOR_WIDTH), (int32_t)(y) , CURSOR_THICKNESS); OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y) , (int32_t)(x+CURSOR_WIDTH), (int32_t)(y) , CURSOR_THICKNESS);
OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), (int32_t)(x+CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS); OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), (int32_t)(x+CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS);
OOColored->Line( (int32_t)(x) , (int32_t)(y) , (int32_t)(x) , (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS); OOColored->Line( (int32_t)(x) , (int32_t)(y) , (int32_t)(x) , (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS);
} }
} }
}
/** /**
@ -495,7 +498,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
// display cursor : // display cursor :
if (m_cursorPos == iii) { if (m_cursorPos == iii) {
// display the cursor: // display the cursor:
CursorDisplay(&OOColored, pixelX, y, letterHeight, letterWidth); CursorDisplay(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth, drawClippingTextArea);
} }
pixelX += drawSize; pixelX += drawSize;
// move to next line ... // move to next line ...
@ -510,7 +513,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
} }
// special case : the cursor is at the end of the buffer... // special case : the cursor is at the end of the buffer...
if (m_cursorPos == iii) { if (m_cursorPos == iii) {
CursorDisplay(&OOColored, pixelX, y, letterHeight, letterWidth); CursorDisplay(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth, drawClippingTextArea);
} }
int64_t stopTime2 = GetCurrentTime(); int64_t stopTime2 = GetCurrentTime();
@ -726,6 +729,7 @@ void BufferText::SelectNone(void)
* @return --- * @return ---
* *
*/ */
// TODO : Deprecated...
void BufferText::ScrollDown(void) void BufferText::ScrollDown(void)
{ {
MoveUpDown(3); MoveUpDown(3);
@ -740,6 +744,7 @@ void BufferText::ScrollDown(void)
* @return --- * @return ---
* *
*/ */
// TODO : Deprecated...
void BufferText::ScrollUp(void) void BufferText::ScrollUp(void)
{ {
MoveUpDown(-3); MoveUpDown(-3);

View File

@ -120,7 +120,7 @@ class BufferText : public Buffer {
void MoveUpDown(int32_t ofset); void MoveUpDown(int32_t ofset);
void DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY); void DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY);
void CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth); void CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip);
}; };

View File

@ -141,7 +141,7 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y) bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y)
{ {
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) { if (1 == IdInput && typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
EDN_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw ); EDN_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1); int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
if ( 0 <= selectBuf) { if ( 0 <= selectBuf) {

View File

@ -90,19 +90,15 @@ void CodeView::CalculateMaxSize(void)
int32_t letterHeight = ewol::GetHeight(m_fontNormal); int32_t letterHeight = ewol::GetHeight(m_fontNormal);
m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight; m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight;
} }
// TODO : remove this from here ...
#include <ewol/importgl.h>
bool CodeView::OnDraw(void) bool CodeView::OnDraw(void)
{ {
//glLoadIdentity();
glTranslatef(m_origin.x,m_origin.y, 0);
m_OObjectsColored[ m_currentDrawId].Draw(); m_OObjectsColored[ m_currentDrawId].Draw();
m_OObjectTextNormal[ m_currentDrawId].Draw(); m_OObjectTextNormal[ m_currentDrawId].Draw();
m_OObjectTextBold[ m_currentDrawId].Draw(); m_OObjectTextBold[ m_currentDrawId].Draw();
m_OObjectTextItalic[ m_currentDrawId].Draw(); m_OObjectTextItalic[ m_currentDrawId].Draw();
m_OObjectTextBoldItalic[m_currentDrawId].Draw(); m_OObjectTextBoldItalic[m_currentDrawId].Draw();
glTranslatef(-m_origin.x,-m_origin.y, 0);
return true; return true;
} }
@ -174,8 +170,6 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
// nothing to do ... done on upper widet ... // nothing to do ... done on upper widet ...
return true; return true;
} }
x -= m_origin.x;
y -= m_origin.y;
if (1 == IdInput) { if (1 == IdInput) {
#ifndef __MODE__Touch #ifndef __MODE__Touch
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {

View File

@ -35,7 +35,6 @@
#include <ewol/widget/CheckBox.h> #include <ewol/widget/CheckBox.h>
#include <ewol/widget/SizerHori.h> #include <ewol/widget/SizerHori.h>
#include <ewol/widget/SizerVert.h> #include <ewol/widget/SizerVert.h>
#include <ewol/widget/Test.h>
#include <ewol/widget/Label.h> #include <ewol/widget/Label.h>
#include <ewol/widget/Entry.h> #include <ewol/widget/Entry.h>
#include <ewol/widget/List.h> #include <ewol/widget/List.h>
@ -174,7 +173,7 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
} }
} else if (generateEventId == ednEventPopUpFileSelected) { } else if (generateEventId == ednEventPopUpFileSelected) {
// get widget: // get widget:
ewol::FileChooser * tmpWidget = reinterpret_cast<ewol::FileChooser*>(ewol::widgetManager::Get(widgetID)); ewol::FileChooser * tmpWidget = dynamic_cast<ewol::FileChooser*>(ewol::widgetManager::Get(widgetID));
if (NULL == tmpWidget) { if (NULL == tmpWidget) {
EDN_ERROR("impossible to get pop_upWidget " << widgetID); EDN_ERROR("impossible to get pop_upWidget " << widgetID);
return false; return false;
@ -219,7 +218,7 @@ bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEve
} }
} else if (generateEventId == ednEventPopUpFileSaveAs) { } else if (generateEventId == ednEventPopUpFileSaveAs) {
// get widget: // get widget:
ewol::FileChooser * tmpWidget = reinterpret_cast<ewol::FileChooser*>(ewol::widgetManager::Get(widgetID)); ewol::FileChooser * tmpWidget = dynamic_cast<ewol::FileChooser*>(ewol::widgetManager::Get(widgetID));
if (NULL == tmpWidget) { if (NULL == tmpWidget) {
EDN_ERROR("impossible to get pop_upWidget " << widgetID); EDN_ERROR("impossible to get pop_upWidget " << widgetID);
return false; return false;

View File

@ -277,7 +277,7 @@ void Search::OnButtonReplaceAndNext(GtkWidget *widget, gpointer data)
void Search::OnButtonQuit(GtkWidget *widget, gpointer data) void Search::OnButtonQuit(GtkWidget *widget, gpointer data)
{ {
//EDN_INFO("CALLBACK"); //EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data); Search * self = dynamic_cast<Search*>(data);
self->Destroy(); self->Destroy();
} }
@ -304,7 +304,7 @@ void Search::OnCheckBoxEventCase(GtkWidget *widget, gpointer data)
void Search::OnCheckBoxEventRegExp(GtkWidget *widget, gpointer data) void Search::OnCheckBoxEventRegExp(GtkWidget *widget, gpointer data)
{ {
//EDN_INFO("CALLBACK"); //EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data); Search * self = dynamic_cast<Search*>(data);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
SearchData::SetRegExp(true); SearchData::SetRegExp(true);
gtk_widget_set_sensitive(self->m_CkMatchCase, false); gtk_widget_set_sensitive(self->m_CkMatchCase, false);
@ -317,7 +317,7 @@ void Search::OnCheckBoxEventRegExp(GtkWidget *widget, gpointer data)
void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data) void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
{ {
//EDN_INFO("CALLBACK"); //EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data); Search * self = dynamic_cast<Search*>(data);
// update research data // update research data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget)); const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) { if (NULL != testData) {
@ -343,7 +343,7 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data) void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
{ {
//EDN_INFO("CALLBACK"); //EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data); Search * self = dynamic_cast<Search*>(data);
// update replace data // update replace data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget)); const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) { if (NULL != testData) {

View File

@ -203,7 +203,7 @@ void CTagsManager::cb_row(GtkTreeView *p_treeview,
gpointer data) gpointer data)
{ {
EDN_DEBUG("event"); EDN_DEBUG("event");
CTagsManager * self = reinterpret_cast<CTagsManager*>(data); CTagsManager * self = dynamic_cast<CTagsManager*>(data);
gchar * p_file=NULL; gchar * p_file=NULL;
gint lineNumber; gint lineNumber;