84 Commits
0.1.1 ... 0.3.0

Author SHA1 Message Date
a9eb976b48 Remove Keybord special key to the abstraction layer 2012-01-19 18:14:57 +01:00
411bf03e74 Correction of the CR comming from X11 2012-01-18 22:56:14 +01:00
a53903d628 Start the change of the display methode 2012-01-18 18:54:55 +01:00
f3bf0b557c Display none Mono-space Text 2012-01-18 14:31:33 +01:00
6f6b0a6f7f Add shortcut and management of move event in codeViewer 2012-01-17 15:35:34 +01:00
43d8aaef48 Display a correct cursor 2012-01-17 09:52:50 +01:00
9c9eac7d37 Text background correction done 2012-01-17 09:39:38 +01:00
c61876b919 Some correction of the Display color is now availlable 2012-01-16 14:37:28 +01:00
10ceb14268 Add and remove char in the buffer 2012-01-15 16:09:32 +01:00
8c014312c6 Scrool up and down and click availlable ==> no display 2012-01-15 15:42:01 +01:00
01868a2114 First display in open GL 2012-01-15 14:15:24 +01:00
bd7aa98324 Starting integration of the main display in EWOL system 2012-01-13 13:06:15 +01:00
70837bd769 First compilation of edn with ewol ==> did not work at all 2012-01-11 15:27:18 +01:00
2d355d05c6 First move for ewol adaptation 2012-01-11 12:51:26 +01:00
a6e583f8c9 Remove deprecated files before the ewol adaptation 2012-01-11 12:08:00 +01:00
870e127932 Add java language parsing based on C language.
Yes I did not like JAVA, but I needed it for the Android application
2011-12-01 09:59:46 +01:00
a351fe72bd Add Edn at the list of the gnome software 2011-11-24 16:50:04 +01:00
9b7707cf9a Display: change the internal title display 2011-11-02 09:09:20 +01:00
heero
a03fb96dc9 Display: corection of the first line selection error 2011-10-16 15:17:45 +02:00
863fab113b add patch correction done in branch display line by line
stop the developpement of the display line by line because it did not work corectly and was a little cpu leacher, the display has maany error and the comphehention is hard.
2011-10-11 14:06:36 +02:00
83dd23b8a9 try to find the error of italic, it seam that cairo does not support monospace italic 2011-09-06 17:05:06 +02:00
2714560c38 SYS : Indent with TAB only when multiple line selected 2011-09-06 09:11:51 +02:00
e48c75df72 gui : Add the current folder in the title area 2011-09-05 10:02:17 +02:00
1de1f787e7 sys : corection of the keypad enter and add the shift+enter replacement with \r 2011-09-05 09:50:15 +02:00
1b3dd3ce98 SYS : catch the shift+tab event 2011-09-04 12:08:48 +02:00
0e6c34d2a0 change the avancement list ==> set it to mabage future version developement 2011-09-04 11:23:01 +02:00
325034bbc0 HL : add bash elif 2011-09-02 17:22:07 +02:00
fc9b98f09e TEST : color changing of menu 2011-09-01 17:58:04 +02:00
a497b028ca GUI : update the display of the about windows to use gtk:about 2011-09-01 16:04:12 +02:00
88b76c074d SYS : Add a Edn:VectorType eraseLen and an erase ==> normalisation with std::vector 2011-09-01 14:34:06 +02:00
28b709bfb8 SYS : Confirm Save when exit 2011-09-01 13:38:12 +02:00
1c01dbd7cd SYS : Change position of the close request message ==> the good position 2011-09-01 09:45:37 +02:00
948240f05f LOG : Remove the change state of the Main windows 2011-08-31 10:11:22 +02:00
990828c69c Error in installation of software 2011-08-31 10:10:03 +02:00
72f63a8990 DISPLAY : add a menu to change the color on the fly 2011-08-31 09:42:30 +02:00
4d2eced7a0 Change name of readme 2011-08-30 09:43:45 +02:00
6598a22981 change format of github readme 2011-08-30 09:42:14 +02:00
01276b581f SEARCH : Change the hide policy 2011-08-26 17:59:38 +02:00
fd13467832 REPLACE : addition done 2011-08-24 12:13:57 +02:00
643f2e38b3 CTAGS : Back is done but the display result is not the best I can do... 2011-08-24 09:44:10 +02:00
c30f57b3f7 GUI : change some displayable element : think at a new methode of gui will be organized 2011-08-19 18:10:46 +02:00
514a5cf003 GUI : Reload on the fly the Color file 2011-08-19 16:09:58 +02:00
0c1f6004eb GUI : Maximisation remove the 'decoration of the windows' ==> need to be an option 2011-08-18 22:50:29 +02:00
c02747d8fb GUI : Add the basic icon for Edn ... must change the color, maybe 2011-08-17 12:24:51 +02:00
80dae2dab9 MAKEFILE : Remove the Abstraction Layer (deprecated) 2011-08-17 12:23:27 +02:00
bd8c11a9da LANG : Add matlab basic parser (not compleate)
HL : Corection of a parser bug
2011-08-16 10:01:28 +02:00
1f08a99ac1 CTAGS : multiple jump OK ... ==> need to go back now... 2011-08-14 11:32:31 +02:00
0eeb214369 HL : Add bash colorisation (basic) 2011-08-12 16:56:32 +02:00
f5911d5463 CTAGS : Set the display of the file for the multiple jump list .
TODO : Set the selection keep when press jump button
TODO : Double click on a specific raw
2011-08-10 15:56:48 +02:00
1f8d3cf045 Remove tag file in the repository 2011-08-10 09:20:54 +02:00
54cc9da39f HL : End of the parsing Error corection 2011-08-09 17:07:03 +02:00
7562c45aa7 CONFIG : update the xml parsing config : XML and boo files 2011-08-09 15:11:58 +02:00
d96a133c6a HL : Correction of a bug of reparsing the buffer betwwen 2 element Erase was not implemented as std::vector ==> I might change this ... 2011-08-09 14:28:58 +02:00
5a47446a09 Remove warning and Custom menuContext 2011-08-08 14:15:44 +02:00
a196c615bf Remove std::vector and std::string from the sources for reson of portability 2011-08-08 14:06:11 +02:00
2c6f280c58 new parsing mode of HL Done with success ==> can have some residual errors
TODO : Recursive Hightlight
2011-08-08 10:24:24 +02:00
722dafaaef base aof te new hilight system 2011-08-07 22:34:27 +02:00
45b4dca615 error whith the Highlight detection 2011-08-07 10:47:06 +02:00
322120a3f3 create the debian package and change the tag name methode 2011-08-06 12:20:08 +02:00
f5993b3f8b remove display of the dialogue from the miniature element 2011-08-05 15:12:40 +02:00
82af3768b0 remove the search windows from the task bar and the miniature bar 2011-08-05 15:10:29 +02:00
4c5f3a0424 String stream and file stream is now OK 2011-08-05 15:03:05 +02:00
7b303d2aad Edn::File is now implemented an integrated in the system ==> test is OK 2011-08-05 14:31:47 +02:00
ff055b88d4 create a class Edn::File that manage the modification of the falineme to get the real filename in the system ==> dit not work corectly... 2011-08-04 18:18:54 +02:00
55681d1dac try to create a real file viewer 2011-08-03 18:01:04 +02:00
ab74a7c516 Correction of a bug in the context menu 2011-08-03 14:47:14 +02:00
1fa86b3b03 Add the context menu for the bufferViewer element 2011-08-03 14:39:39 +02:00
dbade0e4e6 try to set a list when ctags requested and basic realpath for file class 2011-08-02 18:01:30 +02:00
356d7621ae remove from todo list and update license 2011-08-01 18:17:43 +02:00
896beaa4fd Add the goto line number dialogue 2011-08-01 10:01:26 +02:00
7b476ebc49 real installation of edn software in /usr/bin and /usr/shared/edn/... 2011-08-01 09:17:01 +02:00
83f1e2e5b5 add php basic language interpretation 2011-07-31 15:30:11 +02:00
396b03bd42 remove vector (not ready), and correct display error in gtk 3.0 2011-07-31 11:58:44 +02:00
e3e868f351 debut de déplacement du vecteur 2011-07-29 17:07:46 +02:00
0fe575e432 move EdnVectorBin in Edn::VectorType 2011-07-29 13:37:09 +02:00
45aad6b2e2 Mise en place des RegExp en Template ==> OK 2011-07-29 10:44:12 +02:00
f9418d665e mise en place d'un system de RegExp en Template (Non Fonctionnel...) 2011-07-28 18:07:46 +02:00
a751e602ad context menu base 2011-07-27 18:20:13 +02:00
d92945717d some work ... 2011-07-26 17:25:45 +02:00
4da853c367 Correct some display error 2011-07-25 18:01:54 +02:00
dad2057818 test the transparency 2011-07-24 20:25:34 +02:00
088f89d421 try a menu context display 2011-07-22 18:31:43 +02:00
5ff5525c6b Add the version name and compilation date in the About dialog 2011-07-22 10:50:47 +02:00
b3d776b723 add the about dialog 2011-07-22 07:47:25 +02:00
147 changed files with 15791 additions and 17887 deletions

2
.gitignore vendored
View File

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

315
Makefile
View File

@@ -1,290 +1,59 @@
##################################################################################################################
# #
# Fichier : Makefile #
# #
# Type : Makefile d'un programme complet #
# #
# Auteur : Heero Yui #
# #
# Evolutions : Date Auteur Raison #
# 2010-01-29 Heero Yui Mise en place d'un makefile ultra simple #
# 2011-07-14 Heero Yui Rework the current dorder includion (simplification) #
# #
# Notes : This makefile might be edited with an editor compatible with escape char and carrer return #
# char #
# #
# Concu Pour le projet edn #
# #
##################################################################################################################
export F_GRAS=
export F_INVERSER=
export F_SOUSLIGNER=
export F_NORMALE=
export F_NOIR=
export F_ROUGE=
export F_VERT=
export F_MARRON=
export F_BLUE=
export F_VIOLET=
export F_CYAN=
export F_GRIS=
export CADRE_HAUT_BAS=' $(F_INVERSER) $(F_NORMALE)'
export CADRE_COTERS='
$(F_INVERSER) $(F_NORMALE) $(F_INVERSER) $(F_NORMALE)'
###############################################################################
###############################################################################
### Some Preject properties : ###
###############################################################################
###############################################################################
CXX=g++
CC=gcc
PROJECT_PATH=$(shell pwd)
ifeq ($(PLATFORM), Linux)
PROJECT_NDK?=$(PROJECT_PATH)/../ewol/
else ifeq ($(PLATFORM), Android)
PROJECT_NDK?=$(PROJECT_PATH)/../android/ndk-r7/
PROJECT_SDK?=$(PROJECT_PATH)/../android/sdk-r15/
endif
PROJECT_MODULE?=$(PROJECT_PATH)/../
EWOL_FOLDER=$(PROJECT_MODULE)ewol
# group name or constructor ... (no dot, no MAJ no Numerical char)
PROJECT_VENDOR=heeroyui
# Binary name ... (no dot, no MAJ no Numerical char)
PROJECT_NAME=edn
#dependence of the librairies :
#PROJECT_LIB_DEPENDENCY= ewol
PROJECT_FILE_DIRECTORY=jni
# get the tag of the current project :
PROJECT_VERSION_TAG=$(shell git describe --tags)
#$(info Project version TAG : $(PROJECT_VERSION_TAG))
PROJECT_VERSION_TAG_SHORT=$(shell git describe --tags --abbrev=0)
#$(info Project version TAG Short: $(PROJECT_VERSION_TAG_SHORT))
# enable or disable debug :
DEBUG:=1
###############################################################################
### Compilation Define ###
###############################################################################
ifeq ("$(DEBUG)", "0")
ifeq ("$(DEBUG)", "0")
PROJECT_CXXFLAGS = -DPROJECT_DEBUG_LEVEL=1
PROJECT_CXXFLAGS+= -DPROJECT_NDEBUG
PROJECT_CXXFLAGS+= -DPROJECT_VERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
else
else
PROJECT_CXXFLAGS = -DPROJECT_DEBUG_LEVEL=3
PROJECT_CXXFLAGS+= -DPROJECT_VERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
endif
PROJECT_CXXFLAGS+= -DPROJECT_VERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
GTKFLAGS=
ifeq ($(shell if `pkg-config --exists gtk+-3.0` ; then echo "yes"; else echo "no"; fi), yes)
GTKFLAGS= `pkg-config --cflags --libs gtk+-3.0` -DUSE_GTK_VERSION_3_0
else
ifeq ($(shell if `pkg-config --exists gtk+-2.0` ; then echo "yes"; else echo "no"; fi), yes)
GTKFLAGS= `pkg-config --cflags --libs gtk+-2.0` -DUSE_GTK_VERSION_2_0
else
$(error No GTK 3.0 or 2.0 librairies ...)
endif
PROJECT_CXXFLAGS+= -I$(EWOL_FOLDER)/Sources/
###############################################################################
### Basic Cfags ###
###############################################################################
# basic GTK librairy
CXXFLAGS= $(GTKFLAGS)
# Linux thread system
CXXFLAGS+= -lpthread
# Enable debug (cgdb edn)
CXXFLAGS+= -g -O0
#CXXFLAGS+= -O2
# display all flags
CXXFLAGS+= -Wall
# ...
CXXFLAGS+= -D_REENTRANT
# internal defines
CXXFLAGS+= $(DEFINE)
CFLAGS= $(CXXFLAGS) -std=c99
# basic GTK librairy
LDFLAGS= $(GTKFLAGS)
# Linux thread system
LDFLAGS+= -lpthread
# Dynamic connection of the CALLBACK of the GUI
LDFLAGS+= -Wl,--export-dynamic
###############################################################################
### Project Name ###
###############################################################################
PROG_NAME=edn
###############################################################################
### Basic Project description Files ###
###############################################################################
FILE_DIRECTORY=Sources
OUTPUT_NAME_RELEASE=$(PROG_NAME)_release
OUTPUT_NAME_DEBUG=$(PROG_NAME)_debug
OBJECT_DIR=Object
ifeq ("$(DEBUG)", "0")
OBJECT_DIRECTORY=$(OBJECT_DIR)/release
OUTPUT_NAME = $(OUTPUT_NAME_RELEASE)
else
OBJECT_DIRECTORY=$(OBJECT_DIR)/debug
OUTPUT_NAME = $(OUTPUT_NAME_DEBUG)
endif
###############################################################################
### Generique dependency ###
###############################################################################
MAKE_DEPENDENCE=Makefile
###############################################################################
### Files Listes ###
###############################################################################
# tiny XML (extern OPEN Sources) :
CXXFILES = tools/tinyXML/tinyxml.cpp \
tools/tinyXML/tinyxmlparser.cpp \
tools/tinyXML/tinyxmlerror.cpp \
tools/tinyXML/tinystr.cpp
# ExuberantCtags reading file tools (extern OPEN Sources) :
CXXFILES+= ctags/readtags.cpp \
ctags/CTagsManager.cpp
# Globals debug tool:
CXXFILES+= tools/debug/tools_debug.cpp \
tools/globals/tools_globals.cpp \
tools/memory/toolsMemory.cpp
# Buffers internal:
CXXFILES+= tools/EdnTemplate/EdnVectorBuf.cpp \
tools/EdnBuf/EdnBuf.cpp \
tools/EdnBuf/EdnBuf_HighLight.cpp \
tools/EdnBuf/EdnBuf_History.cpp \
tools/EdnBuf/EdnBuf_Selection.cpp \
tools/EdnBuf/EdnBufHistory.cpp
# Tools internal:
CXXFILES+= tools/AL/AL_Mutex.cpp \
tools/Display/Display.cpp \
tools/ClipBoard/ClipBoard.cpp \
tools/MsgBroadcast/MsgBroadcast.cpp \
tools/MsgBroadcast/AccelKey.cpp \
tools/charset/charsetTable.cpp \
tools/charset/charset.cpp \
tools/EdnRegExp/EdnRegExp.cpp \
tools/NameSpaceEdn/File.cpp \
tools/NameSpaceEdn/String.cpp
# Gui:
CXXFILES+= CustumWidget/BufferView/BufferView.cpp \
CustumWidget/CodeView/CodeView.cpp \
GuiTools/WindowsManager/WindowsManager.cpp \
GuiTools/MainWindows/MainWindows.cpp \
GuiTools/MainWindows/StatusBar.cpp \
GuiTools/MainWindows/MenuBar.cpp \
GuiTools/MainWindows/ToolBar.cpp \
GuiTools/Search/Search.cpp \
GuiTools/Search/SearchData.cpp
# Basic Interface :
CXXFILES+= Buffer/Buffer.cpp \
Buffer/BufferText.cpp \
Buffer/BufferEmpty.cpp \
Buffer/BufferManager.cpp \
Colorize/Colorize.cpp \
Colorize/ColorizeManager.cpp \
Highlight/HighlightPattern.cpp \
Highlight/Highlight.cpp \
Highlight/HighlightManager.cpp
# Main entry file :
CXXFILES+= init.cpp
###############################################################################
### Liste of folder where .h can be ###
###############################################################################
LISTE_MODULES = $(dir $(CXXFILES))
INCLUDE_DIRECTORY = $(addprefix -I$(FILE_DIRECTORY)/, $(LISTE_MODULES))
###############################################################################
### Build Object Files List ###
###############################################################################
OBJ = $(addprefix $(OBJECT_DIRECTORY)/, $(CXXFILES:.cpp=.o))
###############################################################################
### Main Part of Makefile ###
###############################################################################
all: build
-include $(OBJ:.o=.d)
build: .encadrer $(OUTPUT_NAME)
.encadrer:
@echo $(CADRE_HAUT_BAS)
@echo $(CADRE_COTERS)
@echo '
DEBUT DE COMPILATION DU PROGRAMME :'$(CADRE_COTERS)
@echo '
Repertoire Sources : $(FILE_DIRECTORY)/'$(CADRE_COTERS)
@echo '
Repertoire object : $(OBJECT_DIRECTORY)/'$(CADRE_COTERS)
@echo '
Binaire de sortie : $(F_VIOLET)$(OUTPUT_NAME) / $(OUTPUT_NAME)-stripped$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@mkdir -p $(addprefix $(OBJECT_DIRECTORY)/, $(LISTE_MODULES))
@mkdir -p ~/.bin
FILE_IMAGES= data/imagesSources/*.png
# Tool used to create a binary version of every element png or other needed by the application
pngToCpp: tools/pngToCpp/pngToCpp.c
@echo $(F_ROUGE)"
(bin) $@"$(F_NORMALE)
@$(CXX) $< -o $@
@strip -s $@
# Generate basic
$(FILE_DIRECTORY)/GuiTools/myImage.cpp: $(FILE_IMAGES) $(MAKE_DEPENDENCE) pngToCpp
@echo $(F_BLUE)"
(.cpp) *.png ==> $@"$(F_NORMALE)
@#echo ./pngToCpp $@ $(FILE_IMAGES)
@./pngToCpp $@ $(FILE_IMAGES)
# build C++
$(OBJECT_DIRECTORY)/%.o: $(FILE_DIRECTORY)/%.cpp $(MAKE_DEPENDENCE)
@echo $(F_VERT)"
(.o) $<"$(F_NORMALE)
@#echo $(CXX) $< -c -o $@ $(INCLUDE_DIRECTORY) $(CXXFLAGS) -MMD
@$(CXX) $< -c -o $@ $(INCLUDE_DIRECTORY) $(CXXFLAGS) -MMD
# build binary Release Mode
$(OUTPUT_NAME_RELEASE): $(OBJ) $(MAKE_DEPENDENCE)
@echo $(F_ROUGE)"
(bin) $@ "$(F_NORMALE)
@$(CXX) $(OBJ) $(LDFLAGS) -o $@
@cp $@ $(PROG_NAME)
# build binary Debug Mode
$(OUTPUT_NAME_DEBUG): $(OBJ) $(MAKE_DEPENDENCE)
@echo $(F_ROUGE)"
(bin) $@ "$(F_NORMALE)
@$(CXX) $(OBJ) $(LDFLAGS) -o $@
@cp $@ $(PROG_NAME)
clean:
@echo $(CADRE_HAUT_BAS)
@echo ' CLEANING : $(F_VIOLET)$(OUTPUT_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@echo Remove Folder : $(OBJECT_DIR)
@rm -rf $(OBJECT_DIR)
@echo Remove File : $(PROG_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
@rm -f $(PROG_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
@echo Remove File : pngToCpp
@rm -f pngToCpp
@echo Remove File : $(FILE_DIRECTORY)/GuiTools/myImage.*
@rm -f $(FILE_DIRECTORY)/GuiTools/myImage.*
@echo Remove doxygen files : doxygen/*
@rm -rf doxygen
@rm -f doxygen.log
@echo Remove temporary files *.bck
@rm -f `find . -name "*.bck"`
count:
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
install: .encadrer $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS)
PROJECT_LDFLAGS= -L$(EWOL_FOLDER)
#include the specific platefom makefile
include $(EWOL_FOLDER)/Build/Makefile.$(PLATFORM).mk

340
Makefile_old Normal file
View File

@@ -0,0 +1,340 @@
##################################################################################################################
# #
# Fichier : Makefile #
# #
# Type : Makefile d'un programme complet #
# #
# Auteur : Heero Yui #
# #
# Evolutions : Date Auteur Raison #
# 2010-01-29 Heero Yui Mise en place d'un makefile ultra simple #
# 2011-07-14 Heero Yui Rework the current dorder includion (simplification) #
# #
# Notes : This makefile might be edited with an editor compatible with escape char and carrer return #
# char #
# #
# Concu Pour le projet edn #
# #
##################################################################################################################
export F_GRAS=
export F_INVERSER=
export F_SOUSLIGNER=
export F_NORMALE=
export F_NOIR=
export F_ROUGE=
export F_VERT=
export F_MARRON=
export F_BLUE=
export F_VIOLET=
export F_CYAN=
export F_GRIS=
export CADRE_HAUT_BAS=' $(F_INVERSER) $(F_NORMALE)'
export CADRE_COTERS='
$(F_INVERSER) $(F_NORMALE) $(F_INVERSER) $(F_NORMALE)'
VERSION_TAG=$(shell git describe --tags)
#$(info $(VERSION_TAG))
VERSION_TAG_SHORT=$(shell git describe --tags --abbrev=0)
#$(info $(VERSION_TAG_SHORT))
VERSION_BUILD_TIME=$(shell date)
#$(info $(VERSION_BUILD_TIME))
###############################################################################
### Compilateur base system ###
###############################################################################
CXX=g++
CC=gcc
AR=ar
DEBUG:=1
###############################################################################
### Compilation Define ###
###############################################################################
ifeq ("$(DEBUG)", "0")
DEFINE= -DEDN_DEBUG_LEVEL=1 -DNDEBUG -DVERSION_TAG_NAME="\"$(VERSION_TAG)-release\""
else
DEFINE= -DEDN_DEBUG_LEVEL=3 -DVERSION_TAG_NAME="\"$(VERSION_TAG)-debug\""
endif
DEFINE+= -DVERSION_BUILD_TIME="\"$(VERSION_BUILD_TIME)\""
GTKFLAGS=
ifeq ($(shell if `pkg-config --exists gtk+-3.0` ; then echo "yes"; else echo "no"; fi), yes)
GTKFLAGS= `pkg-config --cflags --libs gtk+-3.0` -DUSE_GTK_VERSION_3_0
else
ifeq ($(shell if `pkg-config --exists gtk+-2.0` ; then echo "yes"; else echo "no"; fi), yes)
GTKFLAGS= `pkg-config --cflags --libs gtk+-2.0` -DUSE_GTK_VERSION_2_0
else
$(error No GTK 3.0 or 2.0 librairies ...)
endif
endif
###############################################################################
### Basic Cfags ###
###############################################################################
# basic GTK librairy
CXXFLAGS= $(GTKFLAGS)
# Linux thread system
CXXFLAGS+= -lpthread
# Enable debug (cgdb edn)
CXXFLAGS+= -g -O0
#CXXFLAGS+= -O2
# display all flags
CXXFLAGS+= -Wall
# ...
CXXFLAGS+= -D_REENTRANT
# internal defines
CXXFLAGS+= $(DEFINE)
CFLAGS= $(CXXFLAGS) -std=c99
# basic GTK librairy
LDFLAGS= $(GTKFLAGS)
# Linux thread system
LDFLAGS+= -lpthread
# Dynamic connection of the CALLBACK of the GUI
LDFLAGS+= -Wl,--export-dynamic
###############################################################################
### Project Name ###
###############################################################################
PROG_NAME=edn
###############################################################################
### Basic Project description Files ###
###############################################################################
FILE_DIRECTORY=Sources
OUTPUT_NAME_RELEASE=$(PROG_NAME)_release
OUTPUT_NAME_DEBUG=$(PROG_NAME)_debug
OBJECT_DIR=Object
ifeq ("$(DEBUG)", "0")
OBJECT_DIRECTORY=$(OBJECT_DIR)/release
OUTPUT_NAME = $(OUTPUT_NAME_RELEASE)
else
OBJECT_DIRECTORY=$(OBJECT_DIR)/debug
OUTPUT_NAME = $(OUTPUT_NAME_DEBUG)
endif
###############################################################################
### Generique dependency ###
###############################################################################
MAKE_DEPENDENCE=Makefile
###############################################################################
### Files Listes ###
###############################################################################
# tiny XML (extern OPEN Sources) :
CXXFILES = tools/tinyXML/tinyxml.cpp \
tools/tinyXML/tinyxmlparser.cpp \
tools/tinyXML/tinyxmlerror.cpp \
tools/tinyXML/tinystr.cpp
# ExuberantCtags reading file tools (extern OPEN Sources) :
CXXFILES+= ctags/readtags.cpp \
ctags/CTagsManager.cpp
# Globals debug tool:
CXXFILES+= tools/debug/tools_debug.cpp \
tools/globals/tools_globals.cpp \
tools/memory/toolsMemory.cpp
# Buffers internal:
CXXFILES+= tools/EdnTemplate/EdnVectorBuf.cpp \
tools/EdnBuf/EdnBuf.cpp \
tools/EdnBuf/EdnBuf_HighLight.cpp \
tools/EdnBuf/EdnBuf_History.cpp \
tools/EdnBuf/EdnBuf_Selection.cpp \
tools/EdnBuf/EdnBufHistory.cpp
# Tools internal:
CXXFILES+= tools/Display/Display.cpp \
tools/ClipBoard/ClipBoard.cpp \
tools/MsgBroadcast/MsgBroadcast.cpp \
tools/MsgBroadcast/AccelKey.cpp \
tools/charset/charsetTable.cpp \
tools/charset/charset.cpp \
tools/NameSpaceEdn/File.cpp \
tools/NameSpaceEdn/String.cpp \
tools/NameSpaceEdn/RegExp.cpp
# Gui:
CXXFILES+= CustumWidget/BufferView/BufferView.cpp \
CustumWidget/CodeView/CodeView.cpp \
GuiTools/WindowsManager/WindowsManager.cpp \
GuiTools/MainWindows/MainWindows.cpp \
GuiTools/MainWindows/StatusBar.cpp \
GuiTools/MainWindows/MenuBar.cpp \
GuiTools/MainWindows/ToolBar.cpp \
GuiTools/Search/Search.cpp \
GuiTools/Search/SearchData.cpp
# Basic Interface :
CXXFILES+= Buffer/Buffer.cpp \
Buffer/BufferText.cpp \
Buffer/BufferEmpty.cpp \
Buffer/BufferManager.cpp \
Colorize/Colorize.cpp \
Colorize/ColorizeManager.cpp \
Highlight/HighlightPattern.cpp \
Highlight/Highlight.cpp \
Highlight/HighlightManager.cpp
# Main entry file :
CXXFILES+= init.cpp
###############################################################################
### Liste of folder where .h can be ###
###############################################################################
LISTE_MODULES = $(dir $(CXXFILES))
INCLUDE_DIRECTORY = $(addprefix -I$(FILE_DIRECTORY)/, $(LISTE_MODULES))
###############################################################################
### Build Object Files List ###
###############################################################################
OBJ = $(addprefix $(OBJECT_DIRECTORY)/, $(CXXFILES:.cpp=.o))
###############################################################################
### Main Part of Makefile ###
###############################################################################
all: build
-include $(OBJ:.o=.d)
build: .encadrer .versionFile $(OUTPUT_NAME)
.encadrer:
@echo $(CADRE_HAUT_BAS)
@echo $(CADRE_COTERS)
@echo '
DEBUT DE COMPILATION DU PROGRAMME :'$(CADRE_COTERS)
@echo '
Repertoire Sources : $(FILE_DIRECTORY)/'$(CADRE_COTERS)
@echo '
Repertoire object : $(OBJECT_DIRECTORY)/'$(CADRE_COTERS)
@echo '
Binaire de sortie : $(F_VIOLET)$(OUTPUT_NAME) $(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@mkdir -p $(addprefix $(OBJECT_DIRECTORY)/, $(LISTE_MODULES))
FILE_IMAGES= data/imagesSources/*.png
.versionFile :
@rm -f $(OBJECT_DIRECTORY)/GuiTools/WindowsManager/WindowsManager.o
# Tool used to create a binary version of every element png or other needed by the application
pngToCpp: tools/pngToCpp/pngToCpp.c
@echo $(F_ROUGE)"
(bin) $@"$(F_NORMALE)
@$(CXX) $< -o $@
@strip -s $@
# Generate basic
$(FILE_DIRECTORY)/GuiTools/myImage.cpp: $(FILE_IMAGES) $(MAKE_DEPENDENCE) pngToCpp
@echo $(F_BLUE)"
(.cpp) *.png ==> $@"$(F_NORMALE)
@./pngToCpp $@ $(FILE_IMAGES)
# build C++
$(OBJECT_DIRECTORY)/%.o: $(FILE_DIRECTORY)/%.cpp $(MAKE_DEPENDENCE)
@echo $(F_VERT)"
(.o) $<"$(F_NORMALE)
@$(CXX) $< -c -o $@ $(INCLUDE_DIRECTORY) $(CXXFLAGS) -MMD
# build binary Release Mode
$(OUTPUT_NAME_RELEASE): $(OBJ) $(MAKE_DEPENDENCE)
@echo $(F_ROUGE)"
(bin) $@ "$(F_NORMALE)
@$(CXX) $(OBJ) $(LDFLAGS) -o $@
@cp $@ $(PROG_NAME)
# build binary Debug Mode
$(OUTPUT_NAME_DEBUG): $(OBJ) $(MAKE_DEPENDENCE)
@echo $(F_ROUGE)"
(bin) $@ "$(F_NORMALE)
@$(CXX) $(OBJ) $(LDFLAGS) -o $@
@cp $@ $(PROG_NAME)
clean:
@echo $(CADRE_HAUT_BAS)
@echo ' CLEANING : $(F_VIOLET)$(OUTPUT_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@echo Remove Folder : $(OBJECT_DIR)
@rm -rf $(OBJECT_DIR)
@echo Remove File : $(PROG_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
@rm -f $(PROG_NAME) $(OUTPUT_NAME_DEBUG) $(OUTPUT_NAME_RELEASE)
@echo Remove File : pngToCpp
@rm -f pngToCpp
@echo Remove File : $(FILE_DIRECTORY)/GuiTools/myImage.*
@rm -f $(FILE_DIRECTORY)/GuiTools/myImage.*
@echo Remove doxygen files : doxygen/*
@rm -rf doxygen
@rm -f doxygen.log
@echo Remove temporary files *.bck
@rm -f `find . -name "*.bck"`
count:
wc -l Makefile `find $(FILE_DIRECTORY)/ -name "*.cpp"` `find $(FILE_DIRECTORY)/ -name "*.h"`
install: .encadrer .versionFile $(OUTPUT_NAME_RELEASE)
@echo $(CADRE_HAUT_BAS)
@echo ' INSTALL : $(F_VIOLET)$(OUTPUT_NAME_RELEASE)=>$(PROG_NAME)$(F_NORMALE)'$(CADRE_COTERS)
@echo $(CADRE_HAUT_BAS)
@echo $(F_ROUGE)"
(stripped) $(OUTPUT_NAME_RELEASE) => $(PROG_NAME) "$(F_NORMALE)
@cp $(OUTPUT_NAME_RELEASE) $(PROG_NAME)
@strip -s $(PROG_NAME)
@echo $(F_VERT)"
(copy) $(PROG_NAME) /usr/bin/ "$(F_NORMALE)
@cp -vf $(PROG_NAME) /usr/bin/
@echo $(F_VERT)"
(data) data/* ==> /usr/share/edn/ "$(F_NORMALE)
@mkdir -p /usr/share/edn/
@rm -rf /usr/share/edn/*
@cp -vf data/*.xml /usr/share/edn/
@mkdir -p /usr/share/edn/images/
@cp -vf data/imagesSources/icone.png /usr/share/edn/images/
@cp -vf data/imagesSources/delete-24px.png /usr/share/edn/images/
# gnome adding for the program at the list (manage icone in .xpm)
@cp -vf data/edn.desktop /usr/share/applications/
@cp -vf data/imagesSources/icone.png /usr/share/app-install/icons/Edn.png
@cp -vf data/imagesSources/icone.xpm /usr/share/pixmaps/Edn.xpm
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
package: .encadrer
@echo 'Create Folders ...'
@mkdir -p package/$(PROG_NAME)/DEBIAN/
@mkdir -p package/$(PROG_NAME)/usr/bin/
@mkdir -p package/$(PROG_NAME)/usr/share/doc/
@mkdir -p package/$(PROG_NAME)/usr/share/edn/
# Create the control file
@echo "Package: "$(PROG_NAME) > package/$(PROG_NAME)/DEBIAN/control
@echo "Version: "$(VERSION_TAG_SHORT) >> package/$(PROG_NAME)/DEBIAN/control
@echo "Section: Development,Editors" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Priority: optional" >>package/$(PROG_NAME)/DEBIAN/control
@echo "Architecture: all" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Depends: bash" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Maintainer: Mr DUPIN Edouard <yui.heero@gmail.com>" >> package/$(PROG_NAME)/DEBIAN/control
@echo "Description: Text editor for sources code with ctags management" >> package/$(PROG_NAME)/DEBIAN/control
@echo "" >> package/$(PROG_NAME)/DEBIAN/control
# Create the PostRm
@echo "#!/bin/bash" > package/$(PROG_NAME)/DEBIAN/postrm
@echo "rm ~/."$(PROG_NAME) >> package/$(PROG_NAME)/DEBIAN/postrm

22
README
View File

@@ -1,22 +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.
- Write Java sources code with this software.
I reserve the right to change this licence. If it change the version of the copy you have keep its own license

41
README.md Normal file
View File

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

View File

@@ -1,424 +0,0 @@
/**
*******************************************************************************
* @file CodeView.cpp
* @brief Editeur De N'ours : Code Viewer Widget
* This is an abstraction
* @author Edouard DUPIN
* @date 05/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "CodeView.h"
#include "tools_debug.h"
#include "tools_globals.h"
#include "Display.h"
#include "CodeView.h"
#include "BufferManager.h"
#include "ColorizeManager.h"
#include "ClipBoard.h"
#include "SearchData.h"
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
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 200, 100);
gtk_widget_add_events( m_widget,
GDK_KEY_PRESS_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
# ifdef USE_GTK_VERSION_3_0
g_object_set(m_widget,"can-focus", TRUE, NULL);
# elif defined( USE_GTK_VERSION_2_0 )
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
# endif
// Focus Event
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
// Keyboard Event
g_signal_connect_after( G_OBJECT(m_widget), "key_press_event", G_CALLBACK(CB_keyboardEvent), this);
g_signal_connect_after( G_OBJECT(m_widget), "key_release_event", G_CALLBACK(CB_keyboardEvent), this);
// Mouse Event
g_signal_connect( G_OBJECT(m_widget), "button_press_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "button_release_event", G_CALLBACK(CB_mouseButtonEvent), this);
g_signal_connect( G_OBJECT(m_widget), "motion_notify_event", G_CALLBACK(CB_mouseMotionEvent), this);
g_signal_connect( G_OBJECT(m_widget), "scroll-event", G_CALLBACK(CB_mouseScrollEvent), this);
// Display Event
g_signal_connect( G_OBJECT(m_widget), "realize", G_CALLBACK(CB_displayInit), this);
# ifdef USE_GTK_VERSION_3_0
g_signal_connect( G_OBJECT(m_widget), "draw", G_CALLBACK(CB_displayDraw), this);
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
# endif
}
CodeView::~CodeView(void)
{
}
GtkWidget * CodeView::GetMainWidget(void)
{
return m_widget;
}
void CodeView::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
//EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
// request the dispplay of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE:
if (m_bufferManager->Get(m_bufferID)->HaveName() == false) {
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
} else {
m_bufferManager->Get(m_bufferID)->Save();
}
break;
case EDN_MSG__CURRENT_SAVE_AS:
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
break;
case EDN_MSG__CURRENT_REMOVE_LINE:
m_bufferManager->Get(m_bufferID)->RemoveLine();
break;
case EDN_MSG__CURRENT_SELECT_ALL:
m_bufferManager->Get(m_bufferID)->SelectAll();
break;
case EDN_MSG__CURRENT_UN_SELECT:
m_bufferManager->Get(m_bufferID)->SelectNone();
break;
case EDN_MSG__CURRENT_COPY:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Copy(dataID);
break;
case EDN_MSG__CURRENT_CUT:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Cut(dataID);
break;
case EDN_MSG__CURRENT_PASTE:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Paste(dataID);
break;
case EDN_MSG__CURRENT_FIND_PREVIOUS:
{
Edn::String myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_FIND_NEXT:
{
Edn::String myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_REPLACE:
{
Edn::String myDataString;
SearchData::GetReplace(myDataString);
m_bufferManager->Get(m_bufferID)->Replace(myDataString);
}
break;
case EDN_MSG__CURRENT_REPLACE_ALL:
break;
case EDN_MSG__CURRENT_CLOSE:
m_bufferManager->Remove(m_bufferID);
m_bufferID = -1;
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
case EDN_MSG__CURRENT_UNDO:
m_bufferManager->Get(m_bufferID)->Undo();
break;
case EDN_MSG__CURRENT_REDO:
m_bufferManager->Get(m_bufferID)->Redo();
break;
case EDN_MSG__CURRENT_GOTO_LINE:
if (dataID<0) {
dataID = 0;
}
m_bufferManager->Get(m_bufferID)->JumpAtLine(dataID);
break;
case EDN_MSG__REFRESH_DISPLAY:
break;
case EDN_MSG__CURRENT_SET_CHARSET:
m_bufferManager->Get(m_bufferID)->SetCharset((charset_te)dataID);
break;
}
// Force redraw of the widget
gtk_widget_queue_draw(m_widget);
}
gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
//EDN_INFO("displayDraw_cb");
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
bool needRedrawAll = false;
if (self->m_shawableAreaX != allocation.width) {
needRedrawAll = true;
self->m_shawableAreaX = allocation.width;
}
if (self->m_shawableAreaY != allocation.height) {
needRedrawAll = true;
self->m_shawableAreaY = allocation.height;
}
# elif defined( USE_GTK_VERSION_2_0)
bool needRedrawAll = false;
if (self->m_shawableAreaX != widget->allocation.width) {
needRedrawAll = true;
self->m_shawableAreaX = widget->allocation.width;
}
if (self->m_shawableAreaY != widget->allocation.height) {
needRedrawAll = true;
self->m_shawableAreaY = widget->allocation.height;
}
# endif
if (true == needRedrawAll) {
//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 :
ColorizeManager *myColorManager = NULL;
myColorManager = ColorizeManager::getInstance();
//(void)m_bufferManager->Get(m_bufferID)->Display(m_displayParameters, m_shawableAreaX, m_shawableAreaY);
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
//EDN_INFO("Display buffer ID = " << m_bufferID);
(void)self->m_bufferManager->Get(self->m_bufferID)->Display(monDrawer);
// EDN_WARNING("Must display here ... ");
return TRUE;
}
// sur : émis lors du premier affichage de la GtkDrawingArea
gboolean CodeView::CB_displayInit( GtkWidget *widget, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
# ifdef USE_GTK_VERSION_3_0
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
int32_t size_x = allocation.width;
int32_t size_y = allocation.height;
self->m_shawableAreaX = allocation.width;
self->m_shawableAreaY = allocation.height;
# elif defined( USE_GTK_VERSION_2_0)
int32_t size_x = widget->allocation.width;
int32_t size_y = widget->allocation.height;
self->m_shawableAreaX = widget->allocation.width;
self->m_shawableAreaY = widget->allocation.height;
# endif
EDN_INFO("Request a diplay of : "<< size_x <<"px * "<< size_y <<"px");
gtk_widget_queue_draw( widget );
return TRUE;
}
gint CodeView::CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
# endif
self->SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, self->m_bufferID);
EDN_INFO("Focus - In");
return FALSE;
}
gint CodeView::CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data)
{
//CodeView * self = reinterpret_cast<CodeView*>(data);
# ifdef USE_GTK_VERSION_2_0
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
# endif
EDN_INFO("Focus - out");
return FALSE;
}
gint CodeView::CB_keyboardEvent(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
char Utf8Out[10];
bool controlKey;
bool moveKey;
int32_t key;
// Convert input key :
ConvertInput(event, Utf8Out, controlKey, moveKey, key);
if(event->type == GDK_KEY_PRESS) {
if(false==controlKey) {
self->m_bufferManager->Get(self->m_bufferID)->AddChar(Utf8Out);
gtk_widget_queue_draw( widget );
} else if (true == moveKey) {
self->m_bufferManager->Get(self->m_bufferID)->cursorMove(key);
gtk_widget_queue_draw( widget );
}
}
return true;
}
gint CodeView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
// get focus on the widget
gtk_widget_grab_focus(widget);
if (event->button == 1) {
if (event->type == GDK_BUTTON_PRESS) {
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
self->m_bufferManager->Get(self->m_bufferID)->MouseEvent(event->x, event->y);
gtk_widget_queue_draw( widget );
self->m_buttunOneSelected = true;
}else if (event->type == GDK_2BUTTON_PRESS) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
self->m_bufferManager->Get(self->m_bufferID)->MouseEventDouble();
gtk_widget_queue_draw( widget );
self->m_buttunOneSelected = true;
}else if (event->type == GDK_3BUTTON_PRESS) {
//EDN_INFO("mouse-event BT1 ==> Triple Clicked");
self->m_bufferManager->Get(self->m_bufferID)->MouseEventTriple();
gtk_widget_queue_draw( widget );
self->m_buttunOneSelected = true;
}else if (event->type == GDK_BUTTON_RELEASE) {
//EDN_INFO("mouse-event BT1 ==> Realease");
self->m_buttunOneSelected = false;
self->m_bufferManager->Get(self->m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
}
} else if (event->button == 2) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT2 PRESS");
self->m_bufferManager->Get(self->m_bufferID)->MouseEvent(event->x, event->y);
self->m_bufferManager->Get(self->m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
gtk_widget_queue_draw(widget);
}
} else if (event->button == 3) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT3 PRESS");
}
} else {
EDN_INFO("mouse-event BT? PRESS");
}
return true;
}
gint CodeView::CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
if (true == self->m_buttunOneSelected) {
int x, y;
GdkModifierType state;
if (event->is_hint) {
gdk_window_get_pointer(event->window, &x, &y, &state);
} else {
x = event->x;
y = event->y;
state = (GdkModifierType)event->state;
}
if (x<0) {
x = 0;
}
if (y<0) {
y = 0;
}
//EDN_INFO("mouse-motion BT1 %d, %d", x, y);
self->m_bufferManager->Get(self->m_bufferID)->MouseSelectFromCursorTo(x, y);
gtk_widget_queue_draw( widget );
}
return true;
}
gint CodeView::CB_mouseScrollEvent( GtkWidget *widget, GdkEventScroll *event, gpointer data)
{
CodeView * self = reinterpret_cast<CodeView*>(data);
if (event->direction == GDK_SCROLL_UP)
{
// up code
//EDN_INFO("mouse-event GDK_SCROLL_UP");
self->m_bufferManager->Get(self->m_bufferID)->ScrollUp();
gtk_widget_queue_draw( widget );
}
else if (event->direction == GDK_SCROLL_DOWN)
{
// down code
//EDN_INFO("mouse-event GDK_SCROLL_DOWN");
self->m_bufferManager->Get(self->m_bufferID)->ScrollDown();
gtk_widget_queue_draw( widget );
} else {
EDN_INFO("mouse-event SCROLL");
}
return true;
}

View File

@@ -1,60 +0,0 @@
/**
*******************************************************************************
* @file Search.h
* @brief Editeur De N'ours : Search system (header)
* @author Edouard DUPIN
* @date 03/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __SEARCH_H__
#define __SEARCH_H__
#include "tools_debug.h"
#include "Singleton.h"
#include <string>
#include <vector>
class MainAreaView: public Singleton<MainAreaView>
{
friend class Singleton<MainAreaView>;
// specific for sigleton system...
private:
// Constructeur
MainAreaView(void);
~MainAreaView(void);
public:
GtkWidget * GetWidget(void);
void SplitV(void); // split current window vertically (max 1 by section)
void SplitH(void); // split current window horizontaly (max 3)
void Remove(void); // remove current selected element
//ViewArea * GetCurent(void); // Get a pointer on the current displayed area
private:
GtkWidget * m_localDialog; //!< local dialog element
ViewArea * m_EntrySearch[6];
uint8_t m_CurentSelected
};
#endif

View File

@@ -1,191 +0,0 @@
/**
*******************************************************************************
* @file MainWindows.cpp
* @brief Editeur De N'ours : main Windows diplayer (Sources)
* @author Edouard DUPIN
* @date 04/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "MainWindows.h"
#include "CodeView.h"
#include "ClipBoard.h"
#include "BufferView.h"
#include "AccelKey.h"
#undef __class__
#define __class__ "MainWindows"
MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
{
m_mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// select the program icone
gtk_window_set_default_icon_name("text-editor");
// Default size open windows
gtk_window_set_default_size(GTK_WINDOW(m_mainWindow), 800, 600);
// enable the close signal of the windows
g_signal_connect(G_OBJECT(m_mainWindow), "delete-event", G_CALLBACK(OnQuit), this);
//g_signal_connect(G_OBJECT(m_mainWindow), "destroy", G_CALLBACK(OnQuit), this);
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER(m_mainWindow), vbox);
// Set key Accelerator :
AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_mainWindow));
// Create the menu bar.
gtk_box_pack_start( GTK_BOX (vbox), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
// **********************************************************
// * Horizontal ELEMENTS : *
// **********************************************************
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER (vbox), hbox);
// create the toolbar :
# if USE_GTK_VERSION_2_0
gtk_box_pack_start(GTK_BOX(hbox), m_ToolBar.GetWidget(), FALSE, FALSE, 0);
# endif
// TreeView :
gtk_box_pack_start(GTK_BOX(hbox), m_BufferView.GetMainWidget(), FALSE, TRUE, 1);
// Tex displayer :
gtk_box_pack_start( GTK_BOX (hbox), m_CodeView.GetMainWidget(), TRUE, TRUE, 0);
// Create the status bar
gtk_box_pack_end(GTK_BOX(vbox), m_StatusBar.GetWidget(), FALSE, FALSE, 0);
// recursive version of gtk_widget_show
gtk_widget_show_all(m_mainWindow);
}
MainWindows::~MainWindows(void)
{
/*
if (NULL != m_DlgSearch) {
delete m_DlgSearch;
}
*/
}
void MainWindows::SetTitle(Edn::String &fileName, bool isModify)
{
Edn::String tmp = "";
if (fileName != "") {
tmp += fileName;
tmp += " - ";
}
tmp += "Edn";
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
}
void MainWindows::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
// change Title :
// TODO : String error when remove the error with -1;
if (-1 == dataID) {
Edn::String plop = "";
SetTitle(plop, false );
} else {
Buffer *mybuf = BufferManager::getInstance()->Get(dataID);
if (NULL != mybuf) {
Edn::String plop = mybuf->GetName();
SetTitle(plop, mybuf->IsModify() );
}
}
break;
case EDN_MSG__QUIT:
OnQuit(m_mainWindow, this);
break;
}
}
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
{
EDN_INFO("quit requested");
// dlg to confirm the quit event :
GtkWidget *p_dialog = gtk_dialog_new_with_buttons("Exit",
GTK_WINDOW(widget),
GTK_DIALOG_MODAL,
GTK_STOCK_YES, GTK_RESPONSE_YES,
GTK_STOCK_NO, GTK_RESPONSE_NO,
NULL);
GtkWidget *p_label = gtk_label_new ("Do you want exit Edn?");
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area( GTK_DIALOG(p_dialog) )), p_label, TRUE, TRUE, 0);
gtk_widget_show(p_label);
switch (gtk_dialog_run (GTK_DIALOG (p_dialog)))
{
case GTK_RESPONSE_YES:
gtk_widget_destroy (p_dialog);
break;
case GTK_RESPONSE_NO:
gtk_widget_destroy (p_dialog);
// do not close the windows
return true;
break;
}
gtk_main_quit();
return false;
}
#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

