32 Commits
0.3.2 ... 0.3.4

Author SHA1 Message Date
188bd69f06 ewol normalisation 2012-03-09 18:08:08 +01:00
0ab5588a93 Remove deprecated type 2012-03-08 18:01:50 +01:00
df3c97b17e minor modif 2012-03-05 00:09:47 +01:00
03cb9d7cbd clean the buffer text 2012-03-02 16:42:44 +01:00
c8b9b37c8e corection of the pointer mouse event 2012-03-02 09:47:33 +01:00
75f56d52d4 Strat simplify of the buffer access 2012-03-01 18:23:45 +01:00
f6f8679b76 Rework of EWOL (Step 3) 2012-02-29 18:06:08 +01:00
ae113a8a2f Rework of EWOL (Step 2) 2012-02-28 18:22:49 +01:00
45f37a0c4b Rework of EWOL (Step 1) 2012-02-27 18:15:56 +01:00
02e7de2397 Display the frst line number 2012-02-24 17:24:53 +01:00
ea344225e3 add the really basic shortcut ... 2012-02-24 12:45:39 +01:00
40d6de087b change text display 2012-02-23 22:34:12 +01:00
7bf7668686 change the filename in the title 2012-02-23 18:05:57 +01:00
e2e0fc25d3 change the clipping with the viewport 2012-02-23 13:43:57 +01:00
9f2718f97a remove the last singleton to create the basic namespace 2012-02-20 20:30:26 +01:00
a943ddd4f7 start remove of singleton 2012-02-19 22:33:43 +01:00
fced6df123 error android compilation for the reintrepreted cast 2012-02-19 18:52:17 +01:00
a4d314723d Better display 2012-02-19 15:48:08 +01:00
f716055c40 Remove all the capabilities at the Widget main classes 2012-02-18 22:20:53 +01:00
0a11251ccc Optimise the display of the CodeViewer ==> usable on Android 2012-02-18 15:56:00 +01:00
0d0afec709 Display the processing time of the text buffer 2012-02-18 11:50:29 +01:00
1894f56217 Change tree ==> simplify 2012-02-18 00:35:15 +01:00
4e7491e5fc display of menu correct 2012-02-17 18:25:38 +01:00
dc73285cb7 update to the new menu 2012-02-16 23:29:48 +01:00
5d7870248d Some update 2012-02-16 18:18:04 +01:00
4b16540744 Remove old test 2012-02-15 23:07:55 +01:00
f0cda0de78 Change the Sting un Unicode management 2012-02-15 16:23:20 +01:00
e21e7e7c21 add save as and start of Unicode string adaptation 2012-02-14 19:29:53 +01:00
cd84475aea Uniformisation of the UNICODE in the soft 2012-02-13 18:03:09 +01:00
71fa38d61e remove dead code 2012-02-12 22:36:59 +01:00
fdd4ddf978 manage the tablette scrolling 2012-02-11 11:18:27 +01:00
f610c23638 Remove deprecated code 2012-02-10 18:20:03 +01:00
56 changed files with 2131 additions and 3850 deletions

View File

@@ -18,4 +18,5 @@
</activity>
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

View File

@@ -1,4 +1,14 @@
# action a faire (ordonner par r<>vision) :
dans la liste des truc important a refaire
retirer tout les singleton ==> passer par des namespace ==> fonctionnera mieux ...
finir de netoyer la classe widget
netoyer les classe text ...
mettre en pla ce le repositionnement automatique quand on change de buffer
Curseur au bon endroit
* 0.2.X :
- gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre)
- gui : Mise en place d'un display ligne par ligne

View File

@@ -16,10 +16,13 @@ LOCAL_SRC_FILES := ewolAndroidAbstraction.cpp \
LOCAL_LDLIBS := -llog -landroid
LOCAL_CFLAGS := -D__PLATFORM__Android \
-D__MODE__Touch \
-DEWOL_USE_FREE_TYPE \
-DETK_DEBUG_LEVEL=3 \
-DEDN_DEBUG_LEVEL=3 \
-DDATA_IN_APK
-DDATA_IN_APK \
-frtti
include $(BUILD_SHARED_LIBRARY)

View File

@@ -15,7 +15,8 @@ LOCAL_SRC_FILES := $(FILE_LIST)
LOCAL_LDLIBS :=
LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \
LOCAL_CFLAGS := -D__PLATFORM__Linux \
-DEWOL_USE_FREE_TYPE \
-DEDN_DEBUG_LEVEL=3
include $(BUILD_EXECUTABLE)

View File

@@ -27,7 +27,7 @@
#include <tools_globals.h>
#include <Buffer.h>
#include <BufferManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/EObject.h>
#undef __class__
#define __class__ "Buffer"
@@ -45,7 +45,7 @@ Buffer::Buffer()
static int32_t fileBasicID = 0;
m_fileModify = true;
m_haveName = false;
etk::String mString = "Untitle - ";
etk::UString mString = "Untitle - ";
mString += fileBasicID++;
SetFileName(mString);
m_haveName = false;
@@ -95,7 +95,8 @@ void Buffer::SetModify(bool status)
if (status != m_fileModify) {
m_fileModify = status;
// TODO : Remove from here
ewol::widgetMessageMultiCast::Send(-1, ednMsgBufferState, "Modify");
etk::UString data = "Modify";
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgBufferState, data);
}
}
@@ -148,10 +149,10 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
* @return ---
*
*/
int32_t Buffer::Display(ewol::OObject2DTextColored* OOTextNormal,
ewol::OObject2DTextColored* OOTextBold,
ewol::OObject2DTextColored* OOTextItalic,
ewol::OObject2DTextColored* OOTextBoldItalic, ewol::OObject2DColored* OOColored,
int32_t Buffer::Display(ewol::OObject2DTextColored& OOTextNormal,
ewol::OObject2DTextColored& OOTextBold,
ewol::OObject2DTextColored& OOTextItalic,
ewol::OObject2DTextColored& OOTextBoldItalic, ewol::OObject2DColored& OOColored,
int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
{
return ERR_NONE;
@@ -167,7 +168,7 @@ int32_t Buffer::Display(ewol::OObject2DTextColored* OOTextNormal,
* @todo : Set the move up and DOWN...
*
*/
void Buffer::MouseSelectFromCursorTo(int32_t width, int32_t height)
void Buffer::MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height)
{
// nothing to do
}
@@ -182,7 +183,7 @@ void Buffer::MouseSelectFromCursorTo(int32_t width, int32_t height)
* @return ---
*
*/
void Buffer::MouseEvent(int32_t width, int32_t height)
void Buffer::MouseEvent(int32_t fontId, int32_t width, int32_t height)
{
// nothing to do
}
@@ -214,49 +215,6 @@ void Buffer::MouseEventTriple(void)
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Buffer::ScrollDown(void)
{
// nothing to do
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Buffer::ScrollUp(void)
{
// nothing to do
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Buffer::ForceReDraw(bool allElement)
{
// nothing to do
}
void Buffer::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
{
// nothing to do
@@ -270,22 +228,22 @@ void Buffer::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
* @return ---
*
*/
void Buffer::AddChar(char * UTF8data)
void Buffer::AddChar(uniChar_t unicodeData)
{
// nothing to do
}
void Buffer::Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
void Buffer::Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{
// nothing to do
}
void Buffer::Replace(etk::String &data)
void Buffer::Replace(etk::UString &data)
{
// nothing to do
}
int32_t Buffer::FindLine(etk::String &data)
int32_t Buffer::FindLine(etk::UString &data)
{
// nothing to do
return 0;

View File

@@ -26,7 +26,7 @@
#ifndef __BUFFER_H__
#define __BUFFER_H__
#include <etk/String.h>
#include <etk/UString.h>
#include <etk/File.h>
#include <Display.h>
#include <etk/unicode.h>
@@ -61,7 +61,7 @@ class Buffer {
NameChange();
};
void SetFileName(etk::String &newName)
void SetFileName(etk::UString &newName)
{
m_fileName.SetCompleateName(newName, etk::FILE_TYPE_DIRECT);
m_haveName = true;
@@ -82,20 +82,17 @@ class Buffer {
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
virtual void SetLineDisplay(uint32_t lineNumber);
virtual int32_t Display(ewol::OObject2DTextColored* OOTextNormal,
ewol::OObject2DTextColored* OOTextBold,
ewol::OObject2DTextColored* OOTextItalic,
ewol::OObject2DTextColored* OOTextBoldItalic,
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
virtual void ForceReDraw(bool allElement);
virtual void AddChar(char * UTF8data);
virtual int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
ewol::OObject2DTextColored& OOTextBold,
ewol::OObject2DTextColored& OOTextItalic,
ewol::OObject2DTextColored& OOTextBoldItalic,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
virtual void AddChar(uniChar_t unicodeData);
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
virtual void MouseEvent(int32_t width, int32_t height);
virtual void MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height);
virtual void MouseEvent(int32_t fontId, int32_t width, int32_t height);
virtual void MouseEventDouble(void);
virtual void MouseEventTriple(void);
virtual void ScrollDown(void);
virtual void ScrollUp(void);
virtual void RemoveLine(void);
virtual void SelectAll(void);
virtual void SelectNone(void);
@@ -107,9 +104,9 @@ class Buffer {
virtual void Copy(int8_t clipboardID);
virtual void Cut(int8_t clipboardID);
virtual void Paste(int8_t clipboardID);
virtual void Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
virtual void Replace(etk::String &data);
virtual int32_t FindLine(etk::String &data);
virtual void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
virtual void Replace(etk::UString &data);
virtual int32_t FindLine(etk::UString &data);
virtual void JumpAtLine(int32_t newLine);
virtual int32_t GetCurrentLine(void);

View File

@@ -67,36 +67,32 @@ BufferEmpty::~BufferEmpty(void)
* @return ---
*
*/
int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal,
ewol::OObject2DTextColored* OOTextBold,
ewol::OObject2DTextColored* OOTextItalic,
ewol::OObject2DTextColored* OOTextBoldItalic,
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
int32_t BufferEmpty::Display(ewol::OObject2DTextColored& OOTextNormal,
ewol::OObject2DTextColored& OOTextBold,
ewol::OObject2DTextColored& OOTextItalic,
ewol::OObject2DTextColored& OOTextBoldItalic,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
{
ColorizeManager * myColorManager = ColorizeManager::getInstance();
// Get color :
Colorize *myColor = NULL;
//drawer.Flush();
if (NULL == OOTextNormal) {
EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL;
}
if (NULL == OOColored) {
EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL;
}
int32_t fontId = OOTextNormal->GetFontID();
int32_t fontId = OOTextNormal.GetFontID();
int32_t letterHeight = ewol::GetHeight(fontId);
myColor = myColorManager->Get("normal");
OOTextNormal->SetColor(myColor->GetFG());
OOTextNormal->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
coord2D_ts textPos;
textPos.x = 20;
textPos.y = 20;
myColor = myColorManager->Get("commentDoxygen");
OOTextNormal->SetColor(myColor->GetFG());
OOTextNormal->TextAdd(20, (int32_t)(20 + letterHeight*1.30), "No Buffer Availlable to display", sizeX);
myColor = ColorizeManager::Get("normal");
OOTextBold.SetColor(myColor->GetFG());
etk::UString tmpDisplay = "edn - Editeur De N'ours";
OOTextBold.Text(textPos, tmpDisplay);
myColor = ColorizeManager::Get("commentDoxygen");
OOTextNormal.SetColor(myColor->GetFG());
textPos.y = (int32_t)(textPos.y + letterHeight*1.30);
tmpDisplay = "No Buffer Availlable to display";
OOTextNormal.Text(textPos, tmpDisplay);
color_ts bgColor; //!< Text color
@@ -104,8 +100,8 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal,
bgColor.green = 1.0;
bgColor.blue = 1.0;
bgColor.alpha = 1.0;
OOColored->SetColor(bgColor);
OOColored->Rectangle( 0, 0, sizeX, sizeY);
OOColored.SetColor(bgColor);
OOColored.Rectangle( 0, 0, sizeX, sizeY);
return ERR_NONE;
}

View File

@@ -32,11 +32,11 @@ class BufferEmpty : public Buffer {
public:
BufferEmpty(void);
virtual ~BufferEmpty(void);
int32_t Display(ewol::OObject2DTextColored* OOTextNormal,
ewol::OObject2DTextColored* OOTextBold,
ewol::OObject2DTextColored* OOTextItalic,
ewol::OObject2DTextColored* OOTextBoldItalic,
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
ewol::OObject2DTextColored& OOTextBold,
ewol::OObject2DTextColored& OOTextItalic,
ewol::OObject2DTextColored& OOTextBoldItalic,
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
};

View File

@@ -27,10 +27,58 @@
#include <tools_debug.h>
#include <tools_globals.h>
#include <BufferManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#undef __class__
#define __class__ "BufferManager"
#define __class__ "classBufferManager"
class classBufferManager: public ewol::EObject
{
public:
// Constructeur
classBufferManager(void);
~classBufferManager(void);
public:
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
private:
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
// open curent filename
int32_t Open(etk::File &myFile);
bool Remove(int32_t BufferID);
public:
int32_t GetSelected(void) { return m_idSelected;};
//void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
private:
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
};
// Constructeur
/**
@@ -41,23 +89,17 @@
* @return ---
*
*/
BufferManager::BufferManager(void)
classBufferManager::classBufferManager(void)
{
// nothing to do ...
BufferNotExiste = new BufferEmpty();
m_idSelected = -1;
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiNew);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgOpenFile);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiClose);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiSave);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewSelectedId);
/*
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerCloseAll);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerClose);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSave);
*/
RegisterMultiCast(ednMsgGuiNew);
RegisterMultiCast(ednMsgOpenFile);
RegisterMultiCast(ednMsgGuiClose);
RegisterMultiCast(ednMsgGuiSave);
RegisterMultiCast(ednMsgCodeViewSelectedId);
RegisterMultiCast(ednMsgBufferId);
}
/**
@@ -68,131 +110,159 @@ BufferManager::BufferManager(void)
* @return ---
*
*/
BufferManager::~BufferManager(void)
classBufferManager::~classBufferManager(void)
{
//clean All Buffer
EDN_INFO("~BufferManager::RemoveAll();");
EDN_INFO("~classBufferManager::RemoveAll();");
RemoveAll();
// clear The list of Buffer
EDN_INFO("~BufferManager::listBuffer.Clear();");
EDN_INFO("~classBufferManager::listBuffer.Clear();");
listBuffer.Clear();
EDN_INFO("~BufferManager::delete(BufferNotExiste);");
EDN_INFO("~classBufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste);
}
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
if (generateEventId == ednMsgGuiNew) {
ewol::EObject::OnReceiveMessage(CallerObject, eventId, data);
if (eventId == ednMsgBufferId) {
// select a new buffer ID :
if (data == "") {
EDN_ERROR("Request select buffer ID = \"\" ");
} else {
int32_t newID = -1;
sscanf(data.Utf8Data(), "%d", &newID);
if(true == Exist(newID)) {
m_idSelected = newID;
} else {
m_idSelected = -1;
EDN_ERROR("Request a non existant ID : " << newID << " reset to -1...");
}
}
} else if (eventId == ednMsgGuiNew) {
int32_t newOne = Create();
if (-1 != newOne) {
m_idSelected = newOne;
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_idSelected);
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
SendMultiCast(ednMsgBufferId, m_idSelected);
SendMultiCast(ednMsgBufferListChange);
}
} else if (generateEventId == ednMsgOpenFile) {
if (NULL != data) {
} else if (eventId == ednMsgOpenFile) {
if (data != "" ) {
etk::File myFile(data, etk::FILE_TYPE_DIRECT);
int32_t newOne = Open(myFile);
if (-1 != newOne) {
m_idSelected = newOne;
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_idSelected);
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
SendMultiCast(ednMsgBufferId, m_idSelected);
SendMultiCast(ednMsgBufferListChange);
}
}
} else if (generateEventId == ednMsgGuiSave) {
if (NULL == data) {
} else if (eventId == ednMsgGuiSave) {
if (data == "") {
EDN_ERROR("Null data for close file ... ");
} else {
if (0 == strcmp(data , "current")) {
if (data == "current") {
// Check buffer existence
if(true == Exist(m_idSelected)) {
// If no name ==> request a Gui display ...
if (Get(m_idSelected)->HaveName() == false) {
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiSaveAs, "current");
SendMultiCast(ednMsgGuiSaveAs, "current");
} else {
Get(m_idSelected)->Save();
}
}
} else {
int32_t newId;
sscanf(data, "%d", &newId);
sscanf(data.Utf8Data(), "%d", &newId);
if (false == Exist(newId)) {
EDN_ERROR("Request a save As with a non existant ID=" << newId);
} else {
// If no name ==> request a Gui display ...
if (Get(newId)->HaveName() == false) {
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiSaveAs, newId);
SendMultiCast(ednMsgGuiSaveAs, newId);
} else {
Get(m_idSelected)->Save();
}
}
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferState, "saved");
SendMultiCast(ednMsgBufferState, "saved");
}
}
} else if (generateEventId == ednMsgGuiClose) {
if (NULL == data) {
} else if (eventId == ednMsgGuiClose) {
if (data == "") {
EDN_ERROR("Null data for close file ... ");
} else {
if (0 == strcmp(data , "current")) {
} else if (0 == strcmp(data , "All")) {
if (data == "All") {
} else {
int32_t closeID = -1;
if (data == "current") {
closeID = m_idSelected;
EDN_DEBUG("Close specific buffer ID" << closeID);
} else {
// close specific buffer ...
sscanf(data.Utf8Data(), "%d", &closeID);
EDN_DEBUG("Close specific buffer ID="<< closeID);
}
if(true == Exist(closeID)) {
// Get the new display buffer
if (m_idSelected == closeID) {
// Try previous buffer
int32_t destBuffer = -1;
for(int32_t ii=closeID-1; ii >= 0; ii--) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
// try next buffer
if (-1 == destBuffer) {
for(int32_t ii=closeID+1; ii < listBuffer.Size(); ii++) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
}
// set it to the currect display
SendMultiCast(ednMsgBufferId, destBuffer);
m_idSelected = destBuffer;
}
// Remove requested buffer
Remove(closeID);
SendMultiCast(ednMsgBufferListChange);
} else {
EDN_ERROR("Request Close of a non existant ID : " << closeID);
}
}
}
} else if (generateEventId == ednMsgCodeViewSelectedId) {
} else if (eventId == ednMsgCodeViewSelectedId) {
//Change the selected buffer
if (NULL == data) {
if (data == "") {
EDN_ERROR("Null data for changing buffer ID file ... ");
} else {
int32_t newId;
sscanf(data, "%d", &newId);
sscanf(data.Utf8Data(), "%d", &newId);
if (true == Exist(newId)) {
m_idSelected = newId;
} else {
EDN_ERROR("code biew request the selection of an non -existant buffer ==> reset to -1");
m_idSelected = -1;
}
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_idSelected);
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
SendMultiCast(ednMsgBufferId, m_idSelected);
SendMultiCast(ednMsgBufferListChange);
}
}
/*
switch (id)
{
case EDN_MSG__BUFF_ID_CLOSE:
// Check buffer existence
if(true == Exist(dataID)) {
// Get the new display buffer
if (m_idSelected == dataID) {
// Try previous buffer
int32_t destBuffer = -1;
for(int32_t ii=dataID-1; ii >= 0; ii--) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
// try next buffer
if (-1 == destBuffer) {
for(int32_t ii=dataID+1; ii < listBuffer.Size(); ii++) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
}
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
// set it to the currect display
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, destBuffer);
}
//EDN_DEBUG("Remove : " << dataID);
// Remove requested buffer
Remove(dataID);
}
break;
case EDN_MSG__BUFF_ID_SAVE:
// Check buffer existence
if(true == Exist(dataID)) {
// If no name ==> request a Gui display ...
@@ -205,7 +275,6 @@ bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateE
break;
}
*/
return false;
}
@@ -222,13 +291,13 @@ bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateE
* @return ---
*
*/
void BufferManager::RemoveAll(void)
void classBufferManager::RemoveAll(void)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
Remove(i);
}
ewol::widgetMessageMultiCast::Send(-1, ednMsgGuiClose, "All");
SendMultiCast(ednMsgGuiClose, "All");
}
@@ -241,7 +310,7 @@ void BufferManager::RemoveAll(void)
* @return The ID of the curent buffer where the file is loaded
*
*/
int32_t BufferManager::Create(void)
int32_t classBufferManager::Create(void)
{
// allocate a new Buffer
Buffer *myBuffer = new BufferText();
@@ -262,7 +331,7 @@ int32_t BufferManager::Create(void)
* @todo : check if this file is not curently open and return the old ID
*
*/
int32_t BufferManager::Open(etk::File &myFile)
int32_t classBufferManager::Open(etk::File &myFile)
{
// TODO : Check here if the file is already open ==> and display it if needed
// allocate a new Buffer
@@ -274,7 +343,7 @@ int32_t BufferManager::Open(etk::File &myFile)
Buffer * BufferManager::Get(int32_t BufferID)
Buffer * classBufferManager::Get(int32_t BufferID)
{
// possible special case : -1;
if (-1 >= BufferID) {
@@ -295,7 +364,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
}
bool BufferManager::Exist(int32_t BufferID)
bool classBufferManager::Exist(int32_t BufferID)
{
if (-1 >= BufferID) {
return false;
@@ -311,7 +380,7 @@ bool BufferManager::Exist(int32_t BufferID)
}
bool BufferManager::Exist(etk::File &myFile )
bool classBufferManager::Exist(etk::File &myFile )
{
if (-1 == GetId(myFile)) {
return false;
@@ -320,7 +389,7 @@ bool BufferManager::Exist(etk::File &myFile )
}
int32_t BufferManager::GetId(etk::File &myFile)
int32_t classBufferManager::GetId(etk::File &myFile)
{
int32_t iii;
// check if the Buffer existed
@@ -337,11 +406,24 @@ int32_t BufferManager::GetId(etk::File &myFile)
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t BufferManager::Size(void)
uint32_t classBufferManager::Size(void)
{
return listBuffer.Size();
}
// nb of opens file Now ...
uint32_t classBufferManager::SizeOpen(void)
{
uint32_t jjj = 0;
// check if the Buffer existed
for (int32_t iii=0; iii<listBuffer.Size(); iii++) {
// check if the buffer already existed
if (NULL != listBuffer[iii]) {
jjj++;
}
}
return jjj;
}
/**
* @brief
@@ -351,7 +433,7 @@ uint32_t BufferManager::Size(void)
* @return ---
*
*/
bool BufferManager::Remove(int32_t BufferID)
bool classBufferManager::Remove(int32_t BufferID)
{
if (-1 >= BufferID) {
return false;
@@ -369,7 +451,9 @@ bool BufferManager::Remove(int32_t BufferID)
// Delete the Buffer
delete( listBuffer[BufferID] );
listBuffer[BufferID] = NULL;
/*
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
*/
return true;
} else {
EDN_INFO("non existing Buffer " << BufferID);
@@ -389,7 +473,7 @@ bool BufferManager::Remove(int32_t BufferID)
* @return ---
*
*/
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
@@ -405,7 +489,105 @@ int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace part :
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static classBufferManager * localManager = NULL;
void BufferManager::Init(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> already exist, just unlink the previous ...");
localManager = NULL;
}
localManager = new classBufferManager();
if (NULL == localManager) {
EWOL_CRITICAL("Allocation of classBufferManager not done ...");
}
}
void BufferManager::UnInit(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return;
}
ewol::EObjectManager::MarkToRemoved(localManager);
localManager = NULL;
}
int32_t BufferManager::GetSelected(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return -1;
}
return localManager->GetSelected();
}
Buffer * BufferManager::Get(int32_t BufferID)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return NULL;
}
return localManager->Get(BufferID);
}
bool BufferManager::Exist(int32_t BufferID)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(BufferID);
}
bool BufferManager::Exist(etk::File &myFile)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(myFile);
}
int32_t BufferManager::GetId(etk::File &myFile)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return -1;
}
return localManager->GetId(myFile);
}
uint32_t BufferManager::Size(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return 0;
}
return localManager->Size();
}
uint32_t BufferManager::SizeOpen(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return 0;
}
return localManager->SizeOpen();
}
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
return -1;
}
return localManager->WitchBuffer(iEmeElement);
}

View File

@@ -29,47 +29,22 @@
#include <Buffer.h>
#include <BufferText.h>
#include <BufferEmpty.h>
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include <ewol/Widget.h>
class BufferManager: public etk::Singleton<BufferManager>, public ewol::Widget
namespace BufferManager
{
friend class etk::Singleton<BufferManager>;
// specific for sigleton system...
private:
// Constructeur
BufferManager(void);
~BufferManager(void);
public:
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
private:
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
// open curent filename
int32_t Open(etk::File &myFile);
bool Remove(int32_t BufferID);
public:
int32_t GetSelected(void) { return m_idSelected;};
//void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
int32_t WitchBuffer(int32_t iEmeElement);
private:
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
void Init(void);
void UnInit(void);
int32_t GetSelected(void);
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -46,30 +46,27 @@ class BufferText : public Buffer {
void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber);
int32_t Display(ewol::OObject2DTextColored* OOTextNormal,
ewol::OObject2DTextColored* OOTextBold,
ewol::OObject2DTextColored* OOTextItalic,
ewol::OObject2DTextColored* OOTextBoldItalic,
ewol::OObject2DColored* OOColored,
int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
ewol::OObject2DTextColored& OOTextBold,
ewol::OObject2DTextColored& OOTextItalic,
ewol::OObject2DTextColored& OOTextBoldItalic,
ewol::OObject2DColored& OOColored,
int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY);
void ForceReDraw(bool allElement);
void AddChar(char * UTF8data);
void AddChar(uniChar_t unicodeData);
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
void MouseSelectFromCursorTo(int32_t width, int32_t height);
void MouseEvent(int32_t width, int32_t height);
void MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height);
void MouseEvent(int32_t fontId, int32_t width, int32_t height);
void MouseEventDouble(void);
void MouseEventTriple(void);
void ScrollDown(void);
void ScrollUp(void);
void Copy(int8_t clipboardID);
void Cut(int8_t clipboardID);
void Paste(int8_t clipboardID);
void Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(etk::String &data);
int32_t FindLine(etk::String &data);
void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(etk::UString &data);
int32_t FindLine(etk::UString &data);
void JumpAtLine(int32_t newLine);
int32_t GetCurrentLine(void);
@@ -84,43 +81,34 @@ class BufferText : public Buffer {
void NameChange(void);
private:
// Display
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number
ColorizeManager * myColorManager; //!< for the background color :
int32_t GetLineNumberNumberOfElement(void);
// Direct buffer IO
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
int32_t m_displayStartLineId; //!< Id of the line that the display is starting (in nb line)
int32_t m_displayStartPixelX; //!< Pixel of the display starting (in pixel)
position_ts m_displaySize; //!< number of char displayable in the screan
int32_t m_displayStartBufferPos; //!< position where the buffer start
coord2D_ts m_displaySize; //!< number of char displayable in the screan
// Cursor :
int32_t m_cursorPos; //!< position in the buffer of the cursor
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
// internal function
void BasicInit(void);
void UpdateWindowsPosition(bool centerPage = false);
void BasicInit(void);
// moving the current position of the display windows ...
private:
coord2D_ts m_requestDisplayPos; //!< number of char displayable in the screan
void RequestPositionUpdate(bool centerPage = false);
public:
bool RequestPositionRequest(coord2D_ts& newPos);
void CleanSelectLine(void);
void SelectionStart(void);
void SelectionEnd(void);
void SelectionCheckMode(void);
void CheckAndUpdateLineForModification(uint32_t lineID);
private:
bool TextDMoveUp(int32_t offset);
bool TextDMoveDown(int32_t offset);
void SetInsertPosition(int32_t newPosition, bool insertChar = false);
int32_t GetMousePosition(int32_t width, int32_t height);
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);
int32_t GetMousePosition(int32_t fontId, int32_t width, int32_t height);
void CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth);
void DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
void DrawCursor(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip);
};

