62 Commits

Author SHA1 Message Date
472b85b94b Display corection of the enter and rm will now redisplay all the screen 2011-10-05 18:07:35 +02:00
d21a3892df add comment @ in asm code and do not request redraw in GTK3.0 2011-10-04 18:11:33 +02:00
eff5e3ae25 Some amelioration of the redrawing 2011-10-04 13:19:29 +02:00
85806b2638 force the redraw when get the focus ... 2011-10-04 13:03:40 +02:00
4477ef0ab5 basic optimisation of line update ==> not tested 2011-10-03 22:31:54 +02:00
7cf06ba256 sys: first correct version of the display line by line 2011-09-29 17:50:26 +02:00
df4b14611e redisplay lines where we are adding char 2011-09-28 17:42:07 +02:00
127ad0aac5 Little clean 2011-09-28 09:16:33 +02:00
1d0bcd7087 buffer list : normalize the display methode 2011-09-22 17:07:57 +02:00
d3efb637ab internal doubleBuffer with re-copy ==> OK 2011-09-22 15:01:49 +02:00
3dad4f219b first test of internal double buffer ==> display is bad... 2011-09-20 18:27:11 +02:00
74cfca4516 Sys: request redraw of a specific area of a widget 2011-09-19 17:40:31 +02:00
db85018627 SYS: page up and page down coorection 2011-09-19 10:06:18 +02:00
9bad01fc37 sys : rework seem fonctionnal (slow) and a correction start selection error 2011-09-18 20:46:05 +02:00
89394d5770 sys : back to normal compilation and working ok (slow but ok) 2011-09-18 16:43:57 +02:00
03484cc85d sys: rework internal compilation ok 2011-09-18 13:35:24 +02:00
7fbfe1f86a gui : change the display of internal Titile 2011-09-15 18:16:44 +02:00
745ca76a74 SYS : next step of the new display methode ... 2011-09-12 16:43:13 +02:00
2712d4f67d SYS: Buffer anchor mechanism first step 2011-09-11 22:46:36 +02:00
bdc4793955 SYS : remove blobal clean in the main displayer 2011-09-10 10:40:00 +02:00
650206f04e SYS : key error in gtk 3.0 2011-09-08 21:52:02 +02:00
d21d661f15 SYS : color display is back ==> but so slow ... 2011-09-08 14:57:25 +02:00
f5f97c53de SYS : Selection is Back 2011-09-08 14:22:05 +02:00
d78a67f99f SYS : display with left and right movement is back 2011-09-08 14:09:20 +02:00
0b2599fb81 SYS : First step for the display line by line 2011-09-07 18:17:05 +02:00
83dd23b8a9 try to find the error of italic, it seam that cairo does not support monospace italic 2011-09-06 17:05:06 +02:00
2714560c38 SYS : Indent with TAB only when multiple line selected 2011-09-06 09:11:51 +02:00
e48c75df72 gui : Add the current folder in the title area 2011-09-05 10:02:17 +02:00
1de1f787e7 sys : corection of the keypad enter and add the shift+enter replacement with \r 2011-09-05 09:50:15 +02:00
1b3dd3ce98 SYS : catch the shift+tab event 2011-09-04 12:08:48 +02:00
0e6c34d2a0 change the avancement list ==> set it to mabage future version developement 2011-09-04 11:23:01 +02:00
325034bbc0 HL : add bash elif 2011-09-02 17:22:07 +02:00
fc9b98f09e TEST : color changing of menu 2011-09-01 17:58:04 +02:00
a497b028ca GUI : update the display of the about windows to use gtk:about 2011-09-01 16:04:12 +02:00
88b76c074d SYS : Add a Edn:VectorType eraseLen and an erase ==> normalisation with std::vector 2011-09-01 14:34:06 +02:00
28b709bfb8 SYS : Confirm Save when exit 2011-09-01 13:38:12 +02:00
1c01dbd7cd SYS : Change position of the close request message ==> the good position 2011-09-01 09:45:37 +02:00
948240f05f LOG : Remove the change state of the Main windows 2011-08-31 10:11:22 +02:00
990828c69c Error in installation of software 2011-08-31 10:10:03 +02:00
72f63a8990 DISPLAY : add a menu to change the color on the fly 2011-08-31 09:42:30 +02:00
4d2eced7a0 Change name of readme 2011-08-30 09:43:45 +02:00
6598a22981 change format of github readme 2011-08-30 09:42:14 +02:00
01276b581f SEARCH : Change the hide policy 2011-08-26 17:59:38 +02:00
fd13467832 REPLACE : addition done 2011-08-24 12:13:57 +02:00
643f2e38b3 CTAGS : Back is done but the display result is not the best I can do... 2011-08-24 09:44:10 +02:00
c30f57b3f7 GUI : change some displayable element : think at a new methode of gui will be organized 2011-08-19 18:10:46 +02:00
514a5cf003 GUI : Reload on the fly the Color file 2011-08-19 16:09:58 +02:00
0c1f6004eb GUI : Maximisation remove the 'decoration of the windows' ==> need to be an option 2011-08-18 22:50:29 +02:00
c02747d8fb GUI : Add the basic icon for Edn ... must change the color, maybe 2011-08-17 12:24:51 +02:00
80dae2dab9 MAKEFILE : Remove the Abstraction Layer (deprecated) 2011-08-17 12:23:27 +02:00
bd8c11a9da LANG : Add matlab basic parser (not compleate)
HL : Corection of a parser bug
2011-08-16 10:01:28 +02:00
1f08a99ac1 CTAGS : multiple jump OK ... ==> need to go back now... 2011-08-14 11:32:31 +02:00
0eeb214369 HL : Add bash colorisation (basic) 2011-08-12 16:56:32 +02:00
f5911d5463 CTAGS : Set the display of the file for the multiple jump list .
TODO : Set the selection keep when press jump button
TODO : Double click on a specific raw
2011-08-10 15:56:48 +02:00
1f8d3cf045 Remove tag file in the repository 2011-08-10 09:20:54 +02:00
54cc9da39f HL : End of the parsing Error corection 2011-08-09 17:07:03 +02:00
7562c45aa7 CONFIG : update the xml parsing config : XML and boo files 2011-08-09 15:11:58 +02:00
d96a133c6a HL : Correction of a bug of reparsing the buffer betwwen 2 element Erase was not implemented as std::vector ==> I might change this ... 2011-08-09 14:28:58 +02:00
5a47446a09 Remove warning and Custom menuContext 2011-08-08 14:15:44 +02:00
a196c615bf Remove std::vector and std::string from the sources for reson of portability 2011-08-08 14:06:11 +02:00
2c6f280c58 new parsing mode of HL Done with success ==> can have some residual errors
TODO : Recursive Hightlight
2011-08-08 10:24:24 +02:00
722dafaaef base aof te new hilight system 2011-08-07 22:34:27 +02:00
71 changed files with 3063 additions and 5194 deletions

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ doxygen/ALL/
*.o
*.so
*.pyc
tags
edn
out
edn_debug

View File

@@ -53,9 +53,9 @@ DEBUG:=1
###############################################################################
### Compilation Define ###
###############################################################################
ifeq ("$(DEBUG)", "0")
ifeq ("$(DEBUG)", "0")
DEFINE= -DEDN_DEBUG_LEVEL=1 -DNDEBUG -DVERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
else
else
DEFINE= -DEDN_DEBUG_LEVEL=3 -DVERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
endif
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
@@ -155,8 +155,7 @@ CXXFILES+= tools/EdnTemplate/EdnVectorBuf.cpp \
tools/EdnBuf/EdnBufHistory.cpp
# Tools internal:
CXXFILES+= tools/AL/AL_Mutex.cpp \
# Tools internal:
CXXFILES+= tools/Display/Display.cpp \
tools/ClipBoard/ClipBoard.cpp \
tools/MsgBroadcast/MsgBroadcast.cpp \
@@ -175,8 +174,7 @@ CXXFILES+= CustumWidget/BufferView/BufferView.cpp \
GuiTools/MainWindows/StatusBar.cpp \
GuiTools/MainWindows/MenuBar.cpp \
GuiTools/MainWindows/ToolBar.cpp \
GuiTools/Search/Search.cpp \
GuiTools/Search/SearchData.cpp \
GuiTools/Search/Search.cpp \
GuiTools/Search/SearchData.cpp
# Basic Interface :
@@ -222,11 +220,10 @@ build: .encadrer .versionFile $(OUTPUT_NAME)
@echo $(CADRE_COTERS)
@echo '
DEBUT DE COMPILATION DU PROGRAMME :'$(CADRE_COTERS)
@echo '
@echo '
Repertoire Sources : $(FILE_DIRECTORY)/'$(CADRE_COTERS)
@echo '
Repertoire object : $(OBJECT_DIRECTORY)/'$(CADRE_COTERS)
@echo '
@echo '
Binaire de sortie : $(F_VIOLET)$(OUTPUT_NAME) $(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_COTERS)
@@ -297,7 +294,11 @@ install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS)
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@echo $(F_ROUGE)"
(stripped) $(OUTPUT_NAME_RELEASE) => $(PROG_NAME) "$(F_NORMALE)
@cp $(OUTPUT_NAME_RELEASE) $(PROG_NAME)
@strip -s $(PROG_NAME)
@echo $(F_VERT)"

21
README
View File

@@ -1,21 +0,0 @@
Edn (Editeur De N'ours) is a FREE software.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
Terms of license:
You can:
- Redistribute the sources code and binaries.
- Modify the Sources code.
- 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).
- Redistribute the modification only if you want.
- Send me the bug-fix (it could be great).
- Pay me a beer or some other things.
- Print the source code on WC paper ...
You can NOT:
- Earn money with this Software (But I can).
- Add malware in the Sources.
- Do something bad with the sources.
- Use it to travel in the space with a toaster.
I reserve the right to change this licence. If it change the version of the copy you have keep its own license

41
README.md Normal file
View File

@@ -0,0 +1,41 @@
Edn
====
`Edn` (Editeur De N'ours) is a FREE software.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
Instructions
============
download the software :
git clone git://github.com/HeeroYui/edn.git
cd edn
Compile software and install :
sudo make DEBUG=0 install
Run Software :
edn exemple.txt
License
=======
You can:
- Redistribute the sources code and binaries.
- Modify the Sources code.
- 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).
- Redistribute the modification only if you want.
- Send me the bug-fix (it could be great).
- Pay me a beer or some other things.
- Print the source code on WC paper ...
You can NOT:
- Earn money with this Software (But I can).
- Add malware in the Sources.
- Do something bad with the sources.
- Use it to travel in the space with a toaster.
I reserve the right to change this licence. If it change the version of the copy you have keep its own license

View File

@@ -41,12 +41,32 @@
*/
Buffer::Buffer()
{
static int32_t bufID = 0;
m_uniqueID = bufID++;
static int32_t fileBasicID = 0;
m_fileModify = true;
m_haveName = false;
Edn::String mString = "Untitle - ";
mString += fileBasicID++;
SetFileName(mString);
m_haveName = false;
// Set basic anchor
bufferAnchorReference_ts tmpAnchor;
tmpAnchor.m_displaySize.x = 0;
tmpAnchor.m_displaySize.y = 0;
tmpAnchor.m_displayStart.x = 0;
tmpAnchor.m_curent = true;
tmpAnchor.m_idAnchor = -1;
tmpAnchor.m_lineId = 0;
tmpAnchor.m_bufferPos = 0;
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
tmpAnchor.m_redrawLine[iii] = true;
}
tmpAnchor.m_BufferNumberLineOffset = 0;
m_AnchorList.PushBack(tmpAnchor);
m_lineWidth = 10;
m_lineHeight = 10;
}
/**
@@ -61,6 +81,20 @@ Buffer::Buffer(Edn::File &newName)
{
m_fileModify = false;
SetFileName(newName);
// Set basic anchor
bufferAnchorReference_ts tmpAnchor;
tmpAnchor.m_displaySize.x = 0;
tmpAnchor.m_displaySize.y = 0;
tmpAnchor.m_displayStart.x = 0;
tmpAnchor.m_curent = true;
tmpAnchor.m_idAnchor = -1;
tmpAnchor.m_lineId = 0;
tmpAnchor.m_bufferPos = 0;
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
tmpAnchor.m_redrawLine[iii] = true;
}
tmpAnchor.m_BufferNumberLineOffset = 0;
m_AnchorList .PushBack(tmpAnchor);
}
/**
@@ -137,6 +171,19 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
// nothing to do
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Buffer::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
{
return;
}
/**
* @brief
@@ -146,9 +193,15 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
* @return ---
*
*/
int32_t Buffer::Display(DrawerManager &drawer)
void Buffer::DrawLineEmpty(DrawerManager &drawer, int32_t lineScreenID)
{
return ERR_NONE;
ColorizeManager * myColorManager = ColorizeManager::getInstance();
int32_t positionY = m_lineHeight * (lineScreenID);
# ifdef NDEBUG
drawer.Rectangle(myColorManager->Get(COLOR_CODE_BASIC_BG), 0, positionY, drawer.GetWidth(), m_lineHeight );
# else
drawer.Rectangle(myColorManager->Get(COLOR_CODE_CURSOR), 0, positionY, drawer.GetWidth(), m_lineHeight );
# endif
}
/**
@@ -235,7 +288,6 @@ void Buffer::ScrollUp(void)
// nothing to do
}
/**
* @brief
*
@@ -244,13 +296,6 @@ void Buffer::ScrollUp(void)
* @return ---
*
*/
void Buffer::ForceReDraw(bool allElement)
{
// nothing to do
}
void Buffer::cursorMove(int32_t gtkKey)
{
// nothing to do
@@ -282,6 +327,7 @@ void Buffer::Replace(Edn::String &data)
int32_t Buffer::FindLine(Edn::String &data)
{
// nothing to do
return 0;
}
void Buffer::JumpAtLine(int32_t newLine)
@@ -289,6 +335,21 @@ void Buffer::JumpAtLine(int32_t newLine)
// nothing to do
}
/**
* @brief Get the current line (to know where to jump)
*
* @param ---
*
* @return Return the current line number
*
*/
int32_t Buffer::GetCurrentLine(void)
{
return 0;
}
/**
* @brief request a copy of the selection in the named clipBoard ID
*
@@ -332,7 +393,7 @@ void Buffer::Paste(int8_t clipboardID)
void Buffer::RemoveLine(void)
{
// nothing to do
// nothing to do;
}
void Buffer::SelectAll(void)
@@ -355,3 +416,220 @@ void Buffer::Redo(void)
// nothing to do
}
void Buffer::AnchorAdd(int32_t anchorID)
{
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
EDN_ERROR("[" << m_uniqueID << "] AnchorID="<< anchorID << " already exist !!!");
} else {
bufferAnchorReference_ts tmpAnchor = m_AnchorList[0];
m_AnchorList[0].m_curent = false;
tmpAnchor.m_idAnchor = anchorID;
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
tmpAnchor.m_redrawLine[iii] = true;
}
m_AnchorList.PushBack(tmpAnchor);
EDN_DEBUG("[" << m_uniqueID << "] AnchorID="<< anchorID << " ==> Added");
}
}
void Buffer::AnchorRm(int32_t anchorID)
{
if (anchorID == -1) {
EDN_ERROR("[" << m_uniqueID << "] AnchorID="<< anchorID << " Can not remove this one !!!");
return;
}
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
if (m_AnchorList.Size() == 2) {
m_AnchorList[0] = m_AnchorList[1];
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
m_AnchorList[0].m_redrawLine[iii] = true;
}
m_AnchorList[0].m_BufferNumberLineOffset = 0;
}
m_AnchorList.Erase(localID);
EDN_DEBUG("[" << m_uniqueID << "] AnchorID="<< anchorID << " ==> Remove");
} else {
EDN_ERROR("[" << m_uniqueID << "] AnchorID="<< anchorID << " does not exist !!!");
}
}
void Buffer::AnchorRedrawAll(int32_t anchorID)
{
if (anchorID == -1) {
EDN_ERROR("[" << m_uniqueID << "] AnchorID="<< anchorID << " Can not redraw this one !!!");
return;
}
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
AnchorForceRedrawAll(localID);
} else {
EDN_ERROR("[" << m_uniqueID << "] AnchorID="<< anchorID << " does not exist !!!");
}
}
bool Buffer::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
{
EDN_ERROR("[" << m_uniqueID << "] AnchorID="<< anchorID << " Main buffer ==> can not manage Anchor (type buffer specific)");
return false;
}
bool Buffer::AnchorNext(bufferAnchor_ts & anchor)
{
EDN_ERROR("[" << m_uniqueID << "] AnchorID=?? Main buffer ==> can not manage Anchor (type buffer specific)");
return false;
}
void Buffer::AnchorSetSize(int32_t anchorID, int32_t sizePixelX, int32_t sizePixelY)
{
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
position_ts mySize;
mySize.x = sizePixelX / m_lineWidth;
mySize.y = sizePixelY / m_lineHeight;
if( m_AnchorList[localID].m_displaySize.x != mySize.x
|| m_AnchorList[localID].m_displaySize.y != mySize.y )
{
AnchorForceRedrawAll(localID);
}
m_AnchorList[localID].m_displaySize = mySize;
}
}
void Buffer::AnchorSetStartOffset(int32_t anchorID, int32_t offsetX, int32_t offsetY)
{
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
m_AnchorList[localID].m_displayStart.x += offsetX;
if (0<m_AnchorList[localID].m_displayStart.x) {
m_AnchorList[localID].m_displayStart.x = 0;
}
m_AnchorList[localID].m_displayStart.y += offsetY;
if (0<m_AnchorList[localID].m_displayStart.y) {
m_AnchorList[localID].m_displayStart.y = 0;
}
AnchorForceRedrawAll(localID);
}
}
int32_t Buffer::AnchorRealId(int32_t anchorID)
{
//EDN_DEBUG("Get real ID : " << anchorID << " in the anchor list size()=" << m_AnchorList.Size());
for(int32_t iii=0; iii < m_AnchorList.Size(); iii++) {
//EDN_DEBUG("check if equal : " << m_AnchorList[iii].m_idAnchor << " id=" << iii);
if (m_AnchorList[iii].m_idAnchor == anchorID) {
return iii;
}
}
return -1;
}
int32_t Buffer::AnchorCurrentId(void)
{
for(int32_t iii=0; iii < m_AnchorList.Size(); iii++) {
if (m_AnchorList[iii].m_curent == true) {
return iii;
}
}
return 0;
}
void Buffer::AnchorForceRedrawAll(int32_t realAnchorId)
{
EDN_DEBUG("AnchorForceRedrawAll(" << realAnchorId << ")");
if (-5000 == realAnchorId) {
int32_t localID = AnchorCurrentId();
if (localID >=0) {
m_AnchorList[localID].m_BufferNumberLineOffset = 0;
for(int32_t iii=0; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = true;
}
}
} else {
m_AnchorList[realAnchorId].m_BufferNumberLineOffset = 0;
for(int32_t iii=0; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
m_AnchorList[realAnchorId].m_redrawLine[iii] = true;
}
}
}
void Buffer::AnchorForceRedrawLine(int32_t lineID)
{
for(int32_t iii=0; iii < m_AnchorList.Size(); iii++) {
if( m_AnchorList[iii].m_displayStart.y <= lineID
&& m_AnchorList[iii].m_displayStart.y + MAX_LINE_DISPLAYABLE_BY_BUFFER > lineID )
{
m_AnchorList[iii].m_redrawLine[lineID-m_AnchorList[iii].m_displayStart.y] = true;
}
}
}
// TODO : optimiser cette fonction qui met plusieurs fois des variables a true ....
void Buffer::AnchorForceRedrawOffsef(int32_t offset)
{
EDN_DEBUG("** => set ofset : " << offset);
if (0 == offset) {
EDN_DEBUG("No apply offset ...");
return;
}
int32_t localID = AnchorCurrentId();
if (localID >=0) {
EDN_DEBUG("offset ID=" << localID);
m_AnchorList[localID].m_BufferNumberLineOffset += offset;
EDN_DEBUG("move redraw request : [" << m_AnchorList[localID].m_displaySize.y << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER << "[=true");
for(int32_t iii=m_AnchorList[localID].m_displaySize.y; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = true;
}
int32_t maxSize = edn_min(m_AnchorList[localID].m_displaySize.y, MAX_LINE_DISPLAYABLE_BY_BUFFER);
if (offset < 0) {
if (-1 * offset < maxSize) {
EDN_DEBUG("move redraw request : ]" << maxSize << "," << -1*offset << "]=]" << maxSize+offset << "," << -1*offset + offset << "]");
for(int32_t iii=maxSize-1; iii >= -1*offset; iii--) {
m_AnchorList[localID].m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii+offset];
}
EDN_DEBUG("move redraw request : [" << 0 << "," << -1*offset << "[=true");
for(int32_t iii=0; iii < -1*offset; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = true;
}
} else {
EDN_WARNING("FORCE a total redraw... 1");
for(int32_t iii=0; iii < maxSize; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = true;
}
}
} else {
if (offset < maxSize) {
EDN_DEBUG("move redraw request : [" << 0 << "," << maxSize-offset << "[=[" << offset << "," << maxSize << "[");
for(int32_t iii=0; iii < maxSize-offset ; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii+offset];
}
// note the -1 is to force the redisplay of the previous of the last line ==> special case of the gtk 3.0 marker to resize the windows
EDN_DEBUG("move redraw request : [" << maxSize-offset-1 << "," << maxSize << "[=true");
for(int32_t iii=maxSize-offset-1; iii < maxSize; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = true;
}
} else {
EDN_WARNING("FORCE a total redraw... 2");
for(int32_t iii=0; iii < maxSize; iii++) {
m_AnchorList[localID].m_redrawLine[iii] = true;
}
}
}
} else {
EDN_ERROR("can not find the real ID in linste.Size()=" << m_AnchorList.Size());
}
}

View File

@@ -31,15 +31,43 @@
#include "charset.h"
#include "Edn.h"
#define MAX_LINE_DISPLAYABLE_BY_BUFFER (200)
typedef struct{
uint32_t nbTotalLine; //!< Number of line in the buffer
uint32_t nbTotalColomn; //!< Number of line in the buffer
uint32_t startLineDisplay; //!< First line display.
uint32_t startColomnDisplay; //!< First Colomn displayed
uint32_t diplayableColomn; //!< NB colomn that can be displayed
uint32_t diplayableLine; //!< NB Line that can be displayed
}infoStatBuffer_ts;
extern "C"
{
typedef struct{
uint32_t nbTotalLine; //!< Number of line in the buffer
uint32_t nbTotalColomn; //!< Number of line in the buffer
uint32_t startLineDisplay; //!< First line display.
uint32_t startColomnDisplay; //!< First Colomn displayed
uint32_t diplayableColomn; //!< NB colomn that can be displayed
uint32_t diplayableLine; //!< NB Line that can be displayed
}infoStatBuffer_ts;
typedef struct {
int32_t m_idAnchor; //!< reference id of the anchor (real id of the upper displayer of CodeView)
bool m_curent; //!< set at true if the anchor is a reference with the curent display
int32_t m_lineId; //!< first line ID to display
int32_t m_bufferPos; //!< position of the first lineId
position_ts m_displayStart; //!< start display position
position_ts m_displaySize; //!< size of the curent display
bool m_redrawLine[MAX_LINE_DISPLAYABLE_BY_BUFFER]; //!< List of the current line that must be redisplayed
int32_t m_BufferNumberLineOffset; //!< number of line that might be an ofset on the curent screen
} bufferAnchorReference_ts;
typedef struct {
position_ts m_displayStart; //!< start display position
position_ts m_displaySize; //!< size of the curent display
int32_t m_lineNumber; //!< current line-number id
int32_t m_nbIterationMax; //!< number of cycle needed to end the dispalay
int32_t m_posStart; //!< position of the start of the line
int32_t m_posStop; //!< position of the end of the line
int32_t m_selectionPosStart; //!< position of the selection start
int32_t m_selectionPosStop; //!< position of the selection stop
bool m_redrawLine[MAX_LINE_DISPLAYABLE_BY_BUFFER]; //!< List of the current line that must be redisplayed
int32_t m_BufferNumberLineOffset; //!< number of line that might be an ofset on the curent screen
} bufferAnchor_ts;
}
class Buffer {
@@ -81,22 +109,25 @@ class Buffer {
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
virtual void SetLineDisplay(uint32_t lineNumber);
virtual int32_t Display(DrawerManager &drawer);
virtual void ForceReDraw(bool allElement);
virtual void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
virtual void DrawLineEmpty(DrawerManager &drawer, int32_t lineScreenID);
// return the new cursor position ...
virtual void AddChar(char * UTF8data);
virtual void cursorMove(int32_t gtkKey);
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
virtual void MouseEvent(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);
virtual void Undo(void);
virtual void Redo(void);
virtual void SetCharset(charset_te newCharset) {};
virtual void ScrollDown(void); // must be deprecated
virtual void ScrollUp(void); // must be deprecated
//virtual void SelectAll(void);
virtual void Copy(int8_t clipboardID);
@@ -106,12 +137,35 @@ class Buffer {
virtual void Replace(Edn::String &data);
virtual int32_t FindLine(Edn::String &data);
virtual void JumpAtLine(int32_t newLine);
virtual int32_t GetCurrentLine(void);
protected:
bool m_fileModify; //!<
// naming
Edn::File m_fileName; //!< filename of the curent buffer
bool m_haveName; //!< to know if the file have a name or NOT
// anchor section
public:
void AnchorAdd(int32_t anchorID);
void AnchorRm(int32_t anchorID);
void AnchorRedrawAll(int32_t anchorID);
virtual bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
virtual bool AnchorNext(bufferAnchor_ts & anchor);
void AnchorSetSize(int32_t anchorID, int32_t sizePixelX, int32_t sizePixelY);
void AnchorSetStartOffset(int32_t anchorID, int32_t offsetX, int32_t offsetY);
protected:
int32_t m_lineWidth;
int32_t m_lineHeight;
int32_t AnchorRealId(int32_t anchorID);
int32_t AnchorCurrentId(void);
void AnchorForceRedrawAll(int32_t realAnchorId = -5000);
void AnchorForceRedrawLine(int32_t lineID);
void AnchorForceRedrawOffsef(int32_t offset);
Edn::VectorType<bufferAnchorReference_ts> m_AnchorList; //!< list of all line anchor in the current buffer
int32_t m_uniqueID;
};

View File

@@ -42,7 +42,8 @@
*/
BufferEmpty::BufferEmpty()
{
m_lineWidth = Display::GetFontWidth();
m_lineHeight = Display::GetFontHeight()*4;
}
/**
@@ -67,32 +68,58 @@ BufferEmpty::~BufferEmpty(void)
* @return ---
*
*/
int32_t BufferEmpty::Display(DrawerManager &drawer)
void BufferEmpty::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
{
EDN_DEBUG("Request draw : " << anchor.m_lineNumber);
ColorizeManager * myColorManager = ColorizeManager::getInstance();
// Get color :
Colorize *myColor = NULL;
// Clean Buffer
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG) );
myColor = myColorManager->Get("normal");
// Draw the 2 comments Lines :
drawer.Text(myColor, 20,20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique");
//drawer.Flush();
myColor = myColorManager->Get("commentDoxygen");
drawer.Text(myColor, 20,25 + Display::GetFontHeight(), "No Buffer Availlable to display");
drawer.Flush();
/*
myColor = myColorManager->Get(("SelectedText"));
drawer.Cursor(20, 50);
drawer.EndOfLine(20, 70);
drawer.Tabulation(myColor, 20, 90, 5);
drawer.UTF8UnknownElement(myColor, 20, 120, 3, false);
drawer.Flush();
*/
return ERR_NONE;
if (anchor.m_lineNumber == 0) {
// Clean Buffer
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG) );
myColor = myColorManager->Get("normal");
drawer.Text(myColor, 20,20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique");
}
if (anchor.m_lineNumber == 1) {
myColor = myColorManager->Get("commentDoxygen");
drawer.Text(myColor, 20,25 + Display::GetFontHeight(), "No Buffer Availlable to display");
}
return;
}
bool BufferEmpty::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
{
int32_t localID = AnchorRealId(anchorID);
if (localID >=0) {
EDN_DEBUG("Request anchor");
anchor.m_displaySize.x = m_AnchorList[localID].m_displaySize.x;
anchor.m_displaySize.y = m_AnchorList[localID].m_displaySize.y;
anchor.m_displayStart.x = m_AnchorList[localID].m_displayStart.x;
anchor.m_displayStart.y = m_AnchorList[localID].m_displayStart.y;
anchor.m_nbIterationMax = 2;
anchor.m_lineNumber = m_AnchorList[localID].m_lineId;
anchor.m_posStart = -1;
anchor.m_posStop = -1;
anchor.m_selectionPosStart = -1;
anchor.m_selectionPosStop = -1;
return true;
} else {
return false;
}
}
bool BufferEmpty::AnchorNext(bufferAnchor_ts & anchor)
{
anchor.m_lineNumber++;
EDN_DEBUG("Anchor Next : " << anchor.m_lineNumber);
anchor.m_nbIterationMax--;
if (anchor.m_nbIterationMax<=0) {
return false;
}
return true;
}