View File

@@ -1,183 +0,0 @@
/**
*******************************************************************************
* @file WindowsManager.cpp
* @brief Editeur De N'ours : Windows creation, pop up, destruction ... (Sources)
* @author Edouard DUPIN
* @date 20/06/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "WindowsManager.h"
#include "MainWindows.h"
#include "Edn.h"
#include "Search.h"
#undef __class__
#define __class__ "WindowsManager"
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
WindowsManager::WindowsManager(void) : MsgBroadcast("Windows Manager", EDN_CAT_GUI_MANAGER)
{
m_currentBufferID = -1;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
WindowsManager::~WindowsManager(void)
{
}
void WindowsManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_currentBufferID = dataID;
break;
case EDN_MSG__GUI_SHOW_MAIN_WINDOWS:
EDN_INFO("Request opening MAIN_WINDOWS");
m_mainWindow = MainWindows::getInstance();
break;
case EDN_MSG__GUI_SHOW_SEARCH:
EDN_INFO("Request opening SEARCH");
{
Search *myInstance = Search::getInstance();
myInstance->Display();
}
break;
case EDN_MSG__GUI_SHOW_PREFERENCE:
EDN_INFO("Request opening PREFERENCE");
break;
case EDN_MSG__GUI_SHOW_REPLACE:
EDN_INFO("Request opening REPLACE");
break;
case EDN_MSG__GUI_SHOW_OPEN_FILE:
EDN_INFO("Request opening OPEN_FILE");
{
BufferManager *myBufferManager = NULL;
myBufferManager = BufferManager::getInstance();
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open File", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, // button text
GTK_RESPONSE_CANCEL, // response id
GTK_STOCK_OPEN, // button text
GTK_RESPONSE_ACCEPT, // response id
NULL); // end button/response list
if( -1 != m_currentBufferID
&& true == myBufferManager->Exist(m_currentBufferID) )
{
Edn::String fileFolder = myBufferManager->Get(m_currentBufferID)->GetFolder();
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog), fileFolder.c_str());
//gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(dialog), "Untitled document");
}
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
Edn::String myfilename;
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
if (false == myBufferManager->Exist(myfilename) ) {
int32_t openID = myBufferManager->Open(myfilename);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myfilename));
}
}
gtk_widget_destroy(dialog);
}
break;
case EDN_MSG__GUI_SHOW_SAVE_AS:
EDN_INFO("Request opening SAVE_AS");
// save only if one element is selected
if (BufferManager::getInstance()->Size() > 0) {
int32_t idSelected;
if(-1 == dataID) {
idSelected = BufferManager::getInstance()->GetSelected();
} else {
idSelected = dataID;
}
Buffer *myBuffer = BufferManager::getInstance()->Get(idSelected);
Edn::String tmpString = "Save as file : ";
tmpString += myBuffer->GetShortName().c_str();
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, // button text
GTK_RESPONSE_CANCEL, // response id
GTK_STOCK_SAVE, // button text
GTK_RESPONSE_ACCEPT, // response id
NULL); // end button/response list
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
Edn::String myfilename;
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
myBuffer->SetName(myfilename);
myBuffer->Save();
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idSelected);
}
gtk_widget_destroy(dialog); // implicitly hides dialog
}
break;
case EDN_MSG__GUI_SHOW_ABOUT:
{
// dlg to confirm the quit event :
GtkWidget *p_dialog = gtk_dialog_new_with_buttons("About",
NULL,
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);
int32_t result = gtk_dialog_run (GTK_DIALOG (p_dialog));
gtk_widget_destroy(p_dialog);
switch (result)
{
case GTK_RESPONSE_YES:
gtk_main_quit();
break;
case GTK_RESPONSE_NO:
break;
}
}
break;
}
}

View File

@@ -1,297 +0,0 @@
/**
*******************************************************************************
* @file Highlight.c
* @brief Editeur De N'ours : Hightlightning Specific
* @author Edouard DUPIN
* @date 14/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Highlight.h"
#include "tinyxml.h"
#undef __class__
#define __class__ "Highlight"
void Highlight::ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level)
{
// Create the patern ...
HighlightPattern *myPattern = new HighlightPattern();
// parse under Element
myPattern->ParseRules(child, level);
// add element in the list
mListPatern.push_back(myPattern);
}
Highlight::Highlight(Edn::String &xmlFilename)
{
TiXmlDocument XmlDocument;
// open the curent File
bool loadError = XmlDocument.LoadFile(xmlFilename.c_str());
if (false == loadError) {
EDN_ERROR( "can not load Hightlight XML: PARSING error: \"" << xmlFilename.c_str() << "\"");
return;
}
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnLang" );
if (NULL == root) {
EDN_ERROR( "can not load Hightlight XML: main node not find: \"EdnLang\"");
return;
}
int32_t level1 = 0;
int32_t level2 = 0;
TiXmlNode * child = root->FirstChild();
while(NULL != child)
{
if (child->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do ...
} else if (!strcmp(child->Value(), "ext")) {
const char *myData = child->ToElement()->GetText();
if (NULL != myData) {
//EDN_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
Edn::String myEdnData = myData;
m_listExtentions.push_back(myEdnData);
}
} else if (!strcmp(child->Value(), "pass1")) {
// Get sub Nodes ...
TiXmlNode *passChild = child->FirstChild();
while (NULL != passChild) {
if (passChild->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do ...
} else if (!strcmp(passChild->Value(), "rule")) {
ParseRules(passChild, m_listHighlightPass1, level1++);
} else {
EDN_ERROR("(l "<< passChild->Row() << ") node not suported : \""<< passChild->Value() << "\" must be [rule]" );
}
// get the next node element :
passChild = passChild->NextSibling();
}
} else if (!strcmp(child->Value(), "pass2")) {
// Get sub Nodes ...
TiXmlNode *passChild = child->FirstChild();
while (NULL != passChild) {
if (passChild->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do ...
} else if (!strcmp(passChild->Value(), "rule")) {
ParseRules(passChild, m_listHighlightPass2, level2++);
} else {
EDN_ERROR("(l "<< passChild->Row() << ") node not suported : \""<< passChild->Value() << "\" must be [rule]" );
}
// get the next node element :
passChild = passChild->NextSibling();
}
} else {
EDN_ERROR("(l "<< child->Row() << ") node not suported : \""<< child->Value() << "\" must be [ext,pass1,pass2]" );
}
// get the next node element :
child = child->NextSibling();
}
}
Highlight::~Highlight(void)
{
uint32_t i;
// clean all Element
for (i=0; i< m_listHighlightPass1.size(); i++) {
delete(m_listHighlightPass1[i]);
}
// clear the compleate list
m_listHighlightPass1.clear();
}
bool Highlight::HasExtention(Edn::String &ext)
{
uint32_t i;
for (i=0; i<m_listExtentions.size(); i++) {
if (ext == m_listExtentions[i] ) {
return true;
}
}
return false;
}
bool Highlight::FileNameCompatible(Edn::String &fileName)
{
uint32_t i;
int32_t posCopy = fileName.FindBack('/');
Edn::String shortFilename;
if (-1 != posCopy) {
shortFilename = fileName.Extract(posCopy+1);
} else {
shortFilename = fileName;
}
posCopy = shortFilename.FindBack('.');
Edn::String extention;
if (-1 != posCopy) {
extention = shortFilename.Extract(posCopy);
} else {
extention = shortFilename;
}
EDN_DEBUG(" try to find : in \"" << fileName.c_str() << "\" shortfilename\"" << shortFilename.c_str() << "\" extention:\"" << extention.c_str() << "\" ");
for (i=0; i<m_listExtentions.size(); i++) {
if (extention == m_listExtentions[i] ) {
return true;
}
}
return false;
}
void Highlight::Display(void)
{
uint32_t i;
EDN_INFO("List of ALL Highlight : ");
for (i=0; i< m_listExtentions.size(); i++) {
EDN_INFO(" Extention : " << i << " : " << m_listExtentions[i].c_str() );
}
// Display all elements
for (i=0; i< m_listHighlightPass1.size(); i++) {
EDN_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName().c_str() );
//m_listHighlightPass1[i]->Display();
}
// Display all elements
for (i=0; i< m_listHighlightPass2.size(); i++) {
EDN_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName().c_str() );
//m_listHighlightPass2[i]->Display();
}
}
void Highlight::Parse(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID)
{
if (0 > addingPos) {
addingPos = 0;
}
/*int32_t emptyId = -1;
for (i=0; i< (int32_t)metaData.size(); i++) {
}*/
//EDN_DEBUG("Parse element " << elementID << " / " << m_listHighlightPass1.size() << " ==> position search: (" << start << "," << stop << ")" );
if (elementID >= (int32_t)m_listHighlightPass1.size() ){
//EDN_DEBUG("Return at " << elementID << " / " << m_listHighlightPass1.size() );
return;
}
int32_t elementStart = start;
int32_t elementStop = stop;
resultFind_te ret = HLP_FIND_OK;
colorInformation_ts resultat;
while (HLP_FIND_ERROR != ret && elementStart<elementStop) {
ret = m_listHighlightPass1[elementID]->Find(elementStart, elementStop, resultat, buffer);
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Add curent element in the list ...
if (HLP_FIND_OK_NO_END == ret) {
// find if we have a next element with th save Pointer and not higher the this one
int32_t findNextElement = -1;
int32_t i;
int32_t curentLevel = ((HighlightPattern*)resultat.patern)->GetLevel();
for (i=addingPos; i< (int32_t)metaData.size(); i++) {
if (curentLevel > ((HighlightPattern*)metaData[i].patern)->GetLevel() ) {
//EDN_DEBUG(" -> Find upper element at "<< i );
break;
} else if (curentLevel < ((HighlightPattern*)metaData[i].patern)->GetLevel() ) {
findNextElement = i;
//EDN_DEBUG(" -> Find under element at "<< i );
}
if (metaData[i].patern == resultat.patern)
{
findNextElement = i;
//EDN_DEBUG(" -> Find a same element at "<< i );
break;
}
}
if (-1 != findNextElement) {
// if not find a end, we need to search the end of this one and parse all data inside...
int32_t newEnd = buffer.Size();
if (findNextElement >= (int32_t)metaData.size()-1) {
// Remove old element :
//EDN_DEBUG(" --> Remove : " << addingPos << "==>" << (int32_t)metaData.size() << " (end)" );
metaData.erase(metaData.begin()+addingPos,metaData.end());
} else {
// Remove old element :
//EDN_DEBUG(" --> Remove : " << addingPos << "==>" << findNextElement+1 );
metaData.erase(metaData.begin()+addingPos,metaData.begin()+findNextElement+1);
newEnd = metaData[addingPos].beginStart-1;
}
// Regenerate a local parsing : in a higher range of text
Parse(elementStart, edn_max(newEnd, stop), metaData, addingPos, buffer, elementID);
// Break the curent process, beacause we reparse the data in all range...
return;
} else {
//EDN_DEBUG(" --> No element removed " );
metaData.insert(metaData.begin() + addingPos, resultat);
//EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
}
} else {
metaData.insert(metaData.begin() + addingPos, resultat);
//EDN_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
}
// parse the under element :
Parse(elementStart, resultat.beginStart-1, metaData, addingPos, buffer, elementID+1);
addingPos++;
elementStart = resultat.endStop;
}
}
// parse the under element :
Parse(elementStart, elementStop, metaData, addingPos, buffer, elementID+1);
}
/**
* @brief second pass of the hightlight
*
*/
void Highlight::Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID)
{
if (elementID >= (int32_t)m_listHighlightPass2.size() ){
return;
}
int32_t elementStart = start;
int32_t elementStop = stop;
resultFind_te ret = HLP_FIND_OK;
colorInformation_ts resultat;
while (HLP_FIND_ERROR != ret && elementStart<elementStop) {
if (m_listHighlightPass2[elementID]!=NULL) {
ret = m_listHighlightPass2[elementID]->Find(elementStart, elementStop, resultat, buffer);
} else {
ret = HLP_FIND_ERROR;
}
if (HLP_FIND_ERROR != ret) {
//EDN_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// parse the under element :
Parse2(elementStart, resultat.beginStart, metaData, buffer, elementID+1);
// Add curent element in the list ...
metaData.push_back(resultat);
elementStart = resultat.endStop;
}
}
// parse the under element :
Parse2(elementStart, elementStop, metaData, buffer, elementID+1);
}

View File

@@ -1,77 +0,0 @@
/**
*******************************************************************************
* @file Highlight.h
* @brief Editeur De N'ours : Hightlightning Specific (header)
* @author Edouard DUPIN
* @date 14/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__
class Highlight;
class HighlightPattern;
extern "C" {
typedef struct
{
int32_t beginStart;
int32_t beginStop;
int32_t endStart;
int32_t endStop;
bool notEnded;
HighlightPattern * patern; // pointer on class :
} colorInformation_ts;
}
#include <vector>
#include "HighlightPattern.h"
#include "Colorize.h"
#include "Edn.h"
#include "EdnVectorBuf.h"
#include "tinyxml.h"
class Highlight {
public:
// Constructeur
Highlight(Edn::String &xmlFilename);
~Highlight(void);
bool HasExtention(Edn::String &ext);
bool FileNameCompatible(Edn::String &fileName);
void Display(void);
void Parse( int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, int32_t &addingPos, EdnVectorBuf &buffer, int32_t elementID=0);
void Parse2(int32_t start, int32_t stop, std::vector<colorInformation_ts> &metaData, EdnVectorBuf &buffer, int32_t elementID=0);
private:
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level);
Edn::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<Edn::String> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
};
#endif

View File

@@ -1,104 +0,0 @@
/**
*******************************************************************************
* @file HighlightManager.cpp
* @brief Editeur De N'ours : Hightlining Manager
* @author Edouard DUPIN
* @date 16/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "HighlightManager.h"
#undef __class__
#define __class__ "HighlightManager"
HighlightManager::HighlightManager(void)
{
}
HighlightManager::~HighlightManager(void)
{
listHighlight.clear();
}
Highlight *HighlightManager::Get(Edn::String &fileName)
{
uint32_t i;
for (i=0; i<listHighlight.size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return listHighlight[i];
}
}
return NULL;
}
bool HighlightManager::Exist(Edn::String &fileName)
{
uint32_t i;
for (i=0; i<listHighlight.size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
return true;
}
}
return false;
}
void HighlightManager::loadLanguages(void)
{
Edn::String homedir;
#ifdef NDEBUG
homedir = getenv("HOME");
homedir += "/.edn/";
#else
homedir = "./";
#endif
Edn::String xmlFilename = homedir;
xmlFilename += "data/lang_c.xml";
Highlight *myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_boo.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_Makefile.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_asm.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
xmlFilename = homedir;
xmlFilename += "data/lang_xml.xml";
myHightline = new Highlight(xmlFilename);
listHighlight.push_back(myHightline);
myHightline->Display();
}

View File

@@ -1,85 +0,0 @@
/**
*******************************************************************************
* @file HighlightPattern.h
* @brief Editeur De N'ours : Hightlight Patern (header)
* @author Edouard DUPIN
* @date 14/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __HIGHLIGHT_PATTERN_H__
#define __HIGHLIGHT_PATTERN_H__
class HighlightPattern;
#include "Edn.h"
#include "EdnRegExp.h"
#include "Colorize.h"
#include "EdnVectorBin.h"
#include "tinyxml.h"
typedef enum {
HLP_FIND_ERROR,
HLP_FIND_OK,
HLP_FIND_OK_NO_END,
}resultFind_te;
class HighlightPattern;
class HighlightPattern {
public:
// Constructeur
HighlightPattern(void);
~HighlightPattern(void);
void SetName(Edn::String &name) { m_paternName = name;};
Edn::String GetName(void) { return m_paternName;};
void SetPaternStart(Edn::String &regExp);
void SetPaternStop(Edn::String &regExp);
void SetColor(Edn::String &colorName);
void SetEscapeChar(Edn::String &EscapeChar);
void SetMultiline(bool enable) { m_multiline = enable; };
void SetLevel(int32_t newLevel) { m_level = newLevel; };
int32_t GetLevel(void) { return m_level; };
bool IsEnable(void);
void Display(void);
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer);
Colorize * GetColor(void) { return m_color; };
void ParseRules(TiXmlNode *child, int32_t level);
private:
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
Edn::String m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
Edn::String m_colorName; //!< Current color name
Colorize * m_color; //!< Link to the color manager
EdnRegExp * m_regExpStart; //!< Start of Regular expression
EdnRegExp * m_regExpStop; //!< Stop of Regular Expression
bool m_haveStopPatern; //!< Stop patern presence
bool m_multiline; //!< The patern is multiline
char m_escapeChar; //!< Escape char to prevent exeit of patern ....
EdnVectorBin<HighlightPattern *> m_subPatern; //!< Under patern of this one
// EdnVectorBin<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
};
#endif

View File

@@ -1,235 +0,0 @@
/**
*******************************************************************************
* @file CTagsManager.cpp
* @brief Editeur De N'ours : Ctags manager : acces to the ctags file (Sources)
* @author Edouard DUPIN
* @date 15/07/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Edn.h"
#include "CTagsManager.h"
#include "ClipBoard.h"
#include "BufferManager.h"
#undef __class__
#define __class__ "CTagsManager"
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
CTagsManager::CTagsManager(void) : MsgBroadcast("C-Tags Manager", EDN_CAT_CTAGS)
{
m_tagFilename = "";
m_tagFolderBase = "";
m_ctagFile = NULL;
m_historyPos = 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
CTagsManager::~CTagsManager(void)
{
if(0 != m_historyList.Size()) {
for (int32_t iii=0; iii< m_historyList.Size(); iii++) {
delete(m_historyList[iii]);
}
m_historyList.Clear();
}
}
Edn::String CTagsManager::GetFolder(Edn::String &inputString)
{
char tmpVal[4096];
strncpy(tmpVal, inputString.c_str(), 4096);
tmpVal[4096-1] = '\0';
char *ptr = strrchr(tmpVal, '/');
if (NULL == ptr) {
ptr = strrchr(tmpVal, '\\');
}
Edn::String out = "./";
if (NULL != ptr) {
*ptr = '\0';
out = tmpVal;
out+= '/';
}
return out;
}
void CTagsManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_currentSelectedID = dataID;
break;
case EDN_MSG__OPEN_CTAGS:
EDN_INFO("Request opening ctag file");
{
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, // button text
GTK_RESPONSE_CANCEL, // response id
GTK_STOCK_OPEN, // button text
GTK_RESPONSE_ACCEPT, // response id
NULL); // end button/response list
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
// open the new one :
m_tagFilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
m_tagFolderBase = GetFolder(m_tagFilename);
LoadTagFile();
}
gtk_widget_destroy(dialog);
}
break;
case EDN_MSG__RELOAD_CTAGS:
LoadTagFile();
break;
case EDN_MSG__JUMP_TO_CURRENT_SELECTION:
JumpTo();
break;
case EDN_MSG__JUMP_BACK:
EDN_INFO("TODO .... jump back");
break;
}
}
void CTagsManager::LoadTagFile(void)
{
tagFileInfo info;
// close previous tag file
if (NULL != m_ctagFile) {
tagsClose(m_ctagFile);
m_ctagFile = NULL;
}
if (m_tagFilename == "") {
return;
}
// load (open) the tag file :
EDN_INFO("try to open tag file : " << m_tagFilename.c_str());
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
if (NULL != m_ctagFile) {
EDN_INFO("open exuberant Ctags file is OK ...");
} else {
EDN_INFO("Error to open ctags file ...");
}
}
void CTagsManager::AddToHistory(int32_t bufferID)
{
// check tho history position : remove if needed
if (m_historyPos < edn_max(m_historyList.Size()-1, 0) ) {
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
delete(m_historyList[iii]);
}
m_historyList.Erase(m_historyPos, m_historyList.Size() - m_historyPos);
}
// add the current element
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::String currentFilename = myBufferManager->Get(bufferID)->GetName();
int32_t currentLineId = 0;
Edn::File * currentFile = new Edn::File(currentFilename);
}
void CTagsManager::JumpTo(void)
{
if (NULL != m_ctagFile) {
EdnVectorBin<int8_t> data;
// get the middle button of the clipboard ==> represent the current selection ...
ClipBoard::Get(COPY_MIDDLE_BUTTON, data);
if (data.Size() == 0) {
EDN_INFO("No current S<>lection");
}
tagEntry entry;
data.PushBack('\0');
EDN_INFO("try to find the tag : " << (const char *)&data[0]);
if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) {
//EDN_INFO("find the tag");
BufferManager *myBufferManager = BufferManager::getInstance();
Edn::String destinationFilename = m_tagFolderBase;
destinationFilename += entry.file;
EDN_INFO(" OPEN the TAG file Destination : " << destinationFilename.c_str() );
if (false == myBufferManager->Exist(destinationFilename) ) {
// need to open the file :
int32_t openID = myBufferManager->Open(destinationFilename);
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
} else {
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(destinationFilename));
}
int32_t localId = myBufferManager->GetId(destinationFilename);
Edn::String pattern = entry.address.pattern;
EDN_DEBUG("try to find line with : \"" << pattern.c_str() << "\"" );
if (pattern.Size() > 4) {
pattern.Remove(0,2);
pattern.Remove(pattern.Size()-1,2);
}
// TODO : remove '\' char when needed ...
EDN_DEBUG("try to find line with : \"" << pattern.c_str() << "\"" );
int32_t destLine = myBufferManager->Get(localId)->FindLine(pattern);
SendMessage(EDN_MSG__CURRENT_GOTO_LINE, destLine);
/*
do {
PrintTag (&entry);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
*/
} else {
EDN_INFO("no tag find ...");
}
}
}
void CTagsManager::PrintTag (const tagEntry *entry)
{
int i;
EDN_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
<< "\" pattern=\"" <<entry->address.pattern
<< "\" at line="<<entry->address.lineNumber);
EDN_INFO("Extention field : ");
if (entry->kind != NULL && entry->kind [0] != '\0') {
EDN_INFO(" kind : " << entry->kind);
}
if (entry->fileScope) {
EDN_INFO(" file : ");
}
for (i = 0 ; i < entry->fields.count ; ++i) {
EDN_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
}
}