View File

@@ -32,7 +32,7 @@
#define __class__ "Colorize"
Colorize::Colorize( etk::String &newColorName)
Colorize::Colorize( etk::UString &newColorName)
{
m_colorFG.red=0;
@@ -85,14 +85,14 @@ void Colorize::SetName(const char *newColorName)
ColorName = newColorName;
}
void Colorize::SetName(etk::String &newColorName)
void Colorize::SetName(etk::UString &newColorName)
{
//EDN_INFO("color change name : \"%s\" ==> \"%s\"",ColorName.c_str(), newColorName.c_str());
ColorName = newColorName;
}
etk::String Colorize::GetName(void)
etk::UString Colorize::GetName(void)
{
return ColorName;
}

View File

@@ -31,12 +31,12 @@ class Colorize {
public:
// Constructeur
Colorize(void);
Colorize(etk::String &newColorName);
Colorize(etk::UString &newColorName);
~Colorize(void);
void SetName(etk::String &newColorName);
void SetName(etk::UString &newColorName);
void SetName(const char *newColorName);
etk::String GetName(void);
etk::UString GetName(void);
void SetFgColor(const char *myColor);
void SetBgColor(const char *myColor);
@@ -50,10 +50,10 @@ class Colorize {
bool GetItalic(void);
bool GetBold(void);
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName.c_str() << "\"" << " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<","<< m_colorFG.alpha /*<<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName << "\"" << " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<","<< m_colorFG.alpha /*<<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
private:
etk::String ColorName; //!< curent color Name
etk::UString ColorName; //!< curent color Name
color_ts m_colorFG;
color_ts m_colorBG;

View File

@@ -26,17 +26,52 @@
#include <tools_globals.h>
#include <ColorizeManager.h>
#include <tinyXML/tinyxml.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#define PFX "ColorizeManager "
ColorizeManager::ColorizeManager(void)
class classColorManager: public ewol::EObject
{
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiChangeColor);
public:
// Constructeur
classColorManager(void);
~classColorManager(void);
public:
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
public:
void LoadFile(etk::UString &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(etk::UString &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(etk::UString &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
private:
etk::UString m_fileColor;
etk::VectorType<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor;
color_ts basicColors[COLOR_NUMBER_MAX];
};
classColorManager::classColorManager(void)
{
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiChangeColor);
}
ColorizeManager::~ColorizeManager(void)
classColorManager::~classColorManager(void)
{
delete(errorColor);
@@ -52,8 +87,7 @@ ColorizeManager::~ColorizeManager(void)
listMyColor.Clear();
}
bool ColorizeManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
void classColorManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
/*
switch (id)
@@ -61,23 +95,24 @@ bool ColorizeManager::OnEventAreaExternal(int32_t widgetID, const char * generat
case EDN_MSG__RELOAD_COLOR_FILE:
{
// Reaload File
// TODO : Check this : Pb in the recopy etk::String element
etk::String plop = m_fileColor;
LoadFile(plop.c_str());
// TODO : Check this : Pb in the recopy etk::UString element
etk::UString plop = m_fileColor;
LoadFile(plop);
}
break;
}
*/
return false;
}
void ColorizeManager::LoadFile(etk::String &xmlFilename)
void classColorManager::LoadFile(etk::UString &xmlFilename)
{
LoadFile(xmlFilename.c_str());
// TODO : Remove this
LoadFile(xmlFilename.Utf8Data());
}
void ColorizeManager::LoadFile(const char * xmlFilename)
// TODO : Remove this ...
void classColorManager::LoadFile(const char * xmlFilename)
{
// Remove all old color :
int32_t i;
@@ -273,11 +308,12 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
//SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
}
Colorize *ColorizeManager::Get(const char *colorName)
// TODO : Remove this ...
Colorize *classColorManager::Get(const char *colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::String elementName = listMyColor[i]->GetName();
etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return listMyColor[i];
}
@@ -287,12 +323,13 @@ Colorize *ColorizeManager::Get(const char *colorName)
return errorColor;
}
Colorize *ColorizeManager::Get(etk::String &colorName)
Colorize *classColorManager::Get(etk::UString &colorName)
{
return Get(colorName.c_str());
// TODO : Remove this
return Get(colorName.Utf8Data());
}
color_ts & ColorizeManager::Get(basicColor_te myColor)
color_ts & classColorManager::Get(basicColor_te myColor)
{
if (myColor < COLOR_NUMBER_MAX) {
return basicColors[myColor];
@@ -302,28 +339,31 @@ color_ts & ColorizeManager::Get(basicColor_te myColor)
}
bool ColorizeManager::Exist(const char *colorName)
// TODO : Remove this ...
bool classColorManager::Exist(const char *colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::String elementName = listMyColor[i]->GetName();
etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return true;
}
}
return false;
}
bool ColorizeManager::Exist(etk::String &colorName)
bool classColorManager::Exist(etk::UString &colorName)
{
return Exist(colorName.c_str());
// TODO : Remove this
return Exist(colorName.Utf8Data());
}
void ColorizeManager::DisplayListOfColor(void)
void classColorManager::DisplayListOfColor(void)
{
int32_t i;
EDN_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.Size(); i++) {
//etk::String elementName = listMyColor[i]->GetName();
//etk::UString elementName = listMyColor[i]->GetName();
//EDN_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);
}
@@ -331,3 +371,97 @@ void ColorizeManager::DisplayListOfColor(void)
static classColorManager * localManager = NULL;
void ColorizeManager::Init(void)
{
if (NULL == localManager) {
EWOL_ERROR("ColorizeManager ==> already exist, just unlink the previous ...");
localManager = NULL;
}
localManager = new classColorManager();
if (NULL == localManager) {
EWOL_CRITICAL("Allocation of HighlightManager not done ...");
}
}
void ColorizeManager::UnInit(void)
{
if (NULL == localManager) {
EWOL_ERROR("ColorizeManager ==> request UnInit, but does not exist ...");
return;
}
ewol::EObjectManager::MarkToRemoved(localManager);
localManager = NULL;
}
void ColorizeManager::LoadFile(etk::UString &xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(xmlFilename);
}
void ColorizeManager::LoadFile(const char * xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(xmlFilename);
}
Colorize* ColorizeManager::Get(const char *colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(colorName);
}
Colorize* ColorizeManager::Get(etk::UString &colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(colorName);
}
color_ts errorColor;
color_ts& ColorizeManager::Get(basicColor_te myColor)
{
if (NULL == localManager) {
return errorColor;
}
return localManager->Get(myColor);
}
bool ColorizeManager::Exist(etk::UString &colorName)
{
if (NULL == localManager) {
return false;
}
return localManager->Exist(colorName);
}
bool ColorizeManager::Exist(const char *colorName)
{
if (NULL == localManager) {
return false;
}
return localManager->Exist(colorName);
}
void ColorizeManager::DisplayListOfColor(void)
{
if (NULL == localManager) {
return;
}
localManager->DisplayListOfColor();
}

View File

@@ -26,7 +26,6 @@
#ifndef __COLORIZE_MANAGER_H__
#define __COLORIZE_MANAGER_H__
#include <etk/Singleton.h>
#include <Colorize.h>
#include <MsgBroadcast.h>
#include <ewol/Widget.h>
@@ -50,31 +49,18 @@ typedef enum {
class ColorizeManager: public etk::Singleton<ColorizeManager>, public ewol::Widget
namespace ColorizeManager
{
friend class etk::Singleton<ColorizeManager>;
// specific for sigleton system...
private:
// Constructeur
ColorizeManager(void);
~ColorizeManager(void);
public:
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
public:
void LoadFile(etk::String &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(etk::String &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(etk::String &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
private:
etk::String m_fileColor;
etk::VectorType<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor;
color_ts basicColors[COLOR_NUMBER_MAX];
void Init(void);
void UnInit(void);
void LoadFile(etk::UString &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(etk::UString &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(etk::UString &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
};
#endif

View File

@@ -1,431 +0,0 @@
/**
*******************************************************************************
* @file BufferViewer.cpp
* @brief Editeur De N'ours : main textViewer diplayer
* @author Edouard DUPIN
* @date 04/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <Display.h>
#include <BufferView.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <MainWindows.h>
#include <ewol/WidgetMessageMultiCast.h>
#undef __class__
#define __class__ "BufferView"
BufferView::BufferView(void)
{
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
SetCanHaveFocus(true);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferListChange);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferState);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
m_selectedID = -1;
}
BufferView::~BufferView(void)
{
}
/*
GtkWidget * BufferView::GetMainWidget(void)
{
return m_widget;
}
*/
bool BufferView::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
{
if (generateEventId == ednMsgBufferListChange) {
MarkToReedraw();
}else if (generateEventId == ednMsgBufferId) {
MarkToReedraw();
}else if (generateEventId == ednMsgBufferState) {
MarkToReedraw();
}
return false;
}
color_ts BufferView::GetBasicBG(void)
{
return m_colorManager->Get(COLOR_LIST_BG_1);
}
uint32_t BufferView::GetNuberOfColomn(void)
{
return 1;
}
bool BufferView::GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg)
{
myTitle = "Buffers : ";
return true;
}
uint32_t BufferView::GetNuberOfRaw(void)
{
if (NULL != m_bufferManager) {
return m_bufferManager->Size();
}
return 0;
}
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg)
{
etk::File name;
bool isModify;
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1;
if (m_bufferManager->Exist(raw)) {
isModify = m_bufferManager->Get(raw)->IsModify();
name = m_bufferManager->Get(raw)->GetFileName();
char *tmpModify = (char*)" ";
if (true == isModify) {
tmpModify = (char*)"M";
}
char name2[1024] = "";
sprintf(name2, "[%2d](%s) %s", raw, tmpModify, name.GetShortFilename().c_str() );
myTextToWrite = name2;
if (true == isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY;
} else {
selectFG = COLOR_LIST_TEXT_NORMAL;
}
if (raw%2==0) {
selectBG = COLOR_LIST_BG_1;
} else {
selectBG = COLOR_LIST_BG_2;
}
if (m_selectedID == raw) {
selectBG = COLOR_LIST_BG_SELECTED;
}
} else {
myTextToWrite = "ERROR";
}
fg = m_colorManager->Get(selectFG);
bg = m_colorManager->Get(selectBG);
return true;
}
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) {
EDN_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
if ( 0 <= selectBuf) {
m_selectedID = raw;
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);
}
}
MarkToReedraw();
return false;
}
#if 0
gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
bool needRedrawAll = false;
if (self->m_shawableAreaX != allocation.width) {
needRedrawAll = true;
self->m_shawableAreaX = allocation.width;
}
if (self->m_shawableAreaY != allocation.height) {
needRedrawAll = true;
self->m_shawableAreaY = allocation.height;
}
# elif defined( USE_GTK_VERSION_2_0)
bool needRedrawAll = false;
if (self->m_shawableAreaX != widget->allocation.width) {
needRedrawAll = true;
self->m_shawableAreaX = widget->allocation.width;
}
if (self->m_shawableAreaY != widget->allocation.height) {
needRedrawAll = true;
self->m_shawableAreaY = widget->allocation.height;
}
#endif
if (true == needRedrawAll) {
//myBuffer->ForceReDraw(true);
}
EDN_INFO("==========================================================================");
EDN_INFO("Request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
// clean buffer
monDrawer.Clean(self->m_colorManager->Get(COLOR_LIST_BG_1));
// get the number of buffer open
int32_t nbBufferOpen = self->m_bufferManager->Size();
int32_t i;
uint32_t lineID = 0;
uint32_t fontHeight = Display::GetFontHeight();
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1;
for (i=0; i < nbBufferOpen; i++) {
Edn::File name;
bool isModify;
if (self->m_bufferManager->Exist(i)) {
isModify = self->m_bufferManager->Get(i)->IsModify();
name = self->m_bufferManager->Get(i)->GetFileName();
char *tmpModify = (char*)" ";
if (true == isModify) {
tmpModify = (char*)"M";
}
char name2[1024] = "";
sprintf(name2, "[%2d](%s) %s", i, tmpModify, name.GetShortFilename().c_str() );
if (true == isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY;
} else {
selectFG = COLOR_LIST_TEXT_NORMAL;
}
if (lineID%2==0) {
selectBG = COLOR_LIST_BG_1;
} else {
selectBG = COLOR_LIST_BG_2;
}
if (self->m_selectedID == i) {
selectBG = COLOR_LIST_BG_SELECTED;
}
EDN_INFO("color fg=" << selectFG << " bg="<< selectBG);
monDrawer.Rectangle(self->m_colorManager->Get(selectBG), 0, lineID*fontHeight, self->m_shawableAreaX, Display::GetFontHeight());
monDrawer.Text(self->m_colorManager->Get(selectFG), 2, lineID*fontHeight, name2);
monDrawer.Flush();
lineID ++;
}
}
return TRUE;
}
// sur : <20>mis lors du premier affichage de la GtkDrawingArea
gboolean BufferView::CB_displayInit( GtkWidget *widget, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
int32_t size_x = allocation.width;
int32_t size_y = allocation.height;
self->m_shawableAreaX = allocation.width;
self->m_shawableAreaY = allocation.height;
# elif defined( USE_GTK_VERSION_2_0)
int32_t size_x = widget->allocation.width;
int32_t size_y = widget->allocation.height;
self->m_shawableAreaX = widget->allocation.width;
self->m_shawableAreaY = widget->allocation.height;
# endif
EDN_INFO("Request a diplay of : " << size_x << "px * " << size_y << "px");
//Display::InitDisplayParam(self->m_displayParameters, widget, 700, 1200);
gtk_widget_queue_draw( widget );
return TRUE;
}
gint BufferView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
//BufferView * self = reinterpret_cast<BufferView*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - In");
gtk_widget_queue_draw( widget );
return FALSE;
}
gint BufferView::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
//BufferView * self = reinterpret_cast<BufferView*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - out");
return FALSE;
}
gint BufferView::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data)
{
//BufferView * self = reinterpret_cast<BufferView*>(data);
if(event->type == GDK_KEY_PRESS) {
gtk_widget_queue_draw( widget );
}
return true;
}
void BufferView::OnPopupEventShow(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventClose(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_CLOSE, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventSave(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_SAVE, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID)
{
// Save the slected buffer
m_contectMenuSelectID = BufferID;
if (m_bufferManager->Exist(m_contectMenuSelectID)) {
GtkWidget *menu, *menuitem;
menu = gtk_menu_new();
menuitem = gtk_menu_item_new_with_label("Show");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventShow), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
if (true == m_bufferManager->Get(m_contectMenuSelectID)->HaveName()) {
if (true == m_bufferManager->Get(m_contectMenuSelectID)->IsModify()) {
menuitem = gtk_menu_item_new_with_label("Save");
} else {
menuitem = gtk_menu_item_new_with_label("Force Save");
}
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventSave), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
menuitem = gtk_menu_item_new_with_label("Save As ...");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventSaveAs), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label("Close");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventClose), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);
// Note: event can be NULL here when called from view_onPopupMenu;
// gdk_event_get_time() accepts a NULL argument
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
(event != NULL) ? event->button : 0,
gdk_event_get_time((GdkEvent*)event));
} else {
EDN_ERROR("Buffer does not Exist !!! " << m_contectMenuSelectID);
}
}
gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
// get focus on the widget
gtk_widget_grab_focus(widget);
if (event->button == 1) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> One Clicked");
}else if (event->type == GDK_2BUTTON_PRESS) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
//EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf);
if ( 0 <= selectBuf) {
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, selectBuf);
}
}
} else if (event->button == 3) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT3 PRESS");
uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
if ( 0 <= selectBuf) {
self->ViewPopupMenu(widget, event, selectBuf);
}
}
} else {
// not usefull to redraw
return true;
}
gtk_widget_queue_draw( widget );
return true;
}
gint BufferView::CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
//BufferView * self = reinterpret_cast<BufferView*>(data);
/*
if (true == ButtunOneSelected) {
int x, y;
GdkModifierType state;
if (event->is_hint) {
gdk_window_get_pointer(event->window, &x, &y, &state);
} else {
x = event->x;
y = event->y;
state = (GdkModifierType)event->state;
}
EDN_INFO("mouse-motion BT1 %d, %d", x, y);
}
*/
return true;
}
#endif