View File

@@ -32,8 +32,10 @@ class BufferEmpty : public Buffer {
public:
BufferEmpty(void);
virtual ~BufferEmpty(void);
virtual int32_t Display(DrawerManager &drawer);
void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
bool AnchorNext(bufferAnchor_ts & anchor);
};

View File

@@ -51,7 +51,7 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
int32_t Open(Edn::File &myFile);
int32_t GetSelected(void) { return m_idSelected;};
void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(Edn::File &myFile);
int32_t GetId(Edn::File &myFile);

File diff suppressed because it is too large Load Diff

View File

@@ -26,8 +26,6 @@
#ifndef __BUFFER_TEXT_H__
#define __BUFFER_TEXT_H__
#include <vector>
#include <string>
#include "ColorizeManager.h"
#include "Buffer.h"
#include "EdnBuf.h"
@@ -38,63 +36,63 @@ typedef enum {
CURSOR_DISPLAY_MODE_NOT_FOCUS,
} cursorDisplayMode_te;
class BufferText : public Buffer {
public:
BufferText(void);
BufferText(Edn::File &fileName);
virtual ~BufferText(void);
void Save(void);
BufferText(void);
BufferText(Edn::File &fileName);
virtual ~BufferText(void);
void Save(void);
void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber);
void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber);
int32_t Display(DrawerManager &drawer);
void ForceReDraw(bool allElement);
void AddChar(char * UTF8data);
void cursorMove(int32_t gtkKey);
void MouseSelectFromCursorTo(int32_t width, int32_t height);
void MouseEvent(int32_t width, int32_t height);
void MouseEventDouble(void);
void MouseEventTriple(void);
void ScrollDown(void);
void ScrollUp(void);
void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
void AddChar(char * UTF8data);
void cursorMove(int32_t gtkKey);
void MouseSelectFromCursorTo(int32_t width, int32_t height);
void MouseEvent(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 Copy(int8_t clipboardID);
void Cut(int8_t clipboardID);
void Paste(int8_t clipboardID);
void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(Edn::String &data);
int32_t FindLine(Edn::String &data);
void JumpAtLine(int32_t newLine);
void RemoveLine(void);
void SelectAll(void);
void SelectNone(void);
void Undo(void);
void Redo(void);
void SetCharset(charset_te newCharset);
void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(Edn::String &data);
int32_t FindLine(Edn::String &data);
void JumpAtLine(int32_t newLine);
int32_t GetCurrentLine(void);
void RemoveLine(void);
void SelectAll(void);
void SelectNone(void);
void Undo(void);
void Redo(void);
void SetCharset(charset_te newCharset);
bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
bool AnchorNext(bufferAnchor_ts & anchor);
protected:
void NameChange(void);
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 :
ColorizeManager * myColorManager; //!< for the background color :
int32_t m_nbColoneForLineNumber; //!< number of colomn use for linenumber display
// Direct buffer IO
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
position_ts m_displayStart; //!< position where the display is starting
position_ts m_displaySize; //!< number of char displayable in the screan
int32_t m_displayStartBufferPos; //!< position where the buffer start
// Cursor :
int32_t m_cursorPos; //!< position in the buffer of the cursor
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
bool m_cursorOn; //!< the blink of the cursor ...
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
displayHLData_ts m_displayLocalSyntax; //!< for the display of the local elements (display HL mode)
// Cursor :
int32_t m_cursorPosPrevious; //!< Previous position in the buffer of the cursor
int32_t m_cursorPos; //!< position in the buffer of the cursor
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
bool m_cursorOn; //!< the blink of the cursor ...
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
// internal function
void BasicInit(void);
@@ -103,10 +101,6 @@ class BufferText : public Buffer {
void CleanSelectLine(void);
void SelectionStart(void);
void SelectionEnd(void);
void SelectionCheckMode(void);
void CheckAndUpdateLineForModification(uint32_t lineID);
bool TextDMoveUp(int32_t offset);
bool TextDMoveDown(int32_t offset);
@@ -114,7 +108,9 @@ class BufferText : public Buffer {
void GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y);
void MoveUpDown(int32_t ofset);
void DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t lineNumber, int32_t positionY);
void DrawLineNumber(DrawerManager &drawer, int32_t lineNumber, int32_t positionY);
void UpdatePointerNumber(void);
};

View File

@@ -1,6 +1,6 @@
/**
*******************************************************************************
* @file ColoriseManager.cpp
* @file ColorizeManager.cpp
* @brief Editeur De N'ours : Colorising Manager
* @author Edouard DUPIN
* @date 14/12/2010
@@ -30,15 +30,40 @@
#define PFX "ColorizeManager "
ColorizeManager::ColorizeManager(void)
ColorizeManager::ColorizeManager(void) : MsgBroadcast("Colorize Manager", EDN_CAT_COLOR)
{
}
ColorizeManager::~ColorizeManager(void)
{
delete(errorColor);
// TODO : delete all color previously
listMyColor.clear();
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
}
void ColorizeManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__RELOAD_COLOR_FILE:
{
// Reaload File
// TODO : Check this : Pb in the recopy Edn::String element
Edn::String plop = m_fileColor;
LoadFile(plop.c_str());
}
break;
}
}
@@ -49,6 +74,20 @@ void ColorizeManager::LoadFile(Edn::String &xmlFilename)
void ColorizeManager::LoadFile(const char * xmlFilename)
{
// Remove all old color :
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
m_fileColor = xmlFilename;
EDN_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
errorColor = new Colorize();
errorColor->SetBgColor("#000000");
errorColor->SetFgColor("#FFFFFF");
@@ -58,22 +97,17 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
// open the curent File
XmlDocument.LoadFile(xmlFilename);
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" );
if (NULL == root )
{
if (NULL == root ) {
EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\"");
return;
}
else
{
} else {
TiXmlNode * pNode = root->FirstChild();
while(NULL != pNode)
{
while(NULL != pNode) {
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pNode->Value(), "gui")) {
TiXmlNode * pGuiNode = pNode->FirstChild();
while(NULL != pGuiNode)
{
while(NULL != pGuiNode) {
if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pGuiNode->Value(), "color")) {
@@ -181,7 +215,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
myNewColor->SetItalic(true);
}
}
listMyColor.push_back(myNewColor);
listMyColor.PushBack(myNewColor);
} else {
EDN_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
}
@@ -194,12 +228,14 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
pNode = pNode->NextSibling();
}
}
SendMessage(EDN_MSG__COLOR_HAS_CHANGE);
SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
}
Colorize *ColorizeManager::Get(const char *colorName)
{
uint32_t i;
for (i=0; i<listMyColor.size(); i++) {
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
Edn::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return listMyColor[i];
@@ -227,8 +263,8 @@ color_ts & ColorizeManager::Get(basicColor_te myColor)
bool ColorizeManager::Exist(const char *colorName)
{
uint32_t i;
for (i=0; i<listMyColor.size(); i++) {
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
Edn::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return true;
@@ -243,9 +279,9 @@ bool ColorizeManager::Exist(Edn::String &colorName)
void ColorizeManager::DisplayListOfColor(void)
{
uint32_t i;
int32_t i;
EDN_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.size(); i++) {
for (i=0; i<listMyColor.Size(); i++) {
//Edn::String elementName = listMyColor[i]->GetName();
//EDN_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);

View File

@@ -1,6 +1,6 @@
/**
*******************************************************************************
* @file ColoriseManager.h
* @file ColorizeManager.h
* @brief Editeur De N'ours : Colorising Manager (header)
* @author Edouard DUPIN
* @date 14/12/2010
@@ -27,9 +27,9 @@
#define __COLORIZE_MANAGER_H__
#include "Singleton.h"
#include <vector>
#include <string>
#include "Colorize.h"
#include "MsgBroadcast.h"
#include "Edn.h"
typedef enum {
// BASIC color for codeViewer
@@ -50,7 +50,7 @@ typedef enum {
class ColorizeManager: public Singleton<ColorizeManager>
class ColorizeManager: public Singleton<ColorizeManager>, public MsgBroadcast
{
friend class Singleton<ColorizeManager>;
// specific for sigleton system...
@@ -59,19 +59,22 @@ class ColorizeManager: public Singleton<ColorizeManager>
ColorizeManager(void);
~ColorizeManager(void);
public:
void LoadFile(Edn::String &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(Edn::String &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(Edn::String &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
void OnMessage(int32_t id, int32_t dataID);
public:
void LoadFile(Edn::String &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(Edn::String &colorName);
color_ts & Get(basicColor_te myColor);
bool Exist(Edn::String &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
private:
std::vector<Colorize*> listMyColor; //!< List of ALL Color
Colorize* errorColor;
color_ts basicColors[COLOR_NUMBER_MAX];
Edn::String m_fileColor;
Edn::VectorType<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor;
color_ts basicColors[COLOR_NUMBER_MAX];
};
#endif

View File

@@ -41,7 +41,6 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
m_menuContext = MenuContext::getInstance();
m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 250, 100);
@@ -58,6 +57,8 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
# elif defined( USE_GTK_VERSION_2_0 )
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
# endif
// Remove double-buffering ==> in the current case we can not get the previous display...
gtk_widget_set_double_buffered(m_widget, false);
// Focus Event
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
@@ -101,6 +102,10 @@ void BufferView::OnMessage(int32_t id, int32_t dataID)
// change Title :
gtk_widget_queue_draw(m_widget);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ...
gtk_widget_queue_draw(m_widget);
break;
}
}
@@ -139,6 +144,9 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
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;
@@ -230,13 +238,12 @@ gint BufferView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer
gint BufferView::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(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");
self->m_menuContext->Hide();
return FALSE;
}
@@ -245,7 +252,7 @@ gint BufferView::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpoint
//BufferView * self = reinterpret_cast<BufferView*>(data);
if(event->type == GDK_KEY_PRESS) {
gtk_widget_queue_draw( widget );
gtk_widget_queue_draw( widget );
}
return true;
}
@@ -322,9 +329,6 @@ void BufferView::ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_
gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
if (event->type != GDK_BUTTON_RELEASE) {
self->m_menuContext->Hide();
}
// get focus on the widget
gtk_widget_grab_focus(widget);
if (event->button == 1) {
@@ -337,25 +341,8 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g
//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);
/*
MainWindows *window = MainWindows::getInstance();
EDN_INFO(" Event on Buffer " << selectBuf);
// set the new seected Buffer
window->SetSelected(selectBuf);
*/
}
}/* else if (event->type == GDK_3BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> Triple Clicked");
}else if (event->type == GDK_BUTTON_RELEASE) {
EDN_INFO("mouse-event BT1 ==> Realease");
}*/
} else if (event->button == 2) {
/*
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT2 PRESS");
self->m_menuContext->Show(event->x, event->y, false);
}
*/
} else if (event->button == 3) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT3 PRESS");
@@ -366,7 +353,8 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g
}
}
} else {
EDN_INFO("mouse-event BT? PRESS");
// not usefull to redraw
return true;
}
gtk_widget_queue_draw( widget );
return true;

View File

@@ -26,14 +26,11 @@
#define __BUFFER_VIEW_H__
#include "tools_debug.h"
#include <vector>
#include <string>
#include "Singleton.h"
#include "CodeView.h"
#include "BufferManager.h"
#include "Display.h"
#include "MsgBroadcast.h"
#include "MenuContext.h"
@@ -68,7 +65,6 @@ class BufferView : public MsgBroadcast
// r<>cup<75>ration des proprieter g<>n<EFBFBD>ral...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
MenuContext * m_menuContext;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_selectedID;

View File

