Starting integration of the main display in EWOL system
This commit is contained in:
@@ -146,7 +146,7 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
int32_t Buffer::Display(DrawerManager &drawer)
|
||||
int32_t Buffer::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
||||
{
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <etk/File.h>
|
||||
#include <Display.h>
|
||||
#include <charset.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
|
||||
typedef struct{
|
||||
@@ -82,7 +82,7 @@ class Buffer {
|
||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||
virtual void SetLineDisplay(uint32_t lineNumber);
|
||||
|
||||
virtual int32_t Display(DrawerManager &drawer);
|
||||
virtual int32_t Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
||||
virtual void ForceReDraw(bool allElement);
|
||||
virtual void AddChar(char * UTF8data);
|
||||
virtual void cursorMove(int32_t gtkKey);
|
||||
|
@@ -67,30 +67,28 @@ BufferEmpty::~BufferEmpty(void)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
int32_t BufferEmpty::Display(DrawerManager &drawer)
|
||||
int32_t BufferEmpty::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
||||
{
|
||||
|
||||
ColorizeManager * myColorManager = ColorizeManager::getInstance();
|
||||
// Get color :
|
||||
Colorize *myColor = NULL;
|
||||
// Clean Buffer
|
||||
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG) );
|
||||
if (NULL == OOText) {
|
||||
EDN_ERROR("Input VALUE is NULL");
|
||||
return ERR_FAIL;
|
||||
}
|
||||
if (NULL == OOColored) {
|
||||
EDN_ERROR("Input VALUE is NULL");
|
||||
return ERR_FAIL;
|
||||
}
|
||||
OOText->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
|
||||
OOText->TextAdd(20, 50, "No Buffer Availlable to display", sizeX);
|
||||
|
||||
|
||||
color_ts bgColor; //!< Text color
|
||||
bgColor.red = 1.0;
|
||||
bgColor.green = 1.0;
|
||||
bgColor.blue = 1.0;
|
||||
bgColor.alpha = 1.0;
|
||||
OOColored->SetColor(bgColor);
|
||||
OOColored->Rectangle( 0, 0, sizeX, sizeY);
|
||||
|
||||
myColor = myColorManager->Get("normal");
|
||||
// Draw the 2 comments Lines :
|
||||
drawer.Text(myColor, 20,20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique");
|
||||
//drawer.Flush();
|
||||
myColor = myColorManager->Get("commentDoxygen");
|
||||
drawer.Text(myColor, 20,25 + Display::GetFontHeight(), "No Buffer Availlable to display");
|
||||
drawer.Flush();
|
||||
/*
|
||||
myColor = myColorManager->Get(("SelectedText"));
|
||||
drawer.Cursor(20, 50);
|
||||
drawer.EndOfLine(20, 70);
|
||||
drawer.Tabulation(myColor, 20, 90, 5);
|
||||
drawer.UTF8UnknownElement(myColor, 20, 120, 3, false);
|
||||
drawer.Flush();
|
||||
*/
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ class BufferEmpty : public Buffer {
|
||||
public:
|
||||
BufferEmpty(void);
|
||||
virtual ~BufferEmpty(void);
|
||||
virtual int32_t Display(DrawerManager &drawer);
|
||||
int32_t Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
||||
|
||||
};
|
||||
|
||||
|
@@ -30,6 +30,12 @@
|
||||
#include <toolsMemory.h>
|
||||
#include <etk/RegExp.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/OObject.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/Widget.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "BufferText"
|
||||
|
||||
@@ -274,25 +280,27 @@ void BufferText::UpdatePointerNumber(void)
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
int32_t BufferText::Display(DrawerManager &drawer)
|
||||
int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
||||
{
|
||||
int32_t letterHeight = Display::GetFontHeight();
|
||||
int32_t letterWidth = Display::GetFontWidth();
|
||||
// update the number of element that can be displayed
|
||||
m_displaySize.x = (drawer.GetWidth()/letterWidth) + 1 - nbColoneForLineNumber;;
|
||||
m_displaySize.y = (drawer.GetHeight()/letterHeight) + 1;
|
||||
EDN_INFO("main DIPLAY " << m_displaySize.x << " char * " << m_displaySize.y << " char");
|
||||
|
||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||
bool selIsRect;
|
||||
int32_t selHave = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, selStart, selEnd, selIsRect, selRectStart, selRectEnd);
|
||||
int32_t selHave;
|
||||
|
||||
int32_t fontId = ewol::GetDefaultFontId();
|
||||
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||
|
||||
// update the number of element that can be displayed
|
||||
m_displaySize.x = (sizeX/letterWidth) + 1 - nbColoneForLineNumber;
|
||||
m_displaySize.y = (sizeY/letterHeight) + 1;
|
||||
EDN_INFO("main DIPLAY " << m_displaySize.x << " char * " << m_displaySize.y << " char");
|
||||
|
||||
selHave = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, selStart, selEnd, selIsRect, selRectStart, selRectEnd);
|
||||
|
||||
colorInformation_ts * HLColor = NULL;
|
||||
|
||||
//displayLineNumber(drawer);
|
||||
// get the number of line in the buffer
|
||||
int32_t maxNumberLine = m_EdnBuf.NumberOfLines();
|
||||
//int32_t maxNumberLine = 2096;
|
||||
char *myPrint = NULL;
|
||||
if (10 > maxNumberLine) { nbColoneForLineNumber = 1; myPrint = (char *)"%1d";
|
||||
} else if (100 > maxNumberLine) { nbColoneForLineNumber = 2; myPrint = (char *)"%2d";
|
||||
@@ -316,21 +324,27 @@ int32_t BufferText::Display(DrawerManager &drawer)
|
||||
Colorize * selectColor = NULL;
|
||||
char displayChar[MAX_EXP_CHAR_LEN];
|
||||
memset(displayChar, 0, sizeof(char)*MAX_EXP_CHAR_LEN);
|
||||
|
||||
|
||||
|
||||
int mylen = m_EdnBuf.Size();
|
||||
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
|
||||
uint32_t xx = 0;
|
||||
int32_t idX = 0;
|
||||
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG));
|
||||
|
||||
color_ts bgColor; //!< Text color
|
||||
color_ts & tmpppppp = myColorManager->Get(COLOR_CODE_BASIC_BG);
|
||||
OOColored->SetColor(tmpppppp);
|
||||
OOColored->Rectangle( 0, 0, sizeX, sizeY);
|
||||
|
||||
int displayLines = 0;
|
||||
// Regenerate the colorizing if necessary ...
|
||||
m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y);
|
||||
//GTimeVal timeStart;
|
||||
//g_get_current_time(&timeStart);
|
||||
|
||||
|
||||
// draw the lineNumber :
|
||||
int32_t currentLineID = m_displayStart.y+1;
|
||||
|
||||
#if 0
|
||||
DrawLineNumber(drawer, myPrint, currentLineID, y);
|
||||
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
||||
//EDN_INFO("diplay element=" << iii);
|
||||
@@ -452,7 +466,7 @@ int32_t BufferText::Display(DrawerManager &drawer)
|
||||
//GTimeVal timeStop;
|
||||
//g_get_current_time(&timeStop);
|
||||
//EDN_DEBUG("Display Generation = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
|
||||
|
||||
#endif
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ class BufferText : public Buffer {
|
||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||
void SetLineDisplay(uint32_t lineNumber);
|
||||
|
||||
int32_t Display(DrawerManager &drawer);
|
||||
int32_t Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
||||
void ForceReDraw(bool allElement);
|
||||
void AddChar(char * UTF8data);
|
||||
void cursorMove(int32_t gtkKey);
|
||||
|
@@ -36,6 +36,149 @@
|
||||
#include <SearchData.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Button"
|
||||
|
||||
|
||||
CodeView::CodeView(void)
|
||||
{
|
||||
m_label = "CodeView is disable ...";
|
||||
m_bufferID = -1;
|
||||
m_buttunOneSelected = false;
|
||||
|
||||
// Init link with the buffer Manager
|
||||
m_bufferManager = BufferManager::getInstance();
|
||||
m_colorManager = ColorizeManager::getInstance();
|
||||
|
||||
m_textColorFg.red = 0.0;
|
||||
m_textColorFg.green = 0.0;
|
||||
m_textColorFg.blue = 0.0;
|
||||
m_textColorFg.alpha = 1.0;
|
||||
|
||||
m_textColorBg.red = 0.0;
|
||||
m_textColorBg.green = 0.0;
|
||||
m_textColorBg.blue = 0.0;
|
||||
m_textColorBg.alpha = 0.25;
|
||||
SetCanHaveFocus(true);
|
||||
}
|
||||
|
||||
CodeView::~CodeView(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CodeView::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = 50;
|
||||
m_minSize.y = 50;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CodeView::OnRegenerateDisplay(void)
|
||||
{
|
||||
// create tmp object :
|
||||
ewol::OObject2DText* myOObjectText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
|
||||
|
||||
// generate the objects :
|
||||
m_bufferManager->Get(m_bufferID)->Display(myOObjectText, myOObjectsColored, m_size.x, m_size.y);
|
||||
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
// add generated element
|
||||
AddOObject(myOObjectsColored, "CodeViewBackground");
|
||||
AddOObject(myOObjectText, "CodeViewText");
|
||||
|
||||
|
||||
/*
|
||||
// TODO later : Add this in the basic element of the widget ...
|
||||
int32_t borderSize = 2;
|
||||
int32_t paddingSize = 3;
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = (m_size.x - tmpSizeX) / 2;
|
||||
int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2;
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = (m_size.x - tmpSizeX) / 2 + borderSize + 2*paddingSize;
|
||||
int32_t tmpTextOriginY = (m_size.y - tmpSizeY) / 2 + borderSize + 2*paddingSize;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpSizeX = m_size.x;
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
tmpOriginX += paddingSize;
|
||||
tmpOriginY += paddingSize;
|
||||
tmpSizeX -= 2*paddingSize;
|
||||
tmpSizeY -= 2*paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
//int32_t fontId = GetDefaultFontId();
|
||||
//int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_label.c_str(), m_size.x - borderSize - 2*paddingSize);
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, borderSize);
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
AddOObject(tmpText, "BouttonText");
|
||||
*/
|
||||
}
|
||||
|
||||
bool CodeView::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
/*
|
||||
//bool eventIsOK = false;
|
||||
//EWOL_DEBUG("Receive event : \"" << generateEventId << "\"");
|
||||
if(ewolEventButtonPressed == generateEventId) {
|
||||
EWOL_INFO("BT pressed ... " << m_label);
|
||||
//eventIsOK = true;
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
} else if(ewolEventButtonEnter == generateEventId) {
|
||||
OnRegenerateDisplay();
|
||||
}
|
||||
//return eventIsOK;
|
||||
*/
|
||||
// in every case this not stop the propagation of the event
|
||||
return false;
|
||||
// if overwrited... you can ...
|
||||
}
|
||||
|
||||
|
||||
bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
|
||||
{
|
||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||
if( UTF8_data != NULL
|
||||
&& typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||
&& UTF8_data[0] == '\r') {
|
||||
//return OnEventArea(ewolEventButtonPressed, -1, -1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SDFGSDFGSDFG_FGSDFG_SDF_G___DSFG_SD_FG__SD_F_G_SD_FG
|
||||
|
||||
|
||||
CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
|
||||
{
|
||||
m_bufferID = -1;
|
||||
@@ -189,7 +332,6 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
CodeView * self = reinterpret_cast<CodeView*>(data);
|
||||
@@ -420,3 +562,4 @@ gint CodeView::CB_mouseScrollEvent( GtkWidget *widget, GdkEventScroll *event, gp
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@@ -32,6 +32,34 @@
|
||||
#include <Display.h>
|
||||
#include <MsgBroadcast.h>
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Widget.h>
|
||||
|
||||
class CodeView :public ewol::Widget
|
||||
{
|
||||
public:
|
||||
CodeView(void);
|
||||
virtual ~CodeView(void);
|
||||
virtual bool CalculateMinSize(void);
|
||||
private:
|
||||
etk::String m_label;
|
||||
color_ts m_textColorFg; //!< Text color
|
||||
color_ts m_textColorBg; //!< Background color
|
||||
BufferManager * m_bufferManager;
|
||||
ColorizeManager * m_colorManager;
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
//virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
class CodeView : public MsgBroadcast
|
||||
{
|
||||
public:
|
||||
@@ -63,6 +91,9 @@ class CodeView : public MsgBroadcast
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -31,22 +31,94 @@
|
||||
#include <BufferView.h>
|
||||
#include <AccelKey.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Test.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widgetMeta/FileChooser.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
|
||||
|
||||
MainWindows::MainWindows(void)
|
||||
{
|
||||
EDN_DEBUG("CREATE WINDOWS ... ");
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Button * myButton = NULL;
|
||||
ewol::Label * myLabel = NULL;
|
||||
CodeView * myCodeView = NULL;
|
||||
|
||||
mySizerVert = new ewol::SizerVert();
|
||||
SetSubWidget(mySizerVert);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
|
||||
myButton = new ewol::Button("Open");
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
myButton = new ewol::Button("Close");
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
myButton = new ewol::Button("Save");
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
myButton = new ewol::Button("Save As ...");
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
|
||||
myLabel = new ewol::Label("FileName");
|
||||
myLabel->SetExpendX(true);
|
||||
myLabel->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myLabel);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
myCodeView = new CodeView();
|
||||
myCodeView->SetExpendX(true);
|
||||
myCodeView->SetExpendY(true);
|
||||
myCodeView->SetFillX(true);
|
||||
myCodeView->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myCodeView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
MainWindows::~MainWindows(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SDFGSDFGSDF___SDFGSDFG
|
||||
MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
{
|
||||
#if 0
|
||||
m_mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
// select the program icone
|
||||
GError *err = NULL;
|
||||
etk::String iconeFile;
|
||||
#ifdef NDEBUG
|
||||
iconeFile = "/usr/share/edn/images/icone.png";
|
||||
#else
|
||||
iconeFile = "./data/imagesSources/icone.png";
|
||||
#endif
|
||||
|
||||
GdkPixbuf * icone = gdk_pixbuf_new_from_file(iconeFile.c_str(), &err);
|
||||
if (err != NULL) {
|
||||
@@ -54,17 +126,11 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
} else {
|
||||
gtk_window_set_icon(GTK_WINDOW(m_mainWindow), icone);
|
||||
}
|
||||
// Default size open windows
|
||||
gtk_window_set_default_size(GTK_WINDOW(m_mainWindow), 800, 600);
|
||||
|
||||
// enable the close signal of the windows
|
||||
g_signal_connect(G_OBJECT(m_mainWindow), "delete-event", G_CALLBACK(OnQuit), this);
|
||||
g_signal_connect(G_OBJECT(m_mainWindow), "window-state-event", G_CALLBACK(OnStateChange), this);
|
||||
//g_signal_connect(G_OBJECT(m_mainWindow), "destroy", G_CALLBACK(OnQuit), this);
|
||||
|
||||
// remove decoration
|
||||
//gtk_window_set_decorated(GTK_WINDOW(m_mainWindow), FALSE);
|
||||
|
||||
|
||||
// Create a vertical box for stacking the menu and editor widgets in.
|
||||
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(m_mainWindow), vbox);
|
||||
@@ -73,18 +139,11 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_mainWindow));
|
||||
|
||||
// Create the menu bar.
|
||||
#if 0
|
||||
gtk_box_pack_start( GTK_BOX (vbox), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
|
||||
#else
|
||||
GtkWidget *hboxMenu = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start( GTK_BOX (vbox), hboxMenu, FALSE, FALSE, 0);
|
||||
// Add Exit boutton
|
||||
etk::String ExitIconeFile;
|
||||
#ifdef NDEBUG
|
||||
ExitIconeFile = "/usr/share/edn/images/delete-24px.png";
|
||||
#else
|
||||
ExitIconeFile = "./data/imagesSources/delete-24px.png";
|
||||
#endif
|
||||
// TODO : find a good way to change the size of an image
|
||||
GtkWidget *myImageQuit = gtk_image_new_from_file(ExitIconeFile.c_str());
|
||||
GtkIconSize mySize = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
@@ -100,25 +159,10 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
|
||||
// add the real menu bar
|
||||
gtk_box_pack_start( GTK_BOX (hboxMenu), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
|
||||
GdkColor color;
|
||||
GtkStateType tmpppppp = GTK_STATE_NORMAL;
|
||||
//GtkStateType tmpppppp = GTK_STATE_ACTIVE;
|
||||
//GtkStateType tmpppppp = GTK_STATE_PRELIGHT;
|
||||
//GtkStateType tmpppppp = GTK_STATE_SELECTED;
|
||||
//GtkStateType tmpppppp = GTK_STATE_INSENSITIVE;
|
||||
//gdk_color_parse ("green", &color);
|
||||
//gtk_widget_modify_fg(m_MenuBar.GetWidget(), tmpppppp, &color);
|
||||
//gdk_color_parse ("blue", &color);
|
||||
//gtk_widget_modify_bg(m_MenuBar.GetWidget(), tmpppppp, &color);
|
||||
gdk_color_parse ("red", &color);
|
||||
gtk_widget_modify_text(m_MenuBar.GetWidget(), tmpppppp, &color);
|
||||
//gdk_color_parse ("orange", &color);
|
||||
gtk_widget_modify_base(m_MenuBar.GetWidget(), tmpppppp, &color);
|
||||
|
||||
// Add title
|
||||
m_internalTitleLabel = gtk_label_new("Edn");
|
||||
gtk_box_pack_start( GTK_BOX (hboxMenu), m_internalTitleLabel, FALSE, FALSE, 0);
|
||||
#endif
|
||||
// **********************************************************
|
||||
// * Horizontal ELEMENTS : *
|
||||
// **********************************************************
|
||||
@@ -126,9 +170,6 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER (vbox), hbox);
|
||||
// create the toolbar :
|
||||
# if USE_GTK_VERSION_2_0
|
||||
//gtk_box_pack_start(GTK_BOX(hbox), m_ToolBar.GetWidget(), FALSE, FALSE, 0);
|
||||
# endif
|
||||
// TreeView :
|
||||
gtk_box_pack_start(GTK_BOX(hbox), m_BufferView.GetMainWidget(), FALSE, TRUE, 1);
|
||||
|
||||
@@ -140,8 +181,7 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
||||
|
||||
// recursive version of gtk_widget_show
|
||||
gtk_widget_show_all(m_mainWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
MainWindows::~MainWindows(void)
|
||||
{
|
||||
@@ -206,7 +246,6 @@ void MainWindows::OnMessage(int32_t id, int32_t dataID)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
//MainWindows * self = reinterpret_cast<MainWindows*>(data);
|
||||
@@ -234,7 +273,7 @@ gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@@ -38,7 +38,7 @@
|
||||
|
||||
#ifndef __MAIN_WINDOWS_H__
|
||||
#define __MAIN_WINDOWS_H__
|
||||
|
||||
#if 0
|
||||
class MainWindows: public etk::Singleton<MainWindows>, public MsgBroadcast
|
||||
{
|
||||
friend class etk::Singleton<MainWindows>;
|
||||
@@ -67,7 +67,14 @@ class MainWindows: public etk::Singleton<MainWindows>, public MsgBroadcast
|
||||
ToolBar m_ToolBar;
|
||||
*/
|
||||
};
|
||||
|
||||
#endif
|
||||
class MainWindows : public ewol::Windows
|
||||
{
|
||||
public:
|
||||
// Constructeur
|
||||
MainWindows(void);
|
||||
~MainWindows(void);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <tools_debug.h>
|
||||
#include <tools_globals.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <Display.h>
|
||||
#include <BufferManager.h>
|
||||
#include <ColorizeManager.h>
|
||||
@@ -37,19 +38,44 @@
|
||||
#include <readtags.h>
|
||||
#include <CTagsManager.h>
|
||||
|
||||
MainWindows * basicWindows = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* @brief main application function Initialisation
|
||||
*/
|
||||
void APP_Init(int argc, char *argv[])
|
||||
{
|
||||
EDN_INFO("Start Edn");
|
||||
ewol::ChangeSize(800, 600);
|
||||
|
||||
//etk::TestUntaire_String();
|
||||
//return 0;
|
||||
|
||||
|
||||
// Use and remove GTK arguments from the application argument list.
|
||||
//gtk_init (&argc, &argv);
|
||||
// set the default Path of the application :
|
||||
#ifdef PLATFORM_Linux
|
||||
etk::String homedir;
|
||||
#ifdef NDEBUG
|
||||
homedir = "/usr/share/"PROJECT_NAME"/";
|
||||
#else
|
||||
char cCurrentPath[FILENAME_MAX];
|
||||
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
||||
homedir = "./assets/";
|
||||
} else {
|
||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||
homedir = cCurrentPath;
|
||||
homedir += "/assets/";
|
||||
}
|
||||
#endif
|
||||
SetBaseFolderData(homedir.c_str());
|
||||
SetBaseFolderDataUser("~/."PROJECT_NAME"/");
|
||||
SetBaseFolderCache("/tmp/"PROJECT_NAME"/");
|
||||
#endif
|
||||
|
||||
ewol::SetFontFolder("Font");
|
||||
#ifdef EWOL_USE_FREE_TYPE
|
||||
ewol::SetDefaultFont("freefont/FreeMono", 14);
|
||||
#else
|
||||
//ewol::SetDefaultFont("ebtfont/Monospace", 14);
|
||||
ewol::SetDefaultFont("ebtfont/Monospace", 22);
|
||||
#endif
|
||||
|
||||
// init internal global value
|
||||
globals::init();
|
||||
@@ -108,6 +134,16 @@ void APP_Init(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
basicWindows = new MainWindows();
|
||||
if (NULL == basicWindows) {
|
||||
EDN_ERROR("Can not allocate the basic windows");
|
||||
ewol::Stop();
|
||||
}
|
||||
|
||||
// create the specific windows
|
||||
ewol::DisplayWindows(basicWindows);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +164,9 @@ void APP_UnInit(void)
|
||||
//AccelKey::kill();
|
||||
EDN_INFO("Stop Display");
|
||||
Display::UnInit();
|
||||
|
||||
if (NULL != basicWindows) {
|
||||
delete(basicWindows);
|
||||
}
|
||||
|
||||
|
||||
EDN_INFO("Stop Edn");
|
||||
|
Reference in New Issue
Block a user