View File

@@ -1,500 +0,0 @@
/**
*******************************************************************************
* @file CodeView.cpp
* @brief Editeur De N'ours : Code Viewer Widget
* This is an abstraction
* @author Edouard DUPIN
* @date 05/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <CodeView.h>
#include <tools_debug.h>
#include <tools_globals.h>
#include <Display.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <ClipBoard.h>
#include <SearchData.h>
#include <ewol/WidgetManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#undef __class__
#define __class__ "ewol::CodeView"
CodeView::CodeView(void)
{
m_label = "CodeView is disable ...";
m_fontNormal = -1;
m_fontBold = -1;
m_fontItalic = -1;
m_fontBoldItalic = -1;
m_fontSize = 15;
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);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
//old
/*
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSave);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSaveAs);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSelectAll);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentRemoveLine);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentUnSelect);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentCopy);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentCut);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentPaste);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentFindPrevious);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentFindNext);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentFindOldNext);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentReplace);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentReplaceAll);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentClose);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentUndo);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentRedo);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentGotoLine);
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSetCharset);
*/
}
CodeView::~CodeView(void)
{
}
bool CodeView::CalculateMinSize(void)
{
m_minSize.x = 50;
m_minSize.y = 50;
return true;
}
void CodeView::CalculateMaxSize(void)
{
m_maxSize.x = 4096;
int32_t letterHeight = ewol::GetHeight(m_fontNormal);
m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight;
}
void CodeView::OnRegenerateDisplay(void)
{
if (true == NeedRedraw()) {
// For the scrooling windows
CalculateMaxSize();
// create tmp object :
ewol::OObject2DTextColored* myOObjectTextNormal = new ewol::OObject2DTextColored(m_fontNormal);
ewol::OObject2DTextColored* myOObjectTextBold = new ewol::OObject2DTextColored(m_fontBold);
ewol::OObject2DTextColored* myOObjectTextItalic = new ewol::OObject2DTextColored(m_fontItalic);
ewol::OObject2DTextColored* myOObjectTextBoldItalic = new ewol::OObject2DTextColored(m_fontBoldItalic);
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
// generate the objects :
//m_bufferID = 0;
m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored,
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
// clean the object list ...
ClearOObjectList();
// add generated element
AddOObject(myOObjectsColored, "CodeViewBackground");
AddOObject(myOObjectTextNormal, "CodeViewTextNormal");
AddOObject(myOObjectTextBold, "CodeViewTextBold");
AddOObject(myOObjectTextItalic, "CodeViewTextItalic");
AddOObject(myOObjectTextBoldItalic, "CodeViewTextBoldItalic");
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
}
}
bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
{
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
m_bufferManager->Get(m_bufferID)->AddChar(UTF8_data);
MarkToReedraw();
}
return true;
}
bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent)
{
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
m_bufferManager->Get(m_bufferID)->cursorMove(moveTypeEvent);
MarkToReedraw();
}
return true;
}
bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
{
if (true == WidgetScrooled::OnEventInput(IdInput, typeEvent, x, y)) {
ewol::widgetManager::FocusKeep(this);
// nothing to do ... done on upper widet ...
return true;
}
x -= m_origin.x;
y -= m_origin.y;
/*
etk::String type = (int)typeEvent;
switch (typeEvent)
{
case ewol::EVENT_INPUT_TYPE_DOWN:
type = "EVENT_INPUT_TYPE_DOWN";
break;
case ewol::EVENT_INPUT_TYPE_MOVE:
type = "EVENT_INPUT_TYPE_MOVE";
break;
case ewol::EVENT_INPUT_TYPE_SINGLE:
type = "EVENT_INPUT_TYPE_SINGLE";
break;
case ewol::EVENT_INPUT_TYPE_DOUBLE:
type = "EVENT_INPUT_TYPE_DOUBLE";
break;
case ewol::EVENT_INPUT_TYPE_TRIPLE:
type = "EVENT_INPUT_TYPE_TRIPLE";
break;
case ewol::EVENT_INPUT_TYPE_UP:
type = "EVENT_INPUT_TYPE_UP";
break;
case ewol::EVENT_INPUT_TYPE_ENTER:
type = "EVENT_INPUT_TYPE_ENTER";
break;
case ewol::EVENT_INPUT_TYPE_LEAVE:
type = "EVENT_INPUT_TYPE_LEAVE";
break;
default:
break;
};
EDN_DEBUG("Event : " << IdInput << " type : " << type << " position(" << x << "," << y << ")");
*/
if (1 == IdInput) {
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
m_buttunOneSelected = true;
ewol::widgetManager::FocusKeep(this);
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
m_buttunOneSelected = false;
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
// nothing to do ...
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> Triple Clicked");
m_bufferManager->Get(m_bufferID)->MouseEventTriple();
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
if (true == m_buttunOneSelected) {
int xxx, yyy;
xxx = x;
yyy = y;
if (xxx<0) {
xxx = 0;
}
if (yyy<0) {
yyy = 0;
}
//EDN_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
m_bufferManager->Get(m_bufferID)->MouseSelectFromCursorTo(xxx, yyy);
MarkToReedraw();
}
}
} else if (2 == IdInput) {
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
m_bufferManager->Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
MarkToReedraw();
ewol::widgetManager::FocusKeep(this);
}
}
// TODO : No mere used here ... ==> set in the scrooled windows ...
/*
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
{
//EDN_INFO("mouse-event GDK_SCROLL_UP");
m_bufferManager->Get(m_bufferID)->ScrollUp();
MarkToReedraw();
ewol::widgetManager::FocusKeep(this);
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
{
//EDN_INFO("mouse-event GDK_SCROLL_DOWN");
m_bufferManager->Get(m_bufferID)->ScrollDown();
MarkToReedraw();
ewol::widgetManager::FocusKeep(this);
}
*/
return true;
}
bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
{
EDN_DEBUG("Extern Event : " << widgetID << " type : " << generateEventId << " position(" << x << "," << y << ")");
if( ednMsgBufferId == generateEventId) {
int32_t bufferID = 0;
sscanf(data, "%d", &bufferID);
EDN_INFO("Select a new Buffer ... " << bufferID);
m_bufferID = bufferID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
// TODO : need to update the state of the file and the filenames ...
}
// old
/*
else if( ednMsgCodeViewCurrentChangeBufferId == generateEventId) {
int32_t bufferID = 0;
sscanf(data, "%d", &bufferID);
EDN_INFO("Select a new Buffer ... " << bufferID);
m_bufferID = bufferID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferChangeCurrent, (char*)data);
}
*/
/*
else if (ednMsgCodeViewCurrentSave == generateEventId) {
} else if (ednMsgCodeViewCurrentSaveAs == generateEventId) {
} else if (ednMsgCodeViewCurrentSelectAll == generateEventId) {
} else if (ednMsgCodeViewCurrentRemoveLine == generateEventId) {
} else if (ednMsgCodeViewCurrentUnSelect == generateEventId) {
} else if (ednMsgCodeViewCurrentCopy == generateEventId) {
} else if (ednMsgCodeViewCurrentCut == generateEventId) {
} else if (ednMsgCodeViewCurrentPaste == generateEventId) {
} else if (ednMsgCodeViewCurrentFindPrevious == generateEventId) {
} else if (ednMsgCodeViewCurrentFindNext == generateEventId) {
} else if (ednMsgCodeViewCurrentFindOldNext == generateEventId) {
} else if (ednMsgCodeViewCurrentReplace == generateEventId) {
} else if (ednMsgCodeViewCurrentReplaceAll == generateEventId) {
} else if (ednMsgCodeViewCurrentClose == generateEventId) {
} else if (ednMsgCodeViewCurrentUndo == generateEventId) {
} else if (ednMsgCodeViewCurrentRedo == generateEventId) {
} else if (ednMsgCodeViewCurrentGotoLine == generateEventId) {
} else if (ednMsgCodeViewCurrentSetCharset == generateEventId) {
}
*/
else {
}
/*
switch (id)
{
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE:
SendMessage(EDN_MSG__BUFF_ID_SAVE, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE_AS:
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
break;
case EDN_MSG__CURRENT_REMOVE_LINE:
m_bufferManager->Get(m_bufferID)->RemoveLine();
break;
case EDN_MSG__CURRENT_SELECT_ALL:
m_bufferManager->Get(m_bufferID)->SelectAll();
break;
case EDN_MSG__CURRENT_UN_SELECT:
m_bufferManager->Get(m_bufferID)->SelectNone();
break;
case EDN_MSG__CURRENT_COPY:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Copy(dataID);
break;
case EDN_MSG__CURRENT_CUT:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Cut(dataID);
break;
case EDN_MSG__CURRENT_PASTE:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Paste(dataID);
break;
case EDN_MSG__CURRENT_FIND_PREVIOUS:
{
etk::String myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_FIND_NEXT:
{
etk::String myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_REPLACE:
{
etk::String myDataString;
SearchData::GetReplace(myDataString);
m_bufferManager->Get(m_bufferID)->Replace(myDataString);
}
break;
case EDN_MSG__CURRENT_REPLACE_ALL:
break;
case EDN_MSG__CURRENT_CLOSE:
SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
break;
case EDN_MSG__CURRENT_UNDO:
m_bufferManager->Get(m_bufferID)->Undo();
break;
case EDN_MSG__CURRENT_REDO:
m_bufferManager->Get(m_bufferID)->Redo();
break;
case EDN_MSG__CURRENT_GOTO_LINE:
if (dataID<0) {
dataID = 0;
}
m_bufferManager->Get(m_bufferID)->JumpAtLine(dataID);
break;
case EDN_MSG__REFRESH_DISPLAY:
break;
case EDN_MSG__CURRENT_SET_CHARSET:
m_bufferManager->Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ... Done under ...
break;
}
*/
// Force redraw of the widget
MarkToReedraw();
return true;
}
void CodeView::OnGetFocus(void)
{
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_bufferID);
ewol::KeyboardShow(ewol::KEYBOARD_MODE_CODE);
EDN_INFO("Focus - In");
}
void CodeView::OnLostFocus(void)
{
ewol::KeyboardHide();
EDN_INFO("Focus - out");
}
void CodeView::SetFontSize(int32_t size)
{
m_fontSize = size;
}
void CodeView::SetFontNameNormal(etk::String fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontNormal = fontID;
}
}
void CodeView::SetFontNameBold(etk::String fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontBold = fontID;
}
}
void CodeView::SetFontNameItalic(etk::String fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontItalic = fontID;
}
}
void CodeView::SetFontNameBoldItalic(etk::String fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontBoldItalic = fontID;
}
}

View File