@@ -38,47 +38,53 @@
CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
{
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
static int32_t staticIntLocal = 100;
m_displayUniqueId = staticIntLocal++;
m_bufferID = -1;
m_bufferManager->Get(m_bufferID)->AnchorAdd(m_displayUniqueId);
m_buttunOneSelected = false;
m_shawableAreaX = 0;
m_shawableAreaY = 0;
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
m_menuContext = MenuContext::getInstance();
m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 200, 100);
gtk_widget_add_events( m_widget,
GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
gtk_widget_add_events( m_widget,
GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
# ifdef USE_GTK_VERSION_3_0
g_object_set(m_widget,"can-focus", TRUE, NULL);
# elif defined( USE_GTK_VERSION_2_0 )
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
# endif
// Remove double-buffering ==> in the current case we can not get the previous display...
gtk_widget_set_double_buffered(m_widget, false);
// Focus Event
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
// Keyboard Event
g_signal_connect_after( G_OBJECT(m_widget), "key_press_event", G_CALLBACK(CB_keyboardEvent), this);
g_signal_connect_after( G_OBJECT(m_widget), "key_release_event", G_CALLBACK(CB_keyboardEvent), this);
g_signal_connect_after( G_OBJECT(m_widget), "key_press_event", G_CALLBACK(CB_keyboardEvent), this);
g_signal_connect_after( G_OBJECT(m_widget), "key_release_event", G_CALLBACK(CB_keyboardEvent), this);
// Mouse Event
g_signal_connect( G_OBJECT(m_widget), "button_press_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "button_release_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "motion_notify_event", G_CALLBACK(CB_mouseMotionEvent), this);
g_signal_connect( G_OBJECT(m_widget), "scroll-event", G_CALLBACK(CB_mouseScrollEvent), this);
g_signal_connect( G_OBJECT(m_widget), "button_press_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "button_release_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "motion_notify_event", G_CALLBACK(CB_mouseMotionEvent), this);
g_signal_connect( G_OBJECT(m_widget), "scroll-event", G_CALLBACK(CB_mouseScrollEvent), this);
// Display Event
g_signal_connect( G_OBJECT(m_widget), "realize", G_CALLBACK(CB_displayInit), this);
g_signal_connect( G_OBJECT(m_widget), "realize", G_CALLBACK(CB_displayInit), this);
# ifdef USE_GTK_VERSION_3_0
g_signal_connect( G_OBJECT(m_widget), "draw", G_CALLBACK(CB_displayDraw), this);
g_signal_connect( G_OBJECT(m_widget), "draw", G_CALLBACK(CB_displayDraw), this);
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
# endif
}
@@ -99,8 +105,9 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
{
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
//EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferManager->Get(m_bufferID)->AnchorRm(m_displayUniqueId);
m_bufferID = dataID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
m_bufferManager->Get(m_bufferID)->AnchorAdd(m_displayUniqueId);
// request the dispplay of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
@@ -180,13 +187,16 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
case EDN_MSG__CURRENT_SET_CHARSET:
m_bufferManager->Get(m_bufferID)->SetCharset((charset_te)dataID);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ... Done under ...
break;
}
// Force redraw of the widget
gtk_widget_queue_draw(m_widget);
gtk_widget_queue_draw_area(m_widget, 0, 0, m_shawableAreaX, m_shawableAreaY);
}
gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
@@ -195,6 +205,7 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
EDN_INFO("GTK+ request a diplay of : "<< allocation.width <<"px * "<< allocation.height <<"px");
bool needRedrawAll = false;
if (self->m_shawableAreaX != allocation.width) {
needRedrawAll = true;
@@ -205,6 +216,7 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
self->m_shawableAreaY = allocation.height;
}
# elif defined( USE_GTK_VERSION_2_0)
EDN_INFO("GTK+ request a diplay of : "<< widget->allocation.width <<"px * "<< widget->allocation.height <<"px");
bool needRedrawAll = false;
if (self->m_shawableAreaX != widget->allocation.width) {
needRedrawAll = true;
@@ -215,32 +227,51 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
self->m_shawableAreaY = widget->allocation.height;
}
# endif
if (true == needRedrawAll) {
//updateScrollElement();
self->m_bufferManager->Get(self->m_bufferID)->ForceReDraw(true);
}
EDN_INFO("Request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
/*
EDN_INFO("widget width=%d", widget->allocation.width);
EDN_INFO("widget height=%d", widget->allocation.height);
*/
EDN_INFO("Edn request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
//EDN_INFO("BufferView Display");
// Get the color Manager :
ColorizeManager *myColorManager = NULL;
myColorManager = ColorizeManager::getInstance();
//(void)m_bufferManager->Get(m_bufferID)->Display(m_displayParameters, m_shawableAreaX, m_shawableAreaY);
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
//EDN_INFO("Display buffer ID = " << m_bufferID);
(void)self->m_bufferManager->Get(self->m_bufferID)->Display(monDrawer);
// EDN_WARNING("Must display here ... ");
Buffer * tmpBuf = self->m_bufferManager->Get(self->m_bufferID);
#ifndef NDEBUG
GTimeVal timeStart;
g_get_current_time(&timeStart);
#endif
bufferAnchor_ts anchor;
tmpBuf->AnchorSetSize(self->m_displayUniqueId, self->m_shawableAreaX, self->m_shawableAreaY);
bool enableToWrite = tmpBuf->AnchorGet(self->m_displayUniqueId, anchor);
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY, Display::GetFontHeight()*anchor.m_BufferNumberLineOffset);
int32_t currentLineID = 0;
while (true == enableToWrite) {
if (true == anchor.m_redrawLine[currentLineID]) {
#ifndef NDEBUG
EDN_DEBUG("draw line=" << currentLineID << " realID=" << anchor.m_lineNumber );
#endif
tmpBuf->DrawLine(monDrawer, anchor);
}
enableToWrite = tmpBuf->AnchorNext(anchor);
currentLineID++;
}
monDrawer.Flush();
// Need to clean the end of windows (sometimes)...
if(currentLineID<anchor.m_displaySize.y+1) {
for (int32_t iii=currentLineID; iii < anchor.m_displaySize.y; iii++) {
tmpBuf->DrawLineEmpty(monDrawer, iii);
}
}
#ifndef NDEBUG
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("Display Generation = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
#endif
return TRUE;
}
// sur : émis lors du premier affichage de la GtkDrawingArea
gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer data)
{
@@ -248,22 +279,15 @@ gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer 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;
EDN_INFO("GTK+ request a diplay of : "<< allocation.width <<"px * "<< allocation.height <<"px");
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;
EDN_INFO("GTK+ request a diplay of : "<< widget->allocation.width <<"px * "<< widget->allocation.height <<"px");
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");
gtk_widget_queue_draw( widget );
return TRUE;
}
@@ -274,6 +298,12 @@ gint CodeView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer da
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
# endif
self->SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, self->m_bufferID);
# ifdef USE_GTK_VERSION_2_0
Buffer * tmpBuf = self->m_bufferManager->Get(self->m_bufferID);
tmpBuf->AnchorRedrawAll(self->m_displayUniqueId);
// Force redraw of the widget
gtk_widget_queue_draw_area(self->m_widget, 0, 0, self->m_shawableAreaX, self->m_shawableAreaY);
# endif
EDN_INFO("Focus - In");
return FALSE;
}

View File

@@ -32,7 +32,6 @@
#include "BufferManager.h"
#include "Display.h"
#include "MsgBroadcast.h"
#include "MenuContext.h"
class CodeView : public MsgBroadcast
{
@@ -55,10 +54,13 @@ class CodeView : public MsgBroadcast
private:
// main windows widget :
GtkWidget * m_widget;
DrawerManager * m_Drawer;
int32_t m_displayUniqueId;
//position_ts m_displayStart; //!< position where the display is starting
//position_ts m_displaySize; //!< number of char displayable in the screan
// récupération des proprieter général...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
MenuContext * m_menuContext;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_bufferID;

View File

@@ -28,8 +28,7 @@
#include "tools_debug.h"
#include "Singleton.h"
#include <string>
#include <vector>
class MainAreaView: public Singleton<MainAreaView>

View File

@@ -40,15 +40,31 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
m_mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// select the program icone
gtk_window_set_default_icon_name("text-editor");
GError *err = NULL;
Edn::String iconeFile;
#ifdef NDEBUG
iconeFile = "/usr/share/edn/images/icone.png";
#else
iconeFile = "./data/imagesSources/icone.png";
#endif
GdkPixbuf * icone = gdk_pixbuf_new_from_file(iconeFile.c_str(), &err);
if (err != NULL) {
gtk_window_set_default_icon_name("text-editor");
} else {
gtk_window_set_icon(GTK_WINDOW(m_mainWindow), icone);
}
// Default size open windows
gtk_window_set_default_size(GTK_WINDOW(m_mainWindow), 800, 600);
// enable the close signal of the windows
g_signal_connect(G_OBJECT(m_mainWindow), "delete-event", G_CALLBACK(OnQuit), this);
g_signal_connect(G_OBJECT(m_mainWindow), "window-state-event", G_CALLBACK(OnStateChange), this);
//g_signal_connect(G_OBJECT(m_mainWindow), "destroy", G_CALLBACK(OnQuit), this);
// remove decoration
//gtk_window_set_decorated(GTK_WINDOW(m_mainWindow), FALSE);
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER(m_mainWindow), vbox);
@@ -57,8 +73,52 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_mainWindow));
// Create the menu bar.
#if 0
gtk_box_pack_start( GTK_BOX (vbox), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
#else
GtkWidget *hboxMenu = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start( GTK_BOX (vbox), hboxMenu, FALSE, FALSE, 0);
// Add Exit boutton
Edn::String ExitIconeFile;
#ifdef NDEBUG
ExitIconeFile = "/usr/share/edn/images/delete-24px.png";
#else
ExitIconeFile = "./data/imagesSources/delete-24px.png";
#endif
// TODO : find a good way to change the size of an image
GtkWidget *myImageQuit = gtk_image_new_from_file(ExitIconeFile.c_str());
GtkIconSize mySize = GTK_ICON_SIZE_SMALL_TOOLBAR;
//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);
GdkColor color;
GtkStateType tmpppppp = GTK_STATE_NORMAL;
//GtkStateType tmpppppp = GTK_STATE_ACTIVE;
//GtkStateType tmpppppp = GTK_STATE_PRELIGHT;
//GtkStateType tmpppppp = GTK_STATE_SELECTED;
//GtkStateType tmpppppp = GTK_STATE_INSENSITIVE;
//gdk_color_parse ("green", &color);
//gtk_widget_modify_fg(m_MenuBar.GetWidget(), tmpppppp, &color);
//gdk_color_parse ("blue", &color);
//gtk_widget_modify_bg(m_MenuBar.GetWidget(), tmpppppp, &color);
gdk_color_parse ("red", &color);
gtk_widget_modify_text(m_MenuBar.GetWidget(), tmpppppp, &color);
//gdk_color_parse ("orange", &color);
gtk_widget_modify_base(m_MenuBar.GetWidget(), tmpppppp, &color);
// Add title
m_internalTitleLabel = gtk_label_new("Edn");
gtk_box_pack_start( GTK_BOX (hboxMenu), m_internalTitleLabel, FALSE, FALSE, 0);
#endif
// **********************************************************
// * Horizontal ELEMENTS : *
// **********************************************************
@@ -67,16 +127,16 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
gtk_container_add(GTK_CONTAINER (vbox), hbox);
// create the toolbar :
# if USE_GTK_VERSION_2_0
gtk_box_pack_start(GTK_BOX(hbox), m_ToolBar.GetWidget(), FALSE, FALSE, 0);
//gtk_box_pack_start(GTK_BOX(hbox), m_ToolBar.GetWidget(), FALSE, FALSE, 0);
# endif
// TreeView :
gtk_box_pack_start(GTK_BOX(hbox), m_BufferView.GetMainWidget(), FALSE, TRUE, 1);
// Tex displayer :
// 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);
//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);
@@ -93,6 +153,7 @@ MainWindows::~MainWindows(void)
}
void MainWindows::SetTitle(Edn::File &fileName, bool isModify)
{
Edn::String tmp = "";
@@ -104,12 +165,23 @@ void MainWindows::SetTitle(Edn::File &fileName, bool isModify)
}
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";
}
gtk_label_set_text(GTK_LABEL(m_internalTitleLabel), tmp.c_str());
}
void MainWindows::SetNoTitle(void)
{
Edn::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)
@@ -129,70 +201,37 @@ void MainWindows::OnMessage(int32_t id, int32_t dataID)
}
}
break;
case EDN_MSG__QUIT:
OnQuit(m_mainWindow, this);
break;
}
}
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
{
EDN_INFO("quit requested");
// dlg to confirm the quit event :
GtkWidget *p_dialog = gtk_dialog_new_with_buttons("Exit",
GTK_WINDOW(widget),
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);
break;
case GTK_RESPONSE_NO:
gtk_widget_destroy (p_dialog);
// do not close the windows
return true;
break;
}
gtk_main_quit();
return false;
//MainWindows * self = reinterpret_cast<MainWindows*>(data);
GeneralSendMessage(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION);
// Close is not managed here ...
return true;
}
#if 0
void MainWindows::OnMenuAbout(wxCommandEvent & WXUNUSED(event))
gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data)
{
//EDN_INFO("MainWindows::OnMenuAbout (event)");
wxAboutDialogInfo info;
info.SetName(wxT("edn"));
info.SetVersion(wxT("0.1.0 pre-Beta"));
info.SetDescription(wxT("Editeur De N'ours, l'Editeur Desoxyribo-Nucleique\n"
"Source Code Editor"));
info.SetCopyright(wxT( "Copyright 2010 Edouard DUPIN, all right reserved\n"
"This software is distributed in the hope that it will be useful, but WITHOUT\n"
"ANY WARRANTY\n\n"
"Licence summary : \n"
" You can modify and redistribute the sources code and binaries.\n"
" You can send me the bug-fix\n"
" You can not earn money with this Software (if the source extract from Edn\n"
" represent less than 50% of original Sources)\n"
"Term of the licence in in the file licence.txt"));
wxAboutBox(info);
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

@@ -51,12 +51,14 @@ class MainWindows: public Singleton<MainWindows>, public MsgBroadcast
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(Edn::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;

View File

@@ -28,6 +28,7 @@
#include "MenuBar.h"
#include "ClipBoard.h"
#include "charset.h"
#include "ColorizeManager.h"
#define MENU_MSG
const char * MSG_TogleDisplayChar = "Request a Togle of char displaying";
@@ -36,7 +37,9 @@ 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";
#define MSG_LINK(data)
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)
@@ -74,6 +77,26 @@ static void CB_menuInternal(GtkMenuItem *menu_item, gpointer data)
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();
Edn::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();
Edn::String homedir;
# ifdef NDEBUG
homedir = "/usr/share/edn/";
# else
homedir = "./data/";
# endif
homedir += "color_black.xml";
myColorSystem->LoadFile(homedir);
}
}
@@ -164,6 +187,11 @@ class MenuBarMain
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 :
@@ -204,12 +232,12 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
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", NULL, EDN_MSG__CURRENT_CLOSE, true);
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+q", EDN_MSG__QUIT, true);
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);
@@ -220,7 +248,7 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
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+d", EDN_MSG__CURRENT_REMOVE_LINE, true);
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);
@@ -230,15 +258,6 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, 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->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);
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);
@@ -252,6 +271,21 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
// 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);
@@ -260,8 +294,8 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
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+u", EDN_MSG__JUMP_TO_CURRENT_SELECTION, true);
tmp->AddGen("Back previous", "ctrl+y", EDN_MSG__JUMP_BACK, true);
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);

View File

@@ -1,490 +0,0 @@
/**
*******************************************************************************
* @file MenuContext.cpp
* @brief Editeur De N'ours : special Menu (left button or normal menu) (Sources)
* @author Edouard DUPIN
* @date 22/07/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 "MenuContext.h"
#undef __class__
#define __class__ "MenuContext"
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
MenuContext::MenuContext(void) : MsgBroadcast("Menu Context", EDN_CAT_MENU_CONTEXT)
{
//m_currentBufferID = -1;
m_dialog = NULL;
m_shawableSize.x=200;
m_shawableSize.y=200;
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
MenuContext::~MenuContext(void)
{
if(NULL != m_dialog) {
gtk_widget_destroy(m_dialog);
m_dialog = NULL;
}
}
void MenuContext::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
/*
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_currentBufferID = dataID;
break;
*/
}
}
void MenuContext::Clear(void)
{
}
void MenuContext::AddCommonElem(int32_t id)
{
}
void MenuContext::AddSpecificElem(Edn::String &text)
{
}
/* This is called when we need to draw the windows contents */
static gboolean expose (GtkWidget *widget, GdkEventExpose *event, gpointer userdata)
{
gint width;
gint height;
cairo_t *cr = NULL;
# if USE_GTK_VERSION_3_0
cr = gdk_cairo_create(gtk_widget_get_window(widget));
# elif USE_GTK_VERSION_2_0
cr = gdk_cairo_create(widget->window);
# endif
//if (supports_alpha)
{
// transparent
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
}
/*
else
{
// opaque white
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
}
*/
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* draw a circle */
//gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
//cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
//cairo_arc (cr, width / 2, height / 2, (width < height ? width : height) / 2 - 8 , 0, 2 * 3.14);
//cairo_fill (cr);
//cairo_stroke (cr);
//cairo_paint (cr);
cairo_destroy (cr);
return FALSE;
}
// http://zetcode.com/tutorials/cairographicstutorial/transparency/
void MenuContext::Show(int32_t x, int32_t y, bool top)
{
if(NULL != m_dialog) {
gtk_widget_destroy(m_dialog);
m_dialog = NULL;
}
m_dialog = gtk_window_new(GTK_WINDOW_POPUP);
//m_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// Set the dialog on top of the selected windows
//gtk_window_set_transient_for(GTK_WINDOW(m_dialog), parent);
// unset the border of the windows
//gtk_window_set_decorated(GTK_WINDOW(m_dialog), FALSE);
EDN_INFO("Set position X=" << x+2 << " Y=" << y+27);
# if USE_GTK_VERSION_3_0
gtk_window_move(GTK_WINDOW(m_dialog), x+2, y+27);
# elif USE_GTK_VERSION_2_0
gtk_widget_set_uposition(m_dialog, x+2, y+27);
# endif
#if 0
/* sdsfsdf */
gtk_widget_set_app_paintable (m_dialog, TRUE);
# ifdef USE_GTK_VERSION_3_0
g_signal_connect( G_OBJECT(m_dialog), "draw", G_CALLBACK(expose), this);
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_dialog), "expose_event", G_CALLBACK(expose), this);
# endif
#endif
//gtk_window_set_opacity(GTK_WINDOW(m_dialog), 0.25);
// 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), "destroy", G_CALLBACK(OnQuit), 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_dialog), vbox);
GtkWidget *myLabel = gtk_label_new("plop 1 ");
gtk_container_add(GTK_CONTAINER(vbox), myLabel);
myLabel = gtk_label_new("plop 2 ");
gtk_container_add(GTK_CONTAINER(vbox), myLabel);
*/
// Set key Accelerator :
//AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_dialog));
// Create the menu bar.
//gtk_box_pack_start( GTK_BOX (vbox), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
m_widget = gtk_drawing_area_new();
//gtk_window_set_opacity(GTK_WINDOW(m_widget), 0.8);
gtk_widget_set_size_request( m_widget, 250, 100);
gtk_widget_add_events( m_widget,
GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
# ifdef USE_GTK_VERSION_3_0
g_object_set(m_widget,"can-focus", TRUE, NULL);
# elif defined( USE_GTK_VERSION_2_0 )
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
# endif
// Focus Event
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
// Keyboard Event
g_signal_connect_after( G_OBJECT(m_widget), "key_press_event", G_CALLBACK(CB_keyboardEvent), this);
g_signal_connect_after( G_OBJECT(m_widget), "key_release_event", G_CALLBACK(CB_keyboardEvent), this);
// Mouse Event
g_signal_connect( G_OBJECT(m_widget), "button_press_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "button_release_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "motion_notify_event", G_CALLBACK(CB_mouseMotionEvent), this);
// Display Event
g_signal_connect( G_OBJECT(m_widget), "realize", G_CALLBACK(CB_displayInit), this);
# ifdef USE_GTK_VERSION_3_0
g_signal_connect( G_OBJECT(m_widget), "draw", G_CALLBACK(CB_displayDraw), this);
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
# endif
gtk_container_add(GTK_CONTAINER(m_dialog), m_widget);
// recursive version of gtk_widget_show
gtk_widget_show_all(m_dialog);
// Set the Focus
gtk_widget_grab_focus(m_widget);
}
void MenuContext::Hide(void)
{
if(NULL != m_dialog) {
gtk_widget_destroy(m_dialog);
m_dialog = NULL;
}
}
gboolean MenuContext::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
if (self->m_shawableSize.x != allocation.width) {
self->m_shawableSize.x = allocation.width;
}
if (self->m_shawableSize.y != allocation.height) {
self->m_shawableSize.y = allocation.height;
}
# elif defined( USE_GTK_VERSION_2_0)
if (self->m_shawableSize.x != widget->allocation.width) {
self->m_shawableSize.x = widget->allocation.width;
}
if (self->m_shawableSize.y != widget->allocation.height) {
self->m_shawableSize.y = widget->allocation.height;
}
# endif
EDN_INFO("Request a display of : " << self->m_shawableSize.x << "px * "<< self->m_shawableSize.y<<"px");
DrawerManager monDrawer(widget, self->m_shawableSize.x, self->m_shawableSize.y);
// 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;
Edn::VectorType<Edn::String *> myData;
Edn::String * plop = new Edn::String("Save");
myData.PushBack(plop);
plop = new Edn::String("Show");
myData.PushBack(plop);
plop = new Edn::String("Close");
myData.PushBack(plop);
for (i=0; i < myData.Size(); i++) {
selectFG = COLOR_LIST_TEXT_NORMAL;
if (lineID%2==0) {
selectBG = COLOR_LIST_BG_1;
} else {
selectBG = COLOR_LIST_BG_2;
}
monDrawer.Rectangle(self->m_colorManager->Get(selectBG), 0, lineID*fontHeight, self->m_shawableSize.x, Display::GetFontHeight());
monDrawer.Text(self->m_colorManager->Get(selectFG), 2, lineID*fontHeight, myData[i]->c_str());
monDrawer.Flush();
lineID ++;
}
return TRUE;
}
gboolean MenuContext::CB_displayDraw2( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
gint width;
gint height;
cairo_t *cr = NULL;
# if USE_GTK_VERSION_3_0
cr = gdk_cairo_create(gtk_widget_get_window(widget));
# elif USE_GTK_VERSION_2_0
cr = gdk_cairo_create(widget->window);
# endif
// transparent
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* draw a circle */
gtk_window_get_size (GTK_WINDOW(widget), &width, &height);
cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_arc (cr, width / 2, height / 2, (width < height ? width : height) / 2 - 8 , 0, 2 * 3.14);
cairo_fill (cr);
cairo_stroke (cr);
cairo_paint (cr);
cairo_destroy (cr);
return FALSE;
}
// sur : <20>mis lors du premier affichage de la GtkDrawingArea
gboolean MenuContext::CB_displayInit( GtkWidget *widget, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(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_shawableSize.x = allocation.width;
self->m_shawableSize.y = 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_shawableSize.x = widget->allocation.width;
self->m_shawableSize.y = widget->allocation.height;
# endif
EDN_INFO("Request a diplay of : " << size_x << "px * " << size_y << "px");
gtk_widget_queue_draw( widget );
return TRUE;
}
gint MenuContext::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
//MenuContext * self = reinterpret_cast<MenuContext*>(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 MenuContext::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - out");
self->Hide();
return FALSE;
}
gint MenuContext::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data)
{
//MenuContext * self = reinterpret_cast<MenuContext*>(data);
if(event->type == GDK_KEY_PRESS) {
gtk_widget_queue_draw( widget );
}
return true;
}
gint MenuContext::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
MenuContext * self = reinterpret_cast<MenuContext*>(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);
/*
MainWindows *window = MainWindows::getInstance();
EDN_INFO(" Event on Buffer " << selectBuf);
// set the new seected Buffer
window->SetSelected(selectBuf);
*/
}
}/* else if (event->type == GDK_3BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> Triple Clicked");
}else if (event->type == GDK_BUTTON_RELEASE) {
EDN_INFO("mouse-event BT1 ==> Realease");
}*/
}/* else if (event->button == 2) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT2 PRESS");
self->m_menuContext->Show(event->x, event->y, false);
}
} 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) {
// TODO : Find a simple methode
int32_t windowsPosX, windowsPosY;
gtk_window_get_position(GTK_WINDOW(gtk_widget_get_toplevel(widget)), &windowsPosX, &windowsPosY);
//EDN_INFO("windowsPosX=" << windowsPosX << " windowsPosY=" << windowsPosY);
int32_t widgetPosX, widgetPosY;
gtk_widget_translate_coordinates(widget, gtk_widget_get_toplevel(widget), 0, 0, &widgetPosX, &widgetPosY);
//EDN_INFO("widgetPosX=" << widgetPosX << " widgetPosY=" << widgetPosY);
self->m_menuContext->Show(self->m_shawableAreaX+2+widgetPosX+windowsPosX, ((int32_t)(event->y / fontHeight)*fontHeight)+(fontHeight/2)+widgetPosY+windowsPosY, false);
}
}
}*/ else {
EDN_INFO("mouse-event BT? PRESS");
}
gtk_widget_queue_draw( widget );
return true;
}
gint MenuContext::CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
//MenuContexterView * self = reinterpret_cast<MenuContext*>(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;
}