View File

@@ -1,149 +0,0 @@
/**
*******************************************************************************
* @file init.cpp
* @brief Editeur De N'ours : main fonction
* @author Edouard DUPIN
* @date 26/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Display.h"
#include "BufferManager.h"
#include "ColorizeManager.h"
#include "HighlightManager.h"
#include "ClipBoard.h"
#include <string>
#include "WindowsManager.h"
#include "Search.h"
#include <unistd.h>
#include "readtags.h"
#include "CTagsManager.h"
#include "Edn.h"
/**
* @brief Main start function of the system
*
* @param[in] argc number of argument when called
* @param[in] argv sus nomer arguments
*
* @return EXIT_SUCCESS, all time
*
*/
int main (int argc, char *argv[])
{
EDN_INFO("Start Edn");
//Edn::TestUntaire_String();
//return 0;
// Use and remove GTK arguments from the application argument list.
gtk_init (&argc, &argv);
// init internal global value
globals::init();
ClipBoard::Init();
Display::Init();
//MainWindows *window = MainWindows::getInstance();
// init ALL Singleton :
(void)MsgBroadcastCore::getInstance();
(void)AccelKey::getInstance();
(void)WindowsManager::getInstance();
(void)CTagsManager::getInstance();
BufferManager *myBufferManager = BufferManager::getInstance();
// set color and other trucs...
ColorizeManager *myColorManager = NULL;
myColorManager = ColorizeManager::getInstance();
Edn::String homedir;
#ifdef NDEBUG
homedir = getenv("HOME");
homedir += "/.edn/";
#else
homedir = "./";
#endif
homedir += "data/color_black.xml";
myColorManager->LoadFile( homedir.c_str() );
myColorManager->DisplayListOfColor();
HighlightManager *myHighlightManager = NULL;
myHighlightManager = HighlightManager::getInstance();
myHighlightManager->loadLanguages();
// open display
MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__GUI_SHOW_MAIN_WINDOWS);
// get the curent program folder
char cCurrentPath[FILENAME_MAX];
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
return -1;
}
cCurrentPath[FILENAME_MAX - 1] = '\0';
//EDN_INFO("The current working directory is " << cCurrentPath);
// add files
EDN_INFO("show list of files : ");
for( int32_t i=1 ; i<argc; i++) {
EDN_INFO("need load file : \"" << argv[i] << "\"" );
Edn::String myfile = "";
// Special case for the root file origin
if ('/' != argv[i][0]) {
myfile+=cCurrentPath;
myfile+="/";
}
myfile+=(char *)argv[i];
if (false == myBufferManager->Exist(myfile) ) {
int32_t idBuffOpened = myBufferManager->Open(myfile);
if (1==i) {
MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idBuffOpened);
}
}
}
EDN_INFO("Start gtk main");
gtk_main();
EDN_INFO("Stop gtk main");
//Kill all singleton
EDN_INFO("Stop BufferManager");
BufferManager::kill();
EDN_INFO("Stop ColorizeManager");
ColorizeManager::kill();
EDN_INFO("Stop Search");
Search::kill();
EDN_INFO("Stop Accel key");
AccelKey::kill();
EDN_INFO("Stop Display");
Display::UnInit();
EDN_INFO("Stop Edn");
return EXIT_SUCCESS;
}

View File

@@ -1,179 +0,0 @@
/**
*******************************************************************************
* @file AL_Mutex.c
* @brief Editeur De N'ours : Abstraction Layer Mutex
* @author Edouard DUPIN
* @date 04/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "AL_Mutex.h"
// /usr/include/pthread.h
/**
* @brief initialize the curent Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
* @param[in] recursive Enable the possibility that one thread can lock multiple time the same Mutex
*
* @return an standard Error Code (ERR_NONE / ERR_FAIL)
*
*/
erreurCode_te AL_mutex_init(AL_MUTEX * pointerMutex,bool recursive)
{
int systemRet;
pthread_mutexattr_t mutexattr;
erreurCode_te myError= ERR_NONE;
EDN_CHECK_INOUT(pointerMutex);
// init mutex attributes
systemRet = pthread_mutexattr_init(&mutexattr);
if (0 == systemRet) {
if (true == recursive) {
systemRet = pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE_NP);
EDN_ASSERT(!systemRet, "pthread_mutexattr_settype Error");
}
else {
systemRet = pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK_NP);
EDN_ASSERT(!systemRet, "pthread_mutexattr_settype Error");
}
}
if (0 == systemRet) {
systemRet = pthread_mutex_init(pointerMutex, &mutexattr);
EDN_ASSERT(!systemRet, "pthread_mutex_init Error Mutex Init");
if (systemRet) {
myError = ERR_FAIL;
}
}
systemRet = pthread_mutexattr_destroy(&mutexattr);
EDN_ASSERT(0 == systemRet, "pthread_mutexattr_destroy Error");
return myError;
}
/**
* @brief Destroy the current Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return an standard Error Code (ERR_NONE / ERR_FAIL)
*
*/
erreurCode_te AL_mutex_destroy(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_destroy(pointerMutex);
EDN_ASSERT(!systemRet, "pthread_mutex_destroy Error Mutex Destroy");
if (systemRet) {
return ERR_FAIL;
}
return ERR_NONE;
}
/**
* @brief Lock the curent Mutex. Lock call
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return ---
*
*/
void AL_mutex_lock(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_lock(pointerMutex);
EDN_ASSERT(!systemRet, "pthread_mutex_lock Error Mutex lock");
}
/**
* @brief Unlock the current Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return ---
*
*/
void AL_mutex_unlock(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_unlock(pointerMutex);
EDN_ASSERT(!systemRet, "pthread_mutex_unlock Error Mutex unlock");
}
/**
* @brief Try the lock of the curent Mutex
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return an standard Error Code (ERR_NONE / ERR_BUSY)
*
*/
erreurCode_te AL_mutex_trylock(AL_MUTEX * pointerMutex)
{
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
systemRet = pthread_mutex_trylock(pointerMutex);
EDN_ASSERT(0==systemRet || EBUSY==systemRet, "pthread_mutex_trylock Error Mutex unlock");
if (EBUSY==systemRet) {
return ERR_BUSY;
}
return ERR_NONE;
}
/**
* @brief try lock in a periode of time
*
* @param[in,out] pointerMutex Pointer on the mutex that might be init
*
* @return an standard Error Code (ERR_NONE / ERR_TIMEOUT)
*
*/
erreurCode_te AL_mutex_timedlock(AL_MUTEX * pointerMutex, int32_t delay)
{
/*
int systemRet;
EDN_CHECK_INOUT(pointerMutex);
if (0 == delay) {
return ERR_NONE;
}
// TODO ... check is it OK...
systemRet = pthread_mutex_timedlock(pointerMutex, delay);
EDN_ASSERT(0 == systemRet || ETIMEDOUT == systemRet, "pthread_mutex_timedlock Error");
if (ETIMEDOUT == systemRet) {
return ERR_TIMEOUT;
}
*/
return ERR_NONE;
}

View File