@@ -1,79 +0,0 @@
/**
*******************************************************************************
* @file CodeView.h
* @brief Editeur De N'ours : Code Viewer Widget (header)
* @author Edouard DUPIN
* @date 05/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __CODE_VIEW_H__
#define __CODE_VIEW_H__
#include <tools_debug.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <Display.h>
#include <MsgBroadcast.h>
#include <etk/Types.h>
#include <ewol/Widget.h>
#include <ewol/widget/WidgetScrolled.h>
class CodeView :public ewol::WidgetScrooled
{
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);
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
public:
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
private:
int32_t m_fontSize;
int32_t m_fontNormal;
int32_t m_fontBold;
int32_t m_fontItalic;
int32_t m_fontBoldItalic;
public:
void SetFontSize(int32_t size);
void SetFontNameNormal(etk::String fontName);
void SetFontNameBold(etk::String fontName);
void SetFontNameItalic(etk::String fontName);
void SetFontNameBoldItalic(etk::String fontName);
private:
void CalculateMaxSize(void);
};
#endif

152
jni/edn/Gui/BufferView.cpp Normal file
View File

@@ -0,0 +1,152 @@
/**
*******************************************************************************
* @file BufferViewer.cpp
* @brief Editeur De N'ours : main textViewer diplayer
* @author Edouard DUPIN
* @date 04/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <Display.h>
#include <BufferView.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <MainWindows.h>
#include <ewol/EObject.h>
#undef __class__
#define __class__ "BufferView"
BufferView::BufferView(void)
{
SetCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferListChange);
RegisterMultiCast(ednMsgBufferState);
RegisterMultiCast(ednMsgBufferId);
m_selectedID = -1;
}
BufferView::~BufferView(void)
{
}
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
void BufferView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
ewol::List::OnReceiveMessage(CallerObject, eventId, data);
if (eventId == ednMsgBufferListChange) {
MarkToReedraw();
}else if (eventId == ednMsgBufferId) {
MarkToReedraw();
}else if (eventId == ednMsgBufferState) {
MarkToReedraw();
}
}
color_ts BufferView::GetBasicBG(void)
{
return ColorizeManager::Get(COLOR_LIST_BG_1);
}
uint32_t BufferView::GetNuberOfColomn(void)
{
return 1;
}
bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg)
{
myTitle = "Buffers : ";
return true;
}
uint32_t BufferView::GetNuberOfRaw(void)
{
return BufferManager::SizeOpen();
}
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg)
{
etk::File name;
bool isModify;
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1;
// transforme the ID in the real value ...
int32_t realID = BufferManager::WitchBuffer(raw+1);
if (BufferManager::Exist(realID)) {
isModify = BufferManager::Get(realID)->IsModify();
name = BufferManager::Get(realID)->GetFileName();
char *tmpModify = (char*)" ";
if (true == isModify) {
tmpModify = (char*)"M";
}
myTextToWrite = "[";
myTextToWrite += realID;
myTextToWrite += "](";
myTextToWrite += tmpModify;
myTextToWrite += ") ";
myTextToWrite += name.GetShortFilename();
if (true == isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY;
} else {
selectFG = COLOR_LIST_TEXT_NORMAL;
}
if (raw%2==0) {
selectBG = COLOR_LIST_BG_1;
} else {
selectBG = COLOR_LIST_BG_2;
}
if (m_selectedID == raw) {
selectBG = COLOR_LIST_BG_SELECTED;
}
} else {
myTextToWrite = "ERROR";
}
fg = ColorizeManager::Get(selectFG);
bg = ColorizeManager::Get(selectBG);
return true;
}
bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y)
{
if (1 == IdInput && typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
EDN_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
int32_t selectBuf = BufferManager::WitchBuffer(raw+1);
if ( 0 <= selectBuf) {
m_selectedID = raw;
SendMultiCast(ednMsgBufferId, selectBuf);
}
}
MarkToReedraw();
return false;
}

View File

@@ -40,20 +40,23 @@ class BufferView : public ewol::List
// Constructeur
BufferView(void);
~BufferView(void);
//GtkWidget *GetMainWidget(void);
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
protected:
// function call to display the list :
virtual color_ts GetBasicBG(void);
virtual uint32_t GetNuberOfColomn(void);
virtual bool GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg);
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg);
virtual uint32_t GetNuberOfRaw(void);
virtual bool GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg);
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg);
virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y);
private:
// récupération des proprieter général...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
int32_t m_selectedID;
};

459
jni/edn/Gui/CodeView.cpp Normal file
View File

@@ -0,0 +1,459 @@
/**
*******************************************************************************
* @file CodeView.cpp
* @brief Editeur De N'ours : Code Viewer Widget
* This is an abstraction
* @author Edouard DUPIN
* @date 05/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <CodeView.h>
#include <tools_debug.h>
#include <tools_globals.h>
#include <Display.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <ClipBoard.h>
#include <SearchData.h>
#include <ewol/WidgetManager.h>
#include <ewol/EObject.h>
#undef __class__
#define __class__ "ewol::CodeView"
CodeView::CodeView(void)
{
m_label = "CodeView is disable ...";
m_fontNormal = -1;
m_fontBold = -1;
m_fontItalic = -1;
m_fontBoldItalic = -1;
m_fontSize = 15;
m_bufferID = -1;
m_buttunOneSelected = false;
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);
RegisterMultiCast(ednMsgBufferId);
}
CodeView::~CodeView(void)
{
}
bool CodeView::CalculateMinSize(void)
{
m_minSize.x = 50;
m_minSize.y = 50;
return true;
}
void CodeView::CalculateMaxSize(void)
{
m_maxSize.x = 2048;
int32_t letterHeight = ewol::GetHeight(m_fontNormal);
m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight;
}
void CodeView::OnDraw(void)
{
m_OObjectsColored[ m_currentDrawId].Draw();
m_OObjectTextNormal[ m_currentDrawId].Draw();
m_OObjectTextBold[ m_currentDrawId].Draw();
m_OObjectTextItalic[ m_currentDrawId].Draw();
m_OObjectTextBoldItalic[m_currentDrawId].Draw();
}
void CodeView::OnRegenerateDisplay(void)
{
if (true == NeedRedraw()) {
int64_t startTime = GetCurrentTime();
// For the scrooling windows
CalculateMaxSize();
// clean internal elements ...
m_OObjectTextNormal[ m_currentCreateId].SetFontID(m_fontNormal);
m_OObjectTextBold[ m_currentCreateId].SetFontID(m_fontBold);
m_OObjectTextItalic[ m_currentCreateId].SetFontID(m_fontItalic);
m_OObjectTextBoldItalic[m_currentCreateId].SetFontID(m_fontBoldItalic);
m_OObjectTextNormal[ m_currentCreateId].Clear();
m_OObjectTextBold[ m_currentCreateId].Clear();
m_OObjectTextItalic[ m_currentCreateId].Clear();
m_OObjectTextBoldItalic[m_currentCreateId].Clear();
m_OObjectsColored[ m_currentCreateId].Clear();
// generate the objects :
BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal[m_currentCreateId],
m_OObjectTextBold[m_currentCreateId],
m_OObjectTextItalic[m_currentCreateId],
m_OObjectTextBoldItalic[m_currentCreateId],
m_OObjectsColored[m_currentCreateId],
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
int64_t stopTime = GetCurrentTime();
EDN_DEBUG("Display Code Generation = " << stopTime - startTime << " milli-s");
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
m_needFlipFlop = true;
}
}
bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
{
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
BufferManager::Get(m_bufferID)->AddChar(unicodeData);
MarkToReedraw();
}
return true;
}
bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent)
{
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
BufferManager::Get(m_bufferID)->cursorMove(moveTypeEvent);
MarkToReedraw();
}
return true;
}
/**
* @brief Event on an input of this Widget
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
* @param[in] pos Absolute position of the event
* @return true the event is used
* @return false the event is not used
*/
bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos)
{
coord2D_ts relativePos = RelativePosition(pos);
if (m_bufferID < 0) {
return false;
}
if (true == WidgetScrooled::OnEventInput(IdInput, typeEvent, pos)) {
ewol::widgetManager::FocusKeep(this);
// nothing to do ... done on upper widet ...
return true;
}
if (1 == IdInput) {
#ifndef __MODE__Touch
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
m_buttunOneSelected = true;
ewol::widgetManager::FocusKeep(this);
BufferManager::Get(m_bufferID)->MouseEvent(m_fontNormal, relativePos.x+m_originScrooled.x, relativePos.y+m_originScrooled.y);
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
m_buttunOneSelected = false;
BufferManager::Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
MarkToReedraw();
} else
#endif
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
#ifdef __MODE__Touch
ewol::widgetManager::FocusKeep(this);
BufferManager::Get(m_bufferID)->MouseEvent(m_fontNormal, relativePos.x+m_originScrooled.x, relativePos.y+m_originScrooled.y);
MarkToReedraw();
#else
// nothing to do ...
#endif
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
BufferManager::Get(m_bufferID)->MouseEventDouble();
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
BufferManager::Get(m_bufferID)->MouseEventTriple();
MarkToReedraw();
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
if (true == m_buttunOneSelected) {
int xxx, yyy;
xxx = relativePos.x;
yyy = relativePos.y;
if (xxx<0) {
xxx = 0;
}
if (yyy<0) {
yyy = 0;
}
//EDN_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
BufferManager::Get(m_bufferID)->MouseSelectFromCursorTo(m_fontNormal, xxx, yyy);
MarkToReedraw();
}
}
} else if (2 == IdInput) {
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
BufferManager::Get(m_bufferID)->MouseEvent(m_fontNormal, relativePos.x+m_originScrooled.x, relativePos.y+m_originScrooled.y);
BufferManager::Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
MarkToReedraw();
ewol::widgetManager::FocusKeep(this);
}
}
return true;
}
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
ewol::WidgetScrooled::OnReceiveMessage(CallerObject, eventId, data);
EDN_DEBUG("Extern Event : " << CallerObject << " type : " << eventId << " data=\"" << data << "\"");
if(eventId == ednMsgBufferId) {
int32_t bufferID = 0;
sscanf(data.Utf8Data(), "%d", &bufferID);
EDN_INFO("Select a new Buffer ... " << bufferID);
m_bufferID = bufferID;
// TODO : need to update the state of the file and the filenames ...
}
// old
/*
else if( ednMsgCodeViewCurrentChangeBufferId == generateEventId) {
int32_t bufferID = 0;
sscanf(data, "%d", &bufferID);
EDN_INFO("Select a new Buffer ... " << bufferID);
m_bufferID = bufferID;
BufferManager::Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferChangeCurrent, (char*)data);
}
*/
/*
else if (ednMsgCodeViewCurrentSave == generateEventId) {
} else if (ednMsgCodeViewCurrentSaveAs == generateEventId) {
} else if (ednMsgCodeViewCurrentSelectAll == generateEventId) {
} else if (ednMsgCodeViewCurrentRemoveLine == generateEventId) {
} else if (ednMsgCodeViewCurrentUnSelect == generateEventId) {
} else if (ednMsgCodeViewCurrentCopy == generateEventId) {
} else if (ednMsgCodeViewCurrentCut == generateEventId) {
} else if (ednMsgCodeViewCurrentPaste == generateEventId) {
} else if (ednMsgCodeViewCurrentFindPrevious == generateEventId) {
} else if (ednMsgCodeViewCurrentFindNext == generateEventId) {
} else if (ednMsgCodeViewCurrentFindOldNext == generateEventId) {
} else if (ednMsgCodeViewCurrentReplace == generateEventId) {
} else if (ednMsgCodeViewCurrentReplaceAll == generateEventId) {
} else if (ednMsgCodeViewCurrentClose == generateEventId) {
} else if (ednMsgCodeViewCurrentUndo == generateEventId) {
} else if (ednMsgCodeViewCurrentRedo == generateEventId) {
} else if (ednMsgCodeViewCurrentGotoLine == generateEventId) {
} else if (ednMsgCodeViewCurrentSetCharset == generateEventId) {
}
*/
else {
}
/*
switch (id)
{
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID;
BufferManager::Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE:
SendMessage(EDN_MSG__BUFF_ID_SAVE, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE_AS:
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
break;
case EDN_MSG__CURRENT_REMOVE_LINE:
BufferManager::Get(m_bufferID)->RemoveLine();
break;
case EDN_MSG__CURRENT_SELECT_ALL:
BufferManager::Get(m_bufferID)->SelectAll();
break;
case EDN_MSG__CURRENT_UN_SELECT:
BufferManager::Get(m_bufferID)->SelectNone();
break;
case EDN_MSG__CURRENT_COPY:
if (dataID == -1) {
dataID = COPY_STD;
}
BufferManager::Get(m_bufferID)->Copy(dataID);
break;
case EDN_MSG__CURRENT_CUT:
if (dataID == -1) {
dataID = COPY_STD;
}
BufferManager::Get(m_bufferID)->Cut(dataID);
break;
case EDN_MSG__CURRENT_PASTE:
if (dataID == -1) {
dataID = COPY_STD;
}
BufferManager::Get(m_bufferID)->Paste(dataID);
break;
case EDN_MSG__CURRENT_FIND_PREVIOUS:
{
etk::UString myDataString;
SearchData::GetSearch(myDataString);
BufferManager::Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_FIND_NEXT:
{
etk::UString myDataString;
SearchData::GetSearch(myDataString);
BufferManager::Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_REPLACE:
{
etk::UString myDataString;
SearchData::GetReplace(myDataString);
BufferManager::Get(m_bufferID)->Replace(myDataString);
}
break;
case EDN_MSG__CURRENT_REPLACE_ALL:
break;
case EDN_MSG__CURRENT_CLOSE:
SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
break;
case EDN_MSG__CURRENT_UNDO:
BufferManager::Get(m_bufferID)->Undo();
break;
case EDN_MSG__CURRENT_REDO:
BufferManager::Get(m_bufferID)->Redo();
break;
case EDN_MSG__CURRENT_GOTO_LINE:
if (dataID<0) {
dataID = 0;
}
BufferManager::Get(m_bufferID)->JumpAtLine(dataID);
break;
case EDN_MSG__REFRESH_DISPLAY:
break;
case EDN_MSG__CURRENT_SET_CHARSET:
BufferManager::Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ... Done under ...
break;
}
*/
// Force redraw of the widget
MarkToReedraw();
}
void CodeView::OnGetFocus(void)
{
/*
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_bufferID);
*/
ewol::KeyboardShow(ewol::KEYBOARD_MODE_CODE);
EDN_INFO("Focus - In");
}
void CodeView::OnLostFocus(void)
{
ewol::KeyboardHide();
EDN_INFO("Focus - out");
}
void CodeView::SetFontSize(int32_t size)
{
m_fontSize = size;
}
void CodeView::SetFontNameNormal(etk::UString fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontNormal = fontID;
}
}
void CodeView::SetFontNameBold(etk::UString fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontBold = fontID;
}
}
void CodeView::SetFontNameItalic(etk::UString fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontItalic = fontID;
}
}
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
{
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
if (fontID >= 0) {
m_fontBoldItalic = fontID;
}
}

100
jni/edn/Gui/CodeView.h Normal file
View File

@@ -0,0 +1,100 @@
/**
*******************************************************************************
* @file CodeView.h
* @brief Editeur De N'ours : Code Viewer Widget (header)
* @author Edouard DUPIN
* @date 05/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __CODE_VIEW_H__
#define __CODE_VIEW_H__
#include <tools_debug.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <Display.h>
#include <MsgBroadcast.h>
#include <etk/Types.h>
#include <ewol/widget/WidgetScrolled.h>
class CodeView :public ewol::WidgetScrooled
{
public:
CodeView(void);
virtual ~CodeView(void);
virtual bool CalculateMinSize(void);
private:
etk::UString m_label;
color_ts m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color
int32_t m_bufferID;
bool m_buttunOneSelected;
// drawing elements :
ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER];
ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER];
ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER];
ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER];
ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER];
public:
virtual void OnRegenerateDisplay(void);
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
public:
/**
* @brief Event on an input of this Widget
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
* @param[in] pos Absolute position of the event
* @return true the event is used
* @return false the event is not used
*/
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos);
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
private:
int32_t m_fontSize;
int32_t m_fontNormal;
int32_t m_fontBold;
int32_t m_fontItalic;
int32_t m_fontBoldItalic;
public:
void SetFontSize(int32_t size);
void SetFontNameNormal(etk::UString fontName);
void SetFontNameBold(etk::UString fontName);
void SetFontNameItalic(etk::UString fontName);
void SetFontNameBoldItalic(etk::UString fontName);
private:
void CalculateMaxSize(void);
protected:
virtual void OnDraw(void);
};
#endif

287
jni/edn/Gui/MainWindows.cpp Normal file
View File

@@ -0,0 +1,287 @@
/**
*******************************************************************************
* @file MainWindows.cpp
* @brief Editeur De N'ours : main Windows diplayer (Sources)
* @author Edouard DUPIN
* @date 04/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <MainWindows.h>
#include <CodeView.h>
#include <ClipBoard.h>
#include <BufferView.h>
#include <ewol/widget/Button.h>
#include <ewol/widget/CheckBox.h>
#include <ewol/widget/SizerHori.h>
#include <ewol/widget/SizerVert.h>
#include <ewol/widget/Label.h>
#include <ewol/widget/Entry.h>
#include <ewol/widget/List.h>
#include <ewol/widget/ContextMenu.h>
#include <ewol/widget/PopUp.h>
#include <ewol/widget/Spacer.h>
#include <ewol/widget/Menu.h>
#include <ewol/widgetMeta/FileChooser.h>
#include <ewol/WidgetManager.h>
#include <ewol/EObject.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;
CodeView * myCodeView = NULL;
BufferView * myBufferView = NULL;
ewol::Menu * myMenu = NULL;
mySizerVert = new ewol::SizerVert();
SetSubWidget(mySizerVert);
mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori);
myMenu = new ewol::Menu();
mySizerHori->SubWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->AddTitle("File");
(void)myMenu->Add(idMenuFile, "New", "", ednMsgGuiNew);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuFile, "Open", "", ednMsgGuiOpen);
(void)myMenu->Add(idMenuFile, "Close", "", ednMsgGuiClose, "current");
(void)myMenu->Add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
(void)myMenu->Add(idMenuFile, "Save", "", ednMsgGuiSave, "current");
(void)myMenu->Add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
(void)myMenu->AddSpacer();
//(void)myMenu->Add(idMenuFile, "Exit", "", ednMsgGuiExit);
int32_t idMenuEdit = myMenu->AddTitle("Edit");
(void)myMenu->Add(idMenuEdit, "Undo", "", ednMsgGuiUndo);
(void)myMenu->Add(idMenuEdit, "Redo", "", ednMsgGuiRedo);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
(void)myMenu->Add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
(void)myMenu->Add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
(void)myMenu->Add(idMenuEdit, "Redo", "", ednMsgGuiRedo);
(void)myMenu->Add(idMenuEdit, "Remove","", ednMsgGuiRm);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
(void)myMenu->Add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
(void)myMenu->Add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
int32_t idMenuSearch = myMenu->AddTitle("Search");
(void)myMenu->Add(idMenuSearch, "Search", "", ednMsgGuiSearch);
(void)myMenu->Add(idMenuSearch, "Replace", "", ednMsgGuiReplace);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
(void)myMenu->Add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
(void)myMenu->Add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
(void)myMenu->Add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
int32_t idMenuCTags = myMenu->AddTitle("C-tags");
(void)myMenu->Add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
(void)myMenu->Add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
(void)myMenu->Add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
(void)myMenu->Add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
(void)myMenu->AddTitle("?", "", ednMsgGuiAbout);
m_widgetLabelFileName = new ewol::Label("FileName");
m_widgetLabelFileName->SetExpendX(true);
m_widgetLabelFileName->SetFillY(true);
mySizerHori->SubWidgetAdd(m_widgetLabelFileName);
mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori);
myBufferView = new BufferView();
myBufferView->SetExpendX(false);
myBufferView->SetExpendY(true);
myBufferView->SetFillX(true);
myBufferView->SetFillY(true);
mySizerHori->SubWidgetAdd(myBufferView);
myCodeView = new CodeView();
myCodeView->SetExpendX(true);
myCodeView->SetExpendY(true);
myCodeView->SetFillX(true);
myCodeView->SetFillY(true);
myCodeView->SetFontSize(11);
myCodeView->SetFontNameNormal( "freefont/FreeMono.ttf");
myCodeView->SetFontNameBold( "freefont/FreeMonoBold.ttf");
myCodeView->SetFontNameItalic( "freefont/FreeMonoOblique.ttf");
myCodeView->SetFontNameBoldItalic("freefont/FreeMonoBoldOblique.ttf");
/*
myCodeView->SetFontSize(11);
myCodeView->SetFontNameNormal( "ubuntu/UbuntuMono-R.ttf");
myCodeView->SetFontNameBold( "ubuntu/UbuntuMono-B.ttf");
myCodeView->SetFontNameItalic( "ubuntu/UbuntuMono-RI.ttf");
myCodeView->SetFontNameBoldItalic("ubuntu/UbuntuMono-BI.ttf");
*/
mySizerHori->SubWidgetAdd(myCodeView);
// Generic event ...
RegisterMultiCast(ednMsgGuiSaveAs);
RegisterMultiCast(ednMsgGuiOpen);
RegisterMultiCast(ednMsgGuiAbout);
// to update the title ...
RegisterMultiCast(ednMsgBufferState);
RegisterMultiCast(ednMsgBufferId);
}
MainWindows::~MainWindows(void)
{
}
const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
ewol::Windows::OnReceiveMessage(CallerObject, eventId, data);
EDN_INFO("Receive Event from the main windows ... : widgetid=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" );
// Open file Section ...
if (eventId == ednMsgGuiOpen) {
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
tmpWidget->SetTitle("Open Files ...");
tmpWidget->SetValidateLabel("Open");
// TODO : Set the good folder ...
//tmpWidget->SetFolder("/");
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
} else if (eventId == ednEventPopUpFileSelected) {
// get widget:
ewol::FileChooser * tmpWidget = static_cast<ewol::FileChooser*>(CallerObject);
if (NULL == tmpWidget) {
EDN_ERROR("impossible to get pop_upWidget " << CallerObject);
return;
}
// get the filename :
etk::UString tmpData = tmpWidget->GetCompleateFileName();
EDN_DEBUG("Request opening the file : " << tmpData);
SendMultiCast(ednMsgOpenFile, tmpData);
} else if (eventId == ednMsgGuiSaveAs) {
if (data == "") {
EDN_ERROR("Null data for Save As file ... ");
} else {
m_currentSavingAsIdBuffer = -1;
if (data == "current") {
m_currentSavingAsIdBuffer = BufferManager::GetSelected();
} else {
sscanf(data.Utf8Data(), "%d", &m_currentSavingAsIdBuffer);
}
if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) {
EDN_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
} else {
Buffer * myBuffer = BufferManager::Get(m_currentSavingAsIdBuffer);
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
tmpWidget->SetTitle("Save Files As...");
tmpWidget->SetValidateLabel("Save");
etk::UString folder = "/home/";
etk::UString fileName = "";
if (true == myBuffer->HaveName()) {
etk::File tmpName = myBuffer->GetFileName();
folder = tmpName.GetFolder();
fileName = tmpName.GetShortFilename();
}
tmpWidget->SetFolder(folder);
tmpWidget->SetFileName(fileName);
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
}
}
} else if (eventId == ednEventPopUpFileSaveAs) {
// get widget:
ewol::FileChooser * tmpWidget = static_cast<ewol::FileChooser*>(CallerObject);
if (NULL == tmpWidget) {
EDN_ERROR("impossible to get pop_upWidget " << CallerObject);
return;
}
// get the filename :
etk::UString tmpData = tmpWidget->GetCompleateFileName();
EDN_DEBUG("Request Saving As file : " << tmpData);
BufferManager::Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);
SendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
} else if( eventId == ednMsgBufferState
|| eventId == ednMsgBufferId) {
// the buffer change we need to update the widget string
Buffer* tmpBuffer = BufferManager::Get(BufferManager::GetSelected());
if (NULL != tmpBuffer) {
etk::File compleateName = tmpBuffer->GetFileName();
bool isModify = tmpBuffer->IsModify();
etk::UString directName = compleateName.GetCompleateName();
if (true == isModify) {
directName += " *";
}
if (NULL == m_widgetLabelFileName) {
return;
}
m_widgetLabelFileName->SetLabel(directName);
return;
}
return;
// TODO : Set the Title ....
} else if (eventId == ednMsgGuiAbout) {
/*
//Title
"Edn"
// version
VERSION_TAG_NAME
// comments:
"Editeur De N'ours\n"
"L'Editeur Desoxyribo-Nucleique.\n"
"Source Code Editor\n"
"Build Time : " VERSION_BUILD_TIME;
// copyright
"Copyright 2010 Edouard DUPIN, all right reserved";
// licence
"This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY\n\n"
"You can:\n"
" * Redistribute the sources code and binaries.\n"
" * Modify the Sources code.\n"
" * Use a part of the sources (less than 50%) in an other software, just write somewhere \"Edn is great\" visible by the user (on your product or on your website with a link to my page).\n"
" * Redistribute the modification only if you want.\n"
" * Send me the bug-fix (it could be great).\n"
" * Pay me a beer or some other things.\n"
" * Print the source code on WC paper ...\n\n"
"You can NOT:\n"
" * Earn money with this Software (But I can).\n"
" * Add malware in the Sources.\n"
" * Do something bad with the sources.\n"
" * Use it to travel in the space with a toaster.\n\n"
"I reserve the right to change this licence. If it change the version of the copy you have keep its own license."
*/
}
return;
}

View File

@@ -25,58 +25,33 @@
#include <tools_debug.h>
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include <CodeView.h>
#include <BufferView.h>
#include <BufferManager.h>
#include <MenuBar.h>
#include <StatusBar.h>
#include <ToolBar.h>
#include <ewol/widget/Label.h>
#ifndef __MAIN_WINDOWS_H__
#define __MAIN_WINDOWS_H__
#if 0
class MainWindows: public etk::Singleton<MainWindows>, public MsgBroadcast
{
friend class etk::Singleton<MainWindows>;
// specific for sigleton system...
private:
// Constructeur
MainWindows(void);
~MainWindows(void);
public:
//GtkWidget * GetWidget(void) { return m_mainWindow;};
void OnMessage(int32_t id, int32_t dataID);
//static bool OnQuit(GtkWidget *widget, gpointer data);
//static gboolean OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data);
private:
void SetTitle(etk::File &fileName, bool isModify);
void SetNoTitle(void);
// main windows widget :
/*
GtkWidget * m_mainWindow;
GtkWidget * m_internalTitleLabel;
BufferView m_BufferView;
CodeView m_CodeView;
MenuBar m_MenuBar;
StatusBar m_StatusBar;
ToolBar m_ToolBar;
*/
};
#endif
class MainWindows : public ewol::Windows
{
private:
int32_t m_currentSavingAsIdBuffer;
ewol::Label* m_widgetLabelFileName;
public:
// Constructeur
MainWindows(void);
~MainWindows(void);
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y);
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
};
#endif

View File