View File

@@ -1,72 +0,0 @@
/**
*******************************************************************************
* @file MenuContext.h
* @brief Editeur De N'ours : special Menu (left button or normal menu) (header)
* @author Edouard DUPIN
* @date 22/07/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 __MENU_CONTEXT_H__
#define __MENU_CONTEXT_H__
#include "Singleton.h"
#include "MsgBroadcast.h"
#include "Edn.h"
#include "BufferManager.h"
#include "ColorizeManager.h"
class MenuContext: public Singleton<MenuContext>, public MsgBroadcast
{
friend class Singleton<MenuContext>;
// specific for sigleton system...
private:
// Constructeur
MenuContext(void);
~MenuContext(void);
public:
void OnMessage(int32_t id, int32_t dataID);
// sur : GTK+ callback :
static gboolean CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data);
static gboolean CB_displayDraw2( GtkWidget *widget, GdkEventExpose *event, gpointer data);
static gboolean CB_displayInit( GtkWidget *widget, gpointer data);
static gint CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data);
static gint CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data);
static gint CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data);
static gint CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data);
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
static void CB_EventOnBufferManager(gpointer data);
static void CB_ScreenChange(GtkWidget *widget, GdkScreen *old_screen, gpointer userdata);
public:
void Clear(void);
void AddCommonElem(int32_t id);
void AddSpecificElem(Edn::String &text);
void Show(int32_t x, int32_t y, bool top);
void Hide(void);
private:
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
GtkWidget * m_dialog;
GtkWidget * m_widget;
position_ts m_requestedPos;
position_ts m_shawableSize;
};
#endif

View File

@@ -192,9 +192,9 @@ void Search::Display(GtkWindow *parent)
} else {
gtk_widget_set_sensitive(m_CkMatchCase, true);
}
Edn::String myDataString;
SearchData::GetSearch(myDataString);
// Remove data form the search
Edn::String myDataString = "";
SearchData::SetSearch(myDataString);
gtk_entry_set_text(GTK_ENTRY(m_searchEntry), myDataString.c_str());
if (0 == strlen(myDataString.c_str())) {
m_haveSearchData = false;
@@ -212,13 +212,14 @@ void Search::Display(GtkWindow *parent)
gtk_widget_set_sensitive(m_BtPrevious, m_haveSearchData);
gtk_widget_set_sensitive(m_BtNext, m_haveSearchData);
if (false == m_haveSearchData) {
gtk_widget_set_sensitive(m_BtReplace, false);
gtk_widget_set_sensitive(m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(m_BtReplace, m_haveReplaceData);
gtk_widget_set_sensitive(m_BtReplaceAndNext, m_haveReplaceData);
}
// basic no search data
gtk_widget_set_sensitive(m_BtReplace, false);
gtk_widget_set_sensitive(m_BtReplaceAndNext, false);
// set focus on a specific widget :
//gtk_window_set_focus(parent, m_searchEntry);
gtk_widget_grab_focus(m_searchEntry);
// display the dialogue box
gtk_widget_show_all(m_localDialog);
@@ -327,8 +328,8 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
gtk_widget_set_sensitive(self->m_BtReplace, false);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(self->m_BtReplace, self->m_haveReplaceData);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, self->m_haveReplaceData);
gtk_widget_set_sensitive(self->m_BtReplace, true);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
}
}
}
@@ -347,7 +348,12 @@ void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
} else {
self->m_haveReplaceData = true;
}
gtk_widget_set_sensitive(self->m_BtReplace, self->m_haveReplaceData);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, self->m_haveReplaceData);
if (false == self->m_haveSearchData) {
gtk_widget_set_sensitive(self->m_BtReplace, false);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(self->m_BtReplace, true);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
}
}
}

View File

@@ -28,8 +28,6 @@
#include "tools_debug.h"
#include "Singleton.h"
#include <string>
#include <vector>
class Search: public Singleton<Search>

View File

@@ -93,10 +93,8 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open File", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, // button text
GTK_RESPONSE_CANCEL, // response id
GTK_STOCK_OPEN, // button text
GTK_RESPONSE_ACCEPT, // response id
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);
@@ -137,10 +135,8 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
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, // button text
GTK_RESPONSE_CANCEL, // response id
GTK_STOCK_SAVE, // button text
GTK_RESPONSE_ACCEPT, // response id
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);
@@ -159,54 +155,40 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
break;
case EDN_MSG__GUI_SHOW_ABOUT:
{
// dlg to confirm the quit event :
GtkWidget *myDialog = gtk_dialog_new_with_buttons("About",
NULL,
GTK_DIALOG_MODAL,
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);
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog));
GtkWidget *myLabel = gtk_label_new("");
gtk_label_set_markup (GTK_LABEL (myLabel),
"<b>Name :</b> Edn\n"
"<b>Version :</b> " VERSION_TAG_NAME "\n"
"<b>Build Time :</b> " VERSION_BUILD_TIME "\n\n"
"<b>Description :</b> Editeur De N'ours, l'Editeur Desoxyribo-Nucleique\n"
" Source Code Editor\n\n"
"<b>Copyright 2010 Edouard DUPIN, all right reserved</b>\n\n"
"<b>Terms of license : </b>\n"
"This software is distributed in the hope that it will be useful, but \n"
"WITHOUT ANY WARRANTY\n"
" <b>You can:</b>\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,\n"
" just write somewhere \"Edn is great\" visible by the user (on \n"
" 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"
" <b>You can NOT:</b>\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"
"I reserve the right to change this licence. If it change the version of \n"
"the copy you have keep its own license.\n\n"
"<b>Sources : </b> git://github.com/HeeroYui/edn.git ");
gtk_box_pack_start(GTK_BOX(myContentArea), myLabel, TRUE, TRUE, 0);
gtk_widget_show_all(myContentArea);
int32_t result = gtk_dialog_run (GTK_DIALOG (myDialog));
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);
switch (result)
{
case GTK_RESPONSE_NO:
break;
}
}
break;
case EDN_MSG__GUI_SHOW_GOTO_LINE:
@@ -250,5 +232,89 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
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;
}
}

View File

@@ -33,14 +33,14 @@
#define __class__ "Highlight"
void Highlight::ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level)
void Highlight::ParseRules(TiXmlNode *child, Edn::VectorType<HighlightPattern*> &mListPatern, int32_t level)
{
// Create the patern ...
HighlightPattern *myPattern = new HighlightPattern();
// parse under Element
myPattern->ParseRules(child, level);
// add element in the list
mListPatern.push_back(myPattern);
mListPatern.PushBack(myPattern);
}
@@ -72,8 +72,8 @@ Highlight::Highlight(Edn::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);
Edn::String myEdnData = myData;
m_listExtentions.push_back(myEdnData);
Edn::String * myEdnData = new Edn::String(myData);
m_listExtentions.PushBack(myEdnData);
}
} else if (!strcmp(child->Value(), "pass1")) {
// Get sub Nodes ...
@@ -113,21 +113,48 @@ Highlight::Highlight(Edn::String &xmlFilename)
Highlight::~Highlight(void)
{
uint32_t i;
int32_t i;
// clean all Element
for (i=0; i< m_listHighlightPass1.size(); i++) {
delete(m_listHighlightPass1[i]);
for (i=0; i< m_listHighlightPass1.Size(); i++) {
if (NULL != m_listHighlightPass1[i]) {
delete(m_listHighlightPass1[i]);
m_listHighlightPass1[i] = NULL;
}
}
// clear the compleate list
m_listHighlightPass1.clear();
m_listHighlightPass1.Clear();
// clean all Element
for (i=0; i< m_listExtentions.Size(); i++) {
if (NULL != m_listExtentions[i]) {
delete(m_listExtentions[i]);
m_listExtentions[i] = NULL;
}
}
// clear the compleate list
m_listExtentions.Clear();
}
void Highlight::ReloadColor(void)
{
int32_t i;
for (i=0; i< m_listHighlightPass1.Size(); i++) {
if (NULL != m_listHighlightPass1[i]) {
m_listHighlightPass1[i]->ReloadColor();
}
}
for (i=0; i< m_listHighlightPass2.Size(); i++) {
if (NULL != m_listHighlightPass2[i]) {
m_listHighlightPass2[i]->ReloadColor();
}
}
}
bool Highlight::HasExtention(Edn::String &ext)
{
uint32_t i;
for (i=0; i<m_listExtentions.size(); i++) {
if (ext == m_listExtentions[i] ) {
int32_t i;
for (i=0; i<m_listExtentions.Size(); i++) {
if (ext == *m_listExtentions[i] ) {
return true;
}
}
@@ -136,7 +163,7 @@ bool Highlight::HasExtention(Edn::String &ext)
bool Highlight::FileNameCompatible(Edn::File &fileName)
{
uint32_t i;
int32_t i;
Edn::String extention;
if (true == fileName.HasExtention() ) {
extention = "*.";
@@ -146,8 +173,8 @@ bool Highlight::FileNameCompatible(Edn::File &fileName)
}
EDN_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
for (i=0; i<m_listExtentions.size(); i++) {
if (extention == m_listExtentions[i] ) {
for (i=0; i<m_listExtentions.Size(); i++) {
if (extention == *m_listExtentions[i] ) {
return true;
}
}
@@ -157,134 +184,119 @@ bool Highlight::FileNameCompatible(Edn::File &fileName)
void Highlight::Display(void)
{
uint32_t i;
int32_t i;
EDN_INFO("List of ALL Highlight : ");
for (i=0; i< m_listExtentions.size(); i++) {
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i] );
for (i=0; i< m_listExtentions.Size(); i++) {
EDN_INFO(" Extention : " << i << " : " << *m_listExtentions[i] );
}
// Display all elements
for (i=0; i< m_listHighlightPass1.size(); i++) {
for (i=0; i< m_listHighlightPass1.Size(); i++) {
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() );
//m_listHighlightPass1[i]->Display();
}
// Display all elements
for (i=0; i< m_listHighlightPass2.size(); i++) {
for (i=0; i< m_listHighlightPass2.Size(); i++) {
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
//m_listHighlightPass2[i]->Display();
}
}
// 13h 46min 22s | (l= 214) Highlight::Parse | [II] Find Pattern in the Buffer : (2457,2479)
void Highlight::Parse(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID)
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas tr<74>grave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
void Highlight::Parse(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
int32_t addingPos,
EdnVectorBuf &buffer)
{
if (0 > addingPos) {
addingPos = 0;
}
/*int32_t emptyId = -1;
for (i=0; i< (int32_t)metaData.size(); i++) {
}*/
//EDN_DEBUG("Parse element " << elementID << " / " << m_listHighlightPass1.size() << " ==> position search: (" << start << "," << stop << ")" );
if (elementID >= (int32_t)m_listHighlightPass1.size() ){
//EDN_DEBUG("Return at " << elementID << " / " << m_listHighlightPass1.size() );
return;
}
//EDN_DEBUG("Parse element 0 => " << m_listHighlightPass1.Size() << " ==> position search: (" << start << "," << stop << ")" );
int32_t elementStart = start;
int32_t elementStop = stop;
resultFind_te ret = HLP_FIND_OK;
colorInformation_ts resultat;
while (HLP_FIND_ERROR != ret && elementStart<elementStop) {
ret = m_listHighlightPass1[elementID]->Find(elementStart, elementStop, resultat, buffer);
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Add curent element in the list ...
if (HLP_FIND_OK_NO_END == ret) {
// find if we have a next element with th save Pointer and not higher the this one
int32_t findNextElement = -1;
int32_t i;
int32_t curentLevel = ((HighlightPattern*)resultat.patern)->GetLevel();
for (i=addingPos; i< (int32_t)metaData.size(); i++) {
if (curentLevel > ((HighlightPattern*)metaData[i].patern)->GetLevel() ) {
//EDN_DEBUG(" -> Find upper element at "<< i );
break;
} else if (curentLevel < ((HighlightPattern*)metaData[i].patern)->GetLevel() ) {
findNextElement = i;
//EDN_DEBUG(" -> Find under element at "<< i );
}
if (metaData[i].patern == resultat.patern)
{
findNextElement = i;
//EDN_DEBUG(" -> Find a same element at "<< i );
break;
}
}
if (-1 != findNextElement) {
// if not find a end, we need to search the end of this one and parse all data inside...
int32_t newEnd = buffer.Size();
if (findNextElement >= (int32_t)metaData.size()-1) {
// Remove old element :
//EDN_DEBUG(" --> Remove : " << addingPos << "==>" << (int32_t)metaData.size() << " (end)" );
metaData.erase(metaData.begin()+addingPos,metaData.end());
while (elementStart<elementStop) {
//EDN_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have
for (int32_t jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
resultFind_te ret = HLP_FIND_OK;
//EDN_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
// Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.Size(), resultat, buffer);
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Remove element in the current List where the current Element have a end inside the next...
int32_t kkk=addingPos;
while(kkk < metaData.Size() ) {
if (metaData[kkk].beginStart <= resultat.endStop) {
// Remove element
//EDN_INFO("Erase element=" << kkk);
metaData.EraseLen(kkk, kkk+1);
// Increase the end of search
if (kkk < metaData.Size()) {
// just befor the end of the next element
elementStop = metaData[kkk].beginStart-1;
} else {
// end of the buffer
elementStop = buffer.Size();
}
} else {
// Remove old element :
//EDN_DEBUG(" --> Remove : " << addingPos << "==>" << findNextElement+1 );
metaData.erase(metaData.begin()+addingPos,metaData.begin()+findNextElement+1);
newEnd = metaData[addingPos].beginStart-1;
// Not find ==> exit the cycle :
break;
}
// Regenerate a local parsing : in a higher range of text
Parse(elementStart, edn_max(newEnd, stop), metaData, addingPos, buffer, elementID);
// Break the curent process, beacause we reparse the data in all range...
return;
} else {
//EDN_DEBUG(" --> No element removed " );
metaData.insert(metaData.begin() + addingPos, resultat);
//EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
}
} else {
metaData.insert(metaData.begin() + addingPos, resultat);
// Add curent element in the list ...
metaData.Insert(addingPos, resultat);
//EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
// Update the current research starting element: (Set position at the end of the current element
elementStart = resultat.endStop-1;
// increment the position of insertion:
addingPos++;
// We find a pattern ==> Stop search for the current element
break;
}
// parse the under element :
Parse(elementStart, resultat.beginStart-1, metaData, addingPos, buffer, elementID+1);
addingPos++;
elementStart = resultat.endStop;
}
// Go to the next element (and search again ...).
elementStart++;
}
// parse the under element :
Parse(elementStart, elementStop, metaData, addingPos, buffer, elementID+1);
}
/**
* @brief second pass of the hightlight
*
*/
void Highlight::Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID)
void Highlight::Parse2(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer)
{
if (elementID >= (int32_t)m_listHighlightPass2.size() ){
return;
}
//EDN_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " ==> position search: (" << start << "," << stop << ")" );
int32_t elementStart = start;
int32_t elementStop = stop;
resultFind_te ret = HLP_FIND_OK;
colorInformation_ts resultat;
while (HLP_FIND_ERROR != ret && elementStart<elementStop) {
if (m_listHighlightPass2[elementID]!=NULL) {
ret = m_listHighlightPass2[elementID]->Find(elementStart, elementStop, resultat, buffer);
} else {
ret = HLP_FIND_ERROR;
}
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// parse the under element :
Parse2(elementStart, resultat.beginStart, metaData, buffer, elementID+1);
// Add curent element in the list ...
metaData.push_back(resultat);
elementStart = resultat.endStop;
while (elementStart<elementStop) {
//EDN_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have
int32_t jjj;
for (jjj=0; jjj<m_listHighlightPass2.Size(); jjj++){
resultFind_te ret = HLP_FIND_OK;
//EDN_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
// Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass2[jjj]->Find(elementStart, elementStop, resultat, buffer);
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Add curent element in the list ...
metaData.PushBack(resultat);
elementStart = resultat.endStop-1;
// Exit current cycle
break;
}
}
// Go to the next element (and search again ...).
elementStart++;
}
// parse the under element :
Parse2(elementStart, elementStop, metaData, buffer, elementID+1);
}

View File

@@ -23,6 +23,7 @@
*******************************************************************************
*/
#include "Edn.h"
#ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__
@@ -38,14 +39,12 @@ extern "C" {
int32_t endStart;
int32_t endStop;
bool notEnded;
HighlightPattern * patern; // pointer on class :
HighlightPattern * patern; // pointer on class :
} colorInformation_ts;
}
#include <vector>
#include "HighlightPattern.h"
#include "Colorize.h"
#include "Edn.h"
#include "EdnVectorBuf.h"
#include "tinyxml.h"
@@ -57,15 +56,22 @@ class Highlight {
bool HasExtention(Edn::String &ext);
bool FileNameCompatible(Edn::File &fileName);
void Display(void);
void Parse( int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID=0);
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0);
void ReloadColor(void);
void Parse(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
int32_t addingPos,
EdnVectorBuf &buffer);
void Parse2(int32_t start,
int32_t stop,
Edn::VectorType<colorInformation_ts> &metaData,
EdnVectorBuf &buffer);
private:
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level);
Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<Edn::String> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
void ParseRules(TiXmlNode *child, Edn::VectorType<HighlightPattern*> &mListPatern, int32_t level);
Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
Edn::VectorType<Edn::String*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
Edn::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
Edn::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
};

View File

