Compare commits
43 Commits
0.1.7
...
dev-testDi
Author | SHA1 | Date | |
---|---|---|---|
472b85b94b | |||
d21a3892df | |||
eff5e3ae25 | |||
85806b2638 | |||
4477ef0ab5 | |||
7cf06ba256 | |||
df4b14611e | |||
127ad0aac5 | |||
1d0bcd7087 | |||
d3efb637ab | |||
3dad4f219b | |||
74cfca4516 | |||
db85018627 | |||
9bad01fc37 | |||
89394d5770 | |||
03484cc85d | |||
7fbfe1f86a | |||
745ca76a74 | |||
2712d4f67d | |||
bdc4793955 | |||
650206f04e | |||
d21d661f15 | |||
f5f97c53de | |||
d78a67f99f | |||
0b2599fb81 | |||
83dd23b8a9 | |||
2714560c38 | |||
e48c75df72 | |||
1de1f787e7 | |||
1b3dd3ce98 | |||
0e6c34d2a0 | |||
325034bbc0 | |||
fc9b98f09e | |||
a497b028ca | |||
88b76c074d | |||
28b709bfb8 | |||
1c01dbd7cd | |||
948240f05f | |||
990828c69c | |||
72f63a8990 | |||
4d2eced7a0 | |||
6598a22981 | |||
01276b581f |
6
Makefile
6
Makefile
@@ -53,9 +53,9 @@ DEBUG:=1
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
### Compilation Define ###
|
### Compilation Define ###
|
||||||
###############################################################################
|
###############################################################################
|
||||||
ifeq ("$(DEBUG)", "0")
|
ifeq ("$(DEBUG)", "0")
|
||||||
DEFINE= -DEDN_DEBUG_LEVEL=1 -DNDEBUG -DVERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
|
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\""
|
DEFINE= -DEDN_DEBUG_LEVEL=3 -DVERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
|
||||||
endif
|
endif
|
||||||
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
|
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
|
||||||
@@ -294,9 +294,11 @@ install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
|
|||||||
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
|
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
|
||||||
|
|
||||||
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
|
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
|
||||||
|
@echo $(CADRE_HAUT_BAS)
|
||||||
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
|
||||||
@echo $(CADRE_HAUT_BAS)
|
@echo $(CADRE_HAUT_BAS)
|
||||||
@echo $(F_ROUGE)"
|
@echo $(F_ROUGE)"
|
||||||
|
(stripped) $(OUTPUT_NAME_RELEASE) => $(PROG_NAME) "$(F_NORMALE)
|
||||||
@cp $(OUTPUT_NAME_RELEASE) $(PROG_NAME)
|
@cp $(OUTPUT_NAME_RELEASE) $(PROG_NAME)
|
||||||
@strip -s $(PROG_NAME)
|
@strip -s $(PROG_NAME)
|
||||||
@echo $(F_VERT)"
|
@echo $(F_VERT)"
|
||||||
|
21
README
21
README
@@ -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
41
README.md
Normal 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
|
@@ -41,12 +41,32 @@
|
|||||||
*/
|
*/
|
||||||
Buffer::Buffer()
|
Buffer::Buffer()
|
||||||
{
|
{
|
||||||
|
static int32_t bufID = 0;
|
||||||
|
m_uniqueID = bufID++;
|
||||||
static int32_t fileBasicID = 0;
|
static int32_t fileBasicID = 0;
|
||||||
m_fileModify = true;
|
m_fileModify = true;
|
||||||
m_haveName = false;
|
m_haveName = false;
|
||||||
Edn::String mString = "Untitle - ";
|
Edn::String mString = "Untitle - ";
|
||||||
mString += fileBasicID++;
|
mString += fileBasicID++;
|
||||||
SetFileName(mString);
|
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;
|
m_fileModify = false;
|
||||||
SetFileName(newName);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,9 +179,29 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t Buffer::Display(DrawerManager &drawer)
|
void Buffer::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
|
||||||
{
|
{
|
||||||
return ERR_NONE;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param[in,out] ---
|
||||||
|
*
|
||||||
|
* @return ---
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void Buffer::DrawLineEmpty(DrawerManager &drawer, int32_t lineScreenID)
|
||||||
|
{
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +288,6 @@ void Buffer::ScrollUp(void)
|
|||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@@ -243,13 +296,6 @@ void Buffer::ScrollUp(void)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Buffer::ForceReDraw(bool allElement)
|
|
||||||
{
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Buffer::cursorMove(int32_t gtkKey)
|
void Buffer::cursorMove(int32_t gtkKey)
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
@@ -347,7 +393,7 @@ void Buffer::Paste(int8_t clipboardID)
|
|||||||
|
|
||||||
void Buffer::RemoveLine(void)
|
void Buffer::RemoveLine(void)
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::SelectAll(void)
|
void Buffer::SelectAll(void)
|
||||||
@@ -370,3 +416,220 @@ void Buffer::Redo(void)
|
|||||||
// nothing to do
|
// 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -31,15 +31,43 @@
|
|||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
#include "Edn.h"
|
#include "Edn.h"
|
||||||
|
|
||||||
|
#define MAX_LINE_DISPLAYABLE_BY_BUFFER (200)
|
||||||
|
|
||||||
typedef struct{
|
extern "C"
|
||||||
uint32_t nbTotalLine; //!< Number of line in the buffer
|
{
|
||||||
uint32_t nbTotalColomn; //!< Number of line in the buffer
|
typedef struct{
|
||||||
uint32_t startLineDisplay; //!< First line display.
|
uint32_t nbTotalLine; //!< Number of line in the buffer
|
||||||
uint32_t startColomnDisplay; //!< First Colomn displayed
|
uint32_t nbTotalColomn; //!< Number of line in the buffer
|
||||||
uint32_t diplayableColomn; //!< NB colomn that can be displayed
|
uint32_t startLineDisplay; //!< First line display.
|
||||||
uint32_t diplayableLine; //!< NB Line that can be displayed
|
uint32_t startColomnDisplay; //!< First Colomn displayed
|
||||||
}infoStatBuffer_ts;
|
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 {
|
class Buffer {
|
||||||
@@ -81,22 +109,25 @@ class Buffer {
|
|||||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||||
virtual void SetLineDisplay(uint32_t lineNumber);
|
virtual void SetLineDisplay(uint32_t lineNumber);
|
||||||
|
|
||||||
virtual int32_t Display(DrawerManager &drawer);
|
virtual void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
|
||||||
virtual void ForceReDraw(bool allElement);
|
virtual void DrawLineEmpty(DrawerManager &drawer, int32_t lineScreenID);
|
||||||
|
// return the new cursor position ...
|
||||||
virtual void AddChar(char * UTF8data);
|
virtual void AddChar(char * UTF8data);
|
||||||
virtual void cursorMove(int32_t gtkKey);
|
virtual void cursorMove(int32_t gtkKey);
|
||||||
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
|
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
|
||||||
virtual void MouseEvent(int32_t width, int32_t height);
|
virtual void MouseEvent(int32_t width, int32_t height);
|
||||||
virtual void MouseEventDouble(void);
|
virtual void MouseEventDouble(void);
|
||||||
virtual void MouseEventTriple(void);
|
virtual void MouseEventTriple(void);
|
||||||
virtual void ScrollDown(void);
|
|
||||||
virtual void ScrollUp(void);
|
|
||||||
virtual void RemoveLine(void);
|
virtual void RemoveLine(void);
|
||||||
virtual void SelectAll(void);
|
virtual void SelectAll(void);
|
||||||
virtual void SelectNone(void);
|
virtual void SelectNone(void);
|
||||||
virtual void Undo(void);
|
virtual void Undo(void);
|
||||||
virtual void Redo(void);
|
virtual void Redo(void);
|
||||||
|
|
||||||
virtual void SetCharset(charset_te newCharset) {};
|
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 SelectAll(void);
|
||||||
virtual void Copy(int8_t clipboardID);
|
virtual void Copy(int8_t clipboardID);
|
||||||
@@ -113,6 +144,28 @@ class Buffer {
|
|||||||
// naming
|
// naming
|
||||||
Edn::File m_fileName; //!< filename of the curent buffer
|
Edn::File m_fileName; //!< filename of the curent buffer
|
||||||
bool m_haveName; //!< to know if the file have a name or NOT
|
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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -42,7 +42,8 @@
|
|||||||
*/
|
*/
|
||||||
BufferEmpty::BufferEmpty()
|
BufferEmpty::BufferEmpty()
|
||||||
{
|
{
|
||||||
|
m_lineWidth = Display::GetFontWidth();
|
||||||
|
m_lineHeight = Display::GetFontHeight()*4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,32 +68,58 @@ BufferEmpty::~BufferEmpty(void)
|
|||||||
* @return ---
|
* @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();
|
ColorizeManager * myColorManager = ColorizeManager::getInstance();
|
||||||
// Get color :
|
// Get color :
|
||||||
Colorize *myColor = NULL;
|
Colorize *myColor = NULL;
|
||||||
// Clean Buffer
|
if (anchor.m_lineNumber == 0) {
|
||||||
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG) );
|
// Clean Buffer
|
||||||
|
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG) );
|
||||||
myColor = myColorManager->Get("normal");
|
myColor = myColorManager->Get("normal");
|
||||||
// Draw the 2 comments Lines :
|
drawer.Text(myColor, 20,20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique");
|
||||||
drawer.Text(myColor, 20,20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique");
|
}
|
||||||
//drawer.Flush();
|
if (anchor.m_lineNumber == 1) {
|
||||||
myColor = myColorManager->Get("commentDoxygen");
|
myColor = myColorManager->Get("commentDoxygen");
|
||||||
drawer.Text(myColor, 20,25 + Display::GetFontHeight(), "No Buffer Availlable to display");
|
drawer.Text(myColor, 20,25 + Display::GetFontHeight(), "No Buffer Availlable to display");
|
||||||
drawer.Flush();
|
}
|
||||||
/*
|
return;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -32,8 +32,10 @@ class BufferEmpty : public Buffer {
|
|||||||
public:
|
public:
|
||||||
BufferEmpty(void);
|
BufferEmpty(void);
|
||||||
virtual ~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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
|
|||||||
int32_t Open(Edn::File &myFile);
|
int32_t Open(Edn::File &myFile);
|
||||||
int32_t GetSelected(void) { return m_idSelected;};
|
int32_t GetSelected(void) { return m_idSelected;};
|
||||||
void SetSelected(int32_t id) {m_idSelected = id;};
|
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(int32_t BufferID);
|
||||||
bool Exist(Edn::File &myFile);
|
bool Exist(Edn::File &myFile);
|
||||||
int32_t GetId(Edn::File &myFile);
|
int32_t GetId(Edn::File &myFile);
|
||||||
|
@@ -37,8 +37,10 @@
|
|||||||
|
|
||||||
const uint32_t nbLineAllocatedInBase = 300;
|
const uint32_t nbLineAllocatedInBase = 300;
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
const char * g_pointerForTheDisplayLine[] = {"%1d", "%2d","%3d","%4d","%5d","%6d","%7d","%8d","%9d","%d"};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@@ -50,27 +52,19 @@ const uint32_t nbLineAllocatedInBase = 300;
|
|||||||
*/
|
*/
|
||||||
void BufferText::BasicInit(void)
|
void BufferText::BasicInit(void)
|
||||||
{
|
{
|
||||||
NeedToCleanEndPage = true;
|
|
||||||
// set the first element that is displayed
|
|
||||||
m_displayStartBufferPos = 0;
|
|
||||||
|
|
||||||
// set the number of the lineNumber;
|
// set the number of the lineNumber;
|
||||||
nbColoneForLineNumber = 1;
|
m_nbColoneForLineNumber = 1;
|
||||||
// init the link with the buffer manager
|
// init the link with the buffer manager
|
||||||
myColorManager = ColorizeManager::getInstance();
|
myColorManager = ColorizeManager::getInstance();
|
||||||
// Init Selection mode :
|
|
||||||
SelectionEnd();
|
|
||||||
//EDN_INFO("Init");
|
//EDN_INFO("Init");
|
||||||
// new mode :
|
// new mode :
|
||||||
m_cursorPos = 0;
|
m_cursorPos = 0;
|
||||||
|
m_cursorPosPrevious = m_cursorPos;
|
||||||
m_cursorPreferredCol = -1;
|
m_cursorPreferredCol = -1;
|
||||||
m_cursorOn = true;
|
m_cursorOn = true;
|
||||||
//m_cursorMode = CURSOR_DISPLAY_MODE_NORMAL;
|
// set at the sustem buffer internal
|
||||||
m_displayStart.x = 0;
|
m_lineWidth = Display::GetFontWidth();
|
||||||
m_displayStart.y = 0;
|
m_lineHeight = Display::GetFontHeight();
|
||||||
m_displaySize.x = 200;
|
|
||||||
m_displaySize.y = 20;
|
|
||||||
m_displayLocalSyntax.idSequence = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -93,7 +87,6 @@ void BufferText::NameChange(void)
|
|||||||
m_EdnBuf.SetHLSystem(myHL);
|
m_EdnBuf.SetHLSystem(myHL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,7 +134,6 @@ BufferText::BufferText(Edn::File &fileName) : Buffer(fileName)
|
|||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
ForceReDraw(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -181,28 +173,6 @@ BufferText::~BufferText(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferText::SelectionStart(void)
|
|
||||||
{
|
|
||||||
// start a nex selection
|
|
||||||
SelectionCheckMode();
|
|
||||||
//EDN_DEBUG("SELECT_start");
|
|
||||||
}
|
|
||||||
|
|
||||||
void BufferText::SelectionEnd(void)
|
|
||||||
{
|
|
||||||
//EDN_DEBUG("SELECT_stop");
|
|
||||||
}
|
|
||||||
|
|
||||||
void BufferText::SelectionCheckMode(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (true == globals::IsSetCtrl() ) {
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@@ -213,7 +183,7 @@ void BufferText::SelectionCheckMode(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
|
void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
|
||||||
{
|
{
|
||||||
|
EDN_WARNING("TODO ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,218 +196,185 @@ void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
|
|||||||
*/
|
*/
|
||||||
void BufferText::SetLineDisplay(uint32_t lineNumber)
|
void BufferText::SetLineDisplay(uint32_t lineNumber)
|
||||||
{
|
{
|
||||||
|
EDN_WARNING("TODO ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t lineNumber, int32_t positionY)
|
|
||||||
|
|
||||||
|
|
||||||
|
void BufferText::DrawLineNumber(DrawerManager &drawer, int32_t lineNumber, int32_t positionY)
|
||||||
{
|
{
|
||||||
|
int32_t letterHeight = Display::GetFontHeight();
|
||||||
char tmpLineNumber[50];
|
char tmpLineNumber[50];
|
||||||
sprintf(tmpLineNumber, myPrint, lineNumber);
|
sprintf(tmpLineNumber, g_pointerForTheDisplayLine[m_nbColoneForLineNumber-1], lineNumber);
|
||||||
drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber);
|
drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display the curent buffer with all the probematic imposed by the xharset and the user contraint.
|
* @brief Update internal data of the pointer to display
|
||||||
*
|
*
|
||||||
* @param[in,out] drawer the basic user drawer of EDN.
|
* @param[in,out] ---
|
||||||
*
|
*
|
||||||
* @return
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t BufferText::Display(DrawerManager &drawer)
|
void BufferText::UpdatePointerNumber(void)
|
||||||
{
|
{
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
|
||||||
// update the number of element that can be displayed
|
|
||||||
m_displaySize.x = (drawer.GetWidth()/letterWidth) + 1 - nbColoneForLineNumber;;
|
|
||||||
m_displaySize.y = (drawer.GetHeight()/letterHeight) + 1;
|
|
||||||
EDN_INFO("main DIPLAY " << m_displaySize.x << " char * " << m_displaySize.y << " char");
|
|
||||||
|
|
||||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
|
||||||
bool selIsRect;
|
|
||||||
int32_t selHave = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, selStart, selEnd, selIsRect, selRectStart, selRectEnd);
|
|
||||||
|
|
||||||
colorInformation_ts * HLColor = NULL;
|
|
||||||
|
|
||||||
//displayLineNumber(drawer);
|
|
||||||
// get the number of line in the buffer
|
// get the number of line in the buffer
|
||||||
int32_t maxNumberLine = m_EdnBuf.NumberOfLines();
|
int32_t maxNumberLine = m_EdnBuf.NumberOfLines();
|
||||||
//int32_t maxNumberLine = 2096;
|
//int32_t maxNumberLine = 2096;
|
||||||
char *myPrint = NULL;
|
if (10 > maxNumberLine) { m_nbColoneForLineNumber = 1;
|
||||||
if (10 > maxNumberLine) { nbColoneForLineNumber = 1; myPrint = (char *)"%1d";
|
} else if (100 > maxNumberLine) { m_nbColoneForLineNumber = 2;
|
||||||
} else if (100 > maxNumberLine) { nbColoneForLineNumber = 2; myPrint = (char *)"%2d";
|
} else if (1000 > maxNumberLine) { m_nbColoneForLineNumber = 3;
|
||||||
} else if (1000 > maxNumberLine) { nbColoneForLineNumber = 3; myPrint = (char *)"%3d";
|
} else if (10000 > maxNumberLine) { m_nbColoneForLineNumber = 4;
|
||||||
} else if (10000 > maxNumberLine) { nbColoneForLineNumber = 4; myPrint = (char *)"%4d";
|
} else if (100000 > maxNumberLine) { m_nbColoneForLineNumber = 5;
|
||||||
} else if (100000 > maxNumberLine) { nbColoneForLineNumber = 5; myPrint = (char *)"%5d";
|
} else if (1000000 > maxNumberLine) { m_nbColoneForLineNumber = 6;
|
||||||
} else if (1000000 > maxNumberLine) { nbColoneForLineNumber = 6; myPrint = (char *)"%6d";
|
} else if (1000000 > maxNumberLine) { m_nbColoneForLineNumber = 7;
|
||||||
} else if (1000000 > maxNumberLine) { nbColoneForLineNumber = 7; myPrint = (char *)"%7d";
|
} else if (10000000 > maxNumberLine) { m_nbColoneForLineNumber = 8;
|
||||||
} else if (10000000 > maxNumberLine) { nbColoneForLineNumber = 8; myPrint = (char *)"%8d";
|
} else if (100000000 > maxNumberLine) { m_nbColoneForLineNumber = 9;
|
||||||
} else if (100000000 > maxNumberLine) { nbColoneForLineNumber = 9; myPrint = (char *)"%9d";
|
} else { m_nbColoneForLineNumber = 10;
|
||||||
} else { nbColoneForLineNumber = 10; myPrint = (char *)"%d";
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BufferText::DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32_t letterHeight = Display::GetFontHeight();
|
||||||
|
int32_t letterWidth = Display::GetFontWidth();
|
||||||
|
int32_t positionY = letterHeight * (anchor.m_lineNumber - anchor.m_displayStart.y - 1);
|
||||||
|
|
||||||
|
int32_t idX = 0;
|
||||||
|
int32_t pixelX = m_nbColoneForLineNumber*letterWidth + 3;
|
||||||
|
|
||||||
|
Colorize * myColorNormal = myColorManager->Get("normal");
|
||||||
|
Colorize * myColorSelected = myColorManager->Get("SelectedText");
|
||||||
|
Colorize * selectColor = NULL;
|
||||||
|
colorInformation_ts * HLColor = NULL;
|
||||||
|
|
||||||
uint32_t y = 0;
|
// Regenerate the colorizing if necessary ...
|
||||||
int32_t iii, new_i;
|
displayHLData_ts myDisplayLocalSyntax;
|
||||||
// Get color :
|
m_EdnBuf.HightlightOneLine(myDisplayLocalSyntax, anchor.m_posStart, anchor.m_posStop);
|
||||||
Colorize * myColor = myColorManager->Get("normal");
|
|
||||||
Colorize * myColorSel = myColorManager->Get("SelectedText");
|
// clean the current Line
|
||||||
color_ts & myColorSpace = myColorManager->Get(COLOR_CODE_SPACE);
|
drawer.Rectangle(myColorManager->Get(COLOR_CODE_BASIC_BG), 0, positionY, drawer.GetWidth(), letterHeight);
|
||||||
color_ts & myColorTab = myColorManager->Get(COLOR_CODE_TAB);
|
|
||||||
Colorize * selectColor = NULL;
|
DrawLineNumber(drawer, anchor.m_lineNumber, positionY);
|
||||||
|
|
||||||
|
bool selHave = anchor.m_selectionPosStart == -1 ? false : true;
|
||||||
char displayChar[MAX_EXP_CHAR_LEN];
|
char displayChar[MAX_EXP_CHAR_LEN];
|
||||||
memset(displayChar, 0, sizeof(char)*MAX_EXP_CHAR_LEN);
|
memset(displayChar, 0, sizeof(char)*MAX_EXP_CHAR_LEN);
|
||||||
|
int32_t iii;
|
||||||
|
for (iii=anchor.m_posStart; iii<anchor.m_posStop; ) {
|
||||||
int mylen = m_EdnBuf.Size();
|
uint32_t currentChar;
|
||||||
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
|
int32_t savePositionForCursor = iii;
|
||||||
uint32_t xx = 0;
|
int32_t displaywidth = m_EdnBuf.GetExpandedChar(iii, idX, displayChar, currentChar);
|
||||||
int32_t idX = 0;
|
selectColor = myColorNormal;
|
||||||
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG));
|
//kwow size to display
|
||||||
int displayLines = 0;
|
int32_t widthToDisplay;
|
||||||
// Regenerate the colorizing if necessary ...
|
char * tmpDisplayOfset;
|
||||||
m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y);
|
bool inTheScreen = true;
|
||||||
GTimeVal timeStart;
|
if (anchor.m_displayStart.x <= idX) {
|
||||||
g_get_current_time(&timeStart);
|
// Normal display
|
||||||
|
tmpDisplayOfset = displayChar;
|
||||||
// draw the lineNumber :
|
widthToDisplay = displaywidth;
|
||||||
int32_t currentLineID = m_displayStart.y+1;
|
} else if (anchor.m_displayStart.x < idX + displaywidth) {
|
||||||
DrawLineNumber(drawer, myPrint, currentLineID, y);
|
// special case of partial display :
|
||||||
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
widthToDisplay = idX + displaywidth - anchor.m_displayStart.x;
|
||||||
//EDN_INFO("diplay element=" << iii);
|
tmpDisplayOfset = displayChar + (displaywidth-widthToDisplay);
|
||||||
int32_t pixelX = xx*letterWidth + x_base;
|
} else {
|
||||||
int displaywidth;
|
// Out of range ...
|
||||||
uint32_t currentChar = '\0';
|
widthToDisplay = displaywidth;
|
||||||
new_i = iii;
|
tmpDisplayOfset = displayChar;
|
||||||
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
inTheScreen = false;
|
||||||
//EDN_INFO("diplay element=" << new_i);
|
}
|
||||||
if (currentChar!='\n') {
|
if (true==inTheScreen) {
|
||||||
selectColor = myColor;
|
HLColor = m_EdnBuf.GetElementColorAtPosition(myDisplayLocalSyntax, savePositionForCursor);
|
||||||
//kwow size to display
|
if (NULL != HLColor) {
|
||||||
int32_t widthToDisplay;
|
if (NULL != HLColor->patern) {
|
||||||
char * tmpDisplayOfset;
|
selectColor = HLColor->patern->GetColor();
|
||||||
bool inTheScreen = true;
|
|
||||||
if (m_displayStart.x <= idX) {
|
|
||||||
// Normal display
|
|
||||||
tmpDisplayOfset = displayChar;
|
|
||||||
widthToDisplay = displaywidth;
|
|
||||||
} else if (m_displayStart.x < idX + displaywidth) {
|
|
||||||
// special case of partial display :
|
|
||||||
widthToDisplay = idX + displaywidth - m_displayStart.x;
|
|
||||||
tmpDisplayOfset = displayChar + (displaywidth-widthToDisplay);
|
|
||||||
} else {
|
|
||||||
// Out of range ...
|
|
||||||
widthToDisplay = displaywidth;
|
|
||||||
tmpDisplayOfset = displayChar;
|
|
||||||
inTheScreen = false;
|
|
||||||
}
|
|
||||||
if (true==inTheScreen) {
|
|
||||||
HLColor = m_EdnBuf.GetElementColorAtPosition(m_displayLocalSyntax, iii);
|
|
||||||
if (NULL != HLColor) {
|
|
||||||
if (NULL != HLColor->patern) {
|
|
||||||
selectColor = HLColor->patern->GetColor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If user want to display space char : overwrite curent color
|
// If user want to display space char : overwrite curent color
|
||||||
if( ' ' == currentChar
|
if( ' ' == currentChar
|
||||||
&& true == globals::IsSetDisplaySpaceChar() )
|
&& true == globals::IsSetDisplaySpaceChar() )
|
||||||
|
{
|
||||||
|
//selectColor = myColorSelected;
|
||||||
|
//SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32_t nbChar)
|
||||||
|
if( true == selHave
|
||||||
|
&& anchor.m_selectionPosStart <= iii
|
||||||
|
&& anchor.m_selectionPosStop > iii)
|
||||||
{
|
{
|
||||||
//selectColor = myColorSel;
|
drawer.SpaceText(myColorSelected->GetBG(), pixelX ,positionY , 1);
|
||||||
//SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32_t nbChar)
|
} else if (true == selectColor->HaveBg()) {
|
||||||
|
drawer.SpaceText(selectColor->GetBG(), pixelX ,positionY , 1);
|
||||||
if( true == selHave
|
|
||||||
&& selStart <= iii
|
|
||||||
&& selEnd > iii)
|
|
||||||
{
|
|
||||||
drawer.SpaceText(myColorSel->GetBG(), pixelX ,y , 1);
|
|
||||||
} else if (true == selectColor->HaveBg()) {
|
|
||||||
drawer.SpaceText(selectColor->GetBG(), pixelX ,y , 1);
|
|
||||||
} else {
|
|
||||||
drawer.SpaceText(myColorSpace, pixelX ,y , 1);
|
|
||||||
}
|
|
||||||
} else if( '\t' == currentChar
|
|
||||||
&& true == globals::IsSetDisplaySpaceChar() )
|
|
||||||
{
|
|
||||||
if( true == selHave
|
|
||||||
&& selStart <= iii
|
|
||||||
&& selEnd > iii)
|
|
||||||
{
|
|
||||||
drawer.SpaceText(myColorSel->GetBG(), pixelX ,y , strlen(tmpDisplayOfset));
|
|
||||||
} else if (true == selectColor->HaveBg()) {
|
|
||||||
drawer.SpaceText(selectColor->GetBG(), pixelX ,y , strlen(tmpDisplayOfset));
|
|
||||||
} else {
|
|
||||||
drawer.SpaceText(myColorTab, pixelX ,y , strlen(tmpDisplayOfset));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if( true == selHave
|
drawer.SpaceText(myColorManager->Get(COLOR_CODE_SPACE), pixelX ,positionY , 1);
|
||||||
&& selStart <= iii
|
}
|
||||||
&& selEnd > iii)
|
} else if( '\t' == currentChar
|
||||||
{
|
&& true == globals::IsSetDisplaySpaceChar() )
|
||||||
selectColor = myColorSel;
|
{
|
||||||
}
|
if( true == selHave
|
||||||
if (currentChar <= 0x7F) {
|
&& anchor.m_selectionPosStart <= iii
|
||||||
drawer.Text(selectColor, pixelX ,y, tmpDisplayOfset);
|
&& anchor.m_selectionPosStop > iii)
|
||||||
} else {
|
{
|
||||||
drawer.Text(selectColor, pixelX ,y, displayChar);
|
drawer.SpaceText(myColorSelected->GetBG(), pixelX ,positionY , strlen(tmpDisplayOfset));
|
||||||
}
|
} else if (true == selectColor->HaveBg()) {
|
||||||
|
drawer.SpaceText(selectColor->GetBG(), pixelX ,positionY , strlen(tmpDisplayOfset));
|
||||||
|
} else {
|
||||||
|
drawer.SpaceText(myColorManager->Get(COLOR_CODE_TAB), pixelX ,positionY , strlen(tmpDisplayOfset));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if( true == selHave
|
||||||
|
&& anchor.m_selectionPosStart <= iii
|
||||||
|
&& anchor.m_selectionPosStop > iii)
|
||||||
|
{
|
||||||
|
selectColor = myColorSelected;
|
||||||
|
}
|
||||||
|
if (currentChar <= 0x7F) {
|
||||||
|
drawer.Text(selectColor, pixelX ,positionY, tmpDisplayOfset);
|
||||||
|
} else {
|
||||||
|
drawer.Text(selectColor, pixelX ,positionY, displayChar);
|
||||||
}
|
}
|
||||||
xx+=widthToDisplay;
|
|
||||||
}
|
}
|
||||||
idX += displaywidth;
|
|
||||||
}
|
}
|
||||||
// display cursor :
|
// display cursor :
|
||||||
if (m_cursorPos == iii) {
|
if (m_cursorPos == savePositionForCursor) {
|
||||||
// display the cursor:
|
// display the cursor:
|
||||||
if (true == m_cursorOn) {
|
if (true == m_cursorOn) {
|
||||||
drawer.Cursor(pixelX, y+letterHeight);
|
drawer.Cursor(pixelX, positionY+letterHeight);
|
||||||
//m_cursorOn = false;
|
//m_cursorOn = false;
|
||||||
} else {
|
} else {
|
||||||
m_cursorOn = true;
|
m_cursorOn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// move to next line ...
|
if (true==inTheScreen) {
|
||||||
if (currentChar=='\n') {
|
pixelX += widthToDisplay*letterWidth;
|
||||||
drawer.EndOfLine(pixelX, y+letterHeight);
|
|
||||||
drawer.Flush();
|
|
||||||
xx = 0;
|
|
||||||
idX =0;
|
|
||||||
y += letterHeight;
|
|
||||||
displayLines++;
|
|
||||||
currentLineID++;
|
|
||||||
DrawLineNumber(drawer, myPrint, currentLineID, y);
|
|
||||||
}
|
}
|
||||||
|
idX += displaywidth;
|
||||||
}
|
}
|
||||||
// special case : the cursor is at the end of the buffer...
|
// special case : the cursor is at the end of the buffer...
|
||||||
if (m_cursorPos == iii) {
|
if (m_cursorPos == iii) {
|
||||||
// display the cursor:
|
// display the cursor:
|
||||||
if (true == m_cursorOn) {
|
if (true == m_cursorOn) {
|
||||||
drawer.Cursor(xx*letterWidth + x_base, y+letterHeight);
|
drawer.Cursor(pixelX, positionY+letterHeight);
|
||||||
m_cursorOn = false;
|
//m_cursorOn = false;
|
||||||
} else {
|
} else {
|
||||||
m_cursorOn = true;
|
m_cursorOn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawer.Flush();
|
|
||||||
|
|
||||||
GTimeVal timeStop;
|
|
||||||
g_get_current_time(&timeStop);
|
|
||||||
EDN_DEBUG("Display Generation = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
|
|
||||||
|
|
||||||
return ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y)
|
void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y)
|
||||||
{
|
{
|
||||||
x = (width - 3) / Display::GetFontWidth() - nbColoneForLineNumber;
|
x = (width - 3) / Display::GetFontWidth() - m_nbColoneForLineNumber;
|
||||||
y = height / Display::GetFontHeight();
|
y = height / Display::GetFontHeight();
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
x += m_displayStart.x;
|
x += m_AnchorList[AnchorCurrentId()].m_displayStart.x;
|
||||||
y += m_displayStart.y;
|
y += m_AnchorList[AnchorCurrentId()].m_displayStart.y;
|
||||||
//EDN_DEBUG("BufferText::GetMousePosition(" << width << "," << height << "); ==> (" << x << "," << y << ")" );
|
//EDN_DEBUG("BufferText::GetMousePosition(" << width << "," << height << "); ==> (" << x << "," << y << ")" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,8 +408,11 @@ void BufferText::MouseEvent(int32_t width, int32_t height)
|
|||||||
m_cursorPreferredCol = posX;
|
m_cursorPreferredCol = posX;
|
||||||
}
|
}
|
||||||
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
||||||
|
/*
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
|
*/
|
||||||
|
|
||||||
ForceReDraw(true);
|
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -522,7 +462,6 @@ void BufferText::MouseSelectFromCursorTo(int32_t width, int32_t height)
|
|||||||
m_EdnBuf.Select(SELECTION_PRIMARY, selStart, m_cursorPos);
|
m_EdnBuf.Select(SELECTION_PRIMARY, selStart, m_cursorPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ForceReDraw(true);
|
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,8 +480,8 @@ void BufferText::MouseEventDouble(void)
|
|||||||
int32_t beginPos, endPos;
|
int32_t beginPos, endPos;
|
||||||
if (true == m_EdnBuf.SelectAround(m_cursorPos, beginPos, endPos)) {
|
if (true == m_EdnBuf.SelectAround(m_cursorPos, beginPos, endPos)) {
|
||||||
m_EdnBuf.Select(SELECTION_PRIMARY, beginPos, endPos);
|
m_EdnBuf.Select(SELECTION_PRIMARY, beginPos, endPos);
|
||||||
|
m_cursorPosPrevious = m_cursorPos;
|
||||||
m_cursorPos = endPos;
|
m_cursorPos = endPos;
|
||||||
ForceReDraw(true);
|
|
||||||
}
|
}
|
||||||
// no else
|
// no else
|
||||||
}
|
}
|
||||||
@@ -558,8 +497,8 @@ void BufferText::MouseEventDouble(void)
|
|||||||
void BufferText::MouseEventTriple(void)
|
void BufferText::MouseEventTriple(void)
|
||||||
{
|
{
|
||||||
m_EdnBuf.Select(SELECTION_PRIMARY, m_EdnBuf.StartOfLine(m_cursorPos), m_EdnBuf.EndOfLine(m_cursorPos));
|
m_EdnBuf.Select(SELECTION_PRIMARY, m_EdnBuf.StartOfLine(m_cursorPos), m_EdnBuf.EndOfLine(m_cursorPos));
|
||||||
|
m_cursorPosPrevious = m_cursorPos;
|
||||||
m_cursorPos = m_EdnBuf.EndOfLine(m_cursorPos);
|
m_cursorPos = m_EdnBuf.EndOfLine(m_cursorPos);
|
||||||
ForceReDraw(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::RemoveLine(void)
|
void BufferText::RemoveLine(void)
|
||||||
@@ -567,23 +506,29 @@ void BufferText::RemoveLine(void)
|
|||||||
int32_t start = m_EdnBuf.StartOfLine(m_cursorPos);
|
int32_t start = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||||
int32_t stop = m_EdnBuf.EndOfLine(m_cursorPos);
|
int32_t stop = m_EdnBuf.EndOfLine(m_cursorPos);
|
||||||
m_EdnBuf.Remove(start, stop+1);
|
m_EdnBuf.Remove(start, stop+1);
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
SetInsertPosition(start);
|
SetInsertPosition(start);
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::SelectAll(void)
|
void BufferText::SelectAll(void)
|
||||||
{
|
{
|
||||||
m_EdnBuf.Select(SELECTION_PRIMARY, 0, m_EdnBuf.Size());
|
m_EdnBuf.Select(SELECTION_PRIMARY, 0, m_EdnBuf.Size());
|
||||||
|
m_cursorPosPrevious = m_cursorPos;
|
||||||
m_cursorPos = m_EdnBuf.Size();
|
m_cursorPos = m_EdnBuf.Size();
|
||||||
ForceReDraw(true);
|
AnchorForceRedrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::SelectNone(void)
|
void BufferText::SelectNone(void)
|
||||||
{
|
{
|
||||||
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
||||||
ForceReDraw(true);
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SCROLL_NB_LINE (3)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@@ -594,7 +539,7 @@ void BufferText::SelectNone(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::ScrollDown(void)
|
void BufferText::ScrollDown(void)
|
||||||
{
|
{
|
||||||
MoveUpDown(3);
|
MoveUpDown(SCROLL_NB_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -608,7 +553,7 @@ void BufferText::ScrollDown(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::ScrollUp(void)
|
void BufferText::ScrollUp(void)
|
||||||
{
|
{
|
||||||
MoveUpDown(-3);
|
MoveUpDown(-1 * SCROLL_NB_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -622,44 +567,35 @@ void BufferText::ScrollUp(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::MoveUpDown(int32_t ofset)
|
void BufferText::MoveUpDown(int32_t ofset)
|
||||||
{
|
{
|
||||||
m_displayLocalSyntax.idSequence = -1;
|
int32_t iii=AnchorCurrentId();
|
||||||
if (ofset >= 0) {
|
if (ofset >= 0) {
|
||||||
int32_t nbLine = m_EdnBuf.NumberOfLines();
|
int32_t nbLine = m_EdnBuf.NumberOfLines();
|
||||||
if (m_displayStart.y+ofset+3 > nbLine) {
|
if (m_AnchorList[iii].m_displayStart.y+ofset+3 > nbLine) {
|
||||||
m_displayStart.y = nbLine-3;
|
m_AnchorList[iii].m_displayStart.y = nbLine-3;
|
||||||
|
AnchorForceRedrawOffsef(m_AnchorList[iii].m_displayStart.y-(nbLine-3));
|
||||||
} else {
|
} else {
|
||||||
m_displayStart.y += ofset;
|
AnchorForceRedrawOffsef(ofset);
|
||||||
|
m_AnchorList[iii].m_displayStart.y += ofset;
|
||||||
}
|
}
|
||||||
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y);
|
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
||||||
|
m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y;
|
||||||
} else {
|
} else {
|
||||||
ofset *= -1;
|
ofset *= -1;
|
||||||
if (m_displayStart.y < ofset) {
|
if (m_AnchorList[iii].m_displayStart.y < ofset) {
|
||||||
m_displayStart.y = 0;
|
AnchorForceRedrawOffsef(-1 * m_AnchorList[iii].m_displayStart.y);
|
||||||
m_displayStartBufferPos = 0;
|
m_AnchorList[iii].m_displayStart.y = 0;
|
||||||
|
m_AnchorList[iii].m_bufferPos = 0;
|
||||||
|
m_AnchorList[iii].m_lineId = 0;
|
||||||
} else {
|
} else {
|
||||||
m_displayStart.y -= ofset;
|
AnchorForceRedrawOffsef(-1 * ofset);
|
||||||
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y);
|
m_AnchorList[iii].m_displayStart.y -= ofset;
|
||||||
|
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
||||||
|
m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void BufferText::ForceReDraw(bool allElement)
|
|
||||||
{
|
|
||||||
NeedToCleanEndPage = true;
|
|
||||||
//m_displayLocalSyntax.idSequence = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
|
void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
|
||||||
{
|
{
|
||||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||||
@@ -668,7 +604,6 @@ void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
|
|||||||
int32_t rememberCursorPos = m_cursorPos;
|
int32_t rememberCursorPos = m_cursorPos;
|
||||||
|
|
||||||
//EDN_DEBUG("newPos=" << newPos);
|
//EDN_DEBUG("newPos=" << newPos);
|
||||||
|
|
||||||
// unselect buffer:
|
// unselect buffer:
|
||||||
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
||||||
/* make sure new position is ok, do nothing if it hasn't changed */
|
/* make sure new position is ok, do nothing if it hasn't changed */
|
||||||
@@ -679,6 +614,7 @@ void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
|
|||||||
if (newPos > m_EdnBuf.Size()) {
|
if (newPos > m_EdnBuf.Size()) {
|
||||||
newPos = m_EdnBuf.Size();
|
newPos = m_EdnBuf.Size();
|
||||||
}
|
}
|
||||||
|
m_cursorPosPrevious = m_cursorPos;
|
||||||
m_cursorPos = newPos;
|
m_cursorPos = newPos;
|
||||||
}
|
}
|
||||||
m_cursorPreferredCol = -1;
|
m_cursorPreferredCol = -1;
|
||||||
@@ -785,19 +721,8 @@ bool BufferText::TextDMoveDown(int32_t offset)
|
|||||||
*/
|
*/
|
||||||
void BufferText::cursorMove(int32_t gtkKey)
|
void BufferText::cursorMove(int32_t gtkKey)
|
||||||
{
|
{
|
||||||
|
int32_t tmplineID;
|
||||||
bool needUpdatePosition = true;
|
bool needUpdatePosition = true;
|
||||||
// check selection event ...
|
|
||||||
/*
|
|
||||||
if (true == globals::IsSetShift() ) {
|
|
||||||
if ( CURSOR_MODE_NORMAL == cursorMode) {
|
|
||||||
SelectionStart();
|
|
||||||
} else {
|
|
||||||
SelectionCheckMode();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SelectionEnd();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
switch(gtkKey) {
|
switch(gtkKey) {
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Left:
|
case GDK_KEY_Left:
|
||||||
@@ -842,7 +767,7 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
case GDK_Page_Up:
|
case GDK_Page_Up:
|
||||||
# endif
|
# endif
|
||||||
//EDN_INFO("keyEvent : <PAGE-UP>");
|
//EDN_INFO("keyEvent : <PAGE-UP>");
|
||||||
TextDMoveUp(m_displaySize.x);
|
TextDMoveUp(m_AnchorList[AnchorCurrentId()].m_displaySize.y);
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Page_Down:
|
case GDK_KEY_Page_Down:
|
||||||
@@ -850,7 +775,7 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
case GDK_Page_Down:
|
case GDK_Page_Down:
|
||||||
# endif
|
# endif
|
||||||
//EDN_INFO("keyEvent : <PAGE-DOWN>");
|
//EDN_INFO("keyEvent : <PAGE-DOWN>");
|
||||||
TextDMoveDown(m_displaySize.x);
|
TextDMoveDown(m_AnchorList[AnchorCurrentId()].m_displaySize.y);
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Begin:
|
case GDK_KEY_Begin:
|
||||||
@@ -889,57 +814,86 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
*/
|
*/
|
||||||
void BufferText::UpdateWindowsPosition(bool centerPage)
|
void BufferText::UpdateWindowsPosition(bool centerPage)
|
||||||
{
|
{
|
||||||
if (centerPage == false) {
|
int32_t iii = AnchorCurrentId();
|
||||||
// Display position (Y mode):
|
if (iii >=0) {
|
||||||
//EDN_INFO("BufferText::UpdateWindowsPosition() m_displayStart(" << m_displayStart.x << "," << m_displayStart.y << ") m_displaySize(" << m_displaySize.x << "," <<m_displaySize.y << ")");
|
int32_t linePreviousID = m_EdnBuf.GetLinesIdWithRef(m_cursorPosPrevious, m_AnchorList[iii].m_bufferPos, m_AnchorList[iii].m_lineId);
|
||||||
position_ts cursorPosition;
|
AnchorForceRedrawLine(linePreviousID);
|
||||||
cursorPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
|
|
||||||
int32_t lineStartPos = m_EdnBuf.StartOfLine(m_cursorPos);
|
|
||||||
cursorPosition.x = m_EdnBuf.CountDispChars(lineStartPos, m_cursorPos);
|
|
||||||
//EDN_INFO("BufferText::UpdateWindowsPosition() curent cursor position : (" << cursorPosition.x << "," << cursorPosition.y << ")");
|
|
||||||
|
|
||||||
if (m_displayStart.y > (int32_t)cursorPosition.y - globals::getNbLineBorder() ) {
|
if (centerPage == false) {
|
||||||
m_displayStart.y = cursorPosition.y - globals::getNbLineBorder();
|
// Display position (Y mode):
|
||||||
if (m_displayStart.y < 0) {
|
int32_t lineStartPos;
|
||||||
m_displayStart.y = 0;
|
// Get current position of cursor :
|
||||||
ForceReDraw(true);
|
position_ts cursorPosition;
|
||||||
|
EDN_WARNING("plop");
|
||||||
|
cursorPosition.y = m_EdnBuf.GetLinesIdWithRef(m_cursorPos, m_AnchorList[iii].m_bufferPos, m_AnchorList[iii].m_lineId);
|
||||||
|
AnchorForceRedrawLine(cursorPosition.y);
|
||||||
|
lineStartPos = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||||
|
cursorPosition.x = m_EdnBuf.CountDispChars(lineStartPos, m_cursorPos);
|
||||||
|
//EDN_INFO(" curent cursor position : (" << cursorPosition.x << "," << cursorPosition.y << ")");
|
||||||
|
|
||||||
|
position_ts displayPreviousStart = m_AnchorList[iii].m_displayStart;
|
||||||
|
//EDN_INFO(" m_displayStart(" << m_AnchorList[iii].m_displayStart.x << "," << m_AnchorList[iii].m_displayStart.y << ") m_displaySize(" << m_AnchorList[iii].m_displaySize.x << "," << m_AnchorList[iii].m_displaySize.y << ")");
|
||||||
|
if (m_AnchorList[iii].m_displayStart.y > (int32_t)cursorPosition.y - globals::getNbLineBorder() ) {
|
||||||
|
m_AnchorList[iii].m_displayStart.y = cursorPosition.y - globals::getNbLineBorder();
|
||||||
|
if (m_AnchorList[iii].m_displayStart.y < 0) {
|
||||||
|
m_AnchorList[iii].m_displayStart.y = 0;
|
||||||
|
}
|
||||||
|
} else if (m_AnchorList[iii].m_displayStart.y + m_AnchorList[iii].m_displaySize.y <= (int32_t)cursorPosition.y + globals::getNbLineBorder() ) {
|
||||||
|
m_AnchorList[iii].m_displayStart.y = cursorPosition.y - m_AnchorList[iii].m_displaySize.y + globals::getNbLineBorder() + 1;
|
||||||
}
|
}
|
||||||
} else if (m_displayStart.y + m_displaySize.y <= (int32_t)cursorPosition.y + globals::getNbLineBorder() ) {
|
// Display position (X mode):
|
||||||
m_displayStart.y = cursorPosition.y - m_displaySize.y + globals::getNbLineBorder() + 1;
|
//EDN_INFO("cursorPosition X : " << cursorPosition.y << " windows " << m_displayStart.y << "=>" << m_displayStart.x + m_displaySize.x);
|
||||||
ForceReDraw(true);
|
if (m_AnchorList[iii].m_displayStart.x > cursorPosition.x - globals::getNbColoneBorder() ) {
|
||||||
}
|
m_AnchorList[iii].m_displayStart.x = cursorPosition.x - globals::getNbColoneBorder();
|
||||||
// Display position (X mode):
|
if (m_AnchorList[iii].m_displayStart.x < 0) {
|
||||||
//EDN_INFO("cursorPosition X : " << cursorPosition.y << " windows " << m_displayStart.y << "=>" << m_displayStart.x + m_displaySize.x);
|
m_AnchorList[iii].m_displayStart.x = 0;
|
||||||
if (m_displayStart.x > cursorPosition.x - globals::getNbColoneBorder() ) {
|
}
|
||||||
m_displayStart.x = cursorPosition.x - globals::getNbColoneBorder();
|
} else if (m_AnchorList[iii].m_displayStart.x + m_AnchorList[iii].m_displaySize.x <= cursorPosition.x + globals::getNbColoneBorder() ) {
|
||||||
if (m_displayStart.x < 0) {
|
m_AnchorList[iii].m_displayStart.x = cursorPosition.x - m_AnchorList[iii].m_displaySize.x + globals::getNbColoneBorder() + 1;
|
||||||
m_displayStart.x = 0;
|
|
||||||
ForceReDraw(true);
|
|
||||||
}
|
}
|
||||||
} else if (m_displayStart.x + m_displaySize.x <= cursorPosition.x + globals::getNbColoneBorder() ) {
|
|
||||||
m_displayStart.x = cursorPosition.x - m_displaySize.x + globals::getNbColoneBorder() + 1;
|
//update the buffer position ID :
|
||||||
ForceReDraw(true);
|
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
||||||
|
m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y;
|
||||||
|
if (m_AnchorList[iii].m_displayStart.x != displayPreviousStart.x) {
|
||||||
|
AnchorForceRedrawAll(iii);
|
||||||
|
} else {
|
||||||
|
if (m_AnchorList[iii].m_displayStart.y != displayPreviousStart.y) {
|
||||||
|
//EDN_WARNING("SELECT an ofset : displayPreviousStart.y=" << displayPreviousStart.y << " m_AnchorList[iii].m_displayStart.y=" << m_AnchorList[iii].m_displayStart.y << " ==>" << m_AnchorList[iii].m_displayStart.y - displayPreviousStart.y);
|
||||||
|
//EDN_WARNING("SELECT ... offset = " << m_AnchorList[iii].m_BufferNumberLineOffset);
|
||||||
|
AnchorForceRedrawOffsef(m_AnchorList[iii].m_displayStart.y - displayPreviousStart.y);
|
||||||
|
//EDN_WARNING("SELECT ... offset = " << m_AnchorList[iii].m_BufferNumberLineOffset);
|
||||||
|
}
|
||||||
|
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||||
|
bool SelectionIsRect;
|
||||||
|
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
||||||
|
if (true == haveSelectionActive) {
|
||||||
|
int32_t start = edn_min(linePreviousID, cursorPosition.y);
|
||||||
|
int32_t stop = edn_max(linePreviousID, cursorPosition.y);
|
||||||
|
//EDN_WARNING("SELECT force redraw range of lines : (" << start << "," << stop << ")");
|
||||||
|
for (int32_t jjj=start; jjj <= stop; jjj++) {
|
||||||
|
AnchorForceRedrawLine(jjj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// center the line at the middle of the screen :
|
||||||
|
position_ts cursorPosition;
|
||||||
|
//EDN_DEBUG(" -------------------------------------------------");
|
||||||
|
cursorPosition.y = m_EdnBuf.GetLinesIdWithRef(m_cursorPos, m_AnchorList[iii].m_bufferPos, m_AnchorList[iii].m_lineId);
|
||||||
|
//EDN_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << cursorPosition.y);
|
||||||
|
cursorPosition.x = 0;
|
||||||
|
|
||||||
|
m_AnchorList[iii].m_displayStart.x = 0;
|
||||||
|
//EDN_DEBUG(" display size : " << m_displaySize.y);
|
||||||
|
m_AnchorList[iii].m_displayStart.y = cursorPosition.y - m_AnchorList[iii].m_displaySize.y/2;
|
||||||
|
m_AnchorList[iii].m_displayStart.y = edn_max(m_AnchorList[iii].m_displayStart.y, 0);
|
||||||
|
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
||||||
|
m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y;
|
||||||
|
//EDN_DEBUG(" display start : " << m_displayStart.x << "x" << m_displayStart.y);
|
||||||
|
//EDN_DEBUG(" -------------------------------------------------");
|
||||||
|
AnchorForceRedrawAll(iii);
|
||||||
}
|
}
|
||||||
|
|
||||||
//update the buffer position ID :
|
|
||||||
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y);
|
|
||||||
} else {
|
|
||||||
// center the line at the middle of the screen :
|
|
||||||
position_ts cursorPosition;
|
|
||||||
//EDN_DEBUG(" -------------------------------------------------");
|
|
||||||
cursorPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
|
|
||||||
//EDN_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << cursorPosition.y);
|
|
||||||
cursorPosition.x = 0;
|
|
||||||
|
|
||||||
m_displayStart.x = 0;
|
|
||||||
//EDN_DEBUG(" display size : " << m_displaySize.y);
|
|
||||||
m_displayStart.y = cursorPosition.y - m_displaySize.y/2;
|
|
||||||
m_displayStart.y = edn_max(m_displayStart.y, 0);
|
|
||||||
|
|
||||||
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStart.y);
|
|
||||||
ForceReDraw(true);
|
|
||||||
//EDN_DEBUG(" display start : " << m_displayStart.x << "x" << m_displayStart.y);
|
|
||||||
//EDN_DEBUG(" -------------------------------------------------");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -968,33 +922,49 @@ void BufferText::AddChar(char * UTF8data)
|
|||||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||||
SetInsertPosition(m_cursorPos+1, true);
|
SetInsertPosition(m_cursorPos+1, true);
|
||||||
} else {
|
} else {
|
||||||
if (true == globals::IsSetCtrl() ) {
|
// Indent depend of the multiline in the selection ...
|
||||||
m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY);
|
// count the number of line :
|
||||||
|
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
|
||||||
|
if (0 == nbSelectedLines) {
|
||||||
|
Edn::VectorType<int8_t> tmpVect;
|
||||||
|
tmpVect.PushBack(0x09);
|
||||||
|
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, tmpVect);
|
||||||
|
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
|
||||||
} else {
|
} else {
|
||||||
m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY);
|
int32_t tmpPos = m_cursorPos;
|
||||||
|
if (true == globals::IsSetShift() ) {
|
||||||
|
tmpPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY);
|
||||||
|
} else {
|
||||||
|
tmpPos = m_EdnBuf.Indent(SELECTION_PRIMARY);
|
||||||
|
}
|
||||||
|
SetInsertPosition(tmpPos, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actionDone = true;
|
actionDone = true;
|
||||||
} else if (UTF8data[0] == '\n') {
|
} else if (UTF8data[0] == '\n') {
|
||||||
Edn::VectorType<int8_t> tmpVect;
|
Edn::VectorType<int8_t> tmpVect;
|
||||||
tmpVect.PushBack('\n');
|
if (true == globals::IsSetShift()) {
|
||||||
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
|
tmpVect.PushBack('\r');
|
||||||
if (true == globals::IsSetAutoIndent() ) {
|
} else {
|
||||||
int32_t l_lineStart;
|
tmpVect.PushBack('\n');
|
||||||
// Get the begin of the line or the begin of the line befor selection
|
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
|
||||||
if (false == haveSelectionActive) {
|
if (true == globals::IsSetAutoIndent() ) {
|
||||||
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
|
int32_t l_lineStart;
|
||||||
} else {
|
// Get the begin of the line or the begin of the line befor selection
|
||||||
l_lineStart = m_EdnBuf.StartOfLine(SelectionStart);
|
if (false == haveSelectionActive) {
|
||||||
}
|
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||||
// add same characters in the temporar buffer
|
|
||||||
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
|
|
||||||
if (' ' == m_EdnBuf[kk]) {
|
|
||||||
tmpVect.PushBack(' ');
|
|
||||||
} else if('\t' == m_EdnBuf[kk]) {
|
|
||||||
tmpVect.PushBack('\t');
|
|
||||||
} else {
|
} else {
|
||||||
break;
|
l_lineStart = m_EdnBuf.StartOfLine(SelectionStart);
|
||||||
|
}
|
||||||
|
// add same characters in the temporar buffer
|
||||||
|
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
|
||||||
|
if (' ' == m_EdnBuf[kk]) {
|
||||||
|
tmpVect.PushBack(' ');
|
||||||
|
} else if('\t' == m_EdnBuf[kk]) {
|
||||||
|
tmpVect.PushBack('\t');
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1027,6 +997,7 @@ void BufferText::AddChar(char * UTF8data)
|
|||||||
}
|
}
|
||||||
actionDone = true;
|
actionDone = true;
|
||||||
}
|
}
|
||||||
|
AnchorForceRedrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false == actionDone) {
|
if (false == actionDone) {
|
||||||
@@ -1057,7 +1028,6 @@ void BufferText::AddChar(char * UTF8data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
}
|
}
|
||||||
@@ -1087,6 +1057,8 @@ void BufferText::JumpAtLine(int32_t newLine)
|
|||||||
{
|
{
|
||||||
int32_t positionLine = m_EdnBuf.CountForwardNLines(0, newLine);
|
int32_t positionLine = m_EdnBuf.CountForwardNLines(0, newLine);
|
||||||
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
EDN_DEBUG("jump at the line : " << newLine );
|
EDN_DEBUG("jump at the line : " << newLine );
|
||||||
SetInsertPosition(positionLine);
|
SetInsertPosition(positionLine);
|
||||||
UpdateWindowsPosition(true);
|
UpdateWindowsPosition(true);
|
||||||
@@ -1240,7 +1212,6 @@ void BufferText::Copy(int8_t clipboardID)
|
|||||||
*/
|
*/
|
||||||
void BufferText::Cut(int8_t clipboardID)
|
void BufferText::Cut(int8_t clipboardID)
|
||||||
{
|
{
|
||||||
|
|
||||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||||
bool SelectionIsRect;
|
bool SelectionIsRect;
|
||||||
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
||||||
@@ -1251,10 +1222,11 @@ void BufferText::Cut(int8_t clipboardID)
|
|||||||
if (true == haveSelectionActive ) {
|
if (true == haveSelectionActive ) {
|
||||||
EDN_INFO("REMOVE SELECTION");
|
EDN_INFO("REMOVE SELECTION");
|
||||||
m_EdnBuf.RemoveSelected(SELECTION_PRIMARY);
|
m_EdnBuf.RemoveSelected(SELECTION_PRIMARY);
|
||||||
m_cursorPos = SelectionStart;
|
SetInsertPosition(SelectionStart, true);
|
||||||
}
|
}
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
ForceReDraw(true);
|
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,15 +1252,15 @@ void BufferText::Paste(int8_t clipboardID)
|
|||||||
if (true == haveSelectionActive ) {
|
if (true == haveSelectionActive ) {
|
||||||
// replace data
|
// replace data
|
||||||
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, mVect );
|
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, mVect );
|
||||||
m_cursorPos = SelectionStart + mVect.Size();
|
SetInsertPosition(SelectionStart + mVect.Size(), true);
|
||||||
} else {
|
} else {
|
||||||
// insert data
|
// insert data
|
||||||
m_EdnBuf.Insert(m_cursorPos, mVect);
|
m_EdnBuf.Insert(m_cursorPos, mVect);
|
||||||
m_cursorPos += mVect.Size();
|
SetInsertPosition(m_cursorPos + mVect.Size(), true);
|
||||||
}
|
}
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
ForceReDraw(true);
|
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1299,9 +1271,10 @@ void BufferText::Undo(void)
|
|||||||
if (newPos >= 0) {
|
if (newPos >= 0) {
|
||||||
SetInsertPosition(newPos, true);
|
SetInsertPosition(newPos, true);
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
ForceReDraw(true);
|
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::Redo(void)
|
void BufferText::Redo(void)
|
||||||
@@ -1310,15 +1283,80 @@ void BufferText::Redo(void)
|
|||||||
if (newPos >= 0) {
|
if (newPos >= 0) {
|
||||||
SetInsertPosition(newPos, true);
|
SetInsertPosition(newPos, true);
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
ForceReDraw(true);
|
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
}
|
}
|
||||||
|
// for the redraw to permit to remove display error ...
|
||||||
|
AnchorForceRedrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferText::SetCharset(charset_te newCharset)
|
void BufferText::SetCharset(charset_te newCharset)
|
||||||
{
|
{
|
||||||
m_EdnBuf.SetCharsetType(newCharset);
|
m_EdnBuf.SetCharsetType(newCharset);
|
||||||
ForceReDraw(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BufferText::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
|
||||||
|
{
|
||||||
|
int32_t localID = AnchorRealId(anchorID);
|
||||||
|
if (localID >=0) {
|
||||||
|
// update internal sise of the width of lineID
|
||||||
|
UpdatePointerNumber();
|
||||||
|
// Updata uper size of display
|
||||||
|
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 = anchor.m_displaySize.y;
|
||||||
|
// update to buffer position
|
||||||
|
anchor.m_lineNumber = m_AnchorList[localID].m_lineId+1;
|
||||||
|
anchor.m_posStart = m_AnchorList[localID].m_bufferPos;
|
||||||
|
if (anchor.m_posStart >= m_EdnBuf.Size()+1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
anchor.m_posStop = m_EdnBuf.EndOfLine(anchor.m_posStart);
|
||||||
|
// Update selection current
|
||||||
|
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||||
|
bool selIsRect;
|
||||||
|
bool selHave = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, selStart, selEnd, selIsRect, selRectStart, selRectEnd);
|
||||||
|
if (false == selHave){
|
||||||
|
anchor.m_selectionPosStart = -1;
|
||||||
|
anchor.m_selectionPosStop = -1;
|
||||||
|
} else {
|
||||||
|
anchor.m_selectionPosStart = selStart+1;
|
||||||
|
anchor.m_selectionPosStop = selEnd+1;
|
||||||
|
}
|
||||||
|
EDN_DEBUG("SET in anchor " << m_AnchorList[localID].m_displaySize.y << " lines to display");
|
||||||
|
for(int32_t iii=0; iii</*edn_min(*/m_AnchorList[localID].m_displaySize.y/*, MAX_LINE_DISPLAYABLE_BY_BUFFER)*/; iii++) {
|
||||||
|
anchor.m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii];
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = false;
|
||||||
|
/*if (iii > m_AnchorList[localID].m_displaySize.y - 4) {
|
||||||
|
anchor.m_redrawLine[iii] = true;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
anchor.m_BufferNumberLineOffset = m_AnchorList[localID].m_BufferNumberLineOffset;
|
||||||
|
m_AnchorList[localID].m_BufferNumberLineOffset = 0;
|
||||||
|
|
||||||
|
EDN_DEBUG("Request display : line=" << anchor.m_lineNumber << " (" << anchor.m_posStart << "," << anchor.m_posStop << ")");
|
||||||
|
EDN_DEBUG(" ==> select : (" << anchor.m_selectionPosStart << "," << anchor.m_selectionPosStop << ")");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BufferText::AnchorNext(bufferAnchor_ts & anchor)
|
||||||
|
{
|
||||||
|
anchor.m_lineNumber++;
|
||||||
|
anchor.m_posStart = anchor.m_posStop+1;
|
||||||
|
if (anchor.m_posStart >= m_EdnBuf.Size()+1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
anchor.m_posStop = m_EdnBuf.EndOfLine(anchor.m_posStart);
|
||||||
|
anchor.m_nbIterationMax--;
|
||||||
|
if (anchor.m_nbIterationMax<0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -36,65 +36,63 @@ typedef enum {
|
|||||||
CURSOR_DISPLAY_MODE_NOT_FOCUS,
|
CURSOR_DISPLAY_MODE_NOT_FOCUS,
|
||||||
} cursorDisplayMode_te;
|
} cursorDisplayMode_te;
|
||||||
|
|
||||||
|
|
||||||
class BufferText : public Buffer {
|
class BufferText : public Buffer {
|
||||||
public:
|
public:
|
||||||
BufferText(void);
|
BufferText(void);
|
||||||
BufferText(Edn::File &fileName);
|
BufferText(Edn::File &fileName);
|
||||||
virtual ~BufferText(void);
|
virtual ~BufferText(void);
|
||||||
void Save(void);
|
void Save(void);
|
||||||
|
|
||||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||||
void SetLineDisplay(uint32_t lineNumber);
|
void SetLineDisplay(uint32_t lineNumber);
|
||||||
|
|
||||||
int32_t Display(DrawerManager &drawer);
|
void DrawLine(DrawerManager &drawer, bufferAnchor_ts &anchor);
|
||||||
void ForceReDraw(bool allElement);
|
void AddChar(char * UTF8data);
|
||||||
void AddChar(char * UTF8data);
|
void cursorMove(int32_t gtkKey);
|
||||||
void cursorMove(int32_t gtkKey);
|
void MouseSelectFromCursorTo(int32_t width, int32_t height);
|
||||||
void MouseSelectFromCursorTo(int32_t width, int32_t height);
|
void MouseEvent(int32_t width, int32_t height);
|
||||||
void MouseEvent(int32_t width, int32_t height);
|
void MouseEventDouble(void);
|
||||||
void MouseEventDouble(void);
|
void MouseEventTriple(void);
|
||||||
void MouseEventTriple(void);
|
void ScrollDown(void);
|
||||||
void ScrollDown(void);
|
void ScrollUp(void);
|
||||||
void ScrollUp(void);
|
|
||||||
|
|
||||||
void Copy(int8_t clipboardID);
|
void Copy(int8_t clipboardID);
|
||||||
void Cut(int8_t clipboardID);
|
void Cut(int8_t clipboardID);
|
||||||
void Paste(int8_t clipboardID);
|
void Paste(int8_t clipboardID);
|
||||||
|
|
||||||
void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
||||||
void Replace(Edn::String &data);
|
void Replace(Edn::String &data);
|
||||||
int32_t FindLine(Edn::String &data);
|
int32_t FindLine(Edn::String &data);
|
||||||
void JumpAtLine(int32_t newLine);
|
void JumpAtLine(int32_t newLine);
|
||||||
int32_t GetCurrentLine(void);
|
int32_t GetCurrentLine(void);
|
||||||
|
|
||||||
void RemoveLine(void);
|
void RemoveLine(void);
|
||||||
void SelectAll(void);
|
void SelectAll(void);
|
||||||
void SelectNone(void);
|
void SelectNone(void);
|
||||||
void Undo(void);
|
void Undo(void);
|
||||||
void Redo(void);
|
void Redo(void);
|
||||||
void SetCharset(charset_te newCharset);
|
void SetCharset(charset_te newCharset);
|
||||||
|
|
||||||
|
bool AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor);
|
||||||
|
bool AnchorNext(bufferAnchor_ts & anchor);
|
||||||
protected:
|
protected:
|
||||||
void NameChange(void);
|
void NameChange(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Display
|
// Display
|
||||||
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
|
ColorizeManager * myColorManager; //!< for the background color :
|
||||||
uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number
|
int32_t m_nbColoneForLineNumber; //!< number of colomn use for linenumber display
|
||||||
ColorizeManager * myColorManager; //!< for the background color :
|
|
||||||
|
|
||||||
|
|
||||||
// Direct buffer IO
|
// Direct buffer IO
|
||||||
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
|
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
|
|
||||||
|
|
||||||
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
|
// internal function
|
||||||
void BasicInit(void);
|
void BasicInit(void);
|
||||||
@@ -103,10 +101,6 @@ class BufferText : public Buffer {
|
|||||||
|
|
||||||
void CleanSelectLine(void);
|
void CleanSelectLine(void);
|
||||||
|
|
||||||
void SelectionStart(void);
|
|
||||||
void SelectionEnd(void);
|
|
||||||
void SelectionCheckMode(void);
|
|
||||||
|
|
||||||
void CheckAndUpdateLineForModification(uint32_t lineID);
|
void CheckAndUpdateLineForModification(uint32_t lineID);
|
||||||
bool TextDMoveUp(int32_t offset);
|
bool TextDMoveUp(int32_t offset);
|
||||||
bool TextDMoveDown(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 GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y);
|
||||||
void MoveUpDown(int32_t ofset);
|
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);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* @file ColoriseManager.cpp
|
* @file ColorizeManager.cpp
|
||||||
* @brief Editeur De N'ours : Colorising Manager
|
* @brief Editeur De N'ours : Colorising Manager
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @date 14/12/2010
|
* @date 14/12/2010
|
||||||
@@ -57,19 +57,8 @@ void ColorizeManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
{
|
{
|
||||||
case EDN_MSG__RELOAD_COLOR_FILE:
|
case EDN_MSG__RELOAD_COLOR_FILE:
|
||||||
{
|
{
|
||||||
// Remove all current 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();
|
|
||||||
// Reaload File
|
// Reaload File
|
||||||
// TODO : Check this :
|
// TODO : Check this : Pb in the recopy Edn::String element
|
||||||
Edn::String plop = m_fileColor;
|
Edn::String plop = m_fileColor;
|
||||||
LoadFile(plop.c_str());
|
LoadFile(plop.c_str());
|
||||||
}
|
}
|
||||||
@@ -85,6 +74,18 @@ void ColorizeManager::LoadFile(Edn::String &xmlFilename)
|
|||||||
|
|
||||||
void ColorizeManager::LoadFile(const char * 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;
|
m_fileColor = xmlFilename;
|
||||||
EDN_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
|
EDN_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
|
||||||
errorColor = new Colorize();
|
errorColor = new Colorize();
|
||||||
@@ -96,22 +97,17 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
|
|||||||
// open the curent File
|
// open the curent File
|
||||||
XmlDocument.LoadFile(xmlFilename);
|
XmlDocument.LoadFile(xmlFilename);
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" );
|
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" );
|
||||||
if (NULL == root )
|
if (NULL == root ) {
|
||||||
{
|
|
||||||
EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\"");
|
EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\"");
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
TiXmlNode * pNode = root->FirstChild();
|
TiXmlNode * pNode = root->FirstChild();
|
||||||
while(NULL != pNode)
|
while(NULL != pNode) {
|
||||||
{
|
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
||||||
// nothing to do, just proceed to next step
|
// nothing to do, just proceed to next step
|
||||||
} else if (!strcmp(pNode->Value(), "gui")) {
|
} else if (!strcmp(pNode->Value(), "gui")) {
|
||||||
TiXmlNode * pGuiNode = pNode->FirstChild();
|
TiXmlNode * pGuiNode = pNode->FirstChild();
|
||||||
while(NULL != pGuiNode)
|
while(NULL != pGuiNode) {
|
||||||
{
|
|
||||||
if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
||||||
// nothing to do, just proceed to next step
|
// nothing to do, just proceed to next step
|
||||||
} else if (!strcmp(pGuiNode->Value(), "color")) {
|
} else if (!strcmp(pGuiNode->Value(), "color")) {
|
||||||
@@ -233,6 +229,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SendMessage(EDN_MSG__COLOR_HAS_CHANGE);
|
SendMessage(EDN_MSG__COLOR_HAS_CHANGE);
|
||||||
|
SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Colorize *ColorizeManager::Get(const char *colorName)
|
Colorize *ColorizeManager::Get(const char *colorName)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* @file ColoriseManager.h
|
* @file ColorizeManager.h
|
||||||
* @brief Editeur De N'ours : Colorising Manager (header)
|
* @brief Editeur De N'ours : Colorising Manager (header)
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @date 14/12/2010
|
* @date 14/12/2010
|
||||||
|
@@ -57,6 +57,8 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
|
|||||||
# elif defined( USE_GTK_VERSION_2_0 )
|
# elif defined( USE_GTK_VERSION_2_0 )
|
||||||
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
|
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
|
||||||
# endif
|
# 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
|
// 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_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_out_event", G_CALLBACK(CB_focusLost), this);
|
||||||
@@ -100,6 +102,10 @@ void BufferView::OnMessage(int32_t id, int32_t dataID)
|
|||||||
// change Title :
|
// change Title :
|
||||||
gtk_widget_queue_draw(m_widget);
|
gtk_widget_queue_draw(m_widget);
|
||||||
break;
|
break;
|
||||||
|
case EDN_MSG__USER_DISPLAY_CHANGE:
|
||||||
|
// Redraw all the display ...
|
||||||
|
gtk_widget_queue_draw(m_widget);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,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);
|
//EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf);
|
||||||
if ( 0 <= selectBuf) {
|
if ( 0 <= selectBuf) {
|
||||||
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, 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) {
|
} else if (event->button == 3) {
|
||||||
if (event->type == GDK_BUTTON_PRESS) {
|
if (event->type == GDK_BUTTON_PRESS) {
|
||||||
EDN_INFO("mouse-event BT3 PRESS");
|
EDN_INFO("mouse-event BT3 PRESS");
|
||||||
@@ -364,7 +353,8 @@ gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EDN_INFO("mouse-event BT? PRESS");
|
// not usefull to redraw
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
gtk_widget_queue_draw( widget );
|
gtk_widget_queue_draw( widget );
|
||||||
return true;
|
return true;
|
||||||
|
@@ -38,46 +38,53 @@
|
|||||||
|
|
||||||
CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
|
CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
|
||||||
{
|
{
|
||||||
m_bufferID = -1;
|
|
||||||
m_buttunOneSelected = false;
|
|
||||||
m_shawableAreaX = 0;
|
|
||||||
m_shawableAreaY = 0;
|
|
||||||
|
|
||||||
// Init link with the buffer Manager
|
// Init link with the buffer Manager
|
||||||
m_bufferManager = BufferManager::getInstance();
|
m_bufferManager = BufferManager::getInstance();
|
||||||
m_colorManager = ColorizeManager::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;
|
||||||
|
|
||||||
m_widget = gtk_drawing_area_new();
|
m_widget = gtk_drawing_area_new();
|
||||||
gtk_widget_set_size_request( m_widget, 200, 100);
|
gtk_widget_set_size_request( m_widget, 200, 100);
|
||||||
|
|
||||||
gtk_widget_add_events( m_widget,
|
gtk_widget_add_events( m_widget,
|
||||||
GDK_KEY_PRESS_MASK
|
GDK_KEY_PRESS_MASK
|
||||||
| GDK_BUTTON_PRESS_MASK
|
| GDK_BUTTON_PRESS_MASK
|
||||||
| GDK_BUTTON_RELEASE_MASK
|
| GDK_BUTTON_RELEASE_MASK
|
||||||
| GDK_POINTER_MOTION_MASK
|
| GDK_POINTER_MOTION_MASK
|
||||||
| GDK_POINTER_MOTION_HINT_MASK);
|
| GDK_POINTER_MOTION_HINT_MASK);
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
g_object_set(m_widget,"can-focus", TRUE, NULL);
|
g_object_set(m_widget,"can-focus", TRUE, NULL);
|
||||||
# elif defined( USE_GTK_VERSION_2_0 )
|
# elif defined( USE_GTK_VERSION_2_0 )
|
||||||
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
|
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
|
||||||
# endif
|
# 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
|
// 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_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_out_event", G_CALLBACK(CB_focusLost), this);
|
||||||
// Keyboard Event
|
// 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_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_release_event", G_CALLBACK(CB_keyboardEvent), this);
|
||||||
// Mouse Event
|
// 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_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), "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), "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), "scroll-event", G_CALLBACK(CB_mouseScrollEvent), this);
|
||||||
// Display Event
|
// 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
|
# 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 )
|
# 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
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +105,9 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
|
|||||||
{
|
{
|
||||||
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
|
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
|
||||||
//EDN_INFO("Select a new Buffer ... " << dataID);
|
//EDN_INFO("Select a new Buffer ... " << dataID);
|
||||||
|
m_bufferManager->Get(m_bufferID)->AnchorRm(m_displayUniqueId);
|
||||||
m_bufferID = dataID;
|
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
|
// request the dispplay of the curent Editor
|
||||||
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
|
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
|
||||||
break;
|
break;
|
||||||
@@ -179,13 +187,16 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
|
|||||||
case EDN_MSG__CURRENT_SET_CHARSET:
|
case EDN_MSG__CURRENT_SET_CHARSET:
|
||||||
m_bufferManager->Get(m_bufferID)->SetCharset((charset_te)dataID);
|
m_bufferManager->Get(m_bufferID)->SetCharset((charset_te)dataID);
|
||||||
break;
|
break;
|
||||||
|
case EDN_MSG__USER_DISPLAY_CHANGE:
|
||||||
|
// Redraw all the display ... Done under ...
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// Force redraw of the widget
|
// 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)
|
gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||||
{
|
{
|
||||||
CodeView * self = reinterpret_cast<CodeView*>(data);
|
CodeView * self = reinterpret_cast<CodeView*>(data);
|
||||||
@@ -194,6 +205,7 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
|||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
gtk_widget_get_allocation(widget, &allocation);
|
gtk_widget_get_allocation(widget, &allocation);
|
||||||
|
EDN_INFO("GTK+ request a diplay of : "<< allocation.width <<"px * "<< allocation.height <<"px");
|
||||||
bool needRedrawAll = false;
|
bool needRedrawAll = false;
|
||||||
if (self->m_shawableAreaX != allocation.width) {
|
if (self->m_shawableAreaX != allocation.width) {
|
||||||
needRedrawAll = true;
|
needRedrawAll = true;
|
||||||
@@ -204,6 +216,7 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
|||||||
self->m_shawableAreaY = allocation.height;
|
self->m_shawableAreaY = allocation.height;
|
||||||
}
|
}
|
||||||
# elif defined( USE_GTK_VERSION_2_0)
|
# 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;
|
bool needRedrawAll = false;
|
||||||
if (self->m_shawableAreaX != widget->allocation.width) {
|
if (self->m_shawableAreaX != widget->allocation.width) {
|
||||||
needRedrawAll = true;
|
needRedrawAll = true;
|
||||||
@@ -214,32 +227,51 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
|||||||
self->m_shawableAreaY = widget->allocation.height;
|
self->m_shawableAreaY = widget->allocation.height;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
if (true == needRedrawAll) {
|
EDN_INFO("Edn request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
|
||||||
//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("BufferView Display");
|
|
||||||
// Get the color Manager :
|
// Get the color Manager :
|
||||||
ColorizeManager *myColorManager = NULL;
|
ColorizeManager *myColorManager = NULL;
|
||||||
myColorManager = ColorizeManager::getInstance();
|
myColorManager = ColorizeManager::getInstance();
|
||||||
|
|
||||||
//(void)m_bufferManager->Get(m_bufferID)->Display(m_displayParameters, m_shawableAreaX, m_shawableAreaY);
|
Buffer * tmpBuf = self->m_bufferManager->Get(self->m_bufferID);
|
||||||
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
|
|
||||||
//EDN_INFO("Display buffer ID = " << m_bufferID);
|
#ifndef NDEBUG
|
||||||
(void)self->m_bufferManager->Get(self->m_bufferID)->Display(monDrawer);
|
GTimeVal timeStart;
|
||||||
// EDN_WARNING("Must display here ... ");
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// sur : émis lors du premier affichage de la GtkDrawingArea
|
// sur : émis lors du premier affichage de la GtkDrawingArea
|
||||||
gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer data)
|
gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
@@ -247,22 +279,15 @@ gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer data)
|
|||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
gtk_widget_get_allocation(widget, &allocation);
|
gtk_widget_get_allocation(widget, &allocation);
|
||||||
int32_t size_x = allocation.width;
|
EDN_INFO("GTK+ request a diplay of : "<< allocation.width <<"px * "<< allocation.height <<"px");
|
||||||
int32_t size_y = allocation.height;
|
|
||||||
|
|
||||||
self->m_shawableAreaX = allocation.width;
|
self->m_shawableAreaX = allocation.width;
|
||||||
self->m_shawableAreaY = allocation.height;
|
self->m_shawableAreaY = allocation.height;
|
||||||
# elif defined( USE_GTK_VERSION_2_0)
|
# elif defined( USE_GTK_VERSION_2_0)
|
||||||
int32_t size_x = widget->allocation.width;
|
EDN_INFO("GTK+ request a diplay of : "<< widget->allocation.width <<"px * "<< widget->allocation.height <<"px");
|
||||||
int32_t size_y = widget->allocation.height;
|
|
||||||
|
|
||||||
self->m_shawableAreaX = widget->allocation.width;
|
self->m_shawableAreaX = widget->allocation.width;
|
||||||
self->m_shawableAreaY = widget->allocation.height;
|
self->m_shawableAreaY = widget->allocation.height;
|
||||||
# endif
|
# endif
|
||||||
EDN_INFO("Request a diplay of : "<< size_x <<"px * "<< size_y <<"px");
|
|
||||||
|
|
||||||
gtk_widget_queue_draw( widget );
|
gtk_widget_queue_draw( widget );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +298,12 @@ gint CodeView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer da
|
|||||||
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
||||||
# endif
|
# endif
|
||||||
self->SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, self->m_bufferID);
|
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");
|
EDN_INFO("Focus - In");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,10 @@ class CodeView : public MsgBroadcast
|
|||||||
private:
|
private:
|
||||||
// main windows widget :
|
// main windows widget :
|
||||||
GtkWidget * m_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...
|
// récupération des proprieter général...
|
||||||
BufferManager * m_bufferManager;
|
BufferManager * m_bufferManager;
|
||||||
ColorizeManager * m_colorManager;
|
ColorizeManager * m_colorManager;
|
||||||
|
@@ -85,7 +85,7 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
|||||||
#else
|
#else
|
||||||
ExitIconeFile = "./data/imagesSources/delete-24px.png";
|
ExitIconeFile = "./data/imagesSources/delete-24px.png";
|
||||||
#endif
|
#endif
|
||||||
// TODO : find a good way to chenge the size of an image
|
// TODO : find a good way to change the size of an image
|
||||||
GtkWidget *myImageQuit = gtk_image_new_from_file(ExitIconeFile.c_str());
|
GtkWidget *myImageQuit = gtk_image_new_from_file(ExitIconeFile.c_str());
|
||||||
GtkIconSize mySize = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
GtkIconSize mySize = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||||
//EDN_DEBUG(" plop : " << mySize);
|
//EDN_DEBUG(" plop : " << mySize);
|
||||||
@@ -100,9 +100,24 @@ MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
|
|||||||
|
|
||||||
// add the real menu bar
|
// add the real menu bar
|
||||||
gtk_box_pack_start( GTK_BOX (hboxMenu), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
|
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
|
// Add title
|
||||||
|
m_internalTitleLabel = gtk_label_new("Edn");
|
||||||
|
gtk_box_pack_start( GTK_BOX (hboxMenu), m_internalTitleLabel, FALSE, FALSE, 0);
|
||||||
#endif
|
#endif
|
||||||
// **********************************************************
|
// **********************************************************
|
||||||
// * Horizontal ELEMENTS : *
|
// * Horizontal ELEMENTS : *
|
||||||
@@ -150,12 +165,23 @@ void MainWindows::SetTitle(Edn::File &fileName, bool isModify)
|
|||||||
}
|
}
|
||||||
tmp += "Edn";
|
tmp += "Edn";
|
||||||
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
|
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)
|
void MainWindows::SetNoTitle(void)
|
||||||
{
|
{
|
||||||
Edn::String tmp = "Edn";
|
Edn::String tmp = "Edn";
|
||||||
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
|
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)
|
void MainWindows::OnMessage(int32_t id, int32_t dataID)
|
||||||
@@ -175,49 +201,22 @@ void MainWindows::OnMessage(int32_t id, int32_t dataID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EDN_MSG__QUIT:
|
|
||||||
OnQuit(m_mainWindow, this);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
|
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
EDN_INFO("quit requested");
|
//MainWindows * self = reinterpret_cast<MainWindows*>(data);
|
||||||
// dlg to confirm the quit event :
|
GeneralSendMessage(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION);
|
||||||
GtkWidget *p_dialog = gtk_dialog_new_with_buttons("Exit",
|
// Close is not managed here ...
|
||||||
GTK_WINDOW(widget),
|
return true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data)
|
gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data)
|
||||||
{
|
{
|
||||||
MainWindows * self = reinterpret_cast<MainWindows*>(data);
|
MainWindows * self = reinterpret_cast<MainWindows*>(data);
|
||||||
EDN_WARNING("State change");
|
EDN_DEBUG("State change");
|
||||||
EDN_INFO(" change state mask : " << event->window_state.changed_mask);
|
EDN_INFO(" change state mask : " << event->window_state.changed_mask);
|
||||||
EDN_INFO(" change state new val : " << event->window_state.new_window_state);
|
EDN_INFO(" change state new val : " << event->window_state.new_window_state);
|
||||||
if (event->window_state.changed_mask == GDK_WINDOW_STATE_MAXIMIZED) {
|
if (event->window_state.changed_mask == GDK_WINDOW_STATE_MAXIMIZED) {
|
||||||
@@ -233,31 +232,6 @@ gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
void MainWindows::OnMenuAbout(wxCommandEvent & WXUNUSED(event))
|
|
||||||
{
|
|
||||||
//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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -58,6 +58,7 @@ class MainWindows: public Singleton<MainWindows>, public MsgBroadcast
|
|||||||
void SetNoTitle(void);
|
void SetNoTitle(void);
|
||||||
// main windows widget :
|
// main windows widget :
|
||||||
GtkWidget * m_mainWindow;
|
GtkWidget * m_mainWindow;
|
||||||
|
GtkWidget * m_internalTitleLabel;
|
||||||
BufferView m_BufferView;
|
BufferView m_BufferView;
|
||||||
CodeView m_CodeView;
|
CodeView m_CodeView;
|
||||||
MenuBar m_MenuBar;
|
MenuBar m_MenuBar;
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include "MenuBar.h"
|
#include "MenuBar.h"
|
||||||
#include "ClipBoard.h"
|
#include "ClipBoard.h"
|
||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
|
#include "ColorizeManager.h"
|
||||||
|
|
||||||
#define MENU_MSG
|
#define MENU_MSG
|
||||||
const char * MSG_TogleDisplayChar = "Request a Togle of char displaying";
|
const char * MSG_TogleDisplayChar = "Request a Togle of char displaying";
|
||||||
@@ -36,6 +37,8 @@ const char * MSG_TogleAutoIndent = "Request a Togle of Auto Indent";
|
|||||||
const char * MSG_SetCharsetIso559_1 = "Set ISO 5589-1";
|
const char * MSG_SetCharsetIso559_1 = "Set ISO 5589-1";
|
||||||
const char * MSG_SetCharsetIso559_15 = "Set ISO 5589-15";
|
const char * MSG_SetCharsetIso559_15 = "Set ISO 5589-15";
|
||||||
const char * MSG_SetCharsetUTF8 = "Set UTF 8";
|
const char * MSG_SetCharsetUTF8 = "Set UTF 8";
|
||||||
|
const char * MSG_LoadColorBlack = "Load Color Black";
|
||||||
|
const char * MSG_LoadColorWhite = "Load Color White";
|
||||||
#define MSG_LINK(data)
|
#define MSG_LINK(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);
|
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_ISO_8859_15);
|
||||||
} else if (myPointer == MSG_SetCharsetUTF8) {
|
} else if (myPointer == MSG_SetCharsetUTF8) {
|
||||||
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_UTF8);
|
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);
|
m_message.PushBack(message);
|
||||||
// create ITEM
|
// create ITEM
|
||||||
GtkWidget *tmpWidget = gtk_image_menu_item_new_from_stock( title, AccelKey::getInstance()->GetAccel() );
|
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 :
|
// set grisage :
|
||||||
gtk_widget_set_sensitive(tmpWidget, enable);
|
gtk_widget_set_sensitive(tmpWidget, enable);
|
||||||
// add to the menu :
|
// add to the menu :
|
||||||
@@ -209,7 +237,7 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
|
|||||||
tmp->AddGen(GTK_STOCK_SAVE, "ctrl+s", EDN_MSG__CURRENT_SAVE, true);
|
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->AddGen(GTK_STOCK_SAVE_AS, "ctrl+shift+s", EDN_MSG__CURRENT_SAVE_AS, true);
|
||||||
tmp->AddSeparator();
|
tmp->AddSeparator();
|
||||||
tmp->AddGen(GTK_STOCK_QUIT, "ctrl+shift+q", EDN_MSG__QUIT, true);
|
tmp->AddGen(GTK_STOCK_QUIT, "ctrl+shift+q", EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION, true);
|
||||||
m_listMenu.PushBack(tmp);
|
m_listMenu.PushBack(tmp);
|
||||||
|
|
||||||
tmp = new MenuBarMain("_Edit", m_mainWidget);
|
tmp = new MenuBarMain("_Edit", m_mainWidget);
|
||||||
@@ -254,6 +282,9 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
|
|||||||
tmp->AddInternal("Set charset Internationnal (UTF 8)", NULL, MSG_SetCharsetUTF8, true);
|
tmp->AddInternal("Set charset Internationnal (UTF 8)", NULL, MSG_SetCharsetUTF8, true);
|
||||||
tmp->AddSeparator();
|
tmp->AddSeparator();
|
||||||
tmp->AddGen( "Reload Color File", NULL, EDN_MSG__RELOAD_COLOR_FILE, true);
|
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);
|
m_listMenu.PushBack(tmp);
|
||||||
/*
|
/*
|
||||||
tmp = new MenuBarMain("Project", m_mainWidget);
|
tmp = new MenuBarMain("Project", m_mainWidget);
|
||||||
|
@@ -196,11 +196,11 @@ void Search::Display(GtkWindow *parent)
|
|||||||
Edn::String myDataString = "";
|
Edn::String myDataString = "";
|
||||||
SearchData::SetSearch(myDataString);
|
SearchData::SetSearch(myDataString);
|
||||||
gtk_entry_set_text(GTK_ENTRY(m_searchEntry), myDataString.c_str());
|
gtk_entry_set_text(GTK_ENTRY(m_searchEntry), myDataString.c_str());
|
||||||
//if (0 == strlen(myDataString.c_str())) {
|
if (0 == strlen(myDataString.c_str())) {
|
||||||
m_haveSearchData = false;
|
m_haveSearchData = false;
|
||||||
//} else {
|
} else {
|
||||||
// m_haveSearchData = true;
|
m_haveSearchData = true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
SearchData::GetReplace(myDataString);
|
SearchData::GetReplace(myDataString);
|
||||||
gtk_entry_set_text(GTK_ENTRY(m_replaceEntry), myDataString.c_str());
|
gtk_entry_set_text(GTK_ENTRY(m_replaceEntry), myDataString.c_str());
|
||||||
@@ -212,17 +212,14 @@ void Search::Display(GtkWindow *parent)
|
|||||||
|
|
||||||
gtk_widget_set_sensitive(m_BtPrevious, m_haveSearchData);
|
gtk_widget_set_sensitive(m_BtPrevious, m_haveSearchData);
|
||||||
gtk_widget_set_sensitive(m_BtNext, m_haveSearchData);
|
gtk_widget_set_sensitive(m_BtNext, m_haveSearchData);
|
||||||
if (false == m_haveSearchData) {
|
// basic no search data
|
||||||
gtk_widget_set_sensitive(m_BtReplace, false);
|
gtk_widget_set_sensitive(m_BtReplace, false);
|
||||||
gtk_widget_set_sensitive(m_BtReplaceAndNext, 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set focus on a specific widget :
|
// set focus on a specific widget :
|
||||||
gtk_window_set_focus(parent, m_searchEntry);
|
//gtk_window_set_focus(parent, m_searchEntry);
|
||||||
|
gtk_widget_grab_focus(m_searchEntry);
|
||||||
|
|
||||||
// display the dialogue box
|
// display the dialogue box
|
||||||
gtk_widget_show_all(m_localDialog);
|
gtk_widget_show_all(m_localDialog);
|
||||||
@@ -331,8 +328,8 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
|
|||||||
gtk_widget_set_sensitive(self->m_BtReplace, false);
|
gtk_widget_set_sensitive(self->m_BtReplace, false);
|
||||||
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
|
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
|
||||||
} else {
|
} else {
|
||||||
gtk_widget_set_sensitive(self->m_BtReplace, self->m_haveReplaceData);
|
gtk_widget_set_sensitive(self->m_BtReplace, true);
|
||||||
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, self->m_haveReplaceData);
|
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,7 +348,12 @@ void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
|
|||||||
} else {
|
} else {
|
||||||
self->m_haveReplaceData = true;
|
self->m_haveReplaceData = true;
|
||||||
}
|
}
|
||||||
gtk_widget_set_sensitive(self->m_BtReplace, self->m_haveReplaceData);
|
if (false == self->m_haveSearchData) {
|
||||||
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, self->m_haveReplaceData);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -93,10 +93,8 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
|
|
||||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open File", NULL,
|
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open File", NULL,
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
GTK_STOCK_CANCEL, // button text
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_RESPONSE_CANCEL, // response id
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||||
GTK_STOCK_OPEN, // button text
|
|
||||||
GTK_RESPONSE_ACCEPT, // response id
|
|
||||||
NULL); // end button/response list
|
NULL); // end button/response list
|
||||||
// this element did not apear in the miniature of the windows
|
// this element did not apear in the miniature of the windows
|
||||||
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
|
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();
|
tmpString += myBuffer->GetFileName().GetShortFilename().c_str();
|
||||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
|
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
|
||||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||||
GTK_STOCK_CANCEL, // button text
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_RESPONSE_CANCEL, // response id
|
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
||||||
GTK_STOCK_SAVE, // button text
|
|
||||||
GTK_RESPONSE_ACCEPT, // response id
|
|
||||||
NULL); // end button/response list
|
NULL); // end button/response list
|
||||||
// this element did not apear in the miniature of the windows
|
// this element did not apear in the miniature of the windows
|
||||||
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
|
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
|
||||||
@@ -159,54 +155,40 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
break;
|
break;
|
||||||
case EDN_MSG__GUI_SHOW_ABOUT:
|
case EDN_MSG__GUI_SHOW_ABOUT:
|
||||||
{
|
{
|
||||||
// dlg to confirm the quit event :
|
GtkWidget *myDialog = gtk_about_dialog_new();
|
||||||
GtkWidget *myDialog = gtk_dialog_new_with_buttons("About",
|
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(myDialog), "Edn");
|
||||||
NULL,
|
gtk_about_dialog_set_version( GTK_ABOUT_DIALOG(myDialog), VERSION_TAG_NAME);
|
||||||
GTK_DIALOG_MODAL,
|
gtk_about_dialog_set_comments( GTK_ABOUT_DIALOG(myDialog), "Editeur De N'ours\n"
|
||||||
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
|
"L'Editeur Desoxyribo-Nucleique.\n"
|
||||||
NULL);
|
"Source Code Editor\n"
|
||||||
// this element did not apear in the miniature of the windows
|
"Build Time : " VERSION_BUILD_TIME);
|
||||||
gtk_window_set_skip_pager_hint(GTK_WINDOW(myDialog), TRUE);
|
gtk_about_dialog_set_copyright( GTK_ABOUT_DIALOG(myDialog), "Copyright 2010 Edouard DUPIN, all right reserved");
|
||||||
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog));
|
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"
|
||||||
GtkWidget *myLabel = gtk_label_new("");
|
"You can:\n"
|
||||||
gtk_label_set_markup (GTK_LABEL (myLabel),
|
" * Redistribute the sources code and binaries.\n"
|
||||||
"<b>Name :</b> Edn\n"
|
" * Modify the Sources code.\n"
|
||||||
"<b>Version :</b> " VERSION_TAG_NAME "\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"
|
||||||
"<b>Build Time :</b> " VERSION_BUILD_TIME "\n\n"
|
" * Redistribute the modification only if you want.\n"
|
||||||
"<b>Description :</b> Editeur De N'ours, l'Editeur Desoxyribo-Nucleique\n"
|
" * Send me the bug-fix (it could be great).\n"
|
||||||
" Source Code Editor\n\n"
|
" * Pay me a beer or some other things.\n"
|
||||||
"<b>Copyright 2010 Edouard DUPIN, all right reserved</b>\n\n"
|
" * Print the source code on WC paper ...\n\n"
|
||||||
"<b>Terms of license : </b>\n"
|
"You can NOT:\n"
|
||||||
"This software is distributed in the hope that it will be useful, but \n"
|
" * Earn money with this Software (But I can).\n"
|
||||||
"WITHOUT ANY WARRANTY\n"
|
" * Add malware in the Sources.\n"
|
||||||
" <b>You can:</b>\n"
|
" * Do something bad with the sources.\n"
|
||||||
" * Redistribute the sources code and binaries.\n"
|
" * Use it to travel in the space with a toaster.\n\n"
|
||||||
" * Modify the Sources code.\n"
|
"I reserve the right to change this licence. If it change the version of the copy you have keep its own license.");
|
||||||
" * Use a part of the sources (less than 50%) in an other software,\n"
|
gtk_about_dialog_set_wrap_license(GTK_ABOUT_DIALOG(myDialog), true);
|
||||||
" just write somewhere \"Edn is great\" visible by the user (on \n"
|
# if USE_GTK_VERSION_3_0
|
||||||
" your product or on your website with a link to my page).\n"
|
gtk_about_dialog_set_license_type(GTK_ABOUT_DIALOG(myDialog), GTK_LICENSE_CUSTOM);
|
||||||
" * Redistribute the modification only if you want.\n"
|
# endif
|
||||||
" * Send me the bug-fix (it could be great).\n"
|
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(myDialog), "http://HeeroYui.github.com/edn");
|
||||||
" * Pay me a beer or some other things.\n"
|
gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(myDialog), "Edn on github");
|
||||||
" Print the source code on WC paper ...\n"
|
const char * listAutor[] = {"Edouard DUPIN", NULL};
|
||||||
" <b>You can NOT:</b>\n"
|
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(myDialog), listAutor);
|
||||||
" * Earn money with this Software (But I can).\n"
|
// Display About
|
||||||
" * Add malware in the Sources.\n"
|
gtk_dialog_run(GTK_DIALOG(myDialog));
|
||||||
" * 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));
|
|
||||||
gtk_widget_destroy(myDialog);
|
gtk_widget_destroy(myDialog);
|
||||||
switch (result)
|
|
||||||
{
|
|
||||||
case GTK_RESPONSE_NO:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EDN_MSG__GUI_SHOW_GOTO_LINE:
|
case EDN_MSG__GUI_SHOW_GOTO_LINE:
|
||||||
@@ -250,5 +232,89 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
|||||||
gtk_widget_destroy(myDialog);
|
gtk_widget_destroy(myDialog);
|
||||||
}
|
}
|
||||||
break;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -233,7 +233,7 @@ void Highlight::Parse(int32_t start,
|
|||||||
if (metaData[kkk].beginStart <= resultat.endStop) {
|
if (metaData[kkk].beginStart <= resultat.endStop) {
|
||||||
// Remove element
|
// Remove element
|
||||||
//EDN_INFO("Erase element=" << kkk);
|
//EDN_INFO("Erase element=" << kkk);
|
||||||
metaData.Erase(kkk, kkk+1);
|
metaData.EraseLen(kkk, kkk+1);
|
||||||
// Increase the end of search
|
// Increase the end of search
|
||||||
if (kkk < metaData.Size()) {
|
if (kkk < metaData.Size()) {
|
||||||
// just befor the end of the next element
|
// just befor the end of the next element
|
||||||
|
@@ -170,7 +170,7 @@ void CTagsManager::AddToHistory(int32_t bufferID)
|
|||||||
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
|
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
|
||||||
delete(m_historyList[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
|
// add the current element
|
||||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
BufferManager *myBufferManager = BufferManager::getInstance();
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#define FONT_ITALIC_YES (1)
|
#define FONT_ITALIC_YES (1)
|
||||||
|
|
||||||
|
|
||||||
// Variables privé du namespace
|
// Variables priv<EFBFBD> du namespace
|
||||||
#define POLICE_NAME "Monospace"
|
#define POLICE_NAME "Monospace"
|
||||||
|
|
||||||
#ifdef USE_GTK_VERSION_3_0
|
#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}};
|
static cairo_font_face_t * m_cairoFont[2][2] = {{NULL, NULL},{ NULL, NULL}};
|
||||||
void Display::Init(void)
|
void Display::Init(void)
|
||||||
{
|
{
|
||||||
/*
|
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||||
charWidth = gdk_char_width(myFont[FONT_ITALIC_YES][FONT_BOLD_NO], 'Z');
|
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
|
||||||
EDN_INFO("Font Width = %d", charWidth);
|
m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
|
||||||
charHeignt = gdk_char_height(myFont[FONT_ITALIC_YES][FONT_BOLD_NO], 'Z');
|
m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_YES] = cairo_toy_font_face_create(POLICE_NAME, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
|
||||||
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);
|
|
||||||
if ( NULL == m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]) {
|
if ( NULL == m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]) {
|
||||||
EDN_ASSERT(FALSE, "basic font ERROR");
|
EDN_ASSERT(FALSE, "basic font ERROR");
|
||||||
}
|
}
|
||||||
@@ -96,10 +89,10 @@ void Display::Init(void)
|
|||||||
void Display::UnInit(void)
|
void Display::UnInit(void)
|
||||||
{
|
{
|
||||||
// clean the builder...
|
// clean the builder...
|
||||||
free(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]);
|
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_NO]);
|
||||||
free(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO]);
|
cairo_font_face_destroy(m_cairoFont[FONT_ITALIC_YES][FONT_BOLD_NO]);
|
||||||
free(m_cairoFont[FONT_ITALIC_NO][FONT_BOLD_YES]);
|
cairo_font_face_destroy(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_YES][FONT_BOLD_YES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,6 +127,7 @@ cairo_font_face_t * Display::GetFont(bool bold, bool italic)
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "DrawerManager"
|
#define __class__ "DrawerManager"
|
||||||
|
|
||||||
|
//#define megaplop mlkjmlk
|
||||||
/**
|
/**
|
||||||
* @brief DrawerManager constructor : generate a memoryDC where we can draw everything...
|
* @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 ---
|
* @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.x = x;
|
||||||
m_size.y = y;
|
m_size.y = y;
|
||||||
m_haveWork = false;
|
m_haveWork = false;
|
||||||
// Create the Cairo Element
|
|
||||||
# if USE_GTK_VERSION_3_0
|
# 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
|
# elif USE_GTK_VERSION_2_0
|
||||||
m_cairo = gdk_cairo_create(widget->window);
|
m_windows = widget->window;
|
||||||
# endif
|
# endif
|
||||||
//cairo_translate(m_cairo, 0, 7);
|
|
||||||
cairo_set_source_rgb(m_cairo, 0, 0, 0);
|
// Double buffer with previous copy management :
|
||||||
cairo_paint(m_cairo);
|
{
|
||||||
|
// 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);
|
cairo_set_font_size(m_cairo, POLICE_SIZE);
|
||||||
m_dataToDisplay[0] = '\0';
|
m_dataToDisplay[0] = '\0';
|
||||||
|
|
||||||
cairo_scale(m_cairo, 1.0, 1.0);
|
m_nbElement = 0;
|
||||||
|
|
||||||
// http://cairographics.org/FAQ/#clear_a_surface
|
// http://cairographics.org/FAQ/#clear_a_surface
|
||||||
// http://gtk.developpez.com/faq/?page=gtkwidget#GTK_WIDGET_transparent
|
// 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_paint(m_cairo);
|
||||||
//cairo_fill(m_cairo);
|
//cairo_fill(m_cairo);
|
||||||
//cairo_stroke (m_cairo);
|
//cairo_stroke (m_cairo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,6 +205,9 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
|
|||||||
*/
|
*/
|
||||||
DrawerManager::~DrawerManager()
|
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);
|
cairo_destroy(m_cairo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,16 +305,15 @@ void DrawerManager::SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32
|
|||||||
void DrawerManager::Flush(void)
|
void DrawerManager::Flush(void)
|
||||||
{
|
{
|
||||||
if (true == m_haveWork) {
|
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;
|
m_haveWork = false;
|
||||||
|
|
||||||
cairo_set_font_face(m_cairo, Display::GetFont(m_selectColor->GetBold(), m_selectColor->GetItalic()));
|
cairo_set_font_face(m_cairo, Display::GetFont(m_selectColor->GetBold(), m_selectColor->GetItalic()));
|
||||||
int32_t letterHeight = Display::GetFontHeight();
|
int32_t letterHeight = Display::GetFontHeight();
|
||||||
if (true == m_selectColor->HaveBg() ) {
|
if (true == m_selectColor->HaveBg() ) {
|
||||||
int32_t letterWidth = Display::GetFontWidth();
|
int32_t letterWidth = Display::GetFontWidth();
|
||||||
int32_t stringLen = m_nbElement;
|
|
||||||
// generate Clean BG:
|
// 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);
|
cairo_move_to(m_cairo, m_pos.x, m_pos.y+letterHeight-4);
|
||||||
m_selectColor->ApplyFG(m_cairo);
|
m_selectColor->ApplyFG(m_cairo);
|
||||||
@@ -357,9 +372,10 @@ void DrawerManager::DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y,
|
|||||||
// flush
|
// flush
|
||||||
cairo_fill(m_cairo);
|
cairo_fill(m_cairo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawerManager::DirectRectangle(color_ts &SelectColor, int32_t x, int32_t y, int32_t width, int32_t height)
|
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);
|
cairo_set_source_rgb(m_cairo, SelectColor.red, SelectColor.green, SelectColor.blue);
|
||||||
// set postion
|
// set postion
|
||||||
cairo_rectangle(m_cairo, x, y, width, height);
|
cairo_rectangle(m_cairo, x, y, width, height);
|
||||||
@@ -437,6 +453,7 @@ void DrawerManager::Cursor(int32_t x, int32_t y)
|
|||||||
cairo_rel_line_to(m_cairo, 0, -letterHeight);
|
cairo_rel_line_to(m_cairo, 0, -letterHeight);
|
||||||
}
|
}
|
||||||
cairo_stroke(m_cairo);
|
cairo_stroke(m_cairo);
|
||||||
|
//cairo_set_fill_rule(m_cairo, CAIRO_FILL_RULE_EVEN_ODD);
|
||||||
cairo_fill(m_cairo);
|
cairo_fill(m_cairo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,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...
|
/* Basic axample with cairo and pango...
|
||||||
|
@@ -52,7 +52,7 @@ class DrawerManager;
|
|||||||
class DrawerManager {
|
class DrawerManager {
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
DrawerManager(GtkWidget * widget, int32_t x, int32_t y);
|
DrawerManager(GtkWidget * widget, int32_t x, int32_t y, int32_t scrollOffset=0);
|
||||||
~DrawerManager();
|
~DrawerManager();
|
||||||
|
|
||||||
void Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
void Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
||||||
@@ -72,6 +72,7 @@ class DrawerManager {
|
|||||||
void Flush(void);
|
void Flush(void);
|
||||||
int32_t GetWidth(void) { return m_size.x; };
|
int32_t GetWidth(void) { return m_size.x; };
|
||||||
int32_t GetHeight(void) { return m_size.y; };
|
int32_t GetHeight(void) { return m_size.y; };
|
||||||
|
void TranslateVertical(int32_t nbPixelTranslation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
void DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
||||||
@@ -85,7 +86,7 @@ class DrawerManager {
|
|||||||
|
|
||||||
position_ts m_size; //!< Total size
|
position_ts m_size; //!< Total size
|
||||||
cairo_t * m_cairo; //!< Cairo Layout pointer
|
cairo_t * m_cairo; //!< Cairo Layout pointer
|
||||||
|
GdkWindow * m_windows; //!< remember the current widget ==> for some internal problems
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -646,8 +646,22 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
|
|||||||
EdnVectorBuf::Iterator myPosIt = m_data.Position(startPos);
|
EdnVectorBuf::Iterator myPosIt = m_data.Position(startPos);
|
||||||
int32_t lineCount = 0;
|
int32_t lineCount = 0;
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
GTimeVal timeStart;
|
||||||
|
if (0 == startPos) {
|
||||||
|
g_get_current_time(&timeStart);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while (myPosIt) {
|
while (myPosIt) {
|
||||||
if (myPosIt.Position() == endPos) {
|
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;
|
return lineCount;
|
||||||
}
|
}
|
||||||
if ('\n' == *myPosIt) {
|
if ('\n' == *myPosIt) {
|
||||||
@@ -655,6 +669,76 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
|
|||||||
}
|
}
|
||||||
myPosIt++;
|
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;
|
return lineCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,12 +769,21 @@ int32_t EdnBuf::CountLines(void)
|
|||||||
EdnVectorBuf::Iterator myPosIt = m_data.Begin();
|
EdnVectorBuf::Iterator myPosIt = m_data.Begin();
|
||||||
int32_t lineCount = 0;
|
int32_t lineCount = 0;
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
GTimeVal timeStart;
|
||||||
|
g_get_current_time(&timeStart);
|
||||||
|
#endif
|
||||||
while(myPosIt) {
|
while(myPosIt) {
|
||||||
if ('\n' == *myPosIt) {
|
if ('\n' == *myPosIt) {
|
||||||
lineCount++;
|
lineCount++;
|
||||||
}
|
}
|
||||||
myPosIt++;
|
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;
|
return lineCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,6 +813,12 @@ void EdnBuf::CountNumberOfLines(void)
|
|||||||
*/
|
*/
|
||||||
int32_t EdnBuf::CountForwardNLines(int32_t startPos, int32_t nLines)
|
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) {
|
if (nLines == 0) {
|
||||||
return startPos;
|
return startPos;
|
||||||
} else if (startPos > m_data.Size() ) {
|
} else if (startPos > m_data.Size() ) {
|
||||||
@@ -739,6 +838,14 @@ int32_t EdnBuf::CountForwardNLines(int32_t startPos, int32_t nLines)
|
|||||||
}
|
}
|
||||||
myPosIt++;
|
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() );
|
//EDN_INFO(" ==> (2) at position=" << myPosIt.Position() );
|
||||||
return myPosIt.Position();
|
return myPosIt.Position();
|
||||||
}
|
}
|
||||||
|
@@ -105,6 +105,7 @@ class EdnBuf {
|
|||||||
int32_t CharWidth( char c, int32_t indent); // TODO : rework this
|
int32_t CharWidth( char c, int32_t indent); // TODO : rework this
|
||||||
int32_t CountDispChars( int32_t lineStartPos, int32_t targetPos);
|
int32_t CountDispChars( int32_t lineStartPos, int32_t targetPos);
|
||||||
int32_t CountForwardDispChars( int32_t lineStartPos, int32_t nChars);
|
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( int32_t startPos, int32_t endPos);
|
||||||
int32_t CountLines( void);
|
int32_t CountLines( void);
|
||||||
int32_t CountLines( Edn::VectorType<int8_t> &data);
|
int32_t CountLines( Edn::VectorType<int8_t> &data);
|
||||||
@@ -164,7 +165,8 @@ class EdnBuf {
|
|||||||
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
|
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
|
||||||
public:
|
public:
|
||||||
void SetHLSystem( Highlight * newHLSystem);
|
void SetHLSystem( Highlight * newHLSystem);
|
||||||
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines);
|
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);
|
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
|
||||||
private:
|
private:
|
||||||
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
|
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
|
||||||
|
@@ -90,17 +90,17 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
|||||||
m_HLDataPass1.Erase(0);
|
m_HLDataPass1.Erase(0);
|
||||||
//EDN_DEBUG("1 * Erase 0");
|
//EDN_DEBUG("1 * Erase 0");
|
||||||
} else {
|
} else {
|
||||||
m_HLDataPass1.Erase(0,stopId);
|
m_HLDataPass1.EraseLen(0,stopId);
|
||||||
//EDN_DEBUG("2 * Erase 0->" << stopId);
|
//EDN_DEBUG("2 * Erase 0->" << stopId);
|
||||||
}
|
}
|
||||||
} else if(-1 == stopId) {
|
} else if(-1 == stopId) {
|
||||||
//EDN_DEBUG("3 * Erase " << startId+1 << "-> end");
|
//EDN_DEBUG("3 * Erase " << startId+1 << "-> end");
|
||||||
m_HLDataPass1.Erase(startId+1, m_HLDataPass1.Size() - startId);
|
m_HLDataPass1.EraseLen(startId+1, m_HLDataPass1.Size() - startId);
|
||||||
stopId = -1;
|
stopId = -1;
|
||||||
} else {
|
} else {
|
||||||
int32_t currentSize = m_HLDataPass1.Size();
|
int32_t currentSize = m_HLDataPass1.Size();
|
||||||
//EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
|
//EDN_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
|
||||||
m_HLDataPass1.Erase(startId+1, stopId - startId);
|
m_HLDataPass1.EraseLen(startId+1, stopId - startId);
|
||||||
if (stopId == currentSize-1) {
|
if (stopId == currentSize-1) {
|
||||||
stopId = -1;
|
stopId = -1;
|
||||||
}
|
}
|
||||||
@@ -286,6 +286,71 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
|
|||||||
return NULL;
|
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)
|
void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart, int32_t nbLines)
|
||||||
@@ -354,7 +419,6 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
|
|||||||
g_get_current_time(&timeStop);
|
g_get_current_time(&timeStop);
|
||||||
EDN_DEBUG("Display reAnnalyse = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
|
EDN_DEBUG("Display reAnnalyse = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -79,8 +79,8 @@ static char * GetMessageChar(messageType_te Id)
|
|||||||
{
|
{
|
||||||
switch(Id)
|
switch(Id)
|
||||||
{
|
{
|
||||||
MACRO_DISPLAY_MSG(EDN_MSG__QUIT)
|
|
||||||
MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_CHANGE_CURRENT)
|
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_MAIN_WINDOWS)
|
||||||
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_SEARCH)
|
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_SAVE_AS)
|
||||||
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_GOTO_LINE)
|
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_GOTO_LINE)
|
||||||
MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_ABOUT)
|
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)
|
||||||
MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_REMOVE_ALL)
|
MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_REMOVE_ALL)
|
||||||
|
@@ -38,9 +38,8 @@
|
|||||||
// the ID we'll use to identify our event
|
// the ID we'll use to identify our event
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EDN_MSG__NONE = 0,
|
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__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
|
// DESTINATION : GUI_MANAGER
|
||||||
MSG_TO_GUI_MANAGER__START,
|
MSG_TO_GUI_MANAGER__START,
|
||||||
@@ -53,6 +52,7 @@ typedef enum {
|
|||||||
EDN_MSG__GUI_SHOW_SAVE_AS,
|
EDN_MSG__GUI_SHOW_SAVE_AS,
|
||||||
EDN_MSG__GUI_SHOW_GOTO_LINE,
|
EDN_MSG__GUI_SHOW_GOTO_LINE,
|
||||||
EDN_MSG__GUI_SHOW_ABOUT,
|
EDN_MSG__GUI_SHOW_ABOUT,
|
||||||
|
EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION,
|
||||||
MSG_TO_GUI_MANAGER__STOP,
|
MSG_TO_GUI_MANAGER__STOP,
|
||||||
|
|
||||||
// DESTINATION : GUI
|
// DESTINATION : GUI
|
||||||
@@ -201,7 +201,7 @@ class MsgBroadcastCore: public Singleton<MsgBroadcastCore>
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Edn::VectorType<MsgBroadcast*> m_listMessage;
|
Edn::VectorType<MsgBroadcast*> m_listMessage;
|
||||||
uint32_t m_messageID;
|
uint32_t m_messageID;
|
||||||
Edn::VectorType<messageElement_ts> m_listOfMessage;
|
Edn::VectorType<messageElement_ts> m_listOfMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -471,7 +471,7 @@ void Edn::String::Remove(int32_t currentID, int32_t len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO : check the size of the data
|
// TODO : check the size of the data
|
||||||
m_data.Erase(currentID, len);
|
m_data.EraseLen(currentID, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -474,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] pos Position to remove the data
|
||||||
* @param[in] nbElement number of element to remove
|
* @param[in] nbElement number of element to remove
|
||||||
@@ -482,10 +508,10 @@ template<typename MY_TYPE=int32_t> class VectorType
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Erase(int32_t pos, int32_t nbElement)
|
void EraseLen(int32_t pos, int32_t nbElement)
|
||||||
{
|
{
|
||||||
if (pos>m_size) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (pos+nbElement>m_size) {
|
if (pos+nbElement>m_size) {
|
||||||
|
@@ -422,7 +422,11 @@ static uint32_t Utf8_GetValue(UTF8Element_ts &Element)
|
|||||||
int32_t strUtf8Len(const char *input_UTF8)
|
int32_t strUtf8Len(const char *input_UTF8)
|
||||||
{
|
{
|
||||||
int32_t count = 0;
|
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;
|
uint8_t tmpSize;
|
||||||
bool baseValid;
|
bool baseValid;
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
@@ -593,18 +597,18 @@ void ConvertInput(GdkEventKey *event, char* Utf8Out, bool &controlKey, bool &mov
|
|||||||
# elif USE_GTK_VERSION_2_0
|
# elif USE_GTK_VERSION_2_0
|
||||||
case GDK_KP_Tab:
|
case GDK_KP_Tab:
|
||||||
# endif
|
# endif
|
||||||
|
// shift + TAB ... same as a tab here ...
|
||||||
|
case 0xfe20: //GDK_ISO_Left_Tab
|
||||||
case 65289:
|
case 65289:
|
||||||
key = (int32_t)'\t';
|
key = (int32_t)'\t';
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_KP_Enter:
|
case GDK_KEY_KP_Enter:
|
||||||
key = GDK_KEY_Return;
|
|
||||||
break;
|
|
||||||
# elif USE_GTK_VERSION_2_0
|
# elif USE_GTK_VERSION_2_0
|
||||||
case GDK_KP_Enter:
|
case GDK_KP_Enter:
|
||||||
key = GDK_Return;
|
|
||||||
break;
|
|
||||||
# endif
|
# endif
|
||||||
|
key = '\n';
|
||||||
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_KP_F1:
|
case GDK_KEY_KP_F1:
|
||||||
case GDK_KEY_F1:
|
case GDK_KEY_F1:
|
||||||
@@ -1038,17 +1042,129 @@ void ConvertInput(GdkEventKey *event, char* Utf8Out, bool &controlKey, bool &mov
|
|||||||
# endif
|
# endif
|
||||||
key = 0x08;
|
key = 0x08;
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Transform in unicode the input :
|
// Transform in unicode the input :
|
||||||
|
//EDN_INFO("key : " << key);
|
||||||
int32_t unichar = gdk_keyval_to_unicode(key);
|
int32_t unichar = gdk_keyval_to_unicode(key);
|
||||||
|
//EDN_INFO("unichar : " << unichar);
|
||||||
if (unichar == 0) {
|
if (unichar == 0) {
|
||||||
Utf8Out[0] = (char)key;
|
Utf8Out[0] = (char)key;
|
||||||
Utf8Out[1] = '\0';
|
Utf8Out[1] = '\0';
|
||||||
|
//EDN_INFO("NON UTF8 : " << Utf8Out);
|
||||||
} else {
|
} else {
|
||||||
// Generate UTF8 form UniCode
|
// Generate UTF8 form UniCode
|
||||||
convertUnicodeToUtf8(unichar, Utf8Out);
|
convertUnicodeToUtf8(unichar, Utf8Out);
|
||||||
|
//EDN_INFO("UTF8 : " << Utf8Out);
|
||||||
#if 0
|
#if 0
|
||||||
printf(" convertUnicodeToUtf8 : \"0x%08x\" ==> unichar=%d %s\n", key, unichar, Utf8Out);
|
printf(" convertUnicodeToUtf8 : \"0x%08x\" ==> unichar=%d %s\n", key, unichar, Utf8Out);
|
||||||
for (int32_t uu=0; uu < strlen(Utf8Out); uu++) {
|
for (int32_t uu=0; uu < strlen(Utf8Out); uu++) {
|
||||||
|
191
avancement.boo
191
avancement.boo
@@ -1,130 +1,69 @@
|
|||||||
# For the first realease 1.0 :
|
|
||||||
* 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 par r<>vision) :
|
# action a faire (ordonner par r<>vision) :
|
||||||
* 0.1.X :
|
* 0.2.X :
|
||||||
- gui : demander l'enregistrement avant de fermer (quand c'est n<>cessaire)
|
- gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre)
|
||||||
- Edn::VectorType : Rewrite the erase fuction to support start => stop and Erase len methode ...
|
- gui : display partielle de la fenetre
|
||||||
* 0.2.X :
|
- gui : ascenceur quand n<>cessaire
|
||||||
- gui : Mise en place d'un display ligne par ligne
|
- gui : Demander la cr<63>ation de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
|
||||||
- gui : Demander la cr<63>ation de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
|
- sys : Mise en place des colorisation de base pour le
|
||||||
- sys : Mise en place des colorisation de base pour le
|
* java script
|
||||||
* java script
|
* SQL
|
||||||
* SQL
|
- sys : replace TAB with space when Tab is pressed
|
||||||
- gui : ascenceur quand n<>cessaire
|
- sys : Catch F[1-12] ==> for user personal event
|
||||||
- Catch Shift+TAB
|
- BUG : Correction du bug des entr<74> bizard tel que les chapot et les guillemets
|
||||||
- Correction du bug des entr<74> bizard tel que les chapot et les guillemets
|
- BUG : de copier coller sur les <20><><EFBFBD> ...
|
||||||
- pb de s<>lection quand la ligne est pleine et la premi<6D>re ligne s<>ctionn<6E>e.
|
- BUG : les caract<63>re multiples type chapot ...
|
||||||
- PB de copier coller sur les <20><><EFBFBD> ...
|
- BUG : italique non g<>n<EFBFBD>r<EFBFBD>
|
||||||
* 0.3.X :
|
* 0.3.X :
|
||||||
- Charset UTF-8 et iso 8859-15 correcte
|
- SEARCH : get selected text in the search windows
|
||||||
- Transformation de charset a la vol<6F>e
|
- SEARCH : Select the search windows when call crtl+F
|
||||||
- Charset par defaut
|
- sys : personal property file in the ~/.edn ou ~/.gnome/edn
|
||||||
- D<EFBFBD>tection de charset (<28> mettre dans les todo de charset)
|
- gui : Ordonner les fichier ouvert par nom ...
|
||||||
==> regarder les librairies open sources
|
- 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...
|
||||||
* 0.4.X :
|
- gui : Color list selection
|
||||||
- SEARCH : get selected text in the search windows
|
- gui : Hightlight gui management
|
||||||
- SEARCH : Select the search windows when call crtl+F
|
* 0.4.X :
|
||||||
- gui : ordonner les fichier ouvert par nom ...
|
- sys : Charset UTF-8 et iso 8859-15 correcte
|
||||||
* 0.5.X :
|
- sys : Transformation de charset a la vol<6F>e
|
||||||
- project : list of current files open
|
- sys : Charset par defaut
|
||||||
- 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...
|
- Sys : D<>tection de charset (<28> mettre dans les todo de charset)
|
||||||
- sys : replace ALL
|
==> regarder les librairies open sources
|
||||||
|
* 0.5.X :
|
||||||
# Text Editor
|
- prj : list of current files open
|
||||||
|
- prj : open ctags file
|
||||||
- 90% Indent group with Tabulation and shift+tabulation
|
- sys : replace ALL
|
||||||
- 100% Basic smart indent : Recopy the start of the previous line when return (copy '\t' and ' ')
|
- sys : Undo / Redo ajout de caract<63>res autre que " ", "\t" et "\n"
|
||||||
- 0% Replace Tab with space when press the key
|
* 0.6.X :
|
||||||
- 0% Request save user when quit the software
|
- sys : right management ...
|
||||||
- 0% Hide/Display scroll element when not usefull
|
- HL : Normalyse all the system of regular expression with <> chapot ...
|
||||||
- 10% Regular expression search
|
- HL : sub parsing of the reg exp
|
||||||
- 80% Colorisation syntaxique
|
- sys : update all language
|
||||||
- 80% Copier / coller ==> probleme sur les caract<63>res sp<73>ciaux comme <20> <20> <20> ...
|
* 0.7.X :
|
||||||
- 10% Search
|
- sys : Select in colones
|
||||||
- 10% Replace
|
- sys : Select all the same search in the current buffer ... ( HL en vert ou jaune ...)
|
||||||
- 80% Undo / Redo ajout de caract<63>res autre que " ", "\t" et "\n"
|
- sys : Multi-file search ==> display it in a result buffer (clickable only)
|
||||||
- 0% Selectionner en colone
|
* 0.9.X :
|
||||||
- 0% Supression multiple de ligne par la commande ctrl+D
|
- int : Redo all the doxygen ...
|
||||||
- 0% Multi-file search ==> display it in a result buffer (clickable only)
|
* 1.0.X :
|
||||||
- 0% basic UTF8 string management ==> bad with the curent buffer
|
- gui : open file in binary
|
||||||
- 0% Replace in all elements of the project file or a part
|
- sys : compare binary files
|
||||||
- 0% Multiple Text Editor in the same Time
|
- sys : compare normal files
|
||||||
- 0% Support des Macros ==> In python ??? or other ...
|
* 1.1.X :
|
||||||
|
- gui : Display content of a folder
|
||||||
# Ctags :
|
- gui : add a treeview display
|
||||||
- 100% Parse (use the ctags parser)
|
- sys : evenement losqu'un fichier est modifier a l'exterieur...
|
||||||
- 100% Find
|
- sys : image du type de fichier dans le buffer list view
|
||||||
- 50% Jump
|
* 1.2.X :
|
||||||
- 10% History of move (with display)
|
- PRJ : treeview des dossier a ouvrir
|
||||||
|
- PRJ : GUI de management
|
||||||
# Buffer Viewer :
|
- PRJ : Save all in project
|
||||||
- 100% Right menu
|
- SYS : Save all modify files
|
||||||
- 100% Display buffer in color
|
* 1.3.X :
|
||||||
- 100% Display buffer Saved / not Saved
|
- sys : version system management (git, cvs, ...)
|
||||||
- 0% Image of the type of buffer (optionnal)
|
* 1.4.X :
|
||||||
|
- SYS : Macro generation and acquisition
|
||||||
# Configuration :
|
* 1.5.X :
|
||||||
- 0% Creer une IHM pour les configurations de base
|
- GDB : Acces interne pour un debuggeur ==> comme cgdb ... avec l'acces assembleur en plus
|
||||||
- 0% Creer une IHM pour l'edition du hightliner syntaxique (quand il marchera...)
|
|
||||||
- 0% Creer une IHM pour les couleurs (voir la lier avec l'IHM pour le hightliner)
|
|
||||||
- 0% saugegarde automatique de la configuration ou sur demande...
|
|
||||||
|
|
||||||
# Project manager :
|
|
||||||
- 0% Faire un editeur des dossiers du projet a ouvrir ==> automatiquement ajouter dans les Ctags
|
|
||||||
- 0% Base
|
|
||||||
- 0% Save All
|
|
||||||
- 0% TreeView
|
|
||||||
|
|
||||||
# Tree View :
|
|
||||||
- 0% View
|
|
||||||
- 0% Open File
|
|
||||||
- 0% Jump to the curent File
|
|
||||||
- 0% Hide CVS / Git / SVN elements
|
|
||||||
|
|
||||||
# Diff :
|
|
||||||
- 0% generate a Diff between files
|
|
||||||
- 0% same in binary
|
|
||||||
|
|
||||||
# Git :
|
|
||||||
- 0% Diff with the current wersion commited (local)
|
|
||||||
- 0% Git branch local display (as gitk --all) ...
|
|
||||||
- 0% view git chawan history ... (git Log)
|
|
||||||
|
|
||||||
# CVS :
|
|
||||||
- 0% check the version with CVS
|
|
||||||
- 0% commit
|
|
||||||
- 0% display the Branch
|
|
||||||
- 0% Select a new repository ...
|
|
||||||
|
|
||||||
# Publication :
|
|
||||||
- 0% faire une publication du logiciel sur le Web... (need a stable version)
|
|
||||||
- 0% faire un package
|
|
||||||
|
|
||||||
# Repository :
|
|
||||||
- 0% create my own repository (@home)
|
|
||||||
- 0% manage right with Git
|
|
||||||
- 0% create a website fot it (@home)
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
|
|
||||||
# note utiles :
|
# note utiles :
|
||||||
http://majutsushi.github.com/tagbar/ ==> je devrais regarder ca pour savoir ce que je peux faire avec du ctags
|
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/"
|
CTags : Set the parsing methode : "ctags -R --fields=+n Sources/ /usr/include/gtk-3.0/"
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<color name="SelectedText" FG="#AAAAAA" BG="#225a09"/>
|
<color name="SelectedText" FG="#AAAAAA" BG="#225a09"/>
|
||||||
<color name="error" FG="#FF0000"/>
|
<color name="error" FG="#FF0000"/>
|
||||||
<color name="doubleQuoteText" FG="#00fF00"/>
|
<color name="doubleQuoteText" FG="#00fF00"/>
|
||||||
|
|
||||||
<!-- hightline description : -->
|
<!-- hightline description : -->
|
||||||
<color name="type" FG="#56bf10" bold="yes"/>
|
<color name="type" FG="#56bf10" bold="yes"/>
|
||||||
<color name="storageKeyword" FG="#5c8fed"/>
|
<color name="storageKeyword" FG="#5c8fed"/>
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>//</start>
|
<start>(//|@)</start>
|
||||||
<end>\n</end>
|
<end>\n</end>
|
||||||
<EscapeChar>\</EscapeChar>
|
<EscapeChar>\</EscapeChar>
|
||||||
</rule>
|
</rule>
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@for|done|do|while|in|if|then|else|fi\@</start>
|
<start>\@for|done|do|while|in|if|elif|then|else|fi\@</start>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my Variable">
|
<rule name="my Variable">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
</rule>
|
</rule>
|
||||||
<rule name="global inclusion">
|
<rule name="global inclusion">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>global </start>
|
<start>global( |\t)+</start>
|
||||||
<end>\n</end>
|
<end>\n</end>
|
||||||
<EscapeChar>\</EscapeChar>
|
<EscapeChar>\</EscapeChar>
|
||||||
</rule>
|
</rule>
|
||||||
|
2
test2.c
2
test2.c
@@ -13,7 +13,7 @@
|
|||||||
/*
|
/*
|
||||||
#if 0
|
#if 0
|
||||||
*/
|
*/
|
||||||
|
^a^a^aa
|
||||||
|
|
||||||
//#include "tools_debug.h"
|
//#include "tools_debug.h"
|
||||||
#include "tools_globals.h"
|
#include "tools_globals.h"
|
||||||
|
@@ -20,7 +20,7 @@ static gboolean expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_d
|
|||||||
static void clicked(GtkWindow *win, GdkEventButton *event, gpointer user_data);
|
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};
|
const GdkRGBA color = { 1.0, 1.0, 0.0, 0.0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -36,6 +36,9 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
gtk_widget_set_app_paintable(window, TRUE);
|
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
|
# if USE_GTK_VERSION_3_0
|
||||||
g_signal_connect(G_OBJECT(window), "draw", G_CALLBACK(expose), NULL);
|
g_signal_connect(G_OBJECT(window), "draw", G_CALLBACK(expose), NULL);
|
||||||
# elif USE_GTK_VERSION_2_0
|
# elif USE_GTK_VERSION_2_0
|
||||||
@@ -60,17 +63,17 @@ int main(int argc, char **argv)
|
|||||||
&color);
|
&color);
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
|
//gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
|
||||||
gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
|
//gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
|
||||||
g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(clicked), NULL);
|
/* //g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(clicked), NULL);
|
||||||
|
|
||||||
GtkWidget* fixed_container = gtk_fixed_new();
|
GtkWidget* fixed_container = gtk_fixed_new();
|
||||||
gtk_container_add(GTK_CONTAINER(window), fixed_container);
|
gtk_container_add(GTK_CONTAINER(window), fixed_container);
|
||||||
GtkWidget* button = gtk_button_new_with_label("button1");
|
GtkWidget* button = gtk_button_new_with_label("button1");
|
||||||
gtk_widget_set_size_request(button, 100, 100);
|
gtk_widget_set_size_request(button, 100, 100);
|
||||||
gtk_container_add(GTK_CONTAINER(fixed_container), button);
|
gtk_container_add(GTK_CONTAINER(fixed_container), button);
|
||||||
|
*/
|
||||||
screen_changed(window, NULL, NULL);
|
//screen_changed(window, NULL, NULL);
|
||||||
|
|
||||||
gtk_widget_show_all(window);
|
gtk_widget_show_all(window);
|
||||||
gtk_main();
|
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)
|
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 */
|
//return FALSE;
|
||||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
GdkWindow * m_windows = NULL;
|
||||||
cairo_paint (cr);
|
# 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);
|
cairo_destroy(cr);
|
||||||
|
|
||||||
|
292
test_transparence2.c
Normal file
292
test_transparence2.c
Normal 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;
|
||||||
|
}
|
Reference in New Issue
Block a user