@@ -195,7 +195,7 @@ void Search::Display(GtkWindow *parent)
gtk_widget_set_sensitive(m_CkMatchCase, true);
}
// Remove data form the search
etk::String myDataString = "";
etk::UString myDataString = "";
SearchData::SetSearch(myDataString);
gtk_entry_set_text(GTK_ENTRY(m_searchEntry), myDataString.c_str());
if (0 == strlen(myDataString.c_str())) {
@@ -277,7 +277,7 @@ void Search::OnButtonReplaceAndNext(GtkWidget *widget, gpointer data)
void Search::OnButtonQuit(GtkWidget *widget, gpointer data)
{
//EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data);
Search * self = static_cast<Search*>(data);
self->Destroy();
}
@@ -304,7 +304,7 @@ void Search::OnCheckBoxEventCase(GtkWidget *widget, gpointer data)
void Search::OnCheckBoxEventRegExp(GtkWidget *widget, gpointer data)
{
//EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data);
Search * self = static_cast<Search*>(data);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
SearchData::SetRegExp(true);
gtk_widget_set_sensitive(self->m_CkMatchCase, false);
@@ -317,11 +317,11 @@ void Search::OnCheckBoxEventRegExp(GtkWidget *widget, gpointer data)
void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
{
//EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data);
Search * self = static_cast<Search*>(data);
// update research data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) {
etk::String myDataString = testData;
etk::UString myDataString = testData;
SearchData::SetSearch(myDataString);
if (0 == strlen(testData)) {
self->m_haveSearchData = false;
@@ -343,11 +343,11 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
{
//EDN_INFO("CALLBACK");
Search * self = reinterpret_cast<Search*>(data);
Search * self = static_cast<Search*>(data);
// update replace data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) {
etk::String myDataString = testData;
etk::UString myDataString = testData;
SearchData::SetReplace(myDataString);
if (0 == strlen(testData)) {
self->m_haveReplaceData = false;

View File

@@ -27,14 +27,11 @@
#define __SEARCH_H__
#include <tools_debug.h>
#include <etk/Singleton.h>
class Search: public etk::Singleton<Search>
class Search
{
friend class etk::Singleton<Search>;
// specific for sigleton system...
private:
public:
// Constructeur
Search(void);
~Search(void);

View File

@@ -31,13 +31,13 @@
#define __class__ "SearchData"
static etk::String m_findRequest = "";
static etk::UString m_findRequest = "";
void SearchData::SetSearch(etk::String &myData)
void SearchData::SetSearch(etk::UString &myData)
{
m_findRequest = myData;
}
void SearchData::GetSearch(etk::String &myData)
void SearchData::GetSearch(etk::UString &myData)
{
myData = m_findRequest;
}
@@ -49,12 +49,12 @@ bool SearchData::IsSearchEmpty(void)
return true;
}
static etk::String m_replaceRequest = "";
void SearchData::SetReplace(etk::String &myData)
static etk::UString m_replaceRequest = "";
void SearchData::SetReplace(etk::UString &myData)
{
m_replaceRequest = myData;
}
void SearchData::GetReplace(etk::String &myData)
void SearchData::GetReplace(etk::UString &myData)
{
myData = m_replaceRequest;
}

View File

@@ -30,11 +30,11 @@
namespace SearchData
{
void SetSearch(etk::String &myData);
void GetSearch(etk::String &myData);
void SetSearch(etk::UString &myData);
void GetSearch(etk::UString &myData);
bool IsSearchEmpty(void);
void SetReplace(etk::String &myData);
void GetReplace(etk::String &myData);
void SetReplace(etk::UString &myData);
void GetReplace(etk::UString &myData);
bool IsReplaceEmpty(void);
void SetCase(bool value);
bool GetCase(void);

View File

@@ -1,423 +0,0 @@
/**
*******************************************************************************
* @file MainWindows.cpp
* @brief Editeur De N'ours : main Windows diplayer (Sources)
* @author Edouard DUPIN
* @date 04/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <MainWindows.h>
#include <CodeView.h>
#include <ClipBoard.h>
#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>
#include <ewol/WidgetMessageMultiCast.h>
#undef __class__
#define __class__ "MainWindows"
const char * const ednEventNewFile = "edn-New-File";
const char * const ednEventOpenFile = "edn-Open-File";
const char * const ednEventCloseFile = "edn-Close-File";
const char * const ednEventSaveFile = "edn-Save-File";
const char * const ednEventSaveAsFile = "edn-SaveAs-File";
const char * const ednEventPopUpClose = "edn-PopUp-Close";
const char * const ednEventPopUpFileSelected = "edn-PopUp-FileSelected";
const char * const ednEventPopUpFileSaveAs = "edn-PopUp-FileSaveAs";
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;
BufferView * myBufferView = NULL;
mySizerVert = new ewol::SizerVert();
SetSubWidget(mySizerVert);
mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori);
myButton = new ewol::Button("New");
mySizerHori->SubWidgetAdd(myButton);
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventNewFile) ) {
EDN_CRITICAL("link with an entry event");
}
myButton = new ewol::Button("Open");
mySizerHori->SubWidgetAdd(myButton);
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventOpenFile) ) {
EDN_CRITICAL("link with an entry event");
}
myButton = new ewol::Button("Close");
mySizerHori->SubWidgetAdd(myButton);
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventCloseFile) ) {
EDN_CRITICAL("link with an entry event");
}
myButton = new ewol::Button("Save");
mySizerHori->SubWidgetAdd(myButton);
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventSaveFile) ) {
EDN_CRITICAL("link with an entry event");
}
myButton = new ewol::Button("Save As ...");
mySizerHori->SubWidgetAdd(myButton);
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventSaveAsFile) ) {
EDN_CRITICAL("link with an entry event");
}
myLabel = new ewol::Label("FileName");
myLabel->SetExpendX(true);
myLabel->SetFillY(true);
mySizerHori->SubWidgetAdd(myLabel);
mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori);
myBufferView = new BufferView();
myBufferView->SetExpendX(false);
myBufferView->SetExpendY(true);
myBufferView->SetFillX(true);
myBufferView->SetFillY(true);
mySizerHori->SubWidgetAdd(myBufferView);
myCodeView = new CodeView();
myCodeView->SetExpendX(true);
myCodeView->SetExpendY(true);
myCodeView->SetFillX(true);
myCodeView->SetFillY(true);
myCodeView->SetFontSize(11);
myCodeView->SetFontNameNormal( "freefont/FreeMono.ttf");
myCodeView->SetFontNameBold( "freefont/FreeMonoBold.ttf");
myCodeView->SetFontNameItalic( "freefont/FreeMonoOblique.ttf");
myCodeView->SetFontNameBoldItalic("freefont/FreeMonoBoldOblique.ttf");
/*
myCodeView->SetFontSize(11);
myCodeView->SetFontNameNormal( "ubuntu/UbuntuMono-R.ttf");
myCodeView->SetFontNameBold( "ubuntu/UbuntuMono-B.ttf");
myCodeView->SetFontNameItalic( "ubuntu/UbuntuMono-RI.ttf");
myCodeView->SetFontNameBoldItalic("ubuntu/UbuntuMono-BI.ttf");
*/
mySizerHori->SubWidgetAdd(myCodeView);
// Generic event ...
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiSaveAs);
}
MainWindows::~MainWindows(void)
{
}
bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
{
if (true == ewol::Windows::OnEventAreaExternal(widgetID, generateEventId, data, x, y) ) {
return true;
}
//EDN_INFO("Receive Event from the main windows ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
// newFile section ...
if (generateEventId == ednEventNewFile) {
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiNew);
}
else if (generateEventId == ednEventCloseFile) {
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiClose, "current");
}
else if (generateEventId == ednEventSaveFile) {
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiSave, "current");
}
else if (generateEventId == ednEventSaveAsFile) {
OnEventAreaExternal(GetWidgetId(), ednMsgGuiSaveAs, "current", x, y);
}
// Open file Section ...
else if (generateEventId == ednEventOpenFile) {
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
tmpWidget->SetTitle("Open Files ...");
tmpWidget->SetValidateLabel("Open");
// TODO : Set the good folder ...
//tmpWidget->SetFolder("/");
PopUpWidgetPush(tmpWidget);
if (false == tmpWidget->ExternLinkOnEvent(ewolEventFileChooserCancel, GetWidgetId(), ednEventPopUpClose) ) {
EDN_CRITICAL("link with an entry event");
}
if (false == tmpWidget->ExternLinkOnEvent(ewolEventFileChooserValidate, GetWidgetId(), ednEventPopUpFileSelected) ) {
EDN_CRITICAL("link with an entry event");
}
} else if (generateEventId == ednEventPopUpClose) {
// TODO : Set this in the upper windows ...
PopUpWidgetPop();
} else if (generateEventId == ednEventPopUpFileSelected) {
// get widget:
ewol::FileChooser * tmpWidget = (ewol::FileChooser*)ewol::widgetManager::Get(widgetID);
if (NULL == tmpWidget) {
EDN_ERROR("impossible to get pop_upWidget " << widgetID);
PopUpWidgetPop();
return false;
}
// get the filename :
etk::String tmpData = tmpWidget->GetCompleateFileName();
EDN_DEBUG("Request opening the file : " << tmpData);
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgOpenFile, tmpData.c_str());
PopUpWidgetPop();
} else if (generateEventId == ednMsgGuiSaveAs) {
if (NULL == data) {
EDN_ERROR("Null data for Save As file ... ");
} else {
BufferManager * myMng = BufferManager::getInstance();
m_currentSavingAsIdBuffer = -1;
if (0 == strcmp(data , "current")) {
m_currentSavingAsIdBuffer = myMng->GetSelected();
} else {
sscanf(data, "%d", &m_currentSavingAsIdBuffer);
}
if (false == myMng->Exist(m_currentSavingAsIdBuffer)) {
EDN_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
} else {
Buffer * myBuffer = myMng->Get(m_currentSavingAsIdBuffer);
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
tmpWidget->SetTitle("Save Files As...");
tmpWidget->SetValidateLabel("Save");
etk::String folder = "/home/";
etk::String fileName = "";
if (true == myBuffer->HaveName()) {
etk::File tmpName = myBuffer->GetFileName();
folder = tmpName.GetFolder();
fileName = tmpName.GetShortFilename();
}
tmpWidget->SetFolder(folder);
tmpWidget->SetFileName(fileName);
PopUpWidgetPush(tmpWidget);
if (false == tmpWidget->ExternLinkOnEvent(ewolEventFileChooserCancel, GetWidgetId(), ednEventPopUpClose) ) {
EDN_CRITICAL("link with an entry event");
}
if (false == tmpWidget->ExternLinkOnEvent(ewolEventFileChooserValidate, GetWidgetId(), ednEventPopUpFileSaveAs) ) {
EDN_CRITICAL("link with an entry event");
}
}
}
} else if (generateEventId == ednEventPopUpFileSaveAs) {
PopUpWidgetPop();
}
return true;
}
#ifdef SDFGSDFGSDF___SDFGSDFG
MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
{
m_mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// select the program icone
GError *err = NULL;
etk::String iconeFile;
iconeFile = "/usr/share/edn/images/icone.png";
GdkPixbuf * icone = gdk_pixbuf_new_from_file(iconeFile.c_str(), &err);
if (err != NULL) {
gtk_window_set_default_icon_name("text-editor");
} else {
gtk_window_set_icon(GTK_WINDOW(m_mainWindow), icone);
}
// 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);
// 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);
// Set key Accelerator :
AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_mainWindow));
// Create the menu bar.
GtkWidget *hboxMenu = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start( GTK_BOX (vbox), hboxMenu, FALSE, FALSE, 0);
// Add Exit boutton
etk::String ExitIconeFile;
ExitIconeFile = "/usr/share/edn/images/delete-24px.png";
// 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;
//EDN_DEBUG(" plop : " << mySize);
//gtk_image_get_icon_set( GTK_IMAGE(myImageQuit), NULL, &mySize);
//EDN_DEBUG(" plop : " << mySize);
GtkWidget *event_box = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(event_box),myImageQuit);
gtk_widget_add_events(event_box,GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(event_box), "button_press_event", G_CALLBACK(OnQuit), this);
gtk_box_pack_start( GTK_BOX(hboxMenu), event_box, FALSE, FALSE, 0);
// add the real menu bar
gtk_box_pack_start( GTK_BOX (hboxMenu), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
// Add title
m_internalTitleLabel = gtk_label_new("Edn");
gtk_box_pack_start( GTK_BOX (hboxMenu), m_internalTitleLabel, FALSE, FALSE, 0);
// **********************************************************
// * Horizontal ELEMENTS : *
// **********************************************************
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER (vbox), hbox);
// create the toolbar :
// TreeView :
gtk_box_pack_start(GTK_BOX(hbox), m_BufferView.GetMainWidget(), FALSE, TRUE, 1);
// Text displayer :
gtk_box_pack_start( GTK_BOX (hbox), m_CodeView.GetMainWidget(), TRUE, TRUE, 0);
// Create the status bar
//gtk_box_pack_end(GTK_BOX(vbox), m_StatusBar.GetWidget(), FALSE, FALSE, 0);
// recursive version of gtk_widget_show
gtk_widget_show_all(m_mainWindow);
MainWindows::~MainWindows(void)
{
/*
if (NULL != m_DlgSearch) {
delete m_DlgSearch;
}
*/
}
void MainWindows::SetTitle(etk::File &fileName, bool isModify)
{
etk::String tmp = "";
if (fileName.GetShortFilename() != "") {
tmp += fileName.GetShortFilename();
tmp += " - ";
tmp += fileName.GetFolder();
tmp += " - ";
}
tmp += "Edn";
//gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
tmp = " ";
if (fileName.GetShortFilename() != "") {
tmp += fileName.GetFolder();
tmp += "/";
tmp += fileName.GetShortFilename();
} else {
tmp += "Edn";
}
tmp += " ";
//gtk_label_set_text(GTK_LABEL(m_internalTitleLabel), tmp.c_str());
}
void MainWindows::SetNoTitle(void)
{
etk::String tmp = "Edn";
//gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
//gtk_label_set_text(GTK_LABEL(m_internalTitleLabel), tmp.c_str());
}
void MainWindows::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
// change Title :
// TODO : String error when remove the error with -1;
if (-1 == dataID) {
SetNoTitle();
} else {
/*
Buffer *mybuf = BufferManager::getInstance()->Get(dataID);
if (NULL != mybuf) {
etk::File plop = mybuf->GetFileName();
SetTitle(plop, mybuf->IsModify() );
}
*/
}
break;
}
}
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
{
//MainWindows * self = reinterpret_cast<MainWindows*>(data);
GeneralSendMessage(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION);
// Close is not managed here ...
return true;
}
gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data)
{
MainWindows * self = reinterpret_cast<MainWindows*>(data);
EDN_DEBUG("State change");
EDN_INFO(" change state mask : " << event->window_state.changed_mask);
EDN_INFO(" change state new val : " << event->window_state.new_window_state);
if (event->window_state.changed_mask == GDK_WINDOW_STATE_MAXIMIZED) {
EDN_INFO(" ==> Maximisation change...");
if (event->window_state.new_window_state == GDK_WINDOW_STATE_MAXIMIZED) {
EDN_INFO(" ==> ENABLE");
gtk_window_set_decorated(GTK_WINDOW(self->m_mainWindow), FALSE);
} else {
EDN_INFO(" ==> DISABLE");
gtk_window_set_decorated(GTK_WINDOW(self->m_mainWindow), TRUE);
}
}
}
#endif

View File