@@ -30,21 +30,45 @@
#undef __class__
#define __class__ "HighlightManager"
HighlightManager::HighlightManager(void)
HighlightManager::HighlightManager(void) : MsgBroadcast("Hight-light Manager", EDN_CAT_HL)
{
}
HighlightManager::~HighlightManager(void)
{
listHighlight.clear();
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();
}
void HighlightManager::OnMessage(int32_t id, int32_t dataID)
{
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 *HighlightManager::Get(Edn::File &fileName)
{
uint32_t i;
for (i=0; i<listHighlight.size(); i++) {
int32_t i;
for (i=0; i<listHighlight.Size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return listHighlight[i];
}
@@ -73,33 +97,43 @@ void HighlightManager::loadLanguages(void)
Edn::String xmlFilename = homedir;
xmlFilename += "lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_boo.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_Makefile.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_asm.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_xml.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_php.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
listHighlight.PushBack(myHightline);
myHightline->Display();
xmlFilename = homedir;
xmlFilename += "lang_bash.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
xmlFilename = homedir;
xmlFilename += "lang_matlab.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.PushBack(myHightline);
//myHightline->Display();
}

View File

@@ -29,12 +29,11 @@
class HighlightManager;
#include "Singleton.h"
#include <vector>
#include <string>
#include "MsgBroadcast.h"
#include "Highlight.h"
class HighlightManager: public Singleton<HighlightManager>
class HighlightManager: public Singleton<HighlightManager>, public MsgBroadcast
{
friend class Singleton<HighlightManager>;
// specific for sigleton system...
@@ -43,13 +42,15 @@ class HighlightManager: public Singleton<HighlightManager>
HighlightManager(void);
~HighlightManager(void);
public:
void OnMessage(int32_t id, int32_t dataID);
public:
void loadLanguages(void);
Highlight * Get(Edn::File &fileName);
bool Exist(Edn::File &fileName);
private:
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
Edn::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
};
#endif

View File

@@ -87,6 +87,13 @@ bool HighlightPattern::IsEnable(void)
return true;
}
void HighlightPattern::ReloadColor(void)
{
ColorizeManager *myColorManager = ColorizeManager::getInstance();
m_color = myColorManager->Get(m_colorName);
}
/**
* @brief
*
@@ -190,6 +197,19 @@ void HighlightPattern::ParseRules(TiXmlNode *child, int32_t level)
}
}
/**
* @brief Find Element only in the specify start characters and find the end with the range done
*
* @param[in] start First character to search data (if recognise it start here)
* @param[in] stop End of the possibility whe search can continue
* @param[out] resultat Position where find data
* @param[in] buffer : Where to search data
*
* @return HLP_FIND_OK We find a compleate pattern
* @return HLP_FIND_OK_NO_END Xe find a partial pattern (missing end)
* @return HLP_FIND_ERROR Not find the pattern
*/
resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer)
{
//EDN_DEBUG(" try to find the element");
@@ -202,7 +222,7 @@ resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformati
// when we have only one element :
if (false == m_haveStopPatern) {
if (true == m_regExpStart->Process(buffer, start, stop)) {
if (true == m_regExpStart->ProcessOneElement(buffer, start, stop)) {
resultat.beginStart = m_regExpStart->Start();
resultat.beginStop = m_regExpStart->Stop();
resultat.endStart = m_regExpStart->Start();
@@ -212,7 +232,7 @@ resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformati
//EDN_DEBUG("NOT find hightlightpatern ...");
} else {
// try while we find the first element
if (true == m_regExpStart->Process(buffer, start, stop, m_escapeChar)) {
if (true == m_regExpStart->ProcessOneElement(buffer, start, stop, m_escapeChar)) {
resultat.beginStart = m_regExpStart->Start();
resultat.beginStop = m_regExpStart->Stop();
if (true == m_regExpStop->Process(buffer, resultat.beginStop, stop, m_escapeChar)) {

View File

@@ -51,23 +51,25 @@ class HighlightPattern {
HighlightPattern(void);
~HighlightPattern(void);
void SetName(Edn::String &name) { m_paternName = name;};
Edn::String GetName(void) { return m_paternName;};
void SetName(Edn::String &name) { m_paternName = name;};
Edn::String GetName(void) { return m_paternName;};
void SetPaternStart(Edn::String &regExp);
void SetPaternStop(Edn::String &regExp);
void SetColor(Edn::String &colorName);
void SetEscapeChar(Edn::String &EscapeChar);
void SetMultiline(bool enable) { m_multiline = enable; };
void SetPaternStart(Edn::String &regExp);
void SetPaternStop(Edn::String &regExp);
void SetColor(Edn::String &colorName);
void SetEscapeChar(Edn::String &EscapeChar);
void SetMultiline(bool enable) { m_multiline = enable; };
void SetLevel(int32_t newLevel) { m_level = newLevel; };
int32_t GetLevel(void) { return m_level; };
void SetLevel(int32_t newLevel) { m_level = newLevel; };
int32_t GetLevel(void) { return m_level; };
bool IsEnable(void);
void Display(void);
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer);
Colorize * GetColor(void) { return m_color; };
void ParseRules(TiXmlNode *child, int32_t level);
bool IsEnable(void);
void Display(void);
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer);
Colorize * GetColor(void) { return m_color; };
void ParseRules(TiXmlNode *child, int32_t level);
void ReloadColor(void);
private:
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
@@ -79,8 +81,8 @@ class HighlightPattern {
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
char m_escapeChar; //!< Escape char to prevent exeit of patern ....
Edn::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// Edn::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
Edn::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
// Edn::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
};
#endif

View File

@@ -119,7 +119,22 @@ void CTagsManager::OnMessage(int32_t id, int32_t dataID)
JumpTo();
break;
case EDN_MSG__JUMP_BACK:
EDN_INFO("TODO .... jump back");
if (m_historyList.Size() > 0) {
BufferManager *myBufferManager = BufferManager::getInstance();
int32_t id = m_historyList.Size()-1;
if (false == myBufferManager->Exist(*m_historyList[id]) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(*m_historyList[id]);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(*m_historyList[id]));
}
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, m_historyList[id]->GetLineNumber());
// Remove element ....
delete(m_historyList[id]);
m_historyList[id]=NULL;
m_historyList.PopBack();
}
break;
}
@@ -155,61 +170,68 @@ void CTagsManager::AddToHistory(int32_t bufferID)
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
delete(m_historyList[iii]);
}
m_historyList.Erase(m_historyPos, m_historyList.Size() - m_historyPos);
m_historyList.EraseLen(m_historyPos, m_historyList.Size() - m_historyPos);
}
// add the current element
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::File currentFilename = myBufferManager->Get(bufferID)->GetFileName();
}
enum
{
CTAGS_COL_FILE = 0,
CTAGS_COL_REGEXP,
CTAGS_COL_LINE_NUMBER,
CTAGS_NUM_COLS
};
static GtkTreeModel * create_and_fill_model(void)
void CTagsManager::cb_row(GtkTreeView *p_treeview,
GtkTreePath * p_path,
GtkTreeViewColumn * p_column,
gpointer data)
{
GtkListStore * store;
GtkTreeIter iter;
EDN_DEBUG("event");
CTagsManager * self = reinterpret_cast<CTagsManager*>(data);
store = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
gchar * p_file=NULL;
gint lineNumber;
GtkTreeIter iter;
// Append a row and fill in some data
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file1.c",
CTAGS_COL_REGEXP, "void function1(void);",
-1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file2.c",
CTAGS_COL_REGEXP, "void function2(void);",
-1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
CTAGS_COL_FILE, "file3.c",
CTAGS_COL_REGEXP, "void function3(void);",
-1);
return GTK_TREE_MODEL(store);
if (gtk_tree_model_get_iter( GTK_TREE_MODEL(self->m_listStore), &iter, p_path))
{
gtk_tree_model_get( GTK_TREE_MODEL(self->m_listStore),
&iter,
CTAGS_COL_FILE, &p_file,
CTAGS_COL_LINE_NUMBER, &lineNumber,
-1 );
EDN_DEBUG("find : " << p_file << ":" << lineNumber);
for (int32_t iii = 0; iii < self->m_currentList.Size() ; iii++) {
if( self->m_currentList[iii].lineID == lineNumber
&& strcmp(self->m_currentList[iii].filename, p_file)==0)
{
g_object_unref( GTK_TREE_MODEL(self->m_listStore));
// Remove dialogue
gtk_widget_destroy(self->m_Dialog);
// Jump ...
self->JumpAtID(iii);
return;
}
}
}
}
static GtkWidget * create_view_and_model(void)
GtkWidget * CTagsManager::CreateViewAndModel(void)
{
GtkCellRenderer * renderer;
GtkTreeModel * model;
GtkWidget * view;
GtkCellRenderer * renderer;
GtkWidget * view;
view = gtk_tree_view_new();
// Column 1
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW (view),
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
-1,
"File",
renderer,
@@ -218,18 +240,28 @@ static GtkWidget * create_view_and_model(void)
// Column 2
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW (view),
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
-1,
"Regular Expression",
"lineNumber",
renderer,
"text", CTAGS_COL_REGEXP,
"text", CTAGS_COL_LINE_NUMBER,
NULL);
model = create_and_fill_model();
// Set data in the list :
GtkTreeIter iter;
m_listStore = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
// Append a row and fill in some data
for (int32_t iii=0; iii<m_currentList.Size() ; iii++) {
gtk_list_store_append(m_listStore, &iter);
gtk_list_store_set(m_listStore, &iter,
CTAGS_COL_FILE, m_currentList[iii].filename,
CTAGS_COL_LINE_NUMBER, m_currentList[iii].lineID,
-1);
}
gtk_tree_view_set_model(GTK_TREE_VIEW (view), model);
g_object_unref(model);
gtk_tree_view_set_model( GTK_TREE_VIEW(view), GTK_TREE_MODEL(m_listStore) );
g_signal_connect( G_OBJECT(view), "row-activated", G_CALLBACK(cb_row), /*(gpointer)p_model*/ this );
//g_object_unref(GTK_TREE_MODEL(m_listStore));
return view;
}
@@ -238,33 +270,90 @@ static GtkWidget * create_view_and_model(void)
void CTagsManager::MultipleJump(void)
int32_t CTagsManager::MultipleJump(void)
{
// dlg to confirm the quit event :
GtkWidget *myDialog = gtk_dialog_new_with_buttons("C-Tags jump...",
NULL,
GTK_DIALOG_MODAL,
"Jump", GTK_RESPONSE_YES,
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL);
m_Dialog = gtk_dialog_new_with_buttons("C-Tags jump...",
NULL,
GTK_DIALOG_MODAL,
//"Jump", GTK_RESPONSE_YES,
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
NULL);
// 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 *listView = create_view_and_model ();
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(m_Dialog));
GtkWidget *listView = CreateViewAndModel();
gtk_box_pack_start(GTK_BOX(myContentArea), listView, TRUE, TRUE, 0);
// Display it
gtk_widget_show_all(myContentArea);
int32_t result = gtk_dialog_run (GTK_DIALOG (myDialog));
int32_t result = gtk_dialog_run(GTK_DIALOG(m_Dialog));
// Get data from the gtk entry
if (result == GTK_RESPONSE_NO) {
g_object_unref(GTK_TREE_MODEL(m_listStore));
// Remove dialogue
gtk_widget_destroy(m_Dialog);
}
//GtkTreeIter *myIter;
//gtk_tree_selection_get_selected(selection, &model, myIter);
// Remove dialogue
gtk_widget_destroy(myDialog);
//gtk_widget_destroy(myDialog);
return 0;
}
/*
void BufferView::OnCtagsEventList(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 CTagsManager::JumpAtID(int32_t selectID)
{
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::File myFile = m_currentList[selectID].filename;
EDN_INFO("save curent filename and position : ");
int32_t currentSelected = myBufferManager->GetSelected();
Buffer* tmpBuf = myBufferManager->Get(currentSelected);
if (NULL != tmpBuf) {
Edn::File * bufferFilename = new Edn::File();
*bufferFilename = tmpBuf->GetFileName();
bufferFilename->SetLineNumber(tmpBuf->GetCurrentLine());
m_historyList.PushBack(bufferFilename);
}
EDN_INFO(" OPEN the TAG file Destination : " << myFile );
if (false == myBufferManager->Exist(myFile) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(myFile);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myFile));
}
/*
int32_t localId = myBufferManager->GetId(myFile);
Edn::String pattern = entry.address.pattern;
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
if (pattern.Size() > 4) {
pattern.Remove(0,2);
pattern.Remove(pattern.Size()-1,2);
}
// TODO : remove '\' char when needed ...
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
*/
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, m_currentList[selectID].lineID - 1);
}
void CTagsManager::JumpTo(void)
{
MultipleJump();
m_currentList.Clear();
if (NULL != m_ctagFile) {
Edn::VectorType<int8_t> data;
// get the middle button of the clipboard ==> represent the current selection ...
@@ -276,33 +365,37 @@ void CTagsManager::JumpTo(void)
data.PushBack('\0');
EDN_INFO("try to find the tag : " << (const char *)&data[0]);
if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) {
//EDN_INFO("find the tag");
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::String destinationFilename = m_tagFolderBase;
destinationFilename += entry.file;
Edn::File myfile = destinationFilename;
EDN_INFO(" OPEN the TAG file Destination : " << myfile );
if (false == myBufferManager->Exist(myfile) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(myfile);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myfile));
}
int32_t localId = myBufferManager->GetId(myfile);
Edn::String pattern = entry.address.pattern;
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
if (pattern.Size() > 4) {
pattern.Remove(0,2);
pattern.Remove(pattern.Size()-1,2);
}
// TODO : remove '\' char when needed ...
EDN_DEBUG("try to find line with : \"" << pattern << "\"" );
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
/*
tagEntry entrySave = entry;
int32_t numberOfTags = 0;
// For all tags : Save in an internal Structure :
do {
PrintTag (&entry);
Edn::String destinationFilename = m_tagFolderBase;
destinationFilename += entry.file;
Edn::File myfile = destinationFilename;
TagListFind_ts myStruct;
strncpy(myStruct.filename, myfile.GetCompleateName().c_str(), MAX_FILE_NAME);
myStruct.filename[MAX_FILE_NAME-1] = '\0';
strncpy(myStruct.RegExp, entry.address.pattern, MAX_REG_EXP_SEARCH);
myStruct.RegExp[MAX_REG_EXP_SEARCH-1] = '\0';
myStruct.lineID = entry.address.lineNumber;
// at at the corect position
m_currentList.PushBack(myStruct);
PrintTag(&entry, true);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
if (1==m_currentList.Size() ) {
JumpAtID(0);
} else {
// Open a choice windows...
int32_t SelectID = MultipleJump();
}
/*
// Display all the element :
do {
PrintTag(&entry, true);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
*/
} else {
@@ -311,21 +404,26 @@ void CTagsManager::JumpTo(void)
}
}
void CTagsManager::PrintTag (const tagEntry *entry)
void CTagsManager::PrintTag (const tagEntry *entry, bool small)
{
int i;
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" pattern=\"" <<entry->address.pattern
<< "\" at line="<<entry->address.lineNumber);
EDN_INFO("Extention field : ");
if (entry->kind != NULL && entry->kind [0] != '\0') {
EDN_INFO(" kind : " << entry->kind);
}
if (entry->fileScope) {
EDN_INFO(" file : ");
}
for (i = 0 ; i < entry->fields.count ; ++i) {
EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
if (small==true) {
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" at line="<< entry->address.lineNumber);
} else {
int i;
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" pattern=\"" <<entry->address.pattern
<< "\" at line="<<entry->address.lineNumber);
EDN_INFO("Extention field : ");
if (entry->kind != NULL && entry->kind [0] != '\0') {
EDN_INFO(" kind : " << entry->kind);
}
if (entry->fileScope) {
EDN_INFO(" file : ");
}
for (i = 0 ; i < entry->fields.count ; ++i) {
EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
}
}
}

View File

@@ -32,6 +32,14 @@
#include "readtags.h"
#include "Edn.h"
#define MAX_REG_EXP_SEARCH (1024)
typedef struct{
char filename[MAX_FILE_NAME];
char RegExp[MAX_REG_EXP_SEARCH];
int32_t lineID;
} TagListFind_ts;
class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
{
@@ -47,9 +55,9 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
private:
int32_t m_currentSelectedID;
void LoadTagFile(void);
void MultipleJump(void);
int32_t MultipleJump(void);
void JumpTo(void);
void PrintTag(const tagEntry *entry);
void PrintTag(const tagEntry *entry, bool small);
Edn::String GetFolder(Edn::String &inputString);
Edn::String m_tagFolderBase;
Edn::String m_tagFilename;
@@ -58,6 +66,16 @@ class CTagsManager: public Singleton<CTagsManager>, public MsgBroadcast
void AddToHistory(int32_t bufferID);
int32_t m_historyPos;
Edn::VectorType<Edn::File*> m_historyList;
Edn::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

@@ -66,8 +66,6 @@ int main (int argc, char *argv[])
ClipBoard::Init();
Display::Init();
//MainWindows *window = MainWindows::getInstance();
// init ALL Singleton :
(void)MsgBroadcastCore::getInstance();
@@ -86,7 +84,8 @@ int main (int argc, char *argv[])
#else
homedir = "./data/";
#endif
homedir += "color_black.xml";
//homedir += "color_black.xml";
homedir += "color_white.xml";
myColorManager->LoadFile( homedir.c_str() );
myColorManager->DisplayListOfColor();

View File

@@ -1,179 +0,0 @@
/**
*******************************************************************************
* @file AL_Mutex.c
* @brief Editeur De N'ours : Abstraction Layer Mutex
* @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 "AL_Mutex.h"
// /usr/include/pthread.h
/**
* @brief initialize the curent Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
* @param[in] recursive Enable the possibility that one thread can lock multiple time the same Mutex
*
* @return an standard Error Code (ERR_NONE / ERR_FAIL)
*
*/
erreurCode_te AL_mutex_init(AL_MUTEX * pointerMutex,bool recursive)
{
int systemRet;
pthread_mutexattr_t mutexattr;
erreurCode_te myError= ERR_NONE;
EDN_CHECK_INOUT(pointerMutex);
// init mutex attributes
systemRet = pthread_mutexattr_init(&mutexattr);
if (0 == systemRet) {
if (true == recursive) {
systemRet = pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE_NP);
EDN_ASSERT(!systemRet, "pthread_mutexattr_settype Error");
}
else {
systemRet = pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK_NP);
EDN_ASSERT(!systemRet, "pthread_mutexattr_settype Error");
}
}
if (0 == systemRet) {
systemRet = pthread_mutex_init(pointerMutex, &mutexattr);
EDN_ASSERT(!systemRet, "pthread_mutex_init Error Mutex Init");
if (systemRet) {
myError = ERR_FAIL;
}
}
systemRet = pthread_mutexattr_destroy(&mutexattr);
EDN_ASSERT(0 == systemRet, "pthread_mutexattr_destroy Error");
return myError;
}
/**
* @brief Destroy the current Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return an standard Error Code (ERR_NONE / ERR_FAIL)
*
*/
erreurCode_te AL_mutex_destroy(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_destroy(pointerMutex);
EDN_ASSERT(!systemRet, "pthread_mutex_destroy Error Mutex Destroy");
if (systemRet) {
return ERR_FAIL;
}
return ERR_NONE;
}
/**
* @brief Lock the curent Mutex. Lock call
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return ---
*
*/
void AL_mutex_lock(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_lock(pointerMutex);
EDN_ASSERT(!systemRet, "pthread_mutex_lock Error Mutex lock");
}
/**
* @brief Unlock the current Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return ---
*
*/
void AL_mutex_unlock(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_unlock(pointerMutex);
EDN_ASSERT(!systemRet, "pthread_mutex_unlock Error Mutex unlock");
}
/**
* @brief Try the lock of the curent Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return an standard Error Code (ERR_NONE / ERR_BUSY)
*
*/
erreurCode_te AL_mutex_trylock(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_trylock(pointerMutex);
EDN_ASSERT(0==systemRet || EBUSY==systemRet, "pthread_mutex_trylock Error Mutex unlock");
if (EBUSY==systemRet) {
return ERR_BUSY;
}
return ERR_NONE;
}
/**
* @brief try lock in a periode of time
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return an standard Error Code (ERR_NONE / ERR_TIMEOUT)
*
*/
erreurCode_te AL_mutex_timedlock(AL_MUTEX * pointerMutex, int32_t delay)
{
/*
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
if (0 == delay) {
return ERR_NONE;
}
// TODO ... check is it OK...
systemRet = pthread_mutex_timedlock(pointerMutex, delay);
EDN_ASSERT(0 == systemRet || ETIMEDOUT == systemRet, "pthread_mutex_timedlock Error");
if (ETIMEDOUT == systemRet) {
return ERR_TIMEOUT;
}
*/
return ERR_NONE;
}

View File

@@ -1,45 +0,0 @@
/**
*******************************************************************************
* @file AL_Mutex.h
* @brief Editeur De N'ours : Abstraction Layer Mutex
* @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.
*
*******************************************************************************
*/
#ifndef __AL_MUTEX_H__
#define __AL_MUTEX_H__
//basic mutex with pthread system
#include <pthread.h>
#include <errno.h>
typedef pthread_mutex_t AL_MUTEX;
erreurCode_te AL_mutex_init(AL_MUTEX * pointerMutex,bool recursive);
erreurCode_te AL_mutex_destroy(AL_MUTEX * pointerMutex);
void AL_mutex_lock(AL_MUTEX * pointerMutex);
void AL_mutex_unlock(AL_MUTEX * pointerMutex);
erreurCode_te AL_mutex_trylock(AL_MUTEX * pointerMutex);
//erreurCode_te AL_mutex_timedlock(AL_MUTEX * pointerMutex, int32_t delay);
#endif

View File