@@ -1,45 +0,0 @@
/**
*******************************************************************************
* @file AL_Mutex.h
* @brief Editeur De N'ours : Abstraction Layer Mutex
* @author Edouard DUPIN
* @date 04/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __AL_MUTEX_H__
#define __AL_MUTEX_H__
//basic mutex with pthread system
#include <pthread.h>
#include <errno.h>
typedef pthread_mutex_t AL_MUTEX;
erreurCode_te AL_mutex_init(AL_MUTEX * pointerMutex,bool recursive);
erreurCode_te AL_mutex_destroy(AL_MUTEX * pointerMutex);
void AL_mutex_lock(AL_MUTEX * pointerMutex);
void AL_mutex_unlock(AL_MUTEX * pointerMutex);
erreurCode_te AL_mutex_trylock(AL_MUTEX * pointerMutex);
//erreurCode_te AL_mutex_timedlock(AL_MUTEX * pointerMutex, int32_t delay);
#endif

View File

@@ -1,212 +0,0 @@
/**
*******************************************************************************
* @file EdnBuf.h
* @brief Editeur De N'ours : Buffer for internal Data (header)
* @author Edouard DUPIN
* @date 23/03/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EDN_BUF_H__
#define __EDN_BUF_H__
/* Maximum length in characters of a tab or control character expansion
of a single buffer character */
#define MAX_EXP_CHAR_LEN 20*4
class EdnBuf;
#include "EdnVectorBuf.h"
#include "EdnBufHistory.h"
#include "HighlightManager.h"
#include "charset.h"
/*
rectStart rectStart
start ************* *************
********** * xxxx*xxxxxx *
* ******** xxxx*xxxxxxxxxxx*xxxxx
end *************** *************
rectEnd rectEnd
*/
typedef struct {
bool selected; //!< True if the selection is active
bool rectangular; //!< True if the selection is rectangular
bool zeroWidth; //!< Width 0 selections aren't "real" selections, but they can be useful when creating rectangular selections from the keyboard.
int32_t start; //!< Pos. of start of selection, or if rectangular start of line containing it.
int32_t end; //!< Pos. of end of selection, or if rectangular end of line containing it.
int32_t rectStart; //!< Indent of left edge of rect. selection
int32_t rectEnd; //!< Indent of right edge of rect. selection
} selection;
typedef enum{
SELECTION_PRIMARY,
SELECTION_SECONDARY,
SELECTION_HIGHTLIGHT,
SELECTION_SIZE
}selectionType_te;
typedef struct {
std::vector<colorInformation_ts> HLData;
int32_t idSequence;
int32_t posHLPass1;
int32_t posHLPass2;
}displayHLData_ts;
class EdnBuf {
public:
// constructer
EdnBuf(void);
// destructer
~EdnBuf(void);
// public function :
void GetAll( EdnVectorBin<int8_t> &text);
void SetAll( EdnVectorBin<int8_t> &text);
void GetRange( int32_t start, int32_t end, EdnVectorBin<int8_t> &output);
bool DumpIn( FILE *myFile);
bool DumpFrom( FILE *myFile);
// replace with operator [] ...
int8_t operator[] (int32_t);
void Insert( int32_t pos, EdnVectorBin<int8_t> &insertText);
void Replace( int32_t start, int32_t end, EdnVectorBin<int8_t> &insertText);
void Remove( int32_t start, int32_t end);
int32_t Indent( selectionType_te select);
int32_t UnIndent( selectionType_te select);
void GetLineText( int32_t pos, EdnVectorBin<int8_t> &text);
int32_t StartOfLine( int32_t pos);
int32_t EndOfLine( int32_t pos);
int32_t GetExpandedChar( int32_t &pos, int32_t indent, char outUTF8[MAX_EXP_CHAR_LEN], uint32_t &currentChar);
int32_t ExpandCharacter( char c, int32_t indent, char outUTF8[MAX_EXP_CHAR_LEN]); // 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 CountForwardDispChars( int32_t lineStartPos, int32_t nChars);
int32_t CountLines( int32_t startPos, int32_t endPos);
int32_t CountLines( void);
int32_t CountLines( EdnVectorBin<int8_t> &data);
int32_t CountForwardNLines( int32_t startPos, int32_t nLines);
int32_t CountBackwardNLines( int32_t startPos, int32_t nLines);
bool SearchForward( int32_t startPos, EdnVectorBin<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive = true);
bool SearchBackward( int32_t startPos, EdnVectorBin<int8_t> &searchVect, int32_t *foundPos, bool caseSensitive = true);
bool SearchForward( int32_t startPos, char searchChar, int32_t *foundPos);
bool SearchBackward( int32_t startPos, char searchChar, int32_t *foundPos);
bool SelectAround( int32_t startPos, int32_t &beginPos, int32_t &endPos);
// Buffer Size system :
int32_t Size(void) { return m_data.Size(); };
int32_t NumberOfLines(void) {return m_nbLine;};
// -----------------------------------------
// selection remember...
// -----------------------------------------
public:
bool SelectHasSelection( selectionType_te select);
void Select( selectionType_te select, int32_t start, int32_t end);
void Unselect( selectionType_te select);
void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
void GetSelectionText( selectionType_te select, EdnVectorBin<int8_t> &text);
void RemoveSelected( selectionType_te select);
void ReplaceSelected( selectionType_te select, EdnVectorBin<int8_t> &text);
private:
// current selection of the buffer
selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer
void UpdateSelection( selectionType_te select, int32_t pos, int32_t nDeleted, int32_t nInserted);
void UpdateSelections( int32_t pos, int32_t nDeleted, int32_t nInserted);
// -----------------------------------------
// History section :
// -----------------------------------------
public:
int32_t Undo( void);
int32_t Redo( void);
private:
bool m_isUndoProcessing;
bool m_isRedoProcessing;
EdnVectorBin<EdnBufHistory*> m_historyUndo;
EdnVectorBin<EdnBufHistory*> m_historyRedo;
// -----------------------------------------
// hightlight section :
// -----------------------------------------
private:
Highlight * m_Highlight; //!< internal link with the Highlight system
std::vector<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
void CleanHighLight(void);
void FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded);
public:
void SetHLSystem( Highlight * newHLSystem);
void HightlightGenerateLines(displayHLData_ts & MData, int32_t startPos, int32_t nbLines);
colorInformation_ts * GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos);
private:
colorInformation_ts * GetElementColorAtPosition(int32_t pos, int32_t &starPos);
private:
EdnVectorBuf m_data; //!< buffer of the data in the mode int8_t
void CountNumberOfLines(void);
int32_t m_nbLine; //!< Number of line in the biffer
// -----------------------------------------
// Display property and charset ...
// -----------------------------------------
public:
int32_t GetTabDistance(void) { return m_tabDist; } ;
void SetTabDistance(int32_t tabDist) { m_tabDist = tabDist; };
charset_te GetCharsetType(void) { return m_charsetType; };
void SetCharsetType(charset_te newOne) { m_charsetType = newOne; if (EDN_CHARSET_UTF8==newOne){m_isUtf8=true;} else {m_isUtf8=false;} };
bool GetUTF8Mode(void) { return m_isUtf8; };
void SetUTF8Mode(bool newOne) { m_isUtf8 = newOne; m_charsetType=EDN_CHARSET_UTF8; };
private:
// Special mode of the buffer :
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
// Local Tabulation policies
int32_t m_tabDist; //!< equiv. number of characters in a tab
bool m_useTabs; //!< True if buffer routines are allowed to use tabs for padding in rectangular operations
// -----------------------------------------
// Local function :
// -----------------------------------------
private:
void findRectSelBoundariesForCopy( int32_t lineStartPos, int32_t rectStart, int32_t rectEnd, int32_t *selStart, int32_t *selEnd);
char *getSelectionText( selection &sel);
void removeSelected( selection &sel);
void replaceSelected( selection &sel, const char *text);
void eventModification( int32_t pos, int32_t nInserted, EdnVectorBin<int8_t> &deletedText);
int32_t insert( int32_t pos, EdnVectorBin<int8_t> &insertText);
bool charMatch( char first, char second, bool caseSensitive = true);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,261 +0,0 @@
/**
*******************************************************************************
* @file EdnRegExp.h
* @brief Editeur De N'ours : Regular expression annalyser (header)
* @author Edouard DUPIN
* @date 04/04/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EDN_REG_EXP_H__
#define __EDN_REG_EXP_H__
class EdnRegExp;
#include "EdnTree.h"
#include "EdnBuf.h"
#include "EdnVectorBin.h"
#include "EdnVectorBuf.h"
/*
normal mode :
(...) sub element is separate with |
\d Digits [0-9]
\D NOT a digit [^0-9]
\l Letters [a-zA-Z]
\L NOT a Letter [^a-zA-Z]
\s Whitespace [ \t\n\r\f\v]
\S NOT Whitespace [^ \t\n\r\f\v]
\w "Word" character [a-zA-Z0-9_]
\W NOT a "Word" character [^a-zA-Z0-9_]
\@ at the start or the end not in the parsing of element ==> check if \w is not present (other regExp will be <> ...)
[anjdi] or [a-gt-j] range
. dot [^\x00-\x08\x0A-\x1F\x7F]
==> TODO :
$ End / Start of line of line ==> ce sera un truc supl<70>mentaire comme le \@
^in the [] invertion of the range element
multiplicity :
* ==> {0, 2147483647}
? ==> {0, 1}
+ ==> {1, 2147483647}
{x} ==> {x, x}
{x,y} ==> {x, y}
*/
class RegExpNode;
/**
* @brief Node Elements for every-one
*/
class RegExpNode{
public :
RegExpNode(void);
virtual ~RegExpNode(void) { };
virtual int32_t Generate(EdnVectorBin<int16_t> &data, int32_t startPos, int32_t nbElement);
virtual bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
virtual void Display(int32_t level);
void SetMult(int32_t min, int32_t max);
protected:
int32_t GetMultMin(void) { return m_multipleMin; };
int32_t GetMultMax(void) { return m_multipleMax; };
protected :
int32_t m_multipleMin; //!< minimum repetition (included)
int32_t m_multipleMax; //!< maximum repetition (included)
// Data Section ... (can have no data...)
EdnVectorBin<int16_t> m_RegExpData; //!< data to parse and compare in some case ...
};
class RegExpNodePThese : public RegExpNode {
public :
RegExpNodePThese(void) { };
~RegExpNodePThese(void);
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<RegExpNode*> m_subNode;
//int32_t m_posPthese; //!< position of the element is detected in the output element
};
class RegExpNodePTheseElem : public RegExpNode {
public :
RegExpNodePTheseElem(void) { };
~RegExpNodePTheseElem(void);
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<RegExpNode*> m_subNode;
private :
bool SetMultiplicityOnLastNode(int32_t min, int32_t max);
};
class RegExpNodeValue : public RegExpNode {
public :
RegExpNodeValue(void) { };
~RegExpNodeValue(void) { };
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<char> m_data;
};
class RegExpNodeBracket : public RegExpNode {
public :
RegExpNodeBracket(void) { };
~RegExpNodeBracket(void) { };
int32_t Generate(EdnVectorBin<int16_t> &data);
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
protected :
// SubNodes :
EdnVectorBin<char> m_data;
};
class RegExpNodeDigit : public RegExpNode {
public :
RegExpNodeDigit(void) { };
~RegExpNodeDigit(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeDigitNot : public RegExpNode {
public :
RegExpNodeDigitNot(void) { };
~RegExpNodeDigitNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeLetter : public RegExpNode {
public :
RegExpNodeLetter(void) { };
~RegExpNodeLetter(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeLetterNot : public RegExpNode {
public :
RegExpNodeLetterNot(void) { };
~RegExpNodeLetterNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWhiteSpace : public RegExpNode {
public :
RegExpNodeWhiteSpace(void) { };
~RegExpNodeWhiteSpace(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWhiteSpaceNot : public RegExpNode {
public :
RegExpNodeWhiteSpaceNot(void) { };
~RegExpNodeWhiteSpaceNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWordChar : public RegExpNode {
public :
RegExpNodeWordChar(void) { };
~RegExpNodeWordChar(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeWordCharNot : public RegExpNode {
public :
RegExpNodeWordCharNot(void) { };
~RegExpNodeWordCharNot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeDot : public RegExpNode {
public :
RegExpNodeDot(void) { };
~RegExpNodeDot(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeSOL : public RegExpNode {
public :
RegExpNodeSOL(void) { };
~RegExpNodeSOL(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
class RegExpNodeEOL : public RegExpNode {
public :
RegExpNodeEOL(void) { };
~RegExpNodeEOL(void) { };
bool Parse(EdnVectorBuf &data, int32_t currentPos, int32_t lenMax, int32_t &findLen);
void Display(int32_t level);
};
typedef struct {
int32_t start;
int32_t stop;
}elementPos_ts;
// Regular expression manager
class EdnRegExp {
// public API :
public:
// create the regular expression
EdnRegExp(const char *exp);
EdnRegExp(Edn::String &exp);
EdnRegExp(void);
~EdnRegExp(void);
void SetRegExp(const char *exp);
void SetRegExp(Edn::String &exp);
Edn::String GetRegExp(void) { return m_expressionRequested;};
bool GetStatus(void) { return m_isOk;};
// process the regular expression
bool Process( EdnVectorBuf &SearchIn,
int32_t startPos,
int32_t endPos,
char escapeChar=0);
int32_t Start(void) { return m_areaFind.start; };
int32_t Stop(void) { return m_areaFind.stop; };
void Display(void);
// internal parameters
private:
Edn::String m_expressionRequested; // TODO : Remove ...
elementPos_ts m_areaFind; //!< position around selection
RegExpNodePThese m_exprRootNode; //!< The tree where data is set
bool m_isOk; //!< Known if we can process with this regExp
bool m_notBeginWithChar; //!< The regular expression must not have previously a char [a-zA-Z0-9_]
bool m_notEndWithChar; //!< The regular expression must not have after the end a char [a-zA-Z0-9_]
// internal access
private:
bool CheckGoodPosition(EdnVectorBin<int16_t> tmpExp, int32_t &pos);
bool CheckGoodPosition(EdnVectorBin<int16_t> tmpExp);
};
#endif

View File

@@ -1,29 +0,0 @@
#include "tools_debug.h"
#include "tools_globals.h"
#include "EdnVectorBin.h"
void TestTemplate(void)
{
EDN_WARNING("Start Template Test ...");
EdnVectorBin<int32_t> plop;
EdnVectorBin<int8_t> plop2;
plop.PushBack(15365);
plop.PushBack(1);
plop.PushBack(2);
plop.PushBack(3);
plop.PushBack(4);
EDN_INFO("data is : " << plop[0]);
EDN_INFO("data is : " << plop[1]);
EDN_INFO("data is : " << plop[2]);
EDN_INFO("data is : " << plop[3]);
plop2.PushBack(65);
EDN_INFO("data is : " << plop2[0]);
}

View File

@@ -1,186 +0,0 @@
/**
*******************************************************************************
* @file EdnTree.h
* @brief Editeur De N'ours : Basic tree in a vector For none expensive tree (template)
* @author Edouard DUPIN
* @date 04/04/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EDN_TREE_H__
#define __EDN_TREE_H__
#undef __class__
#define __class__ "EdnTreeElement"
template < class T > class EdnTreeElement
{
public:
EdnTreeElement(int32_t parent, int32_t id, T &maNouvelleClass) : elementPtr(NULL), m_parent(parent), m_id(id)
{
elementPtr = new T(maNouvelleClass);
};
~EdnTreeElement(void)
{
delete(elementPtr);
};
EdnTreeElement(const EdnTreeElement &mustCopy ) : elementPtr(NULL), m_parent(mustCopy.m_parent), m_id(mustCopy.m_id)
{
elementPtr = new T(*mustCopy.elementPtr);
}
int32_t GetParrent(void) { return m_parent;};
int32_t GetId(void) { return m_id;};
T* GetPtr() const
{
return elementPtr;
};
private:
T* elementPtr; // pointer on the curent element
int32_t m_parent;
int32_t m_id;
};
#undef __class__
#define __class__ "EdnTree"
#define ROOT_NODE_ID (-1)
template < class T > class EdnTree
{
public:
// constructeur et destructeur
EdnTree(void)
{
m_LastId = 0;
};
~EdnTree(void)
{
};
// Common function ...
int32_t GetNumberNode(void)
{
return m_listElement.size();
};
int32_t GetDepth(void)
{
// TODO : ...
return 0;
};
//!< add an element in the tree
int32_t Add(T &maNouvelleClass, int32_t parent=-1)
{
if (true == CheckPresenceParrent(parent)) {
// create the local element
EdnTreeElement<T> nouvelElement(parent, m_LastId, maNouvelleClass);
// add it in the list
m_listElement.push_back(nouvelElement);
// increment the ID of the element
m_LastId++;
// Add is Ok, in theory ...
return m_LastId-1;
}
return -2;
};
bool Remove(int32_t id)
{
return false;
};
bool Clear(void)
{
return false;
};
T* Get(int32_t id)
{
// try to find ID
int32_t realID = FindElementWithId(id);
// when we find it, check it
if (0 > realID || realID >= m_LastId) {
return NULL;
}
// Return the element :
return m_listElement[realID].GetPtr();
};
std::vector<int32_t> GetListSubNode( int32_t parentId = ROOT_NODE_ID)
{
std::vector<int32_t> res;
int32_t i;
for (i=0; i<(int32_t)m_listElement.size(); i++) {
if (m_listElement[i].GetParrent() == parentId) {
// Add the element ID in the list ...
res.push_back(m_listElement[i].GetId());
}
}
return res;
};
std::vector<int32_t> Root(void)
{
return GetListSubNode(ROOT_NODE_ID);
};
private:
int32_t m_LastId;
std::vector< EdnTreeElement<T> > m_listElement; //!< list of element...
bool CheckPresence(int32_t id)
{
int32_t i;
for (i=0; i<(int32_t)m_listElement.size(); i++) {
if (m_listElement[i].GetId() == id) {
return true;
}
}
return false;
};
bool CheckPresenceParrent(int32_t parrentId)
{
if (ROOT_NODE_ID == parrentId) {
return true;
}
return CheckPresence(parrentId);
};
int32_t FindElementWithId(int32_t id)
{
int32_t i;
for (i=0; i<(int32_t)m_listElement.size(); i++) {
if (m_listElement[i].GetId() == id) {
return i;
}
}
return ROOT_NODE_ID;
};
};
#undef __class__
#define __class__ NULL
#endif

View File

@@ -1,497 +0,0 @@
/**
*******************************************************************************
* @file EdnEdnVector.h
* @brief Editeur De N'ours : Basic EdnVector (template)
* @author Edouard DUPIN
* @date 07/04/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EDN_EdnVector_H__
#define __EDN_EdnVector_H__
#undef __class__
#define __class__ "EdnEdnVector"
/**
* @brief EdnVector classes ...
*
* @tparam[in] T The type of objects to store.
* @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200)
*
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
*
* m_data
* ---------- |-----------------------|
* | 0 |-------->| Class Data |
* |--------| |-----------------------|
* | 1 |----|
* |--------| |
* | 2 |====|==============| |-----------------------|
* |--------| | --->| Class Data |
* m_count | 3 |-| | |-----------------------|
* |--------| | |
* | x | | | |-----------------------|
* |--------| | -------->| Class Data |
* | x | | |-----------------------|
* |--------| |
* | x | |
* |--------| | |-----------------------|
* | x | --------------------->| Class Data |
* |--------| |-----------------------|
* | x |
* |--------|
* | x |
* |--------|
* m_size | x |
* ----------
*
*/
template<class T, int32_t INC=0> class EdnVector:
{
public:
class Iterator:
{
// Private data :
private:
int32_t m_current; // curent Id on the vector
EdnVector<T> * m_EdnVector; // Pointer on the curent element of the vector
public:
/**
* @brief Basic itarator constructor with no link with an EdnVector
*/
Iterator():
m_current(-1),
m_EdnVector(NULL)
{
// nothing to do ...
}
/**
* @brief Recopy constructor on a specific EdnVector.
* @param[in] otherIterator The Iterator that might be copy
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_EdnVector(otherIterator.m_EdnVector)
{
// nothing to do ...
}
/**
* @brief Asignation operator.
* @param[in] otherIterator The Iterator that might be copy
* @return reference on the curent Iterator
*/
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_EdnVector = otherIterator.m_EdnVector;
return *this;
}
/**
* @brief Basic destructor
*/
~Iterator()
{
m_current = -1;
m_EdnVector = NULL;
}
/**
* @brief basic boolean cast
* @return true if the element is present in the EdnVector size
*/
operator bool ()
{
if( 0 <= m_current
&& m_current < m_EdnVector->Size() )
{
return true;
} else {
return false;
}
}
/**
* @brief Incremental operator
* @return Reference on the current iterator incremented
*/
Iterator& operator++ ()
{
if( NULL != m_EdnVector
&& m_current < m_EdnVector->Size() )
{
m_current++;
}
return *this;
}
/**
* @brief Decremental operator
* @return Reference on the current iterator decremented
*/
Iterator& operator-- ()
{
if (m_current >= 0) {
m_current--;
}
return *this;
}
/**
* @brief Incremental operator
* @return Reference on a new iterator and increment the other one
*/
Iterator operator++ (int32_t)
{
Iterator it(*this);
++(*this);
return it;
}
/**
* @brief Decremental operator
* @return Reference on a new iterator and decrement the other one
*
*/
Iterator operator-- (int32_t)
{
Iterator it(*this);
--(*this);
return it;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
T * operator-> () const
{
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_EdnVector->Size());
return &m_EdnVector->Get(m_current);
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
T & operator* () const
{
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_EdnVector->Size());
return m_EdnVector->Get(m_current);
}
private:
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator(EdnVector<T> * EdnVector, int pos):
m_current(pos),
m_EdnVector(EdnVector)
{
// nothing to do ...
}
friend class EdnVector;
};
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
EdnVector(int count = 0):
m_data(NULL),
m_count(0),
m_size(0)
{
Resize(count);
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
EdnVector(const EdnVector<T> & EdnVector):
m_size(EdnVector.m_size),
m_count(EdnVector.m_count),
m_data(NULL)
{
int32_t i;
EDN_MALLOC_CAST(m_data, m_size, T, reinterpret_cast<T*>);
for(i=0; i<m_count; i++) {
new (&m_data[i]) T(EdnVector[i]);
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
~EdnVector()
{
Destroy();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
EdnVector& operator=(const EdnVector<T> & EdnVector)
{
int32_t i;
this->~EdnVector();
m_size = EdnVector.m_size;
m_count = EdnVector.m_count;
EDN_MALLOC_CAST(m_data, m_size, T, reinterpret_cast<T*>);
for(i=0; i<m_count; i++) {
new (&m_data[i]) T(EdnVector[i]);
}
return *this;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t Size()
{
return m_count;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
T& Get(int32_t pos)
{
return m_data[pos];
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
T& operator[] (int32_t pos)
{
return Get(pos);
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
const T& operator[] (int32_t pos) const
{
return m_data[pos];
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int IndexOf(const T * item) const
{
int32_t res = item - m_data;
if( 0 > res
|| res >= Size())
{
return -1
} else {
return res;
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void PushBack(const T& item)
{
int32_t idx = Size();
Resize(idx+1);
Get(idx) = item;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator Get(int pos)
{
return Iterator(this, pos);
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator Begin()
{
return Get(0);
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator End()
{
return Get( Size()-1 );
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Resize(int32_t count)
{
int32_t i;
// Reallocate memory
if (count > m_size) {
ChangeAllocation(count);
}
// Remove deprecated element
for(i=count; i<m_count; i++) {
m_data[i].~T();
}
// Create nex item
for(i=m_count;i<count;i++) {
new (&m_data[i]) T();
}
m_count = count;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void ChangeAllocation(int count)
{
if (count > m_size) {
// generate new size
while(count > m_size) {
if (INC) {
m_size = (m_size + INC)
} else if (m_size==0) {
m_size = 1;
} else {
m_size = m_size * 2;
}
}
// Allocate the curent element
T * data = NULL;
EDN_MALLOC_CAST(data, m_size, T, reinterpret_cast<T*>);
for(int i=0; i<m_count; i++) {
new (&data[i]) T(m_data[i]);
}
Destroy();
m_data = data;
}
}
private:
T * m_data; //!< pointer on the current Data
int32_t m_count; //!< number of element
int32_t m_size; //!< current allocated size
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Destroy()
{
for(int i=0; i<m_count; i++) {
m_data[i].~T();
}
if (m_data) {
EDN_FREE(m_data);
}
}
};
#undef __class__
#define __class__ NULL

View File

@@ -1,642 +0,0 @@
/**
*******************************************************************************
* @file EdnEdnVectorBin.h
* @brief Editeur De N'ours : Basic EdnVectorBin for direct data insertion (template)
* @author Edouard DUPIN
* @date 07/04/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EDN_VECTOR_BIN_H__
#define __EDN_VECTOR_BIN_H__
#include "toolsMemory.h"
#undef __class__
#define __class__ "EdnEdnVectorBin"
/**
* @brief EdnVectorBin classes ...
*
* @tparam[in] SIZE Size of the current element.
*
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
*
* m_data
* <------------ m_dataSize ------------>
* ----------------------------------------
* | 0 |
* |--------------------------------------|
* | 1 |
* |--------------------------------------|
* | 2 |
* |--------------------------------------|
* m_size | 3 |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* m_allocated | x |
* ----------------------------------------
*
*/
template<typename MY_TYPE=int32_t> class EdnVectorBin
{
public:
class Iterator
{
// Private data :
private:
int32_t m_current; // curent Id on the vector
EdnVectorBin<MY_TYPE> * m_EdnVectorBin; // Pointer on the curent element of the vectorBin
public:
/**
* @brief Basic itarator constructor with no link with an EdnVector
*/
Iterator():
m_current(-1),
m_EdnVectorBin(NULL)
{
// nothing to do ...
}
/**
* @brief Recopy constructor on a specific EdnVector.
* @param[in] otherIterator The Iterator that might be copy
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_EdnVectorBin(otherIterator.m_EdnVectorBin)
{
// nothing to do ...
}
/**
* @brief Asignation operator.
* @param[in] otherIterator The Iterator that might be copy
* @return reference on the curent Iterator
*/
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_EdnVectorBin = otherIterator.m_EdnVectorBin;
return *this;
}
/**
* @brief Basic destructor
*/
~Iterator()
{
m_current = -1;
m_EdnVectorBin = NULL;
}
/**
* @brief basic boolean cast
* @return true if the element is present in the EdnVector size
*/
operator bool ()
{
if( 0 <= m_current
&& m_current < m_EdnVectorBin->Size() )
{
return true;
} else {
return false;
}
}
/**
* @brief Incremental operator
* @return Reference on the current iterator incremented
*/
Iterator& operator++ ()
{
if( NULL != m_EdnVectorBin
&& m_current < m_EdnVectorBin->Size() )
{
m_current++;
}
return *this;
}
/**
* @brief Decremental operator
* @return Reference on the current iterator decremented
*/
Iterator& operator-- ()
{
if (m_current >= 0) {
m_current--;
}
return *this;
}
/**
* @brief Incremental operator
* @return Reference on a new iterator and increment the other one
*/
Iterator operator++ (int32_t)
{
Iterator it(*this);
++(*this);
return it;
}
/**
* @brief Decremental operator
* @return Reference on a new iterator and decrement the other one
*/
Iterator operator-- (int32_t)
{
Iterator it(*this);
--(*this);
return it;
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator-> () const
{
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_EdnVectorBin->Size());
return &m_EdnVectorBin->Get(m_current);
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator* () const
{
EDN_CHECK_INOUT(m_current >= 0 && m_current < m_EdnVectorBin->Size());
return m_EdnVectorBin->Get(m_current);
}
private:
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator(EdnVectorBin<MY_TYPE> * Evb, int32_t pos):
m_current(pos),
m_EdnVectorBin(Evb)
{
// nothing to do ...
}
friend class EdnVectorBin;
};
private:
MY_TYPE * m_data; //!< pointer on the curetn table of Data
int32_t m_size; //!< nb Element in the buffer
int32_t m_allocated; //!< Current allocated size
int32_t m_increment; //!< methode of increment
public:
/**
* @brief Create an empty vector
* @param[in] count Minimum request size of the Buffer
*/
EdnVectorBin(int32_t count = 0):
m_data(NULL),
m_size(0),
m_allocated(0),
m_increment(1)
{
ChangeAllocation(count);
}
/**
* @brief Re-copy constructor (copy all needed data)
* @param[in] Evb Vector that might be copy
*/
EdnVectorBin(const EdnVectorBin<MY_TYPE> & Evb)
{
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
m_data = NULL;
//EDN_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
// allocate all same data
EDN_MALLOC(m_data, m_allocated, MY_TYPE);
EDN_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
/**
* @brief Destructor of the current Class
*/
~EdnVectorBin()
{
if (NULL!=m_data) {
EDN_FREE(m_data);
m_data = NULL;
m_allocated = 0;
m_size = 0;
m_increment = 0;
}
}
/**
* @brief Re-copy operator
* @param[in] Evb Vector that might be copy
* @return reference on the curent re-copy vector
*/
EdnVectorBin& operator=(const EdnVectorBin<MY_TYPE> & Evb)
{
//EDN_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
if( this != &Evb ) // avoid copy to itself
{
if (NULL!=m_data) {
EDN_FREE(m_data);
m_data = NULL;
}
// Set the new value
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
// allocate all same data
EDN_MALLOC(m_data, m_allocated, MY_TYPE);
EDN_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
// Return the curent pointer
return *this;
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
EdnVectorBin& operator+= (const EdnVectorBin<MY_TYPE> & Evb) // += operator
{
int32_t nbElememt = Evb.Size();
int32_t idx = m_size;
Resize(m_size+nbElememt);
memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) );
// Return the curent pointer
return *this;
}
/**
* @brief Set increment mode of this vector (default it match corectly with the number of element inside)
* @param[in] newIncrementNumber methode requested
*/
void SetIncrement(int32_t newIncrementNumber)
{
m_increment = newIncrementNumber;
}
/**
* @brief Get the number of element in the vector
* @return The number requested
*/
int32_t Size() const
{
return m_size;
}
/**
* @brief Get the Allocated size in the vector
* @return The size of allocation
*/
int32_t AllocatedSize() const
{
return m_allocated;
}
/**
* @brief Get a current element in the vector
* @param[in] pos Desired position read
* @return Reference on the Element
*/
MY_TYPE& Get(int32_t pos)
{
return m_data[pos];
}
/**
* @brief Get an copy Element an a special position
* @param[in] pos Position in the vector that might be get [0..Size()]
* @return An reference on the copy of selected element
*/
MY_TYPE& operator[] (int32_t pos)
{
return Get(pos);
}
/**
* @brief Get an Element an a special position
* @param[in] pos Position in the vector that might be get [0..Size()]
* @return An reference on the selected element
*/
const MY_TYPE& operator[] (int32_t pos) const
{
return m_data[pos];
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE& item)
{
int32_t idx = m_size;
Resize(m_size+1);
m_data[idx] = item;
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE * item, int32_t nbElement)
{
if (NULL == item) {
return;
}
int32_t idx = m_size;
Resize(m_size+nbElement);
memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove the last element of the vector
*/
void PopBack(void)
{
if(m_size>0) {
Resize(m_size-1);
}
}
/**
* @brief Remove all alement in the current vector
*/
void Clear(void)
{
if(m_size>0) {
Resize(0);
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE& item)
{
if (pos>m_size) {
EDN_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... ");
PushBack(item);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+1);
// move curent data
memmove((m_data + pos + 1), (m_data + pos), (tmpSize - pos)*sizeof(MY_TYPE) );
// affectation of the current element
m_data[pos] = item;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement)
{
if (pos>m_size) {
EDN_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... ");
PushBack(item, nbElement);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+nbElement);
// move curent data (after the position)
memmove((m_data + pos + nbElement), (m_data + pos), (tmpSize - pos)*sizeof(MY_TYPE) );
// affectation of all input element
memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove one element
*
* @param[in] pos Position to remove the data
*
* @return ---
*
*/
void Erase(int32_t pos)
{
if (pos>m_size) {
EDN_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
int32_t tmpSize = m_size;
// move curent data
memmove((m_data + pos), (m_data + pos + 1), (tmpSize - (pos+1))*sizeof(MY_TYPE) );
// Request resize of the current buffer
Resize(m_size-1);
}
/**
* @brief Remove one element
*
* @param[in] pos Position to remove the data
* @param[in] nbElement number of element to remove
*
* @return ---
*
*/
void Erase(int32_t pos, int32_t nbElement)
{
if (pos>m_size) {
EDN_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
if (pos+nbElement>m_size) {
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 extract data between two point :
* @param[in] posStart start position to extract data
* @param[in] posEnd End position to extract data
* @return the extracted vector
*/
EdnVectorBin Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
{
EdnVectorBin<MY_TYPE> out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
return out;
}
if (posEnd < 0) {
return out;
} else if (posEnd >= Size() ) {
posEnd = Size();
}
out.PushBack(&m_data[posStart], posEnd-posStart);
return out;
}
/**
* @brief Set the minimum allocation in memory for the curent vector ==> reallocate the
* buffer to fit exactly the mumber of element needed
*/
void Fit(void)
{
if (m_size > m_allocated) {
// Reallocate the curent data to the correct size ...
EDN_REALLOC(m_data, m_size, MY_TYPE);
}
// Check result with assert :
EDN_ASSERT(NULL!=m_data, "Error in data Fitting");
m_allocated = m_size;
}
/**
* @brief Get an iterator an an specific position
* @param[in] pos Requested position of the iterator in the vector
* @return The Iterator
*/
Iterator Position(int32_t pos)
{
return Iterator(this, pos);
}
/**
* @brief Get an Iterator on the start position of the Vector
* @return The Iterator
*/
Iterator Begin(void)
{
return Position(0);
}
/**
* @brief Get an Iterator on the end position of the Vector
* @return The Iterator
*/
Iterator End(void)
{
return Position( Size()-1 );
}
private:
/**
* @brief Change the current size of the vector
* @param[in] newSize New requested size of element in the vector
*/
void Resize(int32_t newSize)
{
// Reallocate memory
if (newSize > m_allocated) {
ChangeAllocation(newSize);
}
m_size = newSize;
}
/**
* @brief Change the current allocation to the corect one (depend on the current size)
* @param[in] newSize Minimum number of element needed
*/
void ChangeAllocation(int32_t newSize)
{
// set the minimal size to 1
if(newSize <= 0) {
newSize = 1;
}
int32_t requestSize = m_allocated;
// set the size with the corect chose type :
if (newSize == m_allocated) {
return;
} else if (newSize < requestSize) {
// down the size of the vector:
if (0==m_increment) {
// never down size...
} else {
int32_t devide = m_increment;
if (devide == 0) {
devide = 1;
}
int32_t numberOfStep = m_allocated / devide;
if (newSize< ((numberOfStep-2)*devide + devide/2) ) {
//Allow Reallocation of a new size shoerter
requestSize = ((newSize / devide)+1) * devide;
}
}
} else {
while(newSize > requestSize) {
if (0 == requestSize) {
requestSize = 1;
} else if (0==m_increment) {
requestSize = requestSize * 2;
} else {
requestSize = (requestSize + m_increment);
}
}
}
// No reallocation needed :
if (requestSize == m_allocated) {
return;
}
// check if something is allocated :
if (NULL == m_data) {
// no data allocated ==> request an allocation (might be the first)
EDN_MALLOC(m_data, requestSize, MY_TYPE);
} else {
// move datas
EDN_REALLOC(m_data, requestSize, MY_TYPE);
}
// Check result with assert :
EDN_ASSERT(NULL!=m_data, "Error in data allocation");
// set the new allocation size
m_allocated = requestSize;
}
};
#undef __class__
#define __class__ NULL
#endif

View File

@@ -1,85 +0,0 @@
/**
*******************************************************************************
* @file Singleton.h
* @brief Editeur De N'ours : singleton system class
* @author Edouard DUPIN
* @date 04/12/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __SINGLETON_H__
#define __SINGLETON_H__
#include <iostream>
using namespace std;
/////////////////////////////////////////////////////////////////////////////
//
// Singleton - modèle Singleton applicable à n'importe quelle classe.
//
/////////////////////////////////////////////////////////////////////////////
template <typename T>
class Singleton
{
protected:
// Constructeur/destructeur
Singleton() { }
~Singleton() { /*std::cout << "destroying singleton." << std::endl;*/ }
public:
// Interface publique
static T *getInstance()
{
if (NULL == _singleton)
{
/*std::cout << "C: Singleton | creating singleton." << std::endl;*/
_singleton = new T;
}
/*
else
{
std::cout << "C: Singleton | singleton already created!" << std::endl;
}
*/
return (static_cast<T*> (_singleton));
}
static void kill()
{
if (NULL != _singleton)
{
delete _singleton;
_singleton = NULL;
}
}
private:
// Unique instance
static T *_singleton;
};
template <typename T>
T *Singleton<T>::_singleton = NULL;
#endif

View File

@@ -1,114 +0,0 @@
/**
*******************************************************************************
* @file File.cpp
* @brief Editeur De N'ours : File folder and name abstraction (Sources)
* @author Edouard DUPIN
* @date 16/07/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Edn.h"
Edn::File::File(Edn::String &filename, int32_t LineNumber)
{
m_lineNumberOpen = 0;
SetCompleateName(filename);
}
Edn::File::File(Edn::String &filename, Edn::String &folder, int32_t lineNumber)
{
Edn::String tmpString = folder;
tmpString += '/';
tmpString += filename;
SetCompleateName(tmpString);
m_lineNumberOpen = lineNumber;
}
Edn::File::~File(void)
{
// nothing to do ...
}
void Edn::File::ExtranctAndName(Edn::String &inputString)
{
m_folder = "";
m_shortFilename = "";
for (int32_t iii=inputString.Size()-1; iii >= 0 ; iii--) {
/*
if (inputString[iii] != '/') {
m_shortFilename.Insert(0, inputString[iii]);
} else {
break;
}
*/
}
/*
char tmpVal[4096];
strncpy(tmpVal, inputString.c_str(), 4096);
tmpVal[4096-1] = '\0';
char *ptr = strrchr(tmpVal, '/');
if (NULL == ptr) {
ptr = strrchr(tmpVal, '\\');
}
Edn::String out = "./";
if (NULL != ptr) {
*ptr = '\0';
out = tmpVal;
out+= '/';
}
return out;
*/
}
Edn::String Edn::File::GetFolder(void)
{
return m_folder;
}
Edn::String Edn::File::GetShortFilename(void)
{
return m_shortFilename;
}
Edn::String Edn::File::GetCompleateName(void)
{
Edn::String out;
out = m_folder;
out += '/';
out += m_shortFilename;
}
void Edn::File::SetCompleateName(Edn::String &newFilename)
{
}
int32_t Edn::File::GetLineNumber(void)
{
return m_lineNumberOpen;
}

View File

@@ -1,53 +0,0 @@
/**
*******************************************************************************
* @file File.h
* @brief Editeur De N'ours : File folder and name abstraction (header)
* @author Edouard DUPIN
* @date 16/07/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef _IN_NAMESPACE_EDN_
# error This will be include only in "edn.h"
#else
class File
{
public:
File(void) { m_lineNumberOpen=0; }
File(Edn::String &filename, int32_t LineNumber = 0);
File(Edn::String &filename, Edn::String &folder, int32_t lineNumber = 0);
~File(void);
Edn::String GetFolder(void);
Edn::String GetShortFilename(void);
Edn::String GetCompleateName(void);
int32_t GetLineNumber(void);
void SetCompleateName(Edn::String &newFilename);
private :
void ExtranctAndName(Edn::String &inputString);
Edn::String m_folder;
Edn::String m_shortFilename;
int32_t m_lineNumberOpen;
};
#endif

View File

@@ -1,708 +0,0 @@
/**
*******************************************************************************
* @file EdnString.cpp
* @brief Editeur De N'ours : normal sting management... (sources)
* @author Edouard DUPIN
* @date 26/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "Edn.h"
#include "toolsMemory.h"
#undef __class__
#define __class__ "EdnString"
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String::~String(void)
{
m_data.Clear();
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String::String(void)
{
//EDN_INFO("new Edn::String()");
m_data.Clear();
m_data.PushBack('\0');
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String::String(const char myInput)
{
m_data.Clear();
m_data.PushBack(myInput);
m_data.PushBack('\0');
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String::String(const char* inputData, int32_t len)
{
m_data.Clear();
m_data.PushBack('\0');
Set(inputData, len);
}
void Edn::String::Set(const char * inputData, int32_t len)
{
// overwrite the len if needed :
if ((-1) == len) {
len = strlen(inputData);
}
if (len != 0) {
// remove the last '\0'
m_data.PopBack();
// copy the data ...
m_data.PushBack((int8_t*)inputData, len);
// add the last '\0'
m_data.PushBack('\0');
}
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String::String(int inputData)
{
char tmpVal[256];
// generate the string :
sprintf(tmpVal, "%d", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String::String(unsigned int inputData)
{
char tmpVal[256];
// generate the string :
sprintf(tmpVal, "%d", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
Edn::String::String(const Edn::String &ednS)
{
//EDN_INFO("Constructeur de recopie");
m_data = ednS.m_data;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const Edn::String& Edn::String::operator= (const Edn::String &ednS )
{
//EDN_INFO("OPERATOR de recopie");
if( this != &ednS ) // avoid copy to itself
{
m_data = ednS.m_data;
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const Edn::String& Edn::String::operator= (const char * inputData)
{
m_data.Clear();
m_data.PushBack('\0');
// calculate the size :
uint32_t len = strlen(inputData);
// check the new size ...
if (len > 0 ) {
// copy all data :
Set(inputData, len);
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const Edn::String& Edn::String::operator= (EdnVectorBin<int8_t> inputData)
{
m_data = inputData;
if (m_data.Size()>0) {
if (m_data[m_data.Size()-1] != '\0') {
m_data.PushBack('\0');
}
}
//EDN_DEBUG("m_dataLen="<<m_dataLen << " m_dataLenUTF8="<<m_dataLenUTF8 << " description=" << m_data);
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::String::operator== (const Edn::String& ednS) const
{
if( this != &ednS ) {
if (ednS.m_data.Size() != m_data.Size()) {
//EDN_DEBUG(" not the same size : " << ednS.m_data.Size() << "!=" << m_data.Size());
return false;
}
for (int32_t iii= 0; iii<m_data.Size(); iii++) {
//EDN_DEBUG(" check : " << ednS.m_data[iii] << "!=" << m_data[iii]);
if (ednS.m_data[iii]!= m_data[iii]){
return false;
}
}
return true;
}
return true;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::String::operator== (const char * inputData) const
{
// calculate the size :
int32_t len = strlen(inputData);
if (len+1 != m_data.Size()) {
return false;
}
for (int32_t iii= 0; iii<m_data.Size(); iii++) {
if (inputData[iii]!= m_data[iii]){
return false;
}
}
return true;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::String::operator!= (const Edn::String& ednS) const
{
return !(*this == ednS);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::String::operator!= (const char * inputData) const
{
return !(*this == inputData);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const Edn::String& Edn::String::operator+= (const Edn::String &ednS)
{
if (0 < ednS.Size()) {
// remove the last '\0'
m_data.PopBack();
// copy the data ...
m_data += ednS.m_data;
// This previous include the \0 in case of the 2 string are different...
if( this == &ednS ) {
// add the removed end string
m_data.PushBack('\0');
}
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const Edn::String& Edn::String::operator+= (const char * inputData)
{
//EDN_INFO(" string(arg) : \"" << inputData << "\"");
//EDN_INFO(" string(direct) : \"" << m_data << "\"");
int32_t len = strlen(inputData);
if (len != 0) {
// remove the last '\0'
m_data.PopBack();
// copy the data ...
m_data.PushBack((int8_t*)inputData, len+1 );
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String Edn::String::operator+ (const Edn::String &ednS)
{
Edn::String temp;
//EDN_INFO(" string(arg) : \"" << ednS.m_data << "\"");
//EDN_INFO(" string(direct) : \"" << m_data << "\"");
temp += *this;
temp += ednS;
return temp;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
Edn::String Edn::String::operator+ (const char * inputData)
{
Edn::String temp;
//EDN_INFO(" string(arg) : \"" << inputData << "\"");
//EDN_INFO(" string(direct) : \"" << m_data << "\"");
temp += *this;
temp += inputData;
return temp;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool Edn::String::IsEmpty(void) const
{
if(1 >= m_data.Size() ) {
return true;
} else {
return false;
}
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
int32_t Edn::String::Size(void) const
{
if (m_data.Size() == 0) {
return 0;
} else {
return m_data.Size() - 1;
}
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
void Edn::String::Add(int32_t currentID, const char* inputData)
{
// get the input lenght
int32_t len = strlen(inputData);
if (0 == len) {
EDN_WARNING("no data to add on the current string");
return;
} else if (currentID < 0) {
EDN_WARNING("Curent ID(" << currentID << ") < 0 ==> Add at the start");
currentID = 0;
} else if (currentID > Size() ) {
EDN_ERROR("Curent ID(" << currentID << ") > maxSize ... (" << Size() << ") ==> add at the end ...");
m_data.PushBack((int8_t*)inputData, len);
return;
}
m_data.Insert(currentID, (int8_t*)inputData, len);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
void Edn::String::Remove(int32_t currentID, int32_t len)
{
if (0 >= len) {
EDN_ERROR("no data to remove on the current string");
return;
}
// TODO : check the size of the data
m_data.Erase(currentID, len);
}
/**
* @brief Remove all element in the string
*
* @param ---
*
* @return ---
*
*/
void Edn::String::Clear(void)
{
m_data.Clear();
m_data.PushBack('\0');
}
/**
* @brief find the first accurence after the position indicated
*
* @param[in] element Element that might be find in the string
* @param[in] startPos Stert position to begin the search
*
* @return the position of the first occurence or -1 if not find...
*
*/
int32_t Edn::String::FindForward(const char element, int32_t startPos)
{
if (startPos < 0) {
startPos = 0;
} else if (startPos >= Size() ) {
return -1;
}
for (int32_t iii=startPos; iii< Size(); iii++) {
if (m_data[iii] == element) {
return iii;
}
}
return -1;
}
/**
* @brief find the first accurence before the position indicated.
*
* @param[in] element Element that might be find in the string
* @param[in] startPos Stert position to begin the search
*
* @return the position of the first occurence begining by the end or -1 if not find...
*
*/
int32_t Edn::String::FindBack(const char element, int32_t startPos)
{
if (startPos < 0) {
return -1;
} else if (startPos >= Size() ) {
startPos = Size();
}
for (int32_t iii=startPos; iii>=0; iii--) {
if (m_data[iii] == element) {
return iii;
}
}
return -1;
}
/**
* @brief Extract data from the data between two position
*
* @param[in] posStart Start position where to extract data
* @param[in] posEnd End position where to extract data
*
* @return the extracted string
*
*/
Edn::String Edn::String::Extract(int32_t posStart, int32_t posEnd)
{
Edn::String out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
return out;
}
if (posEnd < 0) {
return out;
} else if (posEnd >= Size() ) {
posEnd = Size();
}
out.m_data = m_data.Extract(posStart, posEnd);
out.m_data.PushBack('\0');
return out;
}
/**
* @brief Get a basic vector in int8 data with no \0 at the end of the string
*
* @param ---
*
* @return The desired vector with data
*
*/
EdnVectorBin<int8_t> Edn::String::GetVector(void)
{
EdnVectorBin<int8_t> out = m_data;
out.PopBack();
return out;
}
/**
* @brief Unitary test for the string system
*
* @param ---
*
* @return ---
*
*/
void Edn::TestUntaire_String(void)
{
EDN_WARNING("*********************************************************");
EDN_WARNING("** Test Unitaire 'EdnString' (START)");
EDN_WARNING("*********************************************************");
int32_t iddd = 0;
Edn::String * monString = new Edn::String();
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
delete(monString);
monString = new Edn::String("test de direct data");
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
delete(monString);
monString = new Edn::String("test de direct data", 7);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
delete(monString);
int32_t testId = -6789;
monString = new Edn::String(testId);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
delete(monString);
uint32_t testId2 = 12345;
monString = new Edn::String((unsigned int)testId2);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
delete(monString);
Edn::String plop = "otherString";
monString = new Edn::String(plop);
EDN_INFO("phase : " << iddd++ << " : \"" << monString->c_str() << "\"");
delete(monString);
Edn::String s1 = "test de base ...";
s1 += s1;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
s1 += " plop 2 ";
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
s1 += plop;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
s1 = plop;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
s1 = "test direct 44";
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
EdnVectorBin<int8_t> vb1;
vb1.PushBack('v');
vb1.PushBack('b');
vb1.PushBack('1');
s1 = vb1;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
vb1.Clear();
vb1.PushBack('v');
vb1.PushBack('b');
vb1.PushBack('2');
vb1.PushBack('\0');
s1 = vb1;
EDN_INFO("phase : " << iddd++ << " : \"" << s1.c_str() << "\"");
if (s1 == "vb2") {
EDN_INFO("phase : " << iddd++ << " : == OK");
} else {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
}
if (s1 == "vb3") {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
} else {
EDN_INFO("phase : " << iddd++ << " : == OK");
}
if (s1 != "vb3") {
EDN_INFO("phase : " << iddd++ << " : == OK");
} else {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
}
if (s1 != "vb2") {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
} else {
EDN_INFO("phase : " << iddd++ << " : == OK");
}
Edn::String s2 = "vb2";
Edn::String s3 = "vb3";
if (s1 == s2) {
EDN_INFO("phase : " << iddd++ << " : == OK");
} else {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
}
if (s1 == s3) {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
} else {
EDN_INFO("phase : " << iddd++ << " : == OK");
}
if (s1 != s3) {
EDN_INFO("phase : " << iddd++ << " : == OK");
} else {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
}
if (s1 != s2) {
EDN_ERROR("phase : " << iddd++ << " : == ERROR");
} else {
EDN_INFO("phase : " << iddd++ << " : == OK");
}
EDN_WARNING("*********************************************************");
EDN_WARNING("** Test Unitaire 'EdnString' (STOP)");
EDN_WARNING("*********************************************************");
}

View File

@@ -1,82 +0,0 @@
/**
*******************************************************************************
* @file EdnString.h
* @brief Editeur De N'ours : normal sting management... (header)
* @author Edouard DUPIN
* @date 26/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef _IN_NAMESPACE_EDN_
# error This will be include only in "edn.h"
#else
class String
{
public:
// Constructeurs
String(void);
String(const char myInput);
String(const char* inputData, int32_t len = -1);//, bool noAllocation=false);
void Set(const char* inputData, int32_t len=-1);
// basic convertion integer en string
String(int inputData);
String(unsigned int inputData);
//String(const wchar_t *inputData);
String(const Edn::String &ednS);
// destructor :
~String(void);
const Edn::String& operator= (const Edn::String &ednS ); // assigment
const Edn::String& operator= (const char * inputData);
const Edn::String& operator= (EdnVectorBin<int8_t> inputData);
bool operator== (const Edn::String& ednS) const; // == operator
bool operator== (const char * inputData) const;
bool operator!= (const Edn::String& ednS) const; // != operator
bool operator!= (const char * inputData) const;
const Edn::String& operator+= (const Edn::String &ednS); // += operator
const Edn::String& operator+= (const char * inputData);
Edn::String operator+ (const Edn::String &ednS); // + operator
Edn::String operator+ (const char * inputData);
//operator const char *()
bool IsEmpty(void) const;
int32_t Size(void) const;
void Add(int32_t currentID, const char* inputData);
void Remove(int32_t currentID, int32_t len);
void Clear(void);
EdnVectorBin<int8_t> GetVector(void);
char * c_str(void) { return (char*)&m_data[0]; };
// Sting operation :
int32_t FindForward(const char element, int32_t startPos=0);
int32_t FindBack(const char element, int32_t startPos=0x7FFFFFFF);
Edn::String Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF);
private :
EdnVectorBin<int8_t> m_data;
};
void TestUntaire_String(void);
#endif

View File

@@ -1,62 +0,0 @@
/**
*******************************************************************************
* @file tools_debug.h
* @brief Editeur De N'ours : log implementation
* @author Edouard DUPIN
* @date 08/06/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "time.h"
// Max string size : (wide screan console nb caractere)
#define EDN_LOG_MAX_LENGTH 250
#define FUNCTION_NAME_SIZE (50)
void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName)
{
char tmpName[FUNCTION_NAME_SIZE] = "";
if (NULL == className) {
snprintf(tmpName, FUNCTION_NAME_SIZE, "(l=%5d) %s ",ligne, funcName);
} else {
snprintf(tmpName, FUNCTION_NAME_SIZE, "(l=%5d) %s::%s ",ligne, className, funcName);
}
tmpName[FUNCTION_NAME_SIZE-4] = ' ';
tmpName[FUNCTION_NAME_SIZE-3] = '|';
tmpName[FUNCTION_NAME_SIZE-2] = ' ';
tmpName[FUNCTION_NAME_SIZE-1] = '\0';
std::cout << tmpName;
}
void TOOLS_DisplayTime(void)
{
time_t rawtime;
struct tm * timeinfo;
char tmpdata[50];
time ( &rawtime );
timeinfo = localtime ( &rawtime );
sprintf(tmpdata, " %2dh %2dmin %2ds | ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
std::cout << tmpdata ;
}

View File

@@ -1,155 +0,0 @@
/**
*******************************************************************************
* @file tools_debug.h
* @brief Editeur De N'ours : log implementation
* @author Edouard DUPIN
* @date 08/06/2010
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __TOOLS_DEBUG_H__
#define __TOOLS_DEBUG_H__
#include <iostream>
#include "types_generique.h"
// Log Message System For EDN
void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName);
void TOOLS_DisplayTime(void);
//regular colors
#define COLOR_BLACK "\e[0;30m"
#define COLOR_RED "\e[0;31m"
#define COLOR_GREEN "\e[0;32m"
#define COLOR_YELLOW "\e[0;33m"
#define COLOR_BLUE "\e[0;34m"
#define COLOR_MAGENTA "\e[0;35m"
#define COLOR_CYAN "\e[0;36m"
#define COLOR_WHITE "\e[0;37m"
//emphasized (bolded) colors
#define COLOR_BOLD_BLACK "\e[1;30m"
#define COLOR_BOLD_RED "\e[1;31m"
#define COLOR_BOLD_GREEN "\e[1;32m"
#define COLOR_BOLD_YELLOW "\e[1;33m"
#define COLOR_BOLD_BLUE "\e[1;34m"
#define COLOR_BOLD_MAGENTA "\e[1;35m"
#define COLOR_BOLD_CYAN "\e[1;36m"
#define COLOR_BOLD_WHITE "\e[1;37m"
//background colors
#define COLOR_BG_BLACK "\e[40m"
#define COLOR_BG_RED "\e[41m"
#define COLOR_BG_GREEN "\e[42m"
#define COLOR_BG_YELLOW "\e[43m"
#define COLOR_BG_BLUE "\e[44m"
#define COLOR_BG_MAGENTA "\e[45m"
#define COLOR_BG_CYAN "\e[46m"
#define COLOR_BG_WHITE "\e[47m"
// Return to the normal color setings
#define COLOR_NORMAL "\e[0m"
//go to the Top of bash
#define GO_TOP "\e[0;0f"
#undef __class__
#define __class__ (NULL)
/*
#define DEFINE_CLASS_NAME(name) #undef __class__ \
#define __class__ (#name)
at the start of the class :
#undef __class__
#define __class__ ""
*/
#define EDN_DBG_COMMON(color, info, data) do { \
std::cout << color; \
TOOLS_DisplayTime(); \
TOOLS_DisplayFuncName(__LINE__, __class__, __func__); \
std::cout << "[" << info << "] " << data; \
std::cout << COLOR_NORMAL <<std::endl; \
}while(0)
#define EDN_CRITICAL(data) EDN_DBG_COMMON(COLOR_BOLD_RED, "CC", data)
// General
#if EDN_DEBUG_LEVEL > 0
# define EDN_WARNING(data) EDN_DBG_COMMON(COLOR_MAGENTA, "WW", data)
# define EDN_ERROR(data) EDN_DBG_COMMON(COLOR_BOLD_RED, "EE", data)
#else
# define EDN_WARNING(data) do {}while(0)
# define EDN_ERROR(data) do {}while(0)
#endif
#if EDN_DEBUG_LEVEL > 1
# define EDN_INFO(data) EDN_DBG_COMMON(COLOR_CYAN, "II", data)
#else
# define EDN_INFO(data) do {}while(0)
#endif
#if EDN_DEBUG_LEVEL > 2
# define EDN_DEBUG(data) EDN_DBG_COMMON(COLOR_YELLOW, "DD", data)
#else
# define EDN_DEBUG(data) do {}while(0)
#endif
#if EDN_DEBUG_LEVEL > 0
# define EDN_ASSERT(cond, format, ...) \
do { \
if (!(cond)) { \
EDN_CRITICAL(format, ##__VA_ARGS__); \
assert(!#cond); \
} \
} while (0)
#else
# define EDN_ASSERT(cond, format, ...) \
do { \
assert(cond); \
} while (0)
#endif
#if EDN_DEBUG_LEVEL > 1
# define EDN_CHECK_INOUT(cond) EDN_ASSERT((cond), "Internal input error : "#cond)
#elif EDN_DEBUG_LEVEL > 0
// Critical warning mode
# define EDN_CHECK_INOUT(cond) \
do { \
if (!(cond)) { \
EDN_CRITICAL("Internal input error : "#cond);\
} \
} while (0)
#else
// Default : No check
# define EDN_CHECK_INOUT(cond) do { } while (0)
#endif
// Enable or disable the magic element checking...
#if EDN_DEBUG_LEVEL > 0
#define CHECK_MAGIC(cond) EDN_ASSERT((cond), "MAGIC check error : "#cond)
#define EDN_ENABLE_CHECK_MAGIC (1)
#else
#define CHECK_MAGIC(cond) do {}while(0)
#endif
#endif

View File

@@ -1,116 +0,0 @@
/*
www.sourceforge.net/projects/tinyxml
Original file by Yves Berquin.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
/*
* THIS FILE WAS ALTERED BY Tyge L<>vset, 7. April 2005.
*/
#ifndef TIXML_USE_STL
#include "tinystr.h"
// Error value for find primitive
const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
// Null rep.
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
void TiXmlString::reserve (size_type cap)
{
if (cap > capacity())
{
TiXmlString tmp;
tmp.init(length(), cap);
memcpy(tmp.start(), data(), length());
swap(tmp);
}
}
TiXmlString& TiXmlString::assign(const char* str, size_type len)
{
size_type cap = capacity();
if (len > cap || cap > 3*(len + 8))
{
TiXmlString tmp;
tmp.init(len);
memcpy(tmp.start(), str, len);
swap(tmp);
}
else
{
memmove(start(), str, len);
set_size(len);
}
return *this;
}
TiXmlString& TiXmlString::append(const char* str, size_type len)
{
size_type newsize = length() + len;
if (newsize > capacity())
{
reserve (newsize + capacity());
}
memmove(finish(), str, len);
set_size(newsize);
return *this;
}
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
{
TiXmlString tmp;
tmp.reserve(a.length() + b.length());
tmp += a;
tmp += b;
return tmp;
}
TiXmlString operator + (const TiXmlString & a, const char* b)
{
TiXmlString tmp;
TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
tmp.reserve(a.length() + b_len);
tmp += a;
tmp.append(b, b_len);
return tmp;
}
TiXmlString operator + (const char* a, const TiXmlString & b)
{
TiXmlString tmp;
TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
tmp.reserve(a_len + b.length());
tmp.append(a, a_len);
tmp += b;
return tmp;
}
#endif // TIXML_USE_STL

View File

@@ -1,319 +0,0 @@
/*
www.sourceforge.net/projects/tinyxml
Original file by Yves Berquin.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
/*
* THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
*
* - completely rewritten. compact, clean, and fast implementation.
* - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
* - fixed reserve() to work as per specification.
* - fixed buggy compares operator==(), operator<(), and operator>()
* - fixed operator+=() to take a const ref argument, following spec.
* - added "copy" constructor with length, and most compare operators.
* - added swap(), clear(), size(), capacity(), operator+().
*/
#ifndef TIXML_USE_STL
#ifndef TIXML_STRING_INCLUDED
#define TIXML_STRING_INCLUDED
#include <assert.h>
#include <string.h>
/* The support for explicit isn't that universal, and it isn't really
required - it is used to check that the TiXmlString class isn't incorrectly
used. Be nice to old compilers and macro it here:
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
// Microsoft visual studio, version 6 and higher.
#define TIXML_EXPLICIT explicit
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
// GCC version 3 and higher.s
#define TIXML_EXPLICIT explicit
#else
#define TIXML_EXPLICIT
#endif
/*
TiXmlString is an emulation of a subset of the std::string template.
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
Only the member functions relevant to the TinyXML project have been implemented.
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
a string and there's no more room, we allocate a buffer twice as big as we need.
*/
class TiXmlString
{
public :
// The size type used
typedef size_t size_type;
// Error value for find primitive
static const size_type npos; // = -1;
// TiXmlString empty constructor
TiXmlString () : rep_(&nullrep_)
{
}
// TiXmlString copy constructor
TiXmlString ( const TiXmlString & copy) : rep_(0)
{
init(copy.length());
memcpy(start(), copy.data(), length());
}
// TiXmlString constructor, based on a string
TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
{
init( static_cast<size_type>( strlen(copy) ));
memcpy(start(), copy, length());
}
// TiXmlString constructor, based on a string
TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
{
init(len);
memcpy(start(), str, len);
}
// TiXmlString destructor
~TiXmlString ()
{
quit();
}
// = operator
TiXmlString& operator = (const char * copy)
{
return assign( copy, (size_type)strlen(copy));
}
// = operator
TiXmlString& operator = (const TiXmlString & copy)
{
return assign(copy.start(), copy.length());
}
// += operator. Maps to append
TiXmlString& operator += (const char * suffix)
{
return append(suffix, static_cast<size_type>( strlen(suffix) ));
}
// += operator. Maps to append
TiXmlString& operator += (char single)
{
return append(&single, 1);
}
// += operator. Maps to append
TiXmlString& operator += (const TiXmlString & suffix)
{
return append(suffix.data(), suffix.length());
}
// Convert a TiXmlString into a null-terminated char *
const char * c_str () const { return rep_->str; }
// Convert a TiXmlString into a char * (need not be null terminated).
const char * data () const { return rep_->str; }
// Return the length of a TiXmlString
size_type length () const { return rep_->size; }
// Alias for length()
size_type size () const { return rep_->size; }
// Checks if a TiXmlString is empty
bool empty () const { return rep_->size == 0; }
// Return capacity of string
size_type capacity () const { return rep_->capacity; }
// single char extraction
const char& at (size_type index) const
{
assert( index < length() );
return rep_->str[ index ];
}
// [] operator
char& operator [] (size_type index) const
{
assert( index < length() );
return rep_->str[ index ];
}
// find a char in a string. Return TiXmlString::npos if not found
size_type find (char lookup) const
{
return find(lookup, 0);
}
// find a char in a string from an offset. Return TiXmlString::npos if not found
size_type find (char tofind, size_type offset) const
{
if (offset >= length()) return npos;
for (const char* p = c_str() + offset; *p != '\0'; ++p)
{
if (*p == tofind) return static_cast< size_type >( p - c_str() );
}
return npos;
}
void clear ()
{
//Lee:
//The original was just too strange, though correct:
// TiXmlString().swap(*this);
//Instead use the quit & re-init:
quit();
init(0,0);
}
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
function DOES NOT clear the content of the TiXmlString if any exists.
*/
void reserve (size_type cap);
TiXmlString& assign (const char* str, size_type len);
TiXmlString& append (const char* str, size_type len);
void swap (TiXmlString& other)
{
Rep* r = rep_;
rep_ = other.rep_;
other.rep_ = r;
}
private:
void init(size_type sz) { init(sz, sz); }
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
char* start() const { return rep_->str; }
char* finish() const { return rep_->str + rep_->size; }
struct Rep
{
size_type size, capacity;
char str[1];
};
void init(size_type sz, size_type cap)
{
if (cap)
{
// Lee: the original form:
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
// doesn't work in some cases of new being overloaded. Switching
// to the normal allocation, although use an 'int' for systems
// that are overly picky about structure alignment.
const size_type bytesNeeded = sizeof(Rep) + cap;
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
rep_->str[ rep_->size = sz ] = '\0';
rep_->capacity = cap;
}
else
{
rep_ = &nullrep_;
}
}
void quit()
{
if (rep_ != &nullrep_)
{
// The rep_ is really an array of ints. (see the allocator, above).
// Cast it back before delete, so the compiler won't incorrectly call destructors.
delete [] ( reinterpret_cast<int*>( rep_ ) );
}
}
Rep * rep_;
static Rep nullrep_;
} ;
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
{
return ( a.length() == b.length() ) // optimization on some platforms
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
}
inline bool operator < (const TiXmlString & a, const TiXmlString & b)
{
return strcmp(a.c_str(), b.c_str()) < 0;
}
inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
TiXmlString operator + (const TiXmlString & a, const char* b);
TiXmlString operator + (const char* a, const TiXmlString & b);
/*
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
Only the operators that we need for TinyXML have been developped.
*/
class TiXmlOutStream : public TiXmlString
{
public :
// TiXmlOutStream << operator.
TiXmlOutStream & operator << (const TiXmlString & in)
{
*this += in;
return *this;
}
// TiXmlOutStream << operator.
TiXmlOutStream & operator << (const char * in)
{
*this += in;
return *this;
}
} ;
#endif // TIXML_STRING_INCLUDED
#endif // TIXML_USE_STL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +0,0 @@
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "tinyxml.h"
// The goal of the seperate error file is to make the first
// step towards localization. tinyxml (currently) only supports
// english error messages, but the could now be translated.
//
// It also cleans up the code a bit.
//
const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
{
"No error",
"Error",
"Failed to open file",
"Error parsing Element.",
"Failed to read Element name",
"Error reading Element value.",
"Error reading Attributes.",
"Error: empty tag.",
"Error reading end tag.",
"Error parsing Unknown.",
"Error parsing Comment.",
"Error parsing Declaration.",
"Error document empty.",
"Error null (0) or unexpected EOF found in input stream.",
"Error parsing CDATA.",
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
};

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@@ -0,0 +1,129 @@
name:Monospace
source:Monospace.bmp
#comment line ...
# size 54 largeur 33 space between letter 12
# unknow UTF8 code of the letter and start coordonate and size ==> 0x54 (33,45) (33,54)
0x00 (99,453) (33,54) # Error : Unknow the UTF8 element ...
# hexa UTF8 code of the letter and start coordonate and size ==> 0x54 (33,45) (33,54)
# ABCDEFGHIJKLMN
0x20 (0,7) (33,54) # space ...
0x41 (33,7) (33,54) # A
0x42 (66,7) (33,54) # B
0x43 (99,7) (33,54) # C
0x44 (132,7) (33,54) # D
0x45 (165,7) (33,54) # E
0x46 (198,7) (33,54) # F
0x47 (231,7) (33,54) # G
0x48 (264,7) (33,54) # H
0x49 (297,7) (33,54) # I
0x4A (330,7) (33,54) # J
0x4B (363,7) (33,54) # K
0x4C (396,7) (33,54) # L
0x4D (429,7) (33,54) # M
0x4E (462,7) (33,54) # N
#OPQRSTUVWXYZabc
0x4F (0,71) (33,54) # O
0x50 (33,71) (33,54) # P
0x51 (66,71) (33,54) # Q
0x52 (99,71) (33,54) # R
0x53 (132,71) (33,54) # S
0x54 (165,71) (33,54) # T
0x55 (198,71) (33,54) # U
0x56 (231,71) (33,54) # V
0x57 (264,71) (33,54) # W
0x58 (297,71) (33,54) # X
0x59 (330,71) (33,54) # Y
0x5A (363,71) (33,54) # Z
0x61 (396,71) (33,54) # a
0x62 (429,71) (33,54) # b
0x63 (462,71) (33,54) # c
#defghijklmnopqr
0x64 (0,135) (33,54) # d
0x65 (33,135) (33,54) # e
0x66 (66,135) (33,54) # f
0x67 (99,135) (33,54) # g
0x68 (132,135) (33,54) # h
0x69 (165,135) (33,54) # i
0x6A (198,135) (33,54) # j
0x6B (231,135) (33,54) # k
0x6C (264,135) (33,54) # l
0x6D (297,135) (33,54) # m
0x6E (330,135) (33,54) # n
0x6F (363,135) (33,54) # o
0x70 (396,135) (33,54) # p
0x71 (429,135) (33,54) # q
0x72 (462,135) (33,54) # r
#stuvwxyz1234567
0x73 (0,199) (33,54) # s
0x74 (33,199) (33,54) # t
0x75 (66,199) (33,54) # u
0x76 (99,199) (33,54) # v
0x77 (132,199) (33,54) # w
0x78 (165,199) (33,54) # x
0x79 (198,199) (33,54) # y
0x7A (231,199) (33,54) # z
0x31 (264,199) (33,54) # 1
0x32 (297,199) (33,54) # 2
0x33 (330,199) (33,54) # 3
0x34 (363,199) (33,54) # 4
0x35 (396,199) (33,54) # 5
0x36 (429,199) (33,54) # 6
0x37 (462,199) (33,54) # 7
#890&<26>~"#'{([-|<7C>
0x38 (0,263) (33,54) # 8
0x39 (33,263) (33,54) # 9
0x30 (66,263) (33,54) # 0
0x26 (99,263) (33,54) # &
#0x (132,263) (33,54) # <20>
0x7E (165,263) (33,54) # ~
0x22 (198,263) (33,54) # "
0x23 (231,263) (33,54) # #
0x27 (264,263) (33,54) # '
0x7B (297,263) (33,54) # {
0x28 (330,263) (33,54) # (
0x5B (363,263) (33,54) # [
0x2D (396,263) (33,54) # -
0x7C (429,263) (33,54) # |
#0x (462,263) (33,54) # <20>
#`_\<5C>^<5E>@)]=}
0x60 (0,335) (33,54) # `
0x5F (33,335) (33,54) # _
0x5C (66,335) (33,54) # \
#0x (99,335) (33,54) # <20>
0x5E (132,335) (33,54) # ^
#0x (165,335) (33,54) # <20>
0x40 (198,335) (33,54) # @
0x29 (231,335) (33,54) # )
0x5D (264,335) (33,54) # ]
0x3D (297,335) (33,54) # =
0x7D (330,335) (33,54) # }
#0x (363,335) (33,54) # o chap
#0x (396,335) (33,54) # u chap
#0x (429,335) (33,54) # e chap
#0x (462,335) (33,54) # a chap
#$<24>*<2A>%!<21>:/
#0x (0,391) (33,54) # i chap
#0x (33,391) (33,54) # o trema
#0x (66,391) (33,54) # u trema
#0x (99,391) (33,54) # e trema
#0x (132,391) (33,54) # a trema
0x24 (165,391) (33,54) # $
#0x (198,391) (33,54) # <20>
0x2A (231,391) (33,54) # *
#0x (264,391) (33,54) # <20>
#0x (297,391) (33,54) # <20>
0x25 (330,391) (33,54) # %
0x21 (363,391) (33,54) # !
#0x (396,391) (33,54) # <20>
0x3A (429,391) (33,54) # :
0x2F (462,391) (33,54) # /
#;.,?<><3E>!+
0x3B (0,453) (33,54) # ;
0x2E (33,453) (33,54) # .
0x2C (66,453) (33,54) # ,
0x3F (99,453) (33,54) # ?
0x3C (132,453) (33,54) # <
0x3E (165,453) (33,54) # >
#0x (198,453) (33,54) # <20>
#0x21 (231,453) (33,54) # ! ==> doublon ...
0x2B (264,453) (33,54) # +

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

3
ctags.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
ctags -R --fields=+n jni/ ../../../../usr/include/freetype2 ../ewol/

View File

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

40
data/color_white.xml Normal file
View File

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

14
data/edn.desktop Normal file
View File

@@ -0,0 +1,14 @@
[Desktop Entry]
Version=0.3.0
Name=Edn : Editeur de N'ours
Exec=edn
Icon=Edn
Terminal=false
Type=Application
Categories=Development;Utility;TextEditor;
GenericName=Text editor
GenericName[en]=Text editor
GenericName[nl]=Tekst verwerker
GenericName[fr]=<EFBFBD>diteur de text
Comment=Code editor for c, c++, php, bash, xml ...
Comment[fr]=<EFBFBD>diteur de text pour les language c, c++, php, bash, xml ...

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

View File

@@ -0,0 +1,421 @@
/* XPM */
static char * icone_xpm[] = {
"128 128 290 2",
" c None",
". c #0A0A0A",
"+ c #0B0B0B",
"@ c #0C0C0C",
"# c #0D0D0D",
"$ c #0E0E0E",
"% c #0F0F0F",
"& c #070707",
"* c #030303",
"= c #020202",
"- c #010101",
"; c #040404",
"> c #000000",
", c #111111",
"' c #000100",
") c #131313",
"! c #262626",
"~ c #151515",
"{ c #000301",
"] c #000602",
"^ c #000502",
"/ c #000401",
"( c #000803",
"_ c #1E1E1E",
": c #013413",
"< c #016023",
"[ c #026625",
"} c #016424",
"| c #016324",
"1 c #026525",
"2 c #016524",
"3 c #016223",
"4 c #026725",
"5 c #00270E",
"6 c #000200",
"7 c #040505",
"8 c #1A1A1A",
"9 c #014A1A",
"0 c #03B843",
"a c #04CB4A",
"b c #02802E",
"c c #000D04",
"d c #000001",
"e c #1C1C1C",
"f c #252626",
"g c #014C1B",
"h c #03B943",
"i c #026D28",
"j c #000C1B",
"k c #0A438A",
"l c #24282C",
"m c #014E1C",
"n c #03BB44",
"o c #03CA49",
"p c #000702",
"q c #000B19",
"r c #005DD2",
"s c #0072FF",
"t c #0C58B6",
"u c #01501D",
"v c #03BE45",
"w c #000A18",
"x c #0061D9",
"y c #0C58B5",
"z c #24282D",
"A c #03BF45",
"B c #0E55AF",
"C c #24292F",
"D c #03BD45",
"E c #026D27",
"F c #0F52A5",
"G c #242931",
"H c #014B1B",
"I c #02752A",
"J c #000E20",
"K c #0058C7",
"L c #10509D",
"M c #232A32",
"N c #03B743",
"O c #027A2C",
"P c #000F23",
"Q c #0054BD",
"R c #114F9C",
"S c #232A31",
"T c #01491A",
"U c #03B642",
"V c #027B2C",
"W c #0053BA",
"X c #0071FE",
"Y c #10509F",
"Z c #242930",
"` c #03B742",
" . c #02772B",
".. c #0054BC",
"+. c #0F53A8",
"@. c #24282E",
"#. c #026F28",
"$. c #000C1C",
"%. c #0058C5",
"&. c #0D56B1",
"*. c #005CD0",
"=. c #0061DA",
"-. c #0D56B0",
";. c #026B27",
">. c #030406",
",. c #0452B1",
"'. c #0F53A7",
"). c #02742A",
"!. c #1D1D1D",
"~. c #222C39",
"{. c #0566DC",
"]. c #10509E",
"^. c #02792C",
"/. c #050505",
"(. c #222C38",
"_. c #0665DC",
":. c #114F9B",
"<. c #1B1B1B",
"[. c #222D3A",
"}. c #0763D4",
"|. c #02782B",
"1. c #212E3C",
"2. c #095FCB",
"3. c #027129",
"4. c #212F40",
"5. c #0A5DC3",
"6. c #026826",
"7. c #203042",
"8. c #0A5CC1",
"9. c #212F42",
"0. c #0A5DC5",
"a. c #212E3F",
"b. c #0860CD",
"c. c #252525",
"d. c #026A26",
"e. c #222D3C",
"f. c #0763D7",
"g. c #02732A",
"h. c #202020",
"i. c #090909",
"j. c #1F2020",
"k. c #080808",
"l. c #0763D5",
"m. c #23282F",
"n. c #0860CB",
"o. c #0070FB",
"p. c #082D5A",
"q. c #0A5DC4",
"r. c #0071FD",
"s. c #003B84",
"t. c #00040A",
"u. c #026926",
"v. c #00387F",
"w. c #00050D",
"x. c #00060F",
"y. c #00250D",
"z. c #006FF9",
"A. c #003E8C",
"B. c #016C27",
"C. c #006EF7",
"D. c #004193",
"E. c #000206",
"F. c #004397",
"G. c #000104",
"H. c #004294",
"I. c #001608",
"J. c #02762B",
"K. c #003F8D",
"L. c #028932",
"M. c #000A03",
"N. c #003B85",
"O. c #000409",
"P. c #029034",
"Q. c #001708",
"R. c #029536",
"S. c #001909",
"T. c #029737",
"U. c #00230C",
"V. c #202E3E",
"W. c #043068",
"X. c #00060E",
"Y. c #002D10",
"Z. c #141414",
"`. c #010102",
" + c #002B0F",
".+ c #242424",
"++ c #028A32",
"@+ c #161616",
"#+ c #028530",
"$+ c #00290F",
"%+ c #028430",
"&+ c #02812F",
"*+ c #028831",
"=+ c #029636",
"-+ c #028F34",
";+ c #003111",
">+ c #03AF40",
",+ c #029436",
"'+ c #014318",
")+ c #03C146",
"!+ c #015D21",
"~+ c #029135",
"{+ c #028B32",
"]+ c #028631",
"^+ c #03A63C",
"/+ c #000F21",
"(+ c #0E3564",
"_+ c #000F22",
":+ c #026DF3",
"<+ c #144888",
"[+ c #000D1F",
"}+ c #0054BE",
"|+ c #026DF2",
"1+ c #028D33",
"2+ c #0059C8",
"3+ c #016EF3",
"4+ c #144889",
"5+ c #24282B",
"6+ c #029435",
"7+ c #005ED3",
"8+ c #016FF6",
"9+ c #14498B",
"0+ c #252628",
"a+ c #0070F9",
"b+ c #134A8C",
"c+ c #0071FC",
"d+ c #134A8D",
"e+ c #029235",
"f+ c #14498C",
"g+ c #252729",
"h+ c #028C33",
"i+ c #016FF9",
"j+ c #14498A",
"k+ c #001206",
"l+ c #016EF5",
"m+ c #001E0B",
"n+ c #028731",
"o+ c #003312",
"p+ c #029335",
"q+ c #027D2D",
"r+ c #000F05",
"s+ c #000A17",
"t+ c #027C2D",
"u+ c #123764",
"v+ c #026DF1",
"w+ c #000C04",
"x+ c #16447B",
"y+ c #000E05",
"z+ c #101010",
"A+ c #026CF0",
"B+ c #001106",
"C+ c #174379",
"D+ c #026CED",
"E+ c #03C949",
"F+ c #001407",
"G+ c #174276",
"H+ c #036AEA",
"I+ c #25272A",
"J+ c #184174",
"K+ c #036AE8",
"L+ c #184173",
"M+ c #036AE9",
"N+ c #121212",
"O+ c #001307",
"P+ c #25272B",
"Q+ c #036BEB",
"R+ c #001006",
"S+ c #174277",
"T+ c #026CEE",
"U+ c #242525",
"V+ c #17437A",
"W+ c #232426",
"X+ c #006CF1",
"Y+ c #0B2A51",
"Z+ c #004396",
"`+ c #000103",
" @ c #004192",
".@ c #000205",
"+@ c #003D8A",
"@@ c #000307",
"#@ c #003A83",
"$@ c #0269E8",
"%@ c #242629",
"&@ c #0B223D",
"*@ c #00050C",
"=@ c #039938",
"-@ c #015920",
";@ c #014D1C",
">@ c #232323",
",@ c #181818",
" ",
" ",
" ",
" ",
" ",
" . + @ # @ @ @ # # # # @ @ @ # # # @ @ @ # # # @ @ @ # # # # @ @ @ # # $ % ",
" & * = - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - = * & $ ",
" ; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ; , ",
" > ' > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ) ",
" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > , ! ",
" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - ~ ! ! ",
" > > > > > > > > > { ] ^ / / / ] ^ ^ / / / ^ ^ ] / / / ^ ^ ] ^ / / ^ ] ( ' > > > > > > > > & _ ! ! ! ",
" > > > > > > > > / : < [ } | | | 1 2 2 3 | 3 1 2 1 | | 3 } 1 1 } | | | 4 5 6 > > > > > > > 7 8 ! ! ! ! ! ",
" > > > > > > > > 6 9 0 a a a a a a a a a a a a a a a a a a a a a a a a a b c > > > > > d > 7 e f ! ! ! ! ! ! ",
" > > > > > > > > > g h a a a a a a a a a a a a a a a a a a a a a a a a a i ^ > > > > > d > j k l ! f ! ! ! ! ! ! ",
" > > > > > > > > > m n a a a a a a a a a a a a a a a a a a a a a a a o a 1 p > > > > > d > q r s t l ! f ! ! ! ! ! ! ",
" > > > > > > > > > u v a a a a a a a a a a a a a a a a a a a a a a a a a 3 p > > > > > d > w x s s s y z ! f ! ! ! ! ! ! ",
" > > > > > > > > > u A a a a a a a a a a a a a a a a a a a a a a a a a a 2 ( > > > > > d > q x s s s s s B C ! f ! ! ! ! ! ! ",
" > > > > > > > > > m D a a a a a a a a a a a a a a a a a a a a a a a a a E p > > > > d > > j r s s s s s s s F G ! ! ! ! ! ! ! ! ",
" > > > > > > > > { H n a a a a a a a a a a a a a a a a a a a a a a a a a I ^ > > > > d > > J K s s s s s s s s s L M ! f ! ! ! ! ! ! ",
" > > > > > > > > ^ 9 N a a a a a a a a a a a a a a a a a a a a a a a a a O / > > > > d > > P Q s s s s s s s s s s s R S ! f ! ! ! ! ! ! ",
" > > > > > > > > / T U a a a a a a a a a a a a a a a a a a a a a a a a a V { > > > > > > > P W s s s s s s s s s s s X s Y Z ! f ! ! ! ! ! ! ",
" > > > > > > > > { 9 ` a a a a a a a a a a a a a a a a a a a a a a a a a .{ > > > > > d > J ..s s s s s s s s s s s s s s s +.@.! f ! ! ! ! ! ! ",
" > > > > > > > > > g 0 a a a a a a a a a a a a a a a a a a a a a a a a a #.^ > > > > > d > $.%.s s s s s s s s s s s s s s s s s &.l ! f ! ! ! ! ! ! ",
" > > > > > > > > > m n a a a a a a a a a a a a a a a a a a a a a a a o a 4 ] > > > > > d > q *.s s s s s s s s s s s s s s s s s s s t l ! f ! ! ! ! ! ! ",
" > > > > > > > > > u v a a a a a a a a a a a a a a a a a a a a a a a a a 3 p > > > > > d > w x s s s s s s s s s s s s s s s s s s s s s y z ! f ! ! ! ! ! ! ",
" > > > > > > > > > u A a a a a a a a a a a a a a a a a a a a a a a a a a } ( > > > > > > > w =.s s s s s s s s s s s s s s s s s s s s s s s -.@.! f ! ! ! ! ! ! ",
" > > > > > > > > > m v a a a a a a a a a a a a a a a a a a a a a a a a a ;.p > > > > > > > >.,.s s s s s s s s s s s s s s s s s s s s s s s s s '.G ! ! f ! ! ! ! ! ",
" > > > > > > > > { H n a a a a a a a a a a a a a a a a a a a a a a a a a ).^ > > > > > > > ; !.~.{.s s s s s s s s s s s s s s s s s s s s s s s s s ].M ! ! ! ! ! ! ! ! ",
" > > > > > > > > ^ 9 0 a a a a a a a a a a a a a a a a a a a a a a a a a ^./ > > > > > > > /.e f ! (._.s s s s s s s s s s s s s s s s s s s s s s s s s :.M ! f ! ! ! ! ! ! ",
" > > > > > > > > ^ T ` a a a a a a a a a a a a a a a a a a a a a a a a a V { > > > > > > > /.<.! ! f ! [.}.s s s s s s s s s s s s s s s s s s s s s s s X s ].G ! f ! ! ! ! ! ! ",
" > > > > > > > > { 9 ` a a a a a a a a a a a a a a a a a a a a a a a a a |.{ > > > > > > > ; e ! ! ! ! f ! 1.2.s s s s s s s s s s s s s s s s s s s s s s s s s '.@.! f ! ! ! ! ! ! ",
" > > > > > > > > > H 0 a a a a a a a a a a a a a a a a a a a a a a a a a 3./ > > > > > > > > ~ ! ! ! ! ! ! f ! 4.5.s s s s s s s s s s s s s s s s s s s s s s s s s -.z ! f ! ! ! ! ! ! ",
" > > > > > > > > > m n a a a a a a a a a a a a a a a a a a a a a a a o a 6.] > > > > > > > > ! ! ! ! ! ! ! ! 7.8.s s s s s s s s s s s s s s s s s s s s s s s s s y l ! f ! ! ! ! ! ! ",
" > > > > > > > > > u v a a a a a a a a a a a a a a a a a a a a a a a a a | p > > > > > > > > ! ! ! ! ! ! ! ! 9.0.s s s s s s s s s s s s s s s s s s s s s s s s s t l ! f ! ! ! ! ! ! ",
" > > > > > > > > > u A a a a a a a a a a a a a a a a a a a a a a a a a a } ( > > > > > > > > ! ! ! ! ! ! ! ! a.b.s s s s s s s s s s s s s s s s s s s s s s s s s &.@.! f ! ! ! ! ! c. ",
" > > > > > > > > > m v a a a a a a a a a a a a a a a a a a a a a a a a a d.p > > > > > > > > ! ! ! ! ! ! ! ! e.f.s s s s s s s s s s s s s s s s s s s s s s s s s +.Z ! f ! ! ! c.~ - ",
" > > > > > > > > { g n a a a a a a a a a a a a a a a a a a a a a a a a a g.] > > > > > > > > ! ! ! ! ! ! f ! ~.{.s s s s s s s s s s s s s s s s s s s s s s s s s Y S ! ! ! h.i.> > > ",
" e = > > > > > > > / 9 0 a a a a a a a a a a a a a a a a a a a a a a a a a ^./ > > > > > > > > ! ! ! ! ! ! ! f ! (._.s s s s s s s s s s s s s s s s s s s s s s s s s R M ! j.k.> > > > > ",
" !.k.> > > > > > > ^ T ` a a a a a a a a a a a a a a a a a a a a a a a a a V { > > > > > > > > ! ! ! ! ! ! f ! ~.l.s s s s s s s s s s s s s s s s s s s s s s s X s L m., > > > > > > ",
" $ = > > > > > > > { 9 U a a a a a a a a a a a a a a a a a a a a a a a a a ^.{ > > > > > > > > ! ! ! ! ! ! f ! e.n.s s s s s s s s s s s s s s s s s s s s s s s s o.p.> > > > > > > ",
" > > > > > > > > > H N a a a a a a a a a a a a a a a a a a a a a a a a a 3./ > > > > > > > > ! ! ! ! ! ! f ! a.q.s s s s s s s s s s s s s s s s s s s s s s r.s.t.> > > > > > > ",
" > > > > > > > > > m n a a a a a a a a a a a a a a a a a a a a a a a a a u.] > > > > > > > > ! ! ! ! ! ! ! ! 9.8.s s s s s s s s s s s s s s s s s s s s r.v.w.> > > > > > > > ",
" > > > > > > > > u D a a a a a a a a a a a a a a a a a a a a a a a a a | p > > > > > > > > ! ! ! ! ! ! ! ! 9.q.s s s s s s s s s s s s s s s s s s r.v.x.> > > > > > > > > > ",
" > > > > > > > > u A a a a a a a a a a a a a a a a a a a a a a a a a a | ( > > > > > > > > ! ! ! ! ! ! ! ! a.n.s s s s s s s s s s s s s s s s o.s.w.> > d > > > > > > > > ",
" > > > > > > > y.v a a a a a a a a a a a a a a a a a a a a a a a a a u.p > > > > > > > > ! ! ! ! ! ! ! ! e.l.s s s s s s s s s s s s s s z.A.t.> > d > > > > > > > > ' ",
" > > > > > > > B.a a a a a a a a a a a a a a a a a a a a a a a a a 3.] > > > > > > > > ! ! ! ! ! ! f ! ~._.s s s s s s s s s s s s C.D.E.> d > > > > > > > > > > ' ",
" > > > > > > > O a a a a a a a a a a a a a a a a a a a a a a a a ^./ > > > > > > > > ! ! ! ! ! ! ! f ! (.{.s s s s s s s s s s C.F.G.> d > > > > > > > > > > > > ",
" > > > > > > > I a a a a a a a a a a a a a a a a a a a a a a a V { > > > > > > > > ! ! ! ! ! ! f ! ~.f.s s s s s s s s z.H.G.> d > > > > > I.] > > > > > > ",
" > > > > > > > J.a a a a a a a a a a a a a a a a a a a a a a ^.{ > > > > > > > > ! ! ! ! ! ! f ! e.b.s s s s s s o.K.E.> d > > > > > I.L.M.> > > > > > ",
" > > > > > > > J.a a a a a a a a a a a a a a a a a a a a a g./ > > > > > > > > ! ! ! ! ! ! f ! a.0.s s s s r.N.O.> d > > > > > I.P.a c > > > > > > ",
" > > > > > > > I a a a a a a a a a a a a a a a a a a a a d.] > > > > > > > > ! ! ! ! ! ! ! ! 9.8.s s r.v.w.> d > > > > > Q.R.a a S.> > > > > > ",
" / > > > > > > O a a a a a a a a a a a a a a a a a o a } p > > > > > > > > ! ! ! ! ! ! ! ! 7.5.r.v.x.> > > > > > > Q.T.a a a U.> > > > > > ",
" p > > > > > > O a a a a a a a a a a a a a a a a a a | ( > > > > > > > > ! ! ! ! ! ! ! ! V.W.X.> > d > > > > I.R.a a a a Y.> > > > > > ",
" M.> > > > > > O a a a a a a a a a a a a a a a a a 6.p > > > > > > > > ! ! ! ! ! ! c.Z.`.> > d > > > > I.P.a a a a a +> > > > > > ",
" ( > > > > > > I a a a a a a a a a a a a a a a a 3.] > > > > > > > > ! ! ! ! .+~ - > > > > > > > I.++a a a a a a Y.> > > > > > ",
" p > > > > > > J.a a a a a a a a a a a a a a a |./ > > > > > > > > ! ! ! .+@+> > > > > > > > Q.#+a a a a a a a $+> > > > > > ",
" ( > > > > > > J.a a a a a a a a a a a a a a V { > > > > > > > > .+@+> > > > > > > > I.%+a a a a a a a a $+> > > > > > ",
" p > > > > > > &+a a a a a a a a a a a a a ^.{ > > > > > > > > # > > > > > > > > I.*+a a a a a a a a a $+> > > > > > ",
" ] > > > > > > =+a a a a a a a a a a a a )./ > > > > > > > > > > > > > > > > I.-+a a a a a a a a a a ;+> > > > > > ",
" > > > > > > > >+a a a a a a a a a a a ;.^ > > > > > > > > > > > > > > > > > Q.,+a a a a a a a a a a a '+> > > > > > ",
" 6 > > > > > ' )+a a a a a a a a o a } p > > > > > > > * > > > > > > > > > Q.T.a a a a a a a a a a a a !+> > > > > > ",
" ' > > > > > ' a a a a a a a a a a 3 ( > > > > > > > * h.! > > > > > > > > I.=+a a a a a a a a a a a a a 3.> > > > > > ",
" > > > > > > > a a a a a a a a a 4 p > > > > > > > * h.! ! ! > > > > > > > > I.~+a a a a a a a a a a a a a a b > > > > > > ",
" > > > > > > > a a a a a a a a #.] > > > > > > > ; _ ! ! ! ! ! > > > > > > > > I.{+a a a a a a a a a a a a a a a P.> > > > > > ",
" ' > > > > > ' a a a a a a a .^ > > > > d > > 7 !.! ! ! ! ! ! ! > > > > > > > > Q.]+a a a a a a a a a a a a a a a a ^+> > > > > > ",
" 6 > > > > > 6 a a a a a a V { > > > > d > > /+(+C ! ! ! ! ! ! ! ! > > > > > > > > I.%+a a a a a a a a a a a a a a a a a h > > > > > > ",
" > > > > > > > a a a a a O { > > > > > > > _+W :+<+Z ! ! ! ! ! ! ! ! > > > > > > > > I.*+a a a a a a a a a a a a a a a a a a a ' > > > > > ",
" 6 > > > > > 6 a a a a I / > > > > > d > [+}+s s |+<+@.! ! ! ! ! ! ! ! > > > > > > > > I.1+a a a a a a a a a a a a a a a a a a a a > > > > > > ",
" ' > > > > > ' a a a E ^ > > > > > d > j 2+s s s s 3+4+5+! f ! ! ! ! ! ! > > > > > > > > > Q.6+a a a a a a a a a a a a a a a a a a a a a 6 > > > > > ",
" > > > > > > > o a 2 p > > > > > d > w 7+s s s s s s 8+9+0+! f ! ! ! ! ! ! > > > > > > > > > Q.T.a a a a a a a a a a a a a a a a a a a a a a { > > > > > > ",
" > > > > > > > a 3 ( > > > > > d > w =.s s s s s s s s a+b+f ! f ! ! ! ! ! ! > > > > > > > > Q.=+a a a a a a a a a a a a a a a a a a a a a a a ] > > > > > > ",
" ' > > > > > ' 1 p > > > > > d > q x s s s s s s s s s s c+d+f ! f ! ! ! ! ! ! > > > > > > > > I.e+a a a a a a a a a a a a a a a a a a a a a a a a p > > > > > > ",
" ' > > > > > 6 p > > > > d > > $.*.s s s s s s s s s s s s o.f+g+! ! ! ! ! ! ! ! > > > > > > > > I.h+a a a a a a a a a a a a a a a a a a a a a a a a a M.> > > > > > ",
" > > > > > > > > > > > d > > J %.s s s s s s s s s s s s s s i+j+l ! ! ! ! ! ! ! ! > > > > > > > > Q.]+a a a a a a a a a a a a a a a a a a a a a a a a a a k+> > > > > > ",
" > > > > > > > > > > d > > P ..s s s s s s s s s s s s s s s s l+<+C ! ! ! ! ! ! ! ! > > > > > > > > Q.%+a a a a a a a a a a a a a a a a a a a a a a a a a a a m+> > > > > > ",
" > > > > > > > > > > > > P W s s s s s s s s s s s s s s s s s s :+<+Z ! ! ! ! ! ! ! ! > > > > > > > > I.n+a a a a a a a a a a a a a a a a a a a a a a a a a a a a $+> > > > > > ",
" > > > > > > > > > d > J Q s s s s s s s s s s s s s s s s s s s s |+<+C ! ! ! ! ! ! ! ! > > > > > > > > I.h+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a o+> > > > > > ",
" > > > > > > > > d > j K s s s s s s s s s s s s s s s s s s s s s s 3+4+5+! f ! ! ! ! ! ! > > > > > > > > Q.p+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a Y.> > > > > > ",
" > > > > > > > d > q r s s s s s s s s s s s s s s s s s s s s s s s s 8+j+0+! f ! ! ! ! ! ! > > > > > > > > > Q.T.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+M.> > > > > > ",
" > > > > > > > > w x s s s s s s s s s s s s s s s s s s s s s s s s s s a+b+f ! f ! ! ! ! ! ! > > > > > > > > > Q.T.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+r+> > > > > > > ",
" > > > > > > > s+x s s s s s s s s s s s s s s s s s s s s s s s s s s s s o.d+f ! f ! ! ! ! ! ! > > > > > > > > I.p+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+c > > > > > > > > ",
" > > > > > > - u+v+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s o.b+0+! ! ! ! ! ! ! ! > > > > > > > > I.h+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+w+> > > > > > > - ",
" > > > > > > , ! x+|+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s a+j+5+! ! ! ! ! ! ! ! > > > > > > > > Q.n+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+y+> > > > > > > > ",
" > > > - z+! ! ! x+A+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s 8+4+C ! ! ! ! ! ! ! ! > > > > > > > > Q.%+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+B+> > > > > > > > ",
" > > /.<.! ! ! ! ! C+D+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s 3+<+Z ! ! ! ! ! ! ! ! > > > > > > > > I.]+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a E+q+F+> > > > > > > > ",
" * e ! ! ! ! ! ! f G+H+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s |+<+C ! ! ! ! ! ! ! ! > > > > > > > > I.h+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a E+q+I.> > > > > > > > ",
" ! ! ! ! ! ! ! ! I+J+K+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s :+<+l ! f ! ! ! ! ! c.k.> > > > > > > > Q.e+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+I.> > > > > > > > ",
" ! ! ! ! ! ! ! ! 5+L+M+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s l+j+g+! f ! ! ! c.N+- > > > > > > > Q.=+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+O+> > > > > > > > ",
" ! ! ! ! ! ! ! ! P+J+Q+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s i+f+f ! f ! c.) = > > > > > > > Q.T.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+R+> > > > > > > > ",
" ! ! ! ! ! ! ! ! g+S+T+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s o.d+f ! U+) - > > > > > > > I.6+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+c > > > > > > > > ",
" ! ! ! ! ! ! ! ! ! V+v+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s c+b+W+~ - > > > > > > > I.1+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+w+> > > > > > > > ",
" ! ! ! ! ! ! ! ! ! x+|+s s s s s s s s s s s s s s s s s s s s s s s s s s s s s X+Y+d > > > > > > > I.*+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+c > > > > > > > > ",
" ! ! ! ! ! ! ! ! ! x+v+s s s s s s s s s s s s s s s s s s s s s s s s s s s C.Z+`+> > > > > > > Q.%+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+R+> > > > > > > > ",
" ! ! ! ! ! ! ! ! ! C+D+s s s s s s s s s s s s s s s s s s s s s s s s s z. @.@> > > > > > > I.]+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a E+q+F+> > > > > > > > ",
" ! ! ! ! ! ! ! ! f G+Q+s s s s s s s s s s s s s s s s s s s s s s s o.+@@@> > > > > > > I.{+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a E+q+I.> > > > > > > > ",
" ! ! ! ! ! ! ! ! g+J+M+s s s s s s s s s s s s s s s s s s s s s r.#@t.> > > > > > > I.~+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+I.> > > > > > > > ",
" ! ! ! ! ! ! ! ! 5+L+M+s s s s s s s s s s s s s s s s s s s r.v.X.> d > > > > > Q.=+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+F+> > > > > > > > ",
" ! ! ! ! ! ! ! ! 5+J+Q+s s s s s s s s s s s s s s s s s r.v.x.> > > > > > > Q.T.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+R+> > > > > > > > ",
" ! ! ! ! ! ! ! ! g+G+D+s s s s s s s s s s s s s s s o.N.w.> > > > > > > I.,+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+c > > > > > > > > ",
" ! ! ! ! ! ! ! ! f C+v+s s s s s s s s s s s s s z.K.O.> > > > > > > I.-+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+w+> > > > > > > > ",
" ! ! ! ! ! ! ! ! ! x+|+s s s s s s s s s s s C.H.E.> d > > > > > I.*+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+c > > > > > > > > ",
" ! ! ! ! ! ! ! ! ! x+v+s s s s s s s s s C.F.G.> > > > > > > Q.%+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+R+> > > > > > > > ",
" ! ! ! ! ! ! ! ! ! V+T+s s s s s s s z.D.G.> > > > > > > I.#+a a a a a a a a a a a a a a a a a a a a a a a a a a a a a E+q+O+> > > > > > > > ",
" ! ! ! ! ! ! ! ! ! S+Q+s s s s s o.A.E.> > > > > > > I.++a a a a a a a a a a a a a a a a a a a a a a a a a a a a a E+q+I.> > > > > > > > ",
" ! ! ! ! ! ! ! ! g+J+M+s s s r.s.t.> > > > > > > I.P.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+I.> > > > > > > > ",
" ! ! ! ! ! ! ! ! P+L+K+s r.v.w.> > > > > > > Q.R.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+F+> > > > > > > > ",
" ! ! ! ! ! ! ! ! 5+J+$@v.x.> > > > > > > Q.T.a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a q+B+> > > > > > > > ",
" ! ! ! ! ! ! ! ! %@&@*@> > d > > > > S.=@a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a t+y+> > > > > > > > ",
" ! ! ! ! ! ! c.~ > > > d > > > > y+-@t+^.^. .q+q+t+|.^.|.t+q+q+ .^.^.^.q+q+^.^.^.|.q+q+V |.^. .b ;@( > > > > > > > > ",
" ! ! ! ! c._ i.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ",
" ! ! c._ z+= > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ",
" ! >@N+- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ",
" >@z+> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ",
" @+; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > = /. ",
" k.> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > * + $ ",
" ,@8 8 ,@ ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c">
<EdnLang version="0.1" lang="Makefiles">
<ext>Makefile</ext>
<ext>.mk</ext>
<ext>*.mk</ext>
<ext>*.global</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my preprocesseur">
<color>preprocesseur</color>
@@ -9,9 +10,23 @@
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>'</start>
<end>'</end>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</start>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur">
<ext>.s</ext>
<ext>.S</ext>
<ext>.asm</ext>
<ext>*.s</ext>
<ext>*.S</ext>
<ext>*.asm</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
@@ -39,7 +39,7 @@
</rule>
<rule name="my comment">
<color>comment</color>
<start>//</start>
<start>(//|@)</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>

48
data/lang_bash.xml Normal file
View File

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

View File

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

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="c">
<ext>.c</ext>
<ext>.cpp</ext>
<ext>.h</ext>
<ext>.hpp</ext>
<ext>*.c</ext>
<ext>*.cpp</ext>
<ext>*.h</ext>
<ext>*.hpp</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
@@ -79,7 +79,7 @@
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<start>\@try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
<start>\@new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
</rule>
<rule name="my type">
<color>type</color>
@@ -111,7 +111,7 @@
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</start>
<start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule>
<!-- With all elementes :
<rule name="BIG LETTER">

87
data/lang_java.xml Normal file
View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="java">
<ext>*.java</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<start>/\*\*</start>
<end>\*/</end>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<start>/\*</start>
<end>\*/</end>
</rule>
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<start>//!</start>
<end>\n</end>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<start>//[ \t]*TODO[ \t]*:</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="my comment">
<color>comment</color>
<start>//</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>'</start>
<end>'</end>
<!--<EscapeChar>\</EscapeChar>-->
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<start>\@new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
</rule>
<rule name="my type">
<color>type</color>
<start>\@bool|char|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128)\@</start>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<start>\@import|package|extends|Override|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum\@</start>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<start>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</start>
</rule>
<rule name="numeric constant">
<color>number</color>
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
</rule>
<rule name="my boolean">
<color>boolean</color>
<start>\@true|TRUE|false|FALSE\@</start>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start>
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</start>
</rule>
</pass2>
</EdnLang>

62
data/lang_matlab.xml Normal file
View File

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

76
data/lang_php.xml Normal file
View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="php: pretty home page">
<ext>*.php</ext>
<ext>*.php3</ext>
<ext>*.php4</ext>
<ext>*.phtml</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline">
<color>comment</color>
<start>/\*</start>
<end>\*/</end>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<start>//[ \t]*TODO[ \t]*:</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="my comment inline">
<color>comment</color>
<start>#</start>
<end>\n</end>
</rule>
<rule name="my comment">
<color>comment</color>
<start>//</start>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<start>"</start>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<start>'</start>
<end>'</end>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<start>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</start>
</rule>
<rule name="my type">
<color>type</color>
<start>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</start>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<start>\@abstract|and|as|break|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|interface|isset|list|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor\@</start>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<start>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</start>
</rule>
<rule name="numeric constant">
<color>number</color>
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
</rule>
<rule name="my boolean">
<color>boolean</color>
<start>\@true|TRUE|false|FALSE\@</start>
</rule>
<rule name="Function name">
<color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start>
</rule>
<rule name="condition">
<color>boolean</color>
<start>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</start>
</rule>
</pass2>
</EdnLang>

View File

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

23
jni/Android.mk Normal file
View File

@@ -0,0 +1,23 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ednpackage
LOCAL_STATIC_LIBRARIES := ewol
LOCAL_C_INCLUDES := $(LOCAL_PATH)
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := ewolAndroidAbstraction.cpp \
$(FILE_LIST)
LOCAL_LDLIBS := -llog -landroid
include $(BUILD_SHARED_LIBRARY)
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
$(call import-module,ewol/Sources)

24
jni/Linux.mk Normal file
View File

@@ -0,0 +1,24 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_MODULE := ednn
LOCAL_STATIC_LIBRARIES := ewol etk tinyxml libzip libpng
LOCAL_C_INCLUDES := -I$(LOCAL_PATH) $(addprefix -I$(LOCAL_PATH)/, $(sort $(dir $(FILE_LIST))))
LOCAL_SRC_FILES := $(FILE_LIST)
LOCAL_LDLIBS :=
LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \
-DEDN_DEBUG_LEVEL=3
include $(BUILD_EXECUTABLE)
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
$(call import-module,ewol/Sources)

View File

@@ -23,10 +23,10 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Buffer.h"
#include "BufferManager.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <Buffer.h>
#include <BufferManager.h>
#undef __class__
#define __class__ "Buffer"
@@ -41,10 +41,13 @@
*/
Buffer::Buffer()
{
static int32_t fileBasicID = 0;
m_fileModify = true;
m_haveName = false;
Edn::String mString = "No-Name";
m_fileName.SetCompleateName(mString);
etk::String mString = "Untitle - ";
mString += fileBasicID++;
SetFileName(mString);
m_haveName = false;
}
/**
@@ -55,11 +58,10 @@ Buffer::Buffer()
* @return ---
*
*/
Buffer::Buffer(Edn::String &newFileName)
Buffer::Buffer(etk::File &newName)
{
m_fileModify = false;
m_haveName = true;
m_fileName.SetCompleateName(newFileName);
SetFileName(newName);
}
/**
@@ -95,85 +97,6 @@ void Buffer::SetModify(bool status)
}
}
Edn::File Buffer::GetFileName(void)
{
return m_fileName;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String Buffer::GetName(void)
{
// nothing to do
return m_fileName.GetCompleateName();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String Buffer::GetShortName(void)
{
// nothing to do
return m_fileName.GetShortFilename();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String Buffer::GetFolder(void)
{
// nothing to do
return m_fileName.GetFolder();
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool Buffer::HaveName(void)
{
// nothing to do
return true;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Buffer::SetName(Edn::String &newName)
{
// nothing to do
}
/**
* @brief
*
@@ -215,7 +138,6 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
// nothing to do
}
/**
* @brief
*
@@ -224,7 +146,7 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
* @return ---
*
*/
int32_t Buffer::Display(DrawerManager &drawer)
int32_t Buffer::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
{
return ERR_NONE;
}
@@ -329,7 +251,7 @@ void Buffer::ForceReDraw(bool allElement)
void Buffer::cursorMove(int32_t gtkKey)
void Buffer::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
{
// nothing to do
}
@@ -347,19 +269,20 @@ void Buffer::AddChar(char * UTF8data)
// nothing to do
}
void Buffer::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
void Buffer::Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{
// nothing to do
}
void Buffer::Replace(Edn::String &data)
void Buffer::Replace(etk::String &data)
{
// nothing to do
}
int32_t Buffer::FindLine(Edn::String &data)
int32_t Buffer::FindLine(etk::String &data)
{
// nothing to do
return 0;
}
void Buffer::JumpAtLine(int32_t newLine)
@@ -367,6 +290,21 @@ void Buffer::JumpAtLine(int32_t newLine)
// nothing to do
}
/**
* @brief Get the current line (to know where to jump)
*
* @param ---
*
* @return Return the current line number
*
*/
int32_t Buffer::GetCurrentLine(void)
{
return 0;
}
/**
* @brief request a copy of the selection in the named clipBoard ID
*

View File

@@ -26,10 +26,11 @@
#ifndef __BUFFER_H__
#define __BUFFER_H__
#include <string>
#include "Display.h"
#include "charset.h"
#include "Edn.h"
#include <etk/String.h>
#include <etk/File.h>
#include <Display.h>
#include <charset.h>
#include <ewol/ewol.h>
typedef struct{
@@ -45,26 +46,46 @@ typedef struct{
class Buffer {
public:
Buffer(void);
Buffer(Edn::String &filename);
Buffer(etk::File &newName);
virtual ~Buffer(void);
Edn::File GetFileName(void);
virtual Edn::String GetName(void);
virtual Edn::String GetShortName(void);
virtual Edn::String GetFolder(void);
virtual void SetName(Edn::String &newName);
etk::File GetFileName(void)
{
return m_fileName;
};
void SetFileName(etk::File &newName)
{
m_fileName = newName;
m_haveName = true;
NameChange();
};
void SetFileName(etk::String &newName)
{
m_fileName.SetCompleateName(newName, etk::FILE_TYPE_DIRECT);
m_haveName = true;
NameChange();
};
bool HaveName(void)
{
return m_haveName;
}
virtual void Save(void);
virtual bool HaveName(void);
bool IsModify(void);
protected:
void SetModify(bool status);
virtual void NameChange(void) { /*EDN_DEBUG("check name change ==> no HL change possible");*/};
public:
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
virtual void SetLineDisplay(uint32_t lineNumber);
virtual int32_t Display(DrawerManager &drawer);
virtual int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
virtual void ForceReDraw(bool allElement);
virtual void AddChar(char * UTF8data);
virtual void cursorMove(int32_t gtkKey);
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
virtual void MouseSelectFromCursorTo(int32_t width, int32_t height);
virtual void MouseEvent(int32_t width, int32_t height);
virtual void MouseEventDouble(void);
@@ -82,15 +103,17 @@ class Buffer {
virtual void Copy(int8_t clipboardID);
virtual void Cut(int8_t clipboardID);
virtual void Paste(int8_t clipboardID);
virtual void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
virtual void Replace(Edn::String &data);
virtual int32_t FindLine(Edn::String &data);
virtual void Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
virtual void Replace(etk::String &data);
virtual int32_t FindLine(etk::String &data);
virtual void JumpAtLine(int32_t newLine);
virtual int32_t GetCurrentLine(void);
protected:
bool m_fileModify;
Edn::File m_fileName;
bool m_haveName; //!< to know if the file have a name or NOT
bool m_fileModify; //!<
// naming
etk::File m_fileName; //!< filename of the curent buffer
bool m_haveName; //!< to know if the file have a name or NOT
};

View File

@@ -23,11 +23,11 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "BufferEmpty.h"
#include "ColorizeManager.h"
#include "MainWindows.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <BufferEmpty.h>
#include <ColorizeManager.h>
#include <MainWindows.h>
#undef __class__
#define __class__ "BufferEmpty"
@@ -67,30 +67,40 @@ BufferEmpty::~BufferEmpty(void)
* @return ---
*
*/
int32_t BufferEmpty::Display(DrawerManager &drawer)
int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
{
ColorizeManager * myColorManager = ColorizeManager::getInstance();
// Get color :
Colorize *myColor = NULL;
// Clean Buffer
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG) );
//drawer.Flush();
if (NULL == OOText) {
EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL;
}
if (NULL == OOColored) {
EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL;
}
myColor = myColorManager->Get("normal");
// Draw the 2 comments Lines :
drawer.Text(myColor, 20,20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique");
//drawer.Flush();
OOText->SetColor(myColor->GetFG());
OOText->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
myColor = myColorManager->Get("commentDoxygen");
drawer.Text(myColor, 20,25 + Display::GetFontHeight(), "No Buffer Availlable to display");
drawer.Flush();
/*
myColor = myColorManager->Get(("SelectedText"));
drawer.Cursor(20, 50);
drawer.EndOfLine(20, 70);
drawer.Tabulation(myColor, 20, 90, 5);
drawer.UTF8UnknownElement(myColor, 20, 120, 3, false);
drawer.Flush();
*/
OOText->SetColor(myColor->GetFG());
OOText->TextAdd(20, 50, "No Buffer Availlable to display", sizeX);
color_ts bgColor; //!< Text color
bgColor.red = 1.0;
bgColor.green = 1.0;
bgColor.blue = 1.0;
bgColor.alpha = 1.0;
OOColored->SetColor(bgColor);
OOColored->Rectangle( 0, 0, sizeX, sizeY);
return ERR_NONE;
}

View File

@@ -26,13 +26,13 @@
#ifndef __BUFFER_EMPTY_H__
#define __BUFFER_EMPTY_H__
#include "Buffer.h"
#include <Buffer.h>
class BufferEmpty : public Buffer {
public:
BufferEmpty(void);
virtual ~BufferEmpty(void);
virtual int32_t Display(DrawerManager &drawer);
int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
};

View File

@@ -24,10 +24,9 @@
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "BufferManager.h"
//#include "MsgBroadcast.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <BufferManager.h>
#undef __class__
#define __class__ "BufferManager"
@@ -62,8 +61,8 @@ BufferManager::~BufferManager(void)
EDN_INFO("~BufferManager::RemoveAll();");
RemoveAll();
// clear The list of Buffer
EDN_INFO("~BufferManager::listBuffer.clear();");
listBuffer.clear();
EDN_INFO("~BufferManager::listBuffer.Clear();");
listBuffer.Clear();
EDN_INFO("~BufferManager::delete(BufferNotExiste);");
delete(BufferNotExiste);
}
@@ -73,6 +72,9 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
m_idSelected = dataID;
break;
case EDN_MSG__NEW:
{
int32_t newOne = Create();
@@ -81,6 +83,49 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
}
}
break;
case EDN_MSG__BUFF_ID_CLOSE:
// Check buffer existence
if(true == Exist(dataID)) {
// Get the new display buffer
if (m_idSelected == dataID) {
// Try previous buffer
int32_t destBuffer = -1;
for(int32_t ii=dataID-1; ii >= 0; ii--) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
// try next buffer
if (-1 == destBuffer) {
for(int32_t ii=dataID+1; ii < listBuffer.Size(); ii++) {
if (true == Exist(ii) ) {
destBuffer = ii;
break;
}
}
}
//EDN_DEBUG("new buffer selected : ?? " << destBuffer);
// set it to the currect display
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, destBuffer);
}
//EDN_DEBUG("Remove : " << dataID);
// Remove requested buffer
Remove(dataID);
}
break;
case EDN_MSG__BUFF_ID_SAVE:
// Check buffer existence
if(true == Exist(dataID)) {
// If no name ==> request a Gui display ...
if (Get(dataID)->HaveName() == false) {
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, dataID);
} else {
Get(dataID)->Save();
}
}
break;
}
}
@@ -101,7 +146,7 @@ void BufferManager::OnMessage(int32_t id, int32_t dataID)
void BufferManager::RemoveAll(void)
{
int32_t i;
for (i=0; i<(int32_t)listBuffer.size(); i++) {
for (i=0; i<listBuffer.Size(); i++) {
Remove(i);
}
SendMessage(EDN_MSG__BUFFER_REMOVE_ALL);
@@ -122,8 +167,8 @@ int32_t BufferManager::Create(void)
// allocate a new Buffer
Buffer *myBuffer = new BufferText();
// Add at the list of element
listBuffer.push_back(myBuffer);
int32_t basicID = (int32_t)listBuffer.size() - 1;
listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.Size() - 1;
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
return basicID;
}
@@ -139,13 +184,14 @@ int32_t BufferManager::Create(void)
* @todo : check if this file is not curently open and return the old ID
*
*/
int32_t BufferManager::Open(Edn::String &filename)
int32_t BufferManager::Open(etk::File &myFile)
{
// TODO : Check here if the file is already open ==> and display it if needed
// allocate a new Buffer
Buffer *myBuffer = new BufferText(filename);
Buffer *myBuffer = new BufferText(myFile);
// Add at the list of element
listBuffer.push_back(myBuffer);
int32_t basicID = (int32_t)listBuffer.size() - 1;
listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.Size() - 1;
SendMessage(EDN_MSG__BUFFER_ADD, basicID);
return basicID;
}
@@ -159,7 +205,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
return BufferNotExiste;
}
// check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) {
if (BufferID < listBuffer.Size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
return listBuffer[BufferID];
@@ -167,7 +213,7 @@ Buffer * BufferManager::Get(int32_t BufferID)
EDN_ERROR("non existing Buffer " << BufferID);
}
} else {
EDN_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
EDN_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
}
return BufferNotExiste;
}
@@ -179,7 +225,7 @@ bool BufferManager::Exist(int32_t BufferID)
return false;
}
// check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) {
if (BufferID < listBuffer.Size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
return true;
@@ -189,14 +235,23 @@ bool BufferManager::Exist(int32_t BufferID)
}
int32_t BufferManager::GetId(Edn::String &filename)
bool BufferManager::Exist(etk::File &myFile )
{
if (-1 == GetId(myFile)) {
return false;
}
return true;
}
int32_t BufferManager::GetId(etk::File &myFile)
{
int32_t iii;
// check if the Buffer existed
for (iii=0; iii < (int32_t)listBuffer.size(); iii++) {
for (iii=0; iii < listBuffer.Size(); iii++) {
// check if the buffer already existed
if (NULL != listBuffer[iii]) {
if ( listBuffer[iii]->GetName() == filename) {
if ( listBuffer[iii]->GetFileName() == myFile) {
return iii;
}
}
@@ -204,19 +259,11 @@ int32_t BufferManager::GetId(Edn::String &filename)
return -1;
}
bool BufferManager::Exist(Edn::String &filename)
{
if (-1 == GetId(filename)) {
return false;
}
return true;
}
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t BufferManager::Size(void)
{
return listBuffer.size();
return listBuffer.Size();
}
@@ -234,7 +281,7 @@ bool BufferManager::Remove(int32_t BufferID)
return false;
}
// check if the Buffer existed
if (BufferID < (int32_t)listBuffer.size()) {
if (BufferID < listBuffer.Size()) {
// check if the buffer already existed
if (NULL != listBuffer[BufferID]) {
// TODO : Check if it saved...
@@ -253,7 +300,7 @@ bool BufferManager::Remove(int32_t BufferID)
return false;
}
} else {
EDN_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
EDN_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
return false;
}
}
@@ -269,7 +316,7 @@ bool BufferManager::Remove(int32_t BufferID)
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t i;
for (i=0; i<(int32_t)listBuffer.size(); i++) {
for (i=0; i<listBuffer.Size(); i++) {
if (NULL != listBuffer[i]) {
iEmeElement--;
// find the element :

View File

@@ -26,17 +26,15 @@
#ifndef __BUFFER_MANAGER_H__
#define __BUFFER_MANAGER_H__
#include "Buffer.h"
#include "BufferText.h"
#include "BufferEmpty.h"
#include "Singleton.h"
#include "MsgBroadcast.h"
#include <vector>
#include <string>
#include <Buffer.h>
#include <BufferText.h>
#include <BufferEmpty.h>
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
class BufferManager: public etk::Singleton<BufferManager>, public MsgBroadcast
{
friend class Singleton<BufferManager>;
friend class etk::Singleton<BufferManager>;
// specific for sigleton system...
private:
// Constructeur
@@ -48,28 +46,28 @@ class BufferManager: public Singleton<BufferManager>, public MsgBroadcast
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
int32_t Create(void);
// open curent filename
int32_t Open(Edn::String &filename);
int32_t Open(etk::File &myFile);
int32_t GetSelected(void) { return m_idSelected;};
void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(Edn::String &filename);
int32_t GetId(Edn::String &filename);
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
int32_t WitchBuffer(int32_t iEmeElement);
uint32_t Size(void);
int32_t WitchBuffer(int32_t iEmeElement);
bool Remove(int32_t BufferID);
bool Remove(int32_t BufferID);
private:
std::vector<Buffer*> listBuffer; //!< element List of the char Elements
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
};
#endif

View File

@@ -23,12 +23,18 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "ClipBoard.h"
#include "BufferText.h"
#include "toolsMemory.h"
#include "Edn.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <ClipBoard.h>
#include <BufferText.h>
#include <toolsMemory.h>
#include <etk/RegExp.h>
#include <ewol/ewol.h>
#include <ewol/OObject.h>
#include <ewol/WidgetManager.h>
#include <ewol/Widget.h>
#undef __class__
#define __class__ "BufferText"
@@ -36,6 +42,10 @@
const uint32_t nbLineAllocatedInBase = 300;
extern "C"
{
const char * g_pointerForTheDisplayLine[] = {"%1d", "%2d","%3d","%4d","%5d","%6d","%7d","%8d","%9d","%d"};
}
@@ -49,16 +59,10 @@ const uint32_t nbLineAllocatedInBase = 300;
*/
void BufferText::BasicInit(void)
{
static int32_t fileBasicID = 0;
NeedToCleanEndPage = true;
// set the first element that is displayed
m_displayStartBufferPos = 0;
// set basic filename :
filename = "Untitled ";
filename += fileBasicID;
// no name ...
haveName = false;
fileBasicID++;
// set the number of the lineNumber;
nbColoneForLineNumber = 1;
// init the link with the buffer manager
@@ -79,6 +83,29 @@ void BufferText::BasicInit(void)
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void BufferText::NameChange(void)
{
// Find HL system
//EDN_DEBUG("check name change");
if (true == HighlightManager::getInstance()->Exist(m_fileName)) {
Highlight * myHL = HighlightManager::getInstance()->Get(m_fileName);
// Set the new HL
if (NULL != myHL) {
m_EdnBuf.SetHLSystem(myHL);
}
}
}
/**
* @brief
*
@@ -103,16 +130,15 @@ BufferText::BufferText()
* @return ---
*
*/
BufferText::BufferText(Edn::String &newFileName)
BufferText::BufferText(etk::File &fileName) : Buffer(fileName)
{
BasicInit();
EDN_INFO("Add Data from file(" << newFileName.c_str() << ")");
NameChange();
EDN_INFO("Add Data from file(" << GetFileName() << ")");
FILE * myFile = NULL;
// set the filename :
SetName(newFileName);
// try to open the file. if not existed, new file
myFile = fopen(newFileName.c_str(), "r");
myFile = fopen(fileName.GetCompleateName().c_str(), "r");
if (NULL != myFile) {
m_EdnBuf.DumpFrom(myFile);
// close the input file
@@ -120,7 +146,7 @@ BufferText::BufferText(Edn::String &newFileName)
SetModify(false);
} else {
// fichier inexistant... creation d'un nouveaux
EDN_WARNING("No File ==> created a new one(" << newFileName.c_str() << ")");
EDN_WARNING("No File ==> created a new one(" << GetFileName() << ")");
SetModify(true);
}
UpdateWindowsPosition();
@@ -138,9 +164,9 @@ BufferText::BufferText(Edn::String &newFileName)
*/
void BufferText::Save(void)
{
EDN_INFO("Save File : \"" << filename.c_str() << "\"" );
EDN_INFO("Save File : \"" << GetFileName() << "\"" );
FILE * myFile = NULL;
myFile = fopen(filename.c_str(), "w");
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
if (NULL != myFile) {
m_EdnBuf.DumpIn(myFile);
fclose(myFile);
@@ -179,111 +205,13 @@ void BufferText::SelectionEnd(void)
void BufferText::SelectionCheckMode(void)
{
/*
if (true == globals::IsSetCtrl() ) {
if (true == ewol::IsSetCtrl() ) {
} else {
}
*/
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String BufferText::GetName(void)
{
return filename;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String BufferText::GetShortName(void)
{
char *ptr = strrchr(filename.c_str(), '/');
if (NULL == ptr) {
ptr = strrchr(filename.c_str(), '\\');
}
Edn::String out = filename;
if (NULL != ptr) {
out = ptr+1;
}
return out;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Edn::String BufferText::GetFolder(void)
{
char tmpVal[4096];
strncpy(tmpVal, filename.c_str(), 4096);
tmpVal[4096-1] = '\0';
char *ptr = strrchr(tmpVal, '/');
if (NULL == ptr) {
ptr = strrchr(tmpVal, '\\');
}
Edn::String out = "./";
if (NULL != ptr) {
*ptr = '\0';
out = tmpVal;
}
return out;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool BufferText::HaveName(void)
{
return haveName;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void BufferText::SetName(Edn::String &newName)
{
filename = newName;
haveName = true;
// Find HL system
if (true == HighlightManager::getInstance()->Exist(newName)) {
Highlight * myHL = HighlightManager::getInstance()->Get(newName);
// Set the new HL
if (NULL != myHL) {
m_EdnBuf.SetHLSystem(myHL);
}
}
}
/**
* @brief
*
@@ -310,16 +238,58 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
}
void BufferText::DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t lineNumber, int32_t positionY)
void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY)
{
char tmpLineNumber[50];
sprintf(tmpLineNumber, myPrint, lineNumber);
drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber);
//drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber);
OOText->SetColor(myColorManager->Get(COLOR_CODE_LINE_NUMBER));
OOText->TextAdd(1, positionY, tmpLineNumber, -1);
}
#define CURSOR_WIDTH (5)
#define CURSOR_THICKNESS (1.2)
void BufferText::CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth)
{
color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
OOColored->SetColor(tmpppppp);
if (true == ewol::IsSetInsert()) {
OOColored->Rectangle( x, y, letterWidth, letterHeight);
} else {
OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y) , (int32_t)(x+CURSOR_WIDTH), (int32_t)(y) , CURSOR_THICKNESS);
OOColored->Line( (int32_t)(x-CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), (int32_t)(x+CURSOR_WIDTH), (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS);
OOColored->Line( (int32_t)(x) , (int32_t)(y) , (int32_t)(x) , (int32_t)(y+letterHeight-CURSOR_THICKNESS), CURSOR_THICKNESS);
}
}
/**
* @brief Update internal data of the pointer to display
*
* @param[in,out] ---
*
* @return ---
*
*/
/*
void BufferText::UpdatePointerNumber(void)
{
// get the number of line in the buffer
int32_t maxNumberLine = m_EdnBuf.NumberOfLines();
//int32_t maxNumberLine = 2096;
if (10 > maxNumberLine) { m_nbColoneForLineNumber = 1;
} else if (100 > maxNumberLine) { m_nbColoneForLineNumber = 2;
} else if (1000 > maxNumberLine) { m_nbColoneForLineNumber = 3;
} else if (10000 > maxNumberLine) { m_nbColoneForLineNumber = 4;
} else if (100000 > maxNumberLine) { m_nbColoneForLineNumber = 5;
} else if (1000000 > maxNumberLine) { m_nbColoneForLineNumber = 6;
} else if (1000000 > maxNumberLine) { m_nbColoneForLineNumber = 7;
} else if (10000000 > maxNumberLine) { m_nbColoneForLineNumber = 8;
} else if (100000000 > maxNumberLine) { m_nbColoneForLineNumber = 9;
} else { m_nbColoneForLineNumber = 10;
}
}
*/
/**
* @brief Display the curent buffer with all the probematic imposed by the xharset and the user contraint.
*
@@ -328,25 +298,28 @@ void BufferText::DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t li
* @return
*
*/
int32_t BufferText::Display(DrawerManager &drawer)
int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
{
int32_t letterHeight = Display::GetFontHeight();
int32_t letterWidth = Display::GetFontWidth();
// update the number of element that can be displayed
m_displaySize.x = (drawer.GetWidth()/letterWidth) + 1 - nbColoneForLineNumber;;
m_displaySize.y = (drawer.GetHeight()/letterHeight) + 1;
EDN_INFO("main DIPLAY " << m_displaySize.x << " char * " << m_displaySize.y << " char");
int32_t selStart, selEnd, selRectStart, selRectEnd;
bool selIsRect;
int32_t selHave = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, selStart, selEnd, selIsRect, selRectStart, selRectEnd);
int32_t selHave;
int32_t fontId = ewol::GetDefaultFontId();
int32_t letterWidth = ewol::GetWidth(fontId, "A");
int32_t spaceWidth = ewol::GetWidth(fontId, " ");
int32_t letterHeight = ewol::GetHeight(fontId);
// update the number of element that can be displayed
m_displaySize.x = (sizeX/letterWidth) + 1 - nbColoneForLineNumber;
m_displaySize.y = (sizeY/letterHeight) + 1;
EDN_INFO("main DIPLAY " << m_displaySize.x << " char * " << m_displaySize.y << " char");
selHave = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, selStart, selEnd, selIsRect, selRectStart, selRectEnd);
colorInformation_ts * HLColor = NULL;
//displayLineNumber(drawer);
// get the number of line in the buffer
int32_t maxNumberLine = m_EdnBuf.NumberOfLines();
//int32_t maxNumberLine = 2096;
char *myPrint = NULL;
if (10 > maxNumberLine) { nbColoneForLineNumber = 1; myPrint = (char *)"%1d";
} else if (100 > maxNumberLine) { nbColoneForLineNumber = 2; myPrint = (char *)"%2d";
@@ -370,25 +343,47 @@ int32_t BufferText::Display(DrawerManager &drawer)
Colorize * selectColor = NULL;
char displayChar[MAX_EXP_CHAR_LEN];
memset(displayChar, 0, sizeof(char)*MAX_EXP_CHAR_LEN);
int mylen = m_EdnBuf.Size();
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
uint32_t xx = 0;
int32_t idX = 0;
drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG));
color_ts bgColor; //!< Text color
color_ts & tmpppppp = myColorManager->Get(COLOR_CODE_BASIC_BG);
OOColored->SetColor(tmpppppp);
OOColored->Rectangle( 0, 0, sizeX, sizeY);
int displayLines = 0;
// Regenerate the colorizing if necessary ...
m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y);
GTimeVal timeStart;
g_get_current_time(&timeStart);
//GTimeVal timeStart;
//g_get_current_time(&timeStart);
#if 0
// TODO : change diplay methode :
// Extract the entire line on the buffer with all char expended and the data in Unicode
// Second parsing of the line ==> to have the syntax highligt
// Draw all needed char in the
int32_t currentLineID = m_displayStart.y+1;
EDN_DEBUG("Start display of text buffer [" << m_displayStartBufferPos<< ".." << mylen << "]");
bool ended = false;
while (true == ended) {
currentLineID++;
ended = true;
}
#else
// draw the lineNumber :
int32_t currentLineID = m_displayStart.y+1;
DrawLineNumber(drawer, myPrint, currentLineID, y);
EDN_DEBUG("Start display of text buffer [" << m_displayStartBufferPos<< ".." << mylen << "]");
EDN_DEBUG("cursor Pos : " << m_cursorPos << "start at pos=" << m_displayStartBufferPos);
DrawLineNumber(OOText, OOColored, sizeX, sizeY, myPrint, currentLineID, y);
int32_t pixelX = x_base;
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
//EDN_INFO("diplay element=" << iii);
int32_t pixelX = xx*letterWidth + x_base;
//EDN_DEBUG("diplay element=" << iii);
int displaywidth;
uint32_t currentChar = '\0';
new_i = iii;
@@ -426,19 +421,19 @@ int32_t BufferText::Display(DrawerManager &drawer)
if( ' ' == currentChar
&& true == globals::IsSetDisplaySpaceChar() )
{
//selectColor = myColorSel;
//SpaceText(color_ts & SelectColor, int32_t x, int32_t y,int32_t nbChar)
selectColor = myColorSel;
if( true == selHave
&& selStart <= iii
&& selEnd > iii)
{
drawer.SpaceText(myColorSel->GetBG(), pixelX ,y , 1);
OOColored->SetColor(myColorSel->GetBG());
} else if (true == selectColor->HaveBg()) {
drawer.SpaceText(selectColor->GetBG(), pixelX ,y , 1);
OOColored->SetColor(selectColor->GetBG());
} else {
drawer.SpaceText(myColorSpace, pixelX ,y , 1);
OOColored->SetColor(myColorSpace);
}
OOColored->Rectangle( pixelX, y, spaceWidth, letterHeight);
pixelX += spaceWidth;
} else if( '\t' == currentChar
&& true == globals::IsSetDisplaySpaceChar() )
{
@@ -446,12 +441,14 @@ int32_t BufferText::Display(DrawerManager &drawer)
&& selStart <= iii
&& selEnd > iii)
{
drawer.SpaceText(myColorSel->GetBG(), pixelX ,y , strlen(tmpDisplayOfset));
OOColored->SetColor(myColorSel->GetBG());
} else if (true == selectColor->HaveBg()) {
drawer.SpaceText(selectColor->GetBG(), pixelX ,y , strlen(tmpDisplayOfset));
OOColored->SetColor(selectColor->GetBG());
} else {
drawer.SpaceText(myColorTab, pixelX ,y , strlen(tmpDisplayOfset));
OOColored->SetColor(myColorTab);
}
OOColored->Rectangle( pixelX, y, spaceWidth*strlen(tmpDisplayOfset), letterHeight);
pixelX += spaceWidth*strlen(tmpDisplayOfset);
} else {
if( true == selHave
&& selStart <= iii
@@ -459,10 +456,20 @@ int32_t BufferText::Display(DrawerManager &drawer)
{
selectColor = myColorSel;
}
OOColored->SetColor(selectColor->GetBG());
OOText->SetColor(selectColor->GetFG());
if (currentChar <= 0x7F) {
drawer.Text(selectColor, pixelX ,y, tmpDisplayOfset);
int32_t drawSize = OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
if (true == selectColor->HaveBg() ) {
OOColored->Rectangle( pixelX, y, drawSize*strlen(tmpDisplayOfset), letterHeight);
}
pixelX += drawSize;
} else {
drawer.Text(selectColor, pixelX ,y, displayChar);
int32_t drawSize = OOText->TextAdd(pixelX, y, displayChar, -1);
if (true == selectColor->HaveBg() ) {
OOColored->Rectangle( pixelX, y, drawSize*strlen(tmpDisplayOfset), letterHeight);
}
pixelX += drawSize;
}
}
xx+=widthToDisplay;
@@ -470,42 +477,46 @@ int32_t BufferText::Display(DrawerManager &drawer)
idX += displaywidth;
}
// display cursor :
//EDN_DEBUG(" is equal : " << m_cursorPos << "=" << iii);
if (m_cursorPos == iii) {
// display the cursor:
if (true == m_cursorOn) {
drawer.Cursor(pixelX, y+letterHeight);
CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth);
/*if (true == m_cursorOn) {
//Cursor(OOColored, pixelX, y+letterHeight, letterHeight, letterWidth);
//m_cursorOn = false;
} else {
m_cursorOn = true;
}
}*/
}
// move to next line ...
if (currentChar=='\n') {
drawer.EndOfLine(pixelX, y+letterHeight);
drawer.Flush();
//drawer.EndOfLine(pixelX, y+letterHeight);
//drawer.Flush();
xx = 0;
idX =0;
pixelX = x_base;
y += letterHeight;
displayLines++;
currentLineID++;
DrawLineNumber(drawer, myPrint, currentLineID, y);
DrawLineNumber(OOText, OOColored, sizeX, sizeY, myPrint, currentLineID, y);
}
}
// special case : the cursor is at the end of the buffer...
if (m_cursorPos == iii) {
CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth);
// display the cursor:
if (true == m_cursorOn) {
drawer.Cursor(xx*letterWidth + x_base, y+letterHeight);
//Cursor(OOColored, xx*letterWidth + x_base, yy+letterHeight, letterHeight, letterWidth);
m_cursorOn = false;
} else {
m_cursorOn = true;
}
}
drawer.Flush();
#endif
GTimeVal timeStop;
g_get_current_time(&timeStop);
EDN_DEBUG("Display Generation = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
//GTimeVal timeStop;
//g_get_current_time(&timeStop);
//EDN_DEBUG("Display Generation = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
return ERR_NONE;
}
@@ -514,6 +525,7 @@ int32_t BufferText::Display(DrawerManager &drawer)
void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y)
{
x = (width - 3) / Display::GetFontWidth() - nbColoneForLineNumber;
y = height / Display::GetFontHeight();
if (x < 0) {
@@ -536,7 +548,7 @@ void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int
// TODO : Simplify selection ....
void BufferText::MouseEvent(int32_t width, int32_t height)
{
if (true == globals::IsSetShift() ) {
if (true == ewol::IsSetShift() ) {
MouseSelectFromCursorTo(width, height);
} else {
int32_t posX, posY;
@@ -774,11 +786,11 @@ void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
}
if( false == haveSelectionActive
&& true == globals::IsSetShift() )
&& true == ewol::IsSetShift() )
{
// new selection
m_EdnBuf.Select(SELECTION_PRIMARY, rememberCursorPos, m_cursorPos);
} else if( true == globals::IsSetShift()
} else if( true == ewol::IsSetShift()
&& true == haveSelectionActive)
{
// update selection
@@ -866,12 +878,12 @@ bool BufferText::TextDMoveDown(int32_t offset)
* @return ---
*
*/
void BufferText::cursorMove(int32_t gtkKey)
void BufferText::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
{
bool needUpdatePosition = true;
// check selection event ...
/*
if (true == globals::IsSetShift() ) {
if (true == ewol::IsSetShift() ) {
if ( CURSOR_MODE_NORMAL == cursorMode) {
SelectionStart();
} else {
@@ -881,73 +893,41 @@ void BufferText::cursorMove(int32_t gtkKey)
SelectionEnd();
}
*/
switch(gtkKey) {
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Left:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Left:
# endif
switch(moveTypeEvent) {
case ewol::EVENT_KB_MOVE_TYPE_LEFT:
//EDN_INFO("keyEvent : <LEFT>");
if (m_cursorPos > 0) {
SetInsertPosition(m_cursorPos - 1);
}
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Right:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Right:
# endif
case ewol::EVENT_KB_MOVE_TYPE_RIGHT:
//EDN_INFO("keyEvent : <RIGHT>");
if (m_cursorPos < m_EdnBuf.Size() ) {
SetInsertPosition(m_cursorPos + 1);
}
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Up:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Up:
# endif
case ewol::EVENT_KB_MOVE_TYPE_UP:
//EDN_INFO("keyEvent : <UP>");
TextDMoveUp(1);
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Down:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Down:
# endif
case ewol::EVENT_KB_MOVE_TYPE_DOWN:
//EDN_INFO("keyEvent : <DOWN>");
// check if we have enought line ...
TextDMoveDown(1);
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Page_Up:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Page_Up:
# endif
case ewol::EVENT_KB_MOVE_TYPE_PAGE_UP:
//EDN_INFO("keyEvent : <PAGE-UP>");
TextDMoveUp(m_displaySize.x);
TextDMoveUp(m_displaySize.y);
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Page_Down:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Page_Down:
# endif
case ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN:
//EDN_INFO("keyEvent : <PAGE-DOWN>");
TextDMoveDown(m_displaySize.x);
TextDMoveDown(m_displaySize.y);
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_Begin:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_Begin:
# endif
case ewol::EVENT_KB_MOVE_TYPE_START:
//EDN_INFO("keyEvent : <Start of line>");
SetInsertPosition(m_EdnBuf.StartOfLine(m_cursorPos) );
break;
# ifdef USE_GTK_VERSION_3_0
case GDK_KEY_End:
# elif defined( USE_GTK_VERSION_2_0)
case GDK_End:
# endif
case ewol::EVENT_KB_MOVE_TYPE_END:
//EDN_INFO("keyEvent : <End of line>");
SetInsertPosition(m_EdnBuf.EndOfLine(m_cursorPos) );
break;
@@ -1046,38 +1026,52 @@ void BufferText::AddChar(char * UTF8data)
if (1==size) {
if (UTF8data[0] == 0x09) {
if (false == haveSelectionActive) {
EdnVectorBin<int8_t> tmpVect;
etk::VectorType<int8_t> tmpVect;
tmpVect.PushBack(0x09);
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true);
} else {
if (true == globals::IsSetCtrl() ) {
m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY);
// Indent depend of the multiline in the selection ...
// count the number of line :
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
if (0 == nbSelectedLines) {
etk::VectorType<int8_t> tmpVect;
tmpVect.PushBack(0x09);
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, tmpVect);
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
} else {
m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY);
if (true == ewol::IsSetShift() ) {
m_cursorPos = m_EdnBuf.UnIndent(SELECTION_PRIMARY);
} else {
m_cursorPos = m_EdnBuf.Indent(SELECTION_PRIMARY);
}
}
}
actionDone = true;
} else if (UTF8data[0] == '\n') {
EdnVectorBin<int8_t> tmpVect;
tmpVect.PushBack('\n');
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
if (true == globals::IsSetAutoIndent() ) {
int32_t l_lineStart;
// Get the begin of the line or the begin of the line befor selection
if (false == haveSelectionActive) {
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
} else {
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');
etk::VectorType<int8_t> tmpVect;
if (true == ewol::IsSetShift()) {
tmpVect.PushBack('\r');
} else {
tmpVect.PushBack('\n');
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
if (true == globals::IsSetAutoIndent() ) {
int32_t l_lineStart;
// Get the begin of the line or the begin of the line befor selection
if (false == haveSelectionActive) {
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
} 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;
}
}
}
}
@@ -1114,7 +1108,7 @@ void BufferText::AddChar(char * UTF8data)
if (false == actionDone) {
if (true == m_EdnBuf.GetUTF8Mode()) {
EdnVectorBin<int8_t> tmpVect;
etk::VectorType<int8_t> tmpVect;
int32_t localOfset = strlen(UTF8data);
tmpVect.PushBack((int8_t*)UTF8data, localOfset);
if (false == haveSelectionActive) {
@@ -1128,8 +1122,8 @@ void BufferText::AddChar(char * UTF8data)
// convert in the Good ISO format :
char output_ISO;
convertUtf8ToIso(m_EdnBuf.GetCharsetType(), UTF8data, output_ISO);
printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
EdnVectorBin<int8_t> tmpVect;
//printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
etk::VectorType<int8_t> tmpVect;
tmpVect.PushBack(output_ISO);
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
@@ -1145,16 +1139,15 @@ void BufferText::AddChar(char * UTF8data)
UpdateWindowsPosition();
}
#include "EdnRegExp.h"
int32_t BufferText::FindLine(Edn::String &data)
int32_t BufferText::FindLine(etk::String &data)
{
if ( 0 == data.Size()) {
EDN_WARNING("no search data");
return 0;
}
EDN_INFO("Search data line : \"" << data.c_str() << "\"");
EdnVectorBin<int8_t> mVectSearch;
EDN_INFO("Search data line : \"" << data << "\"");
etk::VectorType<int8_t> mVectSearch;
mVectSearch = data.GetVector();
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
int32_t foundPos;
@@ -1176,9 +1169,24 @@ void BufferText::JumpAtLine(int32_t newLine)
UpdateWindowsPosition(true);
}
void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
/**
* @brief Get the current line (to know where to jump)
*
* @param ---
*
* @return Return the current line number
*
*/
int32_t BufferText::GetCurrentLine(void)
{
EDN_INFO("Search data : \"" << data.c_str() << "\"");
return m_EdnBuf.CountLines(0, m_cursorPos);
}
void BufferText::Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp)
{
EDN_INFO("Search data : \"" << data << "\"");
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
@@ -1197,7 +1205,7 @@ void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool w
EDN_WARNING("no search data");
return;
}
EdnVectorBin<int8_t> mVectSearch;
etk::VectorType<int8_t> mVectSearch;
mVectSearch = data.GetVector();
if (false == back) {
//EDN_INFO("search data Forward : startSearchPos=" << startSearchPos );
@@ -1264,16 +1272,16 @@ void BufferText::Search(Edn::String &data, bool back, bool caseSensitive, bool w
}
void BufferText::Replace(Edn::String &data)
void BufferText::Replace(etk::String &data)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SELECTION_PRIMARY, SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (true == haveSelectionActive) {
// Replace Data :
// TODO : Reset this : ... m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, data.GetDirectPointer());//, strlen(data.GetDirectPointer()));
// TODO : Reset this : ... SetInsertPosition(SelectionStart + strlen(data.GetDirectPointer()));
etk::VectorType<int8_t> myData = data.GetVector();
m_EdnBuf.ReplaceSelected(SELECTION_PRIMARY, myData);
SetInsertPosition(SelectionStart + myData.Size());
}
SetModify(true);
}
@@ -1289,7 +1297,7 @@ void BufferText::Replace(Edn::String &data)
*/
void BufferText::Copy(int8_t clipboardID)
{
EdnVectorBin<int8_t> mVect;
etk::VectorType<int8_t> mVect;
// get the curent selected data
if (true == m_EdnBuf.SelectHasSelection(SELECTION_PRIMARY) ) {
m_EdnBuf.GetSelectionText(SELECTION_PRIMARY, mVect);
@@ -1338,7 +1346,7 @@ void BufferText::Cut(int8_t clipboardID)
*/
void BufferText::Paste(int8_t clipboardID)
{
EdnVectorBin<int8_t> mVect;
etk::VectorType<int8_t> mVect;
// copy data from the click board :
ClipBoard::Get(clipboardID, mVect);

View File

@@ -26,8 +26,6 @@
#ifndef __BUFFER_TEXT_H__
#define __BUFFER_TEXT_H__
#include <vector>
#include <string>
#include "ColorizeManager.h"
#include "Buffer.h"
#include "EdnBuf.h"
@@ -41,22 +39,17 @@ typedef enum {
class BufferText : public Buffer {
public:
BufferText(void);
BufferText(Edn::String &filename);
BufferText(etk::File &fileName);
virtual ~BufferText(void);
Edn::String GetName(void);
Edn::String GetShortName(void);
Edn::String GetFolder(void);
void SetName(Edn::String &newName);
void Save(void);
bool HaveName(void);
void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber);
int32_t Display(DrawerManager &drawer);
int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
void ForceReDraw(bool allElement);
void AddChar(char * UTF8data);
void cursorMove(int32_t gtkKey);
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
void MouseSelectFromCursorTo(int32_t width, int32_t height);
void MouseEvent(int32_t width, int32_t height);
void MouseEventDouble(void);
@@ -68,21 +61,22 @@ class BufferText : public Buffer {
void Cut(int8_t clipboardID);
void Paste(int8_t clipboardID);
void Search(Edn::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(Edn::String &data);
int32_t FindLine(Edn::String &data);
void Search(etk::String &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(etk::String &data);
int32_t FindLine(etk::String &data);
void JumpAtLine(int32_t newLine);
int32_t GetCurrentLine(void);
void RemoveLine(void);
void SelectAll(void);
void SelectNone(void);
void Undo(void);
void Redo(void);
void SetCharset(charset_te newCharset);
protected:
void NameChange(void);
private:
// naming
Edn::String filename; //!< filename of the curent buffer
bool haveName; //!< to know if the file have a name or NOT
// Display
bool NeedToCleanEndPage; //!< if true, the end of the page need to be clean (arrive after a remove line)
uint32_t nbColoneForLineNumber; //!< number of colome used to display the line Number
@@ -120,7 +114,9 @@ class BufferText : public Buffer {
void GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y);
void MoveUpDown(int32_t ofset);
void DrawLineNumber(DrawerManager &drawer,char *myPrint, int32_t lineNumber, int32_t positionY);
void DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY);
void CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth);
};

View File

@@ -23,25 +23,26 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Colorize.h"
#include "Edn.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <Colorize.h>
#undef __class__
#define __class__ "Colorize"
Colorize::Colorize( Edn::String &newColorName)
Colorize::Colorize( etk::String &newColorName)
{
m_colorFG.red=0;
m_colorFG.green=0;
m_colorFG.blue=0;
m_colorFG.alpha=1;
m_colorBG.red=0;
m_colorBG.green=0;
m_colorBG.blue=0;
m_colorBG.alpha=1;
italic = false;
bold = false;
@@ -58,9 +59,11 @@ Colorize::Colorize(void)
m_colorFG.red=0;
m_colorFG.green=0;
m_colorFG.blue=0;
m_colorFG.alpha=1;
m_colorBG.red=0;
m_colorBG.green=0;
m_colorBG.blue=0;
m_colorBG.alpha=1;
italic = false;
bold = false;
@@ -82,14 +85,14 @@ void Colorize::SetName(const char *newColorName)
ColorName = newColorName;
}
void Colorize::SetName(Edn::String &newColorName)
void Colorize::SetName(etk::String &newColorName)
{
//EDN_INFO("color change name : \"%s\" ==> \"%s\"",ColorName.c_str(), newColorName.c_str());
ColorName = newColorName;
}
Edn::String Colorize::GetName(void)
etk::String Colorize::GetName(void)
{
return ColorName;
}
@@ -98,24 +101,38 @@ Edn::String Colorize::GetName(void)
void Colorize::SetFgColor(const char *myColor)
{
haveFG = true;
unsigned int r=0;
unsigned int v=0;
unsigned int b=0;
sscanf(myColor, "#%02x%02x%02x", &r,&v,&b);
signed int r=0;
signed int v=0;
signed int b=0;
signed int a=-1;
sscanf(myColor, "#%02x%02x%02x%02x", &r, &v, &b, &a);
m_colorFG.red = (float)r/255.0;
m_colorFG.green = (float)v/255.0;
m_colorFG.blue = (float)b/255.0;
if (-1 == a) {
m_colorFG.alpha = 1;
} else {
m_colorFG.alpha = (float)a/255.0;
}
//EDN_INFO(myColor << " ==> r="<< r <<" v="<< v <<" b="<< b );
}
void Colorize::SetBgColor(const char *myColor)
{
haveBG = true;
unsigned int r,v,b;
sscanf(myColor, "#%02x%02x%02x", &r,&v,&b);
signed int r=0;
signed int v=0;
signed int b=0;
signed int a=-1;
sscanf(myColor, "#%02x%02x%02x%02x", &r, &v, &b, &a);
m_colorBG.red = (float)r/255.0;
m_colorBG.green = (float)v/255.0;
m_colorBG.blue = (float)b/255.0;
if (-1 == a) {
m_colorBG.alpha = 1;
} else {
m_colorBG.alpha = (float)a/255.0;
}
}
bool Colorize::HaveBg(void)

View File

@@ -26,31 +26,19 @@
#ifndef __COLORIZE_H__
#define __COLORIZE_H__
#include "Edn.h"
extern "C" {
typedef struct {
float red;
float green;
float blue;
} color_ts;
}
class Colorize {
public:
// Constructeur
Colorize(void);
Colorize(Edn::String &newColorName);
Colorize(etk::String &newColorName);
~Colorize(void);
void SetName(Edn::String &newColorName);
void SetName(etk::String &newColorName);
void SetName(const char *newColorName);
Edn::String GetName(void);
etk::String GetName(void);
void SetFgColor(const char *myColor);
void SetBgColor(const char *myColor);
void ApplyFG(cairo_t * cr) { cairo_set_source_rgb(cr, m_colorFG.red, m_colorFG.green, m_colorFG.blue); };
void ApplyBG(cairo_t * cr) { cairo_set_source_rgb(cr, m_colorBG.red, m_colorBG.green, m_colorBG.blue); };
color_ts & GetFG(void) { return m_colorFG; };
color_ts & GetBG(void) { return m_colorBG; };
@@ -62,10 +50,10 @@ class Colorize {
bool GetItalic(void);
bool GetBold(void);
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName.c_str() << "\"" /*<< " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
void Display(int32_t i) { EDN_INFO(" " << i << " : \"" << ColorName.c_str() << "\"" << " fg="<< m_colorFG.red <<","<< m_colorFG.green <<","<< m_colorFG.blue <<","<< m_colorFG.alpha /*<<" bg="<< m_colorBG.red <<","<< m_colorBG.green <<","<< m_colorBG.blue*/ ); };
private:
Edn::String ColorName; //!< curent color Name
etk::String ColorName; //!< curent color Name
color_ts m_colorFG;
color_ts m_colorBG;

View File

@@ -1,6 +1,6 @@
/**
*******************************************************************************
* @file ColoriseManager.cpp
* @file ColorizeManager.cpp
* @brief Editeur De N'ours : Colorising Manager
* @author Edouard DUPIN
* @date 14/12/2010
@@ -22,33 +22,72 @@
*
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "ColorizeManager.h"
#include "tinyxml.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <ColorizeManager.h>
#include <tinyXML/tinyxml.h>
#define PFX "ColorizeManager "
ColorizeManager::ColorizeManager(void)
ColorizeManager::ColorizeManager(void) : MsgBroadcast("Colorize Manager", EDN_CAT_COLOR)
{
}
ColorizeManager::~ColorizeManager(void)
{
delete(errorColor);
// TODO : delete all color previously
listMyColor.clear();
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
}
void ColorizeManager::LoadFile(Edn::String &xmlFilename)
void ColorizeManager::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__RELOAD_COLOR_FILE:
{
// Reaload File
// TODO : Check this : Pb in the recopy etk::String element
etk::String plop = m_fileColor;
LoadFile(plop.c_str());
}
break;
}
}
void ColorizeManager::LoadFile(etk::String &xmlFilename)
{
LoadFile(xmlFilename.c_str());
}
void ColorizeManager::LoadFile(const char * xmlFilename)
{
// Remove all old color :
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
m_fileColor = xmlFilename;
EDN_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
errorColor = new Colorize();
errorColor->SetBgColor("#000000");
errorColor->SetFgColor("#FFFFFF");
@@ -58,22 +97,17 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
// open the curent File
XmlDocument.LoadFile(xmlFilename);
TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" );
if (NULL == root )
{
if (NULL == root ) {
EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\"");
return;
}
else
{
} else {
TiXmlNode * pNode = root->FirstChild();
while(NULL != pNode)
{
while(NULL != pNode) {
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pNode->Value(), "gui")) {
TiXmlNode * pGuiNode = pNode->FirstChild();
while(NULL != pGuiNode)
{
while(NULL != pGuiNode) {
if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pGuiNode->Value(), "color")) {
@@ -116,13 +150,19 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
}
const char *color = pGuiNode->ToElement()->Attribute("val");
if (NULL != color) {
unsigned int r=0;
unsigned int v=0;
unsigned int b=0;
sscanf(color, "#%02x%02x%02x", &r,&v,&b);
int r=0;
int v=0;
int b=0;
int a=-1;
sscanf(color, "#%02x%02x%02x%02x", &r, &v, &b, &a);
basicColors[id].red = (float)r/255.0;
basicColors[id].green = (float)v/255.0;
basicColors[id].blue = (float)b/255.0;
if (-1 == a) {
basicColors[id].alpha = 1;
} else {
basicColors[id].alpha = (float)a/255.0;
}
/*
EDN_INFO(" Specify color for system ID="<< id );
EDN_INFO(" " << color << " ==> r="<< r <<" v="<< v <<" b="<< b );
@@ -181,7 +221,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
myNewColor->SetItalic(true);
}
}
listMyColor.push_back(myNewColor);
listMyColor.PushBack(myNewColor);
} else {
EDN_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
}
@@ -194,13 +234,15 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
pNode = pNode->NextSibling();
}
}
SendMessage(EDN_MSG__COLOR_HAS_CHANGE);
SendMessage(EDN_MSG__USER_DISPLAY_CHANGE);
}
Colorize *ColorizeManager::Get(const char *colorName)
{
uint32_t i;
for (i=0; i<listMyColor.size(); i++) {
Edn::String elementName = listMyColor[i]->GetName();
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return listMyColor[i];
}
@@ -210,7 +252,7 @@ Colorize *ColorizeManager::Get(const char *colorName)
return errorColor;
}
Colorize *ColorizeManager::Get(Edn::String &colorName)
Colorize *ColorizeManager::Get(etk::String &colorName)
{
return Get(colorName.c_str());
}
@@ -227,26 +269,26 @@ color_ts & ColorizeManager::Get(basicColor_te myColor)
bool ColorizeManager::Exist(const char *colorName)
{
uint32_t i;
for (i=0; i<listMyColor.size(); i++) {
Edn::String elementName = listMyColor[i]->GetName();
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::String elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return true;
}
}
return false;
}
bool ColorizeManager::Exist(Edn::String &colorName)
bool ColorizeManager::Exist(etk::String &colorName)
{
return Exist(colorName.c_str());
}
void ColorizeManager::DisplayListOfColor(void)
{
uint32_t i;
int32_t i;
EDN_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.size(); i++) {
//Edn::String elementName = listMyColor[i]->GetName();
for (i=0; i<listMyColor.Size(); i++) {
//etk::String elementName = listMyColor[i]->GetName();
//EDN_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);
}

View File

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

View File

@@ -23,13 +23,13 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "Display.h"
#include "BufferView.h"
#include "BufferManager.h"
#include "ColorizeManager.h"
#include "MainWindows.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <Display.h>
#include <BufferView.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <MainWindows.h>
#undef __class__
#define __class__ "BufferView"
@@ -39,9 +39,9 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
m_shawableAreaX = 0;
m_shawableAreaY = 0;
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
//m_bufferManager = BufferManager::Get();
//m_colorManager = ColorizeManager::Get();
#if 0
m_widget = gtk_drawing_area_new();
gtk_widget_set_size_request( m_widget, 250, 100);
@@ -74,6 +74,7 @@ BufferView::BufferView(void) : MsgBroadcast("Buffer View", EDN_CAT_GUI)
# elif defined( USE_GTK_VERSION_2_0 )
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
# endif
#endif
m_selectedID = -1;
}
@@ -82,11 +83,12 @@ BufferView::~BufferView(void)
{
}
/*
GtkWidget * BufferView::GetMainWidget(void)
{
return m_widget;
}
*/
void BufferView::OnMessage(int32_t id, int32_t dataID)
{
@@ -98,11 +100,15 @@ void BufferView::OnMessage(int32_t id, int32_t dataID)
case EDN_MSG__BUFFER_CHANGE_NAME:
case EDN_MSG__BUFFER_CHANGE_MODIFY:
// change Title :
gtk_widget_queue_draw(m_widget);
//gtk_widget_queue_draw(m_widget);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ...
//gtk_widget_queue_draw(m_widget);
break;
}
}
#if 0
gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
@@ -138,6 +144,9 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
EDN_INFO("Request a display of : " << self->m_shawableAreaX << "px * "<< self->m_shawableAreaY<<"px");
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
// clean buffer
monDrawer.Clean(self->m_colorManager->Get(COLOR_LIST_BG_1));
// get the number of buffer open
int32_t nbBufferOpen = self->m_bufferManager->Size();
int32_t i;
@@ -146,17 +155,17 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
basicColor_te selectBG = COLOR_LIST_BG_1;
for (i=0; i < nbBufferOpen; i++) {
Edn::String name;
Edn::File name;
bool isModify;
if (self->m_bufferManager->Exist(i)) {
isModify = self->m_bufferManager->Get(i)->IsModify();
name = self->m_bufferManager->Get(i)->GetShortName();
name = self->m_bufferManager->Get(i)->GetFileName();
char *tmpModify = (char*)" ";
if (true == isModify) {
tmpModify = (char*)"M";
}
char name2[1024] = "";
sprintf(name2, "[%2d](%s) %s", i, tmpModify, name.c_str() );
sprintf(name2, "[%2d](%s) %s", i, tmpModify, name.GetShortFilename().c_str() );
if (true == isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY;
@@ -187,7 +196,7 @@ gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, g
// sur : émis lors du premier affichage de la GtkDrawingArea
// sur : émis lors du premier affichage de la GtkDrawingArea
gboolean BufferView::CB_displayInit( GtkWidget *widget, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
@@ -249,46 +258,104 @@ gint BufferView::CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpoint
}
void BufferView::OnPopupEventShow(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventClose(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_CLOSE, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventSave(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__BUFF_ID_SAVE, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
self->SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, self->m_contectMenuSelectID);
self->m_contectMenuSelectID = -1;
}
void BufferView::ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID)
{
// Save the slected buffer
m_contectMenuSelectID = BufferID;
if (m_bufferManager->Exist(m_contectMenuSelectID)) {
GtkWidget *menu, *menuitem;
menu = gtk_menu_new();
menuitem = gtk_menu_item_new_with_label("Show");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventShow), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
if (true == m_bufferManager->Get(m_contectMenuSelectID)->HaveName()) {
if (true == m_bufferManager->Get(m_contectMenuSelectID)->IsModify()) {
menuitem = gtk_menu_item_new_with_label("Save");
} else {
menuitem = gtk_menu_item_new_with_label("Force Save");
}
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventSave), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
menuitem = gtk_menu_item_new_with_label("Save As ...");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventSaveAs), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_label("Close");
g_signal_connect( G_OBJECT(menuitem), "activate", G_CALLBACK(OnPopupEventClose), this);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
gtk_widget_show_all(menu);
// Note: event can be NULL here when called from view_onPopupMenu;
// gdk_event_get_time() accepts a NULL argument
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
(event != NULL) ? event->button : 0,
gdk_event_get_time((GdkEvent*)event));
} else {
EDN_ERROR("Buffer does not Exist !!! " << m_contectMenuSelectID);
}
}
gint BufferView::CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
BufferView * self = reinterpret_cast<BufferView*>(data);
// get focus on the widget
gtk_widget_grab_focus(widget);
if (event->button == 1) {
/*
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> One Clicked");
}else*/ if (event->type == GDK_2BUTTON_PRESS) {
}else if (event->type == GDK_2BUTTON_PRESS) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
//EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf);
if ( 0 <= selectBuf) {
self->SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, selectBuf);
/*
MainWindows *window = MainWindows::getInstance();
EDN_INFO(" Event on Buffer " << selectBuf);
// set the new seected Buffer
window->SetSelected(selectBuf);
*/
}
}/* else if (event->type == GDK_3BUTTON_PRESS) {
EDN_INFO("mouse-event BT1 ==> Triple Clicked");
}else if (event->type == GDK_BUTTON_RELEASE) {
EDN_INFO("mouse-event BT1 ==> Realease");
}*/
}/* else if (event->button == 2) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT2 PRESS");
}
} else if (event->button == 3) {
if (event->type == GDK_BUTTON_PRESS) {
EDN_INFO("mouse-event BT3 PRESS");
uint32_t fontHeight = Display::GetFontHeight();
int32_t selectBuf = self->m_bufferManager->WitchBuffer((event->y / fontHeight) + 1);
if ( 0 <= selectBuf) {
self->ViewPopupMenu(widget, event, selectBuf);
}
}
} else {
//EDN_INFO("mouse-event BT? PRESS");
}*/
// not usefull to redraw
return true;
}
gtk_widget_queue_draw( widget );
return true;
}
@@ -316,5 +383,5 @@ gint BufferView::CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event,
*/
return true;
}
#endif

View File

@@ -25,14 +25,12 @@
#ifndef __BUFFER_VIEW_H__
#define __BUFFER_VIEW_H__
#include "tools_debug.h"
#include <vector>
#include <string>
#include "Singleton.h"
#include "CodeView.h"
#include "BufferManager.h"
#include "Display.h"
#include "MsgBroadcast.h"
#include <tools_debug.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <Display.h>
#include <MsgBroadcast.h>
class BufferView : public MsgBroadcast
@@ -41,8 +39,9 @@ class BufferView : public MsgBroadcast
// Constructeur
BufferView(void);
~BufferView(void);
GtkWidget *GetMainWidget(void);
//GtkWidget *GetMainWidget(void);
void OnMessage(int32_t id, int32_t dataID);
/*
// sur : GTK+ callback :
static gboolean CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data);
static gboolean CB_displayInit( GtkWidget *widget, gpointer data);
@@ -53,17 +52,23 @@ class BufferView : public MsgBroadcast
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
static void CB_EventOnBufferManager(gpointer data);
static void OnPopupEventShow(GtkWidget *menuitem, gpointer data);
static void OnPopupEventClose(GtkWidget *menuitem, gpointer data);
static void OnPopupEventSave(GtkWidget *menuitem, gpointer data);
static void OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data);
*/
private:
//void ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID);
// main windows widget :
GtkWidget * m_widget;
//GtkWidget * m_widget;
// récupération des proprieter général...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_selectedID;
int32_t m_contectMenuSelectID;
};

View File

@@ -0,0 +1,348 @@
/**
*******************************************************************************
* @file CodeView.cpp
* @brief Editeur De N'ours : Code Viewer Widget
* This is an abstraction
* @author Edouard DUPIN
* @date 05/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <CodeView.h>
#include <tools_debug.h>
#include <tools_globals.h>
#include <Display.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <ColorizeManager.h>
#include <ClipBoard.h>
#include <SearchData.h>
#include <ewol/WidgetManager.h>
#undef __class__
#define __class__ "ewol::Button"
CodeView::CodeView(void) : MsgBroadcast("Code View", EDN_CAT_WORK_AREA)
{
m_label = "CodeView is disable ...";
m_bufferID = -1;
m_buttunOneSelected = false;
// Init link with the buffer Manager
m_bufferManager = BufferManager::getInstance();
m_colorManager = ColorizeManager::getInstance();
m_textColorFg.red = 0.0;
m_textColorFg.green = 0.0;
m_textColorFg.blue = 0.0;
m_textColorFg.alpha = 1.0;
m_textColorBg.red = 0.0;
m_textColorBg.green = 0.0;
m_textColorBg.blue = 0.0;
m_textColorBg.alpha = 0.25;
SetCanHaveFocus(true);
}
CodeView::~CodeView(void)
{
}
bool CodeView::CalculateMinSize(void)
{
m_minSize.x = 50;
m_minSize.y = 50;
return true;
}
void CodeView::OnRegenerateDisplay(void)
{
// create tmp object :
ewol::OObject2DTextColored* myOObjectText = new ewol::OObject2DTextColored("", -1);
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
// generate the objects :
//m_bufferID = 0;
m_bufferManager->Get(m_bufferID)->Display(myOObjectText, myOObjectsColored, m_size.x, m_size.y);
// clean the object list ...
ClearOObjectList();
// add generated element
AddOObject(myOObjectsColored, "CodeViewBackground");
AddOObject(myOObjectText, "CodeViewText");
}
bool CodeView::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)
{
/*
//bool eventIsOK = false;
//EWOL_DEBUG("Receive event : \"" << generateEventId << "\"");
if(ewolEventButtonPressed == generateEventId) {
EWOL_INFO("BT pressed ... " << m_label);
//eventIsOK = true;
ewol::widgetManager::FocusKeep(this);
} else if(ewolEventButtonEnter == generateEventId) {
OnRegenerateDisplay();
}
//return eventIsOK;
*/
// in every case this not stop the propagation of the event
return false;
// if overwrited... you can ...
}
bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
{
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
m_bufferManager->Get(m_bufferID)->AddChar(UTF8_data);
OnRegenerateDisplay();
}
return true;
}
bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent)
{
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
m_bufferManager->Get(m_bufferID)->cursorMove(moveTypeEvent);
OnRegenerateDisplay();
}
return true;
}
bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
{
x -= m_origin.x;
y -= m_origin.y;
/*
etk::String type = (int)typeEvent;
switch (typeEvent)
{
case ewol::EVENT_INPUT_TYPE_DOWN:
type = "EVENT_INPUT_TYPE_DOWN";
break;
case ewol::EVENT_INPUT_TYPE_MOVE:
type = "EVENT_INPUT_TYPE_MOVE";
break;
case ewol::EVENT_INPUT_TYPE_SINGLE:
type = "EVENT_INPUT_TYPE_SINGLE";
break;
case ewol::EVENT_INPUT_TYPE_DOUBLE:
type = "EVENT_INPUT_TYPE_DOUBLE";
break;
case ewol::EVENT_INPUT_TYPE_TRIPLE:
type = "EVENT_INPUT_TYPE_TRIPLE";
break;
case ewol::EVENT_INPUT_TYPE_UP:
type = "EVENT_INPUT_TYPE_UP";
break;
case ewol::EVENT_INPUT_TYPE_ENTER:
type = "EVENT_INPUT_TYPE_ENTER";
break;
case ewol::EVENT_INPUT_TYPE_LEAVE:
type = "EVENT_INPUT_TYPE_LEAVE";
break;
default:
break;
};
EDN_DEBUG("Event : " << IdInput << " type : " << type << " position(" << x << "," << y << ")");
*/
if (1 == IdInput) {
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
m_buttunOneSelected = true;
ewol::widgetManager::FocusKeep(this);
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
m_buttunOneSelected = false;
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
OnRegenerateDisplay();
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
OnRegenerateDisplay();
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
OnRegenerateDisplay();
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
//EDN_INFO("mouse-event BT1 ==> Triple Clicked");
m_bufferManager->Get(m_bufferID)->MouseEventTriple();
OnRegenerateDisplay();
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
if (true == m_buttunOneSelected) {
int xxx, yyy;
xxx = x;
yyy = y;
if (xxx<0) {
xxx = 0;
}
if (yyy<0) {
yyy = 0;
}
//EDN_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
m_bufferManager->Get(m_bufferID)->MouseSelectFromCursorTo(xxx, yyy);
OnRegenerateDisplay();
}
}
} else if (2 == IdInput) {
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
m_bufferManager->Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
OnRegenerateDisplay();
ewol::widgetManager::FocusKeep(this);
}
}
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent)
{
//EDN_INFO("mouse-event GDK_SCROLL_UP");
m_bufferManager->Get(m_bufferID)->ScrollUp();
OnRegenerateDisplay();
ewol::widgetManager::FocusKeep(this);
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent)
{
//EDN_INFO("mouse-event GDK_SCROLL_DOWN");
m_bufferManager->Get(m_bufferID)->ScrollDown();
OnRegenerateDisplay();
ewol::widgetManager::FocusKeep(this);
}
return true;
}
void CodeView::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__CURRENT_CHANGE_BUFFER_ID:
EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
// request the display of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE:
SendMessage(EDN_MSG__BUFF_ID_SAVE, m_bufferID);
break;
case EDN_MSG__CURRENT_SAVE_AS:
SendMessage(EDN_MSG__GUI_SHOW_SAVE_AS, m_bufferID);
break;
case EDN_MSG__CURRENT_REMOVE_LINE:
m_bufferManager->Get(m_bufferID)->RemoveLine();
break;
case EDN_MSG__CURRENT_SELECT_ALL:
m_bufferManager->Get(m_bufferID)->SelectAll();
break;
case EDN_MSG__CURRENT_UN_SELECT:
m_bufferManager->Get(m_bufferID)->SelectNone();
break;
case EDN_MSG__CURRENT_COPY:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Copy(dataID);
break;
case EDN_MSG__CURRENT_CUT:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Cut(dataID);
break;
case EDN_MSG__CURRENT_PASTE:
if (dataID == -1) {
dataID = COPY_STD;
}
m_bufferManager->Get(m_bufferID)->Paste(dataID);
break;
case EDN_MSG__CURRENT_FIND_PREVIOUS:
{
etk::String myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_FIND_NEXT:
{
etk::String myDataString;
SearchData::GetSearch(myDataString);
m_bufferManager->Get(m_bufferID)->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
break;
case EDN_MSG__CURRENT_REPLACE:
{
etk::String myDataString;
SearchData::GetReplace(myDataString);
m_bufferManager->Get(m_bufferID)->Replace(myDataString);
}
break;
case EDN_MSG__CURRENT_REPLACE_ALL:
break;
case EDN_MSG__CURRENT_CLOSE:
SendMessage(EDN_MSG__BUFF_ID_CLOSE, m_bufferID);
break;
case EDN_MSG__CURRENT_UNDO:
m_bufferManager->Get(m_bufferID)->Undo();
break;
case EDN_MSG__CURRENT_REDO:
m_bufferManager->Get(m_bufferID)->Redo();
break;
case EDN_MSG__CURRENT_GOTO_LINE:
if (dataID<0) {
dataID = 0;
}
m_bufferManager->Get(m_bufferID)->JumpAtLine(dataID);
break;
case EDN_MSG__REFRESH_DISPLAY:
break;
case EDN_MSG__CURRENT_SET_CHARSET:
m_bufferManager->Get(m_bufferID)->SetCharset((charset_te)dataID);
break;
case EDN_MSG__USER_DISPLAY_CHANGE:
// Redraw all the display ... Done under ...
break;
}
// Force redraw of the widget
OnRegenerateDisplay();
}
void CodeView::OnGetFocus(void)
{
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
EDN_INFO("Focus - In");
}
void CodeView::OnLostFocus(void)
{
EDN_INFO("Focus - out");
}

View File

@@ -26,13 +26,44 @@
#ifndef __CODE_VIEW_H__
#define __CODE_VIEW_H__
#include "tools_debug.h"
#include "Singleton.h"
#include "CodeView.h"
#include "BufferManager.h"
#include "Display.h"
#include "MsgBroadcast.h"
#include <tools_debug.h>
#include <CodeView.h>
#include <BufferManager.h>
#include <Display.h>
#include <MsgBroadcast.h>
#include <etk/Types.h>
#include <ewol/Widget.h>
class CodeView :public ewol::Widget, public MsgBroadcast
{
public:
CodeView(void);
virtual ~CodeView(void);
void OnMessage(int32_t id, int32_t dataID);
virtual bool CalculateMinSize(void);
private:
etk::String m_label;
color_ts m_textColorFg; //!< Text color
color_ts m_textColorBg; //!< Background color
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
int32_t m_bufferID;
bool m_buttunOneSelected;
public:
virtual void OnRegenerateDisplay(void);
public:
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y);
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
};
#if 0
class CodeView : public MsgBroadcast
{
public:
@@ -40,6 +71,7 @@ class CodeView : public MsgBroadcast
CodeView(void);
~CodeView(void);
void OnMessage(int32_t id, int32_t dataID);
/*
GtkWidget *GetMainWidget(void);
// sur : GTK+ callback :
static gboolean CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data);
@@ -50,18 +82,22 @@ class CodeView : public MsgBroadcast
static gint CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data);
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
static gint CB_mouseScrollEvent( GtkWidget *widget, GdkEventScroll *event, gpointer data);
*/
private:
// main windows widget :
GtkWidget * m_widget;
//GtkWidget * m_widget;
// récupération des proprieter général...
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_bufferID;
bool m_buttunOneSelected;
BufferManager * m_bufferManager;
ColorizeManager * m_colorManager;
int32_t m_shawableAreaX;
int32_t m_shawableAreaY;
int32_t m_bufferID;
bool m_buttunOneSelected;
};
#endif
#endif

View File

@@ -0,0 +1,279 @@
/**
*******************************************************************************
* @file MainWindows.cpp
* @brief Editeur De N'ours : main Windows diplayer (Sources)
* @author Edouard DUPIN
* @date 04/01/2011
* @par Project
* Edn
*
* @par Copyright
* Copyright 2010 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
* You can not earn money with this Software (if the source extract from Edn
* represent less than 50% of original Sources)
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <tools_debug.h>
#include <tools_globals.h>
#include <MainWindows.h>
#include <CodeView.h>
#include <ClipBoard.h>
#include <BufferView.h>
#include <AccelKey.h>
#include <ewol/widget/Button.h>
#include <ewol/widget/CheckBox.h>
#include <ewol/widget/SizerHori.h>
#include <ewol/widget/SizerVert.h>
#include <ewol/widget/Test.h>
#include <ewol/widget/Label.h>
#include <ewol/widget/Entry.h>
#include <ewol/widget/List.h>
#include <ewol/widget/PopUp.h>
#include <ewol/widget/Spacer.h>
#include <ewol/widgetMeta/FileChooser.h>
#include <ewol/WidgetManager.h>
#undef __class__
#define __class__ "MainWindows"
MainWindows::MainWindows(void)
{
EDN_DEBUG("CREATE WINDOWS ... ");
ewol::SizerVert * mySizerVert = NULL;
ewol::SizerHori * mySizerHori = NULL;
ewol::Button * myButton = NULL;
ewol::Label * myLabel = NULL;
CodeView * myCodeView = NULL;
mySizerVert = new ewol::SizerVert();
SetSubWidget(mySizerVert);
mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori);
myButton = new ewol::Button("Open");
mySizerHori->SubWidgetAdd(myButton);
myButton = new ewol::Button("Close");
mySizerHori->SubWidgetAdd(myButton);
myButton = new ewol::Button("Save");
mySizerHori->SubWidgetAdd(myButton);
myButton = new ewol::Button("Save As ...");
mySizerHori->SubWidgetAdd(myButton);
myLabel = new ewol::Label("FileName");
myLabel->SetExpendX(true);
myLabel->SetFillY(true);
mySizerHori->SubWidgetAdd(myLabel);
mySizerHori = new ewol::SizerHori();
mySizerVert->SubWidgetAdd(mySizerHori);
myCodeView = new CodeView();
myCodeView->SetExpendX(true);
myCodeView->SetExpendY(true);
myCodeView->SetFillX(true);
myCodeView->SetFillY(true);
mySizerHori->SubWidgetAdd(myCodeView);
}
MainWindows::~MainWindows(void)
{
}
#ifdef SDFGSDFGSDF___SDFGSDFG
MainWindows::MainWindows(void) : MsgBroadcast("Main Windows", EDN_CAT_GUI)
{
m_mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// select the program icone
GError *err = NULL;
etk::String iconeFile;
iconeFile = "/usr/share/edn/images/icone.png";
GdkPixbuf * icone = gdk_pixbuf_new_from_file(iconeFile.c_str(), &err);
if (err != NULL) {
gtk_window_set_default_icon_name("text-editor");
} else {
gtk_window_set_icon(GTK_WINDOW(m_mainWindow), icone);
}
// enable the close signal of the windows
g_signal_connect(G_OBJECT(m_mainWindow), "delete-event", G_CALLBACK(OnQuit), this);
g_signal_connect(G_OBJECT(m_mainWindow), "window-state-event", G_CALLBACK(OnStateChange), this);
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER(m_mainWindow), vbox);
// Set key Accelerator :
AccelKey::getInstance()->LinkCommonAccel(GTK_WINDOW(m_mainWindow));
// Create the menu bar.
GtkWidget *hboxMenu = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start( GTK_BOX (vbox), hboxMenu, FALSE, FALSE, 0);
// Add Exit boutton
etk::String ExitIconeFile;
ExitIconeFile = "/usr/share/edn/images/delete-24px.png";
// TODO : find a good way to change the size of an image
GtkWidget *myImageQuit = gtk_image_new_from_file(ExitIconeFile.c_str());
GtkIconSize mySize = GTK_ICON_SIZE_SMALL_TOOLBAR;
//EDN_DEBUG(" plop : " << mySize);
//gtk_image_get_icon_set( GTK_IMAGE(myImageQuit), NULL, &mySize);
//EDN_DEBUG(" plop : " << mySize);
GtkWidget *event_box = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(event_box),myImageQuit);
gtk_widget_add_events(event_box,GDK_BUTTON_PRESS_MASK);
g_signal_connect(G_OBJECT(event_box), "button_press_event", G_CALLBACK(OnQuit), this);
gtk_box_pack_start( GTK_BOX(hboxMenu), event_box, FALSE, FALSE, 0);
// add the real menu bar
gtk_box_pack_start( GTK_BOX (hboxMenu), m_MenuBar.GetWidget(), FALSE, FALSE, 0);
// Add title
m_internalTitleLabel = gtk_label_new("Edn");
gtk_box_pack_start( GTK_BOX (hboxMenu), m_internalTitleLabel, FALSE, FALSE, 0);
// **********************************************************
// * Horizontal ELEMENTS : *
// **********************************************************
// Create a vertical box for stacking the menu and editor widgets in.
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER (vbox), hbox);
// create the toolbar :
// TreeView :
gtk_box_pack_start(GTK_BOX(hbox), m_BufferView.GetMainWidget(), FALSE, TRUE, 1);
// Text displayer :
gtk_box_pack_start( GTK_BOX (hbox), m_CodeView.GetMainWidget(), TRUE, TRUE, 0);
// Create the status bar
//gtk_box_pack_end(GTK_BOX(vbox), m_StatusBar.GetWidget(), FALSE, FALSE, 0);
// recursive version of gtk_widget_show
gtk_widget_show_all(m_mainWindow);
MainWindows::~MainWindows(void)
{
/*
if (NULL != m_DlgSearch) {
delete m_DlgSearch;
}
*/
}
void MainWindows::SetTitle(etk::File &fileName, bool isModify)
{
etk::String tmp = "";
if (fileName.GetShortFilename() != "") {
tmp += fileName.GetShortFilename();
tmp += " - ";
tmp += fileName.GetFolder();
tmp += " - ";
}
tmp += "Edn";
//gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
tmp = " ";
if (fileName.GetShortFilename() != "") {
tmp += fileName.GetFolder();
tmp += "/";
tmp += fileName.GetShortFilename();
} else {
tmp += "Edn";
}
tmp += " ";
//gtk_label_set_text(GTK_LABEL(m_internalTitleLabel), tmp.c_str());
}
void MainWindows::SetNoTitle(void)
{
etk::String tmp = "Edn";
//gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
//gtk_label_set_text(GTK_LABEL(m_internalTitleLabel), tmp.c_str());
}
void MainWindows::OnMessage(int32_t id, int32_t dataID)
{
switch (id)
{
case EDN_MSG__BUFFER_CHANGE_CURRENT:
// change Title :
// TODO : String error when remove the error with -1;
if (-1 == dataID) {
SetNoTitle();
} else {
/*
Buffer *mybuf = BufferManager::getInstance()->Get(dataID);
if (NULL != mybuf) {
etk::File plop = mybuf->GetFileName();
SetTitle(plop, mybuf->IsModify() );
}
*/
}
break;
}
}
bool MainWindows::OnQuit(GtkWidget *widget, gpointer data)
{
//MainWindows * self = reinterpret_cast<MainWindows*>(data);
GeneralSendMessage(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION);
// Close is not managed here ...
return true;
}
gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data)
{
MainWindows * self = reinterpret_cast<MainWindows*>(data);
EDN_DEBUG("State change");
EDN_INFO(" change state mask : " << event->window_state.changed_mask);
EDN_INFO(" change state new val : " << event->window_state.new_window_state);
if (event->window_state.changed_mask == GDK_WINDOW_STATE_MAXIMIZED) {
EDN_INFO(" ==> Maximisation change...");
if (event->window_state.new_window_state == GDK_WINDOW_STATE_MAXIMIZED) {
EDN_INFO(" ==> ENABLE");
gtk_window_set_decorated(GTK_WINDOW(self->m_mainWindow), FALSE);
} else {
EDN_INFO(" ==> DISABLE");
gtk_window_set_decorated(GTK_WINDOW(self->m_mainWindow), TRUE);
}
}
}
#endif

View File

@@ -24,45 +24,57 @@
*/
#include "tools_debug.h"
#include "Singleton.h"
#include "MsgBroadcast.h"
#include <tools_debug.h>
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include "CodeView.h"
#include "BufferView.h"
#include "BufferManager.h"
#include "MenuBar.h"
#include "StatusBar.h"
#include "ToolBar.h"
#include <CodeView.h>
#include <BufferView.h>
#include <BufferManager.h>
#include <MenuBar.h>
#include <StatusBar.h>
#include <ToolBar.h>
#ifndef __MAIN_WINDOWS_H__
#define __MAIN_WINDOWS_H__
class MainWindows: public Singleton<MainWindows>, public MsgBroadcast
#if 0
class MainWindows: public etk::Singleton<MainWindows>, public MsgBroadcast
{
friend class Singleton<MainWindows>;
friend class etk::Singleton<MainWindows>;
// specific for sigleton system...
private:
// Constructeur
MainWindows(void);
~MainWindows(void);
public:
GtkWidget * GetWidget(void) { return m_mainWindow;};
//GtkWidget * GetWidget(void) { return m_mainWindow;};
void OnMessage(int32_t id, int32_t dataID);
static bool OnQuit(GtkWidget *widget, gpointer data);
//static bool OnQuit(GtkWidget *widget, gpointer data);
//static gboolean OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer data);
private:
void SetTitle(Edn::String &fileName, bool isModify);
void SetTitle(etk::File &fileName, bool isModify);
void SetNoTitle(void);
// main windows widget :
/*
GtkWidget * m_mainWindow;
GtkWidget * m_internalTitleLabel;
BufferView m_BufferView;
CodeView m_CodeView;
MenuBar m_MenuBar;
StatusBar m_StatusBar;
ToolBar m_ToolBar;
*/
};
#endif
class MainWindows : public ewol::Windows
{
public:
// Constructeur
MainWindows(void);
~MainWindows(void);
};
#endif

View File

@@ -24,11 +24,12 @@
*/
#include "tools_debug.h"
#include "MenuBar.h"
#include "ClipBoard.h"
#include "charset.h"
#include <tools_debug.h>
#include <MenuBar.h>
#include <ClipBoard.h>
#include <charset.h>
#include <ColorizeManager.h>
#if 0
#define MENU_MSG
const char * MSG_TogleDisplayChar = "Request a Togle of char displaying";
const char * MSG_TogleDisplayEOL = "Request a Togle of displaying EndOfLine";
@@ -36,7 +37,9 @@ const char * MSG_TogleAutoIndent = "Request a Togle of Auto Indent";
const char * MSG_SetCharsetIso559_1 = "Set ISO 5589-1";
const char * MSG_SetCharsetIso559_15 = "Set ISO 5589-15";
const char * MSG_SetCharsetUTF8 = "Set UTF 8";
#define MSG_LINK(data)
const char * MSG_LoadColorBlack = "Load Color Black";
const char * MSG_LoadColorWhite = "Load Color White";
#define MSG_LINK(data)
static void CB_menuGenerique(GtkMenuItem *menu_item, gpointer data)
@@ -74,6 +77,26 @@ static void CB_menuInternal(GtkMenuItem *menu_item, gpointer data)
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_ISO_8859_15);
} else if (myPointer == MSG_SetCharsetUTF8) {
GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_UTF8);
} else if (myPointer == MSG_LoadColorWhite) {
ColorizeManager * myColorSystem = ColorizeManager::getInstance();
etk::String homedir;
# ifdef NDEBUG
homedir = "/usr/share/edn/";
# else
homedir = "./data/";
# endif
homedir += "color_white.xml";
myColorSystem->LoadFile(homedir);
} else if (myPointer == MSG_LoadColorBlack) {
ColorizeManager * myColorSystem = ColorizeManager::getInstance();
etk::String homedir;
# ifdef NDEBUG
homedir = "/usr/share/edn/";
# else
homedir = "./data/";
# endif
homedir += "color_black.xml";
myColorSystem->LoadFile(homedir);
}
}
@@ -164,6 +187,11 @@ class MenuBarMain
m_message.PushBack(message);
// create ITEM
GtkWidget *tmpWidget = gtk_image_menu_item_new_from_stock( title, AccelKey::getInstance()->GetAccel() );
GdkColor color;
gdk_color_parse ("red", &color);
gtk_widget_modify_fg(tmpWidget, GTK_STATE_NORMAL, &color);
gtk_widget_modify_bg(tmpWidget, GTK_STATE_NORMAL, &color);
gtk_widget_modify_text(tmpWidget, GTK_STATE_NORMAL, &color);
// set grisage :
gtk_widget_set_sensitive(tmpWidget, enable);
// add to the menu :
@@ -189,7 +217,7 @@ class MenuBarMain
GtkWidget * m_parent;
GtkWidget * m_menu;
GtkWidget * m_menuListe;
EdnVectorBin<messageData_ts*> m_message;
etk::VectorType<messageData_ts*> m_message;
};
#undef __class__
@@ -204,12 +232,12 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
tmp->AddGen(GTK_STOCK_NEW, "ctrl+n", EDN_MSG__NEW, true);
tmp->AddGen(GTK_STOCK_OPEN, "ctrl+o", EDN_MSG__GUI_SHOW_OPEN_FILE, true);
tmp->AddSeparator();
tmp->AddGen("Close file", NULL, EDN_MSG__CURRENT_CLOSE, true);
tmp->AddGen("Close file", "ctrl+q", EDN_MSG__CURRENT_CLOSE, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_SAVE, "ctrl+s", EDN_MSG__CURRENT_SAVE, true);
tmp->AddGen(GTK_STOCK_SAVE_AS, "ctrl+shift+s", EDN_MSG__CURRENT_SAVE_AS, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_QUIT, "ctrl+q", EDN_MSG__QUIT, true);
tmp->AddGen(GTK_STOCK_QUIT, "ctrl+shift+q", EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("_Edit", m_mainWidget);
@@ -220,23 +248,16 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
tmp->AddGen(GTK_STOCK_COPY, "ctrl+c", EDN_MSG__CURRENT_COPY, true, COPY_STD);
tmp->AddGen(GTK_STOCK_PASTE, "ctrl+v", EDN_MSG__CURRENT_PASTE, true, COPY_STD);
// tmp->AddGen(GTK_STOCK_DELETE, NULL);
tmp->AddGen("Remove line", "ctrl+d", EDN_MSG__CURRENT_REMOVE_LINE, true);
tmp->AddGen("Remove line", "ctrl+w", EDN_MSG__CURRENT_REMOVE_LINE, true);
tmp->AddSeparator();
tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true);
tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true);
tmp->AddSeparator();
tmp->AddGen("Goto Line number ...", "ctrl+l", EDN_MSG__GUI_SHOW_GOTO_LINE, true);
// tmp->AddSeparator();
// tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("Display", m_mainWidget);
tmp->AddInternal("Show space & tabs", NULL, MSG_TogleDisplayChar, true);
tmp->AddInternal("Show end of lines", NULL, MSG_TogleDisplayEOL, true);
tmp->AddInternal("Audo Indent", NULL, MSG_TogleAutoIndent, true);
tmp->AddInternal("Set charset Occidental (ISO-8859-1)", NULL, MSG_SetCharsetIso559_1, true);
tmp->AddInternal("Set charset Occidental (ISO-8859-15)", NULL, MSG_SetCharsetIso559_15, true);
tmp->AddInternal("Set charset Internationnal (UTF 8)", NULL, MSG_SetCharsetUTF8, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("_Search", m_mainWidget);
tmp->AddGen(GTK_STOCK_FIND, "ctrl+f", EDN_MSG__GUI_SHOW_SEARCH, true);
tmp->AddGen(GTK_STOCK_FIND_AND_REPLACE, "ctrl+r", EDN_MSG__GUI_SHOW_REPLACE, true);
@@ -250,6 +271,21 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
// tmp->AddSeparator();
// tmp->AddGen("Goto Line", "ctrl+l", EDN_MSG__CURRENT_GOTO_LINE, true);
m_listMenu.PushBack(tmp);
tmp = new MenuBarMain("Display", m_mainWidget);
tmp->AddInternal("Show space & tabs", NULL, MSG_TogleDisplayChar, true);
tmp->AddInternal("Show end of lines", NULL, MSG_TogleDisplayEOL, true);
tmp->AddInternal("Audo Indent", NULL, MSG_TogleAutoIndent, true);
tmp->AddSeparator();
tmp->AddInternal("Set charset Occidental (ISO-8859-1)", NULL, MSG_SetCharsetIso559_1, true);
tmp->AddInternal("Set charset Occidental (ISO-8859-15)", NULL, MSG_SetCharsetIso559_15, true);
tmp->AddInternal("Set charset Internationnal (UTF 8)", NULL, MSG_SetCharsetUTF8, true);
tmp->AddSeparator();
tmp->AddGen( "Reload Color File", NULL, EDN_MSG__RELOAD_COLOR_FILE, true);
tmp->AddSeparator();
tmp->AddInternal("Set Color Black", NULL, MSG_LoadColorBlack, true);
tmp->AddInternal("Set Color White", NULL, MSG_LoadColorWhite, true);
m_listMenu.PushBack(tmp);
/*
tmp = new MenuBarMain("Project", m_mainWidget);
m_listMenu.PushBack(tmp);
@@ -258,8 +294,8 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI)
tmp->AddGen("load Ctags file", NULL, EDN_MSG__OPEN_CTAGS, true);
tmp->AddGen("re-load Ctags file", NULL, EDN_MSG__RELOAD_CTAGS, true);
tmp->AddSeparator();
tmp->AddGen("Find Definition", "ctrl+u", EDN_MSG__JUMP_TO_CURRENT_SELECTION, true);
tmp->AddGen("Back previous", "ctrl+y", EDN_MSG__JUMP_BACK, true);
tmp->AddGen("Find Definition", "ctrl+d", EDN_MSG__JUMP_TO_CURRENT_SELECTION, true);
tmp->AddGen("Back previous", "ctrl+shift+d", EDN_MSG__JUMP_BACK, true);
/*
tmp->AddGen("Gestion Ctags", NULL);
tmp->AddGen("Add Ctags Folder", NULL);
@@ -347,4 +383,4 @@ void MenuBar::OnMessage(int32_t id, int32_t dataID)
//EDN_INFO("ReceiveMessage");
}
#endif

View File

@@ -23,30 +23,32 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "tools_globals.h"
#include "MsgBroadcast.h"
#include "EdnVectorBin.h"
#include "AccelKey.h"
#include <tools_debug.h>
#include <tools_globals.h>
#include <MsgBroadcast.h>
#include <etk/VectorType.h>
#include <AccelKey.h>
#ifndef __MENU_BAR_H__
#define __MENU_BAR_H__
class MenuBarMain;
//class MenuBarMain;
class MenuBar: public MsgBroadcast
{
public:
// Constructeur
MenuBar(void);
~MenuBar(void);
GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID);
MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI){};
~MenuBar(void) {};
//GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID) {};
private:
/*
GtkWidget * m_mainWidget;
GtkAccelGroup * m_accelGroup;
EdnVectorBin<MenuBarMain*> m_listMenu;
etk::VectorType<MenuBarMain*> m_listMenu;
*/
};

View File

@@ -23,13 +23,14 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "StatusBar.h"
#include <tools_debug.h>
#include <StatusBar.h>
StatusBar::StatusBar(void) : MsgBroadcast("Status bar", EDN_CAT_GUI)
{
/*
m_mainWidget = gtk_statusbar_new();
// pas très bien compris pourquoi mais ca marche...
m_iContextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(m_mainWidget), "ExitMsg");
@@ -37,6 +38,7 @@ StatusBar::StatusBar(void) : MsgBroadcast("Status bar", EDN_CAT_GUI)
gtk_statusbar_push(GTK_STATUSBAR (m_mainWidget), GPOINTER_TO_INT(m_iContextId), "Edn Editeur de n'ours");
// Supression du précédent message :
//gtk_statusbar_pop(GTK_STATUSBAR(m_mainWidget), GPOINTER_TO_INT(m_iContextId));
*/
}
StatusBar::~StatusBar(void)

View File

@@ -23,7 +23,7 @@
*******************************************************************************
*/
#include "MsgBroadcast.h"
#include <MsgBroadcast.h>
#ifndef __STATUS_BAR_H__
#define __STATUS_BAR_H__
@@ -34,12 +34,12 @@ class StatusBar: public MsgBroadcast
// Constructeur
StatusBar(void);
~StatusBar(void);
GtkWidget * GetWidget(void) { return m_mainWidget; };
//GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID);
private:
GtkWidget * m_mainWidget;
guint m_iContextId;
//GtkWidget * m_mainWidget;
//guint m_iContextId;
};

View File

@@ -23,10 +23,11 @@
*******************************************************************************
*/
#include "tools_debug.h"
#include "ToolBar.h"
#include "ClipBoard.h"
#include <tools_debug.h>
#include <ToolBar.h>
#include <ClipBoard.h>
/*
static void CB_menuGenerique(GtkMenuItem *menu_item, gpointer data)
{
//EDN_INFO("basic menue_event");
@@ -34,11 +35,11 @@ static void CB_menuGenerique(GtkMenuItem *menu_item, gpointer data)
// broacast message :
GeneralSendMessage(msg->msgId, msg->dataId);
}
*/
ToolBar::ToolBar(void) : MsgBroadcast("Tool bar", EDN_CAT_GUI)
{
/*
m_mainWidget = gtk_toolbar_new();
# ifdef USE_GTK_VERSION_2_0
gtk_toolbar_set_orientation(GTK_TOOLBAR(m_mainWidget), GTK_ORIENTATION_VERTICAL);
@@ -55,6 +56,7 @@ ToolBar::ToolBar(void) : MsgBroadcast("Tool bar", EDN_CAT_GUI)
Add(GTK_STOCK_SAVE_AS, "Enregistrer sous", EDN_MSG__CURRENT_SAVE_AS);
AddSeparator();
Add(GTK_STOCK_QUIT, "Quitter");
*/
}
ToolBar::~ToolBar(void)
@@ -66,7 +68,7 @@ void ToolBar::OnMessage(int32_t id, int32_t dataID)
{
//EDN_INFO("ReceiveMessage");
}
/*
void ToolBar::AddSeparator(void)
{
# ifdef USE_GTK_VERSION_3_0
@@ -87,7 +89,7 @@ void ToolBar::Add(const char * title, const char * labelHelp, messageType_te id,
gtk_toolbar_insert_stock(GTK_TOOLBAR(m_mainWidget), title, labelHelp, NULL, G_CALLBACK(CB_menuGenerique), message, -1);
# endif
}
*/

View File

@@ -23,7 +23,7 @@
*******************************************************************************
*/
#include "MsgBroadcast.h"
#include <MsgBroadcast.h>
#ifndef __TOOL_BAR_H__
#define __TOOL_BAR_H__
@@ -35,14 +35,14 @@ class ToolBar: public MsgBroadcast
// Constructeur
ToolBar(void);
~ToolBar(void);
GtkWidget * GetWidget(void) { return m_mainWidget; };
//GtkWidget * GetWidget(void) { return m_mainWidget; };
void OnMessage(int32_t id, int32_t dataID);
private:
void AddSeparator(void);
void Add(const char * title, const char * labelHelp, messageType_te id = EDN_MSG__NONE, bool enable = false);
GtkWidget * m_mainWidget;
EdnVectorBin<messageData_ts*> m_message;
//void AddSeparator(void);
//void Add(const char * title, const char * labelHelp, messageType_te id = EDN_MSG__NONE, bool enable = false);
//GtkWidget * m_mainWidget;
//etk::VectorType<messageData_ts*> m_message;
};

View File

@@ -36,33 +36,44 @@
Search::Search(void)
: m_localDialog(NULL),
/*: m_localDialog(NULL),
m_searchLabel(NULL),
m_searchEntry(NULL),
m_replaceLabel(NULL),
m_replaceEntry(NULL),
m_CkMatchCase(NULL),
m_CkWrapAround(NULL)
m_CkWrapAround(NULL) */
{
// nothing to do ...
}
Search::~Search(void)
{
/*
if (NULL!=m_localDialog) {
gtk_widget_hide(m_localDialog);
gtk_widget_destroy(m_localDialog);
m_localDialog = NULL;
}
*/
}
void Search::Display(void)
/*
void Search::Display(GtkWindow *parent)
{
if(NULL == m_localDialog) {
m_localDialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// set dialog not resisable
gtk_window_set_resizable(GTK_WINDOW(m_localDialog), FALSE);
gtk_window_set_keep_above(GTK_WINDOW(m_localDialog), TRUE);
// set the windows alwais on top of every all system windows
//gtk_window_set_keep_above(GTK_WINDOW(m_localDialog), TRUE);
// Set the dialog on top of the selected windows
gtk_window_set_transient_for(GTK_WINDOW(m_localDialog), parent);
// set the dialog on the top right
gtk_window_set_gravity(GTK_WINDOW(m_localDialog), GDK_GRAVITY_NORTH_EAST);
// Remove the dialogue from the task bar
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_localDialog), TRUE);
// this element did not apear in the miniature of the windows
gtk_window_set_skip_pager_hint(GTK_WINDOW(m_localDialog), TRUE);
// select the program icone
//gtk_window_set_default_icon_name("Replace");
@@ -183,9 +194,9 @@ void Search::Display(void)
} else {
gtk_widget_set_sensitive(m_CkMatchCase, true);
}
Edn::String myDataString;
SearchData::GetSearch(myDataString);
// Remove data form the search
etk::String myDataString = "";
SearchData::SetSearch(myDataString);
gtk_entry_set_text(GTK_ENTRY(m_searchEntry), myDataString.c_str());
if (0 == strlen(myDataString.c_str())) {
m_haveSearchData = false;
@@ -203,13 +214,14 @@ void Search::Display(void)
gtk_widget_set_sensitive(m_BtPrevious, m_haveSearchData);
gtk_widget_set_sensitive(m_BtNext, m_haveSearchData);
if (false == m_haveSearchData) {
gtk_widget_set_sensitive(m_BtReplace, false);
gtk_widget_set_sensitive(m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(m_BtReplace, m_haveReplaceData);
gtk_widget_set_sensitive(m_BtReplaceAndNext, m_haveReplaceData);
}
// basic no search data
gtk_widget_set_sensitive(m_BtReplace, false);
gtk_widget_set_sensitive(m_BtReplaceAndNext, false);
// set focus on a specific widget :
//gtk_window_set_focus(parent, m_searchEntry);
gtk_widget_grab_focus(m_searchEntry);
// display the dialogue box
gtk_widget_show_all(m_localDialog);
@@ -218,21 +230,25 @@ void Search::Display(void)
gtk_widget_hide(m_CkRegularExpression);
}
}
*/
void Search::Destroy(void)
{
/*
if (NULL!=m_localDialog) {
gtk_widget_destroy(m_localDialog);
m_localDialog = NULL;
}
*/
}
void Search::Hide(void)
{
gtk_widget_hide(m_localDialog);
//gtk_widget_hide(m_localDialog);
}
/*
void Search::OnButtonPrevious(GtkWidget *widget, gpointer data)
{
//EDN_INFO("CALLBACK");
@@ -305,7 +321,7 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
// update research data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) {
Edn::String myDataString = testData;
etk::String myDataString = testData;
SearchData::SetSearch(myDataString);
if (0 == strlen(testData)) {
self->m_haveSearchData = false;
@@ -318,8 +334,8 @@ void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
gtk_widget_set_sensitive(self->m_BtReplace, false);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(self->m_BtReplace, self->m_haveReplaceData);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, self->m_haveReplaceData);
gtk_widget_set_sensitive(self->m_BtReplace, true);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
}
}
}
@@ -331,14 +347,20 @@ void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
// update replace data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) {
Edn::String myDataString = testData;
etk::String myDataString = testData;
SearchData::SetReplace(myDataString);
if (0 == strlen(testData)) {
self->m_haveReplaceData = false;
} else {
self->m_haveReplaceData = true;
}
gtk_widget_set_sensitive(self->m_BtReplace, self->m_haveReplaceData);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, self->m_haveReplaceData);
if (false == self->m_haveSearchData) {
gtk_widget_set_sensitive(self->m_BtReplace, false);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(self->m_BtReplace, true);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
}
}
}
*/

View File

@@ -26,15 +26,13 @@
#ifndef __SEARCH_H__
#define __SEARCH_H__
#include "tools_debug.h"
#include "Singleton.h"
#include <string>
#include <vector>
#include <tools_debug.h>
#include <etk/Singleton.h>
class Search: public Singleton<Search>
class Search: public etk::Singleton<Search>
{
friend class Singleton<Search>;
friend class etk::Singleton<Search>;
// specific for sigleton system...
private:
// Constructeur
@@ -43,9 +41,9 @@ class Search: public Singleton<Search>
public:
void Destroy(void);
void Display(void);
//void Display(GtkWindow *parent);
void Hide(void);
/*
private:
GtkWidget * m_localDialog; //!< local dialog element
// entry
@@ -77,7 +75,7 @@ class Search: public Singleton<Search>
static void OnCheckBoxEventRegExp(GtkWidget *widget, gpointer user_data);
static void OnEntrySearchChange(GtkWidget *widget, gpointer user_data);
static void OnEntryReplaceChange(GtkWidget *widget, gpointer user_data);
*/
};

View File

@@ -23,22 +23,21 @@
*******************************************************************************
*/
#include "tools_globals.h"
#include "SearchData.h"
#include "Edn.h"
#include <tools_globals.h>
#include <SearchData.h>
#undef __class__
#define __class__ "SearchData"
static Edn::String m_findRequest = "";
static etk::String m_findRequest = "";
void SearchData::SetSearch(Edn::String &myData)
void SearchData::SetSearch(etk::String &myData)
{
m_findRequest = myData;
}
void SearchData::GetSearch(Edn::String &myData)
void SearchData::GetSearch(etk::String &myData)
{
myData = m_findRequest;
}
@@ -50,12 +49,12 @@ bool SearchData::IsSearchEmpty(void)
return true;
}
static Edn::String m_replaceRequest = "";
void SearchData::SetReplace(Edn::String &myData)
static etk::String m_replaceRequest = "";
void SearchData::SetReplace(etk::String &myData)
{
m_replaceRequest = myData;
}
void SearchData::GetReplace(Edn::String &myData)
void SearchData::GetReplace(etk::String &myData)
{
myData = m_replaceRequest;
}

View File

@@ -26,16 +26,15 @@
#ifndef __SEARCH_DATA_H__
#define __SEARCH_DATA_H__
#include "tools_debug.h"
#include "Edn.h"
#include <tools_debug.h>
namespace SearchData
{
void SetSearch(Edn::String &myData);
void GetSearch(Edn::String &myData);
void SetSearch(etk::String &myData);
void GetSearch(etk::String &myData);
bool IsSearchEmpty(void);
void SetReplace(Edn::String &myData);
void GetReplace(Edn::String &myData);
void SetReplace(etk::String &myData);
void GetReplace(etk::String &myData);
bool IsReplaceEmpty(void);
void SetCase(bool value);
bool GetCase(void);

View File

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

View File

@@ -26,13 +26,13 @@
#ifndef __WINDOWS_MANAGER_H__
#define __WINDOWS_MANAGER_H__
#include "Singleton.h"
#include "MsgBroadcast.h"
#include "MainWindows.h"
#include <etk/Singleton.h>
#include <MsgBroadcast.h>
#include <MainWindows.h>
class WindowsManager: public Singleton<WindowsManager>, public MsgBroadcast
class WindowsManager: public etk::Singleton<WindowsManager>, public MsgBroadcast
{
friend class Singleton<WindowsManager>;
friend class etk::Singleton<WindowsManager>;
// specific for sigleton system...
private:
// Constructeur

Some files were not shown because too many files have changed in this diff Show More