@@ -1,386 +0,0 @@
/**
*******************************************************************************
* @file MenuBar.cpp
* @brief Editeur De N'ours : abstraction of the menu bar (Sources)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <MenuBar.h>
#include <ClipBoard.h>
#include <etk/unicode.h>
#include <ColorizeManager.h>
#if 0
#define MENU_MSG
const char * MSG_TogleDisplayChar = "Request a Togle of char displaying";
const char * MSG_TogleDisplayEOL = "Request a Togle of displaying EndOfLine";
const char * MSG_TogleAutoIndent = "Request a Togle of Auto Indent";
const char * MSG_SetCharsetIso559_1 = "Set ISO 5589-1";
const char * MSG_SetCharsetIso559_15 = "Set ISO 5589-15";
const char * MSG_SetCharsetUTF8 = "Set UTF 8";
const char * MSG_LoadColorBlack = "Load Color Black";
const char * MSG_LoadColorWhite = "Load Color White";
#define MSG_LINK(data)
static void CB_menuGenerique(GtkMenuItem *menu_item, gpointer data)
{
//EDN_INFO("basic menue_event");
messageData_ts * msg = (messageData_ts*)data;
GeneralSendMessage(msg->msgId, msg->dataId);
}
static void CB_menuInternal(GtkMenuItem *menu_item, gpointer data)
{
//EDN_INFO("basic menue_event");
const char * myPointer = (const char*)data;
if (myPointer == MSG_TogleDisplayChar) {
if (globals::IsSetDisplaySpaceChar() == true) {
globals::SetDisplaySpaceChar(false);
} else {
globals::SetDisplaySpaceChar(true);
}
} else if (myPointer == MSG_TogleDisplayEOL) {
if (globals::IsSetDisplayEndOfLine() == true) {
globals::SetDisplayEndOfLine(false);
} else {
globals::SetDisplayEndOfLine(true);
}
} else if (myPointer == MSG_TogleAutoIndent) {
if (globals::IsSetAutoIndent() == true) {
globals::SetAutoIndent(false);
} else {
globals::SetAutoIndent(true);
}
} else if (myPointer == MSG_SetCharsetIso559_1) {
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_ISO_8859_1);
} else if (myPointer == MSG_SetCharsetIso559_15) {
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_ISO_8859_15);
} else if (myPointer == MSG_SetCharsetUTF8) {
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_UTF8);
} else if (myPointer == MSG_LoadColorWhite) {
ColorizeManager * myColorSystem = ColorizeManager::getInstance();
etk::String homedir;
# ifdef NDEBUG
homedir = "/usr/share/edn/";
# else
homedir = "./data/";
# endif
homedir += "color_white.xml";
myColorSystem->LoadFile(homedir);
} else if (myPointer == MSG_LoadColorBlack) {
ColorizeManager * myColorSystem = ColorizeManager::getInstance();
etk::String homedir;
# ifdef NDEBUG
homedir = "/usr/share/edn/";
# else
homedir = "./data/";
# endif
homedir += "color_black.xml";
myColorSystem->LoadFile(homedir);
}
}
#undef __class__
#define __class__ "MenuBarMain"
class MenuBarMain
{
public:
MenuBarMain(const char * title, GtkWidget * parent) : m_parent(NULL), m_menu(NULL), m_menuListe(NULL)
{
m_parent = parent;
m_menu = gtk_menu_item_new_with_mnemonic(title);
gtk_menu_shell_append( GTK_MENU_SHELL (parent), m_menu);
}
~MenuBarMain(void)
{
}
private:
void CheckSubMenu(void)
{
if (NULL == m_menuListe) {
m_menuListe = gtk_menu_new();
if (NULL != m_menuListe) {
gtk_menu_item_set_submenu( GTK_MENU_ITEM (m_menu), m_menuListe);
} else {
EDN_ERROR("Can not create sub menu");
}
}
}
public:
void AddInternal(const char * title, const char * accelKey, const char * msg, bool enable = false)
{
CheckSubMenu();
if (NULL == m_menuListe) {
return;
}
// create ITEM
GtkWidget *tmpWidget = gtk_menu_item_new_with_mnemonic(title);
// set grisage :
gtk_widget_set_sensitive(tmpWidget, enable);
// add to the menu :
gtk_menu_shell_append(GTK_MENU_SHELL(m_menuListe), tmpWidget);
// accel KEY :
AccelKey::getInstance()->SetAccel(tmpWidget, (char *)accelKey);
// set callback
g_signal_connect(G_OBJECT(tmpWidget), "activate", G_CALLBACK(CB_menuInternal), (void*)msg);
}
void Add(const char * title, const char * accelKey, messageType_te id = EDN_MSG__NONE, bool enable = false, int32_t dataSpecificID = -1)
{
CheckSubMenu();
if (NULL == m_menuListe) {
return;
}
messageData_ts * message = new messageData_ts;
message->msgId = id;
message->dataId = dataSpecificID;
m_message.PushBack(message);
// create ITEM
GtkWidget *tmpWidget = gtk_menu_item_new_with_mnemonic(title);
// set grisage :
gtk_widget_set_sensitive(tmpWidget, enable);
// add to the menu :
gtk_menu_shell_append(GTK_MENU_SHELL(m_menuListe), tmpWidget);
// accel KEY :
AccelKey::getInstance()->SetAccel(tmpWidget, (char *)accelKey);
// set callback
if(EDN_MSG__NONE!=id) {
g_signal_connect(G_OBJECT(tmpWidget), "activate", G_CALLBACK(CB_menuGenerique), message);
}
}
void AddGen(const char * title, const char * accelKey, messageType_te id = EDN_MSG__NONE, bool enable = false, int32_t dataSpecificID = -1)
{
CheckSubMenu();
if (NULL == m_menuListe) {
return;
}
messageData_ts * message = new messageData_ts;
message->msgId = id;
message->dataId = dataSpecificID;
m_message.PushBack(message);
// create ITEM
GtkWidget *tmpWidget = gtk_image_menu_item_new_from_stock( title, AccelKey::getInstance()->GetAccel() );
GdkColor color;
gdk_color_parse ("red", &color);
gtk_widget_modify_fg(tmpWidget, GTK_STATE_NORMAL, &color);
gtk_widget_modify_bg(tmpWidget, GTK_STATE_NORMAL, &color);
gtk_widget_modify_text(tmpWidget, GTK_STATE_NORMAL, &color);
// set grisage :
gtk_widget_set_sensitive(tmpWidget, enable);
// add to the menu :
gtk_menu_shell_append(GTK_MENU_SHELL(m_menuListe), tmpWidget);
// accel KEY :
AccelKey::getInstance()->SetAccel(tmpWidget, (char *)accelKey);
// set callback
if(EDN_MSG__NONE!=id) {
g_signal_connect(G_OBJECT(tmpWidget), "activate", G_CALLBACK(CB_menuGenerique), message);
}
}
void AddSeparator(void)
{
CheckSubMenu();
if (NULL == m_menuListe) {
return;
}
gtk_menu_shell_append(GTK_MENU_SHELL (m_menuListe), gtk_separator_menu_item_new() );
}
private:
GtkWidget * m_parent;
GtkWidget * m_menu;
GtkWidget * m_menuListe;
etk::VectorType<messageData_ts*> m_message;
};
#undef __class__
#define __class__ "MenuBar"
MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
{
m_mainWidget = gtk_menu_bar_new();
MenuBarMain *tmp = NULL;
tmp = new MenuBarMain("_File", m_mainWidget);
tmp->AddGen(GTK_STOCK_NEW, "ctrl+n", EDN_MSG__NEW, true);
tmp->AddGen(GTK_STOCK_OPEN, "ctrl+o", EDN_MSG__GUI_SHOW_OPEN_FILE, true);
tmp->AddSeparator();
tmp->AddGen("Close file", "ctrl+q", EDN_MSG__CURRENT_CLOSE, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_SAVE, "ctrl+s", EDN_MSG__CURRENT_SAVE, true);
tmp->AddGen(GTK_STOCK_SAVE_AS, "ctrl+shift+s", EDN_MSG__CURRENT_SAVE_AS, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_QUIT, "ctrl+shift+q", EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("_Edit", m_mainWidget);
tmp->AddGen(GTK_STOCK_UNDO, "ctrl+z", EDN_MSG__CURRENT_UNDO, true);
tmp->AddGen(GTK_STOCK_REDO, "ctrl+shift+z", EDN_MSG__CURRENT_REDO, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_CUT, "ctrl+x", EDN_MSG__CURRENT_CUT, true, COPY_STD);
tmp->AddGen(GTK_STOCK_COPY, "ctrl+c", EDN_MSG__CURRENT_COPY, true, COPY_STD);
tmp->AddGen(GTK_STOCK_PASTE, "ctrl+v", EDN_MSG__CURRENT_PASTE, true, COPY_STD);
// tmp->AddGen(GTK_STOCK_DELETE, NULL);
tmp->AddGen("Remove line", "ctrl+w", EDN_MSG__CURRENT_REMOVE_LINE, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true);
tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true);
tmp->AddSeparator();
tmp->AddGen("Goto Line number ...", "ctrl+l", EDN_MSG__GUI_SHOW_GOTO_LINE, true);
// tmp->AddSeparator();
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("_Search", m_mainWidget);
tmp->AddGen(GTK_STOCK_FIND, "ctrl+f", EDN_MSG__GUI_SHOW_SEARCH, true);
tmp->AddGen(GTK_STOCK_FIND_AND_REPLACE, "ctrl+r", EDN_MSG__GUI_SHOW_REPLACE, true);
tmp->AddSeparator();
tmp->AddGen("Find next", "ctrl+h", EDN_MSG__CURRENT_FIND_NEXT, true);
tmp->AddGen("Find previous", "ctrl+shift+h", EDN_MSG__CURRENT_FIND_PREVIOUS, true);
// tmp->AddGen("Find old next", "ctrl+g", EDN_MSG__CURRENT_FIND_OLD_NEXT, true);
// tmp->AddGen("Find old previous", "ctrl+shift+g", EDN_MSG__CURRENT_FIND_OLD_PREVIOUS, true);
// tmp->AddSeparator();
// tmp->AddGen("Suprimer colorisation", NULL);
// tmp->AddSeparator();
// tmp->AddGen("Goto Line", "ctrl+l", EDN_MSG__CURRENT_GOTO_LINE, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("Display", m_mainWidget);
tmp->AddInternal("Show space & tabs", NULL, MSG_TogleDisplayChar, true);
tmp->AddInternal("Show end of lines", NULL, MSG_TogleDisplayEOL, true);
tmp->AddInternal("Audo Indent", NULL, MSG_TogleAutoIndent, true);
tmp->AddSeparator();
tmp->AddInternal("Set charset Occidental (ISO-8859-1)", NULL, MSG_SetCharsetIso559_1, true);
tmp->AddInternal("Set charset Occidental (ISO-8859-15)", NULL, MSG_SetCharsetIso559_15, true);
tmp->AddInternal("Set charset Internationnal (UTF 8)", NULL, MSG_SetCharsetUTF8, true);
tmp->AddSeparator();
tmp->AddGen( "Reload Color File", NULL, EDN_MSG__RELOAD_COLOR_FILE, true);
tmp->AddSeparator();
tmp->AddInternal("Set Color Black", NULL, MSG_LoadColorBlack, true);
tmp->AddInternal("Set Color White", NULL, MSG_LoadColorWhite, true);
m_listMenu.PushBack(tmp);
/*
tmp = new MenuBarMain("Project", m_mainWidget);
m_listMenu.PushBack(tmp);
*/
tmp = new MenuBarMain("Ctags", m_mainWidget);
tmp->AddGen("load Ctags file", NULL, EDN_MSG__OPEN_CTAGS, true);
tmp->AddGen("re-load Ctags file", NULL, EDN_MSG__RELOAD_CTAGS, true);
tmp->AddSeparator();
tmp->AddGen("Find Definition", "ctrl+d", EDN_MSG__JUMP_TO_CURRENT_SELECTION, true);
tmp->AddGen("Back previous", "ctrl+shift+d", EDN_MSG__JUMP_BACK, true);
/*
tmp->AddGen("Gestion Ctags", NULL);
tmp->AddGen("Add Ctags Folder", NULL);
tmp->AddSeparator();
tmp->AddGen("Trouver la definition", NULL);
tmp->AddGen("Trouver la declaration", NULL);
tmp->AddGen("Retour...", NULL);
tmp->AddSeparator();
tmp->AddGen("Tout desactiver", NULL);
*/
m_listMenu.PushBack(tmp);
/*
tmp = new MenuBarMain("Macros", m_mainWidget);
m_listMenu.PushBack(tmp);
*/
/*
tmp = new MenuBarMain("Tools", m_mainWidget);
tmp->AddGen("Execute Commande", "ctrl+e");
tmp->AddGen("Set Command", NULL);
m_listMenu.PushBack(tmp);
*/
tmp = new MenuBarMain("Internal ClipBoard", m_mainWidget);
// tmp->AddGen("Cut 1", "ctrl+alt+1", EDN_MSG__CURRENT_CUT, true, 1);
tmp->AddGen("Copy 1", "ctrl+1", EDN_MSG__CURRENT_COPY, true, 1);
tmp->AddGen("Paste 1", "alt+1", EDN_MSG__CURRENT_PASTE, true, 1);
tmp->AddSeparator();
// tmp->AddGen("Cut 2", "ctrl+alt+2", EDN_MSG__CURRENT_CUT, true, 2);
tmp->AddGen("Copy 2", "ctrl+2", EDN_MSG__CURRENT_COPY, true, 2);
tmp->AddGen("Paste 2", "alt+2", EDN_MSG__CURRENT_PASTE, true, 2);
tmp->AddSeparator();
// tmp->AddGen("Cut 3", "ctrl+alt+3", EDN_MSG__CURRENT_CUT, true, 3);
tmp->AddGen("Copy 3", "ctrl+3", EDN_MSG__CURRENT_COPY, true, 3);
tmp->AddGen("Paste 3", "alt+3", EDN_MSG__CURRENT_PASTE, true, 3);
tmp->AddSeparator();
// tmp->AddGen("Cut 4", "ctrl+alt+4", EDN_MSG__CURRENT_CUT, true, 4);
tmp->AddGen("Copy 4", "ctrl+4", EDN_MSG__CURRENT_COPY, true, 4);
tmp->AddGen("Paste 4", "alt+4", EDN_MSG__CURRENT_PASTE, true, 4);
tmp->AddSeparator();
// tmp->AddGen("Cut 5", "ctrl+alt+5", EDN_MSG__CURRENT_CUT, true, 5);
tmp->AddGen("Copy 5", "ctrl+5", EDN_MSG__CURRENT_COPY, true, 5);
tmp->AddGen("Paste 5", "alt+5", EDN_MSG__CURRENT_PASTE, true, 5);
tmp->AddSeparator();
// tmp->AddGen("Cut 6", "ctrl+alt+6", EDN_MSG__CURRENT_CUT, true, 6);
tmp->AddGen("Copy 6", "ctrl+6", EDN_MSG__CURRENT_COPY, true, 6);
tmp->AddGen("Paste 6", "alt+6", EDN_MSG__CURRENT_PASTE, true, 6);
tmp->AddSeparator();
// tmp->AddGen("Cut 7", "ctrl+alt+7", EDN_MSG__CURRENT_CUT, true, 7);
tmp->AddGen("Copy 7", "ctrl+7", EDN_MSG__CURRENT_COPY, true, 7);
tmp->AddGen("Paste 7", "alt+7", EDN_MSG__CURRENT_PASTE, true, 7);
tmp->AddSeparator();
// tmp->AddGen("Cut 8", "ctrl+alt+8", EDN_MSG__CURRENT_CUT, true, 8);
tmp->AddGen("Copy 8", "ctrl+8", EDN_MSG__CURRENT_COPY, true, 8);
tmp->AddGen("Paste 8", "alt+8", EDN_MSG__CURRENT_PASTE, true, 8);
tmp->AddSeparator();
// tmp->AddGen("Cut 9", "ctrl+alt+9", EDN_MSG__CURRENT_CUT, true, 9);
tmp->AddGen("Copy 9", "ctrl+9", EDN_MSG__CURRENT_COPY, true, 9);
tmp->AddGen("Paste 9", "alt+9", EDN_MSG__CURRENT_PASTE, true, 9);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("Help", m_mainWidget);
tmp->AddGen("help display", NULL, EDN_MSG__OPEN_CTAGS, false);
tmp->AddSeparator();
tmp->AddGen("About ...", NULL, EDN_MSG__GUI_SHOW_ABOUT, true);
/*
tmp->AddGen("Gestion Ctags", NULL);
tmp->AddGen("Add Ctags Folder", NULL);
tmp->AddSeparator();
tmp->AddGen("Trouver la definition", NULL);
tmp->AddGen("Trouver la declaration", NULL);
tmp->AddGen("Retour...", NULL);
tmp->AddSeparator();
tmp->AddGen("Tout desactiver", NULL);
*/
m_listMenu.PushBack(tmp);
}
MenuBar::~MenuBar(void)
{
}
void MenuBar::OnMessage(int32_t id, int32_t dataID)
{
//EDN_INFO("ReceiveMessage");
}
#endif

View File

@@ -1,55 +0,0 @@
/**
*******************************************************************************
* @file MenuBar.h
* @brief Editeur De N'ours : abstraction of the menu bar (Header)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <MsgBroadcast.h>
#include <etk/VectorType.h>
#include <AccelKey.h>
#ifndef __MENU_BAR_H__
#define __MENU_BAR_H__
//class MenuBarMain;
class MenuBar
{
public:
// Constructeur
MenuBar(void) {};
~MenuBar(void) {};
//GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID) {};
private:
/*
GtkWidget * m_mainWidget;
GtkAccelGroup * m_accelGroup;
etk::VectorType<MenuBarMain*> m_listMenu;
*/
};
#endif

View File

@@ -1,54 +0,0 @@
/**
*******************************************************************************
* @file StatusBar.cpp
* @brief Editeur De N'ours : abstraction of the status bar (Sources)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <StatusBar.h>
StatusBar::StatusBar(void)
{
/*
m_mainWidget = gtk_statusbar_new();
// pas tr<74>s bien compris pourquoi mais ca marche...
m_iContextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(m_mainWidget), "ExitMsg");
// ajout d'un message :
gtk_statusbar_push(GTK_STATUSBAR (m_mainWidget), GPOINTER_TO_INT(m_iContextId), "Edn Editeur de n'ours");
// Supression du pr<70>c<EFBFBD>dent message :
//gtk_statusbar_pop(GTK_STATUSBAR(m_mainWidget), GPOINTER_TO_INT(m_iContextId));
*/
}
StatusBar::~StatusBar(void)
{
}
void StatusBar::OnMessage(int32_t id, int32_t dataID)
{
//EDN_INFO("ReceiveMessage");
}

View File

@@ -1,46 +0,0 @@
/**
*******************************************************************************
* @file StatusBar.h
* @brief Editeur De N'ours : abstraction of the status bar (Header)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <MsgBroadcast.h>
#ifndef __STATUS_BAR_H__
#define __STATUS_BAR_H__
class StatusBar
{
public:
// Constructeur
StatusBar(void);
~StatusBar(void);
//GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID);
private:
//GtkWidget * m_mainWidget;
//guint m_iContextId;
};
#endif

View File

@@ -1,95 +0,0 @@
/**
*******************************************************************************
* @file ToolBar.cpp
* @brief Editeur De N'ours : abstraction of the tool bar (Sources)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <ToolBar.h>
#include <ClipBoard.h>
/*
static void CB_menuGenerique(GtkMenuItem *menu_item, gpointer data)
{
//EDN_INFO("basic menue_event");
messageData_ts * msg = (messageData_ts*)data;
// broacast message :
GeneralSendMessage(msg->msgId, msg->dataId);
}
*/
ToolBar::ToolBar(void)
{
/*
m_mainWidget = gtk_toolbar_new();
# ifdef USE_GTK_VERSION_2_0
gtk_toolbar_set_orientation(GTK_TOOLBAR(m_mainWidget), GTK_ORIENTATION_VERTICAL);
# endif
// Modification de la taille des icones
gtk_toolbar_set_icon_size(GTK_TOOLBAR(m_mainWidget), GTK_ICON_SIZE_BUTTON);
// Affichage uniquement des icones
gtk_toolbar_set_style(GTK_TOOLBAR(m_mainWidget), GTK_TOOLBAR_ICONS);
Add(GTK_STOCK_NEW, "Nouveau", EDN_MSG__NEW);
Add(GTK_STOCK_OPEN, "Ouvrir", EDN_MSG__GUI_SHOW_OPEN_FILE);
AddSeparator();
Add(GTK_STOCK_SAVE, "Enregistrer", EDN_MSG__CURRENT_SAVE);
Add(GTK_STOCK_SAVE_AS, "Enregistrer sous", EDN_MSG__CURRENT_SAVE_AS);
AddSeparator();
Add(GTK_STOCK_QUIT, "Quitter");
*/
}
ToolBar::~ToolBar(void)
{
}
void ToolBar::OnMessage(int32_t id, int32_t dataID)
{
//EDN_INFO("ReceiveMessage");
}
/*
void ToolBar::AddSeparator(void)
{
# ifdef USE_GTK_VERSION_3_0
# elif defined( USE_GTK_VERSION_2_0)
gtk_toolbar_append_space(GTK_TOOLBAR(m_mainWidget));
# endif
}
void ToolBar::Add(const char * title, const char * labelHelp, messageType_te id, bool enable)
{
messageData_ts * message = new messageData_ts;
message->msgId = id;
message->dataId = -1;
m_message.PushBack(message);
# ifdef USE_GTK_VERSION_3_0
# elif defined( USE_GTK_VERSION_2_0)
gtk_toolbar_insert_stock(GTK_TOOLBAR(m_mainWidget), title, labelHelp, NULL, G_CALLBACK(CB_menuGenerique), message, -1);
# endif
}
*/

View File