@@ -40,7 +40,7 @@
#define FONT_ITALIC_YES (1)
// Variables privé du namespace
// Variables priv<EFBFBD> du namespace
#define POLICE_NAME "Monospace"
#ifdef USE_GTK_VERSION_3_0
@@ -61,17 +61,10 @@ static cairo_font_face_t * m_cairoFont[2][2] = {{NULL, NULL},{ NULL, NULL}};
static cairo_font_face_t * m_cairoFont[2][2] = {{NULL, NULL},{ NULL, NULL}};
void Display::Init(void)
{
/*
charWidth = gdk_char_width(myFont[FONT_ITALIC_YES][FONT_BOLD_NO], 'Z');
EDN_INFO("Font Width = %d", charWidth);
charHeignt = gdk_char_height(myFont[FONT_ITALIC_YES][FONT_BOLD_NO], 'Z');
EDN_INFO("Font Height = %d", charHeignt);
*/
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
if ( NULL == m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]) {
EDN_ASSERT(FALSE, "basic font ERROR");
}
@@ -96,10 +89,10 @@ void Display::Init(void)
void Display::UnInit(void)
{
// clean the builder...
free(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]);
free(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO]);
free(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES]);
free(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES]);
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]);
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO]);
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES]);
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES]);
}
@@ -134,6 +127,7 @@ cairo_font_face_t * Display::GetFont(bool bold, bool italic)
#undef __class__
#define __class__ "DrawerManager"
//#define megaplop mlkjmlk
/**
* @brief DrawerManager constructor : generate a memoryDC where we can draw everything...
*
@@ -146,25 +140,48 @@ cairo_font_face_t * Display::GetFont(bool bold, bool italic)
* @return ---
*
*/
DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y, int32_t scrollOffset)
{
m_size.x = x;
m_size.y = y;
m_haveWork = false;
// Create the Cairo Element
# if USE_GTK_VERSION_3_0
m_cairo = gdk_cairo_create(gtk_widget_get_window(widget));
m_windows = gtk_widget_get_window(widget);
# elif USE_GTK_VERSION_2_0
m_cairo = gdk_cairo_create(widget->window);
m_windows = widget->window;
# endif
//cairo_translate(m_cairo, 0, 7);
cairo_set_source_rgb(m_cairo, 0, 0, 0);
cairo_paint(m_cairo);
// Double buffer with previous copy management :
{
// Create the Cairo context from the current windows
cairo_t * cairoWindows = gdk_cairo_create(m_windows);
// inform that we nee a double buffer
GdkRectangle myRect = {0, 0, x, y};
gdk_window_begin_paint_rect(m_windows, &myRect);
// Create the Cairo context from the double Buffer just created
m_cairo = gdk_cairo_create(m_windows);
// Copy the previous display data from the current display to the double buffer area:
cairo_surface_t * drawableSurface = cairo_get_target(cairoWindows);
TranslateVertical(-1* scrollOffset);
cairo_set_source_surface(m_cairo, drawableSurface, 0, 0);
cairo_paint(m_cairo);
TranslateVertical(scrollOffset);
//cairo_surface_destroy(drawableSurface);
cairo_destroy(cairoWindows);
}
cairo_scale(m_cairo, 1.0, 1.0);
# ifndef NDEBUG
// for Test only : this remove slowly the old line that is not rewritten
cairo_set_source_rgb(m_cairo, 0, 0, 0);
cairo_set_source_rgba(m_cairo, 1, 1, 1, 0.05);
cairo_paint(m_cairo);
# endif
cairo_set_font_size(m_cairo, POLICE_SIZE);
m_dataToDisplay[0] = '\0';
cairo_scale(m_cairo, 1.0, 1.0);
m_nbElement = 0;
// http://cairographics.org/FAQ/#clear_a_surface
// http://gtk.developpez.com/faq/?page=gtkwidget#GTK_WIDGET_transparent
@@ -173,10 +190,6 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
//cairo_paint(m_cairo);
//cairo_fill(m_cairo);
//cairo_stroke (m_cairo);
}
@@ -192,6 +205,9 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
*/
DrawerManager::~DrawerManager()
{
// call the painting of the double buffer in the displayed current buffer
gdk_window_end_paint(m_windows);
// Destroy cairo context
cairo_destroy(m_cairo);
}
@@ -246,7 +262,6 @@ void DrawerManager::Text(color_ts & SelectColorFg, color_ts & SelectColorBg, int
cairo_set_font_face(m_cairo, Display::GetFont(false, false));
int32_t letterHeight = Display::GetFontHeight();
int32_t letterWidth = Display::GetFontWidth();
int32_t stringLen = strUtf8Len(myText);
DirectRectangle(SelectColorBg, x, y, letterWidth*strlen(myText), letterHeight);
cairo_fill(m_cairo);
cairo_move_to(m_cairo, x, y+letterHeight-4);
@@ -290,16 +305,15 @@ void DrawerManager::SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32
void DrawerManager::Flush(void)
{
if (true == m_haveWork) {
//EDN_WARNING("flush : \"" << m_dataToDisplay << "\"");
//EDN_WARNING("flush : \"" << m_dataToDisplay << "\"" << " bold=" << m_selectColor->GetBold() << " italic=" << m_selectColor->GetItalic());
m_haveWork = false;
cairo_set_font_face(m_cairo, Display::GetFont(m_selectColor->GetBold(), m_selectColor->GetItalic()));
int32_t letterHeight = Display::GetFontHeight();
if (true == m_selectColor->HaveBg() ) {
int32_t letterWidth = Display::GetFontWidth();
int32_t stringLen = m_nbElement;
// generate Clean BG:
DirectRectangle(m_selectColor, m_pos.x, m_pos.y, letterWidth*stringLen, letterHeight);
DirectRectangle(m_selectColor, m_pos.x, m_pos.y, letterWidth*m_nbElement, letterHeight);
}
cairo_move_to(m_cairo, m_pos.x, m_pos.y+letterHeight-4);
m_selectColor->ApplyFG(m_cairo);
@@ -358,9 +372,10 @@ void DrawerManager::DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y,
// flush
cairo_fill(m_cairo);
}
void DrawerManager::DirectRectangle(color_ts &SelectColor, int32_t x, int32_t y, int32_t width, int32_t height)
{
cairo_set_source_rgb(m_cairo, SelectColor.red, SelectColor.green, SelectColor.blue);
// set postion
cairo_rectangle(m_cairo, x, y, width, height);
@@ -438,6 +453,7 @@ void DrawerManager::Cursor(int32_t x, int32_t y)
cairo_rel_line_to(m_cairo, 0, -letterHeight);
}
cairo_stroke(m_cairo);
//cairo_set_fill_rule(m_cairo, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill(m_cairo);
}
@@ -585,6 +601,14 @@ void DrawerManager::UTF8UnknownElement(Colorize *SelectColor, int32_t x, int32_t
}
void DrawerManager::TranslateVertical(int32_t nbPixelTranslation)
{
Flush();
//scale((xmax-xmin)/W, (ymax-ymin)/H)
cairo_translate(m_cairo, 0, nbPixelTranslation);
cairo_fill(m_cairo);
cairo_paint(m_cairo);
}
/* Basic axample with cairo and pango...

View File

@@ -26,11 +26,9 @@
#ifndef __TOOLS_DISPLAY_H__
#define __TOOLS_DISPLAY_H__
#include "tools_debug.h"
#include "Colorize.h"
#include "ColorizeManager.h"
#include <string>
#include <vector>
#include "tools_debug.h"
#include "Colorize.h"
#include "ColorizeManager.h"
/**
@@ -54,7 +52,7 @@ class DrawerManager;
class DrawerManager {
public:
// Constructeur
DrawerManager(GtkWidget * widget, int32_t x, int32_t y);
DrawerManager(GtkWidget * widget, int32_t x, int32_t y, int32_t scrollOffset=0);
~DrawerManager();
void Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
@@ -74,6 +72,7 @@ class DrawerManager {
void Flush(void);
int32_t GetWidth(void) { return m_size.x; };
int32_t GetHeight(void) { return m_size.y; };
void TranslateVertical(int32_t nbPixelTranslation);
private:
void DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
@@ -87,7 +86,7 @@ class DrawerManager {
position_ts m_size; //!< Total size
cairo_t * m_cairo; //!< Cairo Layout pointer
GdkWindow * m_windows; //!< remember the current widget ==> for some internal problems
};

View File

@@ -646,8 +646,22 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
EdnVectorBuf::Iterator myPosIt = m_data.Position(startPos);
int32_t lineCount = 0;
#ifndef NDEBUG
GTimeVal timeStart;
if (0 == startPos) {
g_get_current_time(&timeStart);
}
#endif
while (myPosIt) {
if (myPosIt.Position() == endPos) {
#ifndef NDEBUG
if (0 == startPos) {
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_ERROR("Count line (" << startPos << "," << endPos << ") time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
}
#endif
return lineCount;
}
if ('\n' == *myPosIt) {
@@ -655,6 +669,76 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
}
myPosIt++;
}
#ifndef NDEBUG
if (0 == startPos) {
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_ERROR("Count line (" << startPos << "," << endPos << ") time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
}
#endif
return lineCount;
}
/**
* @brief Get the Id of the line where is positionned the current pos element
*
* @param[in] pos posithion in the buffer where we need to know the current line
* @param[in] refPos reference position
* @param[in] refLine reference Line of the position
*
* @return the current line ID of the pos
*
*/
int32_t EdnBuf::GetLinesIdWithRef(int32_t pos, int32_t refPos, int32_t refLine)
{
EdnVectorBuf::Iterator myPosIt = m_data.Position(refPos);
int32_t lineCount = refLine;
#ifndef NDEBUG
GTimeVal timeStart;
g_get_current_time(&timeStart);
#endif
if (pos == refPos) {
return refLine;
} else if (pos > refPos) {
while (myPosIt) {
if (myPosIt.Position() == pos) {
#ifndef NDEBUG
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("Count line " << pos << " with ref(" << refPos << "," << refPos << ") time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
#endif
return lineCount;
}
if ('\n' == *myPosIt) {
lineCount++;
}
myPosIt++;
}
} else {
while (myPosIt) {
if (myPosIt.Position() == pos) {
#ifndef NDEBUG
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("Count line " << pos << " with ref(" << refPos << "," << refPos << ") time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
#endif
return lineCount;
}
if ('\n' == *myPosIt) {
lineCount--;
}
myPosIt--;
}
}
#ifndef NDEBUG
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("Count line " << pos << " with ref(" << refPos << "," << refPos << ") time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
#endif
return lineCount;
}
@@ -685,12 +769,21 @@ int32_t EdnBuf::CountLines(void)
EdnVectorBuf::Iterator myPosIt = m_data.Begin();
int32_t lineCount = 0;
#ifndef NDEBUG
GTimeVal timeStart;
g_get_current_time(&timeStart);
#endif
while(myPosIt) {
if ('\n' == *myPosIt) {
lineCount++;
}
myPosIt++;
}
#ifndef NDEBUG
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("count total number of line time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
#endif
return lineCount;
}
@@ -720,6 +813,12 @@ void EdnBuf::CountNumberOfLines(void)
*/
int32_t EdnBuf::CountForwardNLines(int32_t startPos, int32_t nLines)
{
#ifndef NDEBUG
GTimeVal timeStart;
if (0 == startPos) {
g_get_current_time(&timeStart);
}
#endif
if (nLines == 0) {
return startPos;
} else if (startPos > m_data.Size() ) {
@@ -739,6 +838,14 @@ int32_t EdnBuf::CountForwardNLines(int32_t startPos, int32_t nLines)
}
myPosIt++;
}
#ifndef NDEBUG
if (0 == startPos) {
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("get poiner line (pos=" << startPos << "=>" << nLines << "lines) time = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s ==> " << (timeStop.tv_usec - timeStart.tv_usec)/1000. << "ms");
}
#endif
//EDN_INFO(" ==> (2) at position=" << myPosIt.Position() );
return myPosIt.Position();
}

View File

@@ -49,13 +49,13 @@ end *************** *************
*/
typedef struct {
bool selected; //!< True if the selection is active
bool rectangular; //!< True if the selection is rectangular
bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard.
int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it.
int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it.
int32_t rectStart; //!< Indent of left edge of rect. selection
int32_t rectEnd; //!< Indent of right edge of rect. selection
bool selected; //!< True if the selection is active
bool rectangular; //!< True if the selection is rectangular
bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard.
int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it.
int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it.
int32_t rectStart; //!< Indent of left edge of rect. selection
int32_t rectEnd; //!< Indent of right edge of rect. selection
} selection;
typedef enum{
@@ -67,10 +67,10 @@ typedef enum{
typedef struct {
std::vector<colorInformation_ts> HLData;
int32_t idSequence;
int32_t posHLPass1;
int32_t posHLPass2;
Edn::VectorType<colorInformation_ts> HLData;
int32_t idSequence;
int32_t posHLPass1;
int32_t posHLPass2;
}displayHLData_ts;
@@ -105,6 +105,7 @@ class EdnBuf {
int32_t CharWidth( char c, int32_t indent); // TODO : rework this
int32_t CountDispChars( int32_t lineStartPos, int32_t targetPos);
int32_t CountForwardDispChars( int32_t lineStartPos, int32_t nChars);
int32_t GetLinesIdWithRef( int32_t pos, int32_t refPos, int32_t refLine);
int32_t CountLines( int32_t startPos, int32_t endPos);
int32_t CountLines( void);
int32_t CountLines( Edn::VectorType<int8_t> &data);
@@ -125,54 +126,55 @@ class EdnBuf {
// selection remember...
// -----------------------------------------
public:
bool SelectHasSelection( selectionType_te select);
void Select( selectionType_te select, int32_t start, int32_t end);
void Unselect( selectionType_te select);
void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text);
void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text);
bool SelectHasSelection( selectionType_te select);
void Select( selectionType_te select, int32_t start, int32_t end);
void Unselect( selectionType_te select);
void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( selectionType_te select, Edn::VectorType<int8_t> &text);
void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, Edn::VectorType<int8_t> &text);
private:
// current selection of the buffer
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted);
void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted);
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted);
void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted);
// -----------------------------------------
// History section :
// -----------------------------------------
public:
int32_t Undo( void);
int32_t Redo( void);
int32_t Undo(void);
int32_t Redo(void);
private:
bool m_isUndoProcessing;
bool m_isRedoProcessing;
Edn::VectorType<EdnBufHistory*> m_historyUndo;
Edn::VectorType<EdnBufHistory*> m_historyRedo;
bool m_isUndoProcessing;
bool m_isRedoProcessing;
Edn::VectorType<EdnBufHistory*> m_historyUndo;
Edn::VectorType<EdnBufHistory*> m_historyRedo;
// -----------------------------------------
// hightlight section :
// -----------------------------------------
private:
Highlight * m_Highlight; //!< internal link with the Highlight system
std::vector<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void);
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
Highlight * m_Highlight; //!< internal link with the Highlight system
Edn::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void);
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
public:
void SetHLSystem( Highlight * newHLSystem);
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines);
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
void SetHLSystem( Highlight * newHLSystem);
void HightlightOneLine(displayHLData_ts & MData, int32_t HLStart, int32_t HLStop);
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines); // TODO : deprecated ...
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
private:
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
private:
EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t
void CountNumberOfLines(void);
int32_t m_nbLine; //!< Number of line in the biffer
EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t
void CountNumberOfLines(void);
int32_t m_nbLine; //!< Number of line in the biffer
// -----------------------------------------
// Display property and charset ...
@@ -186,27 +188,27 @@ class EdnBuf {
void SetUTF8Mode(bool newOne) { m_isUtf8 = newOne; m_charsetType=EDN_CHARSET_UTF8; };
private:
// Special mode of the buffer :
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
// Local Tabulation policies
int32_t m_tabDist; //!< equiv. number of characters in a tab
bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations
int32_t m_tabDist; //!< equiv. number of characters in a tab
bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations
// -----------------------------------------
// Local function :
// -----------------------------------------
private:
void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd);
char *getSelectionText( selection &sel);
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd);
char * getSelectionText( selection &sel);
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
void eventModification( int32_t pos, int32_t nInserted, Edn::VectorType<int8_t> &deletedText);
int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
int32_t insert( int32_t pos, Edn::VectorType<int8_t> &insertText);
bool charMatch( char first, char second, bool caseSensitive = true);
bool charMatch( char first, char second, bool caseSensitive = true);
};
#endif

View File