@@ -1,49 +0,0 @@
/**
*******************************************************************************
* @file ToolBar.h
* @brief Editeur De N'ours : abstraction of the tool bar (Header)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <MsgBroadcast.h>
#ifndef __TOOL_BAR_H__
#define __TOOL_BAR_H__
class ToolBar
{
public:
// Constructeur
ToolBar(void);
~ToolBar(void);
//GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID);
private:
//void AddSeparator(void);
//void Add(const char * title, const char * labelHelp, messageType_te id = EDN_MSG__NONE, bool enable = false);
//GtkWidget * m_mainWidget;
//etk::VectorType<messageData_ts*> m_message;
};
#endif

View File

@@ -1,320 +0,0 @@
/**
*******************************************************************************
* @file WindowsManager.cpp
* @brief Editeur De N'ours : Windows creation, pop up, destruction ... (Sources)
* @author Edouard DUPIN
* @date 20/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <WindowsManager.h>
#include <MainWindows.h>
#include <Search.h>
#undef __class__
#define __class__ "WindowsManager"
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
WindowsManager::WindowsManager(void)
{
m_currentBufferID = -1;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
WindowsManager::~WindowsManager(void)
{
}
void WindowsManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
/*
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_currentBufferID = dataID;
break;
case EDN_MSG__GUI_SHOW_MAIN_WINDOWS:
EDN_INFO("Request opening MAIN_WINDOWS");
m_mainWindow = MainWindows::getInstance();
break;
case EDN_MSG__GUI_SHOW_SEARCH:
EDN_INFO("Request opening SEARCH");
{
Search *myInstance = Search::getInstance();
myInstance->Display(GTK_WINDOW(m_mainWindow->GetWidget()));
}
break;
case EDN_MSG__GUI_SHOW_PREFERENCE:
EDN_INFO("Request opening PREFERENCE");
break;
case EDN_MSG__GUI_SHOW_REPLACE:
EDN_INFO("Request opening REPLACE");
break;
case EDN_MSG__GUI_SHOW_OPEN_FILE:
EDN_INFO("Request opening OPEN_FILE");
{
BufferManager *myBufferManager = NULL;
myBufferManager = BufferManager::getInstance();
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open File", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL); // end button/response list
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
if( -1 != m_currentBufferID
&& true == myBufferManager->Exist(m_currentBufferID) )
{
etk::File fileName = myBufferManager->Get(m_currentBufferID)->GetFileName();
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), fileName.GetFolder().c_str());
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), fileName.GetShortFilename().c_str());
}
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
etk::File myfilename;
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
if (false == myBufferManager->Exist(myfilename) ) {
int32_t openID = myBufferManager->Open(myfilename);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myfilename));
}
}
gtk_widget_destroy(dialog);
}
break;
case EDN_MSG__GUI_SHOW_SAVE_AS:
EDN_INFO("Request opening SAVE_AS");
// save only if one element is selected
if (BufferManager::getInstance()->Size() > 0) {
int32_t idSelected;
if(-1 == dataID) {
idSelected = BufferManager::getInstance()->GetSelected();
} else {
idSelected = dataID;
}
Buffer *myBuffer = BufferManager::getInstance()->Get(idSelected);
etk::String tmpString = "Save as file : ";
tmpString += myBuffer->GetFileName().GetShortFilename().c_str();
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL); // end button/response list
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
etk::String myfilename;
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
myBuffer->SetFileName(myfilename);
myBuffer->Save();
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idSelected);
}
gtk_widget_destroy(dialog); // implicitly hides dialog
}
break;
case EDN_MSG__GUI_SHOW_ABOUT:
{
GtkWidget *myDialog = gtk_about_dialog_new();
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(myDialog), "Edn");
gtk_about_dialog_set_version( GTK_ABOUT_DIALOG(myDialog), VERSION_TAG_NAME);
gtk_about_dialog_set_comments( GTK_ABOUT_DIALOG(myDialog), "Editeur De N'ours\n"
"L'Editeur Desoxyribo-Nucleique.\n"
"Source Code Editor\n"
"Build Time : " VERSION_BUILD_TIME);
gtk_about_dialog_set_copyright( GTK_ABOUT_DIALOG(myDialog), "Copyright 2010 Edouard DUPIN, all right reserved");
gtk_about_dialog_set_license( GTK_ABOUT_DIALOG(myDialog), "This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY\n\n"
"You can:\n"
" * Redistribute the sources code and binaries.\n"
" * Modify the Sources code.\n"
" * Use a part of the sources (less than 50%) in an other software, just write somewhere \"Edn is great\" visible by the user (on your product or on your website with a link to my page).\n"
" * Redistribute the modification only if you want.\n"
" * Send me the bug-fix (it could be great).\n"
" * Pay me a beer or some other things.\n"
" * Print the source code on WC paper ...\n\n"
"You can NOT:\n"
" * Earn money with this Software (But I can).\n"
" * Add malware in the Sources.\n"
" * Do something bad with the sources.\n"
" * Use it to travel in the space with a toaster.\n\n"
"I reserve the right to change this licence. If it change the version of the copy you have keep its own license.");
gtk_about_dialog_set_wrap_license(GTK_ABOUT_DIALOG(myDialog), true);
# if USE_GTK_VERSION_3_0
gtk_about_dialog_set_license_type(GTK_ABOUT_DIALOG(myDialog), GTK_LICENSE_CUSTOM);
# endif
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(myDialog), "http://HeeroYui.github.com/edn");
gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(myDialog), "Edn on github");
const char * listAutor[] = {"Edouard DUPIN", NULL};
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(myDialog), listAutor);
// Display About
gtk_dialog_run(GTK_DIALOG(myDialog));
gtk_widget_destroy(myDialog);
}
break;
case EDN_MSG__GUI_SHOW_GOTO_LINE:
{
// dlg to confirm the quit event :
GtkWidget *myDialog = gtk_dialog_new_with_buttons("Goto Line",
GTK_WINDOW(m_mainWindow->GetWidget()),
GTK_DIALOG_MODAL,
"Jump", GTK_RESPONSE_YES,
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL);
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(myDialog), TRUE);
// Set over main windows
gtk_window_set_transient_for(GTK_WINDOW(myDialog), GTK_WINDOW(m_mainWindow->GetWidget()));
// add writting area
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog));
GtkWidget *myEntry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(myContentArea), myEntry, TRUE, TRUE, 0);
// Display it
gtk_widget_show_all(myContentArea);
int32_t result = gtk_dialog_run (GTK_DIALOG (myDialog));
// Get data from the gtk entry
const char *myData = gtk_entry_get_text(GTK_ENTRY(myEntry));
if (NULL != myData) {
int32_t lineID=0;
if (1==sscanf(myData, "%d",&lineID)) {
EDN_DEBUG("find in : \"" << myData << "\" = " << lineID);
if(GTK_RESPONSE_YES == result) {
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, lineID-1);
}
} else {
if (GTK_RESPONSE_YES == result) {
EDN_WARNING("find in : \"" << myData << "\" line Number is not correct ");
}
}
} else {
EDN_DEBUG("no line Writen ...");
}
// Remove dialogue
gtk_widget_destroy(myDialog);
}
break;
case EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION:
{
EDN_INFO("quit requested");
// dlg to confirm the quit event :
GtkWidget *p_dialog = gtk_dialog_new_with_buttons("Exit",
GTK_WINDOW(m_mainWindow->GetWidget()),
GTK_DIALOG_MODAL,
GTK_STOCK_YES, GTK_RESPONSE_YES,
GTK_STOCK_NO, GTK_RESPONSE_NO,
NULL);
GtkWidget *p_label = gtk_label_new ("Do you want exit Edn ?");
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area( GTK_DIALOG(p_dialog) )), p_label, TRUE, TRUE, 0);
gtk_widget_show(p_label);
switch (gtk_dialog_run (GTK_DIALOG (p_dialog)))
{
case GTK_RESPONSE_YES:
gtk_widget_destroy (p_dialog);
p_dialog = NULL;
{
BufferManager * myBufferMng = BufferManager::getInstance();
for (int32_t iii=0 ; iii<myBufferMng->Size() ; iii++) {
if (true==myBufferMng->Exist(iii) ) {
Buffer * myBuffer = myBufferMng->Get(iii);
if (NULL != myBuffer) {
if (true == myBuffer->IsModify()) {
if (true == myBuffer->HaveName()) {
p_dialog = gtk_dialog_new_with_buttons("Save Before Exit",
GTK_WINDOW(m_mainWindow->GetWidget()),
GTK_DIALOG_MODAL,
GTK_STOCK_SAVE, GTK_RESPONSE_YES,
GTK_STOCK_SAVE_AS, GTK_RESPONSE_ACCEPT,
GTK_STOCK_NO, GTK_RESPONSE_NO,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
} else {
p_dialog = gtk_dialog_new_with_buttons("Save Before Exit",
GTK_WINDOW(m_mainWindow->GetWidget()),
GTK_DIALOG_MODAL,
GTK_STOCK_SAVE_AS, GTK_RESPONSE_ACCEPT,
GTK_STOCK_NO, GTK_RESPONSE_NO,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
}
char tmpName[1024];
sprintf(tmpName, "Save file \"%s\" ?", myBuffer->GetFileName().GetCompleateName().c_str());
p_label = gtk_label_new(tmpName);
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area( GTK_DIALOG(p_dialog) )), p_label, TRUE, TRUE, 0);
gtk_widget_show(p_label);
switch (gtk_dialog_run (GTK_DIALOG (p_dialog)))
{
case GTK_RESPONSE_YES:
myBuffer->Save();
break;
case GTK_RESPONSE_ACCEPT:
OnMessage(EDN_MSG__GUI_SHOW_SAVE_AS, iii);
break;
case GTK_RESPONSE_NO:
// nothing to do ...
break;
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (p_dialog);
return;
break;
}
gtk_widget_destroy (p_dialog);
p_dialog = NULL;
}
}
}
}
}
gtk_main_quit();
break;
case GTK_RESPONSE_NO:
gtk_widget_destroy (p_dialog);
break;
}
}
break;
*/
default:
break;
}
}

View File

@@ -1,50 +0,0 @@
/**
*******************************************************************************
* @file WindowsManager.h
* @brief Editeur De N'ours : Windows creation, pop up, destruction ... (header)
* @author Edouard DUPIN
* @date 20/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __WINDOWS_MANAGER_H__
#define __WINDOWS_MANAGER_H__
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include <MainWindows.h>
class WindowsManager: public etk::Singleton<WindowsManager>
{
friend class etk::Singleton<WindowsManager>;
// specific for sigleton system...
private:
// Constructeur
WindowsManager(void);
~WindowsManager(void);
public:
void OnMessage(int32_t id, int32_t dataID);
private:
MainWindows * m_mainWindow;
int32_t m_currentBufferID;
};
#endif

View File

@@ -45,7 +45,7 @@ void Highlight::ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*>
Highlight::Highlight(etk::String &xmlFilename)
Highlight::Highlight(etk::UString &xmlFilename)
{
TiXmlDocument XmlDocument;
@@ -99,7 +99,7 @@ Highlight::Highlight(etk::String &xmlFilename)
const char *myData = child->ToElement()->GetText();
if (NULL != myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
etk::String * myEdnData = new etk::String(myData);
etk::UString * myEdnData = new etk::UString(myData);
m_listExtentions.PushBack(myEdnData);
}
} else if (!strcmp(child->Value(), "pass1")) {
@@ -180,7 +180,7 @@ void Highlight::ReloadColor(void)
}
}
bool Highlight::HasExtention(etk::String &ext)
bool Highlight::HasExtention(etk::UString &ext)
{
int32_t i;
for (i=0; i<m_listExtentions.Size(); i++) {
@@ -194,7 +194,7 @@ bool Highlight::HasExtention(etk::String &ext)
bool Highlight::FileNameCompatible(etk::File &fileName)
{
int32_t i;
etk::String extention;
etk::UString extention;
if (true == fileName.HasExtention() ) {
extention = "*.";
extention += fileName.GetExtention();

View File

@@ -50,9 +50,9 @@ extern "C" {
class Highlight {
public:
// Constructeur
Highlight(etk::String &xmlFilename);
Highlight(etk::UString &xmlFilename);
~Highlight(void);
bool HasExtention(etk::String &ext);
bool HasExtention(etk::UString &ext);
bool FileNameCompatible(etk::File &fileName);
void Display(void);
void ReloadColor(void);
@@ -67,8 +67,8 @@ class Highlight {
EdnVectorBuf &buffer);
private:
void ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*> &mListPatern, int32_t level);
etk::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
etk::VectorType<etk::String*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
etk::VectorType<etk::UString*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
etk::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
etk::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
};

View File

@@ -26,107 +26,172 @@
#include <tools_debug.h>
#include <tools_globals.h>
#include <HighlightManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#undef __class__
#define __class__ "HighlightManager"
HighlightManager::HighlightManager(void)
{
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferColor);
}
HighlightManager::~HighlightManager(void)
class localClassHighlightManager: public ewol::EObject
{
int32_t i;
// clean all Element
for (i=0; i< listHighlight.Size(); i++) {
if (NULL != listHighlight[i]) {
delete(listHighlight[i]);
listHighlight[i] = NULL;
}
}
// clear the compleate list
listHighlight.Clear();
}
bool HighlightManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
{
/*
switch (id)
{
case EDN_MSG__COLOR_HAS_CHANGE:
EDN_INFO("UPDATE the color pointer on the HL");
for (int32_t i=0; i<listHighlight.Size(); i++) {
private:
etk::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
public:
// Constructeur
localClassHighlightManager(void) {
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferColor);
};
~localClassHighlightManager(void) {
int32_t i;
// clean all Element
for (i=0; i< listHighlight.Size(); i++) {
if (NULL != listHighlight[i]) {
listHighlight[i]->ReloadColor();
delete(listHighlight[i]);
listHighlight[i] = NULL;
}
}
break;
// clear the compleate list
listHighlight.Clear();
};
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
{
/*
switch (id)
{
case EDN_MSG__COLOR_HAS_CHANGE:
EDN_INFO("UPDATE the color pointer on the HL");
for (int32_t i=0; i<listHighlight.Size(); i++) {
if (NULL != listHighlight[i]) {
listHighlight[i]->ReloadColor();
}
}
break;
}
*/
}
Highlight* Get(etk::File &fileName)
{
int32_t i;
for (i=0; i<listHighlight.Size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return listHighlight[i];
}
}
return NULL;
}
bool Exist(etk::File &fileName)
{
if (NULL != Get(fileName) ) {
return true;
}
return false;
}
void loadLanguages(void)
{
etk::UString xmlFilename = "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_boo.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_asm.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_xml.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_php.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_bash.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_matlab.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_java.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
//myHightline->Display();
}
};
static localClassHighlightManager * localManager = NULL;
void HighlightManager::Init(void)
{
if (NULL == localManager) {
EWOL_ERROR("HighlightManager ==> already exist, just unlink the previous ...");
localManager = NULL;
}
localManager = new localClassHighlightManager();
if (NULL == localManager) {
EWOL_CRITICAL("Allocation of HighlightManager not done ...");
}
*/
return false;
}
Highlight *HighlightManager::Get(etk::File &fileName)
void HighlightManager::UnInit(void)
{
int32_t i;
for (i=0; i<listHighlight.Size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return listHighlight[i];
}
if (NULL == localManager) {
EWOL_ERROR("HighlightManager ==> request UnInit, but does not exist ...");
return;
}
return NULL;
ewol::EObjectManager::MarkToRemoved(localManager);
localManager = NULL;
}
void HighlightManager::loadLanguages(void)
{
if (NULL == localManager) {
return;
}
localManager->loadLanguages();
}
Highlight* HighlightManager::Get(etk::File &fileName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(fileName);
}
bool HighlightManager::Exist(etk::File &fileName)
{
if (NULL != Get(fileName) ) {
return true;
if (NULL == localManager) {
return false;
}
return false;
return localManager->Exist(fileName);
}
void HighlightManager::loadLanguages(void)
{
etk::String xmlFilename = "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_boo.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_asm.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_xml.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_php.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_bash.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_matlab.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = "lang_java.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
//myHightline->Display();
}

View File

@@ -26,33 +26,20 @@
#ifndef __HIGHLIGHT_MANAGER_H__
#define __HIGHLIGHT_MANAGER_H__
class HighlightManager;
#include <etk/Singleton.h>
#include <etk/UString.h>
#include <MsgBroadcast.h>
#include <Highlight.h>
#include <ewol/Widget.h>
class HighlightManager: public etk::Singleton<HighlightManager>, public ewol::Widget
{
friend class etk::Singleton<HighlightManager>;
// specific for sigleton system...
private:
// Constructeur
HighlightManager(void);
~HighlightManager(void);
public:
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
public:
void loadLanguages(void);
Highlight * Get(etk::File &fileName);
bool Exist(etk::File &fileName);
private:
etk::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
namespace HighlightManager{
void Init(void);
void UnInit(void);
void loadLanguages(void);
Highlight* Get(etk::File &fileName);
bool Exist(etk::File &fileName);
};
#endif

View File

@@ -37,8 +37,7 @@ HighlightPattern::HighlightPattern(void)
{
m_haveStopPatern = false;
m_multiline = false;
ColorizeManager *myColorManager = ColorizeManager::getInstance();
m_color = myColorManager->Get("normal");
m_color = ColorizeManager::Get("normal");
m_regExpStart = new etk::RegExp<EdnVectorBuf>();
m_regExpStop = new etk::RegExp<EdnVectorBuf>();
m_escapeChar = 0;
@@ -50,12 +49,12 @@ HighlightPattern::~HighlightPattern(void)
delete(m_regExpStop);
}
void HighlightPattern::SetPaternStart(etk::String &regExp)
void HighlightPattern::SetPaternStart(etk::UString &regExp)
{
m_regExpStart->SetRegExp(regExp);
}
void HighlightPattern::SetPaternStop(etk::String &regExp)
void HighlightPattern::SetPaternStop(etk::UString &regExp)
{
if (regExp.Size() != 0) {
m_regExpStop->SetRegExp(regExp);
@@ -65,21 +64,20 @@ void HighlightPattern::SetPaternStop(etk::String &regExp)
}
}
void HighlightPattern::SetEscapeChar(etk::String &EscapeChar)
void HighlightPattern::SetEscapeChar(etk::UString &EscapeChar)
{
if (EscapeChar.Size()>0) {
m_escapeChar = EscapeChar.c_str()[0];
m_escapeChar = EscapeChar[0];
} else {
m_escapeChar = 0;
}
}
void HighlightPattern::SetColor(etk::String &colorName)
void HighlightPattern::SetColor(etk::UString &colorName)
{
m_colorName = colorName;
ColorizeManager *myColorManager = ColorizeManager::getInstance();
m_color = myColorManager->Get(m_colorName);
m_color = ColorizeManager::Get(m_colorName);
}
bool HighlightPattern::IsEnable(void)
@@ -90,8 +88,7 @@ bool HighlightPattern::IsEnable(void)
void HighlightPattern::ReloadColor(void)
{
ColorizeManager *myColorManager = ColorizeManager::getInstance();
m_color = myColorManager->Get(m_colorName);
m_color = ColorizeManager::Get(m_colorName);
}
/**
@@ -140,7 +137,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
//--------------------------------------------------------------------------------------------
// process attribute
const char *highLightName = child->ToElement()->Attribute("name");
etk::String myEdnDataTmp = "???";
etk::UString myEdnDataTmp = "???";
if (NULL != highLightName) {
myEdnDataTmp = highLightName;
}
@@ -152,7 +149,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
const char *myData = xChild->GetText();
if (myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::String myEdnData = myData;
etk::UString myEdnData = myData;
SetColor(myEdnData);
}
}
@@ -161,7 +158,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
const char *myData = xChild->GetText();
if (myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::String myEdnData = myData;
etk::UString myEdnData = myData;
SetPaternStart(myEdnData);
}
}
@@ -170,7 +167,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
const char *myData = xChild->GetText();
if (myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::String myEdnData = myData;
etk::UString myEdnData = myData;
SetPaternStop(myEdnData);
}
}
@@ -179,7 +176,7 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
const char *myData = xChild->GetText();
if (myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::String myEdnData = myData;
etk::UString myEdnData = myData;
SetEscapeChar(myEdnData);
}
}

View File

@@ -51,13 +51,13 @@ class HighlightPattern {
HighlightPattern(void);
~HighlightPattern(void);
void SetName(etk::String &name) { m_paternName = name;};
etk::String GetName(void) { return m_paternName;};
void SetName(etk::UString &name) { m_paternName = name;};
etk::UString GetName(void) { return m_paternName;};
void SetPaternStart(etk::String &regExp);
void SetPaternStop(etk::String &regExp);
void SetColor(etk::String &colorName);
void SetEscapeChar(etk::String &EscapeChar);
void SetPaternStart(etk::UString &regExp);
void SetPaternStop(etk::UString &regExp);
void SetColor(etk::UString &colorName);
void SetEscapeChar(etk::UString &EscapeChar);
void SetMultiline(bool enable) { m_multiline = enable; };
void SetLevel(int32_t newLevel) { m_level = newLevel; };
@@ -73,14 +73,14 @@ class HighlightPattern {
private:
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
etk::String m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
etk::String m_colorName; //!< Current color name
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
etk::UString m_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
char m_escapeChar; //!< Escape char to prevent exeit of patern ....
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
etk::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// etk::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
};

View File

@@ -28,13 +28,13 @@
#include <CTagsManager.h>
#include <ClipBoard.h>
#include <BufferManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/EObject.h>
#undef __class__
#define __class__ "CTagsManager"
#if 0
/**
* @brief
*
@@ -72,7 +72,7 @@ CTagsManager::~CTagsManager(void)
*/
}
etk::String CTagsManager::GetFolder(etk::String &inputString)
etk::UString CTagsManager::GetFolder(etk::UString &inputString)
{
/*
char tmpVal[4096];
@@ -82,7 +82,7 @@ etk::String CTagsManager::GetFolder(etk::String &inputString)
if (NULL == ptr) {
ptr = strrchr(tmpVal, '\\');
}
etk::String out = "./";
etk::UString out = "./";
if (NULL != ptr) {
*ptr = '\0';
out = tmpVal;
@@ -90,7 +90,7 @@ etk::String CTagsManager::GetFolder(etk::String &inputString)
}
return out;
*/
etk::String out = "./";
etk::UString out = "./";
return out;
}
@@ -203,7 +203,7 @@ void CTagsManager::cb_row(GtkTreeView *p_treeview,
gpointer data)
{
EDN_DEBUG("event");
CTagsManager * self = reinterpret_cast<CTagsManager*>(data);
CTagsManager * self = static_cast<CTagsManager*>(data);
gchar * p_file=NULL;
gint lineNumber;
@@ -360,7 +360,7 @@ void CTagsManager::JumpTo(void)
// For all tags : Save in an internal Structure :
do {
etk::String destinationFilename = m_tagFolderBase;
etk::UString destinationFilename = m_tagFolderBase;
destinationFilename += entry.file;
etk::File myfile = destinationFilename;
TagListFind_ts myStruct;
@@ -412,4 +412,7 @@ void CTagsManager::PrintTag (const tagEntry *entry, bool small)
}
}
}
*/
*/
#endif

View File

@@ -27,7 +27,6 @@
#define __C_TAGS_MANAGER_H__
#include <etk/Singleton.h>
#include <ewol/Widget.h>
#include "MsgBroadcast.h"
#include "readtags.h"
@@ -40,7 +39,7 @@ typedef struct{
int32_t lineID;
} TagListFind_ts;
/*
class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
{
friend class etk::Singleton<CTagsManager>;
@@ -58,9 +57,9 @@ class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
int32_t MultipleJump(void);
void JumpTo(void);
void PrintTag(const tagEntry *entry, bool small);
etk::String GetFolder(etk::String &inputString);
etk::String m_tagFolderBase;
etk::String m_tagFilename;
etk::UString GetFolder(etk::UString &inputString);
etk::UString m_tagFolderBase;
etk::UString m_tagFilename;
tagFile * m_ctagFile;
// history system
void AddToHistory(int32_t bufferID);
@@ -68,16 +67,6 @@ class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
etk::VectorType<etk::File*> m_historyList;
etk::VectorType<TagListFind_ts> m_currentList;
void JumpAtID(int32_t selectID);
/*
GtkWidget * CreateViewAndModel(void);
static void cb_row (GtkTreeView *p_treeview,
GtkTreePath * p_path,
GtkTreeViewColumn * p_column,
gpointer p_data);
// save data in the list :
GtkListStore * m_listStore;
GtkWidget * m_Dialog;
*/
};
*/
#endif

View File