@@ -35,12 +35,12 @@ void EdnBuf::SetHLSystem(Highlight * newHLSystem)
{
if (m_Highlight != newHLSystem) {
m_Highlight = newHLSystem;
m_HLDataPass1.clear();
m_HLDataPass1.Clear();
RegenerateHighLightAt(0, 0, m_data.Size());
}
}
// TODO : Check this fuction it have too many conditionnal inside ==> can do a better algo
void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded)
{
GTimeVal timeStart;
@@ -60,14 +60,23 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
return;
}
// normal case
EDN_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
//EDN_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
int32_t i;
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
EDN_DEBUG("HighLight (previous) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
int32_t posEnd = pos + nbDeleted;
// search position of the old element to reparse IT...
int32_t startId;
int32_t stopId;
// clean data if needed
if (0 != m_HLDataPass1.size()) {
if (0 != m_HLDataPass1.Size()) {
// find element previous
FindMainHighLightPosition(pos, posEnd, startId, stopId, true);
@@ -75,19 +84,37 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
if( -1 == startId
&& -1 == stopId)
{
m_HLDataPass1.clear();
m_HLDataPass1.Clear();
} else if(-1 == startId) {
if (0 == stopId){
m_HLDataPass1.erase(m_HLDataPass1.begin());
m_HLDataPass1.Erase(0);
//EDN_DEBUG("1 * Erase 0");
} else {
m_HLDataPass1.erase(m_HLDataPass1.begin(),m_HLDataPass1.begin()+stopId);
m_HLDataPass1.EraseLen(0,stopId);
//EDN_DEBUG("2 * Erase 0->" << stopId);
}
} else if(-1 == stopId) {
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1,m_HLDataPass1.end());
//EDN_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.EraseLen(startId+1, m_HLDataPass1.Size() - startId);
stopId = -1;
} else {
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1,m_HLDataPass1.begin()+stopId);
int32_t currentSize = m_HLDataPass1.Size();
//EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.EraseLen(startId+1, stopId - startId);
if (stopId == currentSize-1) {
stopId = -1;
}
}
EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
//EDN_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
EDN_DEBUG("HighLight (Middle) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
// update position after the range position :
int32_t elemStart;
if(-1 == startId) {
@@ -95,7 +122,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
} else {
elemStart = startId+1;
}
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
//EDN_DEBUG("move element=" << i);
m_HLDataPass1[i].beginStart += nbAdded - nbDeleted;
m_HLDataPass1[i].beginStop += nbAdded - nbDeleted;
@@ -113,23 +140,24 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
} else if(-1 == stopId) {
//EDN_DEBUG("******* Regenerate STOP");
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.Size(), m_HLDataPass1.size());
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.Size() -1].endStop, m_data.Size(), m_HLDataPass1.Size());
} else {
//EDN_DEBUG("******* Regenerate RANGE");
GenerateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
}
} else {
// Parse the new element ...
//GenerateHighLightAt(pos, nbAdded);
GenerateHighLightAt(0, m_data.Size());
}
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
Edn::String ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
}
//EDN_DEBUG("HighLight element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp.c_str() );
EDN_DEBUG("HighLight (end) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
*/
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("HL General = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
@@ -177,7 +205,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
S=-1 *************** E
*/
int32_t i;
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
if (m_HLDataPass1[i].endStop > startPos) {
break;
}
@@ -198,7 +226,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
} else {
elemStart = startId+1;
}
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
if (m_HLDataPass1[i].beginStart > endPos)
{
stopId = i;
@@ -206,13 +234,13 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
}
}
/*
if (-1 != startId && startId < (int32_t)m_HLDataPass1.size()) {
EDN_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.size()-1);
if (-1 != startId && startId < (int32_t)m_HLDataPass1.Size()) {
EDN_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.Size()-1);
} else {
EDN_DEBUG("==> BEGIN : start=???, stop=??? id=" << startId);
}
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.size()) {
EDN_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.size()-1);
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.Size()) {
EDN_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.Size()-1);
} else {
EDN_DEBUG("==> END : start=???, stop=??? id=" << stopId);
}
@@ -236,7 +264,7 @@ void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
void EdnBuf::CleanHighLight(void)
{
// Remove all element in the list...
m_HLDataPass1.clear();
m_HLDataPass1.Clear();
}
@@ -244,7 +272,7 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
{
int32_t i;
int32_t start = edn_max(0, starPos-1);
for (i=start; i<(int32_t)m_HLDataPass1.size(); i++) {
for (i=start; i<(int32_t)m_HLDataPass1.Size(); i++) {
starPos = i;
if( m_HLDataPass1[i].beginStart <= pos
&& m_HLDataPass1[i].endStop > pos)
@@ -258,6 +286,71 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
return NULL;
}
//#define COUNT_TIME plop
void EdnBuf::HightlightOneLine(displayHLData_ts & MData, int32_t HLStart, int32_t HLStop)
{
MData.posHLPass1 = 0;
MData.posHLPass2 = 0;
if (NULL == m_Highlight) {
return;
}
#ifdef COUNT_TIME
GTimeVal timeStart;
g_get_current_time(&timeStart);
#endif
int32_t startId, stopId;
// find element previous
FindMainHighLightPosition(HLStart, HLStop, startId, stopId, true);
int32_t k;
//EDN_DEBUG("List of section between : "<< startId << " & " << stopId);
int32_t endSearch = stopId+1;
if (-1 == stopId) {
endSearch = m_HLDataPass1.Size();
}
for (k=edn_max(startId, 0); k<endSearch; k++) {
// empty section :
if (0==k) {
if (HLStart < m_HLDataPass1[k].beginStart) {
//EDN_DEBUG(" ==> (empty section 1 ) k="<<k<<" start="<<HLStart<<" stop="<<m_HLDataPass1[k].beginStart );
m_Highlight->Parse2(HLStart,
m_HLDataPass1[k].beginStart,
MData.HLData,
m_data);
} // else : nothing to do ...
} else {
//EDN_DEBUG(" ==> (empty section 2 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<m_HLDataPass1[k].beginStart );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
m_HLDataPass1[k].beginStart,
MData.HLData,
m_data);
}
// under section :
//EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
}
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
if (m_HLDataPass1.Size() != 0) {
//EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
HLStop,
MData.HLData,
m_data);
} else {
//EDN_DEBUG(" ==> (empty section 4 ) k="<<k<<" start=0 stop="<<HLStop );
m_Highlight->Parse2(0,
HLStop,
MData.HLData,
m_data);
}
}
#ifdef COUNT_TIME
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("Display reAnnalyse = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
#endif
}
void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart, int32_t nbLines)
@@ -272,7 +365,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
g_get_current_time(&timeStart);
MData.idSequence = m_HLDataSequence;
HLStart = StartOfLine(HLStart);
MData.HLData.clear();
MData.HLData.Clear();
int32_t HLStop = CountForwardNLines(HLStart, nbLines);
int32_t startId, stopId;
// find element previous
@@ -282,7 +375,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//EDN_DEBUG("List of section between : "<< startId << " & " << stopId);
int32_t endSearch = stopId+1;
if (-1 == stopId) {
endSearch = m_HLDataPass1.size();
endSearch = m_HLDataPass1.Size();
}
for (k=edn_max(startId, 0); k<endSearch; k++) {
// empty section :
@@ -305,9 +398,9 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
}
if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.size()) {
if (m_HLDataPass1.size() != 0) {
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
//if( k < (int32_t)m_HLDataPass1.Size()) {
if (m_HLDataPass1.Size() != 0) {
//EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
HLStop,
@@ -326,7 +419,6 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
g_get_current_time(&timeStop);
EDN_DEBUG("Display reAnnalyse = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
}
}
@@ -334,7 +426,7 @@ colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData
{
int32_t i;
int32_t start = edn_max(0, MData.posHLPass2-1);
for (i=start; i<(int32_t)MData.HLData.size(); i++) {
for (i=start; i<(int32_t)MData.HLData.Size(); i++) {
MData.posHLPass2 = i;
if( MData.HLData[i].beginStart <= pos
&& MData.HLData[i].endStop > pos)

View File

@@ -79,8 +79,8 @@ static char * GetMessageChar(messageType_te Id)
{
switch(Id)
{
MACRO_DISPLAY_MSG(EDN_MSG__QUIT)
MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_CHANGE_CURRENT)
MACRO_DISPLAY_MSG(EDN_MSG__USER_DISPLAY_CHANGE)
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_MAIN_WINDOWS)
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_SEARCH)
@@ -90,6 +90,7 @@ static char * GetMessageChar(messageType_te Id)
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_SAVE_AS)
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_GOTO_LINE)
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_ABOUT)
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION)
MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_REMOVE)
MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_REMOVE_ALL)
@@ -132,12 +133,18 @@ static char * GetMessageChar(messageType_te Id)
MACRO_DISPLAY_MSG(EDN_MSG__REFRESH_DISPLAY)
MACRO_DISPLAY_MSG(EDN_MSG__CURRENT_SET_CHARSET)
// Ctags MESSAGE :
// Ctags MESSAGE :
MACRO_DISPLAY_MSG(EDN_MSG__OPEN_CTAGS)
MACRO_DISPLAY_MSG(EDN_MSG__RELOAD_CTAGS)
MACRO_DISPLAY_MSG(EDN_MSG__JUMP_TO_CURRENT_SELECTION)
MACRO_DISPLAY_MSG(EDN_MSG__JUMP_BACK)
// HL message :
MACRO_DISPLAY_MSG(EDN_MSG__COLOR_HAS_CHANGE)
// Color message :
MACRO_DISPLAY_MSG(EDN_MSG__RELOAD_COLOR_FILE)
default:
return (char*)"??";
}
@@ -163,6 +170,10 @@ static char * GetMessageTypeChar(messageCat_te Id)
return (char*)"C-TAGS_MANAGER";
case EDN_CAT_MENU_CONTEXT:
return (char*)"MENU CONTEXT";
case EDN_CAT_HL:
return (char*)"HIGHT-LIGHT";
case EDN_CAT_COLOR:
return (char*)"COLOR";
default:
return (char*)"??";
}
@@ -204,6 +215,14 @@ void MsgBroadcastCore::SendMessage(MsgBroadcast * pointerOnSender, messageType_t
&& MSG_TO_CONTEXT__STOP >= id )
{
catDest = EDN_CAT_MENU_CONTEXT;
} else if( MSG_TO_HL__START <= id
&& MSG_TO_HL__STOP >= id )
{
catDest = EDN_CAT_HL;
} else if( MSG_TO_COLOR__START <= id
&& MSG_TO_COLOR__STOP >= id )
{
catDest = EDN_CAT_COLOR;
}
myStructMessage.localMessageID = m_messageID++;

View File

@@ -38,9 +38,8 @@
// the ID we'll use to identify our event
typedef enum {
EDN_MSG__NONE = 0,
// Programm is Quitting... close all if needed ...
EDN_MSG__QUIT,
EDN_MSG__BUFFER_CHANGE_CURRENT, // set the new current BUFFER ...
EDN_MSG__USER_DISPLAY_CHANGE, // User change the display ==> need to reload all the display depending on color internal
// DESTINATION : GUI_MANAGER
MSG_TO_GUI_MANAGER__START,
@@ -53,6 +52,7 @@ typedef enum {
EDN_MSG__GUI_SHOW_SAVE_AS,
EDN_MSG__GUI_SHOW_GOTO_LINE,
EDN_MSG__GUI_SHOW_ABOUT,
EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION,
MSG_TO_GUI_MANAGER__STOP,
// DESTINATION : GUI
@@ -125,6 +125,16 @@ typedef enum {
MSG_TO_CONTEXT__START,
MSG_TO_CONTEXT__STOP,
// DESTINATION : highlight system ...
MSG_TO_HL__START,
EDN_MSG__COLOR_HAS_CHANGE,
MSG_TO_HL__STOP,
// DESTINATION : Color System ...
MSG_TO_COLOR__START,
EDN_MSG__RELOAD_COLOR_FILE,
MSG_TO_COLOR__STOP,
}messageType_te;
@@ -137,6 +147,8 @@ typedef enum {
EDN_CAT_GUI_MANAGER,
EDN_CAT_CTAGS,
EDN_CAT_MENU_CONTEXT,
EDN_CAT_HL,
EDN_CAT_COLOR,
}messageCat_te;
@@ -189,7 +201,7 @@ class MsgBroadcastCore: public Singleton<MsgBroadcastCore>
private:
Edn::VectorType<MsgBroadcast*> m_listMessage;
uint32_t m_messageID;
uint32_t m_messageID;
Edn::VectorType<messageElement_ts> m_listOfMessage;
};

View File

@@ -28,7 +28,6 @@
#include "tools_globals.h"
#include "Edn.h"
#define MAX_FILE_NAME (10240)
#undef __class__
#define __class__ "Edn::File"
@@ -154,7 +153,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
} else {
destFilename = newFilename;
}
//EDN_DEBUG("2 : Get file Name : " << destFilename );
EDN_DEBUG("2 : Get file Name : " << destFilename );
if ('/' != *destFilename.c_str()) {
// Get the command came from the running of the program :
char cCurrentPath[FILENAME_MAX];
@@ -167,7 +166,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
destFilename += '/';
destFilename += tmpFilename;
}
//EDN_DEBUG("3 : Get file Name : " << destFilename );
EDN_DEBUG("3 : Get file Name : " << destFilename );
// Get the real Path of the current File
ok = realpath(destFilename.c_str(), buf);
@@ -177,7 +176,7 @@ void Edn::File::SetCompleateName(Edn::String &newFilename)
// Get the FileName
Edn::String tmpFilename = destFilename.Extract(lastPos+1);
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
//EDN_DEBUG("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
EDN_DEBUG("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
ok = realpath(destFilename.c_str(), buf);
if (!ok) {
EDN_ERROR("Can not find real Path name of \"" << destFilename << "\"");
@@ -213,6 +212,10 @@ int32_t Edn::File::GetLineNumber(void)
return m_lineNumberOpen;
}
void Edn::File::SetLineNumber(int32_t newline)
{
m_lineNumberOpen = newline;
}
bool Edn::File::HasExtention(void)
{

View File

@@ -26,6 +26,8 @@
#ifndef __EDN__FILE_H__
#define __EDN__FILE_H__
#define MAX_FILE_NAME (10240)
namespace Edn
{
class File
@@ -42,6 +44,7 @@ namespace Edn
bool HasExtention(void);
Edn::String GetExtention(void);
int32_t GetLineNumber(void);
void SetLineNumber(int32_t newline);
void SetCompleateName(Edn::String &newFilename);
const Edn::File& operator= (const Edn::File &ednF );

View File

@@ -1801,13 +1801,13 @@ template<class CLASS_TYPE> class EdnRegExp {
if (true == m_notBeginWithChar) {
if (i>0) {
char tmpVal = SearchIn[i-1];
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
{
// go on the next char ...
continue;
@@ -1827,13 +1827,13 @@ template<class CLASS_TYPE> class EdnRegExp {
if (true == m_notEndWithChar) {
if (i+findLen < SearchIn.Size() ) {
char tmpVal = SearchIn[i+findLen];
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
{
// go on the next char ...
continue;
@@ -1860,6 +1860,72 @@ template<class CLASS_TYPE> class EdnRegExp {
return false;
};
bool ProcessOneElement( CLASS_TYPE &SearchIn,
int32_t startPos,
int32_t endPos,
char escapeChar=0)
{
if (false == m_isOk) {
return false;
}
int32_t buflen = SearchIn.Size();
if (endPos > buflen) {
endPos = buflen;
}
if (startPos > endPos) {
return false;
}
int32_t findLen=0;
int32_t maxlen = endPos-startPos;
if (true == m_notBeginWithChar) {
if (startPos>0) {
char tmpVal = SearchIn[startPos-1];
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
{
// go on the next char ...
return false;
}
}
}
if (true == m_exprRootNode.Parse(SearchIn, startPos, maxlen, findLen)) {
if( 0!=escapeChar
&& startPos>0)
{
if (escapeChar == (char)SearchIn[startPos-1]) {
//==> detected escape char ==> try find again ...
return false;
}
}
// Check end :
if (true == m_notEndWithChar) {
if (startPos+findLen < SearchIn.Size() ) {
char tmpVal = SearchIn[startPos+findLen];
if( ( 'a' <= tmpVal
&& 'z' >= tmpVal )
|| ( 'A' <= tmpVal
&& 'Z' >= tmpVal )
|| ( '0' <= tmpVal
&& '9' >= tmpVal )
|| ( '_' == tmpVal ) )
{
// go on the next char ...
return false;
}
}
}
m_areaFind.start = startPos;
m_areaFind.stop = startPos + findLen;
return true;
}
return false;
};
/**
* @brief

View File

@@ -471,7 +471,7 @@ void Edn::String::Remove(int32_t currentID, int32_t len)
return;
}
// TODO : check the size of the data
m_data.Erase(currentID, len);
m_data.EraseLen(currentID, len);
}
@@ -584,6 +584,8 @@ Edn::VectorType<int8_t> Edn::String::GetVector(void)
return out;
}
/**
* @brief Unitary test for the string system
*

View File

@@ -36,8 +36,6 @@
*
* @tparam[in] SIZE Size of the current element.
*
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
*
* m_data
* <------------ m_dataSize ------------>
* ----------------------------------------
@@ -476,7 +474,33 @@ template<typename MY_TYPE=int32_t> class VectorType
}
/**
* @brief Remove one element
* @brief Remove N elements
*
* @param[in] pos Position to remove the data
* @param[in] posEnd Last position number
*
* @return ---
*
*/
void Erase(int32_t pos, int32_t posEnd)
{
if (pos>m_size) {
EDN_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
if (posEnd>m_size) {
posEnd = m_size;
}
int32_t nbElement = m_size - pos;
int32_t tmpSize = m_size;
// move curent data
memmove((m_data + pos), (m_data + pos + nbElement), (tmpSize - (pos+nbElement))*sizeof(MY_TYPE) );
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief Remove N element
*
* @param[in] pos Position to remove the data
* @param[in] nbElement number of element to remove
@@ -484,10 +508,10 @@ template<typename MY_TYPE=int32_t> class VectorType
* @return ---
*
*/
void Erase(int32_t pos, int32_t nbElement)
void EraseLen(int32_t pos, int32_t nbElement)
{
if (pos>m_size) {
EDN_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
EDN_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size);
return;
}
if (pos+nbElement>m_size) {

View File

@@ -301,6 +301,7 @@ void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &b
}
}
#if 0 // Remove for the moment ...
/**
* @brief Get the number of element of the previous UTF8 char (in the curent Buffer)
*
@@ -349,7 +350,7 @@ static void Utf8_SizePreviousElement(const char * data, int32_t lenMax, uint8_t
size = 1;
}
}
#endif
/**
* @brief
@@ -421,7 +422,11 @@ static uint32_t Utf8_GetValue(UTF8Element_ts &Element)
int32_t strUtf8Len(const char *input_UTF8)
{
int32_t count = 0;
int32_t size = strlen(input_UTF8);
int32_t sizeInput = strlen(input_UTF8);
int32_t size = sizeInput;
if (size>20) {
EDN_DEBUG("check SIZE...");
}
uint8_t tmpSize;
bool baseValid;
while (size > 0) {
@@ -592,18 +597,18 @@ void ConvertInput(GdkEventKey *event, char* Utf8Out, bool &controlKey, bool &mov
# elif USE_GTK_VERSION_2_0
case GDK_KP_Tab:
# endif
// shift + TAB ... same as a tab here ...
case 0xfe20: //GDK_ISO_Left_Tab
case 65289:
key = (int32_t)'\t';
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_KP_Enter:
key = GDK_KEY_Return;
break;
# elif USE_GTK_VERSION_2_0
case GDK_KP_Enter:
key = GDK_Return;
break;
# endif
key = '\n';
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_KP_F1:
case GDK_KEY_F1:
@@ -1037,17 +1042,129 @@ void ConvertInput(GdkEventKey *event, char* Utf8Out, bool &controlKey, bool &mov
# endif
key = 0x08;
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_dead_grave:
case GDK_KEY_dead_acute:
case GDK_KEY_dead_circumflex:
case GDK_KEY_dead_tilde:
case GDK_KEY_dead_macron:
case GDK_KEY_dead_breve:
case GDK_KEY_dead_abovedot:
case GDK_KEY_dead_diaeresis:
case GDK_KEY_dead_abovering:
case GDK_KEY_dead_doubleacute:
case GDK_KEY_dead_caron:
case GDK_KEY_dead_cedilla:
case GDK_KEY_dead_ogonek:
case GDK_KEY_dead_iota:
case GDK_KEY_dead_voiced_sound:
case GDK_KEY_dead_semivoiced_sound:
case GDK_KEY_dead_belowdot:
case GDK_KEY_dead_hook:
case GDK_KEY_dead_horn:
case GDK_KEY_dead_stroke:
case GDK_KEY_dead_abovecomma:
case GDK_KEY_dead_abovereversedcomma:
case GDK_KEY_dead_doublegrave:
case GDK_KEY_dead_belowring:
case GDK_KEY_dead_belowmacron:
case GDK_KEY_dead_belowcircumflex:
case GDK_KEY_dead_belowtilde:
case GDK_KEY_dead_belowbreve:
case GDK_KEY_dead_belowdiaeresis:
case GDK_KEY_dead_invertedbreve:
case GDK_KEY_dead_belowcomma:
case GDK_KEY_dead_currency:
case GDK_KEY_dead_a:
case GDK_KEY_dead_A:
case GDK_KEY_dead_e:
case GDK_KEY_dead_E:
case GDK_KEY_dead_i:
case GDK_KEY_dead_I:
case GDK_KEY_dead_o:
case GDK_KEY_dead_O:
case GDK_KEY_dead_u:
case GDK_KEY_dead_U:
case GDK_KEY_dead_small_schwa:
case GDK_KEY_dead_capital_schwa:
# elif USE_GTK_VERSION_2_0
case GDK_dead_grave:
case GDK_dead_acute:
case GDK_dead_circumflex:
key = '^';
break;
case GDK_dead_tilde:
case GDK_dead_macron:
case GDK_dead_breve:
case GDK_dead_abovedot:
case GDK_dead_diaeresis:
case GDK_dead_abovering:
case GDK_dead_doubleacute:
case GDK_dead_caron:
case GDK_dead_cedilla:
case GDK_dead_ogonek:
case GDK_dead_iota:
case GDK_dead_voiced_sound:
case GDK_dead_semivoiced_sound:
case GDK_dead_belowdot:
case GDK_dead_hook:
case GDK_dead_horn:
case GDK_dead_stroke:
case GDK_dead_abovecomma:
case GDK_dead_abovereversedcomma:
case GDK_dead_doublegrave:
case GDK_dead_belowring:
case GDK_dead_belowmacron:
case GDK_dead_belowcircumflex:
case GDK_dead_belowtilde:
case GDK_dead_belowbreve:
case GDK_dead_belowdiaeresis:
case GDK_dead_invertedbreve:
case GDK_dead_belowcomma:
case GDK_dead_currency:
key = '?';
break;
case GDK_dead_a:
EDN_INFO("dead a");
//key = 'a';
break;
case GDK_dead_A:
case GDK_dead_e:
case GDK_dead_E:
case GDK_dead_i:
case GDK_dead_I:
case GDK_dead_o:
case GDK_dead_O:
case GDK_dead_u:
case GDK_dead_U:
case GDK_dead_small_schwa:
case GDK_dead_capital_schwa:
# endif
key = '?';
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Caps_Lock:
# elif USE_GTK_VERSION_2_0
case GDK_Caps_Lock:
# endif
controlKey = true;
break;
default:
break;
}
// Transform in unicode the input :
//EDN_INFO("key : " << key);
int32_t unichar = gdk_keyval_to_unicode(key);
//EDN_INFO("unichar : " << unichar);
if (unichar == 0) {
Utf8Out[0] = (char)key;
Utf8Out[1] = '\0';
//EDN_INFO("NON UTF8 : " << Utf8Out);
} else {
// Generate UTF8 form UniCode
convertUnicodeToUtf8(unichar, Utf8Out);
//EDN_INFO("UTF8 : " << Utf8Out);
#if 0
printf(" convertUnicodeToUtf8 : \"0x%08x\" ==> unichar=%d %s\n", key, unichar, Utf8Out);
for (int32_t uu=0; uu < strlen(Utf8Out); uu++) {

View File

@@ -26,14 +26,11 @@
#include "tools_globals.h"
#include "ColorizeManager.h"
#include "MsgBroadcast.h"
#include <string>
#undef __class__
#define __class__ "globals"
// Variables privé du namespace
static std::string curentFileName = "???";
erreurCode_te globals::init(void)
@@ -201,36 +198,3 @@ bool globals::IsSetInsert(void)
/*
* Basic GUI system :
*
*
*
*
*/
void globals::DisplaySystemString(std::vector<int32_t> &data)
{
// Display the copyed data ...
uint32_t i;
EDN_INFO("Display Data : ");
printf(" ========================================================\n");
for(i=0; i<data.size(); i++) {
# ifdef USE_GTK_VERSION_2_0
if (GDK_Return == data[i]) {
# elif USE_GTK_VERSION_3_0
if (GDK_KEY_Return == data[i]) {
# endif
printf("\n = ");
} else {
printf("%c", (char)data[i]);
}
}
printf("\n ========================================================\n");
}

View File

@@ -27,14 +27,12 @@
#define __TOOLS_GLOBALS_H__
#include "tools_debug.h"
#include <string>
#include <vector>
namespace globals
{
erreurCode_te init(void);
int32_t getNbColoneBorder(void);
int32_t getNbLineBorder(void);
erreurCode_te init(void);
int32_t getNbColoneBorder(void);
int32_t getNbLineBorder(void);
bool IsSetDisplayEndOfLine(void);
void SetDisplayEndOfLine(bool newVal);
@@ -45,25 +43,24 @@ namespace globals
bool IsSetAutoIndent(void);
void SetAutoIndent(bool newVal);
void init2(void);
void init2(void);
void SetShift(void);
void UnSetShift(void);
bool IsSetShift(void);
void SetAlt(void);
void UnSetAlt(void);
bool IsSetAlt(void);
void SetCtrl(void);
void UnSetCtrl(void);
bool IsSetCtrl(void);
void SetPomme(void);
void UnSetPomme(void);
bool IsSetPomme(void);
void SetInsert(void);
void UnSetInsert(void);
void ToggleInsert(void);
bool IsSetInsert(void);
void DisplaySystemString(std::vector<int32_t> &data);
void SetShift(void);
void UnSetShift(void);
bool IsSetShift(void);
void SetAlt(void);
void UnSetAlt(void);
bool IsSetAlt(void);
void SetCtrl(void);
void UnSetCtrl(void);
bool IsSetCtrl(void);
void SetPomme(void);
void UnSetPomme(void);
bool IsSetPomme(void);
void SetInsert(void);
void UnSetInsert(void);
void ToggleInsert(void);
bool IsSetInsert(void);
}
#endif

View File

@@ -1,140 +1,69 @@
/* pour voir les appels system*/
# For the first realease :
* Syst<73>mes :
- Affichage ligne par ligne
- Correction du bug de hl(sub patern empty)
- Verifier si le hldisplay reaserch marche avec l'id et pas l'id-1
- Gestion correct des charsets
* Gui :
- Confirmer avant de fermer
- Demander de sauver
- Controle des droits
- Hl-gui management
- Event quand un fichier ouvert a changer
- Affichage des fichiers binaires
- Ctags phase 1
- Project manager phase 1
# action a faire (ordonner) :
- HL : Parsing caracter/caract<63>re et plus section par section ...
- ctags : Back simple et multiple
- ctags : Multiple files
- sys : search complet, replace complet
- gui : ordonner les fichier ouvert par nom ...
- sys : Mise en place des colorisation de base pour le
* xml
* makefiles
* script bash
* python
* matlab
* java script
* SQL
- project : list of current files open
- gui : demander l'enregistrement avant de fermer (quand c'est n<>cessaire)
- gui : demande de cr<63>ation de nouveaux fichier ou quiter l'editeur ...
# action a faire (ordonner par r<>vision) :
* 0.2.X :
- gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre)
- gui : display partielle de la fenetre
- gui : ascenceur quand n<>cessaire
- gui : Demander la cr<63>ation de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
- Catch Shift+TAB
- Correction du bug des entr<74> bizard tel que les chapot et les guillemets
- gui : Parameters : et en autre la taille de la police ... et voir pour la r<>cup<75>rer sur le system... et ce serait cool...
- PB de copier coller sur les <20><> ...
- Charset UTF-8 et iso 8859-15 correcte
- Transformation de charset a la vol<6F>
- Charset par defaut
- D<EFBFBD>ction de charset (<28> mettre dans les todo de charset)
- Faire les deplacement de EdnXXX dans le nameSpace Edn::XXX
- pb de s<>lection quand la ligne est pleine et la premi<6D>re ligne s<>lectionn<6E>...
# Text Editor
- [1] 90% Indent group with Tabulation and shift+tabulation
- [1] 100% Basic smart indent : Recopy the start of the previous line when return (copy '\t' and ' ')
- [1] 0% Replace Tab with space when press the key
- [1] 0% Request save user when quit the software
- [1] 0% Hide/Display scroll element when not usefull
- [1] 10% Regular expression search
- [1] 80% Colorisation syntaxique
- [1] 80% Copier / coller ==> probleme sur les caract<63>res sp<73>ciaux comme <20> <20> <20> ...
- [1] 10% Search
- [1] 10% Replace
- [1] 80% Undo / Redo ajout de caract<63>res autre que " ", "\t" et "\n"
- [2] 0% Selectionner en colone
- [2] 0% Supression multiple de ligne par la commande ctrl+D
- [3] 0% Multi-file search ==> display it in a result buffer (clickable only)
- [3] 0% basic UTF8 string management ==> bad with the curent buffer
- [5] 0% Replace in all elements of the project file or a part
- [5] 0% Multiple Text Editor in the same Time
- [5] 0% Support des Macros ==> In python ??? or other ...
# Ctags :
- [1] 100% Parse (use the ctags parser)
- [1] 50% Find
- [1] 50% Jump
- [1] 10% History of move (with display)
# Buffer Viewer :
- [1] 0% Right menu
- [1] 100% Display buffer in color
- [1] 100% Display buffer Saved / not Saved
- [2] 0% Image of the type of buffer (optionnal)
# Configuration :
- [1] 0% Creer une IHM pour les configurations de base
- [1] 0% Creer une IHM pour l'edition du hightliner syntaxique (quand il marchera...)
- [1] 0% Creer une IHM pour les couleurs (voir la lier avec l'IHM pour le hightliner)
- [1] 0% saugegarde automatique de la configuration ou sur demande...
# Project manager :
- [2] 0% Faire un editeur des dossiers du projet a ouvrir ==> automatiquement ajouter dans les Ctags
- [2] 0% Base
- [2] 0% Save All
- [2] 0% TreeView
# Tree View :
- [2] 0% View
- [2] 0% Open File
- [2] 0% Jump to the curent File
- [2] 0% Hide CVS / Git / SVN elements
# Diff :
- [4] 0% generate a Diff between files
- [4] 0% same in binary
# Git :
- [4] 0% Diff with the current wersion commited (local)
- [9] 0% Git branch local display (as gitk --all) ...
- [4] 0% view git chawan history ... (git Log)
# CVS :
- [6] 0% check the version with CVS
- [6] 0% commit
- [6] 0% display the Branch
- [6] 0% Select a new repository ...
# Publication :
- [1] 0% faire une publication du logiciel sur le Web... (need a stable version)
- [2] 0% faire un package
# Repository :
- [2] 0% create my own repository (@home)
- [2] 0% manage right with Git
- [2] 0% create a website fot it (@home)
- [2] 0% reserve edn.org
# plugin : (never i think ...)
- [ ] 0% Comprendre comment faire un system avec des plugin (interne et simple)...
- [ ] 0% En c++ compiler seulement, pas d'interface pyton ou autre c'est trop moche.
# notes :
The [x] Represent the version expected of the feature
# Global TODO List:
- [1] 0% EdnString ==> a revoir pour etre plus rapide et plus compl<70>te... et suporter le << et >>
- [1] 0% Remove wxString from the current code...
- sys : Mise en place des colorisation de base pour le
* java script
* SQL
- sys : replace TAB with space when Tab is pressed
- sys : Catch F[1-12] ==> for user personal event
- BUG : Correction du bug des entr<74> bizard tel que les chapot et les guillemets
- BUG : de copier coller sur les <20><><EFBFBD> ...
- BUG : les caract<EFBFBD>re multiples type chapot ...
- BUG : italique non g<>n<EFBFBD>r<EFBFBD>
* 0.3.X :
- SEARCH : get selected text in the search windows
- SEARCH : Select the search windows when call crtl+F
- sys : personal property file in the ~/.edn ou ~/.gnome/edn
- gui : Ordonner les fichier ouvert par nom ...
- gui : parameter gui : et en autre la taille de la police ... et voir pour la r<>cup<75>rer sur le system... et ce serait cool...
- gui : Color list selection
- gui : Hightlight gui management
* 0.4.X :
- sys : Charset UTF-8 et iso 8859-15 correcte
- sys : Transformation de charset a la vol<6F>e
- sys : Charset par defaut
- Sys : D<>tection de charset (<28> mettre dans les todo de charset)
==> regarder les librairies open sources
* 0.5.X :
- prj : list of current files open
- prj : open ctags file
- sys : replace ALL
- sys : Undo / Redo ajout de caract<63>res autre que " ", "\t" et "\n"
* 0.6.X :
- sys : right management ...
- HL : Normalyse all the system of regular expression with <> chapot ...
- HL : sub parsing of the reg exp
- sys : update all language
* 0.7.X :
- sys : Select in colones
- sys : Select all the same search in the current buffer ... ( HL en vert ou jaune ...)
- sys : Multi-file search ==> display it in a result buffer (clickable only)
* 0.9.X :
- int : Redo all the doxygen ...
* 1.0.X :
- gui : open file in binary
- sys : compare binary files
- sys : compare normal files
* 1.1.X :
- gui : Display content of a folder
- gui : add a treeview display
- sys : evenement losqu'un fichier est modifier a l'exterieur...
- sys : image du type de fichier dans le buffer list view
* 1.2.X :
- PRJ : treeview des dossier a ouvrir
- PRJ : GUI de management
- PRJ : Save all in project
- SYS : Save all modify files
* 1.3.X :
- sys : version system management (git, cvs, ...)
* 1.4.X :
- SYS : Macro generation and acquisition
* 1.5.X :
- GDB : Acces interne pour un debuggeur ==> comme cgdb ... avec l'acces assembleur en plus
# note utiles :
http://majutsushi.github.com/tagbar/ ==> je devrais regarder ca pour savoir ce que je peux faire avec du ctags
CTags : Set the parsing methode : "ctags -R --fields=+n Sources/ /usr/include/gtk-3.0/"

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnColor version="0.1">
<gui> <!-- Doivent tous y <20>tre de prf<72>rence ... global system acces -->
<color name="CODE_basicBackgroung" val="#151515"/>
<color name="CODE_space" val="#333333"/>
<color name="CODE_tabulation" val="#444444"/>
<color name="CODE_basicBackgroung" val="#151515"/>
<color name="CODE_cursor" val="#eadd05"/>
<color name="CODE_lineNumber" val="#fff725"/>
<!-- Buffer list property -->
@@ -16,10 +16,9 @@
<syntax>
<color name="normal" FG="#EEEEEE"/>
<color name="SelectedText" FG="#AAAAAA" BG="#225a09"/>
<color name="SelectedNoText" BG="#124a00"/>
<color name="error" FG="#FF0000"/>
<color name="doubleQuoteText" FG="#00fF00"/>
<!-- hightline description : -->
<color name="type" FG="#56bf10" bold="yes"/>
<color name="storageKeyword" FG="#5c8fed"/>
@@ -34,6 +33,8 @@
<color name="macro" FG="#6c09c8" bold="yes"/>
<color name="SYNTAX_ERROR" FG="#000000" BG="#FF0000" bold="yes"/>
<color name="functionName" FG="#24d1e0" bold="yes"/>
<color name="TestResultOK" FG="#000000" BG="#00FF00" bold="yes"/>
<color name="TestResultERROR" FG="#000000" BG="#FF0000" bold="yes"/>
</syntax>
</EdnColor>

40
data/color_white.xml Normal file
View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnColor version="0.1">
<gui> <!-- Doivent tous y <20>tre de prf<72>rence ... global system acces -->
<color name="CODE_basicBackgroung" val="#d9d7d7"/>
<color name="CODE_space" val="#b7b6b6"/>
<color name="CODE_tabulation" val="#a7a5a5"/>
<color name="CODE_cursor" val="#2a00ff"/>
<color name="CODE_lineNumber" val="#1a00a0"/>
<!-- Buffer list property -->
<color name="LIST_backgroung1" val="#d9d7d7"/>
<color name="LIST_backgroung2" val="#b7b6b6"/>
<color name="LIST_backgroungSelected" val="#3da3f9"/>
<color name="LIST_textNormal" val="#000000"/>
<color name="LIST_textModify" val="#FF0000"/>
</gui>
<syntax>
<color name="normal" FG="#000000"/>
<color name="SelectedText" FG="#292929" BG="#009ce7"/>
<color name="error" FG="#FF0000"/>
<color name="doubleQuoteText" FG="#008e00"/>
<!-- hightline description : -->
<color name="type" FG="#376d0a" bold="yes"/>
<color name="storageKeyword" FG="#466cb4"/>
<color name="number" FG="#007b00"/>
<color name="systemFunction" FG="#acaa00"/>
<color name="commonDefine" FG="#3c850b"/>
<color name="boolean" FG="#1633a3"/>
<color name="preprocesseur" FG="#ac0000"/>
<color name="comment" FG="#b704b5" italic="yes"/>
<color name="commentDoxygen" FG="#bf3e00" bold="yes" italic="yes"/>
<color name="keyword" FG="#215eb8" bold="yes"/>
<color name="macro" FG="#571793" bold="yes"/>
<color name="SYNTAX_ERROR" FG="#000000" BG="#c20000" bold="yes"/>
<color name="functionName" FG="#09857e" bold="yes"/>
<color name="TestResultOK" FG="#000000" BG="#009c00" bold="yes"/>
<color name="TestResultERROR" FG="#000000" BG="#c20000" bold="yes"/>
</syntax>
</EdnColor>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c">
<EdnLang version="0.1" lang="Makefiles">
<ext>Makefile</ext>
<ext>*.mk</ext>
<ext>*.global</ext>

View File

@@ -39,7 +39,7 @@
</rule>
<rule name="my comment">
<color>comment</color>
<start>//</start>
<start>(//|@)</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>

48
data/lang_bash.xml Normal file
View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Bash script">
<ext>*.sh</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="first line">
<color>commentDoxygen</color>
<start>#!</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="comment line">
<color>comment</color>
<start>#</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>'</start>
<end>'</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>\@for|done|do|while|in|if|elif|then|else|fi\@</start>
</rule>
<rule name="my Variable">
<color>keyword</color>
<start>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>function (\w|_)+[ \t]*\(</start>
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c">
<EdnLang version="0.1" lang="boulou log">
<ext>*.boo</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="comment ##">
<color>SYNTAX_ERROR</color>
<start>##</start>
@@ -14,5 +12,49 @@
<start>#</start>
<end>\n</end>
</rule>
<rule name="notes ... ">
<color>preprocesseur</color>
<start>(NOTE|TODO) : </start>
<end>\n</end>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>\@'</start>
<end>'</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="pourcentage OK">
<color>TestResultOK</color>
<start>100%</start>
</rule>
<rule name="pourcentage">
<color>number</color>
<start>[0-9]*%</start>
</rule>
<rule name="R<>sultat OK">
<color>TestResultOK</color>
<start>\[( )*(OK|Ok|ok)( )*\]</start>
</rule>
<rule name="resultat en erreur">
<color>TestResultERROR</color>
<start>\[(ERREUR|Erreur|erreur)\]</start>
</rule>
<rule name="resultat vide">
<color>number</color>
<start>\[( )*\]</start>
</rule>
<rule name="notes ... ">
<color>macro</color>
<start>==&gt;</start>
</rule>
</pass2>
</EdnLang>

View File

@@ -111,7 +111,7 @@
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</start>
<start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule>
<!-- With all elementes :
<rule name="BIG LETTER">

62
data/lang_matlab.xml Normal file
View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="matlab">
<ext>*.m</ext>
<ext>*.M</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<start>%%</start>
<end>\n</end>
</rule>
<rule name="my comment">
<color>comment</color>
<start>%</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start> "</start>
<end>("|\n)</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start> '</start>
<end>('|\n)</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
<rule name="global inclusion">
<color>preprocesseur</color>
<start>global( |\t)+</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</start>
</rule>
<rule name="my boolean">
<color>boolean</color>
<start>\@true|false\@</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start>
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule>
<rule name="numeric constant">
<color>number</color>
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c">
<EdnLang version="0.1" lang="php: pretty home page">
<ext>*.php</ext>
<ext>*.php3</ext>
<ext>*.php4</ext>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur">
<EdnLang version="0.1" lang="XML">
<ext>*.xml</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Comment">
@@ -7,9 +7,28 @@
<start>&lt;!\-\-</start>
<end>\-\-&gt;</end>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>\@'</start>
<end>('|\n)</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1>
<pass2>
<rule name="special Balise">
<color>error</color>
<start>&lt;\?\w*|\?&gt;</start>
</rule>
<rule name="normale Balise">
<color>functionName</color>
<start>&lt;/\w*|&lt;\w*|/&gt;|&gt;</start>
</rule>
</pass2>
</EdnLang>

2041
tags

File diff suppressed because it is too large Load Diff

1026
test2.c

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ static gboolean expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_d
static void clicked(GtkWindow *win, GdkEventButton *event, gpointer user_data);
# if USE_GTK_VERSION_3_0
#if USE_GTK_VERSION_3_0
const GdkRGBA color = { 1.0, 1.0, 0.0, 0.0};
#endif
@@ -36,6 +36,9 @@ int main(int argc, char **argv)
gtk_widget_set_app_paintable(window, TRUE);
// Remove double-buffering ==> in the current case we can not get the previous display...
gtk_widget_set_double_buffered(window, FALSE);
# if USE_GTK_VERSION_3_0
g_signal_connect(G_OBJECT(window), "draw", G_CALLBACK(expose), NULL);
# elif USE_GTK_VERSION_2_0
@@ -60,17 +63,17 @@ int main(int argc, char **argv)
&color);
*/
#endif
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(clicked), NULL);
//gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
//gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
/* //g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(clicked), NULL);
GtkWidget* fixed_container = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(window), fixed_container);
GtkWidget* button = gtk_button_new_with_label("button1");
gtk_widget_set_size_request(button, 100, 100);
gtk_container_add(GTK_CONTAINER(fixed_container), button);
screen_changed(window, NULL, NULL);
*/
//screen_changed(window, NULL, NULL);
gtk_widget_show_all(window);
gtk_main();
@@ -114,20 +117,36 @@ static void screen_changed(GtkWidget *widget, GdkScreen *old_screen, gpointer us
static gboolean expose(GtkWidget *widget, GdkEventExpose *event, gpointer userdata)
{
return FALSE;
# if USE_GTK_VERSION_3_0
cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
# elif USE_GTK_VERSION_2_0
cairo_t *cr = gdk_cairo_create(widget->window);
# endif
if (TRUE == supports_alpha)
cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.3); /* transparent */
else
cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); /* opaque white */
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
//return FALSE;
GdkWindow * m_windows = NULL;
# if USE_GTK_VERSION_3_0
m_windows = gtk_widget_get_window(widget);
# elif USE_GTK_VERSION_2_0
m_windows = widget->window;
# endif
gtk_widget_shape_combine_mask(widget, NULL, 0, 0);
cairo_t *cr = gdk_cairo_create(m_windows);
//if (TRUE == supports_alpha) {
cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.2); // transparent
/*} else {
cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); // opaque white
}*/
/* draw the background */
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* draw a circle */
int width, height;
gtk_window_get_size(GTK_WINDOW(widget), &width, &height);
cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.6);
cairo_arc(cr, width / 2, height / 2, (width < height ? width : height) / 2 - 8 , 0, 2 * 3.14);
cairo_fill(cr);
cairo_stroke(cr);
cairo_destroy(cr);

292
test_transparence2.c Normal file
View File

@@ -0,0 +1,292 @@
/*******************************************************************************
**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
** 10 20 30 40 50 60 70 80
**
** program:
** input_shape_test
**
** created:
** 19.2.2006
**
** last change:
** 20.2.2006
**
** author:
** Mirco "MacSlow" Mueller <macslow@bangang.de>
**
** license:
** GPL
**
** notes:
** - this is a test I did to figure out how to use input-shapes (XShape 1.1)
** - opens a decoration-less and transparent gtk+-window and draws a red
** cross with a circle around it
** - only the parts drawn will be "draggable"
** - window can be dragged around with LMB-drag
** - window can be resized with MMB-drag (the input-shape also resizes!)
** - window can be exited with ESC or q
** - needs a compositing manager to run in order to look as intended
** - tested with xcompmgr and compiz
** - tested with gtk+-2.8.11 and gtk+-2.9.0 (CVS-head)
**
** bugs:
** - there are no size-checks done for the input-shape, so I don't know what
** will happen, if you make the window super large
**
** todo:
** - nothing
**
** compile with:
** gcc `pkg-config --cflags --libs gtk+-2.0` input_shape_test.c -o input_shape_test
**
*******************************************************************************/
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION(2,9,0)
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#include <gdk/gdkx.h>
#endif
#define WIN_WIDTH 300
#define WIN_HEIGHT 300
gint g_iCurrentWidth = WIN_WIDTH;
gint g_iCurrentHeight = WIN_HEIGHT;
void update_input_shape (GtkWidget* pWindow, int iWidth, int iHeight);
void on_alpha_screen_changed (GtkWidget* pWidget, GdkScreen* pOldScreen, GtkWidget* pLabel);
void render (cairo_t* pCairoContext, gint iWidth, gint iHeight);
gboolean on_expose (GtkWidget* pWidget, GdkEventExpose* pExpose);
gboolean on_key_press (GtkWidget* pWidget, GdkEventKey* pKey, gpointer userData);
gboolean on_button_press (GtkWidget* pWidget, GdkEventButton* pButton, GdkWindowEdge edge);
gboolean on_configure (GtkWidget* pWidget, GdkEventConfigure* pEvent, gpointer data);
#if !GTK_CHECK_VERSION(2,9,0)
void do_shape_combine_mask (GdkWindow* window, GdkBitmap* mask, gint x, gint y);
#endif
void update_input_shape (GtkWidget* pWindow, int iWidth, int iHeight);
void on_alpha_screen_changed (GtkWidget* pWidget,
GdkScreen* pOldScreen,
GtkWidget* pLabel)
{
GdkScreen* pScreen = gtk_widget_get_screen (pWidget);
GdkColormap* pColormap = gdk_screen_get_rgba_colormap (pScreen);
if (!pColormap)
pColormap = gdk_screen_get_rgb_colormap (pScreen);
gtk_widget_set_colormap (pWidget, pColormap);
}
void render (cairo_t* pCairoContext, gint iWidth, gint iHeight)
{
cairo_scale (pCairoContext, (double) iWidth, (double) iHeight);
cairo_set_source_rgba (pCairoContext, 1.0f, 1.0f, 1.0f, 0.0f);
cairo_set_operator (pCairoContext, CAIRO_OPERATOR_SOURCE);
cairo_paint (pCairoContext);
cairo_set_source_rgba (pCairoContext, 1.0f, 0.0f, 0.0f, 0.75f);
cairo_set_line_width (pCairoContext, 0.1f);
cairo_move_to (pCairoContext, 0.15f, 0.15f);
cairo_line_to (pCairoContext, 0.85f, 0.85f);
cairo_move_to (pCairoContext, 0.85f, 0.15f);
cairo_line_to (pCairoContext, 0.15f, 0.85f);
cairo_stroke (pCairoContext);
cairo_arc (pCairoContext, 0.5f, 0.5f, 0.45f, 0.0f, M_PI/180.0f * 360.0f);
cairo_stroke (pCairoContext);
}
gboolean on_expose (GtkWidget* pWidget,
GdkEventExpose* pExpose)
{
gint iWidth;
gint iHeight;
cairo_t* pCairoContext = NULL;
pCairoContext = gdk_cairo_create (pWidget->window);
if (!pCairoContext)
return FALSE;
gtk_window_get_size (GTK_WINDOW (pWidget), &iWidth, &iHeight);
render (pCairoContext, iWidth, iHeight);
cairo_destroy (pCairoContext);
return FALSE;
}
gboolean on_configure (GtkWidget* pWidget,
GdkEventConfigure* pEvent,
gpointer userData)
{
gint iNewWidth = pEvent->width;
gint iNewHeight = pEvent->height;
if (iNewWidth != g_iCurrentWidth || iNewHeight != g_iCurrentHeight)
{
update_input_shape (pWidget, iNewWidth, iNewHeight);
g_iCurrentWidth = iNewWidth;
g_iCurrentHeight = iNewHeight;
}
return FALSE;
}
gboolean on_key_press (GtkWidget* pWidget,
GdkEventKey* pKey,
gpointer userData)
{
gint iWidth;
gint iHeight;
if (pKey->type == GDK_KEY_PRESS)
{
switch (pKey->keyval)
{
case GDK_Escape :
case GDK_q :
gtk_main_quit ();
break;
}
}
return FALSE;
}
gboolean on_button_press (GtkWidget* pWidget,
GdkEventButton* pButton,
GdkWindowEdge edge)
{
if (pButton->type == GDK_BUTTON_PRESS)
{
if (pButton->button == 1)
gtk_window_begin_move_drag (GTK_WINDOW (gtk_widget_get_toplevel (pWidget)),
pButton->button,
pButton->x_root,
pButton->y_root,
pButton->time);
if (pButton->button == 2)
gtk_window_begin_resize_drag (GTK_WINDOW (gtk_widget_get_toplevel (pWidget)),
edge,
pButton->button,
pButton->x_root,
pButton->y_root,
pButton->time);
}
return FALSE;
}
#if !GTK_CHECK_VERSION(2,9,0)
/* this is piece by piece taken from gtk+ 2.9.0 (CVS-head with a patch applied
regarding XShape's input-masks) so people without gtk+ >= 2.9.0 can compile and
run input_shape_test.c */
void do_shape_combine_mask (GdkWindow* window,
GdkBitmap* mask,
gint x,
gint y)
{
Pixmap pixmap;
int ignore;
int maj;
int min;
if (!XShapeQueryExtension (GDK_WINDOW_XDISPLAY (window), &ignore, &ignore))
return;
if (!XShapeQueryVersion (GDK_WINDOW_XDISPLAY (window), &maj, &min))
return;
/* for shaped input we need at least XShape 1.1 */
if (maj != 1 && min < 1)
return;
if (mask)
pixmap = GDK_DRAWABLE_XID (mask);
else
{
x = 0;
y = 0;
pixmap = None;
}
XShapeCombineMask (GDK_WINDOW_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
ShapeInput,
x,
y,
pixmap,
ShapeSet);
}
#endif
void update_input_shape (GtkWidget* pWindow, int iWidth, int iHeight)
{
static GdkBitmap* pShapeBitmap = NULL;
static cairo_t* pCairoContext = NULL;
pShapeBitmap = (GdkBitmap*) gdk_pixmap_new (NULL, iWidth, iHeight, 1);
if (pShapeBitmap)
{
pCairoContext = gdk_cairo_create (pShapeBitmap);
if (cairo_status (pCairoContext) == CAIRO_STATUS_SUCCESS)
{
render (pCairoContext, iWidth, iHeight);
cairo_destroy (pCairoContext);
#if !GTK_CHECK_VERSION(2,9,0)
do_shape_combine_mask (pWindow->window, NULL, 0, 0);
do_shape_combine_mask (pWindow->window, pShapeBitmap, 0, 0);
#else
gtk_widget_input_shape_combine_mask (pWindow, NULL, 0, 0);
gtk_widget_input_shape_combine_mask (pWindow, pShapeBitmap, 0, 0);
#endif
}
g_object_unref ((gpointer) pShapeBitmap);
}
}
int main (int argc, char** argv)
{
GtkWidget* pWindow = NULL;
GdkBitmap* pShapeMaskBitmap = NULL;
gtk_init (&argc, &argv);
pWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
on_alpha_screen_changed (pWindow, NULL, NULL);
gtk_widget_set_app_paintable (pWindow, TRUE);
gtk_window_set_decorated (GTK_WINDOW (pWindow), FALSE);
gtk_window_set_resizable (GTK_WINDOW (pWindow), TRUE);
gtk_window_set_title (GTK_WINDOW (pWindow), "gtk+/XShape 1.1 test");
gtk_widget_set_size_request (pWindow, g_iCurrentWidth, g_iCurrentHeight);
gtk_widget_add_events (pWindow, GDK_BUTTON_PRESS_MASK);
gtk_widget_show (pWindow);
g_signal_connect (G_OBJECT (pWindow),
"destroy",
G_CALLBACK (gtk_main_quit),
NULL);
g_signal_connect (G_OBJECT (pWindow),
"expose-event",
G_CALLBACK (on_expose),
NULL);
g_signal_connect (G_OBJECT (pWindow),
"configure-event",
G_CALLBACK (on_configure),
NULL);
g_signal_connect (G_OBJECT (pWindow),
"key-press-event",
G_CALLBACK (on_key_press),
NULL);
g_signal_connect (G_OBJECT (pWindow),
"button-press-event",
G_CALLBACK (on_button_press),
NULL);
update_input_shape (pWindow, g_iCurrentWidth, g_iCurrentHeight);
gtk_main ();
return 0;
}