@@ -26,18 +26,20 @@
#include <tools_debug.h>
#include <tools_globals.h>
#include <ewol/ewol.h>
#include <Gui/MainWindows.h>
#include <Display.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <HighlightManager.h>
#include <ClipBoard.h>
#include <etk/String.h>
#include <WindowsManager.h>
#include <Search.h>
#include <Gui/Search.h>
#include <unistd.h>
#include <readtags.h>
#include <CTagsManager.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <etk/UString.h>
#include <ewol/EObject.h>
#include <ewol/WidgetManager.h>
#include <tools/MsgBroadcast/MsgBroadcast.h>
MainWindows * basicWindows = NULL;
@@ -52,7 +54,7 @@ void APP_Init(void)
// set the default Path of the application :
#ifdef PLATFORM_Linux
etk::String homedir;
etk::UString homedir;
#ifdef NDEBUG
homedir = "/usr/share/"PROJECT_NAME"/";
#else
@@ -65,19 +67,19 @@ void APP_Init(void)
homedir += "/assets/";
}
#endif
SetBaseFolderData(homedir.c_str());
// TODO : Remove the Utf8Data
SetBaseFolderData(homedir.Utf8Data());
SetBaseFolderDataUser("~/."PROJECT_NAME"/");
SetBaseFolderCache("/tmp/"PROJECT_NAME"/");
#endif
ewol::SetFontFolder("Font");
//ewol::SetDefaultFont("freefont/FreeMono.ttf", 12);
ewol::SetDefaultFont("freefont/FreeSerif.ttf", 12);
//ewol::SetDefaultFont("freefont/FreeMonoBold.ttf", 12);
//ewol::SetDefaultFont("ACharmingFont.ttf", 45);
//ewol::SetDefaultFont("Monospace/Monospace", 40);
//ewol::SetDefaultFont("unispace.ttf", 12);
#ifdef __PLATFORM__Android
ewol::SetDefaultFont("freefont/FreeSerif.ttf", 16);
#else
ewol::SetDefaultFont("freefont/FreeSerif.ttf", 12);
#endif
// init internal global value
globals::init();
@@ -85,20 +87,17 @@ void APP_Init(void)
// init ALL Singleton :
(void)WindowsManager::getInstance();
(void)CTagsManager::getInstance();
(void)BufferManager::getInstance();
//(void)CTagsManager::getInstance();
BufferManager::Init();
// set color and other trucs...
ColorizeManager *myColorManager = NULL;
myColorManager = ColorizeManager::getInstance();
etk::String homedir = "color_white.xml";
myColorManager->LoadFile( homedir.c_str() );
myColorManager->DisplayListOfColor();
ColorizeManager::Init();
etk::UString homedir = "color_white.xml";
ColorizeManager::LoadFile( homedir.Utf8Data() );
ColorizeManager::DisplayListOfColor();
HighlightManager *myHighlightManager = NULL;
myHighlightManager = HighlightManager::getInstance();
myHighlightManager->loadLanguages();
HighlightManager::Init();
HighlightManager::loadLanguages();
// get the curent program folder
@@ -119,13 +118,41 @@ void APP_Init(void)
// create the specific windows
ewol::DisplayWindows(basicWindows);
// add generic shortcut ...
// (shift, control, alt, meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString& data)
ewol::shortCut::Add("ctrl+o", ednMsgGuiOpen, "");
ewol::shortCut::Add("ctrl+n", ednMsgGuiNew, "");
ewol::shortCut::Add("ctrl+s", ednMsgGuiSave, "current");
ewol::shortCut::Add("ctrl+shift+s", ednMsgGuiSave, "All");
ewol::shortCut::Add("ctrl+q", ednMsgGuiClose, "current");
ewol::shortCut::Add("ctrl+shift+q", ednMsgGuiClose, "All");
ewol::shortCut::Add("ctrl+z", ednMsgGuiUndo, "");
ewol::shortCut::Add("ctrl+shift+z", ednMsgGuiRedo, "");
ewol::shortCut::Add("ctrl+w", ednMsgGuiRm, "Line");
ewol::shortCut::Add("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
ewol::shortCut::Add("ctrl+x", ednMsgGuiCut, "STD");
ewol::shortCut::Add("ctrl+c", ednMsgGuiCopy, "STD");
ewol::shortCut::Add("ctrl+v", ednMsgGuiPaste, "STD");
ewol::shortCut::Add("ctrl+a", ednMsgGuiSelect, "ALL");
ewol::shortCut::Add("ctrl+shift+a", ednMsgGuiSelect, "NONE");
ewol::shortCut::Add("ctrl+l", ednMsgGuiGotoLine, "???");
// add files
EDN_INFO("show list of files : ");
for( int32_t iii=0 ; iii<ewol::CmdLineNb(); iii++) {
EDN_INFO("need load file : \"" << ewol::CmdLineGet(iii) << "\"" );
ewol::widgetMessageMultiCast::Send(-1, ednMsgOpenFile, ewol::CmdLineGet(iii).c_str());
etk::UString tmpppp = ewol::CmdLineGet(iii);
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgOpenFile, tmpppp);
}
EDN_INFO("==> Init Edn (END)");
}
@@ -139,20 +166,22 @@ void APP_UnInit(void)
// Remove windows :
ewol::DisplayWindows(NULL);
EDN_INFO("Stop Hightlight");
HighlightManager::UnInit();
//Kill all singleton
EDN_INFO("Stop BufferManager");
BufferManager::Kill();
BufferManager::UnInit();
EDN_INFO("Stop ColorizeManager");
ColorizeManager::Kill();
ColorizeManager::UnInit();
EDN_INFO("Stop Search");
Search::Kill();
//Search::Kill();
//EDN_INFO("Stop Accel key");
//AccelKey::Kill();
if (NULL != basicWindows) {
delete(basicWindows);
basicWindows->MarkToRemove();
basicWindows = NULL;
}
basicWindows = NULL;
EDN_INFO("==> Un-Init Edn (END)");
}

View File

@@ -61,7 +61,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
int32_t i;
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
etk::String ploppp;
etk::UString ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
@@ -105,7 +105,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
//EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
etk::String ploppp;
etk::UString ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
@@ -148,7 +148,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
}
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
etk::String ploppp;
etk::UString ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}

View File

@@ -1,97 +0,0 @@
/**
*******************************************************************************
* @file AccelKey.cpp
* @brief Editeur De N'ours : Basic Gui Accelerator Key (common for ALL) or nearly (Sources)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <AccelKey.h>
#if 0
AccelKey::AccelKey(void)
{
m_accelGroup = gtk_accel_group_new();
}
AccelKey::~AccelKey(void)
{
}
void AccelKey::SetAccel(GtkWidget * widget, char * accelKey)
{
SetAccel(widget, m_accelGroup, accelKey);
}
void AccelKey::SetAccel(GtkWidget * widget, GtkAccelGroup * accel, char * accelKey)
{
guint accel_key = 0;
int32_t accel_mods = 0;
if( NULL==accelKey
|| 0==strlen(accelKey))
{
return;
}
// parsing of the string :
//"ctrl+shift+alt+pomme+s"
//EDN_DEBUG("Parse acxel string : \"" << accelKey << "\"");
char * tmp = strstr(accelKey, "ctrl");
if(NULL != tmp) {
accel_mods |= GDK_CONTROL_MASK;
//EDN_DEBUG(" => find CTRL");
}
tmp = strstr(accelKey, "shift");
if(NULL != tmp) {
accel_mods |= GDK_SHIFT_MASK;
//EDN_DEBUG(" => find SHIFT");
}
tmp = strstr(accelKey, "alt");
if(NULL != tmp) {
accel_mods |= GDK_MOD1_MASK;
//EDN_DEBUG(" => find ALT");
}
tmp = strstr(accelKey, "pomme");
if(NULL != tmp) {
accel_mods |= GDK_MOD2_MASK;
//EDN_DEBUG(" => find POMME");
}
accel_key = accelKey[strlen(accelKey) -1];
//char plop = accel_key;
//EDN_DEBUG(" => find letter : '" << plop << "'");
// Ajout du racourcis clavier :
gtk_widget_add_accelerator( widget, "activate", accel,
accel_key, // key
(GdkModifierType)accel_mods, // modifier keys
GTK_ACCEL_VISIBLE);
}
void AccelKey::LinkCommonAccel(GtkWidget * widget)
{
gtk_window_add_accel_group(GTK_WINDOW(widget), m_accelGroup);
}
void AccelKey::LinkCommonAccel(GtkWindow * widget)
{
gtk_window_add_accel_group(GTK_WINDOW(widget), m_accelGroup);
}
#endif

View File

@@ -1,56 +0,0 @@
/**
*******************************************************************************
* @file AccelKey.h
* @brief Editeur De N'ours : Basic Gui Accelerator Key (common for ALL) or nearly (header)
* @author Edouard DUPIN
* @date 17/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ACCEL_KEY_H__
#define __ACCEL_KEY_H__
#include <tools_debug.h>
#include <etk/Singleton.h>
/*
// need to create a syngleton ...
class AccelKey: public Singleton<AccelKey>
{
friend class Singleton<AccelKey>;
// specific for sigleton system...
private:
// Constructeur
AccelKey(void);
~AccelKey(void);
public:
// for internal Parsing
void SetAccel(GtkWidget * widget, char * accelKey);
// For external parsing
void SetAccel(GtkWidget * widget, GtkAccelGroup * accel, char * accelKey);
void LinkCommonAccel(GtkWidget * widget);
void LinkCommonAccel(GtkWindow * widget);
GtkAccelGroup * GetAccel(void) { return m_accelGroup; };
private:
GtkAccelGroup * m_accelGroup;
};
*/
#endif

View File

@@ -23,12 +23,9 @@
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <MsgBroadcast.h>
// new list of edn event generic :
////////////////////////////////////////////////////////////////////////
// Event of the gui request something :
////////////////////////////////////////////////////////////////////////

View File

@@ -26,11 +26,6 @@
#ifndef __MSG_BROADCAST_H__
#define __MSG_BROADCAST_H__
#include <tools_debug.h>
#include <etk/String.h>
// new list of edn event generic :
////////////////////////////////////////////////////////////////////////
// Event of the gui request something :
////////////////////////////////////////////////////////////////////////
@@ -51,7 +46,7 @@
extern const char* const ednMsgGuiSearch; // data : ""
extern const char* const ednMsgGuiReplace; // data : ""
extern const char* const ednMsgGuiFind; // data : "Next" "Previous"
extern const char* const ednMsgGuiFind; // data : "Next" "Previous" "All" "None"
extern const char* const ednMsgGuiChangeColor; // data : "Black" "White"
extern const char* const ednMsgGuiChangeCharset; // data : "UTF-8" "ISO-8859-1" "ISO-8859-15"

View File

@@ -59,7 +59,7 @@ extern const char * ednLog;
# define EDN_VERBOSE(data) do {}while(0)
#endif
#define EDN_TODO(data) DRAW_WARNING("TODO : " << data)
#define EDN_TODO(data) ETK_WARNING(ednLog, "TODO : " << data)
#define EDN_ASSERT(cond, data) ETK_ASSERT(ednLog, cond, data)

View File

@@ -26,7 +26,7 @@
#include <tools_globals.h>
#include <ColorizeManager.h>
#include <MsgBroadcast.h>
#include <ewol/WidgetMessageMultiCast.h>
#include <ewol/EObject.h>
#undef __class__
#define __class__ "globals"

View File

@@ -5,50 +5,45 @@
###############################################################################
# ExuberantCtags reading file tools (extern OPEN Sources) :
FILE_LIST+= edn/ctags/readtags.cpp \
FILE_LIST+= edn/ctags/readtags.cpp \
edn/ctags/CTagsManager.cpp
# Globals debug tool:
FILE_LIST+= edn/tools/debug/tools_debug.cpp \
edn/tools/globals/tools_globals.cpp \
FILE_LIST+= edn/tools/debug/tools_debug.cpp \
edn/tools/globals/tools_globals.cpp \
edn/tools/memory/toolsMemory.cpp
# Buffers internal:
FILE_LIST+= edn/tools/EdnTemplate/EdnVectorBuf.cpp \
edn/tools/EdnBuf/EdnBuf.cpp \
edn/tools/EdnBuf/EdnBuf_HighLight.cpp \
edn/tools/EdnBuf/EdnBuf_History.cpp \
edn/tools/EdnBuf/EdnBuf_Selection.cpp \
FILE_LIST+= edn/tools/EdnTemplate/EdnVectorBuf.cpp \
edn/tools/EdnBuf/EdnBuf.cpp \
edn/tools/EdnBuf/EdnBuf_HighLight.cpp \
edn/tools/EdnBuf/EdnBuf_History.cpp \
edn/tools/EdnBuf/EdnBuf_Selection.cpp \
edn/tools/EdnBuf/EdnBufHistory.cpp
# Tools internal:
FILE_LIST+= edn/tools/Display/Display.cpp \
edn/tools/ClipBoard/ClipBoard.cpp \
edn/tools/MsgBroadcast/MsgBroadcast.cpp \
edn/tools/MsgBroadcast/AccelKey.cpp
FILE_LIST+= edn/tools/Display/Display.cpp \
edn/tools/ClipBoard/ClipBoard.cpp \
edn/tools/MsgBroadcast/MsgBroadcast.cpp
# Gui:
FILE_LIST+= edn/CustumWidget/BufferView/BufferView.cpp \
edn/CustumWidget/CodeView/CodeView.cpp \
edn/GuiTools/WindowsManager/WindowsManager.cpp \
edn/GuiTools/MainWindows/MainWindows.cpp \
edn/GuiTools/MainWindows/StatusBar.cpp \
edn/GuiTools/MainWindows/MenuBar.cpp \
edn/GuiTools/MainWindows/ToolBar.cpp \
edn/GuiTools/Search/Search.cpp \
edn/GuiTools/Search/SearchData.cpp
FILE_LIST+= edn/Gui/BufferView.cpp \
edn/Gui/CodeView.cpp \
edn/Gui/MainWindows.cpp \
edn/Gui/Search.cpp \
edn/Gui/SearchData.cpp
# Basic Interface :
FILE_LIST+= edn/Buffer/Buffer.cpp \
edn/Buffer/BufferText.cpp \
edn/Buffer/BufferEmpty.cpp \
edn/Buffer/BufferManager.cpp \
edn/Colorize/Colorize.cpp \
edn/Colorize/ColorizeManager.cpp \
edn/Highlight/HighlightPattern.cpp \
edn/Highlight/Highlight.cpp \
FILE_LIST+= edn/Buffer/Buffer.cpp \
edn/Buffer/BufferText.cpp \
edn/Buffer/BufferEmpty.cpp \
edn/Buffer/BufferManager.cpp \
edn/Colorize/Colorize.cpp \
edn/Colorize/ColorizeManager.cpp \
edn/Highlight/HighlightPattern.cpp \
edn/Highlight/Highlight.cpp \
edn/Highlight/HighlightManager.cpp
# Main entry file :

View File

@@ -1,202 +0,0 @@
/**
*******************************************************************************
* @file pngToCpp.cpp
* @brief convert a binary file into a C source vector
* @author Sandro Sigala
* @date 26/01/2011
* @par Project
* ---
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
* @compilation g++ pngToCpp -o pngToCpp
*
*******************************************************************************
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
bool zeroTerminated = false;
int myfgetc(FILE *f)
{
int c = fgetc(f);
if (c == EOF && zeroTerminated)
{
zeroTerminated = 0;
return 0;
}
return c;
}
void generateHeader(FILE *file)
{
fprintf(file, "/**\n");
fprintf(file, " ******************************************************************************* \n");
fprintf(file, " * \n");
fprintf(file, " * @par Project\n");
fprintf(file, " * Edn\n");
fprintf(file, " * \n");
fprintf(file, " * Automatic generated file for Edn Software\n");
fprintf(file, " * Please do not save this file on File configuration server\n");
fprintf(file, " * \n");
fprintf(file, " * @par Copyright\n");
fprintf(file, " * \n");
fprintf(file, " * Copyright 2010 Edouard DUPIN, all right reserved\n");
fprintf(file, " * \n");
fprintf(file, " * his software is distributed in the hope that it will be useful, but WITHOUT\n");
fprintf(file, " * ANY WARRANTY.\n");
fprintf(file, " * \n");
fprintf(file, " * Licence summary : \n");
fprintf(file, " * You can modify and redistribute the sources code and binaries.\n");
fprintf(file, " * You can send me the bug-fix\n");
fprintf(file, " * You can not earn money with this Software (if the source extract from Edn\n");
fprintf(file, " * represent less than 50/100 of original Sources)\n");
fprintf(file, " * Term of the licence in in the file licence.txt.\n");
fprintf(file, " * \n");
fprintf(file, " ******************************************************************************* \n");
fprintf(file, " */\n\n");
}
FILE *ofile=NULL;
FILE *ofileH=NULL;
void process(const char *ifname)
{
FILE *ifile=NULL;
ifile = fopen(ifname, "rb");
if (ifile == NULL)
{
fprintf(stderr, "cannot open %s for reading\n", ifname);
exit(1);
}
char buf[PATH_MAX], *p;
const char *cp;
if ((cp = strrchr(ifname, '/')) != NULL)
{
++cp;
} else {
if ((cp = strrchr(ifname, '\\')) != NULL)
++cp;
else
cp = ifname;
}
strcpy(buf, cp);
for (p = buf; *p != '\0'; ++p)
{
if (!isalnum(*p))
*p = '_';
}
fprintf(ofile, "unsigned char %s[] = {\n\t\t", buf);
int n = 0;
unsigned char c = 0;
while(fread(&c, 1, 1, ifile) == 1)
{
if(n%100 == 0) {
fprintf(ofile, "\n\t\t");
}
fprintf(ofile, "0x%02x,", c);
n++;
}
fprintf(ofile, "\n};\n");
fprintf(ofile, "unsigned long int %s_size = sizeof(%s);\n\n\n", buf, buf);
fprintf(ofileH, "extern unsigned char %s[];\n", buf);
fprintf(ofileH, "extern unsigned long int %s_size;\n", buf);
fclose(ifile);
}
void usage(void)
{
fprintf(stderr, "usage: pngToCpp <output_file>.xxx <input_file>\n");
exit(1);
}
int main(int argc, char **argv)
{
//zeroTerminated = true;
if (argc < 3) {
usage();
}
// dynamic output name :
char tmpOutput[PATH_MAX*2] = "";
strcpy(tmpOutput, argv[1]);
int32_t sizeName = strlen(tmpOutput);
if (6>=sizeName) {
usage();
}
if (tmpOutput[sizeName-1] == '.') {
tmpOutput[sizeName-1] = '\0';
} else if (tmpOutput[sizeName-2] == '.') {
tmpOutput[sizeName-2] = '\0';
} else if (tmpOutput[sizeName-3] == '.') {
tmpOutput[sizeName-3] = '\0';
} else if (tmpOutput[sizeName-4] == '.') {
tmpOutput[sizeName-4] = '\0';
} else if (tmpOutput[sizeName-5] == '.') {
tmpOutput[sizeName-5] = '\0';
} else if (tmpOutput[sizeName-6] == '.') {
tmpOutput[sizeName-6] = '\0';
}
//fprintf(stderr, "writing to %s\n", tmpOutput);
char tmpOutputCPP[PATH_MAX*2] = "";
char tmpOutputH[PATH_MAX*2] = "";
// Generate the output filename
sprintf(tmpOutputCPP,"%s.cpp", tmpOutput);
sprintf(tmpOutputH,"%s.h", tmpOutput);
// open destination name :
ofile = fopen(tmpOutputCPP, "wb");
if (ofile == NULL)
{
fprintf(stderr, "cannot open %s for writing\n", tmpOutputCPP);
exit(1);
}
generateHeader(ofile);
ofileH = fopen(tmpOutputH, "wb");
if (ofileH == NULL)
{
fprintf(stderr, "cannot open %s for writing\n", tmpOutputH);
exit(1);
}
generateHeader(ofileH);
fprintf(ofileH, "#ifndef __INPUT_PNG_FILE_GENERATED_H__\n");
fprintf(ofileH, "#define __INPUT_PNG_FILE_GENERATED_H__\n");
//fprintf(ofileH, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
//fprintf(ofile, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
// Generate the output
int32_t i;
for(i=2; i<argc; i++) {
process(argv[i]);
}
//fprintf(ofile, "#ifdef __cplusplus\n}\n#endif\n");
//fprintf(ofileH, "#ifdef __cplusplus\n}\n#endif\n");
fprintf(ofileH, "#endif\n\n");
// Close destination files
fclose(ofile);
fclose(ofileH);
return 0;
}