Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
8c3c3daf5c | |||
7da1beb12d | |||
ddd21072b5 | |||
bf7899e045 | |||
3f0febce28 | |||
5a924f7c9d | |||
39801fd265 | |||
ebdfd8be4c | |||
1d60917575 | |||
86d54590c0 | |||
b9a1c026fa | |||
4942765ccf | |||
a425bdc17b | |||
7d7d66d121 | |||
55e05d24a3 | |||
173e57342d | |||
440f4c7093 | |||
a01d121036 | |||
09425067dc | |||
780234de13 | |||
c421bd5f90 | |||
3ec3fa00d9 | |||
9b21e5c769 | |||
2157099f0a | |||
d18b202e75 | |||
63834fe960 | |||
cab0e6009d | |||
08261def10 | |||
304ac2ba45 | |||
2d8c5d588d | |||
f1543f6199 | |||
7acd5127eb | |||
0c6151283b | |||
8854a5a34b | |||
958138ecbb | |||
44bc1dd277 | |||
0821335de6 | |||
8d0fc9023f | |||
4f0839221d | |||
17101a38b0 | |||
def986ab82 | |||
7ebc20e936 | |||
f807faf55a |
4
CMakeLists.txt
Normal file
4
CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
SUBDIRS(${CMAKE_CURRENT_SOURCE_DIR}/../ewol)
|
||||||
|
SUBDIRS(sources)
|
34
README.md
34
README.md
@@ -46,8 +46,8 @@ download the software :
|
|||||||
http://developer.android.com/tools/sdk/ndk/index.html
|
http://developer.android.com/tools/sdk/ndk/index.html
|
||||||
http://developer.android.com/sdk/index.html
|
http://developer.android.com/sdk/index.html
|
||||||
==> you need to download sub package of the NDK (refer to the NDK doccumentation) but only supported android version >4.0
|
==> you need to download sub package of the NDK (refer to the NDK doccumentation) but only supported android version >4.0
|
||||||
cd ../edn
|
cd ..
|
||||||
# generate .so
|
# Generate package and install on Android device (in debug mode a generic key is set)
|
||||||
../ewol/build/lutin.py --color --target=Android --mode=debug edn-install
|
../ewol/build/lutin.py --color --target=Android --mode=debug edn-install
|
||||||
# to show the log :
|
# to show the log :
|
||||||
../ewol/build/lutin.py --target=Android edn-log
|
../ewol/build/lutin.py --target=Android edn-log
|
||||||
@@ -55,8 +55,11 @@ download the software :
|
|||||||
|
|
||||||
(Windows) Compile software & install
|
(Windows) Compile software & install
|
||||||
|
|
||||||
cd yourDevFolder/edn
|
cd yourDevFolder
|
||||||
../ewol/build/lutin.py --color --target=Windows --mode=debug
|
../ewol/build/lutin.py --color --target=Windows --mode=debug edn
|
||||||
|
|
||||||
|
#we have many problem for windows compilation now...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(MAC) All needed and some useful packages
|
(MAC) All needed and some useful packages
|
||||||
@@ -65,8 +68,27 @@ download the software :
|
|||||||
- Xcode ==> for all developement packages
|
- Xcode ==> for all developement packages
|
||||||
- in Xcode : XCode->Setting->Download and install component: "Command Line Tools"
|
- in Xcode : XCode->Setting->Download and install component: "Command Line Tools"
|
||||||
|
|
||||||
cd yourDevFolder/edn
|
cd yourDevFolder
|
||||||
../ewol/build/lutin.py --color --mode=debug
|
../ewol/build/lutin.py --color --mode=debug edn
|
||||||
|
|
||||||
|
|
||||||
|
(IOs) All needed and some useful packages
|
||||||
|
|
||||||
|
- Git access (client you want or : http://code.google.com/p/git-osx-installer/ ==>need a ctrl+click to remove the normal installation control)
|
||||||
|
- Xcode ==> for all developement packages
|
||||||
|
- in Xcode : XCode->Setting->Download and install component: "Command Line Tools"
|
||||||
|
|
||||||
|
for porting on IOs you need a developper account
|
||||||
|
|
||||||
|
cd yourDevFolder
|
||||||
|
# compile and install on simulator (no developper account needed)
|
||||||
|
../ewol/build/lutin.py --color --target=IOs --mode=debug --simulation edn-intall
|
||||||
|
# launch IOs simulator in xcode, and your application will appear on the second page (32 bit mode only)
|
||||||
|
|
||||||
|
# compile and install on board
|
||||||
|
../ewol/build/lutin.py --color --target=IOs --mode=debug edn-intall
|
||||||
|
# compile and install on board and debug mode :
|
||||||
|
../ewol/build/lutin.py --color --target=IOs --mode=debug edn-log
|
||||||
|
|
||||||
|
|
||||||
On linux you can generate 3 board in one time
|
On linux you can generate 3 board in one time
|
||||||
|
@@ -1,68 +0,0 @@
|
|||||||
#
|
|
||||||
# Automatically generated file; DO NOT EDIT.
|
|
||||||
# Linux Kernel Configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Modules
|
|
||||||
#
|
|
||||||
# CONFIG_BUILD_AGG is not set
|
|
||||||
# CONFIG_BUILD_LINEARMATH is not set
|
|
||||||
# CONFIG_BUILD_BULLET is not set
|
|
||||||
# CONFIG_BUILD_ETK is not set
|
|
||||||
# CONFIG_BUILD_FREETYPE is not set
|
|
||||||
# CONFIG_BUILD_LUA is not set
|
|
||||||
# CONFIG_BUILD_OGG is not set
|
|
||||||
# CONFIG_BUILD_PARSERSVG is not set
|
|
||||||
# CONFIG_BUILD_LIBPNG is not set
|
|
||||||
# CONFIG_BUILD_TINYXML is not set
|
|
||||||
# CONFIG_BUILD_ZLIB is not set
|
|
||||||
# CONFIG_BUILD_LIBZIP is not set
|
|
||||||
# CONFIG_BUILD_EWOL is not set
|
|
||||||
CONFIG_BUILD_EDN=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# ewol
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
|
||||||
CONFIG___EWOL_INTEGRATED_FONT__=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# Android
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_ANDROID_MINIMUM_SDK_VERSION__=9
|
|
||||||
# CONFIG___EWOL_ANDROID_SHOW_TITLE__ is not set
|
|
||||||
CONFIG___EWOL_ANDROID_ORIENTATION_AUTO__=y
|
|
||||||
# CONFIG___EWOL_ANDROID_ORIENTATION_LANDSCAPE__ is not set
|
|
||||||
# CONFIG___EWOL_ANDROID_ORIENTATION_PORTRAIT__ is not set
|
|
||||||
|
|
||||||
#
|
|
||||||
# Permissions
|
|
||||||
#
|
|
||||||
CONFIG___ANDROID_PERMISSION__WRITE_EXTERNAL_STORAGE__=y
|
|
||||||
# CONFIG___ANDROID_PERMISSION__CAMERA__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__INTERNET__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__MODIFY_AUDIO_SETTINGS__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__READ_CALENDAR__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__READ_CONTACTS__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__READ_FRAME_BUFFER__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__READ_PROFILE__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__RECORD_AUDIO__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__SET_ORIENTATION__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__VIBRATE__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__ACCESS_COARSE_LOCATION__ is not set
|
|
||||||
# CONFIG___ANDROID_PERMISSION__ACCESS_FINE_LOCATION__ is not set
|
|
||||||
|
|
||||||
#
|
|
||||||
# edn
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
|
||||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
|
@@ -1,49 +0,0 @@
|
|||||||
#
|
|
||||||
# Automatically generated file; DO NOT EDIT.
|
|
||||||
# Linux Kernel Configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Modules
|
|
||||||
#
|
|
||||||
# CONFIG_BUILD_AGG is not set
|
|
||||||
# CONFIG_BUILD_LINEARMATH is not set
|
|
||||||
# CONFIG_BUILD_BULLET is not set
|
|
||||||
# CONFIG_BUILD_ETK is not set
|
|
||||||
# CONFIG_BUILD_FREETYPE is not set
|
|
||||||
# CONFIG_BUILD_LUA is not set
|
|
||||||
# CONFIG_BUILD_OGG is not set
|
|
||||||
# CONFIG_BUILD_PARSERSVG is not set
|
|
||||||
# CONFIG_BUILD_LIBPNG is not set
|
|
||||||
# CONFIG_BUILD_PORTAUDIO is not set
|
|
||||||
# CONFIG_BUILD_TINYXML is not set
|
|
||||||
# CONFIG_BUILD_ZLIB is not set
|
|
||||||
# CONFIG_BUILD_LIBZIP is not set
|
|
||||||
# CONFIG_BUILD_EWOL is not set
|
|
||||||
CONFIG_BUILD_EDN=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# ewol
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
|
||||||
# CONFIG___EWOL_INTEGRATED_FONT__ is not set
|
|
||||||
|
|
||||||
#
|
|
||||||
# Linux
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_LINUX_GUI_MODE_X11__=y
|
|
||||||
# CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__ is not set
|
|
||||||
|
|
||||||
#
|
|
||||||
# edn
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
|
||||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
|
@@ -1,48 +0,0 @@
|
|||||||
#
|
|
||||||
# Automatically generated file; DO NOT EDIT.
|
|
||||||
# Linux Kernel Configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Modules
|
|
||||||
#
|
|
||||||
# CONFIG_BUILD_AGG is not set
|
|
||||||
# CONFIG_BUILD_LINEARMATH is not set
|
|
||||||
# CONFIG_BUILD_BULLET is not set
|
|
||||||
# CONFIG_BUILD_ETK is not set
|
|
||||||
# CONFIG_BUILD_FREETYPE is not set
|
|
||||||
# CONFIG_BUILD_LUA is not set
|
|
||||||
# CONFIG_BUILD_OGG is not set
|
|
||||||
# CONFIG_BUILD_PARSERSVG is not set
|
|
||||||
# CONFIG_BUILD_LIBPNG is not set
|
|
||||||
# CONFIG_BUILD_TINYXML is not set
|
|
||||||
# CONFIG_BUILD_ZLIB is not set
|
|
||||||
# CONFIG_BUILD_LIBZIP is not set
|
|
||||||
# CONFIG_BUILD_EWOL is not set
|
|
||||||
CONFIG_BUILD_EDN=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# ewol
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
|
||||||
CONFIG___EWOL_INTEGRATED_FONT__=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# Linux
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_LINUX_GUI_MODE_X11__=y
|
|
||||||
# CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__ is not set
|
|
||||||
|
|
||||||
#
|
|
||||||
# edn
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
|
||||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
|
@@ -1,43 +0,0 @@
|
|||||||
#
|
|
||||||
# Automatically generated file; DO NOT EDIT.
|
|
||||||
# Linux Kernel Configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Modules
|
|
||||||
#
|
|
||||||
# CONFIG_BUILD_AGG is not set
|
|
||||||
# CONFIG_BUILD_LINEARMATH is not set
|
|
||||||
# CONFIG_BUILD_BULLET is not set
|
|
||||||
# CONFIG_BUILD_ETK is not set
|
|
||||||
# CONFIG_BUILD_FREETYPE is not set
|
|
||||||
# CONFIG_BUILD_GLEW is not set
|
|
||||||
# CONFIG_BUILD_LUA is not set
|
|
||||||
# CONFIG_BUILD_OGG is not set
|
|
||||||
# CONFIG_BUILD_PARSERSVG is not set
|
|
||||||
# CONFIG_BUILD_LIBPNG is not set
|
|
||||||
# CONFIG_BUILD_TINYXML is not set
|
|
||||||
# CONFIG_BUILD_ZLIB is not set
|
|
||||||
# CONFIG_BUILD_LIBZIP is not set
|
|
||||||
# CONFIG_BUILD_EWOL is not set
|
|
||||||
CONFIG_BUILD_EDN=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# ewol
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Ewol Basic Title"
|
|
||||||
CONFIG___EWOL_INTEGRATED_FONT__=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# edn
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# General
|
|
||||||
#
|
|
||||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
|
||||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
|
@@ -12,15 +12,15 @@
|
|||||||
<button name="SEARCH:replace">
|
<button name="SEARCH:replace">
|
||||||
<image src="THEME:GUI:Replace.edf" fill="true" size="7,7mm" distance-field="true"/>
|
<image src="THEME:GUI:Replace.edf" fill="true" size="7,7mm" distance-field="true"/>
|
||||||
</button>
|
</button>
|
||||||
<button name="SEARCH:case">
|
<button name="SEARCH:case" toggle="true">
|
||||||
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||||
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||||
</button>
|
</button>
|
||||||
<button name="SEARCH:wrap">
|
<button name="SEARCH:wrap" toggle="true">
|
||||||
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||||
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||||
</button>
|
</button>
|
||||||
<button name="SEARCH:up-down">
|
<button name="SEARCH:up-down" toggle="true">
|
||||||
<image src="THEME:GUI:Up.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
<image src="THEME:GUI:Up.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||||
<image src="THEME:GUI:Down.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
<image src="THEME:GUI:Down.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||||
</button>
|
</button>
|
||||||
|
@@ -1,14 +1,27 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Version=0.3.0
|
|
||||||
Name=Edn : Editeur de N'ours
|
Name=Edn : Editeur de N'ours
|
||||||
Exec=edn
|
Exec=edn %U
|
||||||
Icon=Edn
|
Icon=/usr/share/edn/icon.png
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Development;Utility;TextEditor;
|
Categories=Development;
|
||||||
GenericName=Text editor
|
GenericName=Text editor
|
||||||
GenericName[en]=Text editor
|
GenericName[en]=Text editor
|
||||||
GenericName[nl]=Tekst verwerker
|
GenericName[nl]=Tekst verwerker
|
||||||
GenericName[fr]=éditeur de text
|
GenericName[fr]=Éditeur de text
|
||||||
Comment=Code editor for c, c++, php, bash, xml ...
|
Comment=Code editor for c, c++, php, bash, xml ...
|
||||||
Comment[fr]=éditeur de text pour les language c, c++, php, bash, xml ...
|
Comment[fr]=éditeur de text pour les language c, c++, php, bash, xml ...
|
||||||
|
OnlyShowIn=GNOME;Unity;
|
||||||
|
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
|
||||||
|
StartupNotify=true
|
||||||
|
Actions=New;
|
||||||
|
|
||||||
|
[Desktop Action New]
|
||||||
|
Name=Open a New Window
|
||||||
|
Name[fr]=Ouvrir une nouvelle fenêtre
|
||||||
|
Name[nl]=Nieuw venster openen
|
||||||
|
Name[en]=Open a New Window
|
||||||
|
Exec=edn
|
||||||
|
|
||||||
|
#desktop-file-validate edn.desktop
|
||||||
|
#sudo cp xxx /usr/share/applications/
|
0
data/lang/EN.json
Normal file
0
data/lang/EN.json
Normal file
0
data/lang/FR.json
Normal file
0
data/lang/FR.json
Normal file
@@ -6,52 +6,41 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline doxygen">
|
<rule name="my comment multiline doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>/\*\*</start>
|
<regex>/\*\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>/\*</start>
|
<regex>/\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my if 0">
|
<rule name="my if 0">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#[ \t]*if 0</start>
|
<regex>#[ \t]*if 0.*#(regexif|else)</regex>
|
||||||
<end>#endif|#else</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#</start>
|
<regex>#.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment doxygen">
|
<rule name="my comment doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>//!</start>
|
<regex>//!.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my todo comment">
|
<rule name="my todo comment">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>//[ \t]*TODO[ \t]*:</start>
|
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>(//|@)</start>
|
<regex>(//|@).*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@smull|ldrsh|smlal|stmdb|mul|mla|umull|ldr|add|str|mov|subs|bgt|ldmia|stmia|ldmfd|cmp|sub|strd|stmfd|bne|bhi|ldrd|mvn\@</start>
|
<regex>\@smull|ldrsh|smlal|stmdb|mul|mla|umull|ldr|add|str|mov|subs|bgt|ldmia|stmia|ldmfd|cmp|sub|strd|stmfd|bne|bhi|ldrd|mvn\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="register list">
|
<rule name="register list">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@r(10|11|12|[0-9]?)|sp|lp|lr|pc\@</start>
|
<regex>\@r(10|11|12|[0-9]?)|sp|lp|lr|pc\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,45 +4,37 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="first line">
|
<rule name="first line">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>#!</start>
|
<regex>#!(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="comment line">
|
<rule name="comment line">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'(\\[\\']|.)*'</regex>
|
||||||
<end>'</end>
|
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@for|done|do|while|in|if|elif|then|else|fi\@</start>
|
<regex>\@for|done|do|while|in|if|elif|then|else|fi\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my Variable">
|
<rule name="my Variable">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</start>
|
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>function (\w|_)+[ \t]*\(</start>
|
<regex>function (\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,57 +4,50 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="comment ##">
|
<rule name="comment ##">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>##</start>
|
<regex>##.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="comment #">
|
<rule name="comment #">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>#</start>
|
<regex>#.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="notes ... ">
|
<rule name="notes ... ">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>(NOTE|TODO) : </start>
|
<regex>(NOTE|TODO) : .*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*$</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>\@'</start>
|
<regex>\@'(\\[\\']|.)*$</regex>
|
||||||
<end>'</end>
|
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
|
|
||||||
<rule name="pourcentage OK">
|
<rule name="pourcentage OK">
|
||||||
<color>TestResultOK</color>
|
<color>TestResultOK</color>
|
||||||
<start>100%</start>
|
<regex>100%</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="pourcentage">
|
<rule name="pourcentage">
|
||||||
<color>number</color>
|
<color>number</color>
|
||||||
<start>[0-9]*%</start>
|
<regex>[0-9]*%</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="R<>sultat OK">
|
<rule name="R<>sultat OK">
|
||||||
<color>TestResultOK</color>
|
<color>TestResultOK</color>
|
||||||
<start>\[( )*(OK|Ok|ok)( )*\]</start>
|
<regex>\[( )*(OK|Ok|ok)( )*\]</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="resultat en erreur">
|
<rule name="resultat en erreur">
|
||||||
<color>TestResultERROR</color>
|
<color>TestResultERROR</color>
|
||||||
<start>\[(ERREUR|Erreur|erreur)\]</start>
|
<regex>\[(ERREUR|Erreur|erreur)\]</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="resultat vide">
|
<rule name="resultat vide">
|
||||||
<color>number</color>
|
<color>number</color>
|
||||||
<start>\[( )*\]</start>
|
<regex>\[( )*\]</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="notes ... ">
|
<rule name="notes ... ">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>==></start>
|
<regex>==></regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -2,137 +2,118 @@
|
|||||||
<EdnLang version="0.1" lang="C/C++">
|
<EdnLang version="0.1" lang="C/C++">
|
||||||
<ext>*.c</ext>
|
<ext>*.c</ext>
|
||||||
<ext>*.cpp</ext>
|
<ext>*.cpp</ext>
|
||||||
|
<ext>*.cxx</ext>
|
||||||
<ext>*.cc</ext>
|
<ext>*.cc</ext>
|
||||||
<ext>*.h</ext>
|
<ext>*.h</ext>
|
||||||
<ext>*.hpp</ext>
|
<ext>*.hpp</ext>
|
||||||
|
<ext>*.hxx</ext>
|
||||||
|
<ext>*.m</ext>
|
||||||
<ext>*.mm</ext>
|
<ext>*.mm</ext>
|
||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline doxygen">
|
<rule name="my comment multiline doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>/\*\*</start>
|
<regex>/\*\*.*(\*/|\e)</regex>
|
||||||
<end>\*/</end>
|
|
||||||
<rule name="macro">
|
|
||||||
<color>macro</color>
|
|
||||||
<start>\@[A-Z_]{4,500}\@</start>
|
|
||||||
</rule>
|
|
||||||
<rule name="keyword">
|
|
||||||
<color>keyword</color>
|
|
||||||
<start>@\w*[ \t]*(\[(in|out| |,)*\])?[ \t]*([a-zA-Z0-9\-_]*)</start>
|
|
||||||
<underColor idPThese="1"></underColor><!-- (\[(in|out| |,)*\]) -->
|
|
||||||
<underColor idPThese="3"></underColor><!-- (([a-zA-Z0-9\-_])*) -->
|
|
||||||
</rule>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="code Review">
|
<rule name="code Review">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>/\*[ \t]*TODO :</start>
|
<regex>/\*[ \t]*TODO :.*(\*/|\e)</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>/\*</start>
|
<regex>/\*.*(\*/|\e)</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my if 0">
|
<rule name="my if 0">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#[ \t]*if 0</start>
|
<regex>#[ \t]*if 0.*#(endif|else)</regex>
|
||||||
<end>#endif|#else</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment doxygen">
|
<rule name="my comment doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>//!</start>
|
<regex>//!.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my todo comment">
|
<rule name="my todo comment">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>//[ \t]*TODO[ \t]*:</start>
|
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>//</start>
|
<regex>//.*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'((\\[\\'])|.){1,2}'</regex>
|
||||||
<end>'</end>
|
</rule>
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
<rule name="simpleQuteTextError">
|
||||||
|
<color>SYNTAX_ERROR</color>
|
||||||
|
<regex>'</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
|
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my function keyword">
|
<rule name="my function keyword">
|
||||||
<color>systemFunction</color>
|
<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>
|
<regex>\@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]|_)+\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my type">
|
<rule name="my type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@bool|BOOL|char(16_t|32_t)?|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>
|
<regex>\@bool|BOOL|char(16_t|32_t)?|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128)\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="std type">
|
<rule name="std type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@std::(vector|(u16|u32|w)?string|codecvt_utf(16|8_utf16|8)+|complex|iterator(_traits)?|tuple(_element|_size)?|pair)\@</start>
|
<regex>\@std::(vector|(u16|u32|w)?string|codecvt_utf(16|8_utf16|8)+|complex|iterator(_traits)?|tuple(_element|_size)?|pair)\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my storage keyword">
|
<rule name="my storage keyword">
|
||||||
<color>storageKeyword</color>
|
<color>storageKeyword</color>
|
||||||
<start>\@inline|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>
|
<regex>\@inline|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\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my common Define">
|
<rule name="my common Define">
|
||||||
<color>commonDefine</color>
|
<color>commonDefine</color>
|
||||||
<start>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</start>
|
<regex>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|TRUE|false|FALSE\@</start>
|
<regex>\@true|TRUE|false|FALSE\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="CPP member">
|
<rule name="CPP member">
|
||||||
<color>memberClass</color>
|
<color>memberClass</color>
|
||||||
<start>\@m_[A-Za-z_0-9]*\@</start>
|
<regex>\@m_[A-Za-z_0-9]*\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="function input">
|
<rule name="function input">
|
||||||
<color>inputFunction</color>
|
<color>inputFunction</color>
|
||||||
<start>\@_[A-Za-z_0-9]*\@</start>
|
<regex>\@_[A-Za-z_0-9]*\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<!-- With all elementes :
|
<!-- With all elementes :
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>([A-Z]|_){4,500}</start>
|
<regex>([A-Z]|_){4,500}</regex>
|
||||||
<elemSubColor id="1">doxElem</elemSubColor>
|
<elemSubColor id="1">doxElem</elemSubColor>
|
||||||
</rule>
|
</rule>
|
||||||
-->
|
-->
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
50
data/languages/cmake/highlight.xml
Normal file
50
data/languages/cmake/highlight.xml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<EdnLang version="0.1" lang="C/C++">
|
||||||
|
<ext>CMakeLists.txt</ext>
|
||||||
|
<ext>CMakeCache.txt</ext>
|
||||||
|
<pass1>
|
||||||
|
<rule name="my comment doxygen">
|
||||||
|
<color>commentDoxygen</color>
|
||||||
|
<regex>##.*$</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="my todo comment">
|
||||||
|
<color>SYNTAX_ERROR</color>
|
||||||
|
<regex>#[ \t]TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="my comment">
|
||||||
|
<color>comment</color>
|
||||||
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="doubleQuteText">
|
||||||
|
<color>doubleQuoteText</color>
|
||||||
|
<regex>"(\\[\\"]|.)*$</regex>
|
||||||
|
</rule>
|
||||||
|
</pass1>
|
||||||
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
|
<rule name="my keyword">
|
||||||
|
<color>keyword</color>
|
||||||
|
<regex>\@foreach|message|endforeach|if|else|endif|list|file|string\@</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="my function keyword">
|
||||||
|
<color>systemFunction</color>
|
||||||
|
<regex>\@set|include_directories|add_definitions|add_library|include_directories|target_link_libraries|project|include|check_include_file|enable_testing|option|cmake_minimum_required|add_definitions|check_include_file|configure_file|include_directories|add_custom_command|add_executable|add_test\@</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="Variable">
|
||||||
|
<color>inputFunction</color>
|
||||||
|
<regex>\${.*}</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="numeric constant">
|
||||||
|
<color>number</color>
|
||||||
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="BIG LETTER">
|
||||||
|
<color>macro</color>
|
||||||
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
|
</rule>
|
||||||
|
<rule name="Function name">
|
||||||
|
<color>functionName</color>
|
||||||
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
</pass2>
|
||||||
|
</EdnLang>
|
@@ -7,76 +7,65 @@
|
|||||||
<pass1>
|
<pass1>
|
||||||
<rule name="my comment multiline doxygen">
|
<rule name="my comment multiline doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>/\*\*</start>
|
<regex>/\*\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>/\*</start>
|
<regex>/\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my if 0">
|
<rule name="my if 0">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#[ \t]*if 0</start>
|
<regex>#[ \t]*if 0(\\[\\\n]|.)*#(endif|else)</regex>
|
||||||
<end>#endif|#else</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment doxygen">
|
<rule name="my comment doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>//!</start>
|
<regex>//!(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my todo comment">
|
<rule name="my todo comment">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>//[ \t]*TODO[ \t]*:</start>
|
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>//</start>
|
<regex>//(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
|
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my type">
|
<rule name="my type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@void|bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</start>
|
<regex>\@void|bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my storage keyword">
|
<rule name="my storage keyword">
|
||||||
<color>storageKeyword</color>
|
<color>storageKeyword</color>
|
||||||
<start>\@varying|uniform|attribute|precision|mediump\@</start>
|
<regex>\@varying|uniform|attribute|precision|mediump\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|false\@</start>
|
<regex>\@true|false\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,43 +4,37 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*$</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'(\\[\\']|.)*$</regex>
|
||||||
<end>'</end>
|
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config\@</start>
|
<regex>\@menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my type">
|
<rule name="my type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@int|hex|bool|string\@</start>
|
<regex>\@int|hex|bool|string\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,84 +4,73 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline doxygen">
|
<rule name="my comment multiline doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>/\*\*</start>
|
<regex>/\*\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>/\*</start>
|
<regex>/\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment doxygen">
|
<rule name="my comment doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>//!</start>
|
<regex>//!(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my todo comment">
|
<rule name="my todo comment">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>//[ \t]*TODO[ \t]*:</start>
|
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>//</start>
|
<regex>//(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'(\\[\\']|.)*'</regex>
|
||||||
<end>'</end>
|
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for\@</start>
|
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my function keyword">
|
<rule name="my function keyword">
|
||||||
<color>systemFunction</color>
|
<color>systemFunction</color>
|
||||||
<start>\@new|try|catch|print\@</start>
|
<regex>\@new|try|catch|print\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my type">
|
<rule name="my type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum\@</start>
|
<regex>\@boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my storage keyword">
|
<rule name="my storage keyword">
|
||||||
<color>storageKeyword</color>
|
<color>storageKeyword</color>
|
||||||
<start>\@import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface@</start>
|
<regex>\@import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my common Define">
|
<rule name="my common Define">
|
||||||
<color>commonDefine</color>
|
<color>commonDefine</color>
|
||||||
<start>\@null\@</start>
|
<regex>\@null\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|false\@</start>
|
<regex>\@true|false\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,31 +4,29 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\{|\}|\[|\]</start>
|
<regex>\{|\}|\[|\]</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="separator">
|
<rule name="separator">
|
||||||
<color>error</color>
|
<color>error</color>
|
||||||
<start>:|,</start>
|
<regex>:|,</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="names">
|
<rule name="names">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>([a-zA-Z0-9]|-|_)*</start>
|
<regex>([a-zA-Z0-9]|-|_)*</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|false\@</start>
|
<regex>\@true|false\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,57 +4,49 @@
|
|||||||
<pass1>
|
<pass1>
|
||||||
<rule name="Comment multiline">
|
<rule name="Comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>\-\-\[\[</start>
|
<regex>\-\-\[\[.*\-\-\]\]</regex>
|
||||||
<end>\-\-\]\]</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my todo comment">
|
<rule name="my todo comment">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>\-\-[ \t]*TODO[ \t]*:</start>
|
<regex>\-\-[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>\-\-</start>
|
<regex>\-\-(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'(\\[\\']|.)*'</regex>
|
||||||
<end>'</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while\@</start>
|
<regex>\@and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|false\@</start>
|
<regex>\@true|false\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|~=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|~=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -6,38 +6,33 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'(\\[\\']|.)*'</regex>
|
||||||
<end>'</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="confition">
|
<rule name="confition">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@if|ifeq|ifneq|else|endif|define|endef\@</start>
|
<regex>\@if|ifeq|ifneq|else|endif|define|endef\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</start>
|
<regex>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="function call">
|
<rule name="function call">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\$\((call|info|error|warning|shell|patsubst|lastword|wildcard|addprefix|foreach|subst|word|eval)</start>
|
<regex>\$\((call|info|error|warning|shell|patsubst|lastword|wildcard|addprefix|foreach|subst|word|eval)</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>:=|?=|!=|=</start>
|
<regex>:=|?=|!=|=</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -5,58 +5,49 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment doxygen">
|
<rule name="my comment doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>%%</start>
|
<regex>%%(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>%</start>
|
<regex>%(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start> "</start>
|
<regex> ".*($|")</regex>
|
||||||
<end>("|\n)</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start> '</start>
|
<regex> '.*($|')</regex>
|
||||||
<end>('|\n)</end>
|
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="global inclusion">
|
<rule name="global inclusion">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>global( |\t)+</start>
|
<regex>global( |\t)+(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</start>
|
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|false\@</start>
|
<regex>\@true|false\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -7,70 +7,61 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>/\*</start>
|
<regex>/\*.*\*/</regex>
|
||||||
<end>\*/</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my todo comment">
|
<rule name="my todo comment">
|
||||||
<color>SYNTAX_ERROR</color>
|
<color>SYNTAX_ERROR</color>
|
||||||
<start>//[ \t]*TODO[ \t]*:</start>
|
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment inline">
|
<rule name="my comment inline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>//</start>
|
<regex>//(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'(\\[\\']|.)*'</regex>
|
||||||
<end>'</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</start>
|
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my type">
|
<rule name="my type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</start>
|
<regex>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my storage keyword">
|
<rule name="my storage keyword">
|
||||||
<color>storageKeyword</color>
|
<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>
|
<regex>\@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\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my common Define">
|
<rule name="my common Define">
|
||||||
<color>commonDefine</color>
|
<color>commonDefine</color>
|
||||||
<start>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</start>
|
<regex>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@true|TRUE|false|FALSE\@</start>
|
<regex>\@true|TRUE|false|FALSE\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<|>|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<|>|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
@@ -4,73 +4,70 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="my comment multiline">
|
<rule name="my comment multiline">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>"""</start>
|
<regex>""".*"""</regex>
|
||||||
<end>"""</end>
|
</rule>
|
||||||
|
<rule name="my comment multiline">
|
||||||
|
<color>comment</color>
|
||||||
|
<regex>'''.*'''</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment doxygen">
|
<rule name="my comment doxygen">
|
||||||
<color>commentDoxygen</color>
|
<color>commentDoxygen</color>
|
||||||
<start>##</start>
|
<regex>##(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my comment">
|
<rule name="my comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start>#</start>
|
<regex>#(\\[\\\n]|.)*$</regex>
|
||||||
<end>\n</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>'</start>
|
<regex>'((\\[\\'])|.)*'</regex>
|
||||||
<end>'</end>
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||||
<rule name="my keyword">
|
<rule name="my keyword">
|
||||||
<color>keyword</color>
|
<color>keyword</color>
|
||||||
<start>\@if|else|elif|break|pass|continue|while|do|for|in|return\@</start>
|
<regex>\@if|else|elif|break|pass|continue|while|do|for|in|return\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my function keyword">
|
<rule name="my function keyword">
|
||||||
<color>systemFunction</color>
|
<color>systemFunction</color>
|
||||||
<start>\@print|len|range|del|__init__|self|os\.|sys\.|path\.\@</start>
|
<regex>\@print|len|range|del|__init__|self|os\.|sys\.|path\.\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my type">
|
<rule name="my type">
|
||||||
<color>type</color>
|
<color>type</color>
|
||||||
<start>\@bool|BOOL|char|double|float\@</start>
|
<regex>\@bool|BOOL|char|double|float\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my storage keyword">
|
<rule name="my storage keyword">
|
||||||
<color>storageKeyword</color>
|
<color>storageKeyword</color>
|
||||||
<start>\@def|class|import|from|as|try|except\@</start>
|
<regex>\@def|class|import|from|as|try|except\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="numeric constant">
|
<rule name="numeric constant">
|
||||||
<color>number</color>
|
<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>
|
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="my boolean">
|
<rule name="my boolean">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>\@True|False\@</start>
|
<regex>\@True|False\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="Function name">
|
<rule name="Function name">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start>\@(\w|_)+[ \t]*\(</start>
|
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="condition">
|
<rule name="condition">
|
||||||
<color>boolean</color>
|
<color>boolean</color>
|
||||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||||
</rule>
|
</rule>
|
||||||
<!-- With all elementes : -->
|
<!-- With all elementes : -->
|
||||||
<rule name="BIG LETTER">
|
<rule name="BIG LETTER">
|
||||||
<color>macro</color>
|
<color>macro</color>
|
||||||
<start>([A-Z]|_){4,500}</start>
|
<regex>([A-Z]|_){4,500}</regex>
|
||||||
<elemSubColor id="1">doxElem</elemSubColor>
|
<elemSubColor id="1">doxElem</elemSubColor>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
|
@@ -5,30 +5,33 @@
|
|||||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||||
<rule name="Comment">
|
<rule name="Comment">
|
||||||
<color>comment</color>
|
<color>comment</color>
|
||||||
<start><!\-\-</start>
|
<regex><![CDATA[<!\-\-.*\-\->]]></regex>
|
||||||
<end>\-\-></end>
|
<!--<regex><!\-\-.*\-\-></regex>-->
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="doubleQuteText">
|
<rule name="doubleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>"</start>
|
<regex>"(\\[\\"]|.)*"</regex>
|
||||||
<end>"</end>
|
|
||||||
<EscapeChar>\</EscapeChar>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule name="simpleQuteText">
|
<rule name="simpleQuteText">
|
||||||
<color>doubleQuoteText</color>
|
<color>doubleQuoteText</color>
|
||||||
<start>\@'</start>
|
<regex>\@'.*('|\n)</regex>
|
||||||
<end>('|\n)</end>
|
|
||||||
<!--<EscapeChar>\</EscapeChar>-->
|
|
||||||
</rule>
|
</rule>
|
||||||
</pass1>
|
</pass1>
|
||||||
<pass2>
|
<pass2>
|
||||||
<rule name="special Balise">
|
<rule name="special Balise">
|
||||||
<color>error</color>
|
<color>error</color>
|
||||||
<start><\?\w*|\?></start>
|
<regex><\?\w*|\?></regex>
|
||||||
</rule>
|
</rule>
|
||||||
|
<!--
|
||||||
|
<rule name="normale Balise2">
|
||||||
|
<color>functionName</color>
|
||||||
|
<regex><![CDATA[(</[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+)(/>|>)]]></regex>
|
||||||
|
</rule>
|
||||||
|
-->
|
||||||
<rule name="normale Balise">
|
<rule name="normale Balise">
|
||||||
<color>functionName</color>
|
<color>functionName</color>
|
||||||
<start></[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+|/>|></start>
|
<!--<regex></[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+|/>|></regex>-->
|
||||||
|
<regex><![CDATA[(</[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+)\@]]></regex>
|
||||||
</rule>
|
</rule>
|
||||||
</pass2>
|
</pass2>
|
||||||
</EdnLang>
|
</EdnLang>
|
||||||
|
110
sources/CMakeLists.txt
Normal file
110
sources/CMakeLists.txt
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
# Declare the project
|
||||||
|
project(edn)
|
||||||
|
|
||||||
|
##
|
||||||
|
## Include C++ X11 dependency ... (check correct flags)
|
||||||
|
##
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||||
|
if(COMPILER_SUPPORTS_CXX11)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
else()
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||||
|
if(COMPILER_SUPPORTS_CXX0X)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
|
else()
|
||||||
|
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# set output path:
|
||||||
|
set(LIBRARY_OUTPUT_PATH lib/${CMAKE_BUILD_TYPE})
|
||||||
|
|
||||||
|
include_directories(.)
|
||||||
|
|
||||||
|
#Create src file list
|
||||||
|
set(src_files
|
||||||
|
appl/ctags/readtags.cpp
|
||||||
|
appl/debug.cpp
|
||||||
|
appl/global.cpp
|
||||||
|
appl/globalMsg.cpp
|
||||||
|
appl/init.cpp
|
||||||
|
appl/Gui/BufferView.cpp
|
||||||
|
appl/Gui/TextViewer.cpp
|
||||||
|
appl/Gui/ViewerManager.cpp
|
||||||
|
appl/Gui/MainWindows.cpp
|
||||||
|
appl/Gui/Search.cpp
|
||||||
|
appl/Gui/TagFileSelection.cpp
|
||||||
|
appl/Gui/TagFileList.cpp
|
||||||
|
appl/Gui/WorkerSaveFile.cpp
|
||||||
|
appl/Gui/WorkerSaveAllFile.cpp
|
||||||
|
appl/Gui/WorkerCloseFile.cpp
|
||||||
|
appl/Gui/WorkerCloseAllFile.cpp
|
||||||
|
appl/Buffer.cpp
|
||||||
|
appl/BufferManager.cpp
|
||||||
|
appl/TextPlugin.cpp
|
||||||
|
appl/TextPluginCopy.cpp
|
||||||
|
appl/TextPluginMultiLineTab.cpp
|
||||||
|
appl/TextPluginAutoIndent.cpp
|
||||||
|
appl/TextPluginHistory.cpp
|
||||||
|
appl/TextPluginRmLine.cpp
|
||||||
|
appl/TextPluginSelectAll.cpp
|
||||||
|
appl/TextPluginCtags.cpp
|
||||||
|
appl/TextPluginManager.cpp
|
||||||
|
appl/GlyphDecoration.cpp
|
||||||
|
appl/GlyphPainting.cpp
|
||||||
|
appl/HighlightPattern.cpp
|
||||||
|
appl/Highlight.cpp
|
||||||
|
appl/HighlightManager.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_definitions( -DDEBUG_LEVEL=3 )
|
||||||
|
add_definitions( -DDEBUG=1 )
|
||||||
|
add_definitions( -DPROJECT_NAME="edn" )
|
||||||
|
if (APPLE)
|
||||||
|
add_definitions( -D__TARGET_OS__MacOs )
|
||||||
|
elseif (UNIX)
|
||||||
|
add_definitions( -D__TARGET_OS__Linux )
|
||||||
|
elseif (WIN32)
|
||||||
|
add_definitions( -D__TARGET_OS__Windows )
|
||||||
|
endif ()
|
||||||
|
# read version :
|
||||||
|
file (STRINGS "tag" BUILD_VERSION)
|
||||||
|
add_definitions( -DAPPL_VERSION="${BUILD_VERSION}" )
|
||||||
|
|
||||||
|
#Create a static Lib:
|
||||||
|
add_executable(edn ${src_files} )
|
||||||
|
|
||||||
|
include_directories(${zlib_SOURCE_DIR}/contrib/)
|
||||||
|
include_directories(${linearmath_SOURCE_DIR}/bullet/src/)
|
||||||
|
include_directories(${etk_SOURCE_DIR})
|
||||||
|
include_directories(${freetype_SOURCE_DIR})
|
||||||
|
include_directories(${exml_SOURCE_DIR})
|
||||||
|
include_directories(${ejson_SOURCE_DIR})
|
||||||
|
include_directories(${egami_SOURCE_DIR})
|
||||||
|
include_directories(${edtaa3_SOURCE_DIR})
|
||||||
|
include_directories(${date_SOURCE_DIR})
|
||||||
|
include_directories(${agg_SOURCE_DIR})
|
||||||
|
include_directories(${ewol_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
#target_link_libraries(edn ewol)
|
||||||
|
target_link_libraries(edn ewol linearmath zlib etk freetype exml ejson egami edtaa3 date esvg png)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(edn
|
||||||
|
"-framework Cocoa"
|
||||||
|
"-framework OpenGL"
|
||||||
|
"-framework QuartzCore"
|
||||||
|
"-framework AppKit"
|
||||||
|
)
|
||||||
|
elseif (UNIX)
|
||||||
|
target_link_libraries(edn -lGL -lX11 -lpthread)
|
||||||
|
elseif (WIN32)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
@@ -8,24 +8,27 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
|
#include <etk/stdTools.h>
|
||||||
#include <appl/Buffer.h>
|
#include <appl/Buffer.h>
|
||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
#include <ewol/context/clipBoard.h>
|
#include <ewol/context/clipBoard.h>
|
||||||
#include <appl/HighlightManager.h>
|
#include <appl/HighlightManager.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "Buffer"
|
||||||
|
|
||||||
const char* const appl::Buffer::eventIsModify = "edn-is-modify";
|
const char* const appl::Buffer::eventIsModify = "edn-is-modify";
|
||||||
const char* const appl::Buffer::eventIsSave = "edn-is-save";
|
const char* const appl::Buffer::eventIsSave = "edn-is-save";
|
||||||
const char* const appl::Buffer::eventSelectChange = "edn-select-change";
|
const char* const appl::Buffer::eventSelectChange = "edn-select-change";
|
||||||
const char* const appl::Buffer::eventChangeName = "edn-buffer-name-change";
|
const char* const appl::Buffer::eventChangeName = "edn-buffer-name-change";
|
||||||
|
|
||||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ (void) {
|
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
|
||||||
m_value = u32char::Null;
|
m_value = u32char::Null;
|
||||||
if (m_current < 0) {
|
if (m_current < 0) {
|
||||||
m_current = 0;
|
m_current = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
if (m_data != NULL) {
|
if (m_data != nullptr) {
|
||||||
if (m_current < m_data->m_data.size() ) {
|
if (m_current < m_data->m_data.size() ) {
|
||||||
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
|
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
|
||||||
if (nbChar != 0) {
|
if (nbChar != 0) {
|
||||||
@@ -41,9 +44,9 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ (void) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- () {
|
||||||
m_value = u32char::Null;
|
m_value = u32char::Null;
|
||||||
if (m_data != NULL) {
|
if (m_data != nullptr) {
|
||||||
if (m_current > 0) {
|
if (m_current > 0) {
|
||||||
int32_t iii = -1;
|
int32_t iii = -1;
|
||||||
while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false
|
while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false
|
||||||
@@ -62,11 +65,11 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
char32_t appl::Buffer::Iterator::operator* (void) {
|
char32_t appl::Buffer::Iterator::operator* () {
|
||||||
if (m_value != u32char::Null) {
|
if (m_value != u32char::Null) {
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
if (m_data == NULL) {
|
if (m_data == nullptr) {
|
||||||
APPL_ERROR("request an element that iterator not link");
|
APPL_ERROR("request an element that iterator not link");
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
@@ -92,32 +95,32 @@ appl::Buffer::Iterator appl::Buffer::position(int64_t _pos) {
|
|||||||
return appl::Buffer::Iterator(this, _pos);
|
return appl::Buffer::Iterator(this, _pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::begin(void) {
|
appl::Buffer::Iterator appl::Buffer::begin() {
|
||||||
return position(0);
|
return position(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::end(void) {
|
appl::Buffer::Iterator appl::Buffer::end() {
|
||||||
// TODO : chek the validity of the char ...
|
// TODO : chek the validity of the char ...
|
||||||
return position( m_data.size() );
|
return position( m_data.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::cursor(void) {
|
appl::Buffer::Iterator appl::Buffer::cursor() {
|
||||||
if (m_cursorPos<= 0) {
|
if (m_cursorPos<= 0) {
|
||||||
return begin();
|
return begin();
|
||||||
}
|
}
|
||||||
return position( m_cursorPos );
|
return position( m_cursorPos );
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::selectStart(void) {
|
appl::Buffer::Iterator appl::Buffer::selectStart() {
|
||||||
return position( getStartSelectionPos() );
|
return position( getStartSelectionPos() );
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::selectStop(void) {
|
appl::Buffer::Iterator appl::Buffer::selectStop() {
|
||||||
return position( getStopSelectionPos() );
|
return position( getStopSelectionPos() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::Buffer::Buffer(void) :
|
appl::Buffer::Buffer() :
|
||||||
m_hasFileName(false),
|
m_hasFileName(false),
|
||||||
m_fileName(""),
|
m_fileName(""),
|
||||||
m_isModify(false),
|
m_isModify(false),
|
||||||
@@ -125,10 +128,10 @@ appl::Buffer::Buffer(void) :
|
|||||||
m_cursorSelectPos(-1),
|
m_cursorSelectPos(-1),
|
||||||
m_cursorPreferredCol(-1),
|
m_cursorPreferredCol(-1),
|
||||||
m_nbLines(1),
|
m_nbLines(1),
|
||||||
m_highlight(NULL) {
|
m_highlight(nullptr) {
|
||||||
addObjectType("appl::Buffer");
|
addObjectType("appl::Buffer");
|
||||||
static int32_t bufferBaseId = 0;
|
static int32_t bufferBaseId = 0;
|
||||||
m_fileName = "No Name " + std::to_string(bufferBaseId);
|
m_fileName = "No Name " + etk::to_string(bufferBaseId);
|
||||||
bufferBaseId++;
|
bufferBaseId++;
|
||||||
addEventId(eventIsModify);
|
addEventId(eventIsModify);
|
||||||
addEventId(eventIsSave);
|
addEventId(eventIsSave);
|
||||||
@@ -136,15 +139,20 @@ appl::Buffer::Buffer(void) :
|
|||||||
addEventId(eventChangeName);
|
addEventId(eventChangeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::~Buffer(void) {
|
void appl::Buffer::init() {
|
||||||
if (m_highlight == NULL) {
|
ewol::Object::init();
|
||||||
appl::Highlight::release(m_highlight);
|
}
|
||||||
}
|
|
||||||
|
appl::Buffer::~Buffer() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Buffer::loadFile(const std::string& _name) {
|
bool appl::Buffer::loadFile(const std::string& _name) {
|
||||||
APPL_DEBUG("Load file : '" << _name << "'");
|
APPL_DEBUG("Convert filename :'" << _name << "'");
|
||||||
m_fileName = _name;
|
etk::FSNode file(_name);
|
||||||
|
std::string name = file.getName();
|
||||||
|
APPL_INFO("Load file : '" << name << "'");
|
||||||
|
m_fileName = name;
|
||||||
m_hasFileName = true;
|
m_hasFileName = true;
|
||||||
m_isModify = true;
|
m_isModify = true;
|
||||||
m_cursorPos = 0;
|
m_cursorPos = 0;
|
||||||
@@ -160,16 +168,19 @@ bool appl::Buffer::loadFile(const std::string& _name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::setFileName(const std::string& _name) {
|
void appl::Buffer::setFileName(const std::string& _name) {
|
||||||
if (m_fileName == _name) {
|
APPL_DEBUG("Convert filename :'" << _name << "'");
|
||||||
|
etk::FSNode file(_name);
|
||||||
|
std::string name = file.getName();
|
||||||
|
if (m_fileName == name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_fileName = _name;
|
m_fileName = name;
|
||||||
m_hasFileName = true;
|
m_hasFileName = true;
|
||||||
generateEventId(eventChangeName);
|
generateEventId(eventChangeName);
|
||||||
setModification(true);
|
setModification(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Buffer::storeFile(void) {
|
bool appl::Buffer::storeFile() {
|
||||||
if (m_data.dumpIn(m_fileName) == true) {
|
if (m_data.dumpIn(m_fileName) == true) {
|
||||||
APPL_INFO("saving file : " << m_fileName);
|
APPL_INFO("saving file : " << m_fileName);
|
||||||
setModification(false);
|
setModification(false);
|
||||||
@@ -191,7 +202,7 @@ void appl::Buffer::setModification(bool _status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Naming error
|
// TODO : Naming error
|
||||||
void appl::Buffer::countNumberofLine(void) {
|
void appl::Buffer::countNumberofLine() {
|
||||||
m_nbLines = 1;
|
m_nbLines = 1;
|
||||||
for (Iterator it = begin();
|
for (Iterator it = begin();
|
||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
@@ -293,7 +304,7 @@ bool appl::Buffer::search(const appl::Buffer::Iterator& _pos,
|
|||||||
for (Iterator it = _pos;
|
for (Iterator it = _pos;
|
||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
++it) {
|
++it) {
|
||||||
if (tolower(*it) == firstElement) {
|
if ((char32_t)tolower(*it) == firstElement) {
|
||||||
// find the first char ==> check next...
|
// find the first char ==> check next...
|
||||||
bool find = true;
|
bool find = true;
|
||||||
Iterator tmp = it;
|
Iterator tmp = it;
|
||||||
@@ -365,7 +376,7 @@ bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos,
|
|||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
--it) {
|
--it) {
|
||||||
//APPL_DEBUG("compare : " << *it << " ?= " << _search);
|
//APPL_DEBUG("compare : " << *it << " ?= " << _search);
|
||||||
if (tolower(*it) == lastElement) {
|
if ((char32_t)tolower(*it) == lastElement) {
|
||||||
// find the last char ==> check previous...
|
// find the last char ==> check previous...
|
||||||
bool find = true;
|
bool find = true;
|
||||||
_result = it;
|
_result = it;
|
||||||
@@ -511,7 +522,7 @@ void appl::Buffer::setSelectionPos(const appl::Buffer::Iterator& _pos) {
|
|||||||
generateEventId(eventSelectChange);
|
generateEventId(eventSelectChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::unSelect(void) {
|
void appl::Buffer::unSelect() {
|
||||||
m_cursorSelectPos = -1;
|
m_cursorSelectPos = -1;
|
||||||
generateEventId(eventSelectChange);
|
generateEventId(eventSelectChange);
|
||||||
}
|
}
|
||||||
@@ -619,8 +630,6 @@ bool appl::Buffer::copy(std::string& _data) {
|
|||||||
|
|
||||||
void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||||
_data.clear();
|
_data.clear();
|
||||||
int64_t startPos = getStartSelectionPos();
|
|
||||||
int64_t endPos = getStopSelectionPos();
|
|
||||||
for (Iterator it = _pos;
|
for (Iterator it = _pos;
|
||||||
it != _posEnd &&
|
it != _posEnd &&
|
||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
@@ -634,7 +643,7 @@ bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator&
|
|||||||
if (position < 0){
|
if (position < 0){
|
||||||
position = 0;
|
position = 0;
|
||||||
}
|
}
|
||||||
APPL_ERROR("writye at pos: " << (int64_t)_pos << " ==> " << position);
|
APPL_VERBOSE("write at pos: " << (int64_t)_pos << " ==> " << position << " data : " << _data);
|
||||||
m_data.insert(position, (int8_t*)(_data.c_str()), _data.size());
|
m_data.insert(position, (int8_t*)(_data.c_str()), _data.size());
|
||||||
if (m_cursorPos < 0) {
|
if (m_cursorPos < 0) {
|
||||||
m_cursorPos = 0;
|
m_cursorPos = 0;
|
||||||
@@ -661,7 +670,7 @@ bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterato
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::removeSelection(void) {
|
void appl::Buffer::removeSelection() {
|
||||||
if (hasTextSelected() == false) {
|
if (hasTextSelected() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -675,7 +684,7 @@ void appl::Buffer::removeSelection(void) {
|
|||||||
setModification(true);
|
setModification(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::tryFindHighlightType(void) {
|
void appl::Buffer::tryFindHighlightType() {
|
||||||
etk::FSNode file(m_fileName);
|
etk::FSNode file(m_fileName);
|
||||||
std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention());
|
std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention());
|
||||||
if (type.size() == 0) {
|
if (type.size() == 0) {
|
||||||
@@ -688,21 +697,19 @@ void appl::Buffer::tryFindHighlightType(void) {
|
|||||||
void appl::Buffer::setHighlightType(const std::string& _type) {
|
void appl::Buffer::setHighlightType(const std::string& _type) {
|
||||||
m_highlightType = "";
|
m_highlightType = "";
|
||||||
cleanHighLight();
|
cleanHighLight();
|
||||||
if (m_highlight == NULL) {
|
m_highlight.reset();
|
||||||
appl::Highlight::release(m_highlight);
|
|
||||||
}
|
|
||||||
std::string resourceName = appl::highlightManager::getFileWithTypeType(_type);
|
std::string resourceName = appl::highlightManager::getFileWithTypeType(_type);
|
||||||
if (resourceName == "") {
|
if (resourceName == "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_highlightType = _type;
|
m_highlightType = _type;
|
||||||
m_highlight = appl::Highlight::keep(resourceName);
|
m_highlight = appl::Highlight::create(resourceName);
|
||||||
generateHighLightAt(0, m_data.size());
|
generateHighLightAt(0, m_data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) {
|
void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) {
|
||||||
// prevent ERROR...
|
// prevent ERROR...
|
||||||
if (NULL == m_highlight) {
|
if (nullptr == m_highlight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// prevent No data Call
|
// prevent No data Call
|
||||||
@@ -757,12 +764,10 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
|||||||
} else {
|
} else {
|
||||||
elemStart = startId+1;
|
elemStart = startId+1;
|
||||||
}
|
}
|
||||||
for (int64_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
|
for (auto it(m_HLDataPass1.begin()+elemStart); it != m_HLDataPass1.end(); ++it) {
|
||||||
//APPL_DEBUG("move element=" << i);
|
//APPL_DEBUG("move element=" << i);
|
||||||
m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted;
|
it->start += _nbAdded - _nbDeleted;
|
||||||
m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted;
|
it->stop += _nbAdded - _nbDeleted;
|
||||||
m_HLDataPass1[iii].endStart += _nbAdded - _nbDeleted;
|
|
||||||
m_HLDataPass1[iii].endStop += _nbAdded - _nbDeleted;
|
|
||||||
}
|
}
|
||||||
//Regenerate Element inside range
|
//Regenerate Element inside range
|
||||||
if ( startId == -1
|
if ( startId == -1
|
||||||
@@ -771,13 +776,13 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
|||||||
generateHighLightAt(0, m_data.size());
|
generateHighLightAt(0, m_data.size());
|
||||||
} else if(-1 == startId) {
|
} else if(-1 == startId) {
|
||||||
//APPL_DEBUG("******* Regenerate START");
|
//APPL_DEBUG("******* Regenerate START");
|
||||||
generateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
|
generateHighLightAt(0, m_HLDataPass1[0].start, 0);
|
||||||
} else if(-1 == stopId) {
|
} else if(-1 == stopId) {
|
||||||
//APPL_DEBUG("******* Regenerate STOP");
|
//APPL_DEBUG("******* Regenerate STOP");
|
||||||
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.size(), m_HLDataPass1.size());
|
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].stop, m_data.size(), m_HLDataPass1.size());
|
||||||
} else {
|
} else {
|
||||||
//APPL_DEBUG("******* Regenerate RANGE");
|
//APPL_DEBUG("******* Regenerate RANGE");
|
||||||
generateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
|
generateHighLightAt(m_HLDataPass1[startId].stop, m_HLDataPass1[startId+1].start, startId+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -825,8 +830,8 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
|||||||
------------ ------------- ----------
|
------------ ------------- ----------
|
||||||
S=-1 *************** E
|
S=-1 *************** E
|
||||||
*/
|
*/
|
||||||
for (int32_t iii = 0; iii < m_HLDataPass1.size(); ++iii) {
|
for (size_t iii = 0; iii < m_HLDataPass1.size(); ++iii) {
|
||||||
if (m_HLDataPass1[iii].endStop > _startPos) {
|
if (m_HLDataPass1[iii].stop > _startPos) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_startId = iii;
|
_startId = iii;
|
||||||
@@ -846,8 +851,8 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
|||||||
} else {
|
} else {
|
||||||
elemStart = _startId+1;
|
elemStart = _startId+1;
|
||||||
}
|
}
|
||||||
for (int32_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
|
for (size_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
|
||||||
if (m_HLDataPass1[iii].beginStart > _endPos) {
|
if (m_HLDataPass1[iii].start > _endPos) {
|
||||||
_stopId = iii;
|
_stopId = iii;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -855,39 +860,39 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
|
void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
|
||||||
if (NULL == m_highlight) {
|
if (nullptr == m_highlight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
|
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
|
||||||
m_highlight->parse(_pos, _endPos, m_HLDataPass1, _addingPos, m_data);
|
m_highlight->parse(_pos, _endPos, m_HLDataPass1, _addingPos, m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::cleanHighLight(void) {
|
void appl::Buffer::cleanHighLight() {
|
||||||
// remove all element in the list...
|
// remove all element in the list...
|
||||||
m_HLDataPass1.clear();
|
m_HLDataPass1.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
|
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
|
||||||
int32_t start = etk_max(0, _starPos-1);
|
int32_t start = std::max((int64_t)0, _starPos-1);
|
||||||
for (int32_t iii = start; iii < m_HLDataPass1.size(); ++iii) {
|
for (size_t iii = start; iii < m_HLDataPass1.size(); ++iii) {
|
||||||
_starPos = iii;
|
_starPos = iii;
|
||||||
if ( m_HLDataPass1[iii].beginStart <= _pos
|
if ( m_HLDataPass1[iii].start <= _pos
|
||||||
&& m_HLDataPass1[iii].endStop > _pos) {
|
&& m_HLDataPass1[iii].stop > _pos) {
|
||||||
return &m_HLDataPass1[iii];
|
return &m_HLDataPass1[iii];
|
||||||
}
|
}
|
||||||
if(m_HLDataPass1[iii].beginStart > _pos) {
|
if(m_HLDataPass1[iii].start > _pos) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) {
|
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) {
|
||||||
_MData.posHLPass1 = 0;
|
_MData.posHLPass1 = 0;
|
||||||
_MData.posHLPass2 = 0;
|
_MData.posHLPass2 = 0;
|
||||||
if (NULL == m_highlight) {
|
if (nullptr == m_highlight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//int64_t timeStart = ewol::getTime();
|
//int64_t timeStart = ewol::getTime();
|
||||||
@@ -907,24 +912,24 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
|||||||
endSearch = m_HLDataPass1.size();
|
endSearch = m_HLDataPass1.size();
|
||||||
}
|
}
|
||||||
int64_t kkk;
|
int64_t kkk;
|
||||||
for (kkk = etk_max(startId, 0); kkk < endSearch; ++kkk) {
|
for (kkk = std::max(startId, (int64_t)0); kkk < endSearch; ++kkk) {
|
||||||
// empty section :
|
// empty section :
|
||||||
if (kkk == 0) {
|
if (kkk == 0) {
|
||||||
if (HLStartPos < m_HLDataPass1[kkk].beginStart) {
|
if (HLStartPos < m_HLDataPass1[kkk].start) {
|
||||||
APPL_VERBOSE(" == > (empty section 1 ) kkk=" << kkk <<
|
APPL_VERBOSE(" == > (empty section 1 ) kkk=" << kkk <<
|
||||||
" start=" << HLStartPos <<
|
" start=" << HLStartPos <<
|
||||||
" stop=" << m_HLDataPass1[kkk].beginStart );
|
" stop=" << m_HLDataPass1[kkk].start );
|
||||||
m_highlight->parse2(HLStartPos,
|
m_highlight->parse2(HLStartPos,
|
||||||
m_HLDataPass1[kkk].beginStart,
|
m_HLDataPass1[kkk].start,
|
||||||
_MData.HLData,
|
_MData.HLData,
|
||||||
m_data);
|
m_data);
|
||||||
} // else : nothing to do ...
|
} // else : nothing to do ...
|
||||||
} else {
|
} else {
|
||||||
APPL_VERBOSE(" == > (empty section 2 ) kkk=" << kkk <<
|
APPL_VERBOSE(" == > (empty section 2 ) kkk=" << kkk <<
|
||||||
" start=" << m_HLDataPass1[kkk-1].endStop <<
|
" start=" << m_HLDataPass1[kkk-1].stop <<
|
||||||
" stop=" << m_HLDataPass1[kkk].beginStart );
|
" stop=" << m_HLDataPass1[kkk].start );
|
||||||
m_highlight->parse2(m_HLDataPass1[kkk-1].endStop,
|
m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
|
||||||
m_HLDataPass1[kkk].beginStart,
|
m_HLDataPass1[kkk].start,
|
||||||
_MData.HLData,
|
_MData.HLData,
|
||||||
m_data);
|
m_data);
|
||||||
}
|
}
|
||||||
@@ -936,9 +941,9 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
|||||||
//if( k < (int32_t)m_HLDataPass1.size()) {
|
//if( k < (int32_t)m_HLDataPass1.size()) {
|
||||||
if (m_HLDataPass1.size() != 0) {
|
if (m_HLDataPass1.size() != 0) {
|
||||||
APPL_VERBOSE(" == > (empty section 3 ) kkk=" << kkk <<
|
APPL_VERBOSE(" == > (empty section 3 ) kkk=" << kkk <<
|
||||||
" start=" << m_HLDataPass1[kkk-1].endStop <<
|
" start=" << m_HLDataPass1[kkk-1].stop <<
|
||||||
" stop=" << HLStop );
|
" stop=" << HLStop );
|
||||||
m_highlight->parse2(m_HLDataPass1[kkk-1].endStop,
|
m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
|
||||||
HLStop,
|
HLStop,
|
||||||
_MData.HLData,
|
_MData.HLData,
|
||||||
m_data);
|
m_data);
|
||||||
@@ -959,22 +964,22 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
|||||||
|
|
||||||
|
|
||||||
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos) {
|
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos) {
|
||||||
int64_t start = etk_max(0, _MData.posHLPass2-1);
|
int64_t start = std::max((int64_t)0, _MData.posHLPass2-1);
|
||||||
for (int64_t iii=start; iii<(int32_t)_MData.HLData.size(); iii++) {
|
for (int64_t iii=start; iii<(int32_t)_MData.HLData.size(); iii++) {
|
||||||
_MData.posHLPass2 = iii;
|
_MData.posHLPass2 = iii;
|
||||||
if( _MData.HLData[iii].beginStart <= _pos
|
if( _MData.HLData[iii].start <= _pos
|
||||||
&& _MData.HLData[iii].endStop > _pos)
|
&& _MData.HLData[iii].stop > _pos)
|
||||||
{
|
{
|
||||||
return &_MData.HLData[iii];
|
return &_MData.HLData[iii];
|
||||||
}
|
}
|
||||||
if(_MData.HLData[iii].beginStart > _pos) {
|
if(_MData.HLData[iii].start > _pos) {
|
||||||
return getElementColorAtPosition(_pos, _MData.posHLPass1);
|
return getElementColorAtPosition(_pos, _MData.posHLPass1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getElementColorAtPosition(_pos, _MData.posHLPass1);
|
return getElementColorAtPosition(_pos, _MData.posHLPass1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t appl::Buffer::getCursorLinesId(void) {
|
uint32_t appl::Buffer::getCursorLinesId() {
|
||||||
if (m_data.size() == 0) {
|
if (m_data.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -987,4 +992,4 @@ uint32_t appl::Buffer::getCursorLinesId(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@@ -38,9 +38,9 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Basic itarator constructor with no link.
|
* @brief Basic itarator constructor with no link.
|
||||||
*/
|
*/
|
||||||
Iterator(void):
|
Iterator():
|
||||||
m_current(0),
|
m_current(0),
|
||||||
m_data(NULL),
|
m_data(nullptr),
|
||||||
m_value(u32char::Null) {
|
m_value(u32char::Null) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
@@ -68,17 +68,17 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Basic destructor
|
* @brief Basic destructor
|
||||||
*/
|
*/
|
||||||
~Iterator(void) {
|
virtual ~Iterator() {
|
||||||
m_current = 0;
|
m_current = 0;
|
||||||
m_data = NULL;
|
m_data = nullptr;
|
||||||
m_value = u32char::Null;
|
m_value = u32char::Null;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief basic boolean cast
|
* @brief basic boolean cast
|
||||||
* @return true if the element is present in buffer
|
* @return true if the element is present in buffer
|
||||||
*/
|
*/
|
||||||
operator bool (void) const {
|
operator bool () const {
|
||||||
if (m_data == NULL) {
|
if (m_data == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_current >= m_data->m_data.size()) {
|
if (m_current >= m_data->m_data.size()) {
|
||||||
@@ -93,8 +93,8 @@ namespace appl {
|
|||||||
* @brief basic boolean cast
|
* @brief basic boolean cast
|
||||||
* @return true if the element is present in buffer
|
* @return true if the element is present in buffer
|
||||||
*/
|
*/
|
||||||
operator int64_t (void) const {
|
operator int64_t () const {
|
||||||
if (m_data == NULL) {
|
if (m_data == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (m_current < 0) {
|
if (m_current < 0) {
|
||||||
@@ -109,12 +109,12 @@ namespace appl {
|
|||||||
* @brief Incremental operator
|
* @brief Incremental operator
|
||||||
* @return Reference on the current iterator incremented
|
* @return Reference on the current iterator incremented
|
||||||
*/
|
*/
|
||||||
Iterator& operator++ (void);
|
Iterator& operator++ ();
|
||||||
/**
|
/**
|
||||||
* @brief Decremental operator
|
* @brief Decremental operator
|
||||||
* @return Reference on the current iterator decremented
|
* @return Reference on the current iterator decremented
|
||||||
*/
|
*/
|
||||||
Iterator& operator-- (void);
|
Iterator& operator-- ();
|
||||||
/**
|
/**
|
||||||
* @brief Incremental operator
|
* @brief Incremental operator
|
||||||
* @return Reference on a new iterator and increment the other one
|
* @return Reference on a new iterator and increment the other one
|
||||||
@@ -211,13 +211,13 @@ namespace appl {
|
|||||||
* @brief Get the value on the current element
|
* @brief Get the value on the current element
|
||||||
* @return The request element value
|
* @return The request element value
|
||||||
*/
|
*/
|
||||||
char32_t operator* (void);
|
char32_t operator* ();
|
||||||
/**
|
/**
|
||||||
* @brief Get the position in the buffer
|
* @brief Get the position in the buffer
|
||||||
* @return The requested position.
|
* @return The requested position.
|
||||||
*/
|
*/
|
||||||
int64_t getPos(void) const {
|
int64_t getPos() const {
|
||||||
if (m_data == NULL) {
|
if (m_data == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (m_current < 0) {
|
if (m_current < 0) {
|
||||||
@@ -248,7 +248,7 @@ namespace appl {
|
|||||||
};
|
};
|
||||||
Iterator operator+ (const size_t _val) const {
|
Iterator operator+ (const size_t _val) const {
|
||||||
Iterator tmpp(*this);
|
Iterator tmpp(*this);
|
||||||
for (int64_t iii=0; iii<_val; ++iii) {
|
for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
|
||||||
++tmpp;
|
++tmpp;
|
||||||
}
|
}
|
||||||
return tmpp;
|
return tmpp;
|
||||||
@@ -273,7 +273,7 @@ namespace appl {
|
|||||||
};
|
};
|
||||||
Iterator operator- (const size_t _val) const {
|
Iterator operator- (const size_t _val) const {
|
||||||
Iterator tmpp(*this);
|
Iterator tmpp(*this);
|
||||||
for (int64_t iii=0; iii<_val; ++iii) {
|
for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
|
||||||
--tmpp;
|
--tmpp;
|
||||||
}
|
}
|
||||||
return tmpp;
|
return tmpp;
|
||||||
@@ -292,9 +292,12 @@ namespace appl {
|
|||||||
static const char* const eventIsSave;
|
static const char* const eventIsSave;
|
||||||
static const char* const eventSelectChange;
|
static const char* const eventSelectChange;
|
||||||
static const char* const eventChangeName;
|
static const char* const eventChangeName;
|
||||||
|
protected:
|
||||||
|
Buffer();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
Buffer(void);
|
DECLARE_FACTORY(Buffer);
|
||||||
~Buffer(void);
|
virtual ~Buffer();
|
||||||
private:
|
private:
|
||||||
bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ...
|
bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ...
|
||||||
std::string m_fileName; //!< name of the file (with his path)
|
std::string m_fileName; //!< name of the file (with his path)
|
||||||
@@ -302,14 +305,14 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief get the curent filename of the Buffer
|
* @brief get the curent filename of the Buffer
|
||||||
*/
|
*/
|
||||||
const std::string& getFileName(void) {
|
const std::string& getFileName() {
|
||||||
return m_fileName;
|
return m_fileName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Check if the buffer has a real filename.
|
* @brief Check if the buffer has a real filename.
|
||||||
* @return the status of the existance of a name.
|
* @return the status of the existance of a name.
|
||||||
*/
|
*/
|
||||||
bool hasFileName(void) {
|
bool hasFileName() {
|
||||||
return m_hasFileName;
|
return m_hasFileName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -327,7 +330,7 @@ namespace appl {
|
|||||||
* @brief save the file in the specify path.
|
* @brief save the file in the specify path.
|
||||||
* @return true is saving well done
|
* @return true is saving well done
|
||||||
*/
|
*/
|
||||||
bool storeFile(void);
|
bool storeFile();
|
||||||
protected:
|
protected:
|
||||||
bool m_isModify; //!< true if the file is modify
|
bool m_isModify; //!< true if the file is modify
|
||||||
public:
|
public:
|
||||||
@@ -335,7 +338,7 @@ namespace appl {
|
|||||||
* @breif get the status of file modification.
|
* @breif get the status of file modification.
|
||||||
* @return true if file is modify.
|
* @return true if file is modify.
|
||||||
*/
|
*/
|
||||||
bool isModify(void) {
|
bool isModify() {
|
||||||
return m_isModify;
|
return m_isModify;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -346,7 +349,7 @@ namespace appl {
|
|||||||
protected:
|
protected:
|
||||||
etk::Buffer m_data; //!< copy of the file buffer
|
etk::Buffer m_data; //!< copy of the file buffer
|
||||||
public:
|
public:
|
||||||
etk::Buffer& getData(void) {
|
etk::Buffer& getData() {
|
||||||
return m_data;
|
return m_data;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
@@ -364,31 +367,31 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Remove Selection of the buffer.
|
* @brief Remove Selection of the buffer.
|
||||||
*/
|
*/
|
||||||
void unSelect(void);
|
void unSelect();
|
||||||
/**
|
/**
|
||||||
* @brief Remove the selection of the buffer. (do nothing if no secection)
|
* @brief Remove the selection of the buffer. (do nothing if no secection)
|
||||||
*/
|
*/
|
||||||
void removeSelection(void);
|
void removeSelection();
|
||||||
/**
|
/**
|
||||||
* @brief Get the status of selection.
|
* @brief Get the status of selection.
|
||||||
* @return true if we have a curent selection, false otherwise.
|
* @return true if we have a curent selection, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool hasTextSelected(void) {
|
bool hasTextSelected() {
|
||||||
return m_cursorSelectPos >= 0;
|
return m_cursorSelectPos >= 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get the Start position of the selection.
|
* @brief Get the Start position of the selection.
|
||||||
* @return position of the start selection.
|
* @return position of the start selection.
|
||||||
*/
|
*/
|
||||||
int64_t getStartSelectionPos(void) {
|
int64_t getStartSelectionPos() {
|
||||||
return etk_min(m_cursorPos, m_cursorSelectPos);
|
return std::min(m_cursorPos, m_cursorSelectPos);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get the Stop position of the selection.
|
* @brief Get the Stop position of the selection.
|
||||||
* @return position of the stop selection.
|
* @return position of the stop selection.
|
||||||
*/
|
*/
|
||||||
int64_t getStopSelectionPos(void) {
|
int64_t getStopSelectionPos() {
|
||||||
return etk_max(m_cursorPos, m_cursorSelectPos);
|
return std::max(m_cursorPos, m_cursorSelectPos);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
float m_cursorPreferredCol; //!< position of the cursor when up and down is done.
|
float m_cursorPreferredCol; //!< position of the cursor when up and down is done.
|
||||||
@@ -404,7 +407,7 @@ namespace appl {
|
|||||||
* @brief Get the favorite distance from the left screen (For up and down moving).
|
* @brief Get the favorite distance from the left screen (For up and down moving).
|
||||||
* @return The distance in pixels.
|
* @return The distance in pixels.
|
||||||
*/
|
*/
|
||||||
float getFavoriteUpDownPos(void) {
|
float getFavoriteUpDownPos() {
|
||||||
return m_cursorPreferredCol;
|
return m_cursorPreferredCol;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -421,7 +424,7 @@ namespace appl {
|
|||||||
* @brief Get the selection mode (if true, the move event creata a selection)
|
* @brief Get the selection mode (if true, the move event creata a selection)
|
||||||
* @return The selecting mode.
|
* @return The selecting mode.
|
||||||
*/
|
*/
|
||||||
bool getSelectMode(void) {
|
bool getSelectMode() {
|
||||||
return m_selectMode;
|
return m_selectMode;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
@@ -544,27 +547,27 @@ namespace appl {
|
|||||||
* @brief Get an Iterator on the start position.
|
* @brief Get an Iterator on the start position.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator begin(void);
|
Iterator begin();
|
||||||
/**
|
/**
|
||||||
* @brief Get an Iterator on the end position.
|
* @brief Get an Iterator on the end position.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator end(void);
|
Iterator end();
|
||||||
/**
|
/**
|
||||||
* @brief Get an Iterator on the cursor position.
|
* @brief Get an Iterator on the cursor position.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator cursor(void);
|
Iterator cursor();
|
||||||
/**
|
/**
|
||||||
* @brief Get an Iterator on the start selection.
|
* @brief Get an Iterator on the start selection.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator selectStart(void);
|
Iterator selectStart();
|
||||||
/**
|
/**
|
||||||
* @brief Get an Iterator on the stop selection.
|
* @brief Get an Iterator on the stop selection.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
Iterator selectStop(void);
|
Iterator selectStop();
|
||||||
protected:
|
protected:
|
||||||
int32_t m_nbLines; //!< number of line in the buffer
|
int32_t m_nbLines; //!< number of line in the buffer
|
||||||
public:
|
public:
|
||||||
@@ -572,29 +575,29 @@ namespace appl {
|
|||||||
* @brief Get the number of line in the buffer.
|
* @brief Get the number of line in the buffer.
|
||||||
* @return number of line in the Buffer.
|
* @return number of line in the Buffer.
|
||||||
*/
|
*/
|
||||||
int32_t getNumberOfLines(void) {
|
int32_t getNumberOfLines() {
|
||||||
return m_nbLines;
|
return m_nbLines;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get the cursor line numberin the buffer.
|
* @brief Get the cursor line numberin the buffer.
|
||||||
* @return the line id in the Buffer.
|
* @return the line id in the Buffer.
|
||||||
*/
|
*/
|
||||||
uint32_t getCursorLinesId(void);
|
uint32_t getCursorLinesId();
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Count the number of line in the buffer
|
* @brief Count the number of line in the buffer
|
||||||
*/
|
*/
|
||||||
void countNumberofLine(void);
|
void countNumberofLine();
|
||||||
protected:
|
protected:
|
||||||
std::string m_highlightType; //!< Name of the highlight type
|
std::string m_highlightType; //!< Name of the highlight type
|
||||||
|
|
||||||
appl::Highlight* m_highlight; //!< internal link with the Highlight system
|
std::shared_ptr<appl::Highlight> m_highlight; //!< internal link with the Highlight system
|
||||||
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Find the Highligh capability
|
* @brief Find the Highligh capability
|
||||||
*/
|
*/
|
||||||
void tryFindHighlightType(void);
|
void tryFindHighlightType();
|
||||||
/**
|
/**
|
||||||
* @brief Set type of highlight
|
* @brief Set type of highlight
|
||||||
* @param[in] _type type of the highlight
|
* @param[in] _type type of the highlight
|
||||||
@@ -604,7 +607,7 @@ namespace appl {
|
|||||||
* @brief Get type of highlight
|
* @brief Get type of highlight
|
||||||
* @return Type of the highlight
|
* @return Type of the highlight
|
||||||
*/
|
*/
|
||||||
const std::string& setHighlightType(void) {
|
const std::string& setHighlightType() {
|
||||||
return m_highlightType;
|
return m_highlightType;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -615,7 +618,7 @@ namespace appl {
|
|||||||
int64_t& _stopId,
|
int64_t& _stopId,
|
||||||
bool _backPreviousNotEnded);
|
bool _backPreviousNotEnded);
|
||||||
void generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos=0);
|
void generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos=0);
|
||||||
void cleanHighLight(void);
|
void cleanHighLight();
|
||||||
appl::HighlightInfo* getElementColorAtPosition(int64_t _pos, int64_t &_starPos);
|
appl::HighlightInfo* getElementColorAtPosition(int64_t _pos, int64_t &_starPos);
|
||||||
void hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines);
|
void hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines);
|
||||||
appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos);
|
appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos);
|
||||||
|
@@ -6,10 +6,11 @@
|
|||||||
* @license GPL v3 (see license file)
|
* @license GPL v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <etk/os/FSNode.h>
|
||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
#include <appl/global.h>
|
#include <appl/global.h>
|
||||||
#include <appl/BufferManager.h>
|
#include <appl/BufferManager.h>
|
||||||
#include <etk/types.h>
|
|
||||||
#include <ewol/object/Object.h>
|
#include <ewol/object/Object.h>
|
||||||
#include <ewol/object/Manager.h>
|
#include <ewol/object/Manager.h>
|
||||||
#include <ewol/resource/Manager.h>
|
#include <ewol/resource/Manager.h>
|
||||||
@@ -17,89 +18,79 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "BufferManager"
|
#define __class__ "BufferManager"
|
||||||
|
|
||||||
appl::BufferManager::BufferManager(void) :
|
appl::BufferManager::BufferManager() {
|
||||||
ewol::Resource("???BufferManager???"),
|
|
||||||
m_bufferSelected(NULL) {
|
|
||||||
addObjectType("appl::BufferManager");
|
addObjectType("appl::BufferManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::BufferManager::~BufferManager(void) {
|
void appl::BufferManager::init(const std::string& _uniqueName) {
|
||||||
int32_t previousCount = m_list.size();
|
ewol::Resource::init(_uniqueName);
|
||||||
for (int32_t iii = m_list.size()-1; iii >= 0 ; --iii) {
|
}
|
||||||
if (m_list[iii] == NULL) {
|
|
||||||
continue;
|
appl::BufferManager::~BufferManager() {
|
||||||
}
|
|
||||||
delete(m_list[iii]);
|
|
||||||
if (previousCount == m_list.size()) {
|
|
||||||
APPL_ERROR("Error in removing buffer !! ");
|
|
||||||
}
|
|
||||||
previousCount = m_list.size();
|
|
||||||
}
|
|
||||||
m_list.clear();
|
m_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::Buffer* appl::BufferManager::createNewBuffer(void) {
|
std::shared_ptr<appl::Buffer> appl::BufferManager::createNewBuffer() {
|
||||||
appl::Buffer* tmp = new appl::Buffer();
|
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
|
||||||
if (tmp == NULL) {
|
if (tmp == nullptr) {
|
||||||
APPL_ERROR("Can not allocate the Buffer (empty).");
|
APPL_ERROR("Can not allocate the Buffer (empty).");
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
m_list.push_back(tmp);
|
m_list.push_back(tmp);
|
||||||
sendMultiCast(appl::MsgSelectNewFile, tmp->getFileName());
|
sendMultiCast(appl::MsgSelectNewFile, tmp->getFileName());
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
|
std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
|
||||||
for (int32_t iii = 0; iii < m_list.size(); ++iii) {
|
APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")");
|
||||||
if (m_list[iii] == NULL) {
|
for (auto &it : m_list) {
|
||||||
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_list[iii]->getFileName() == _fileName) {
|
if (it->getFileName() == _fileName) {
|
||||||
return m_list[iii];
|
return it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_createIfNeeded == true) {
|
if (_createIfNeeded == true) {
|
||||||
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) {
|
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) {
|
||||||
APPL_INFO("try open a folder : " << _fileName);
|
APPL_WARNING("try open a folder : " << _fileName);
|
||||||
return NULL;
|
APPL_CRITICAL("plop");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
appl::Buffer* tmp = new appl::Buffer();
|
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
|
||||||
if (tmp == NULL) {
|
if (tmp == nullptr) {
|
||||||
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
|
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
tmp->loadFile(_fileName);
|
tmp->loadFile(_fileName);
|
||||||
m_list.push_back(tmp);
|
m_list.push_back(tmp);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
void appl::BufferManager::setBufferSelected(appl::Buffer* _bufferSelected) {
|
void appl::BufferManager::setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected) {
|
||||||
m_bufferSelected = _bufferSelected;
|
m_bufferSelected = _bufferSelected;
|
||||||
sendMultiCast(appl::MsgSelectChange, "");
|
sendMultiCast(appl::MsgSelectChange, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::BufferManager::onObjectRemove(ewol::Object * _removeObject) {
|
std::shared_ptr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
|
||||||
if (m_bufferSelected == _removeObject) {
|
int32_t id = 0;
|
||||||
setBufferSelected(NULL);
|
for (auto &it : m_list) {
|
||||||
}
|
if (id == _id) {
|
||||||
for (int32_t iii = 0; iii < m_list.size(); ++iii) {
|
return it;
|
||||||
if (m_list[iii] != _removeObject) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
m_list[iii] = NULL;
|
id++;
|
||||||
m_list.erase(m_list.begin()+iii);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return m_list.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::BufferManager::exist(const std::string& _fileName) {
|
bool appl::BufferManager::exist(const std::string& _fileName) {
|
||||||
for (int32_t iii = 0; iii < m_list.size(); ++iii) {
|
for (auto &it : m_list) {
|
||||||
if (m_list[iii] == NULL) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_list[iii]->getFileName() == _fileName) {
|
if (it->getFileName() == _fileName) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +101,7 @@ void appl::BufferManager::open(const std::string& _fileName) {
|
|||||||
if (exist(_fileName) == true) {
|
if (exist(_fileName) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (get(_fileName, true) == NULL) {
|
if (get(_fileName, true) == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendMultiCast(appl::MsgSelectNewFile, _fileName);
|
sendMultiCast(appl::MsgSelectNewFile, _fileName);
|
||||||
@@ -120,28 +111,3 @@ void appl::BufferManager::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
APPL_DEBUG("receive message !!! " << _msg);
|
APPL_DEBUG("receive message !!! " << _msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::BufferManager* appl::BufferManager::keep(void) {
|
|
||||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
|
||||||
appl::BufferManager* object = static_cast<appl::BufferManager*>(getManager().localKeep("???BufferManager???"));
|
|
||||||
if (NULL != object) {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
// this element create a new one every time ....
|
|
||||||
EWOL_INFO("CREATE : appl::BufferManager: ???BufferManager???");
|
|
||||||
object = new appl::BufferManager();
|
|
||||||
if (NULL == object) {
|
|
||||||
EWOL_ERROR("allocation error of a resource : ???BufferManager???");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
getManager().localAdd(object);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::BufferManager::release(appl::BufferManager*& _object) {
|
|
||||||
if (NULL == _object) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
|
||||||
getManager().release(object2);
|
|
||||||
_object = NULL;
|
|
||||||
}
|
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#ifndef __BUFFER_MANAGER_H__
|
#ifndef __BUFFER_MANAGER_H__
|
||||||
#define __BUFFER_MANAGER_H__
|
#define __BUFFER_MANAGER_H__
|
||||||
|
|
||||||
|
#include <list>
|
||||||
#include <appl/Buffer.h>
|
#include <appl/Buffer.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
@@ -16,11 +17,14 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class BufferManager : public ewol::Resource {
|
class BufferManager : public ewol::Resource {
|
||||||
protected:
|
public:
|
||||||
BufferManager(void);
|
BufferManager();
|
||||||
~BufferManager(void);
|
void init(const std::string& _uniqueName);
|
||||||
|
public:
|
||||||
|
DECLARE_RESOURCE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
|
||||||
|
virtual ~BufferManager();
|
||||||
private:
|
private:
|
||||||
std::vector<appl::Buffer*> m_list; // list of all buffer curently open
|
std::list<std::shared_ptr<appl::Buffer>> m_list; // list of all buffer curently open
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get a specific buffer with his name (can create a new buffer).
|
* @brief Get a specific buffer with his name (can create a new buffer).
|
||||||
@@ -28,7 +32,7 @@ namespace appl {
|
|||||||
* @param[in] _createIfNeeded Create the buffer if not existed.
|
* @param[in] _createIfNeeded Create the buffer if not existed.
|
||||||
* @return a pointer on the buffer
|
* @return a pointer on the buffer
|
||||||
*/
|
*/
|
||||||
appl::Buffer* get(const std::string& _fileName, bool _createIfNeeded=false);
|
std::shared_ptr<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
|
||||||
/**
|
/**
|
||||||
* @brief Load a specific file, event if it not existed:
|
* @brief Load a specific file, event if it not existed:
|
||||||
* @param[in] _fileName Name of the file to open or create.
|
* @param[in] _fileName Name of the file to open or create.
|
||||||
@@ -44,7 +48,7 @@ namespace appl {
|
|||||||
* @brief Get count of all buffer availlable.
|
* @brief Get count of all buffer availlable.
|
||||||
* @return Number of buffer
|
* @return Number of buffer
|
||||||
*/
|
*/
|
||||||
int32_t size(void) const {
|
int32_t size() const {
|
||||||
return m_list.size();
|
return m_list.size();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -52,45 +56,29 @@ namespace appl {
|
|||||||
* @param[in] _id Number of buffer
|
* @param[in] _id Number of buffer
|
||||||
* @return pointer on the buffer
|
* @return pointer on the buffer
|
||||||
*/
|
*/
|
||||||
appl::Buffer* get(int32_t _id) {
|
std::shared_ptr<appl::Buffer> get(int32_t _id);
|
||||||
return m_list[_id];
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a new buffer empty.
|
* @brief Create a new buffer empty.
|
||||||
* @return Created buffer or NULL.
|
* @return Created buffer or nullptr.
|
||||||
*/
|
*/
|
||||||
appl::Buffer* createNewBuffer(void);
|
std::shared_ptr<appl::Buffer> createNewBuffer();
|
||||||
private:
|
private:
|
||||||
appl::Buffer* m_bufferSelected;
|
std::shared_ptr<appl::Buffer> m_bufferSelected;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Set the current buffer selected
|
* @brief Set the current buffer selected
|
||||||
* @param[in] _bufferSelected Pointer on the buffer selected
|
* @param[in] _bufferSelected Pointer on the buffer selected
|
||||||
*/
|
*/
|
||||||
void setBufferSelected(appl::Buffer* _bufferSelected);
|
void setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected);
|
||||||
/**
|
/**
|
||||||
* @brief Get the current buffer selected
|
* @brief Get the current buffer selected
|
||||||
* @return Pointer on the buffer selected
|
* @return Pointer on the buffer selected
|
||||||
*/
|
*/
|
||||||
appl::Buffer* getBufferSelected(void) {
|
std::shared_ptr<appl::Buffer> getBufferSelected() {
|
||||||
return m_bufferSelected;
|
return m_bufferSelected;
|
||||||
};
|
};
|
||||||
public: // herited function
|
public: // herited function
|
||||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
public: // resource manager
|
|
||||||
/**
|
|
||||||
* @brief keep the resource pointer.
|
|
||||||
* @note Never free this pointer by your own...
|
|
||||||
* @param[in] _filename Name of the configuration file.
|
|
||||||
* @return pointer on the resource or NULL if an error occured.
|
|
||||||
*/
|
|
||||||
static appl::BufferManager* keep(void);
|
|
||||||
/**
|
|
||||||
* @brief release the keeped resources
|
|
||||||
* @param[in,out] reference on the object pointer
|
|
||||||
*/
|
|
||||||
static void release(appl::BufferManager*& _object);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ void appl::GlyphDecoration::setBold(bool _enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::CCout& appl::operator <<(etk::CCout& _os, const appl::GlyphDecoration& _obj)
|
std::ostream& appl::operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj)
|
||||||
{
|
{
|
||||||
_os << "{fg=" << _obj.getForeground();
|
_os << "{fg=" << _obj.getForeground();
|
||||||
_os << ",bg=" << _obj.getBackground();
|
_os << ",bg=" << _obj.getBackground();
|
||||||
|
@@ -17,7 +17,7 @@ namespace appl {
|
|||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
GlyphDecoration(const std::string& _newColorName = "no_name");
|
GlyphDecoration(const std::string& _newColorName = "no_name");
|
||||||
~GlyphDecoration(void) {
|
virtual ~GlyphDecoration() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@@ -34,7 +34,7 @@ namespace appl {
|
|||||||
* @brief Get the color name.
|
* @brief Get the color name.
|
||||||
* @return The name of the color.
|
* @return The name of the color.
|
||||||
*/
|
*/
|
||||||
const std::string& getName(void) const {
|
const std::string& getName() const {
|
||||||
return m_colorName;
|
return m_colorName;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@@ -51,14 +51,14 @@ namespace appl {
|
|||||||
* @brief Get the foreground color.
|
* @brief Get the foreground color.
|
||||||
* @return The color.
|
* @return The color.
|
||||||
*/
|
*/
|
||||||
const etk::Color<>& getForeground(void) const {
|
const etk::Color<>& getForeground() const {
|
||||||
return m_colorFG;
|
return m_colorFG;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the foreground color status.
|
* @brief Get the foreground color status.
|
||||||
* @return true if the color is visible.
|
* @return true if the color is visible.
|
||||||
*/
|
*/
|
||||||
bool haveFg(void) const {
|
bool haveFg() const {
|
||||||
return m_colorFG.a() != 0;
|
return m_colorFG.a() != 0;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@@ -75,14 +75,14 @@ namespace appl {
|
|||||||
* @brief Get the background color.
|
* @brief Get the background color.
|
||||||
* @return The color.
|
* @return The color.
|
||||||
*/
|
*/
|
||||||
const etk::Color<>& getBackground(void) const {
|
const etk::Color<>& getBackground() const {
|
||||||
return m_colorBG;
|
return m_colorBG;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the background color status.
|
* @brief Get the background color status.
|
||||||
* @return true if the color is visible.
|
* @return true if the color is visible.
|
||||||
*/
|
*/
|
||||||
bool haveBackground(void) const {
|
bool haveBackground() const {
|
||||||
return m_colorBG.a()!=0;
|
return m_colorBG.a()!=0;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@@ -97,7 +97,7 @@ namespace appl {
|
|||||||
* @brief Get the italic status.
|
* @brief Get the italic status.
|
||||||
* @return true if the glyph might be display in italic.
|
* @return true if the glyph might be display in italic.
|
||||||
*/
|
*/
|
||||||
bool getItalic(void) const {
|
bool getItalic() const {
|
||||||
return m_italic;
|
return m_italic;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
@@ -112,11 +112,11 @@ namespace appl {
|
|||||||
* @brief Get the bold status.
|
* @brief Get the bold status.
|
||||||
* @return true if the glyph might be display in bold.
|
* @return true if the glyph might be display in bold.
|
||||||
*/
|
*/
|
||||||
bool getBold(void) const {
|
bool getBold() const {
|
||||||
return m_bold;
|
return m_bold;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
etk::CCout& operator <<(etk::CCout& _os, const appl::GlyphDecoration& _obj);
|
std::ostream& operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -18,18 +18,21 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
appl::GlyphPainting::GlyphPainting(const std::string& _filename) :
|
appl::GlyphPainting::GlyphPainting() {
|
||||||
ewol::Resource(_filename) {
|
|
||||||
addObjectType("appl::GlyphPainting");
|
addObjectType("appl::GlyphPainting");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::GlyphPainting::init(const std::string& _filename) {
|
||||||
|
ewol::Resource::init(_filename);
|
||||||
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
|
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::GlyphPainting::~GlyphPainting(void) {
|
appl::GlyphPainting::~GlyphPainting() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::GlyphPainting::reload(void) {
|
void appl::GlyphPainting::reload() {
|
||||||
ejson::Document doc;
|
ejson::Document doc;
|
||||||
if (false == doc.load(m_name)) {
|
if (false == doc.load(m_name)) {
|
||||||
APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName());
|
APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName());
|
||||||
@@ -43,13 +46,13 @@ void appl::GlyphPainting::reload(void) {
|
|||||||
APPL_DEBUG(tmppppp);
|
APPL_DEBUG(tmppppp);
|
||||||
*/
|
*/
|
||||||
ejson::Array* baseArray = doc.getArray("ednColor");
|
ejson::Array* baseArray = doc.getArray("ednColor");
|
||||||
if (baseArray == NULL) {
|
if (baseArray == nullptr) {
|
||||||
APPL_ERROR("Can not get basic array : 'ednColor'");
|
APPL_ERROR("Can not get basic array : 'ednColor'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii = 0; iii < baseArray->size(); ++iii) {
|
for (size_t iii = 0; iii < baseArray->size(); ++iii) {
|
||||||
ejson::Object* tmpObj = baseArray->getObject(iii);
|
ejson::Object* tmpObj = baseArray->getObject(iii);
|
||||||
if (tmpObj == NULL) {
|
if (tmpObj == nullptr) {
|
||||||
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
|
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -60,7 +63,7 @@ void appl::GlyphPainting::reload(void) {
|
|||||||
bool bold = tmpObj->getBooleanValue("bold", false);
|
bool bold = tmpObj->getBooleanValue("bold", false);
|
||||||
APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'");
|
APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'");
|
||||||
bool findElement = false;
|
bool findElement = false;
|
||||||
for (int32_t jjj=0; jjj<m_list.size(); ++jjj) {
|
for (size_t jjj=0; jjj<m_list.size(); ++jjj) {
|
||||||
if (m_list[jjj].getName() != name) {
|
if (m_list[jjj].getName() != name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -84,7 +87,7 @@ void appl::GlyphPainting::reload(void) {
|
|||||||
|
|
||||||
|
|
||||||
int32_t appl::GlyphPainting::request(const std::string& _name) {
|
int32_t appl::GlyphPainting::request(const std::string& _name) {
|
||||||
for (int32_t iii=0; iii<m_list.size(); ++iii) {
|
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||||
if (m_list[iii].getName() == _name) {
|
if (m_list[iii].getName() == _name) {
|
||||||
return iii;
|
return iii;
|
||||||
}
|
}
|
||||||
@@ -94,30 +97,3 @@ int32_t appl::GlyphPainting::request(const std::string& _name) {
|
|||||||
m_list.push_back(tmpDeco);
|
m_list.push_back(tmpDeco);
|
||||||
return m_list.size()-1;
|
return m_list.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::GlyphPainting* appl::GlyphPainting::keep(const std::string& _filename) {
|
|
||||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
|
||||||
appl::GlyphPainting* object = static_cast<appl::GlyphPainting*>(getManager().localKeep(_filename));
|
|
||||||
if (NULL != object) {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
// this element create a new one every time ....
|
|
||||||
EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\"");
|
|
||||||
object = new appl::GlyphPainting(_filename);
|
|
||||||
if (NULL == object) {
|
|
||||||
EWOL_ERROR("allocation error of a resource : ??GlyphPainting??");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
getManager().localAdd(object);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::GlyphPainting::release(appl::GlyphPainting*& _object) {
|
|
||||||
if (NULL == _object) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
|
||||||
getManager().release(object2);
|
|
||||||
_object = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -19,13 +19,16 @@ namespace appl {
|
|||||||
private:
|
private:
|
||||||
std::vector<appl::GlyphDecoration> m_list;
|
std::vector<appl::GlyphDecoration> m_list;
|
||||||
protected:
|
protected:
|
||||||
GlyphPainting(const std::string& _filename);
|
GlyphPainting();
|
||||||
virtual ~GlyphPainting(void);
|
void init(const std::string& _filename);
|
||||||
|
public:
|
||||||
|
DECLARE_RESOURCE_NAMED_FACTORY(GlyphPainting);
|
||||||
|
virtual ~GlyphPainting();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Load or reload data from config
|
* @brief Load or reload data from config
|
||||||
*/
|
*/
|
||||||
void reload(void);
|
void reload();
|
||||||
/**
|
/**
|
||||||
* @brief Register a decoration with his name and get the ref id.
|
* @brief Register a decoration with his name and get the ref id.
|
||||||
* @param[in] _name Name of the deco.
|
* @param[in] _name Name of the deco.
|
||||||
@@ -48,19 +51,6 @@ namespace appl {
|
|||||||
const appl::GlyphDecoration& operator[] (int32_t _pos) const {
|
const appl::GlyphDecoration& operator[] (int32_t _pos) const {
|
||||||
return m_list[_pos];
|
return m_list[_pos];
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief keep the resource pointer.
|
|
||||||
* @note Never free this pointer by your own...
|
|
||||||
* @param[in] _filename Name of the configuration file.
|
|
||||||
* @return pointer on the resource or NULL if an error occured.
|
|
||||||
*/
|
|
||||||
static appl::GlyphPainting* keep(const std::string& _filename);
|
|
||||||
/**
|
|
||||||
* @brief release the keeped resources
|
|
||||||
* @param[in,out] reference on the object pointer
|
|
||||||
*/
|
|
||||||
static void release(appl::GlyphPainting*& _object);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -20,14 +20,14 @@
|
|||||||
static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
|
static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
|
||||||
std::vector<appl::dataBufferStruct *> tmpList = _list;
|
std::vector<appl::dataBufferStruct *> tmpList = _list;
|
||||||
_list.clear();
|
_list.clear();
|
||||||
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
for(size_t iii=0; iii<tmpList.size(); iii++) {
|
||||||
if (NULL == tmpList[iii]) {
|
if (nullptr == tmpList[iii]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int32_t findPos = 0;
|
size_t findPos = 0;
|
||||||
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
|
for(size_t jjj=0; jjj<_list.size(); jjj++) {
|
||||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||||
if (_list[jjj] == NULL) {
|
if (_list[jjj] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
|
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
|
||||||
@@ -39,22 +39,16 @@ static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferView::BufferView(void) :
|
BufferView::BufferView() :
|
||||||
m_openOrderMode(false) {
|
m_openOrderMode(false) {
|
||||||
addObjectType("appl::BufferView");
|
addObjectType("appl::BufferView");
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
registerMultiCast(ednMsgBufferListChange);
|
|
||||||
registerMultiCast(ednMsgBufferState);
|
|
||||||
registerMultiCast(ednMsgBufferId);
|
|
||||||
registerMultiCast(appl::MsgSelectNewFile);
|
|
||||||
registerMultiCast(appl::MsgSelectChange);
|
|
||||||
registerMultiCast(appl::MsgNameChange);
|
|
||||||
m_selectedID = -1;
|
m_selectedID = -1;
|
||||||
m_selectedIdRequested = -1;
|
m_selectedIdRequested = -1;
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
// load color properties
|
// load color properties
|
||||||
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:bufferList.json");
|
m_paintingProperties = appl::GlyphPainting::create("THEME:COLOR:bufferList.json");
|
||||||
// get all id properties ...
|
// get all id properties ...
|
||||||
m_colorBackground1 = m_paintingProperties->request("backgroung1");
|
m_colorBackground1 = m_paintingProperties->request("backgroung1");
|
||||||
m_colorBackground2 = m_paintingProperties->request("backgroung2");
|
m_colorBackground2 = m_paintingProperties->request("backgroung2");
|
||||||
@@ -63,42 +57,47 @@ BufferView::BufferView(void) :
|
|||||||
m_colorTextModify = m_paintingProperties->request("textModify");
|
m_colorTextModify = m_paintingProperties->request("textModify");
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferView::~BufferView(void) {
|
void BufferView::init() {
|
||||||
|
ewol::widget::List::init();
|
||||||
|
registerMultiCast(ednMsgBufferListChange);
|
||||||
|
registerMultiCast(ednMsgBufferState);
|
||||||
|
registerMultiCast(ednMsgBufferId);
|
||||||
|
registerMultiCast(appl::MsgSelectNewFile);
|
||||||
|
registerMultiCast(appl::MsgSelectChange);
|
||||||
|
registerMultiCast(appl::MsgNameChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferView::~BufferView() {
|
||||||
removeAllElement();
|
removeAllElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::removeAllElement(void) {
|
void BufferView::removeAllElement() {
|
||||||
for(int32_t iii=0; iii<m_list.size(); iii++) {
|
for(auto &it : m_list) {
|
||||||
if (NULL!=m_list[iii]) {
|
delete(it);
|
||||||
delete(m_list[iii]);
|
it = nullptr;
|
||||||
m_list[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_list.clear();
|
m_list.clear();
|
||||||
if (m_bufferManager != NULL) {
|
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) {
|
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) {
|
||||||
if (_dataStruct == NULL) {
|
if (_dataStruct == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// alphabetical order:
|
// alphabetical order:
|
||||||
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
||||||
if (m_list[iii] == NULL) {
|
if (m_list[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (std::tolower(m_list[iii]->m_bufferName.getNameFile()) > std::tolower(_dataStruct->m_bufferName.getNameFile())) {
|
if (etk::tolower(m_list[iii]->m_bufferName.getNameFile()) > etk::tolower(_dataStruct->m_bufferName.getNameFile())) {
|
||||||
m_list.insert(m_list.begin() + iii, _dataStruct);
|
m_list.insert(m_list.begin() + iii, _dataStruct);
|
||||||
_dataStruct = NULL;
|
_dataStruct = nullptr;
|
||||||
if (_selectNewPosition == true) {
|
if (_selectNewPosition == true) {
|
||||||
m_selectedID = iii;
|
m_selectedID = iii;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_dataStruct != NULL) {
|
if (_dataStruct != nullptr) {
|
||||||
m_list.push_back(_dataStruct);
|
m_list.push_back(_dataStruct);
|
||||||
if (_selectNewPosition == true) {
|
if (_selectNewPosition == true) {
|
||||||
m_selectedID = m_list.size()-1;
|
m_selectedID = m_list.size()-1;
|
||||||
@@ -108,18 +107,19 @@ void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _sel
|
|||||||
|
|
||||||
|
|
||||||
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||||
|
APPL_VERBOSE("message : " << _msg);
|
||||||
ewol::widget::List::onReceiveMessage(_msg);
|
ewol::widget::List::onReceiveMessage(_msg);
|
||||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||||
appl::Buffer* buffer = m_bufferManager->get(_msg.getData());
|
std::shared_ptr<appl::Buffer> buffer = m_bufferManager->get(_msg.getData());
|
||||||
if (buffer == NULL) {
|
if (buffer == nullptr) {
|
||||||
APPL_ERROR("event on element nor exist : " << _msg.getData());
|
APPL_ERROR("event on element nor exist : " << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buffer->registerOnEvent(this, appl::Buffer::eventIsSave);
|
buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventIsSave);
|
||||||
buffer->registerOnEvent(this, appl::Buffer::eventIsModify);
|
buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventIsModify);
|
||||||
buffer->registerOnEvent(this, appl::Buffer::eventChangeName);
|
buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventChangeName);
|
||||||
appl::dataBufferStruct* tmp = new appl::dataBufferStruct(_msg.getData(), buffer);
|
appl::dataBufferStruct* tmp = new appl::dataBufferStruct(_msg.getData(), buffer);
|
||||||
if (tmp == NULL) {
|
if (tmp == nullptr) {
|
||||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
}
|
}
|
||||||
if (_msg.getMessage() == appl::Buffer::eventChangeName) {
|
if (_msg.getMessage() == appl::Buffer::eventChangeName) {
|
||||||
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
||||||
if (m_list[iii] == NULL) {
|
if (m_list[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) {
|
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) {
|
||||||
@@ -141,9 +141,9 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
if (m_openOrderMode == false) {
|
if (m_openOrderMode == false) {
|
||||||
// re-order the fine in the correct position
|
// re-order the fine in the correct position
|
||||||
appl::dataBufferStruct* tmp = m_list[iii];
|
appl::dataBufferStruct* tmp = m_list[iii];
|
||||||
m_list[iii] = NULL;
|
m_list[iii] = nullptr;
|
||||||
m_list.erase(m_list.begin() + iii);
|
m_list.erase(m_list.begin() + iii);
|
||||||
insertAlphabetic(tmp, (iii == m_selectedID));
|
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,16 +159,15 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
APPL_DEBUG("message : " << _msg);
|
|
||||||
if (_msg.getMessage() == appl::MsgSelectChange) {
|
if (_msg.getMessage() == appl::MsgSelectChange) {
|
||||||
m_selectedID = -1;
|
m_selectedID = -1;
|
||||||
appl::Buffer* tmpBuffer = NULL;
|
std::shared_ptr<appl::Buffer> tmpBuffer;
|
||||||
if (m_bufferManager != NULL) {
|
if (m_bufferManager != nullptr) {
|
||||||
tmpBuffer = m_bufferManager->getBufferSelected();
|
tmpBuffer = m_bufferManager->getBufferSelected();
|
||||||
}
|
}
|
||||||
if (tmpBuffer != NULL) {
|
if (tmpBuffer != nullptr) {
|
||||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
for (size_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (m_list[iii] == NULL) {
|
if (m_list[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_list[iii]->m_buffer != tmpBuffer) {
|
if (m_list[iii]->m_buffer != tmpBuffer) {
|
||||||
@@ -185,16 +184,16 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
// clean The list
|
// clean The list
|
||||||
removeAllElement();
|
removeAllElement();
|
||||||
// get all the buffer name and properties:
|
// get all the buffer name and properties:
|
||||||
int32_t nbBufferOpen = 0; // BufferManager::size();
|
size_t nbBufferOpen = 0; // BufferManager::size();
|
||||||
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
|
for (size_t iii=0; iii<nbBufferOpen; iii++) {
|
||||||
/*
|
/*
|
||||||
if (BufferManager::exist(iii)) {
|
if (BufferManager::exist(iii)) {
|
||||||
BufferText* tmpBuffer = BufferManager::get(iii);
|
BufferText* tmpBuffer = BufferManager::get(iii);
|
||||||
if (NULL != tmpBuffer) {
|
if (nullptr != tmpBuffer) {
|
||||||
bool isModify = tmpBuffer->isModify();
|
bool isModify = tmpBuffer->isModify();
|
||||||
etk::FSNode name = tmpBuffer->getFileName();
|
etk::FSNode name = tmpBuffer->getFileName();
|
||||||
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
|
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
|
||||||
if (NULL != tmpElement) {
|
if (nullptr != tmpElement) {
|
||||||
m_list.push_back(tmpElement);
|
m_list.push_back(tmpElement);
|
||||||
} else {
|
} else {
|
||||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||||
@@ -212,36 +211,21 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}else if (_msg.getMessage() == ednMsgBufferState) {
|
}else if (_msg.getMessage() == ednMsgBufferState) {
|
||||||
// update list of modify section ...
|
// update list of modify section ...
|
||||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
for (auto &it : m_list) {
|
||||||
if (NULL!=m_list[iii]) {
|
if (it != nullptr) {
|
||||||
//m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify();
|
//it->m_isModify = BufferManager::get(it->m_bufferID)->isModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
ewol::widget::List::onObjectRemove(_removeObject);
|
|
||||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
|
||||||
if (m_list[iii] == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (m_list[iii]->m_buffer != _removeObject) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
m_list.erase(m_list.begin()+iii);
|
|
||||||
markToRedraw();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
etk::Color<> BufferView::getBasicBG() {
|
||||||
etk::Color<> BufferView::getBasicBG(void) {
|
|
||||||
return (*m_paintingProperties)[m_colorBackground1].getForeground();
|
return (*m_paintingProperties)[m_colorBackground1].getForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t BufferView::getNuberOfColomn(void) {
|
uint32_t BufferView::getNuberOfColomn() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,17 +234,17 @@ bool BufferView::getTitle(int32_t _colomn, std::string &_myTitle, etk::Color<> &
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t BufferView::getNuberOfRaw(void) {
|
uint32_t BufferView::getNuberOfRaw() {
|
||||||
return m_list.size();
|
return m_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||||
if( _raw >= 0
|
if( _raw >= 0
|
||||||
&& _raw<m_list.size()
|
&& _raw<(int64_t)m_list.size()
|
||||||
&& NULL != m_list[_raw]) {
|
&& m_list[_raw] != nullptr) {
|
||||||
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
|
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
|
||||||
|
|
||||||
if ( m_list[_raw]->m_buffer != NULL
|
if ( m_list[_raw]->m_buffer != nullptr
|
||||||
&& m_list[_raw]->m_buffer->isModify() == false) {
|
&& m_list[_raw]->m_buffer->isModify() == false) {
|
||||||
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
||||||
} else {
|
} else {
|
||||||
@@ -286,9 +270,9 @@ bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent
|
|||||||
if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) {
|
if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) {
|
||||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||||
if( _raw >= 0
|
if( _raw >= 0
|
||||||
&& _raw<m_list.size()
|
&& _raw<(int64_t)m_list.size()
|
||||||
&& NULL != m_list[_raw]) {
|
&& nullptr != m_list[_raw]) {
|
||||||
if (m_list[_raw]->m_buffer != NULL) {
|
if (m_list[_raw]->m_buffer != nullptr) {
|
||||||
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName());
|
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName());
|
||||||
m_selectedID = _raw;
|
m_selectedID = _raw;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
|
@@ -15,28 +15,25 @@
|
|||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
|
|
||||||
namespace appl
|
namespace appl {
|
||||||
{
|
class dataBufferStruct {
|
||||||
class dataBufferStruct
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
etk::FSNode m_bufferName;
|
etk::FSNode m_bufferName;
|
||||||
appl::Buffer* m_buffer;
|
std::shared_ptr<appl::Buffer> m_buffer;
|
||||||
dataBufferStruct(const std::string& _bufferName, appl::Buffer* _buffer) :
|
dataBufferStruct(const std::string& _bufferName, const std::shared_ptr<appl::Buffer>& _buffer) :
|
||||||
m_bufferName(_bufferName),
|
m_bufferName(_bufferName),
|
||||||
m_buffer(_buffer) {
|
m_buffer(_buffer) {
|
||||||
|
|
||||||
};
|
};
|
||||||
~dataBufferStruct(void) { };
|
virtual ~dataBufferStruct() { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class BufferView : public ewol::widget::List
|
class BufferView : public ewol::widget::List {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
private:
|
private:
|
||||||
appl::GlyphPainting* m_paintingProperties; //!< element painting property
|
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||||
int32_t m_colorBackground1;
|
int32_t m_colorBackground1;
|
||||||
int32_t m_colorBackground2;
|
int32_t m_colorBackground2;
|
||||||
int32_t m_colorBackgroundSelect;
|
int32_t m_colorBackgroundSelect;
|
||||||
@@ -51,23 +48,25 @@ class BufferView : public ewol::widget::List
|
|||||||
* @param[in] _dataStruct element to add.
|
* @param[in] _dataStruct element to add.
|
||||||
*/
|
*/
|
||||||
void insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition = false);
|
void insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition = false);
|
||||||
public:
|
protected:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
BufferView(void);
|
BufferView();
|
||||||
~BufferView(void);
|
void init();
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(BufferView);
|
||||||
|
virtual ~BufferView();
|
||||||
// Derived function
|
// Derived function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object* _removeObject);
|
|
||||||
private:
|
private:
|
||||||
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
||||||
protected:
|
protected:
|
||||||
// function call to display the list :
|
// function call to display the list :
|
||||||
virtual etk::Color<> getBasicBG(void);
|
virtual etk::Color<> getBasicBG();
|
||||||
void removeAllElement(void);
|
void removeAllElement();
|
||||||
// Derived function
|
// Derived function
|
||||||
virtual uint32_t getNuberOfColomn(void);
|
virtual uint32_t getNuberOfColomn();
|
||||||
virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||||
virtual uint32_t getNuberOfRaw(void);
|
virtual uint32_t getNuberOfRaw();
|
||||||
virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||||
virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||||
};
|
};
|
||||||
|
@@ -38,13 +38,13 @@
|
|||||||
#include <appl/Gui/WorkerCloseAllFile.h>
|
#include <appl/Gui/WorkerCloseAllFile.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
std::string getVersion(void) {
|
std::string getVersion() {
|
||||||
#define FIRST_YEAR (2010)
|
#define FIRST_YEAR (2010)
|
||||||
std::string tmpOutput = std::to_string(date::getYear()-FIRST_YEAR);
|
std::string tmpOutput = etk::to_string(date::getYear()-FIRST_YEAR);
|
||||||
tmpOutput += ".";
|
tmpOutput += ".";
|
||||||
tmpOutput += std::to_string(date::getMonth());
|
tmpOutput += etk::to_string(date::getMonth());
|
||||||
tmpOutput += ".";
|
tmpOutput += ".";
|
||||||
tmpOutput += std::to_string(date::getDay());
|
tmpOutput += etk::to_string(date::getDay());
|
||||||
return tmpOutput;
|
return tmpOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,12 +59,15 @@ namespace appl {
|
|||||||
|
|
||||||
class ParameterAboutGui : public ewol::widget::Sizer {
|
class ParameterAboutGui : public ewol::widget::Sizer {
|
||||||
public :
|
public :
|
||||||
ParameterAboutGui(void) :
|
ParameterAboutGui() {
|
||||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
|
addObjectType("appl::ParameterAboutGui");
|
||||||
ewol::widget::Spacer* mySpacer = NULL;
|
}
|
||||||
|
void init() {
|
||||||
|
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
|
||||||
|
std::shared_ptr<ewol::widget::Spacer> mySpacer;
|
||||||
|
|
||||||
mySpacer = new ewol::widget::Spacer();
|
mySpacer = ewol::widget::Spacer::create();
|
||||||
if (NULL == mySpacer) {
|
if (nullptr == mySpacer) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
mySpacer->setExpand(bvec2(true,true));
|
mySpacer->setExpand(bvec2(true,true));
|
||||||
@@ -93,8 +96,8 @@ class ParameterAboutGui : public ewol::widget::Sizer {
|
|||||||
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
|
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
|
||||||
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
|
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
|
||||||
tmpLabel += "</left>";
|
tmpLabel += "</left>";
|
||||||
ewol::widget::Label* myLabel = new ewol::widget::Label(tmpLabel);
|
std::shared_ptr<ewol::widget::Label> myLabel = ewol::widget::Label::create(tmpLabel);
|
||||||
if (NULL == myLabel) {
|
if (nullptr == myLabel) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myLabel->setExpand(bvec2(true,false));
|
myLabel->setExpand(bvec2(true,false));
|
||||||
@@ -102,7 +105,7 @@ class ParameterAboutGui : public ewol::widget::Sizer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
~ParameterAboutGui(void) {
|
~ParameterAboutGui() {
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -119,39 +122,46 @@ const char* l_smoothMax = "tmpEvent_maxChange";
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "MainWindows"
|
#define __class__ "MainWindows"
|
||||||
|
|
||||||
MainWindows::MainWindows(void) {
|
MainWindows::MainWindows() {
|
||||||
addObjectType("appl::MainWindows");
|
addObjectType("appl::MainWindows");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindows::init() {
|
||||||
|
ewol::widget::Windows::init();
|
||||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||||
ewol::widget::Sizer * mySizerVert = NULL;
|
std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr;
|
||||||
ewol::widget::Sizer * mySizerVert2 = NULL;
|
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = nullptr;
|
||||||
ewol::widget::Sizer * mySizerHori = NULL;
|
std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
|
||||||
//ewol::Button * myButton = NULL;
|
std::shared_ptr<appl::TextViewer> myTextView = nullptr;
|
||||||
appl::TextViewer * myTextView = NULL;
|
std::shared_ptr<BufferView> myBufferView = nullptr;
|
||||||
BufferView * myBufferView = NULL;
|
std::shared_ptr<ewol::widget::Menu> myMenu = nullptr;
|
||||||
ewol::widget::Menu * myMenu = NULL;
|
|
||||||
|
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
|
||||||
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert);
|
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||||
|
mySizerVert->setName("plop 1111111");
|
||||||
setSubWidget(mySizerVert);
|
setSubWidget(mySizerVert);
|
||||||
|
|
||||||
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
|
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
|
||||||
|
mySizerHori->setName("plop 222222222");
|
||||||
mySizerVert->subWidgetAdd(mySizerHori);
|
mySizerVert->subWidgetAdd(mySizerHori);
|
||||||
myBufferView = new BufferView();
|
myBufferView = BufferView::create();
|
||||||
|
myBufferView->setName("plop 3333333");
|
||||||
myBufferView->setExpand(bvec2(false,true));
|
myBufferView->setExpand(bvec2(false,true));
|
||||||
myBufferView->setFill(bvec2(true,true));
|
myBufferView->setFill(bvec2(true,true));
|
||||||
mySizerHori->subWidgetAdd(myBufferView);
|
mySizerHori->subWidgetAdd(myBufferView);
|
||||||
|
|
||||||
mySizerVert2 = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert);
|
mySizerVert2 = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||||
mySizerHori->subWidgetAdd(mySizerVert2);
|
mySizerHori->subWidgetAdd(mySizerVert2);
|
||||||
|
mySizerVert2->setName("plop 4444444");
|
||||||
// main buffer Area :
|
// main buffer Area :
|
||||||
#if defined(__TARGET_OS__Android)
|
#if defined(__TARGET_OS__Android)
|
||||||
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16);
|
myTextView = appl::TextViewer::create("FreeMono;DejaVuSansMono;FreeSerif", 16);
|
||||||
#else
|
#else
|
||||||
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11);
|
myTextView = appl::TextViewer::create("FreeMono;DejaVuSansMono;FreeSerif", 11);
|
||||||
#endif
|
#endif
|
||||||
|
myTextView->setName("appl-text-viewer");
|
||||||
myTextView->setExpand(bvec2(true,true));
|
myTextView->setExpand(bvec2(true,true));
|
||||||
myTextView->setFill(bvec2(true,true));
|
myTextView->setFill(bvec2(true,true));
|
||||||
mySizerVert2->subWidgetAdd(myTextView);
|
mySizerVert2->subWidgetAdd(myTextView);
|
||||||
@@ -162,90 +172,63 @@ MainWindows::MainWindows(void) {
|
|||||||
mySizerVert2->subWidgetAdd(myTextView);
|
mySizerVert2->subWidgetAdd(myTextView);
|
||||||
*/
|
*/
|
||||||
// search area :
|
// search area :
|
||||||
Search * mySearch = new Search();
|
std::shared_ptr<appl::widget::Search> mySearch = appl::widget::Search::create();
|
||||||
mySizerVert2->subWidgetAdd(mySearch);
|
mySizerVert2->subWidgetAdd(mySearch);
|
||||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
|
||||||
{
|
|
||||||
ewol::widget::Sizer * mySizerHori2 = new widget::Sizer(ewol::widget::Sizer::modeHori);
|
|
||||||
mySizerVert2->subWidgetAdd(mySizerHori2);
|
|
||||||
|
|
||||||
ewol::widget::CheckBox* tmpCheck = new widget::CheckBox("smooth");
|
|
||||||
mySizerHori2->subWidgetAdd(tmpCheck);
|
|
||||||
tmpCheck->registerOnEvent(this, "clicked", l_smoothChick);
|
|
||||||
|
|
||||||
ewol::widget::Slider* tmpSlider = new widget::Slider();
|
|
||||||
mySizerHori2->subWidgetAdd(tmpSlider);
|
|
||||||
tmpSlider->registerOnEvent(this, "change", l_smoothMin);
|
|
||||||
tmpSlider->setExpand(bvec2(true,false));
|
|
||||||
tmpSlider->setMin(0);
|
|
||||||
tmpSlider->setMax(1000);
|
|
||||||
tmpSlider->setValue(0450);
|
|
||||||
tmpSliderMin = tmpSlider;
|
|
||||||
|
|
||||||
tmpSlider = new ewol::widget::Slider();
|
|
||||||
mySizerHori2->subWidgetAdd(tmpSlider);
|
|
||||||
tmpSlider->registerOnEvent(this, "change", l_smoothMax);
|
|
||||||
tmpSlider->setExpand(bvec2(true,false));
|
|
||||||
tmpSlider->setMin(0);
|
|
||||||
tmpSlider->setMax(1000);
|
|
||||||
tmpSlider->setValue(0550);
|
|
||||||
tmpSliderMax = tmpSlider;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
|
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
|
||||||
|
mySizerHori->setName("plop 555555");
|
||||||
mySizerVert->subWidgetAdd(mySizerHori);
|
mySizerVert->subWidgetAdd(mySizerHori);
|
||||||
|
|
||||||
myMenu = new ewol::widget::Menu();
|
myMenu = ewol::widget::Menu::create();
|
||||||
mySizerHori->subWidgetAdd(myMenu);
|
mySizerHori->subWidgetAdd(myMenu);
|
||||||
int32_t idMenuFile = myMenu->addTitle("File");
|
int32_t idMenuFile = myMenu->addTitle("File");
|
||||||
(void)myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
|
myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
(void)myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", ednMsgGuiOpen);
|
myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", ednMsgGuiOpen);
|
||||||
(void)myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", ednMsgGuiClose, "current");
|
myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", ednMsgGuiClose, "current");
|
||||||
(void)myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
|
myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
|
||||||
(void)myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", ednMsgGuiSave, "current");
|
myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", ednMsgGuiSave, "current");
|
||||||
(void)myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
|
myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
//(void)myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit);
|
//myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit);
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
(void)myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", ednMsgProperties);
|
myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", ednMsgProperties);
|
||||||
int32_t idMenuEdit = myMenu->addTitle("Edit");
|
int32_t idMenuEdit = myMenu->addTitle("Edit");
|
||||||
(void)myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", ednMsgGuiUndo);
|
myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", ednMsgGuiUndo);
|
||||||
(void)myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", ednMsgGuiRedo);
|
myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", ednMsgGuiRedo);
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
(void)myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
|
myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
|
||||||
(void)myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
|
myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
|
||||||
(void)myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
|
myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
|
||||||
(void)myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
|
myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
(void)myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
|
myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
|
||||||
(void)myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
|
myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
|
||||||
(void)myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
|
myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
|
||||||
int32_t idMenuSearch = myMenu->addTitle("Search");
|
int32_t idMenuSearch = myMenu->addTitle("Search");
|
||||||
(void)myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", ednMsgGuiSearch);
|
myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", ednMsgGuiSearch);
|
||||||
(void)myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", ednMsgGuiReplace);
|
myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", ednMsgGuiReplace);
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
(void)myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
|
myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
|
||||||
(void)myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
|
myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
|
||||||
(void)myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
|
myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
|
||||||
(void)myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
|
myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
|
||||||
/* ==> must be in the pluggin list control ...
|
/* ==> must be in the pluggin list control ...
|
||||||
int32_t idMenuCTags = myMenu->addTitle("C-tags");
|
int32_t idMenuCTags = myMenu->addTitle("C-tags");
|
||||||
(void)myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
|
myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
|
||||||
(void)myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
|
myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
|
||||||
(void)myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
|
myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
|
||||||
(void)myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
|
myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
|
||||||
*/
|
*/
|
||||||
int32_t idMenugDisplay = myMenu->addTitle("Display");
|
int32_t idMenugDisplay = myMenu->addTitle("Display");
|
||||||
(void)myMenu->add(idMenugDisplay, "Color Black", "", appl::MsgNameGuiChangeColor, "color/black/");
|
myMenu->add(idMenugDisplay, "Color Black", "", appl::MsgNameGuiChangeColor, "color/black/");
|
||||||
(void)myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "color/white/");
|
myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "color/white/");
|
||||||
(void)myMenu->add(idMenugDisplay, "Shape square", "", l_MsgNameGuiChangeShape, "shape/square/");
|
myMenu->add(idMenugDisplay, "Shape square", "", l_MsgNameGuiChangeShape, "shape/square/");
|
||||||
(void)myMenu->add(idMenugDisplay, "Shape round", "", l_MsgNameGuiChangeShape, "shape/round/");
|
myMenu->add(idMenugDisplay, "Shape round", "", l_MsgNameGuiChangeShape, "shape/round/");
|
||||||
(void)myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
(void)myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
|
myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
|
||||||
|
|
||||||
m_widgetLabelFileName = new ewol::widget::Label("FileName");
|
m_widgetLabelFileName = ewol::widget::Label::create("FileName");
|
||||||
m_widgetLabelFileName->setExpand(bvec2(true,false));
|
m_widgetLabelFileName->setExpand(bvec2(true,false));
|
||||||
m_widgetLabelFileName->setFill(bvec2(true,false));;
|
m_widgetLabelFileName->setFill(bvec2(true,false));;
|
||||||
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
|
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
|
||||||
@@ -291,8 +274,8 @@ MainWindows::MainWindows(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindows::~MainWindows(void) {
|
MainWindows::~MainWindows() {
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -306,42 +289,73 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
APPL_VERBOSE("Receive Event from the main windows: " << _msg );
|
APPL_VERBOSE("Receive Event from the main windows: " << _msg );
|
||||||
// open file Section ...
|
// open file Section ...
|
||||||
if (_msg.getMessage() == ednMsgGuiOpen) {
|
if (_msg.getMessage() == ednMsgGuiOpen) {
|
||||||
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser();
|
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
|
||||||
if (tmpWidget == NULL) {
|
if (tmpWidget == nullptr) {
|
||||||
APPL_ERROR("Can not open File chooser !!! ");
|
APPL_ERROR("Can not open File chooser !!! ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWidget->setTitle("Open files ...");
|
tmpWidget->setTitle("Open files ...");
|
||||||
tmpWidget->setValidateLabel("Open");
|
tmpWidget->setValidateLabel("Open");
|
||||||
if (m_bufferManager == NULL) {
|
if (m_bufferManager == nullptr) {
|
||||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get a ref on the buffer selected (if null, no buffer was selected ...)
|
// Get a ref on the buffer selected (if null, no buffer was selected ...)
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->getBufferSelected();
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
|
||||||
if (tmpBuffer != NULL) {
|
if (tmpBuffer != nullptr) {
|
||||||
etk::FSNode tmpFile = tmpBuffer->getFileName();
|
etk::FSNode tmpFile = tmpBuffer->getFileName();
|
||||||
tmpWidget->setFolder(tmpFile.getNameFolder());
|
tmpWidget->setFolder(tmpFile.getNameFolder());
|
||||||
}
|
}
|
||||||
// apply widget pop-up ...
|
// apply widget pop-up ...
|
||||||
popUpWidgetPush(tmpWidget);
|
popUpWidgetPush(tmpWidget);
|
||||||
tmpWidget->registerOnEvent(this, "validate", ednEventPopUpFileSelected);
|
tmpWidget->registerOnEvent(shared_from_this(), "validate", ednEventPopUpFileSelected);
|
||||||
} else if (_msg.getMessage() == ednMsgProperties) {
|
} else if (_msg.getMessage() == ednMsgProperties) {
|
||||||
// Request the parameter GUI
|
// Request the parameter GUI
|
||||||
ewol::widget::Parameter* tmpWidget = new ewol::widget::Parameter();
|
std::shared_ptr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
|
||||||
if (NULL == tmpWidget) {
|
if (nullptr == tmpWidget) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef SDGSDFGSDFGSDFGSDFGSTERGDHFGHFDS
|
||||||
|
std::string menuDescription = "<title>Properties</title>\n";
|
||||||
|
menuDescription += "<group>\n";
|
||||||
|
menuDescription += " <title>Editor</title>\n";
|
||||||
|
menuDescription += " <menu>\n";
|
||||||
|
menuDescription += " <title>Editor Interface</title>\n";
|
||||||
|
menuDescription += " <short-title>Editor</short-title>\n";
|
||||||
|
menuDescription += " <widget>appl-text-viewer</widget>\n";
|
||||||
|
menuDescription += " </menu>\n";
|
||||||
|
menuDescription += "</group>\n";
|
||||||
|
menuDescription += "<group>\n";
|
||||||
|
menuDescription += " <title>Gui</title>\n";
|
||||||
|
menuDescription += " <menu>\n";
|
||||||
|
menuDescription += " <title>Font selection</title>\n";
|
||||||
|
menuDescription += " <short-title>Font</short-title>\n";
|
||||||
|
menuDescription += " <widget></widget>\n";
|
||||||
|
menuDescription += " </menu>\n";
|
||||||
|
menuDescription += " <menu>\n";
|
||||||
|
menuDescription += " <title>Color selection</title>\n";
|
||||||
|
menuDescription += " <short-title>Color</short-title>\n";
|
||||||
|
menuDescription += " <widget></widget>\n";
|
||||||
|
menuDescription += " </menu>\n";
|
||||||
|
menuDescription += " <menu>\n";
|
||||||
|
menuDescription += " <title>Theme selection</title>\n";
|
||||||
|
menuDescription += " <short-title>Theme</short-title>\n";
|
||||||
|
menuDescription += " <widget></widget>\n";
|
||||||
|
menuDescription += " </menu>\n";
|
||||||
|
menuDescription += "</group>\n";
|
||||||
|
|
||||||
|
tmpWidget->setMenu(menuDescription);
|
||||||
|
#endif
|
||||||
tmpWidget->setTitle("Properties");
|
tmpWidget->setTitle("Properties");
|
||||||
popUpWidgetPush(tmpWidget);
|
popUpWidgetPush(tmpWidget);
|
||||||
tmpWidget->menuAddGroup("Editor");
|
tmpWidget->menuAddGroup("Editor");
|
||||||
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
|
std::shared_ptr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
|
||||||
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
|
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
|
||||||
tmpWidget->menuAdd("Font & Color", "", NULL);
|
tmpWidget->menuAdd("Font & Color", "", nullptr);
|
||||||
tmpWidget->menuAdd("Highlight", "", NULL);
|
tmpWidget->menuAdd("Highlight", "", nullptr);
|
||||||
tmpWidget->menuAddGroup("General");
|
tmpWidget->menuAddGroup("General");
|
||||||
tmpWidget->menuAdd("Display", "", NULL);
|
tmpWidget->menuAdd("Display", "", nullptr);
|
||||||
tmpSubWidget = new ParameterAboutGui();
|
tmpSubWidget = ParameterAboutGui::create();
|
||||||
tmpWidget->menuAdd("About", "", tmpSubWidget);
|
tmpWidget->menuAdd("About", "", tmpSubWidget);
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
|
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
|
||||||
@@ -359,7 +373,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
// TODO : ...
|
// TODO : ...
|
||||||
}
|
}
|
||||||
// Note : Fore all next message we need to acces to the buffer manager ==> just check one time ...
|
// Note : Fore all next message we need to acces to the buffer manager ==> just check one time ...
|
||||||
if (m_bufferManager == NULL) {
|
if (m_bufferManager == nullptr) {
|
||||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -368,57 +382,58 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
|| _msg.getMessage() == appl::Buffer::eventIsSave
|
|| _msg.getMessage() == appl::Buffer::eventIsSave
|
||||||
|| _msg.getMessage() == appl::Buffer::eventChangeName) {
|
|| _msg.getMessage() == appl::Buffer::eventChangeName) {
|
||||||
// select a new Buffer ==> change title:
|
// select a new Buffer ==> change title:
|
||||||
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
|
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||||
if (tmpp == NULL) {
|
if (tmpp == nullptr) {
|
||||||
setTitle("Edn");
|
setTitle("Edn");
|
||||||
if (m_widgetLabelFileName != NULL) {
|
if (m_widgetLabelFileName != nullptr) {
|
||||||
m_widgetLabelFileName->setLabel("");
|
m_widgetLabelFileName->setLabel("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||||
tmpp->registerOnEvent(this, appl::Buffer::eventIsModify);
|
tmpp->registerOnEvent(shared_from_this(), appl::Buffer::eventIsModify);
|
||||||
tmpp->registerOnEvent(this, appl::Buffer::eventIsSave);
|
tmpp->registerOnEvent(shared_from_this(), appl::Buffer::eventIsSave);
|
||||||
tmpp->registerOnEvent(this, appl::Buffer::eventChangeName);
|
tmpp->registerOnEvent(shared_from_this(), appl::Buffer::eventChangeName);
|
||||||
}
|
}
|
||||||
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + tmpp->getFileName());
|
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
|
||||||
if (m_widgetLabelFileName != NULL) {
|
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
|
||||||
m_widgetLabelFileName->setLabel(tmpp->getFileName() + (tmpp->isModify()==true?" *":""));
|
if (m_widgetLabelFileName != nullptr) {
|
||||||
|
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (_msg.getMessage() == ednMsgGuiNew) {
|
} else if (_msg.getMessage() == ednMsgGuiNew) {
|
||||||
(void)m_bufferManager->createNewBuffer();
|
m_bufferManager->createNewBuffer();
|
||||||
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
|
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
|
||||||
APPL_DEBUG("Request opening the file : " << _msg.getData());
|
APPL_DEBUG("Request opening the file : " << _msg.getData());
|
||||||
m_bufferManager->open(_msg.getData());
|
m_bufferManager->open(_msg.getData());
|
||||||
} else if (_msg.getMessage() == ednMsgGuiSave) {
|
} else if (_msg.getMessage() == ednMsgGuiSave) {
|
||||||
APPL_DEBUG("Request saving the file : " << _msg.getData());
|
APPL_DEBUG("Request saving the file : " << _msg.getData());
|
||||||
if (std::tolower(_msg.getData()) == "current") {
|
if (etk::tolower(_msg.getData()) == "current") {
|
||||||
appl::WorkerSaveFile* tmpWorker = new appl::WorkerSaveFile("", false);
|
appl::WorkerSaveFile::create("", false);
|
||||||
return;
|
return;
|
||||||
} else if (std::tolower(_msg.getData()) == "all") {
|
} else if (etk::tolower(_msg.getData()) == "all") {
|
||||||
appl::WorkerSaveAllFile* tmpWorker = new appl::WorkerSaveAllFile();
|
appl::WorkerSaveAllFile::create();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
APPL_ERROR("UNKNOW request : " << _msg);
|
APPL_ERROR("UNKNOW request : " << _msg);
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
|
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
|
||||||
appl::WorkerSaveFile* tmpWorker = new appl::WorkerSaveFile("", true);
|
appl::WorkerSaveFile::create("", true);
|
||||||
} else if (_msg.getMessage() == ednMsgGuiClose) {
|
} else if (_msg.getMessage() == ednMsgGuiClose) {
|
||||||
// Get a ref on the buffer selected (if null, no buffer was selected ...)
|
// Get a ref on the buffer selected (if null, no buffer was selected ...)
|
||||||
if (_msg.getData() == "current") {
|
if (_msg.getData() == "current") {
|
||||||
appl::WorkerCloseFile* tmpWorker = new appl::WorkerCloseFile("");
|
appl::WorkerCloseFile::create("");
|
||||||
} else {
|
} else {
|
||||||
appl::WorkerCloseAllFile* tmpWorker = new appl::WorkerCloseAllFile();
|
appl::WorkerCloseAllFile::create();
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == mainWindowsRequestSaveFile) { // return after a choice of close...
|
} else if (_msg.getMessage() == mainWindowsRequestSaveFile) { // return after a choice of close...
|
||||||
if (m_bufferManager->exist(_msg.getData()) == false) {
|
if (m_bufferManager->exist(_msg.getData()) == false) {
|
||||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData());
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -436,8 +451,8 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData());
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -447,64 +462,58 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData());
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// note: just remove ==> no check : normal case ...
|
// note: just remove ==> no check : normal case ...
|
||||||
tmpBuffer->removeObject();
|
//tmpBuffer->removeObject();
|
||||||
|
EWOL_TODO("call remove buffer ...");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindows::saveAsPopUp(appl::Buffer* _buffer) {
|
void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) {
|
||||||
if (_buffer == NULL) {
|
if (_buffer == nullptr) {
|
||||||
APPL_ERROR("Call With NULL input...");
|
APPL_ERROR("Call With nullptr input...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::WorkerSaveFile* tmpObject = new appl::WorkerSaveFile(_buffer->getFileName());
|
std::shared_ptr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create(_buffer->getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindows::closeNotSavedFile(appl::Buffer* _buffer) {
|
void MainWindows::closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer) {
|
||||||
if (_buffer == NULL) {
|
if (_buffer == nullptr) {
|
||||||
APPL_ERROR("Call With NULL input...");
|
APPL_ERROR("Call With nullptr input...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp();
|
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
|
||||||
if (tmpPopUp == NULL) {
|
if (tmpPopUp == nullptr) {
|
||||||
APPL_ERROR("Can not create a simple pop-up");
|
APPL_ERROR("Can not create a simple pop-up");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
|
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
|
||||||
tmpPopUp->setComment("The file named : <i>\"" + _buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
|
tmpPopUp->setComment("The file named : <i>\"" + _buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
|
||||||
ewol::Widget* bt = NULL;
|
std::shared_ptr<ewol::Widget> bt = nullptr;
|
||||||
if (_buffer->hasFileName() == true) {
|
if (_buffer->hasFileName() == true) {
|
||||||
bt = tmpPopUp->addButton("Save", true);
|
bt = tmpPopUp->addButton("Save", true);
|
||||||
if (bt != NULL) {
|
if (bt != nullptr) {
|
||||||
// TODO : The element is removed before beeing pressed
|
// TODO : The element is removed before beeing pressed
|
||||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestSaveFile, _buffer->getFileName());
|
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFile, _buffer->getFileName());
|
||||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bt = tmpPopUp->addButton("Save As", true);
|
bt = tmpPopUp->addButton("Save As", true);
|
||||||
if (bt != NULL) {
|
if (bt != nullptr) {
|
||||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName());
|
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName());
|
||||||
//bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
//bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||||
// TODO : Request the close when saved ...
|
// TODO : Request the close when saved ...
|
||||||
}
|
}
|
||||||
bt = tmpPopUp->addButton("Close", true);
|
bt = tmpPopUp->addButton("Close", true);
|
||||||
if (bt != NULL) {
|
if (bt != nullptr) {
|
||||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||||
}
|
}
|
||||||
tmpPopUp->addButton("Cancel", true);
|
tmpPopUp->addButton("Cancel", true);
|
||||||
tmpPopUp->setRemoveOnExternClick(true);
|
tmpPopUp->setRemoveOnExternClick(true);
|
||||||
popUpWidgetPush(tmpPopUp);
|
popUpWidgetPush(tmpPopUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindows::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
ewol::widget::Windows::onObjectRemove(_removeObject);
|
|
||||||
if (m_widgetLabelFileName == _removeObject) {
|
|
||||||
m_widgetLabelFileName = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -19,27 +19,28 @@
|
|||||||
|
|
||||||
class MainWindows : public ewol::widget::Windows {
|
class MainWindows : public ewol::widget::Windows {
|
||||||
private:
|
private:
|
||||||
int32_t m_currentSavingAsIdBuffer;
|
std::shared_ptr<ewol::widget::Label> m_widgetLabelFileName;
|
||||||
ewol::widget::Label* m_widgetLabelFileName;
|
protected:
|
||||||
public:
|
|
||||||
// Constructeur
|
// Constructeur
|
||||||
MainWindows(void);
|
MainWindows();
|
||||||
~MainWindows(void);
|
void init();
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(MainWindows);
|
||||||
|
virtual ~MainWindows();
|
||||||
private:
|
private:
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
/**
|
/**
|
||||||
* @brief Display a pop-up to the select the name of the file.
|
* @brief Display a pop-up to the select the name of the file.
|
||||||
* @param[in] _buffer Buffer that might be saved with a new name.
|
* @param[in] _buffer Buffer that might be saved with a new name.
|
||||||
*/
|
*/
|
||||||
void saveAsPopUp(appl::Buffer* _buffer);
|
void saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer);
|
||||||
/**
|
/**
|
||||||
* @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved.
|
* @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved.
|
||||||
* @param[in] _buffer Buffer that might be close.
|
* @param[in] _buffer Buffer that might be close.
|
||||||
*/
|
*/
|
||||||
void closeNotSavedFile(appl::Buffer* _buffer);
|
void closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer);
|
||||||
public: // Derived function
|
public: // Derived function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -28,52 +28,50 @@ const char* const l_eventWrapCb = "appl-wrap-CheckBox";
|
|||||||
const char* const l_eventForwardCb = "appl-forward-CheckBox";
|
const char* const l_eventForwardCb = "appl-forward-CheckBox";
|
||||||
const char* const l_eventHideBt = "appl-hide-button";
|
const char* const l_eventHideBt = "appl-hide-button";
|
||||||
|
|
||||||
Search::Search(void) :
|
appl::widget::Search::Search() :
|
||||||
ewol::widget::Composer(ewol::widget::Composer::file, "DATA:GUI-Search.xml"),
|
|
||||||
m_viewerManager(NULL),
|
|
||||||
m_forward(true),
|
m_forward(true),
|
||||||
m_caseSensitive(false),
|
m_caseSensitive(false),
|
||||||
m_wrap(true),
|
m_wrap(true) {
|
||||||
m_searchEntry(NULL),
|
addObjectType("appl::widget::Search");
|
||||||
m_replaceEntry(NULL) {
|
}
|
||||||
addObjectType("appl::Search");
|
void appl::widget::Search::init() {
|
||||||
// load buffer manager:
|
ewol::widget::Composer::init(ewol::widget::Composer::file, "DATA:GUI-Search.xml");
|
||||||
m_viewerManager = appl::ViewerManager::keep();
|
m_viewerManager = appl::ViewerManager::create();
|
||||||
// link event
|
// link event
|
||||||
registerOnEventNameWidget(this, "SEARCH:close", "pressed", l_eventHideBt);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:close", "pressed", l_eventHideBt);
|
||||||
registerOnEventNameWidget(this, "SEARCH:search-entry", "modify", l_eventSearchEntry);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:search-entry", "modify", l_eventSearchEntry);
|
||||||
registerOnEventNameWidget(this, "SEARCH:search-entry", "enter", l_eventSearchEntryEnter);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:search-entry", "enter", l_eventSearchEntryEnter);
|
||||||
registerOnEventNameWidget(this, "SEARCH:search", "pressed", l_eventSearchBt);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:search", "pressed", l_eventSearchBt);
|
||||||
registerOnEventNameWidget(this, "SEARCH:replace-entry", "modify", l_eventReplaceEntry);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace-entry", "modify", l_eventReplaceEntry);
|
||||||
registerOnEventNameWidget(this, "SEARCH:replace-entry", "enter", l_eventReplaceEntryEnter);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace-entry", "enter", l_eventReplaceEntryEnter);
|
||||||
registerOnEventNameWidget(this, "SEARCH:replace", "pressed", l_eventReplaceBt);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace", "pressed", l_eventReplaceBt);
|
||||||
registerOnEventNameWidget(this, "SEARCH:case", "value", l_eventCaseCb);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:case", "value", l_eventCaseCb);
|
||||||
registerOnEventNameWidget(this, "SEARCH:wrap", "value", l_eventWrapCb);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:wrap", "value", l_eventWrapCb);
|
||||||
registerOnEventNameWidget(this, "SEARCH:up-down", "value", l_eventForwardCb);
|
registerOnEventNameWidget(shared_from_this(), "SEARCH:up-down", "value", l_eventForwardCb);
|
||||||
// set default properties
|
// set default properties
|
||||||
setConfigNamed("SEARCH:case", "value", std::to_string(m_caseSensitive));
|
parameterSetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
|
||||||
setConfigNamed("SEARCH:wrap", "value", std::to_string(m_wrap));
|
parameterSetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
|
||||||
setConfigNamed("SEARCH:up-down", "value", std::to_string(m_forward));
|
parameterSetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
|
||||||
// get widget
|
// get widget
|
||||||
m_searchEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:search-entry"));
|
m_searchEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:search-entry"));
|
||||||
m_replaceEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:replace-entry"));
|
m_replaceEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:replace-entry"));
|
||||||
// Display and hide event:
|
// Display and hide event:
|
||||||
registerMultiCast(ednMsgGuiSearch);
|
registerMultiCast(ednMsgGuiSearch);
|
||||||
// basicly hiden ...
|
// basicly hiden ...
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
Search::~Search(void) {
|
appl::widget::Search::~Search() {
|
||||||
appl::ViewerManager::release(m_viewerManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Search::find(void) {
|
void appl::widget::Search::find() {
|
||||||
if (m_viewerManager == NULL) {
|
if (m_viewerManager == nullptr) {
|
||||||
APPL_WARNING("No viewer manager selected!!!");
|
APPL_WARNING("No viewer manager selected!!!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::TextViewer* viewer = m_viewerManager->getViewerSelected();
|
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||||
if (viewer == NULL) {
|
if (viewer == nullptr) {
|
||||||
APPL_INFO("No viewer selected!!!");
|
APPL_INFO("No viewer selected!!!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -103,13 +101,13 @@ void Search::find(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Search::replace(void) {
|
void appl::widget::Search::replace() {
|
||||||
if (m_viewerManager == NULL) {
|
if (m_viewerManager == nullptr) {
|
||||||
APPL_WARNING("No viewer manager selected!!!");
|
APPL_WARNING("No viewer manager selected!!!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::TextViewer* viewer = m_viewerManager->getViewerSelected();
|
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||||
if (viewer == NULL) {
|
if (viewer == nullptr) {
|
||||||
APPL_INFO("No viewer selected!!!");
|
APPL_INFO("No viewer selected!!!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -121,39 +119,39 @@ void Search::replace(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
void appl::widget::Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||||
ewol::widget::Composer::onReceiveMessage(_msg);
|
ewol::widget::Composer::onReceiveMessage(_msg);
|
||||||
APPL_INFO("Search receive message : " << _msg);
|
APPL_INFO("Search receive message : " << _msg);
|
||||||
if ( _msg.getMessage() == l_eventSearchEntry) {
|
if ( _msg.getMessage() == l_eventSearchEntry) {
|
||||||
m_searchData = to_u32string(_msg.getData());
|
m_searchData = etk::to_u32string(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventSearchEntryEnter
|
} else if ( _msg.getMessage() == l_eventSearchEntryEnter
|
||||||
|| _msg.getMessage() == l_eventSearchBt) {
|
|| _msg.getMessage() == l_eventSearchBt) {
|
||||||
find();
|
find();
|
||||||
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
|
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
|
||||||
m_replaceData = to_u32string(_msg.getData());
|
m_replaceData = etk::to_u32string(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter
|
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter
|
||||||
|| _msg.getMessage() == l_eventReplaceBt) {
|
|| _msg.getMessage() == l_eventReplaceBt) {
|
||||||
replace();
|
replace();
|
||||||
find();
|
find();
|
||||||
} else if ( _msg.getMessage() == l_eventCaseCb) {
|
} else if ( _msg.getMessage() == l_eventCaseCb) {
|
||||||
m_caseSensitive = std::stob(_msg.getData());
|
m_caseSensitive = etk::string_to_bool(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
||||||
m_wrap = std::stob(_msg.getData());
|
m_wrap = etk::string_to_bool(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
||||||
m_forward = std::stob(_msg.getData());
|
m_forward = etk::string_to_bool(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventHideBt) {
|
} else if ( _msg.getMessage() == l_eventHideBt) {
|
||||||
hide();
|
hide();
|
||||||
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
|
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
|
||||||
if (true == isHide()) {
|
if (true == isHide()) {
|
||||||
show();
|
show();
|
||||||
if (m_searchEntry!= NULL) {
|
if (m_searchEntry!= nullptr) {
|
||||||
m_searchEntry->keepFocus();
|
m_searchEntry->keepFocus();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|
if( (m_searchEntry!=nullptr && true == m_searchEntry->getFocus())
|
||||||
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
|
|| (m_replaceEntry!=nullptr && true == m_replaceEntry->getFocus()) ) {
|
||||||
hide();
|
hide();
|
||||||
} else if (m_searchEntry!= NULL) {
|
} else if (m_searchEntry!= nullptr) {
|
||||||
m_searchEntry->keepFocus();
|
m_searchEntry->keepFocus();
|
||||||
} else {
|
} else {
|
||||||
hide();
|
hide();
|
||||||
@@ -162,16 +160,3 @@ void Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Search::onObjectRemove(ewol::Object * _removeObject) {
|
|
||||||
ewol::widget::Composer::onObjectRemove(_removeObject);
|
|
||||||
if (_removeObject == m_searchEntry) {
|
|
||||||
m_searchEntry = NULL;
|
|
||||||
}
|
|
||||||
if (_removeObject == m_replaceEntry) {
|
|
||||||
m_replaceEntry = NULL;
|
|
||||||
}
|
|
||||||
if (_removeObject == m_viewerManager) {
|
|
||||||
m_viewerManager = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -14,35 +14,39 @@
|
|||||||
#include <ewol/widget/Entry.h>
|
#include <ewol/widget/Entry.h>
|
||||||
#include <appl/Buffer.h>
|
#include <appl/Buffer.h>
|
||||||
#include <appl/Gui/ViewerManager.h>
|
#include <appl/Gui/ViewerManager.h>
|
||||||
|
namespace appl {
|
||||||
class Search : public ewol::widget::Composer {
|
namespace widget {
|
||||||
private:
|
class Search : public ewol::widget::Composer {
|
||||||
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager
|
private:
|
||||||
bool m_forward;
|
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||||
bool m_caseSensitive;
|
bool m_forward;
|
||||||
bool m_wrap;
|
bool m_caseSensitive;
|
||||||
ewol::widget::Entry* m_searchEntry;
|
bool m_wrap;
|
||||||
ewol::widget::Entry* m_replaceEntry;
|
std::shared_ptr<ewol::widget::Entry> m_searchEntry;
|
||||||
std::u32string m_searchData;
|
std::shared_ptr<ewol::widget::Entry> m_replaceEntry;
|
||||||
std::u32string m_replaceData;
|
std::u32string m_searchData;
|
||||||
public:
|
std::u32string m_replaceData;
|
||||||
// Constructeur
|
protected:
|
||||||
Search(void);
|
// Constructeur
|
||||||
~Search(void);
|
Search();
|
||||||
private:
|
void init();
|
||||||
/**
|
public:
|
||||||
* @brief Find the next element that corespond at the search
|
DECLARE_FACTORY(Search);
|
||||||
*/
|
virtual ~Search();
|
||||||
void find(void);
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Replace the current selected text.
|
* @brief Find the next element that corespond at the search
|
||||||
*/
|
*/
|
||||||
void replace(void);
|
void find();
|
||||||
public: // derived function
|
/**
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
* @brief Replace the current selected text.
|
||||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
*/
|
||||||
|
void replace();
|
||||||
|
public: // derived function
|
||||||
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,29 +16,37 @@ extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-
|
|||||||
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
|
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
|
||||||
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||||
|
|
||||||
appl::TagFileList::TagFileList(void) {
|
appl::TagFileList::TagFileList() {
|
||||||
addObjectType("appl::TagFileList");
|
addObjectType("appl::TagFileList");
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
addEventId(applEventCtagsListSelect);
|
addEventId(applEventCtagsListSelect);
|
||||||
addEventId(applEventCtagsListValidate);
|
addEventId(applEventCtagsListValidate);
|
||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
|
// Load color properties: (use file list to be generic ...)
|
||||||
|
m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:ListFileSystem.json");
|
||||||
|
if (m_colorProperty != nullptr) {
|
||||||
|
m_colorIdText = m_colorProperty->request("text");
|
||||||
|
m_colorIdBackground1 = m_colorProperty->request("background1");
|
||||||
|
m_colorIdBackground2 = m_colorProperty->request("background2");
|
||||||
|
m_colorIdBackgroundSelected = m_colorProperty->request("selected");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void appl::TagFileList::init() {
|
||||||
|
ewol::widget::List::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appl::TagFileList::~TagFileList() {
|
||||||
appl::TagFileList::~TagFileList(void) {
|
for (auto &it : m_list) {
|
||||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
delete(it);
|
||||||
if (NULL != m_list[iii]) {
|
it = nullptr;
|
||||||
delete(m_list[iii]);
|
|
||||||
m_list[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::Color<> appl::TagFileList::getBasicBG(void) {
|
etk::Color<> appl::TagFileList::getBasicBG() {
|
||||||
return 0x00000010;
|
return 0x00000010;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t appl::TagFileList::getNuberOfColomn(void) {
|
uint32_t appl::TagFileList::getNuberOfColomn() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,40 +55,28 @@ bool appl::TagFileList::getTitle(int32_t _colomn, std::string& _myTitle, etk::Co
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t appl::TagFileList::getNuberOfRaw(void) {
|
uint32_t appl::TagFileList::getNuberOfRaw() {
|
||||||
return m_list.size();
|
return m_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||||
if (_raw >= 0 && _raw < m_list.size() && NULL != m_list[_raw]) {
|
if (_raw >= 0 && (size_t)_raw < m_list.size() && nullptr != m_list[_raw]) {
|
||||||
if (0 == _colomn) {
|
if (0 == _colomn) {
|
||||||
_myTextToWrite = std::to_string(m_list[_raw]->fileLine);
|
_myTextToWrite = etk::to_string(m_list[_raw]->fileLine);
|
||||||
} else {
|
} else {
|
||||||
_myTextToWrite = m_list[_raw]->filename;
|
_myTextToWrite = m_list[_raw]->filename;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_myTextToWrite = "ERROR";
|
_myTextToWrite = "ERROR";
|
||||||
}
|
}
|
||||||
_fg = etk::color::black;
|
_fg = m_colorProperty->get(m_colorIdText);
|
||||||
if (_raw % 2) {
|
if (_raw % 2) {
|
||||||
if (_colomn%2 == 0) {
|
_bg = m_colorProperty->get(m_colorIdBackground1);
|
||||||
_bg = 0xFFFFFF00;
|
|
||||||
} else {
|
|
||||||
_bg = 0xFFFFFF10;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (_colomn%2 == 0) {
|
_bg = m_colorProperty->get(m_colorIdBackground2);
|
||||||
_bg = 0xBFBFBFFF;
|
|
||||||
} else {
|
|
||||||
_bg = 0xCFCFCFFF;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (m_selectedLine == _raw) {
|
if (m_selectedLine == _raw) {
|
||||||
if (_colomn%2 == 0) {
|
_bg = m_colorProperty->get(m_colorIdBackgroundSelected);
|
||||||
_bg = 0x8F8FFFFF;
|
|
||||||
} else {
|
|
||||||
_bg = 0x7F7FFFFF;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -91,7 +87,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
|||||||
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||||
if (_IdInput == 1) {
|
if (_IdInput == 1) {
|
||||||
int32_t previousRaw = m_selectedLine;
|
int32_t previousRaw = m_selectedLine;
|
||||||
if (_raw > m_list.size() ) {
|
if (_raw > (int64_t)m_list.size() ) {
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
} else {
|
} else {
|
||||||
m_selectedLine = _raw;
|
m_selectedLine = _raw;
|
||||||
@@ -101,9 +97,9 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
|||||||
event = applEventCtagsListSelect;
|
event = applEventCtagsListSelect;
|
||||||
}
|
}
|
||||||
if( m_selectedLine >= 0
|
if( m_selectedLine >= 0
|
||||||
&& m_selectedLine < m_list.size()
|
&& m_selectedLine < (int64_t)m_list.size()
|
||||||
&& NULL != m_list[m_selectedLine] ) {
|
&& nullptr != m_list[m_selectedLine] ) {
|
||||||
generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
generateEventId(event, etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||||
} else {
|
} else {
|
||||||
generateEventId(applEventCtagsListUnSelect);
|
generateEventId(applEventCtagsListUnSelect);
|
||||||
}
|
}
|
||||||
@@ -123,7 +119,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
|||||||
*/
|
*/
|
||||||
void appl::TagFileList::add(std::string& _file, int32_t _line) {
|
void appl::TagFileList::add(std::string& _file, int32_t _line) {
|
||||||
appl::TagListElement *tmpFile = new appl::TagListElement(_file, _line);
|
appl::TagListElement *tmpFile = new appl::TagListElement(_file, _line);
|
||||||
if (NULL != tmpFile) {
|
if (nullptr != tmpFile) {
|
||||||
m_list.push_back(tmpFile);
|
m_list.push_back(tmpFile);
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
|
#include <ewol/resource/ColorFile.h>
|
||||||
|
|
||||||
|
|
||||||
extern const char * const applEventCtagsListSelect;
|
extern const char * const applEventCtagsListSelect;
|
||||||
@@ -27,7 +28,7 @@ namespace appl {
|
|||||||
fileLine(_line) {
|
fileLine(_line) {
|
||||||
|
|
||||||
};
|
};
|
||||||
~TagListElement(void) {
|
virtual ~TagListElement() {
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -35,14 +36,23 @@ namespace appl {
|
|||||||
private:
|
private:
|
||||||
int32_t m_selectedLine;
|
int32_t m_selectedLine;
|
||||||
std::vector<appl::TagListElement*> m_list;
|
std::vector<appl::TagListElement*> m_list;
|
||||||
|
protected:
|
||||||
|
std::shared_ptr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
|
||||||
|
int32_t m_colorIdText; //!< Color of the text.
|
||||||
|
int32_t m_colorIdBackground1; //!< Color of the Background.
|
||||||
|
int32_t m_colorIdBackground2; //!< Color of the Background 2.
|
||||||
|
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
||||||
|
protected:
|
||||||
|
TagFileList();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TagFileList(void);
|
DECLARE_FACTORY(TagFileList);
|
||||||
~TagFileList(void);
|
virtual ~TagFileList();
|
||||||
// display API :
|
// display API :
|
||||||
virtual etk::Color<> getBasicBG(void);
|
virtual etk::Color<> getBasicBG();
|
||||||
uint32_t getNuberOfColomn(void);
|
uint32_t getNuberOfColomn();
|
||||||
bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||||
uint32_t getNuberOfRaw(void);
|
uint32_t getNuberOfRaw();
|
||||||
bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||||
bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||||
public:
|
public:
|
||||||
|
@@ -30,18 +30,15 @@ extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
|||||||
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||||
|
|
||||||
|
|
||||||
appl::TagFileSelection::TagFileSelection(void) {
|
appl::TagFileSelection::TagFileSelection() {
|
||||||
addObjectType("appl::TagFileSelection");
|
addObjectType("appl::TagFileSelection");
|
||||||
addEventId(applEventctagsSelection);
|
addEventId(applEventctagsSelection);
|
||||||
addEventId(applEventctagsCancel);
|
addEventId(applEventctagsCancel);
|
||||||
|
}
|
||||||
ewol::widget::Label* myWidgetTitle = NULL;
|
|
||||||
ewol::widget::Button* myWidgetValidate = NULL;
|
void appl::TagFileSelection::init() {
|
||||||
ewol::widget::Button* myWidgetCancel = NULL;
|
ewol::widget::PopUp::init();
|
||||||
|
std::shared_ptr<ewol::widget::Sizer> mySizerVert;
|
||||||
ewol::widget::Sizer * mySizerVert = NULL;
|
|
||||||
ewol::widget::Sizer * mySizerHori = NULL;
|
|
||||||
ewol::widget::Spacer * mySpacer = NULL;
|
|
||||||
#if defined(__TARGET_OS__Android)
|
#if defined(__TARGET_OS__Android)
|
||||||
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
|
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
|
||||||
#elif defined(__TARGET_OS__Windows)
|
#elif defined(__TARGET_OS__Windows)
|
||||||
@@ -50,15 +47,15 @@ appl::TagFileSelection::TagFileSelection(void) {
|
|||||||
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
|
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert);
|
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||||
if (NULL == mySizerVert) {
|
if (nullptr == mySizerVert) {
|
||||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
mySizerVert->lockExpand(bvec2(true,true));
|
mySizerVert->lockExpand(bvec2(true,true));
|
||||||
mySizerVert->setExpand(bvec2(true,true));
|
mySizerVert->setExpand(bvec2(true,true));
|
||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
setSubWidget(mySizerVert);
|
setSubWidget(mySizerVert);
|
||||||
ewol::widget::Composer* compose = new ewol::widget::Composer(ewol::widget::Composer::String,
|
std::shared_ptr<ewol::widget::Composer> compose = ewol::widget::Composer::create(ewol::widget::Composer::String,
|
||||||
"<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n"
|
"<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n"
|
||||||
" <spacer expand=\"true,false\"/>\n"
|
" <spacer expand=\"true,false\"/>\n"
|
||||||
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
|
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
|
||||||
@@ -77,23 +74,24 @@ appl::TagFileSelection::TagFileSelection(void) {
|
|||||||
compose->setExpand(bvec2(true,false));
|
compose->setExpand(bvec2(true,false));
|
||||||
compose->setFill(bvec2(true,true));
|
compose->setFill(bvec2(true,true));
|
||||||
mySizerVert->subWidgetAdd(compose);
|
mySizerVert->subWidgetAdd(compose);
|
||||||
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
|
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
|
||||||
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
|
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
|
||||||
|
|
||||||
m_listTag = new appl::TagFileList();
|
m_listTag = appl::TagFileList::create();
|
||||||
if (NULL == m_listTag) {
|
if (nullptr == m_listTag) {
|
||||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
m_listTag->registerOnEvent(this, applEventCtagsListValidate);
|
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListValidate);
|
||||||
m_listTag->registerOnEvent(this, applEventCtagsListSelect);
|
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListSelect);
|
||||||
m_listTag->registerOnEvent(this, applEventCtagsListUnSelect);
|
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListUnSelect);
|
||||||
m_listTag->setExpand(bvec2(true,true));
|
m_listTag->setExpand(bvec2(true,true));
|
||||||
m_listTag->setFill(bvec2(true,true));
|
m_listTag->setFill(bvec2(true,true));
|
||||||
mySizerVert->subWidgetAdd(m_listTag);
|
mySizerVert->subWidgetAdd(m_listTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
myWidgetTitle = new ewol::widget::Label("Ctags Jump Selection ...");
|
std::shared_ptr<ewol::widget::Label> myWidgetTitle;
|
||||||
if (NULL == myWidgetTitle) {
|
myWidgetTitle = ewol::widget::Label::create("Ctags Jump Selection ...");
|
||||||
|
if (nullptr == myWidgetTitle) {
|
||||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
mySizerVert->subWidgetAdd(myWidgetTitle);
|
mySizerVert->subWidgetAdd(myWidgetTitle);
|
||||||
@@ -102,7 +100,7 @@ appl::TagFileSelection::TagFileSelection(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::TagFileSelection::~TagFileSelection(void) {
|
appl::TagFileSelection::~TagFileSelection() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,21 +136,8 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::object::Message& _msg)
|
|||||||
* @param[in] jump line id
|
* @param[in] jump line id
|
||||||
*/
|
*/
|
||||||
void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) {
|
void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) {
|
||||||
if (NULL != m_listTag) {
|
if (nullptr != m_listTag) {
|
||||||
m_listTag->add(_file, _line);
|
m_listTag->add(_file, _line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TagFileSelection::onObjectRemove(ewol::Object * _removeObject) {
|
|
||||||
// First step call parrent :
|
|
||||||
ewol::widget::PopUp::onObjectRemove(_removeObject);
|
|
||||||
// second step find if in all the elements ...
|
|
||||||
if(_removeObject == m_listTag) {
|
|
||||||
m_listTag = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,11 +19,14 @@ extern const char * const applEventctagsCancel;
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class TagFileSelection : public ewol::widget::PopUp {
|
class TagFileSelection : public ewol::widget::PopUp {
|
||||||
private:
|
private:
|
||||||
appl::TagFileList* m_listTag;
|
std::shared_ptr<appl::TagFileList> m_listTag;
|
||||||
std::string m_eventNamed;
|
std::string m_eventNamed;
|
||||||
public:
|
public:
|
||||||
TagFileSelection(void);
|
TagFileSelection();
|
||||||
virtual ~TagFileSelection(void);
|
void init();
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(TagFileSelection);
|
||||||
|
virtual ~TagFileSelection();
|
||||||
/**
|
/**
|
||||||
* @brief add a Ctags item on the curent list
|
* @brief add a Ctags item on the curent list
|
||||||
* @param[in] file Compleate file name
|
* @param[in] file Compleate file name
|
||||||
@@ -32,7 +35,6 @@ namespace appl {
|
|||||||
void addCtagsNewItem(std::string file, int32_t line);
|
void addCtagsNewItem(std::string file, int32_t line);
|
||||||
public: // herited function
|
public: // herited function
|
||||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -28,26 +28,19 @@
|
|||||||
int64_t processTimeLocal = (endTime - startTime); \
|
int64_t processTimeLocal = (endTime - startTime); \
|
||||||
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
|
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
|
||||||
|
|
||||||
appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
appl::TextViewer::TextViewer() :
|
||||||
m_buffer(NULL),
|
|
||||||
m_displayText(_fontName, _fontSize),
|
|
||||||
m_insertMode(false) {
|
m_insertMode(false) {
|
||||||
addObjectType("appl::TextViewer");
|
addObjectType("appl::TextViewer");
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
registerMultiCast(ednMsgBufferId);
|
|
||||||
registerMultiCast(ednMsgGuiFind);
|
|
||||||
registerMultiCast(ednMsgGuiReplace);
|
|
||||||
registerMultiCast(appl::MsgSelectGotoLine);
|
|
||||||
registerMultiCast(appl::MsgSelectNewFile);
|
|
||||||
registerMultiCast(appl::MsgSelectGotoLineSelect);
|
|
||||||
setLimitScrolling(0.2);
|
setLimitScrolling(0.2);
|
||||||
|
setSingleFinger(false);
|
||||||
|
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
m_viewerManager = appl::ViewerManager::keep();
|
m_viewerManager = appl::ViewerManager::create();
|
||||||
|
|
||||||
// load color properties
|
// load color properties
|
||||||
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:textViewer.json");
|
m_paintingProperties = appl::GlyphPainting::create("THEME:COLOR:textViewer.json");
|
||||||
// get all id properties ...
|
// get all id properties ...
|
||||||
m_colorBackground = m_paintingProperties->request("CODE_basicBackgroung");
|
m_colorBackground = m_paintingProperties->request("CODE_basicBackgroung");
|
||||||
m_colorSpace = m_paintingProperties->request("CODE_space");
|
m_colorSpace = m_paintingProperties->request("CODE_space");
|
||||||
@@ -56,17 +49,38 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
|||||||
m_colorLineNumber = m_paintingProperties->request("CODE_lineNumber");
|
m_colorLineNumber = m_paintingProperties->request("CODE_lineNumber");
|
||||||
m_colorSelection = m_paintingProperties->request("SelectedText");
|
m_colorSelection = m_paintingProperties->request("SelectedText");
|
||||||
m_colorNormal = m_paintingProperties->request("normal");
|
m_colorNormal = m_paintingProperties->request("normal");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
|
||||||
|
ewol::widget::WidgetScrolled::init();
|
||||||
|
m_displayText.setFont(_fontName, _fontSize);
|
||||||
appl::textPluginManager::connect(*this);
|
appl::textPluginManager::connect(*this);
|
||||||
// last created has focus ...
|
// last created has focus ...
|
||||||
setCurrentSelect();
|
setCurrentSelect();
|
||||||
|
|
||||||
|
registerMultiCast(ednMsgBufferId);
|
||||||
|
registerMultiCast(ednMsgGuiFind);
|
||||||
|
registerMultiCast(ednMsgGuiReplace);
|
||||||
|
registerMultiCast(appl::MsgSelectGotoLine);
|
||||||
|
registerMultiCast(appl::MsgSelectNewFile);
|
||||||
|
registerMultiCast(appl::MsgSelectGotoLineSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::TextViewer::~TextViewer(void) {
|
|
||||||
|
appl::TextViewer::~TextViewer() {
|
||||||
appl::textPluginManager::disconnect(*this);
|
appl::textPluginManager::disconnect(*this);
|
||||||
appl::GlyphPainting::release(m_paintingProperties);
|
}
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
appl::ViewerManager::release(m_viewerManager);
|
std::string appl::TextViewer::getBufferPath() {
|
||||||
|
if (m_buffer == nullptr) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
std::string filename = m_buffer->getFileName();
|
||||||
|
size_t pos = filename.rfind('/');
|
||||||
|
if (pos == std::string::npos) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return std::string(filename, 0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::changeZoom(float _range) {
|
void appl::TextViewer::changeZoom(float _range) {
|
||||||
@@ -74,19 +88,19 @@ void appl::TextViewer::changeZoom(float _range) {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::calculateMinSize(void) {
|
bool appl::TextViewer::calculateMinSize() {
|
||||||
m_minSize.setValue(50,50);
|
m_minSize.setValue(50,50);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::TextViewer::onDraw(void) {
|
void appl::TextViewer::onDraw() {
|
||||||
m_displayDrawing.draw();
|
m_displayDrawing.draw();
|
||||||
m_displayText.draw();
|
m_displayText.draw();
|
||||||
WidgetScrolled::onDraw();
|
WidgetScrolled::onDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::onRegenerateDisplay(void) {
|
void appl::TextViewer::onRegenerateDisplay() {
|
||||||
if (false == needRedraw()) {
|
if (false == needRedraw()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -100,7 +114,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
m_displayDrawing.setColor((*m_paintingProperties)[m_colorBackground].getForeground());
|
m_displayDrawing.setColor((*m_paintingProperties)[m_colorBackground].getForeground());
|
||||||
m_displayDrawing.rectangleWidth(m_size);
|
m_displayDrawing.rectangleWidth(m_size);
|
||||||
|
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
m_maxSize.setX(256);
|
m_maxSize.setX(256);
|
||||||
m_maxSize.setY(256);
|
m_maxSize.setY(256);
|
||||||
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::compositing::alignLeft);
|
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::compositing::alignLeft);
|
||||||
@@ -129,14 +143,11 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
vec3 tmpCursorPosition(0, 0, -1);
|
vec3 tmpCursorPosition(0, 0, -1);
|
||||||
float tmpCursorLenght = -1.0;
|
float tmpCursorLenght = -1.0;
|
||||||
// real display ...
|
// real display ...
|
||||||
etk::Buffer& buf = m_buffer->getData();
|
m_displayText.setColor(etk::Color<>(0, 0, 0, 255));
|
||||||
m_displayText.setColor(etk::Color<>(0, 0, 0, 256));
|
|
||||||
float countNbLine = 1;
|
float countNbLine = 1;
|
||||||
int32_t countColomn = 0;
|
int32_t countColomn = 0;
|
||||||
// the siplay string :
|
// the siplay string :
|
||||||
std::u32string stringToDisplay;
|
std::u32string stringToDisplay;
|
||||||
int64_t bufferElementSize = 0;
|
|
||||||
bool isSelect = false;
|
|
||||||
appl::Buffer::Iterator selectPosStart = m_buffer->begin();
|
appl::Buffer::Iterator selectPosStart = m_buffer->begin();
|
||||||
appl::Buffer::Iterator selectPosStop = m_buffer->begin();
|
appl::Buffer::Iterator selectPosStop = m_buffer->begin();
|
||||||
if (m_buffer->hasTextSelected() == true) {
|
if (m_buffer->hasTextSelected() == true) {
|
||||||
@@ -198,7 +209,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
appl::DisplayHLData displayLocalSyntax;
|
appl::DisplayHLData displayLocalSyntax;
|
||||||
m_buffer->hightlightGenerateLines(displayLocalSyntax, startingIt, (m_size.y()/tmpLetterSize.y()) + 5);
|
m_buffer->hightlightGenerateLines(displayLocalSyntax, startingIt, (m_size.y()/tmpLetterSize.y()) + 5);
|
||||||
float maxSizeX = 0;
|
float maxSizeX = 0;
|
||||||
appl::HighlightInfo * HLColor = NULL;
|
appl::HighlightInfo * HLColor = nullptr;
|
||||||
bool DisplayCursorAndSelection = isSelectedLast();
|
bool DisplayCursorAndSelection = isSelectedLast();
|
||||||
appl::Buffer::Iterator it;
|
appl::Buffer::Iterator it;
|
||||||
for (it = startingIt;
|
for (it = startingIt;
|
||||||
@@ -214,12 +225,12 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
if (*it == u32char::Return) {
|
if (*it == u32char::Return) {
|
||||||
countNbLine += 1;
|
countNbLine += 1;
|
||||||
countColomn = 0;
|
countColomn = 0;
|
||||||
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX);
|
maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
|
||||||
// Display the end line position only if we have the focus ...
|
// Display the end line position only if we have the focus ...
|
||||||
if (DisplayCursorAndSelection == true) {
|
if (DisplayCursorAndSelection == true) {
|
||||||
if (it >= selectPosStart && it < selectPosStop) {
|
if (it >= selectPosStart && it < selectPosStop) {
|
||||||
ewol::compositing::Drawing& draw = m_displayText.getDrawing();
|
ewol::compositing::Drawing& draw = m_displayText.getDrawing();
|
||||||
draw.setColor(etk::Color<>(0xFF0000FF));
|
draw.setColor(etk::Color<>(0xFF, 0x00, 0x00, 0xFF));
|
||||||
draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f);
|
draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f);
|
||||||
draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f);
|
draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f);
|
||||||
}
|
}
|
||||||
@@ -236,8 +247,8 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (int64_t)it);
|
HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (int64_t)it);
|
||||||
bool haveBackground = false;
|
bool haveBackground = false;
|
||||||
if ( HLColor != NULL
|
if ( HLColor != nullptr
|
||||||
&& HLColor->patern != NULL) {
|
&& HLColor->patern != nullptr) {
|
||||||
m_displayText.setColor(HLColor->patern->getColorGlyph().getForeground());
|
m_displayText.setColor(HLColor->patern->getColorGlyph().getForeground());
|
||||||
m_displayText.setColorBg(HLColor->patern->getColorGlyph().getBackground());
|
m_displayText.setColorBg(HLColor->patern->getColorGlyph().getBackground());
|
||||||
haveBackground = HLColor->patern->getColorGlyph().haveBackground();
|
haveBackground = HLColor->patern->getColorGlyph().haveBackground();
|
||||||
@@ -275,7 +286,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
tmpCursorPosition = m_displayText.getPos();
|
tmpCursorPosition = m_displayText.getPos();
|
||||||
tmpCursorLenght = 5;
|
tmpCursorLenght = 5;
|
||||||
}
|
}
|
||||||
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX);
|
maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
|
||||||
// Display cursor only if we have the focus ...
|
// Display cursor only if we have the focus ...
|
||||||
if ( tmpCursorPosition.z() != -1
|
if ( tmpCursorPosition.z() != -1
|
||||||
&& getFocus() == true) {
|
&& getFocus() == true) {
|
||||||
@@ -307,7 +318,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// First call plugin
|
// First call plugin
|
||||||
@@ -352,7 +363,8 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
|||||||
m_buffer->setSelectMode(false);
|
m_buffer->setSelectMode(false);
|
||||||
// normal adding char ...
|
// normal adding char ...
|
||||||
char output[5];
|
char output[5];
|
||||||
int32_t nbElement = u32char::convertUtf8(localValue, output);
|
output[0] = '0';
|
||||||
|
u32char::convertUtf8(localValue, output);
|
||||||
if ( m_buffer->hasTextSelected() == false
|
if ( m_buffer->hasTextSelected() == false
|
||||||
&& _event.getSpecialKey().getInsert() == true) {
|
&& _event.getSpecialKey().getInsert() == true) {
|
||||||
appl::Buffer::Iterator pos = m_buffer->cursor();
|
appl::Buffer::Iterator pos = m_buffer->cursor();
|
||||||
@@ -368,7 +380,6 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
|||||||
}
|
}
|
||||||
// move events ...
|
// move events ...
|
||||||
if (_event.getStatus() == ewol::key::statusDown) {
|
if (_event.getStatus() == ewol::key::statusDown) {
|
||||||
bool needUpdatePosition = true;
|
|
||||||
// selection when shift is set:
|
// selection when shift is set:
|
||||||
m_buffer->setSelectMode(_event.getSpecialKey().getShift());
|
m_buffer->setSelectMode(_event.getSpecialKey().getShift());
|
||||||
// check selection event ...
|
// check selection event ...
|
||||||
@@ -418,23 +429,26 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
||||||
if (_event.getId() != 0) {
|
if ( _event.getId() != 0
|
||||||
|
&& _event.getStatus() == ewol::key::statusDown) {
|
||||||
keepFocus();
|
keepFocus();
|
||||||
}
|
}
|
||||||
//tic();
|
//tic();
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// First call the scrolling widget :
|
// First call the scrolling widget :
|
||||||
if (WidgetScrolled::onEventInput(_event) == true) {
|
if (ewol::widget::WidgetScrolled::onEventInput(_event) == true) {
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
APPL_VERBOSE("event : " << _event);
|
||||||
// Second call plugin
|
// Second call plugin
|
||||||
if (appl::textPluginManager::onEventInput(*this, _event) == true) {
|
if (appl::textPluginManager::onEventInput(*this, _event) == true) {
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
APPL_VERBOSE("event2 : " << _event);
|
||||||
vec2 relativePos = relativePosition(_event.getPos());
|
vec2 relativePos = relativePosition(_event.getPos());
|
||||||
// offset for the lineNumber:
|
// offset for the lineNumber:
|
||||||
relativePos -= vec2(m_lastOffsetDisplay, 0);
|
relativePos -= vec2(m_lastOffsetDisplay, 0);
|
||||||
@@ -537,7 +551,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::TextViewer::mouseEventDouble(void) {
|
void appl::TextViewer::mouseEventDouble() {
|
||||||
//m_selectMode = false;
|
//m_selectMode = false;
|
||||||
appl::Buffer::Iterator beginPos, endPos;
|
appl::Buffer::Iterator beginPos, endPos;
|
||||||
if (true == m_buffer->getPosAround(m_buffer->cursor(), beginPos, endPos)) {
|
if (true == m_buffer->getPosAround(m_buffer->cursor(), beginPos, endPos)) {
|
||||||
@@ -546,7 +560,7 @@ void appl::TextViewer::mouseEventDouble(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::mouseEventTriple(void) {
|
void appl::TextViewer::mouseEventTriple() {
|
||||||
//m_selectMode = false;
|
//m_selectMode = false;
|
||||||
moveCursor(m_buffer->getEndLine(m_buffer->cursor()));
|
moveCursor(m_buffer->getEndLine(m_buffer->cursor()));
|
||||||
m_buffer->setSelectionPos(m_buffer->getStartLine(m_buffer->cursor()));
|
m_buffer->setSelectionPos(m_buffer->getStartLine(m_buffer->cursor()));
|
||||||
@@ -604,7 +618,7 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
||||||
if (m_buffer != NULL) {
|
if (m_buffer != nullptr) {
|
||||||
std::string data = ewol::context::clipBoard::get(_clipboardID);
|
std::string data = ewol::context::clipBoard::get(_clipboardID);
|
||||||
write(data);
|
write(data);
|
||||||
}
|
}
|
||||||
@@ -615,7 +629,7 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
ewol::widget::WidgetScrolled::onReceiveMessage(_msg);
|
ewol::widget::WidgetScrolled::onReceiveMessage(_msg);
|
||||||
APPL_VERBOSE("receive msg: " << _msg);
|
APPL_VERBOSE("receive msg: " << _msg);
|
||||||
// First call plugin
|
// First call plugin
|
||||||
if (appl::textPluginManager::onReceiveMessage(*this, _msg) == true) {
|
if (appl::textPluginManager::onReceiveMessageViewer(*this, _msg) == true) {
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -633,27 +647,27 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
|
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
|
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
|
||||||
select(it, m_buffer->getEndLine(it));
|
select(it, m_buffer->getEndLine(it));
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
|
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
|
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
|
||||||
moveCursor(it);
|
moveCursor(it);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||||
// reset scroll:
|
// reset scroll:
|
||||||
if (m_buffer != NULL) {
|
if (m_buffer != nullptr) {
|
||||||
m_buffer->unRegisterOnEvent(this);
|
m_buffer->unRegisterOnEvent(shared_from_this());
|
||||||
bool needAdd = true;
|
bool needAdd = true;
|
||||||
for (size_t iii=0; iii<m_drawingRemenber.size(); ++iii) {
|
for (size_t iii=0; iii<m_drawingRemenber.size(); ++iii) {
|
||||||
if (m_drawingRemenber[iii].first == m_buffer) {
|
if (m_drawingRemenber[iii].first == m_buffer) {
|
||||||
@@ -669,12 +683,12 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_originScrooled = vec2(0,0);
|
m_originScrooled = vec2(0,0);
|
||||||
if (m_bufferManager != NULL) {
|
if (m_bufferManager != nullptr) {
|
||||||
m_buffer = m_bufferManager->get(_msg.getData());
|
m_buffer = m_bufferManager->get(_msg.getData());
|
||||||
m_bufferManager->setBufferSelected(m_buffer);
|
m_bufferManager->setBufferSelected(m_buffer);
|
||||||
if (m_buffer != NULL) {
|
if (m_buffer != nullptr) {
|
||||||
m_buffer->registerOnEvent(this, appl::Buffer::eventIsModify);
|
m_buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventIsModify);
|
||||||
m_buffer->registerOnEvent(this, appl::Buffer::eventSelectChange);
|
m_buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventSelectChange);
|
||||||
for (auto element : m_drawingRemenber) {
|
for (auto element : m_drawingRemenber) {
|
||||||
if (element.first == m_buffer) {
|
if (element.first == m_buffer) {
|
||||||
m_originScrooled = element.second;
|
m_originScrooled = element.second;
|
||||||
@@ -690,22 +704,14 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::onObjectRemove(ewol::Object* _removeObject) {
|
void appl::TextViewer::onGetFocus() {
|
||||||
ewol::widget::WidgetScrolled::onObjectRemove(_removeObject);
|
|
||||||
if (m_buffer == _removeObject) {
|
|
||||||
m_buffer = NULL;
|
|
||||||
markToRedraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::TextViewer::onGetFocus(void) {
|
|
||||||
showKeyboard();
|
showKeyboard();
|
||||||
APPL_INFO("Focus - In");
|
APPL_INFO("Focus - In");
|
||||||
setCurrentSelect();
|
setCurrentSelect();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::onLostFocus(void) {
|
void appl::TextViewer::onLostFocus() {
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
APPL_INFO("Focus - out");
|
APPL_INFO("Focus - out");
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -721,8 +727,8 @@ void appl::TextViewer::setFontName(const std::string& _fontName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Update process time ==> a little expensive (2->4ms) in end of file
|
// TODO : Update process time ==> a little expensive (2->4ms) in end of file
|
||||||
void appl::TextViewer::updateScrolling(void) {
|
void appl::TextViewer::updateScrolling() {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
vec2 realCursorPosition(0,0);
|
vec2 realCursorPosition(0,0);
|
||||||
@@ -751,7 +757,7 @@ void appl::TextViewer::updateScrolling(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
|
bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -765,7 +771,7 @@ bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::write(const std::string& _data) {
|
bool appl::TextViewer::write(const std::string& _data) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_buffer->hasTextSelected() == true) {
|
if (m_buffer->hasTextSelected() == true) {
|
||||||
@@ -775,7 +781,7 @@ bool appl::TextViewer::write(const std::string& _data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) {
|
bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -791,7 +797,7 @@ bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Itera
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -807,7 +813,7 @@ bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::replace(const std::string& _data) {
|
bool appl::TextViewer::replace(const std::string& _data) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_buffer->hasTextSelected() == false) {
|
if (m_buffer->hasTextSelected() == false) {
|
||||||
@@ -816,8 +822,8 @@ bool appl::TextViewer::replace(const std::string& _data) {
|
|||||||
return replace(_data, m_buffer->selectStart(), m_buffer->selectStop());
|
return replace(_data, m_buffer->selectStart(), m_buffer->selectStop());
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::remove(void) {
|
void appl::TextViewer::remove() {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_buffer->hasTextSelected() == false) {
|
if (m_buffer->hasTextSelected() == false) {
|
||||||
@@ -835,7 +841,7 @@ void appl::TextViewer::remove(void) {
|
|||||||
|
|
||||||
|
|
||||||
void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
|
void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -858,7 +864,7 @@ void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
|
void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -881,7 +887,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
|
void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -907,7 +913,7 @@ void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::moveCursorDown(uint32_t _nbLine) {
|
void appl::TextViewer::moveCursorDown(uint32_t _nbLine) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@@ -986,15 +992,15 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::setCurrentSelect(void) {
|
void appl::TextViewer::setCurrentSelect() {
|
||||||
if (m_viewerManager != NULL) {
|
if (m_viewerManager != nullptr) {
|
||||||
m_viewerManager->setViewerSelected(this, m_buffer);
|
m_viewerManager->setViewerSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()), m_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextViewer::isSelectedLast(void) {
|
bool appl::TextViewer::isSelectedLast() {
|
||||||
if (m_viewerManager != NULL) {
|
if (m_viewerManager != nullptr) {
|
||||||
return m_viewerManager->isLastSelected(this);
|
return m_viewerManager->isLastSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class TextViewer : public ewol::widget::WidgetScrolled {
|
class TextViewer : public ewol::widget::WidgetScrolled {
|
||||||
private:
|
private:
|
||||||
appl::GlyphPainting* m_paintingProperties; //!< element painting property
|
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||||
int32_t m_colorBackground;
|
int32_t m_colorBackground;
|
||||||
int32_t m_colorSpace;
|
int32_t m_colorSpace;
|
||||||
int32_t m_colorTabulation;
|
int32_t m_colorTabulation;
|
||||||
@@ -33,40 +33,42 @@ namespace appl {
|
|||||||
int32_t m_colorSelection;
|
int32_t m_colorSelection;
|
||||||
int32_t m_colorNormal;
|
int32_t m_colorNormal;
|
||||||
private:
|
private:
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||||
|
protected:
|
||||||
|
TextViewer();
|
||||||
|
void init(const std::string& _fontName="", int32_t _fontSize=-1);
|
||||||
public:
|
public:
|
||||||
TextViewer(const std::string& _fontName="", int32_t _fontSize=-1);
|
DECLARE_FACTORY(TextViewer);
|
||||||
virtual ~TextViewer(void);
|
virtual ~TextViewer();
|
||||||
private:
|
private:
|
||||||
appl::Buffer* m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
|
std::shared_ptr<appl::Buffer> m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
|
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
|
||||||
* @return pointer on buffer
|
* @return pointer on buffer
|
||||||
*/
|
*/
|
||||||
appl::Buffer* internalGetBuffer(void) {
|
std::shared_ptr<appl::Buffer> internalGetBuffer() {
|
||||||
return m_buffer;
|
return m_buffer;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
ewol::compositing::Text m_displayText; //!< Text display properties.
|
ewol::compositing::Text m_displayText; //!< Text display properties.
|
||||||
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
|
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
|
||||||
std::vector<std::pair<appl::Buffer*, vec2>> m_drawingRemenber;
|
std::vector<std::pair<std::shared_ptr<appl::Buffer>, vec2>> m_drawingRemenber;
|
||||||
public:
|
public:
|
||||||
void setFontSize(int32_t _size);
|
void setFontSize(int32_t _size);
|
||||||
void setFontName(const std::string& _fontName);
|
void setFontName(const std::string& _fontName);
|
||||||
protected: // derived function
|
protected: // derived function
|
||||||
virtual void onDraw(void);
|
virtual void onDraw();
|
||||||
public: // Derived function
|
public: // Derived function
|
||||||
virtual bool calculateMinSize(void);
|
virtual bool calculateMinSize();
|
||||||
virtual void onRegenerateDisplay(void);
|
virtual void onRegenerateDisplay();
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object* _removeObject);
|
|
||||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||||
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
||||||
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
|
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
|
||||||
virtual void onGetFocus(void);
|
virtual void onGetFocus();
|
||||||
virtual void onLostFocus(void);
|
virtual void onLostFocus();
|
||||||
virtual void changeZoom(float _range);
|
virtual void changeZoom(float _range);
|
||||||
private:
|
private:
|
||||||
float m_lastOffsetDisplay; //!< Line number ofssed in the display
|
float m_lastOffsetDisplay; //!< Line number ofssed in the display
|
||||||
@@ -77,7 +79,7 @@ namespace appl {
|
|||||||
* @brief Update the scrolling position from the cursor position,
|
* @brief Update the scrolling position from the cursor position,
|
||||||
* it might be be all time in the display screen.
|
* it might be be all time in the display screen.
|
||||||
*/
|
*/
|
||||||
void updateScrolling(void);
|
void updateScrolling();
|
||||||
// TODO : Doc : write data on buffer
|
// TODO : Doc : write data on buffer
|
||||||
bool moveCursor(const appl::Buffer::Iterator& _pos);
|
bool moveCursor(const appl::Buffer::Iterator& _pos);
|
||||||
bool write(const std::string& _data);
|
bool write(const std::string& _data);
|
||||||
@@ -85,17 +87,17 @@ namespace appl {
|
|||||||
bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd);
|
bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd);
|
||||||
bool replace(const std::string& _data);
|
bool replace(const std::string& _data);
|
||||||
bool replace(const std::u32string& _data) {
|
bool replace(const std::u32string& _data) {
|
||||||
return replace(std::to_string(_data));
|
return replace(etk::to_string(_data));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Remove selected data ...
|
* @brief Remove selected data ...
|
||||||
*/
|
*/
|
||||||
void remove(void);
|
void remove();
|
||||||
/**
|
/**
|
||||||
* @brief Remove selected data ... (No plugin call)
|
* @brief Remove selected data ... (No plugin call)
|
||||||
*/
|
*/
|
||||||
void removeDirect(void) {
|
void removeDirect() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_buffer->removeSelection();
|
m_buffer->removeSelection();
|
||||||
@@ -108,7 +110,7 @@ namespace appl {
|
|||||||
* @return true of no error occured.
|
* @return true of no error occured.
|
||||||
*/
|
*/
|
||||||
bool copy(std::string& _data) {
|
bool copy(std::string& _data) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_buffer->copy(_data);
|
return m_buffer->copy(_data);
|
||||||
@@ -120,7 +122,7 @@ namespace appl {
|
|||||||
* @param[in] _posEnd End position to end replace the data.
|
* @param[in] _posEnd End position to end replace the data.
|
||||||
*/
|
*/
|
||||||
void copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
void copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_buffer->copy(_data, _pos, _posEnd);
|
m_buffer->copy(_data, _pos, _posEnd);
|
||||||
@@ -132,7 +134,7 @@ namespace appl {
|
|||||||
* @return true if the write is done corectly
|
* @return true if the write is done corectly
|
||||||
*/
|
*/
|
||||||
bool writeDirect(const std::string& _data, const appl::Buffer::Iterator& _pos) {
|
bool writeDirect(const std::string& _data, const appl::Buffer::Iterator& _pos) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ret = m_buffer->write(_data, _pos);
|
bool ret = m_buffer->write(_data, _pos);
|
||||||
@@ -147,7 +149,7 @@ namespace appl {
|
|||||||
* @return true if the write is done corectly
|
* @return true if the write is done corectly
|
||||||
*/
|
*/
|
||||||
bool replaceDirect(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
bool replaceDirect(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ret = m_buffer->replace(_data, _pos, _posEnd);
|
bool ret = m_buffer->replace(_data, _pos, _posEnd);
|
||||||
@@ -156,8 +158,8 @@ namespace appl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator getMousePosition(const vec2& _relativePos);
|
appl::Buffer::Iterator getMousePosition(const vec2& _relativePos);
|
||||||
void mouseEventDouble(void);
|
void mouseEventDouble();
|
||||||
void mouseEventTriple(void);
|
void mouseEventTriple();
|
||||||
private:
|
private:
|
||||||
enum moveMode {
|
enum moveMode {
|
||||||
moveLetter,
|
moveLetter,
|
||||||
@@ -191,26 +193,31 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Set the current buffer selected
|
* @brief Set the current buffer selected
|
||||||
*/
|
*/
|
||||||
void setCurrentSelect(void);
|
void setCurrentSelect();
|
||||||
/**
|
/**
|
||||||
* @brief Check if the current buffer is last selected
|
* @brief Check if the current buffer is last selected
|
||||||
* @return true if selected last
|
* @return true if selected last
|
||||||
*/
|
*/
|
||||||
bool isSelectedLast(void);
|
bool isSelectedLast();
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief get the path of the current buffer
|
||||||
|
* @return Path of the buffer (remove the ended name)
|
||||||
|
*/
|
||||||
|
virtual std::string getBufferPath();
|
||||||
/**
|
/**
|
||||||
* @brief Check if the buffer is availlable
|
* @brief Check if the buffer is availlable
|
||||||
* @return true if a display buffer is present, false otherwise.
|
* @return true if a display buffer is present, false otherwise.
|
||||||
*/
|
*/
|
||||||
virtual bool hasBuffer(void) {
|
virtual bool hasBuffer() {
|
||||||
return m_buffer != NULL;
|
return m_buffer != nullptr;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get the status of selection.
|
* @brief Get the status of selection.
|
||||||
* @return true if we have a current selection, false otherwise.
|
* @return true if we have a current selection, false otherwise.
|
||||||
*/
|
*/
|
||||||
virtual bool hasTextSelected(void) {
|
virtual bool hasTextSelected() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_buffer->hasTextSelected();
|
return m_buffer->hasTextSelected();
|
||||||
@@ -218,8 +225,8 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Remove Selection of the buffer.
|
* @brief Remove Selection of the buffer.
|
||||||
*/
|
*/
|
||||||
virtual void unSelect(void) {
|
virtual void unSelect() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_buffer->unSelect();
|
m_buffer->unSelect();
|
||||||
@@ -230,7 +237,7 @@ namespace appl {
|
|||||||
* @param[in] _stop Stop position of the selection (the curor is set at this position)
|
* @param[in] _stop Stop position of the selection (the curor is set at this position)
|
||||||
*/
|
*/
|
||||||
virtual void select(const appl::Buffer::Iterator& _start, const appl::Buffer::Iterator& _stop) {
|
virtual void select(const appl::Buffer::Iterator& _start, const appl::Buffer::Iterator& _stop) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
moveCursor(_stop);
|
moveCursor(_stop);
|
||||||
@@ -250,7 +257,7 @@ namespace appl {
|
|||||||
appl::Buffer::Iterator& _resultStart,
|
appl::Buffer::Iterator& _resultStart,
|
||||||
appl::Buffer::Iterator& _resultStop,
|
appl::Buffer::Iterator& _resultStop,
|
||||||
bool _caseSensitive = true) {
|
bool _caseSensitive = true) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ret = m_buffer->search(_pos, _search, _resultStart, _caseSensitive);
|
bool ret = m_buffer->search(_pos, _search, _resultStart, _caseSensitive);
|
||||||
@@ -273,7 +280,7 @@ namespace appl {
|
|||||||
appl::Buffer::Iterator& _resultStart,
|
appl::Buffer::Iterator& _resultStart,
|
||||||
appl::Buffer::Iterator& _resultStop,
|
appl::Buffer::Iterator& _resultStop,
|
||||||
bool _caseSensitive = true) {
|
bool _caseSensitive = true) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ret = m_buffer->searchBack(_pos, _search, _resultStart, _caseSensitive);
|
bool ret = m_buffer->searchBack(_pos, _search, _resultStart, _caseSensitive);
|
||||||
@@ -292,7 +299,7 @@ namespace appl {
|
|||||||
bool getPosAround(const appl::Buffer::Iterator& _pos,
|
bool getPosAround(const appl::Buffer::Iterator& _pos,
|
||||||
appl::Buffer::Iterator &_beginPos,
|
appl::Buffer::Iterator &_beginPos,
|
||||||
appl::Buffer::Iterator &_endPos) {
|
appl::Buffer::Iterator &_endPos) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_buffer->getPosAround(_pos, _beginPos, _endPos);
|
return m_buffer->getPosAround(_pos, _beginPos, _endPos);
|
||||||
@@ -303,7 +310,7 @@ namespace appl {
|
|||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator position(int64_t _pos) {
|
appl::Buffer::Iterator position(int64_t _pos) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->position(_pos);
|
return m_buffer->position(_pos);
|
||||||
@@ -312,8 +319,8 @@ namespace appl {
|
|||||||
* @brief Get the cursor position.
|
* @brief Get the cursor position.
|
||||||
* @return The iterator on the cursor position
|
* @return The iterator on the cursor position
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator cursor(void) {
|
appl::Buffer::Iterator cursor() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->cursor();
|
return m_buffer->cursor();
|
||||||
@@ -322,8 +329,8 @@ namespace appl {
|
|||||||
* @brief Get the begin position.
|
* @brief Get the begin position.
|
||||||
* @return The iterator on the begin position
|
* @return The iterator on the begin position
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator begin(void) {
|
appl::Buffer::Iterator begin() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->begin();
|
return m_buffer->begin();
|
||||||
@@ -332,8 +339,8 @@ namespace appl {
|
|||||||
* @brief Get the end position.
|
* @brief Get the end position.
|
||||||
* @return The iterator on the end position
|
* @return The iterator on the end position
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator end(void) {
|
appl::Buffer::Iterator end() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->end();
|
return m_buffer->end();
|
||||||
@@ -342,8 +349,8 @@ namespace appl {
|
|||||||
* @brief Get an Iterator on the start selection.
|
* @brief Get an Iterator on the start selection.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator selectStart(void) {
|
appl::Buffer::Iterator selectStart() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->selectStart();
|
return m_buffer->selectStart();
|
||||||
@@ -352,8 +359,8 @@ namespace appl {
|
|||||||
* @brief Get an Iterator on the stop selection.
|
* @brief Get an Iterator on the stop selection.
|
||||||
* @return The Iterator
|
* @return The Iterator
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator selectStop(void) {
|
appl::Buffer::Iterator selectStop() {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->selectStop();
|
return m_buffer->selectStop();
|
||||||
@@ -364,7 +371,7 @@ namespace appl {
|
|||||||
* @return The position in the buffer of the start of the line.
|
* @return The position in the buffer of the start of the line.
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator getStartLine(const appl::Buffer::Iterator& _pos) {
|
appl::Buffer::Iterator getStartLine(const appl::Buffer::Iterator& _pos) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->getStartLine(_pos);
|
return m_buffer->getStartLine(_pos);
|
||||||
@@ -375,7 +382,7 @@ namespace appl {
|
|||||||
* @return The position in the buffer of the end of the line.
|
* @return The position in the buffer of the end of the line.
|
||||||
*/
|
*/
|
||||||
appl::Buffer::Iterator getEndLine(const appl::Buffer::Iterator& _pos) {
|
appl::Buffer::Iterator getEndLine(const appl::Buffer::Iterator& _pos) {
|
||||||
if (m_buffer==NULL) {
|
if (m_buffer==nullptr) {
|
||||||
return appl::Buffer::Iterator();
|
return appl::Buffer::Iterator();
|
||||||
}
|
}
|
||||||
return m_buffer->getEndLine(_pos);
|
return m_buffer->getEndLine(_pos);
|
||||||
@@ -394,9 +401,9 @@ namespace appl {
|
|||||||
* @param[in] _data Associate data wit the event
|
* @param[in] _data Associate data wit the event
|
||||||
*/
|
*/
|
||||||
virtual void ext_shortCutAdd(const char * _descriptiveString,
|
virtual void ext_shortCutAdd(const char * _descriptiveString,
|
||||||
const char * _generateEventId,
|
const char * _generateEventId,
|
||||||
std::string _data="",
|
std::string _data="",
|
||||||
bool _broadcast=false) {
|
bool _broadcast=false) {
|
||||||
shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
|
shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -17,62 +17,30 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ViewerManager"
|
#define __class__ "ViewerManager"
|
||||||
|
|
||||||
appl::ViewerManager::ViewerManager(void) :
|
appl::ViewerManager::ViewerManager() {
|
||||||
ewol::Resource("???ViewerManager???"),
|
|
||||||
m_viewer(NULL) {
|
|
||||||
addObjectType("appl::ViewerManager");
|
addObjectType("appl::ViewerManager");
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::ViewerManager::~ViewerManager(void) {
|
void appl::ViewerManager::init(const std::string& _uniqueName) {
|
||||||
appl::BufferManager::release(m_bufferManager);
|
ewol::Resource::init(_uniqueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::ViewerManager::setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer) {
|
appl::ViewerManager::~ViewerManager() {
|
||||||
if (m_viewer == _viewer) {
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool appl::ViewerManager::isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer) {
|
||||||
|
return m_viewer.lock() == _viewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::ViewerManager::setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer) {
|
||||||
|
if (m_viewer.lock() == _viewer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_viewer = _viewer;
|
m_viewer = _viewer;
|
||||||
if (m_bufferManager != NULL) {
|
if (m_bufferManager != nullptr) {
|
||||||
m_bufferManager->setBufferSelected(_buffer);
|
m_bufferManager->setBufferSelected(_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::ViewerManager::onReceiveMessage(const ewol::object::Message& _msg) {
|
|
||||||
APPL_DEBUG("receive message !!! " << _msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::ViewerManager::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
ewol::Resource:: onObjectRemove(_removeObject);
|
|
||||||
if (_removeObject == m_viewer) {
|
|
||||||
m_viewer = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
appl::ViewerManager* appl::ViewerManager::keep(void) {
|
|
||||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
|
||||||
appl::ViewerManager* object = static_cast<appl::ViewerManager*>(getManager().localKeep("???ViewerManager???"));
|
|
||||||
if (NULL != object) {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
// this element create a new one every time ....
|
|
||||||
EWOL_INFO("CREATE : appl::ViewerManager: ???ViewerManager???");
|
|
||||||
object = new appl::ViewerManager();
|
|
||||||
if (NULL == object) {
|
|
||||||
EWOL_ERROR("allocation error of a resource : ???ViewerManager???");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
getManager().localAdd(object);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::ViewerManager::release(appl::ViewerManager*& _object) {
|
|
||||||
if (NULL == _object) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
|
||||||
getManager().release(object2);
|
|
||||||
_object = NULL;
|
|
||||||
}
|
|
||||||
|
@@ -19,48 +19,33 @@ namespace appl {
|
|||||||
class TextViewer;
|
class TextViewer;
|
||||||
class ViewerManager : public ewol::Resource {
|
class ViewerManager : public ewol::Resource {
|
||||||
protected:
|
protected:
|
||||||
ViewerManager(void);
|
ViewerManager();
|
||||||
~ViewerManager(void);
|
void init(const std::string& _uniqueName);
|
||||||
|
public:
|
||||||
|
DECLARE_RESOURCE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???");
|
||||||
|
virtual ~ViewerManager();
|
||||||
private:
|
private:
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
appl::TextViewer* m_viewer;
|
std::weak_ptr<appl::TextViewer> m_viewer;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Set the current buffer selected
|
* @brief Set the current buffer selected
|
||||||
* @param[in] _viewer Pointer on the viewer selected
|
* @param[in] _viewer Pointer on the viewer selected
|
||||||
*/
|
*/
|
||||||
void setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer);
|
void setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer);
|
||||||
/**
|
/**
|
||||||
* @brief Get the current buffer selected
|
* @brief Get the current buffer selected
|
||||||
* @return Pointer on the buffer selected
|
* @return Pointer on the buffer selected
|
||||||
*/
|
*/
|
||||||
appl::TextViewer* getViewerSelected(void) {
|
std::shared_ptr<appl::TextViewer> getViewerSelected() {
|
||||||
return m_viewer;
|
return m_viewer.lock();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @breif Check if the element is the last request selection
|
* @breif Check if the element is the last request selection
|
||||||
* @param[in] _viewer element selected.
|
* @param[in] _viewer element selected.
|
||||||
* @return true if the element is selected
|
* @return true if the element is selected
|
||||||
*/
|
*/
|
||||||
bool isLastSelected(appl::TextViewer* _viewer) {
|
bool isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer);
|
||||||
return m_viewer == _viewer;
|
|
||||||
};
|
|
||||||
public: // herited function
|
|
||||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
|
||||||
void onObjectRemove(ewol::Object* _removeObject);
|
|
||||||
public: // resource manager
|
|
||||||
/**
|
|
||||||
* @brief keep the resource pointer.
|
|
||||||
* @note Never free this pointer by your own...
|
|
||||||
* @param[in] _filename Name of the configuration file.
|
|
||||||
* @return pointer on the resource or NULL if an error occured.
|
|
||||||
*/
|
|
||||||
static appl::ViewerManager* keep(void);
|
|
||||||
/**
|
|
||||||
* @brief release the keeped resources
|
|
||||||
* @param[in,out] reference on the object pointer
|
|
||||||
*/
|
|
||||||
static void release(appl::ViewerManager*& _object);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,26 +15,28 @@
|
|||||||
|
|
||||||
static const char* s_closeDone = "close-done";
|
static const char* s_closeDone = "close-done";
|
||||||
|
|
||||||
appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
appl::WorkerCloseAllFile::WorkerCloseAllFile() {
|
||||||
m_worker(NULL),
|
|
||||||
m_bufferManager(NULL) {
|
|
||||||
addObjectType("appl::WorkerCloseAllFile");
|
addObjectType("appl::WorkerCloseAllFile");
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
}
|
||||||
if (m_bufferManager == NULL) {
|
|
||||||
|
void appl::WorkerCloseAllFile::init() {
|
||||||
|
ewol::Object::init();
|
||||||
|
if (m_bufferManager == nullptr) {
|
||||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// List all current open file :
|
// List all current open file :
|
||||||
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
|
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(iii);
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmpBuffer->isModify() == false) {
|
if (tmpBuffer->isModify() == false) {
|
||||||
tmpBuffer->removeObject();
|
APPL_TODO("destroy object");
|
||||||
|
tmpBuffer->destroy();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_bufferNameList.push_back(tmpBuffer->getFileName());
|
m_bufferNameList.push_back(tmpBuffer->getFileName());
|
||||||
@@ -45,22 +47,22 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// create the worker :
|
// create the worker :
|
||||||
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front());
|
m_worker = appl::WorkerCloseFile::create(m_bufferNameList.front());
|
||||||
// remove first element :
|
// remove first element :
|
||||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||||
if (m_bufferNameList.size() == 0) {
|
if (m_bufferNameList.size() == 0) {
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_worker->registerOnEvent(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
m_worker->registerOnEvent(shared_from_this(), appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::WorkerCloseAllFile::~WorkerCloseAllFile(void) {
|
appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||||
if (m_bufferManager == NULL) {
|
if (m_bufferManager == nullptr) {
|
||||||
// nothing to do in this case ==> can do nothing ...
|
// nothing to do in this case ==> can do nothing ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -70,25 +72,14 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// create the worker :
|
// create the worker :
|
||||||
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front());
|
m_worker = appl::WorkerCloseFile::create(m_bufferNameList.front());
|
||||||
// remove first element :
|
// remove first element :
|
||||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||||
if (m_bufferNameList.size() == 0) {
|
if (m_bufferNameList.size() == 0) {
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_worker->registerOnEvent(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
m_worker->registerOnEvent(shared_from_this(), appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::WorkerCloseAllFile::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
if (_removeObject == m_worker) {
|
|
||||||
m_worker = NULL;
|
|
||||||
APPL_VERBOSE("AutoRemove After saving sub widget ...");
|
|
||||||
autoDestroy();
|
|
||||||
} else if (_removeObject == m_bufferManager) {
|
|
||||||
m_bufferManager = NULL;
|
|
||||||
autoDestroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,16 +14,18 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class WorkerCloseAllFile : public ewol::Object {
|
class WorkerCloseAllFile : public ewol::Object {
|
||||||
|
protected:
|
||||||
|
WorkerCloseAllFile();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
WorkerCloseAllFile(void);
|
DECLARE_FACTORY(WorkerCloseAllFile);
|
||||||
virtual ~WorkerCloseAllFile(void);
|
virtual ~WorkerCloseAllFile();
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> m_bufferNameList;
|
std::vector<std::string> m_bufferNameList;
|
||||||
appl::WorkerCloseFile* m_worker; //! pop-up element that is open...
|
std::shared_ptr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
public: // derived function
|
public: // derived function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -21,25 +21,28 @@ static const char* s_saveValidate = "save-validate";
|
|||||||
static const char* s_closeValidate = "close-validate";
|
static const char* s_closeValidate = "close-validate";
|
||||||
static const char* s_saveAsDone = "save-as-done";
|
static const char* s_saveAsDone = "save-as-done";
|
||||||
|
|
||||||
appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
appl::WorkerCloseFile::WorkerCloseFile() :
|
||||||
m_bufferName(_bufferName),
|
m_buffer(nullptr),
|
||||||
m_buffer(NULL),
|
m_worker(nullptr),
|
||||||
m_worker(NULL),
|
m_bufferManager(nullptr) {
|
||||||
m_bufferManager(NULL) {
|
|
||||||
addObjectType("appl::WorkerCloseFile");
|
addObjectType("appl::WorkerCloseFile");
|
||||||
addEventId(eventCloseDone);
|
addEventId(eventCloseDone);
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
}
|
||||||
if (m_bufferManager == NULL) {
|
|
||||||
|
void appl::WorkerCloseFile::init(const std::string& _bufferName) {
|
||||||
|
ewol::Object::init();
|
||||||
|
m_bufferName = _bufferName;
|
||||||
|
if (m_bufferManager == nullptr) {
|
||||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_bufferName == "") {
|
if (m_bufferName == "") {
|
||||||
// need to find the curent file ...
|
// need to find the curent file ...
|
||||||
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
|
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||||
if (tmpp == NULL) {
|
if (tmpp == nullptr) {
|
||||||
APPL_ERROR("No selected buffer now ...");
|
APPL_ERROR("No selected buffer now ...");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
@@ -52,43 +55,43 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_buffer = m_bufferManager->get(m_bufferName);
|
m_buffer = m_bufferManager->get(m_bufferName);
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_buffer->isModify() == false) {
|
if (m_buffer->isModify() == false) {
|
||||||
generateEventId(eventCloseDone);
|
generateEventId(eventCloseDone);
|
||||||
m_buffer->removeObject();
|
m_buffer->destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp();
|
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
|
||||||
if (tmpPopUp == NULL) {
|
if (tmpPopUp == nullptr) {
|
||||||
APPL_ERROR("Can not create a simple pop-up");
|
APPL_ERROR("Can not create a simple pop-up");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
|
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
|
||||||
tmpPopUp->setComment("The file named : <i>\"" + m_buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
|
tmpPopUp->setComment("The file named : <i>\"" + m_buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
|
||||||
ewol::Widget* bt = NULL;
|
std::shared_ptr<ewol::Widget> bt = nullptr;
|
||||||
if (m_buffer->hasFileName() == true) {
|
if (m_buffer->hasFileName() == true) {
|
||||||
bt = tmpPopUp->addButton("Save", true);
|
bt = tmpPopUp->addButton("Save", true);
|
||||||
if (bt != NULL) {
|
if (bt != nullptr) {
|
||||||
bt->registerOnEvent(this, "pressed", s_saveValidate);
|
bt->registerOnEvent(shared_from_this(), "pressed", s_saveValidate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bt = tmpPopUp->addButton("Save As", true);
|
bt = tmpPopUp->addButton("Save As", true);
|
||||||
if (bt != NULL) {
|
if (bt != nullptr) {
|
||||||
bt->registerOnEvent(this, "pressed", s_saveAsValidate);
|
bt->registerOnEvent(shared_from_this(), "pressed", s_saveAsValidate);
|
||||||
}
|
}
|
||||||
bt = tmpPopUp->addButton("Close", true);
|
bt = tmpPopUp->addButton("Close", true);
|
||||||
if (bt != NULL) {
|
if (bt != nullptr) {
|
||||||
bt->registerOnEvent(this, "pressed", s_closeValidate);
|
bt->registerOnEvent(shared_from_this(), "pressed", s_closeValidate);
|
||||||
}
|
}
|
||||||
tmpPopUp->addButton("Cancel", true);
|
tmpPopUp->addButton("Cancel", true);
|
||||||
tmpPopUp->setRemoveOnExternClick(true);
|
tmpPopUp->setRemoveOnExternClick(true);
|
||||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||||
if (tmpWindows == NULL) {
|
if (tmpWindows == nullptr) {
|
||||||
APPL_ERROR("Error to get the windows.");
|
APPL_ERROR("Error to get the windows.");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
@@ -96,30 +99,30 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
|||||||
tmpWindows->popUpWidgetPush(tmpPopUp);
|
tmpWindows->popUpWidgetPush(tmpPopUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::WorkerCloseFile::~WorkerCloseFile(void) {
|
appl::WorkerCloseFile::~WorkerCloseFile() {
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||||
if (m_bufferManager == NULL) {
|
if (m_bufferManager == nullptr) {
|
||||||
// nothing to do in this case ==> can do nothing ...
|
// nothing to do in this case ==> can do nothing ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
APPL_DEBUG("have message : " << _msg);
|
APPL_DEBUG("have message : " << _msg);
|
||||||
if (_msg.getMessage() == s_saveAsValidate) {
|
if (_msg.getMessage() == s_saveAsValidate) {
|
||||||
m_worker = new appl::WorkerSaveFile(m_bufferName);
|
m_worker = appl::WorkerSaveFile::create(m_bufferName);
|
||||||
if (m_worker != NULL) {
|
if (m_worker != nullptr) {
|
||||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == s_saveValidate) {
|
} else if (_msg.getMessage() == s_saveValidate) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
|
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_buffer->storeFile() == false) {
|
if (m_buffer->storeFile() == false) {
|
||||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||||
if (tmpWindows == NULL) {
|
if (tmpWindows == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + m_buffer->getFileName() + "</i>");
|
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + m_buffer->getFileName() + "</i>");
|
||||||
@@ -128,27 +131,14 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
|
|||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == s_closeValidate
|
} else if ( _msg.getMessage() == s_closeValidate
|
||||||
|| _msg.getMessage() == s_saveAsDone) {
|
|| _msg.getMessage() == s_saveAsDone) {
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
generateEventId(eventCloseDone);
|
generateEventId(eventCloseDone);
|
||||||
m_buffer->removeObject();
|
m_buffer->destroy();
|
||||||
}
|
m_buffer.reset();
|
||||||
}
|
|
||||||
|
|
||||||
void appl::WorkerCloseFile::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
if (_removeObject == m_worker) {
|
|
||||||
m_worker = NULL;
|
|
||||||
APPL_VERBOSE("AutoRemove After closing sub widget ...");
|
|
||||||
autoDestroy();
|
|
||||||
} else if (_removeObject == m_bufferManager) {
|
|
||||||
m_bufferManager = NULL;
|
|
||||||
autoDestroy();
|
|
||||||
} else if (_removeObject == m_buffer) {
|
|
||||||
m_buffer = NULL;
|
|
||||||
autoDestroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,18 +17,20 @@ namespace appl {
|
|||||||
class WorkerCloseFile : public ewol::Object {
|
class WorkerCloseFile : public ewol::Object {
|
||||||
public:
|
public:
|
||||||
static const char* eventCloseDone;
|
static const char* eventCloseDone;
|
||||||
public:
|
protected:
|
||||||
// note : if == "" ==> current ...
|
// note : if == "" ==> current ...
|
||||||
WorkerCloseFile(const std::string& _bufferName);
|
WorkerCloseFile();
|
||||||
virtual ~WorkerCloseFile(void);
|
void init(const std::string& _bufferName);
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(WorkerCloseFile);
|
||||||
|
virtual ~WorkerCloseFile();
|
||||||
private:
|
private:
|
||||||
std::string m_bufferName;
|
std::string m_bufferName;
|
||||||
appl::Buffer* m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
|
std::shared_ptr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
|
||||||
appl::WorkerSaveFile* m_worker; //! sub-worker element...
|
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
public: // derived function
|
public: // derived function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,22 +15,23 @@
|
|||||||
|
|
||||||
static const char* s_saveAsDone = "save-as-done";
|
static const char* s_saveAsDone = "save-as-done";
|
||||||
|
|
||||||
appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
appl::WorkerSaveAllFile::WorkerSaveAllFile() {
|
||||||
m_worker(NULL),
|
|
||||||
m_bufferManager(NULL) {
|
|
||||||
addObjectType("appl::WorkerSaveAllFile");
|
addObjectType("appl::WorkerSaveAllFile");
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
}
|
||||||
if (m_bufferManager == NULL) {
|
|
||||||
|
void appl::WorkerSaveAllFile::init() {
|
||||||
|
ewol::Object::init();
|
||||||
|
if (m_bufferManager == nullptr) {
|
||||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// List all current open file :
|
// List all current open file :
|
||||||
for (size_t iii=0; iii<m_bufferManager->size(); ++iii) {
|
for (int32_t iii=0; iii<m_bufferManager->size(); ++iii) {
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(iii);
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmpBuffer->isModify() == false) {
|
if (tmpBuffer->isModify() == false) {
|
||||||
@@ -48,22 +49,22 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// create the worker :
|
// create the worker :
|
||||||
m_worker = new appl::WorkerSaveFile(m_bufferNameList.front());
|
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
|
||||||
// remove first element :
|
// remove first element :
|
||||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||||
if (m_bufferNameList.size() == 0) {
|
if (m_bufferNameList.size() == 0) {
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::WorkerSaveAllFile::~WorkerSaveAllFile(void) {
|
appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||||
if (m_bufferManager == NULL) {
|
if (m_bufferManager == nullptr) {
|
||||||
// nothing to do in this case ==> can do nothing ...
|
// nothing to do in this case ==> can do nothing ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -73,25 +74,14 @@ void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// create the worker :
|
// create the worker :
|
||||||
m_worker = new appl::WorkerSaveFile(m_bufferNameList.front());
|
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
|
||||||
// remove first element :
|
// remove first element :
|
||||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||||
if (m_bufferNameList.size() == 0) {
|
if (m_bufferNameList.size() == 0) {
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::WorkerSaveAllFile::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
if (_removeObject == m_worker) {
|
|
||||||
m_worker = NULL;
|
|
||||||
APPL_VERBOSE("AutoRemove After saving sub widget ...");
|
|
||||||
autoDestroy();
|
|
||||||
} else if (_removeObject == m_bufferManager) {
|
|
||||||
m_bufferManager = NULL;
|
|
||||||
autoDestroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,16 +14,18 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class WorkerSaveAllFile : public ewol::Object {
|
class WorkerSaveAllFile : public ewol::Object {
|
||||||
|
protected:
|
||||||
|
WorkerSaveAllFile();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
WorkerSaveAllFile(void);
|
DECLARE_FACTORY(WorkerSaveAllFile);
|
||||||
virtual ~WorkerSaveAllFile(void);
|
virtual ~WorkerSaveAllFile();
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> m_bufferNameList;
|
std::vector<std::string> m_bufferNameList;
|
||||||
appl::WorkerSaveFile* m_worker; //! pop-up element that is open...
|
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
public: // derived function
|
public: // derived function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -17,24 +17,25 @@ const char* appl::WorkerSaveFile::eventSaveDone = "save-file-done";
|
|||||||
|
|
||||||
static const char* s_saveAsValidate = "save-as-validate";
|
static const char* s_saveAsValidate = "save-as-validate";
|
||||||
|
|
||||||
appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _forceSaveAs) :
|
appl::WorkerSaveFile::WorkerSaveFile() {
|
||||||
m_bufferName(_bufferName),
|
|
||||||
m_chooser(NULL),
|
|
||||||
m_bufferManager(NULL) {
|
|
||||||
addObjectType("appl::WorkerSaveFile");
|
addObjectType("appl::WorkerSaveFile");
|
||||||
addEventId(eventSaveDone);
|
addEventId(eventSaveDone);
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
}
|
||||||
if (m_bufferManager == NULL) {
|
|
||||||
|
void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveAs) {
|
||||||
|
ewol::Object::init();
|
||||||
|
m_bufferName = _bufferName;
|
||||||
|
if (m_bufferManager == nullptr) {
|
||||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_bufferName == "") {
|
if (m_bufferName == "") {
|
||||||
// need to find the curent file ...
|
// need to find the curent file ...
|
||||||
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
|
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||||
if (tmpp == NULL) {
|
if (tmpp == nullptr) {
|
||||||
APPL_ERROR("No selected buffer now ...");
|
APPL_ERROR("No selected buffer now ...");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
@@ -46,8 +47,8 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
|||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName);
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
@@ -60,8 +61,8 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_chooser = new ewol::widget::FileChooser();
|
m_chooser = ewol::widget::FileChooser::create();
|
||||||
if (NULL == m_chooser) {
|
if (nullptr == m_chooser) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
@@ -71,22 +72,22 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
|||||||
etk::FSNode tmpName(m_bufferName);
|
etk::FSNode tmpName(m_bufferName);
|
||||||
m_chooser->setFolder(tmpName.getNameFolder());
|
m_chooser->setFolder(tmpName.getNameFolder());
|
||||||
m_chooser->setFileName(tmpName.getNameFile());
|
m_chooser->setFileName(tmpName.getNameFile());
|
||||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||||
if (tmpWindows == NULL) {
|
if (tmpWindows == nullptr) {
|
||||||
APPL_ERROR("Error to get the windows.");
|
APPL_ERROR("Error to get the windows.");
|
||||||
autoDestroy();
|
autoDestroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWindows->popUpWidgetPush(m_chooser);
|
tmpWindows->popUpWidgetPush(m_chooser);
|
||||||
m_chooser->registerOnEvent(this, ewol::widget::FileChooser::eventValidate, s_saveAsValidate);
|
m_chooser->registerOnEvent(shared_from_this(), ewol::widget::FileChooser::eventValidate, s_saveAsValidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::WorkerSaveFile::~WorkerSaveFile(void) {
|
appl::WorkerSaveFile::~WorkerSaveFile() {
|
||||||
appl::BufferManager::release(m_bufferManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||||
if (m_bufferManager == NULL) {
|
if (m_bufferManager == nullptr) {
|
||||||
// nothing to do in this case ==> can do nothing ...
|
// nothing to do in this case ==> can do nothing ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -99,15 +100,15 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
|
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName);
|
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||||
if (tmpBuffer == NULL) {
|
if (tmpBuffer == nullptr) {
|
||||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpBuffer->setFileName(_msg.getData());
|
tmpBuffer->setFileName(_msg.getData());
|
||||||
if (tmpBuffer->storeFile() == false) {
|
if (tmpBuffer->storeFile() == false) {
|
||||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||||
if (tmpWindows == NULL) {
|
if (tmpWindows == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
|
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
|
||||||
@@ -117,14 +118,3 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::WorkerSaveFile::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
if (_removeObject == m_chooser) {
|
|
||||||
m_chooser = NULL;
|
|
||||||
APPL_VERBOSE("AutoRemove After closing sub widget ...");
|
|
||||||
autoDestroy();
|
|
||||||
} else if (_removeObject == m_bufferManager) {
|
|
||||||
m_bufferManager = NULL;
|
|
||||||
autoDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -16,16 +16,18 @@ namespace appl {
|
|||||||
class WorkerSaveFile : public ewol::Object {
|
class WorkerSaveFile : public ewol::Object {
|
||||||
public:
|
public:
|
||||||
static const char* eventSaveDone;
|
static const char* eventSaveDone;
|
||||||
|
protected:
|
||||||
|
WorkerSaveFile();
|
||||||
|
void init(const std::string& _bufferName, bool _forceSaveAs=true);
|
||||||
public:
|
public:
|
||||||
WorkerSaveFile(const std::string& _bufferName, bool _forceSaveAs=true);
|
DECLARE_FACTORY(WorkerSaveFile);
|
||||||
virtual ~WorkerSaveFile(void);
|
virtual ~WorkerSaveFile();
|
||||||
private:
|
private:
|
||||||
std::string m_bufferName;
|
std::string m_bufferName;
|
||||||
ewol::widget::FileChooser* m_chooser; //! pop-up element that is open...
|
std::shared_ptr<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
public: // derived function
|
public: // derived function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -25,21 +25,25 @@
|
|||||||
#define HL2_DEBUG APPL_VERBOSE
|
#define HL2_DEBUG APPL_VERBOSE
|
||||||
|
|
||||||
void appl::Highlight::parseRules(exml::Element* _child,
|
void appl::Highlight::parseRules(exml::Element* _child,
|
||||||
std::vector<HighlightPattern*>& _mListPatern,
|
std::vector<std::unique_ptr<HighlightPattern>>& _mListPatern,
|
||||||
int32_t _level) {
|
int32_t _level) {
|
||||||
// Create the patern ...
|
// Create the patern ...
|
||||||
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
|
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
|
||||||
// parse under Element
|
// parse under Element
|
||||||
myPattern->parseRules(_child, _level);
|
myPattern->parseRules(_child, _level);
|
||||||
// add element in the list
|
// add element in the list
|
||||||
_mListPatern.push_back(myPattern);
|
_mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) :
|
appl::Highlight::Highlight() {
|
||||||
ewol::Resource(_xmlFilename),
|
addObjectType("appl::Highlight");
|
||||||
m_typeName("") {
|
}
|
||||||
|
|
||||||
|
void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _colorFile) {
|
||||||
|
ewol::Resource::init(_xmlFilename);
|
||||||
|
|
||||||
// keep color propertiy file :
|
// keep color propertiy file :
|
||||||
m_paintingProperties = appl::GlyphPainting::keep(_colorFile);
|
m_paintingProperties = appl::GlyphPainting::create(_colorFile);
|
||||||
|
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
if (doc.load(_xmlFilename) == false) {
|
if (doc.load(_xmlFilename) == false) {
|
||||||
@@ -47,7 +51,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
exml::Element* root = doc.getNamed("EdnLang");
|
exml::Element* root = doc.getNamed("EdnLang");
|
||||||
if (NULL == root ) {
|
if (nullptr == root ) {
|
||||||
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ...");
|
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -55,9 +59,9 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
|||||||
int32_t level1 = 0;
|
int32_t level1 = 0;
|
||||||
int32_t level2 = 0;
|
int32_t level2 = 0;
|
||||||
// parse all the elements :
|
// parse all the elements :
|
||||||
for(int32_t iii = 0; iii < root->size(); ++iii) {
|
for(size_t iii = 0; iii < root->size(); ++iii) {
|
||||||
exml::Element* child = root->getElement(iii);
|
exml::Element* child = root->getElement(iii);
|
||||||
if (child == NULL) {
|
if (child == nullptr) {
|
||||||
// trash here all that is not element ...
|
// trash here all that is not element ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -69,9 +73,9 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
|||||||
}
|
}
|
||||||
} else if (child->getValue() == "pass1") {
|
} else if (child->getValue() == "pass1") {
|
||||||
// get sub Nodes ...
|
// get sub Nodes ...
|
||||||
for(int32_t jjj=0; jjj< child->size(); jjj++) {
|
for(size_t jjj=0; jjj< child->size(); jjj++) {
|
||||||
exml::Element* passChild = child->getElement(jjj);
|
exml::Element* passChild = child->getElement(jjj);
|
||||||
if (passChild == NULL) {
|
if (passChild == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (passChild->getValue() != "rule") {
|
if (passChild->getValue() != "rule") {
|
||||||
@@ -82,9 +86,9 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
|||||||
}
|
}
|
||||||
} else if (child->getValue() == "pass2") {
|
} else if (child->getValue() == "pass2") {
|
||||||
// get sub Nodes ...
|
// get sub Nodes ...
|
||||||
for(int32_t jjj=0; jjj< child->size(); jjj++) {
|
for(size_t jjj=0; jjj< child->size(); jjj++) {
|
||||||
exml::Element* passChild = child->getElement(jjj);
|
exml::Element* passChild = child->getElement(jjj);
|
||||||
if (passChild == NULL) {
|
if (passChild == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (passChild->getValue() != "rule") {
|
if (passChild->getValue() != "rule") {
|
||||||
@@ -99,26 +103,20 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Highlight::~Highlight(void) {
|
appl::Highlight::~Highlight() {
|
||||||
int32_t i;
|
|
||||||
// clean all Element
|
|
||||||
for (int32_t iii = 0; iii < m_listHighlightPass1.size(); ++iii) {
|
|
||||||
if (m_listHighlightPass1[iii] != NULL) {
|
|
||||||
delete(m_listHighlightPass1[iii]);
|
|
||||||
m_listHighlightPass1[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// clear the compleate list
|
// clear the compleate list
|
||||||
m_listHighlightPass1.clear();
|
m_listHighlightPass1.clear();
|
||||||
// clear the compleate list
|
// clear the compleate list
|
||||||
|
m_listHighlightPass2.clear();
|
||||||
|
// clear the compleate list
|
||||||
m_listExtentions.clear();
|
m_listExtentions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Highlight::hasExtention(const std::string& _ext) {
|
bool appl::Highlight::hasExtention(const std::string& _ext) {
|
||||||
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
|
for (auto &it : m_listExtentions) {
|
||||||
APPL_VERBOSE(" check : " << m_listExtentions[iii] << "=?=" << _ext);
|
APPL_VERBOSE(" check : " << it << "=?=" << _ext);
|
||||||
if ( m_listExtentions[iii] == "*." + _ext
|
if ( it == "*." + _ext
|
||||||
|| m_listExtentions[iii] == _ext) {
|
|| it == _ext) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,8 +134,8 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
|
|||||||
}
|
}
|
||||||
APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" ");
|
APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" ");
|
||||||
|
|
||||||
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
|
for (auto &it : m_listExtentions) {
|
||||||
if (extention == m_listExtentions[iii] ) {
|
if (extention == it ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,19 +143,19 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::Highlight::display(void) {
|
void appl::Highlight::display() {
|
||||||
APPL_INFO("List of ALL Highlight : ");
|
APPL_INFO("List of ALL Highlight : ");
|
||||||
for (int32_t iii=0; iii< m_listExtentions.size(); iii++) {
|
for (auto &it : m_listExtentions) {
|
||||||
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] );
|
APPL_INFO(" Extention : " << it );
|
||||||
}
|
}
|
||||||
// display all elements
|
// display all elements
|
||||||
for (int32_t iii=0; iii< m_listHighlightPass1.size(); iii++) {
|
for (auto &it : m_listHighlightPass1) {
|
||||||
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->getName() );
|
APPL_INFO(" Pass 1 : " << it->getName() );
|
||||||
//m_listHighlightPass1[iii]->display();
|
//m_listHighlightPass1[iii]->display();
|
||||||
}
|
}
|
||||||
// display all elements
|
// display all elements
|
||||||
for (int32_t iii=0; iii< m_listHighlightPass2.size(); iii++) {
|
for (auto &it : m_listHighlightPass2) {
|
||||||
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->getName() );
|
APPL_INFO(" pass 2 : " << it->getName() );
|
||||||
//m_listHighlightPass2[iii]->display();
|
//m_listHighlightPass2[iii]->display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,24 +178,24 @@ void appl::Highlight::parse(int64_t _start,
|
|||||||
while (elementStart <= elementStop) {
|
while (elementStart <= elementStop) {
|
||||||
HL_DEBUG("Parse element in the buffer pos=" << elementStart);
|
HL_DEBUG("Parse element in the buffer pos=" << elementStart);
|
||||||
//try to fond the HL in ALL of we have
|
//try to fond the HL in ALL of we have
|
||||||
for (int64_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){
|
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
|
||||||
enum resultFind ret = HLP_FIND_OK;
|
enum resultFind ret = HLP_FIND_OK;
|
||||||
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ")" );
|
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj]->getPaternString());
|
||||||
// Stop the search to the end (to get the end of the pattern)
|
// Stop the search to the end (to get the end of the pattern)
|
||||||
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer);
|
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer);
|
||||||
if (HLP_FIND_ERROR != ret) {
|
if (HLP_FIND_ERROR != ret) {
|
||||||
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ")" );
|
||||||
// remove element in the current List where the current Element have a end inside the next...
|
// remove element in the current List where the current Element have a end inside the next...
|
||||||
int64_t kkk=_addingPos;
|
int64_t kkk=_addingPos;
|
||||||
while(kkk < _metaData.size() ) {
|
while(kkk < (int64_t)_metaData.size() ) {
|
||||||
if (_metaData[kkk].beginStart <= resultat.endStop) {
|
if (_metaData[kkk].start <= resultat.stop) {
|
||||||
// remove element
|
// remove element
|
||||||
HL_DEBUG("Erase element=" << kkk);
|
HL_DEBUG("Erase element=" << kkk);
|
||||||
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
|
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
|
||||||
// Increase the end of search
|
// Increase the end of search
|
||||||
if (kkk < _metaData.size()) {
|
if (kkk < (int64_t)_metaData.size()) {
|
||||||
// just befor the end of the next element
|
// just befor the end of the next element
|
||||||
elementStop = _metaData[kkk].beginStart-1;
|
elementStop = _metaData[kkk].start-1;
|
||||||
} else {
|
} else {
|
||||||
// end of the buffer
|
// end of the buffer
|
||||||
elementStop = _buffer.size();
|
elementStop = _buffer.size();
|
||||||
@@ -209,9 +207,9 @@ void appl::Highlight::parse(int64_t _start,
|
|||||||
}
|
}
|
||||||
// add curent element in the list ...
|
// add curent element in the list ...
|
||||||
_metaData.insert(_metaData.begin()+_addingPos, resultat);
|
_metaData.insert(_metaData.begin()+_addingPos, resultat);
|
||||||
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
|
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.start << " E=" << resultat.stop );
|
||||||
// update the current research starting element: (set position at the end of the current element
|
// update the current research starting element: (set position at the end of the current element
|
||||||
elementStart = resultat.endStop-1;
|
elementStart = resultat.stop-1;
|
||||||
// increment the position of insertion:
|
// increment the position of insertion:
|
||||||
_addingPos++;
|
_addingPos++;
|
||||||
// We find a pattern == > Stop search for the current element
|
// We find a pattern == > Stop search for the current element
|
||||||
@@ -239,19 +237,23 @@ void appl::Highlight::parse2(int64_t _start,
|
|||||||
appl::HighlightInfo resultat;
|
appl::HighlightInfo resultat;
|
||||||
|
|
||||||
while (elementStart < elementStop) {
|
while (elementStart < elementStop) {
|
||||||
|
if (elementStart == 306) {
|
||||||
|
//etk::log::setLevel(etk::log::logLevelVerbose);
|
||||||
|
}
|
||||||
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
|
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
|
||||||
//try to fond the HL in ALL of we have
|
//try to fond the HL in ALL of we have
|
||||||
for (int64_t jjj=0; jjj<m_listHighlightPass2.size(); jjj++){
|
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass2.size(); jjj++){
|
||||||
enum resultFind ret = HLP_FIND_OK;
|
enum resultFind ret = HLP_FIND_OK;
|
||||||
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
|
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
|
||||||
_start << "," << _buffer.size() << ")" );
|
elementStart << "," << elementStop << ") in='"
|
||||||
|
<< _buffer[elementStart] << "' " << m_listHighlightPass2[jjj]->getPaternString());
|
||||||
// Stop the search to the end (to get the end of the pattern)
|
// Stop the search to the end (to get the end of the pattern)
|
||||||
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer);
|
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer);
|
||||||
if (HLP_FIND_ERROR != ret) {
|
if (ret != HLP_FIND_ERROR) {
|
||||||
HL2_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
HL2_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ")" );
|
||||||
// add curent element in the list ...
|
// add curent element in the list ...
|
||||||
_metaData.push_back(resultat);
|
_metaData.push_back(resultat);
|
||||||
elementStart = resultat.endStop-1;
|
elementStart = resultat.stop-1;
|
||||||
// Exit current cycle
|
// Exit current cycle
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -260,30 +262,3 @@ void appl::Highlight::parse2(int64_t _start,
|
|||||||
elementStart++;
|
elementStart++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::Highlight* appl::Highlight::keep(const std::string& _filename) {
|
|
||||||
//EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\"");
|
|
||||||
appl::Highlight* object = static_cast<appl::Highlight*>(getManager().localKeep(_filename));
|
|
||||||
if (NULL != object) {
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
EWOL_INFO("CREATE : appl::Highlight : file : \"" << _filename << "\"");
|
|
||||||
// this element create a new one every time ....
|
|
||||||
object = new appl::Highlight(_filename, "THEME:COLOR:textViewer.json");
|
|
||||||
if (NULL == object) {
|
|
||||||
EWOL_ERROR("allocation error of a resource : ??Highlight??");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
getManager().localAdd(object);
|
|
||||||
return object;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::Highlight::release(appl::Highlight*& _object) {
|
|
||||||
if (NULL == _object) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
|
||||||
getManager().release(object2);
|
|
||||||
_object = NULL;
|
|
||||||
}
|
|
||||||
|
@@ -16,15 +16,14 @@ namespace appl {
|
|||||||
|
|
||||||
class HighlightInfo {
|
class HighlightInfo {
|
||||||
public:
|
public:
|
||||||
int32_t beginStart;
|
int32_t start;
|
||||||
int32_t beginStop;
|
int32_t stop;
|
||||||
int32_t endStart;
|
|
||||||
int32_t endStop;
|
|
||||||
bool notEnded;
|
bool notEnded;
|
||||||
appl::HighlightPattern* patern; // pointer on class :
|
appl::HighlightPattern* patern; // pointer on class :
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
#include <appl/HighlightPattern.h>
|
#include <appl/HighlightPattern.h>
|
||||||
#include <appl/GlyphPainting.h>
|
#include <appl/GlyphPainting.h>
|
||||||
@@ -34,21 +33,24 @@ namespace appl {
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class Highlight : public ewol::Resource {
|
class Highlight : public ewol::Resource {
|
||||||
private:
|
private:
|
||||||
appl::GlyphPainting* m_paintingProperties;
|
std::shared_ptr<appl::GlyphPainting> m_paintingProperties;
|
||||||
protected:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
Highlight(const std::string& _xmlFilename, const std::string& _colorFile);
|
Highlight();
|
||||||
~Highlight(void);
|
void init(const std::string& _xmlFilename, const std::string& _colorFile = "THEME:COLOR:textViewer.json");
|
||||||
|
public:
|
||||||
|
DECLARE_RESOURCE_NAMED_FACTORY(Highlight);
|
||||||
|
virtual ~Highlight();
|
||||||
private:
|
private:
|
||||||
std::string m_typeName; //!< descriptive string type like "C/C++"
|
std::string m_typeName; //!< descriptive string type like "C/C++"
|
||||||
public:
|
public:
|
||||||
const std::string& getTypeName(void) {
|
const std::string& getTypeName() {
|
||||||
return m_typeName;
|
return m_typeName;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
bool hasExtention(const std::string& _ext);
|
bool hasExtention(const std::string& _ext);
|
||||||
bool fileNameCompatible(const std::string& _fileName);
|
bool fileNameCompatible(const std::string& _fileName);
|
||||||
void display(void);
|
void display();
|
||||||
void parse(int64_t _start,
|
void parse(int64_t _start,
|
||||||
int64_t _stop,
|
int64_t _stop,
|
||||||
std::vector<appl::HighlightInfo> &_metaData,
|
std::vector<appl::HighlightInfo> &_metaData,
|
||||||
@@ -60,27 +62,14 @@ namespace appl {
|
|||||||
etk::Buffer &_buffer);
|
etk::Buffer &_buffer);
|
||||||
private:
|
private:
|
||||||
void parseRules(exml::Element* _child,
|
void parseRules(exml::Element* _child,
|
||||||
std::vector<HighlightPattern*> &_mListPatern,
|
std::vector<std::unique_ptr<HighlightPattern>> &_mListPatern,
|
||||||
int32_t _level);
|
int32_t _level);
|
||||||
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||||
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
std::vector<std::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<std::unique_ptr<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)) )
|
std::vector<std::unique_ptr<HighlightPattern>> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief keep the resource pointer.
|
|
||||||
* @note Never free this pointer by your own...
|
|
||||||
* @param[in] _filename Name of the configuration file.
|
|
||||||
* @return pointer on the resource or NULL if an error occured.
|
|
||||||
*/
|
|
||||||
static appl::Highlight* keep(const std::string& _filename);
|
|
||||||
/**
|
|
||||||
* @brief release the keeped resources
|
|
||||||
* @param[in,out] reference on the object pointer
|
|
||||||
*/
|
|
||||||
static void release(appl::Highlight*& _object);
|
|
||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual void updateContext(void) {
|
virtual void updateContext() {
|
||||||
// no upfate to do ...
|
// no upfate to do ...
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -15,14 +15,16 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "highlightManager"
|
#define __class__ "highlightManager"
|
||||||
|
|
||||||
static std::vector<appl::Highlight*>& s_list(void) {
|
// TODO : Review this in a generic unique resource ...
|
||||||
static std::vector<appl::Highlight*> list;
|
|
||||||
|
static std::vector<std::shared_ptr<appl::Highlight>>& s_list() {
|
||||||
|
static std::vector<std::shared_ptr<appl::Highlight>> list;
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::highlightManager::init(void) {
|
void appl::highlightManager::init() {
|
||||||
std::vector<appl::Highlight*>& hlList = s_list();
|
std::vector<std::shared_ptr<appl::Highlight>>& hlList = s_list();
|
||||||
if (hlList.size() != 0) {
|
if (hlList.size() != 0) {
|
||||||
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
||||||
hlList.clear();
|
hlList.clear();
|
||||||
@@ -31,17 +33,17 @@ void appl::highlightManager::init(void) {
|
|||||||
etk::FSNode myFile("DATA:languages/");
|
etk::FSNode myFile("DATA:languages/");
|
||||||
// get the subfolder list :
|
// get the subfolder list :
|
||||||
std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false);
|
std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false);
|
||||||
for (int32_t iii = 0; iii < list.size(); ++iii) {
|
for (auto &it : list) {
|
||||||
if (list[iii] == NULL) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->getNodeType() != etk::FSN_FOLDER) {
|
if (it->getNodeType() != etk::FSN_FOLDER) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string filename = list[iii]->getName() + "/highlight.xml";
|
std::string filename = it->getName() + "/highlight.xml";
|
||||||
APPL_DEBUG("Load xml name : " << filename);
|
APPL_DEBUG("Load xml name : " << filename);
|
||||||
appl::Highlight *myHightLine = appl::Highlight::keep(filename);
|
std::shared_ptr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
|
||||||
if (myHightLine != NULL) {
|
if (myHightLine != nullptr) {
|
||||||
hlList.push_back(myHightLine);
|
hlList.push_back(myHightLine);
|
||||||
} else {
|
} else {
|
||||||
APPL_ERROR("Can not allocate HighLight");
|
APPL_ERROR("Can not allocate HighLight");
|
||||||
@@ -49,29 +51,22 @@ void appl::highlightManager::init(void) {
|
|||||||
}
|
}
|
||||||
// display :
|
// display :
|
||||||
/*
|
/*
|
||||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
for (auto &it : hlList) {
|
||||||
if (hlList[iii] == NULL) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hlList[iii]->display();
|
it->display();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::highlightManager::unInit(void) {
|
void appl::highlightManager::unInit() {
|
||||||
std::vector<Highlight*>& hlList = s_list();
|
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
|
||||||
if (hlList.size() == 0) {
|
if (hlList.size() == 0) {
|
||||||
APPL_DEBUG("HighlightManager ==> no highlight");
|
APPL_DEBUG("HighlightManager ==> no highlight");
|
||||||
hlList.clear();
|
hlList.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
|
||||||
if (hlList[iii] == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
appl::Highlight::release(hlList[iii]);
|
|
||||||
hlList[iii] = NULL;
|
|
||||||
}
|
|
||||||
hlList.clear();
|
hlList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,16 +75,16 @@ std::string appl::highlightManager::getTypeExtention(const std::string& _extenti
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
|
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
|
||||||
std::vector<Highlight*>& hlList = s_list();
|
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
|
||||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
for (auto &it : hlList) {
|
||||||
if (hlList[iii] == NULL) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
APPL_DEBUG(" check : " << hlList[iii]->getTypeName());
|
APPL_DEBUG(" check : " << it->getTypeName());
|
||||||
if (hlList[iii]->hasExtention(_extention) == true) {
|
if (it->hasExtention(_extention) == true) {
|
||||||
APPL_DEBUG("Find type for extention : " << _extention
|
APPL_DEBUG("Find type for extention : " << _extention
|
||||||
<< " type : " << hlList[iii]->getTypeName());
|
<< " type : " << it->getTypeName());
|
||||||
return hlList[iii]->getTypeName();
|
return it->getTypeName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@@ -99,19 +94,18 @@ std::string appl::highlightManager::getFileWithTypeType(const std::string& _type
|
|||||||
if (_type.size() == 0) {
|
if (_type.size() == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::vector<Highlight*>& hlList = s_list();
|
for (auto &it : s_list()) {
|
||||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (hlList[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (hlList[iii]->getTypeName() == _type) {
|
if (it->getTypeName() == _type) {
|
||||||
return hlList[iii]->getName();
|
return it->getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> appl::highlightManager::getTypeList(void) {
|
std::vector<std::string> appl::highlightManager::getTypeList() {
|
||||||
std::vector<std::string> ret;
|
std::vector<std::string> ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -20,11 +20,11 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Init the Highlight manager
|
* @brief Init the Highlight manager
|
||||||
*/
|
*/
|
||||||
void init(void);
|
void init();
|
||||||
/**
|
/**
|
||||||
* @brief Un-Init the Highlight manager
|
* @brief Un-Init the Highlight manager
|
||||||
*/
|
*/
|
||||||
void unInit(void);
|
void unInit();
|
||||||
/**
|
/**
|
||||||
* @brief Un-Init the Highlight manager
|
* @brief Un-Init the Highlight manager
|
||||||
* @param[in] extention of the file
|
* @param[in] extention of the file
|
||||||
@@ -41,7 +41,7 @@ namespace appl {
|
|||||||
* @brief Get the list of extention type
|
* @brief Get the list of extention type
|
||||||
* @return the requested list.
|
* @return the requested list.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getTypeList(void);
|
std::vector<std::string> getTypeList();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -13,53 +13,27 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "HighlightPattern"
|
#define __class__ "HighlightPattern"
|
||||||
|
|
||||||
appl::HighlightPattern::HighlightPattern(appl::GlyphPainting*& _glyphPainting) :
|
appl::HighlightPattern::HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting) :
|
||||||
m_glyphPainting(_glyphPainting),
|
m_glyphPainting(_glyphPainting),
|
||||||
m_paternName(""),
|
m_paternName(""),
|
||||||
m_regExpStart(NULL),
|
m_regExp(nullptr),
|
||||||
m_regExpStop(NULL),
|
|
||||||
m_colorName(""),
|
m_colorName(""),
|
||||||
m_escapeChar(u32char::Null),
|
|
||||||
m_multiline(false),
|
|
||||||
m_level(0) {
|
m_level(0) {
|
||||||
m_regExpStart = new etk::RegExp<etk::Buffer>();
|
m_regExp = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::HighlightPattern::~HighlightPattern(void) {
|
appl::HighlightPattern::~HighlightPattern() {
|
||||||
if (m_regExpStart != NULL) {
|
|
||||||
delete(m_regExpStart);
|
|
||||||
m_regExpStart = NULL;
|
|
||||||
}
|
|
||||||
if (m_regExpStop != NULL) {
|
|
||||||
delete(m_regExpStop);
|
|
||||||
m_regExpStop = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
|
void appl::HighlightPattern::setPatern(std::string& _regExp) {
|
||||||
if (m_regExpStart == NULL) {
|
if (m_regExp == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_regExpStart->compile(_regExp);
|
m_regExp->compile(_regExp);
|
||||||
}
|
}
|
||||||
|
std::string appl::HighlightPattern::getPaternString() {
|
||||||
void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
|
return m_regExp->getRegExDecorated();
|
||||||
if (m_regExpStop != NULL) {
|
|
||||||
delete(m_regExpStop);
|
|
||||||
m_regExpStop = NULL;
|
|
||||||
}
|
|
||||||
if (_regExp.size() != 0) {
|
|
||||||
m_regExpStop = new etk::RegExp<etk::Buffer>();
|
|
||||||
if (m_regExpStop != NULL) {
|
|
||||||
m_regExpStop->compile(_regExp);
|
|
||||||
} else {
|
|
||||||
APPL_ERROR("Allocation error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void appl::HighlightPattern::setEscapeChar(const char32_t& _EscapeChar) {
|
|
||||||
m_escapeChar = _EscapeChar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
|
void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
|
||||||
@@ -68,18 +42,10 @@ void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
|
|||||||
APPL_VERBOSE("Resuest color name '" << m_colorName << "' => id=" << m_colorId);
|
APPL_VERBOSE("Resuest color name '" << m_colorName << "' => id=" << m_colorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::HighlightPattern::display(void) {
|
void appl::HighlightPattern::display() {
|
||||||
APPL_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
|
APPL_INFO("patern : '" << m_paternName << "' level=" << m_level );
|
||||||
APPL_INFO(" == > colorName \"" << m_colorName << "\"");
|
APPL_INFO(" == > colorName '" << m_colorName << "'");
|
||||||
APPL_INFO(" == > regExpStart \"" << m_regExpStart->getRegExp() << "\"");
|
APPL_INFO(" == > regExp '" << m_regExp->getRegExp() << "'");
|
||||||
if (m_regExpStop != NULL) {
|
|
||||||
APPL_INFO(" == > regExpStop \"" << m_regExpStop->getRegExp() << "\"");
|
|
||||||
}
|
|
||||||
if (m_multiline == true) {
|
|
||||||
APPL_INFO(" == > multiline pattern: YES");
|
|
||||||
} else {
|
|
||||||
APPL_INFO(" == > multiline pattern: NO");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||||
@@ -87,9 +53,7 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
|||||||
/*
|
/*
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
<color>preprocesseur</color>
|
<color>preprocesseur</color>
|
||||||
<start>#</start>
|
<regex>#</regex>
|
||||||
<end>$</end>
|
|
||||||
<multiline>yes</multiline>
|
|
||||||
</rule>
|
</rule>
|
||||||
*/
|
*/
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
@@ -103,7 +67,7 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
|||||||
setLevel(_level);
|
setLevel(_level);
|
||||||
|
|
||||||
exml::Element* xChild = _child->getNamed("color");
|
exml::Element* xChild = _child->getNamed("color");
|
||||||
if (NULL != xChild) {
|
if (nullptr != xChild) {
|
||||||
std::string myData = xChild->getText();
|
std::string myData = xChild->getText();
|
||||||
if (myData.size() != 0) {
|
if (myData.size() != 0) {
|
||||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||||
@@ -111,30 +75,13 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
|||||||
setColorGlyph(myEdnData);
|
setColorGlyph(myEdnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xChild = _child->getNamed("start");
|
xChild = _child->getNamed("regex");
|
||||||
if (NULL != xChild) {
|
if (nullptr != xChild) {
|
||||||
std::string myData = xChild->getText();
|
std::string myData = xChild->getText();
|
||||||
if (myData.size() != 0) {
|
if (myData.size() != 0) {
|
||||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||||
std::string myEdnData = myData;
|
std::string myEdnData = myData;
|
||||||
setPaternStart(myEdnData);
|
setPatern(myEdnData);
|
||||||
}
|
|
||||||
}
|
|
||||||
xChild = _child->getNamed("end");
|
|
||||||
if (NULL != xChild) {
|
|
||||||
std::string myData = xChild->getText();
|
|
||||||
if (myData.size() != 0) {
|
|
||||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
|
||||||
std::string myEdnData = myData;
|
|
||||||
setPaternStop(myEdnData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xChild = _child->getNamed("EscapeChar");
|
|
||||||
if (NULL != xChild) {
|
|
||||||
std::string myData = xChild->getText();
|
|
||||||
if (myData.size() != 0) {
|
|
||||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
|
||||||
setEscapeChar(myData[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,41 +92,17 @@ enum resultFind appl::HighlightPattern::find(int32_t _start,
|
|||||||
appl::HighlightInfo& _resultat,
|
appl::HighlightInfo& _resultat,
|
||||||
etk::Buffer& _buffer) {
|
etk::Buffer& _buffer) {
|
||||||
//APPL_DEBUG(" try to find the element");
|
//APPL_DEBUG(" try to find the element");
|
||||||
_resultat.beginStart = -1;
|
_resultat.start = -1;
|
||||||
_resultat.beginStop = -1;
|
_resultat.stop = -1;
|
||||||
_resultat.endStart = -1;
|
|
||||||
_resultat.endStop = -1;
|
|
||||||
_resultat.notEnded = false;
|
_resultat.notEnded = false;
|
||||||
_resultat.patern = this;
|
_resultat.patern = this;
|
||||||
|
|
||||||
// when we have only one element:
|
// when we have only one element:
|
||||||
if (m_regExpStop == NULL) {
|
if (true == m_regExp->processOneElement(_buffer, _start, _stop)) {
|
||||||
if (true == m_regExpStart->processOneElement(_buffer, _start, _stop)) {
|
_resultat.start = m_regExp->start();
|
||||||
_resultat.beginStart = m_regExpStart->start();
|
_resultat.stop = m_regExp->stop();
|
||||||
_resultat.beginStop = m_regExpStart->stop();
|
|
||||||
_resultat.endStart = m_regExpStart->start();
|
|
||||||
_resultat.endStop = m_regExpStart->stop();
|
|
||||||
return HLP_FIND_OK;
|
|
||||||
}
|
|
||||||
//APPL_DEBUG("NOT find hightlightpatern ...");
|
|
||||||
return HLP_FIND_ERROR;
|
|
||||||
}
|
|
||||||
// try while we find the first element
|
|
||||||
if (m_regExpStart->processOneElement(_buffer, _start, _stop, m_escapeChar) == false) {
|
|
||||||
return HLP_FIND_ERROR;
|
|
||||||
}
|
|
||||||
_resultat.beginStart = m_regExpStart->start();
|
|
||||||
_resultat.beginStop = m_regExpStart->stop();
|
|
||||||
if (m_regExpStop->parse(_buffer, _resultat.beginStop, _stop, m_escapeChar) == true) {
|
|
||||||
_resultat.endStart = m_regExpStop->start();
|
|
||||||
_resultat.endStop = m_regExpStop->stop();
|
|
||||||
return HLP_FIND_OK;
|
return HLP_FIND_OK;
|
||||||
} else {
|
|
||||||
_resultat.endStart = _stop+1;
|
|
||||||
_resultat.endStop = _stop+1;
|
|
||||||
_resultat.notEnded = true;
|
|
||||||
return HLP_FIND_OK_NO_END;
|
|
||||||
}
|
}
|
||||||
//APPL_DEBUG("NOT find start hightlightpatern ...");
|
//APPL_DEBUG("NOT find hightlightpatern ...");
|
||||||
return HLP_FIND_ERROR;
|
return HLP_FIND_ERROR;
|
||||||
}
|
}
|
||||||
|
@@ -29,59 +29,46 @@ enum resultFind {
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class HighlightPattern {
|
class HighlightPattern {
|
||||||
private:
|
private:
|
||||||
appl::GlyphPainting*& m_glyphPainting;
|
std::shared_ptr<appl::GlyphPainting> m_glyphPainting;
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
HighlightPattern(appl::GlyphPainting*& _glyphPainting);
|
HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting);
|
||||||
~HighlightPattern(void);
|
virtual ~HighlightPattern();
|
||||||
private:
|
private:
|
||||||
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||||
public:
|
public:
|
||||||
void setName(std::string& _name) {
|
void setName(std::string& _name) {
|
||||||
m_paternName = _name;
|
m_paternName = _name;
|
||||||
};
|
};
|
||||||
std::string getName(void) {
|
std::string getName() {
|
||||||
return m_paternName;
|
return m_paternName;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
etk::RegExp<etk::Buffer>* m_regExpStart; //!< Start of Regular expression
|
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExp; //!< Start of Regular expression
|
||||||
public:
|
public:
|
||||||
void setPaternStart(std::string& _regExp);
|
void setPatern(std::string& _regExp);
|
||||||
private:
|
std::string getPaternString();
|
||||||
etk::RegExp<etk::Buffer>* m_regExpStop; //!< Stop of Regular Expression
|
|
||||||
public:
|
|
||||||
void setPaternStop(std::string& _regExp);
|
|
||||||
private:
|
private:
|
||||||
std::string m_colorName; //!< Current color name
|
std::string m_colorName; //!< Current color name
|
||||||
int32_t m_colorId; //!< Id of the the glyph painting
|
int32_t m_colorId; //!< Id of the the glyph painting
|
||||||
public:
|
public:
|
||||||
void setColorGlyph(std::string& _colorName);
|
void setColorGlyph(std::string& _colorName);
|
||||||
const appl::GlyphDecoration& getColorGlyph(void) {
|
const appl::GlyphDecoration& getColorGlyph() {
|
||||||
return (*m_glyphPainting)[m_colorId];
|
return (*m_glyphPainting)[m_colorId];
|
||||||
};
|
};
|
||||||
private:
|
|
||||||
char32_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
|
||||||
public:
|
|
||||||
void setEscapeChar(const char32_t& _EscapeChar);
|
|
||||||
private:
|
|
||||||
bool m_multiline; //!< The patern is multiline
|
|
||||||
public:
|
|
||||||
void setMultiline(bool _enable) {
|
|
||||||
m_multiline = _enable;
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher ....
|
int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher ....
|
||||||
public:
|
public:
|
||||||
void setLevel(int32_t _newLevel) {
|
void setLevel(int32_t _newLevel) {
|
||||||
m_level = _newLevel;
|
m_level = _newLevel;
|
||||||
};
|
};
|
||||||
int32_t getLevel(void) {
|
int32_t getLevel() {
|
||||||
return m_level;
|
return m_level;
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void display(void);
|
void display();
|
||||||
/**
|
/**
|
||||||
* @brief find Element only in the specify start characters and find the end with the range done
|
* @brief find Element only in the specify start characters and find the end with the range done
|
||||||
* @param[in] _start First character to search data (if recognise it start here)
|
* @param[in] _start First character to search data (if recognise it start here)
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#define __class__ "TextViewerPlugin"
|
#define __class__ "TextViewerPlugin"
|
||||||
|
|
||||||
|
|
||||||
appl::TextViewerPlugin::TextViewerPlugin(void) :
|
appl::TextViewerPlugin::TextViewerPlugin() :
|
||||||
m_isEnable(true),
|
m_isEnable(true),
|
||||||
m_activateOnEventEntry(false),
|
m_activateOnEventEntry(false),
|
||||||
m_activateOnEventInput(false),
|
m_activateOnEventInput(false),
|
||||||
@@ -23,10 +23,14 @@ appl::TextViewerPlugin::TextViewerPlugin(void) :
|
|||||||
m_activateOnRemove(false),
|
m_activateOnRemove(false),
|
||||||
m_activateOnReceiveMessage(false),
|
m_activateOnReceiveMessage(false),
|
||||||
m_activateOnCursorMove(false) {
|
m_activateOnCursorMove(false) {
|
||||||
|
addObjectType("appl::TextViewerPlugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::TextViewerPlugin::~TextViewerPlugin(void) {
|
void appl::TextViewerPlugin::init() {
|
||||||
|
ewol::Object::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
appl::TextViewerPlugin::~TextViewerPlugin() {
|
||||||
if (m_isEnable == false) {
|
if (m_isEnable == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -17,9 +17,12 @@
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class TextViewerPlugin : public ewol::Object {
|
class TextViewerPlugin : public ewol::Object {
|
||||||
friend class appl::TextViewer;
|
friend class appl::TextViewer;
|
||||||
|
protected:
|
||||||
|
TextViewerPlugin();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextViewerPlugin(void);
|
DECLARE_FACTORY(TextViewerPlugin);
|
||||||
virtual ~TextViewerPlugin(void);
|
virtual ~TextViewerPlugin();
|
||||||
private:
|
private:
|
||||||
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
||||||
public:
|
public:
|
||||||
@@ -32,20 +35,20 @@ namespace appl {
|
|||||||
* @brief Get the activity status.
|
* @brief Get the activity status.
|
||||||
* @return true if the plugin is active, false otherwise.
|
* @return true if the plugin is active, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool isEnable(void) {
|
bool isEnable() {
|
||||||
return m_isEnable;
|
return m_isEnable;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief On plugin global enable.
|
* @brief On plugin global enable.
|
||||||
*/
|
*/
|
||||||
virtual void onPluginEnable(void) {
|
virtual void onPluginEnable() {
|
||||||
// nothing to do here ...
|
// nothing to do here ...
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief On plugin global disable.
|
* @brief On plugin global disable.
|
||||||
*/
|
*/
|
||||||
virtual void onPluginDisable(void) {
|
virtual void onPluginDisable() {
|
||||||
// nothing to do here ...
|
// nothing to do here ...
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@@ -69,7 +72,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnEventEntry(void) {
|
bool isAvaillableOnEventEntry() {
|
||||||
return m_activateOnEventEntry;
|
return m_activateOnEventEntry;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +92,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnEventInput(void) {
|
bool isAvaillableOnEventInput() {
|
||||||
return m_activateOnEventInput;
|
return m_activateOnEventInput;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -109,7 +112,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnWrite(void) {
|
bool isAvaillableOnWrite() {
|
||||||
return m_activateOnWrite;
|
return m_activateOnWrite;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +134,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnReplace(void) {
|
bool isAvaillableOnReplace() {
|
||||||
return m_activateOnReplace;
|
return m_activateOnReplace;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -155,7 +158,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnRemove(void) {
|
bool isAvaillableOnRemove() {
|
||||||
return m_activateOnRemove;
|
return m_activateOnRemove;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -177,7 +180,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnReceiveMessage(void) {
|
bool isAvaillableOnReceiveMessage() {
|
||||||
return m_activateOnReceiveMessage;
|
return m_activateOnReceiveMessage;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -186,8 +189,8 @@ namespace appl {
|
|||||||
* @param[in] _msg Generic message.
|
* @param[in] _msg Generic message.
|
||||||
* @return true if the event might not propagate anymore
|
* @return true if the event might not propagate anymore
|
||||||
*/
|
*/
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
@@ -197,7 +200,7 @@ namespace appl {
|
|||||||
* @brief Get the availlability of a callback
|
* @brief Get the availlability of a callback
|
||||||
* @return true if availlable
|
* @return true if availlable
|
||||||
*/
|
*/
|
||||||
bool isAvaillableOnCursorMove(void) {
|
bool isAvaillableOnCursorMove() {
|
||||||
return m_activateOnCursorMove;
|
return m_activateOnCursorMove;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@@ -15,8 +15,13 @@
|
|||||||
#define __class__ "TextPluginAutoIndent"
|
#define __class__ "TextPluginAutoIndent"
|
||||||
|
|
||||||
|
|
||||||
appl::TextPluginAutoIndent::TextPluginAutoIndent(void) {
|
appl::TextPluginAutoIndent::TextPluginAutoIndent() {
|
||||||
m_activateOnEventEntry = true;
|
m_activateOnEventEntry = true;
|
||||||
|
addObjectType("appl::TextPluginAutoIndent");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginAutoIndent::init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
||||||
|
@@ -17,9 +17,12 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextPluginAutoIndent : public appl::TextViewerPlugin {
|
class TextPluginAutoIndent : public appl::TextViewerPlugin {
|
||||||
|
protected:
|
||||||
|
TextPluginAutoIndent();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginAutoIndent(void);
|
DECLARE_FACTORY(TextPluginAutoIndent);
|
||||||
~TextPluginAutoIndent(void) {
|
virtual ~TextPluginAutoIndent() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
|
@@ -15,8 +15,13 @@
|
|||||||
#define __class__ "TextPluginCopy"
|
#define __class__ "TextPluginCopy"
|
||||||
|
|
||||||
|
|
||||||
appl::TextPluginCopy::TextPluginCopy(void) {
|
appl::TextPluginCopy::TextPluginCopy() {
|
||||||
m_activateOnReceiveMessage = true;
|
m_activateOnReceiveMessage = true;
|
||||||
|
addObjectType("appl::TextPluginCopy");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginCopy::init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||||
@@ -33,8 +38,8 @@ void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
|
|||||||
// TODO : unknow function ...
|
// TODO : unknow function ...
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextPluginCopy::onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
if (isEnable() == false) {
|
if (isEnable() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -17,15 +17,18 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextPluginCopy : public appl::TextViewerPlugin {
|
class TextPluginCopy : public appl::TextViewerPlugin {
|
||||||
|
protected:
|
||||||
|
TextPluginCopy();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginCopy(void);
|
DECLARE_FACTORY(TextPluginCopy);
|
||||||
~TextPluginCopy(void) {
|
virtual ~TextPluginCopy() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -18,16 +18,23 @@
|
|||||||
#define __class__ "TextPluginCtags"
|
#define __class__ "TextPluginCtags"
|
||||||
|
|
||||||
|
|
||||||
appl::TextPluginCtags::TextPluginCtags(void) :
|
appl::TextPluginCtags::TextPluginCtags() :
|
||||||
m_tagFilename(""),
|
|
||||||
m_tagFolderBase(""),
|
m_tagFolderBase(""),
|
||||||
m_ctagFile(NULL) {
|
m_tagFilename(""),
|
||||||
|
m_ctagFile(nullptr) {
|
||||||
m_activateOnReceiveMessage = true;
|
m_activateOnReceiveMessage = true;
|
||||||
// load buffer manager:
|
// load buffer manager:
|
||||||
m_bufferManager = appl::BufferManager::keep();
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
addObjectType("appl::TextPluginCtags");
|
||||||
}
|
}
|
||||||
appl::TextPluginCtags::~TextPluginCtags(void) {
|
|
||||||
appl::BufferManager::release(m_bufferManager);
|
void appl::TextPluginCtags::init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
appl::TextPluginCtags::~TextPluginCtags() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* eventJumpDestination = "event-plugin-ctags-jump-destination";
|
const char* eventJumpDestination = "event-plugin-ctags-jump-destination";
|
||||||
@@ -57,7 +64,7 @@ void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
||||||
if (m_ctagFile == NULL) {
|
if (m_ctagFile == nullptr) {
|
||||||
APPL_WARNING("No ctags file open");
|
APPL_WARNING("No ctags file open");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -78,20 +85,20 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
|||||||
|
|
||||||
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
|
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
|
||||||
APPL_INFO("Multiple file destination ...");
|
APPL_INFO("Multiple file destination ...");
|
||||||
appl::TagFileSelection* tmpWidget = new appl::TagFileSelection();
|
std::shared_ptr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
|
||||||
if (NULL == tmpWidget) {
|
if (nullptr == tmpWidget) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
tmpWidget->addCtagsNewItem(myfile.getName(), lineID);
|
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
|
||||||
do {
|
do {
|
||||||
tmpFile = m_tagFolderBase + "/" + entry.file;
|
tmpFile = m_tagFolderBase + "/" + entry.file;
|
||||||
myfile = tmpFile;
|
myfile = tmpFile;
|
||||||
lineID = entry.address.lineNumber;
|
lineID = entry.address.lineNumber;
|
||||||
printTag(&entry);
|
printTag(&entry);
|
||||||
tmpWidget->addCtagsNewItem(myfile.getName(), lineID);
|
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
|
||||||
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
|
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
|
||||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||||
tmpWidget->registerOnEvent(this, applEventctagsSelection, eventOpenCtagsSelectReturn);
|
tmpWidget->registerOnEvent(shared_from_this(), applEventctagsSelection, eventOpenCtagsSelectReturn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jumpFile(myfile.getName(), lineID - 1);
|
jumpFile(myfile.getName(), lineID - 1);
|
||||||
@@ -101,19 +108,19 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
|||||||
void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _lineId) {
|
void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _lineId) {
|
||||||
// save the current file in the history
|
// save the current file in the history
|
||||||
// TODO : registerHistory();
|
// TODO : registerHistory();
|
||||||
if (m_bufferManager != NULL) {
|
if (m_bufferManager != nullptr) {
|
||||||
m_bufferManager->open(_filename);
|
m_bufferManager->open(_filename);
|
||||||
}
|
}
|
||||||
sendMultiCast(appl::MsgSelectChange, _filename);
|
sendMultiCast(appl::MsgSelectChange, _filename);
|
||||||
sendMultiCast(appl::MsgSelectGotoLineSelect, std::to_string(_lineId));
|
sendMultiCast(appl::MsgSelectGotoLineSelect, etk::to_string(_lineId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextPluginCtags::loadTagFile(void) {
|
void appl::TextPluginCtags::loadTagFile() {
|
||||||
tagFileInfo info;
|
tagFileInfo info;
|
||||||
// close previous tag file
|
// close previous tag file
|
||||||
if (NULL != m_ctagFile) {
|
if (nullptr != m_ctagFile) {
|
||||||
tagsClose(m_ctagFile);
|
tagsClose(m_ctagFile);
|
||||||
m_ctagFile = NULL;
|
m_ctagFile = nullptr;
|
||||||
}
|
}
|
||||||
if (m_tagFilename == "") {
|
if (m_tagFilename == "") {
|
||||||
return;
|
return;
|
||||||
@@ -121,7 +128,7 @@ void appl::TextPluginCtags::loadTagFile(void) {
|
|||||||
// load (open) the tag file :
|
// load (open) the tag file :
|
||||||
APPL_INFO("try to open tag file : " << m_tagFilename);
|
APPL_INFO("try to open tag file : " << m_tagFilename);
|
||||||
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
|
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
|
||||||
if (NULL != m_ctagFile) {
|
if (nullptr != m_ctagFile) {
|
||||||
APPL_INFO("open exuberant Ctags file is OK ...");
|
APPL_INFO("open exuberant Ctags file is OK ...");
|
||||||
} else {
|
} else {
|
||||||
APPL_INFO("Error to open ctags file ...");
|
APPL_INFO("Error to open ctags file ...");
|
||||||
@@ -138,7 +145,7 @@ void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
|
|||||||
<< "\" at line="<< (int32_t)_entry->address.lineNumber);
|
<< "\" at line="<< (int32_t)_entry->address.lineNumber);
|
||||||
|
|
||||||
APPL_INFO("Extention field : ");
|
APPL_INFO("Extention field : ");
|
||||||
if (_entry->kind != NULL && _entry->kind [0] != '\0') {
|
if (_entry->kind != nullptr && _entry->kind [0] != '\0') {
|
||||||
APPL_INFO(" kind : " << _entry->kind);
|
APPL_INFO(" kind : " << _entry->kind);
|
||||||
}
|
}
|
||||||
if (_entry->fileScope) {
|
if (_entry->fileScope) {
|
||||||
@@ -156,7 +163,7 @@ void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg)
|
|||||||
etk::FSNode tmpFilename = _msg.getData();
|
etk::FSNode tmpFilename = _msg.getData();
|
||||||
m_tagFilename = tmpFilename.getNameFile();
|
m_tagFilename = tmpFilename.getNameFile();
|
||||||
m_tagFolderBase = tmpFilename.getNameFolder();
|
m_tagFolderBase = tmpFilename.getNameFolder();
|
||||||
APPL_DEBUG("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
|
APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
|
||||||
loadTagFile();
|
loadTagFile();
|
||||||
} else if (_msg.getMessage() == eventOpenCtagsSelectReturn) {
|
} else if (_msg.getMessage() == eventOpenCtagsSelectReturn) {
|
||||||
// parse the input data
|
// parse the input data
|
||||||
@@ -167,22 +174,28 @@ void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg)
|
|||||||
jumpFile(tmp, lineID - 1);
|
jumpFile(tmp, lineID - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
if (isEnable() == false) {
|
if (isEnable() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_msg.getMessage() == eventOpenCtagsFile) {
|
if (_msg.getMessage() == eventOpenCtagsFile) {
|
||||||
APPL_INFO("Request opening ctag file");
|
APPL_INFO("Request opening ctag file");
|
||||||
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser();
|
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
|
||||||
if (NULL == tmpWidget) {
|
if (nullptr == tmpWidget) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
return true;
|
||||||
tmpWidget->setTitle("Open Exuberant Ctags file");
|
|
||||||
tmpWidget->setValidateLabel("Open");
|
|
||||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
|
||||||
tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn);
|
|
||||||
}
|
}
|
||||||
|
tmpWidget->setTitle("Open Exuberant Ctags file");
|
||||||
|
tmpWidget->setValidateLabel("Open");
|
||||||
|
// try to get the current folder :
|
||||||
|
std::string path = _textDrawer.getBufferPath();
|
||||||
|
APPL_ERROR("get path : '" << path << "'");
|
||||||
|
if (path != "") {
|
||||||
|
tmpWidget->setFolder(path);
|
||||||
|
}
|
||||||
|
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||||
|
tmpWidget->registerOnEvent(shared_from_this(), "validate", eventOpenCtagsOpenFileReturn);
|
||||||
return true;
|
return true;
|
||||||
} else if (_msg.getMessage() == eventJumpDestination) {
|
} else if (_msg.getMessage() == eventJumpDestination) {
|
||||||
if (_textDrawer.hasBuffer() == false) {
|
if (_textDrawer.hasBuffer() == false) {
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
#include <appl/TextPlugin.h>
|
#include <appl/TextPlugin.h>
|
||||||
#include <appl/ctags/readtags.h>
|
#include <appl/ctags/readtags.h>
|
||||||
|
|
||||||
|
// create ctags file : "ctags-exuberant --fields=n -R"
|
||||||
|
// --fields=n add the line number needed for this software version ..
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextPluginCtags : public appl::TextViewerPlugin {
|
class TextPluginCtags : public appl::TextViewerPlugin {
|
||||||
private:
|
private:
|
||||||
@@ -26,19 +29,22 @@ namespace appl {
|
|||||||
std::string m_tagFolderBase;
|
std::string m_tagFolderBase;
|
||||||
std::string m_tagFilename;
|
std::string m_tagFilename;
|
||||||
tagFile* m_ctagFile;
|
tagFile* m_ctagFile;
|
||||||
void loadTagFile(void);
|
void loadTagFile();
|
||||||
void printTag(const tagEntry *_entry);
|
void printTag(const tagEntry *_entry);
|
||||||
void jumpTo(const std::string& _name);
|
void jumpTo(const std::string& _name);
|
||||||
void jumpFile(const std::string& _filename, int64_t _lineId);
|
void jumpFile(const std::string& _filename, int64_t _lineId);
|
||||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||||
|
protected:
|
||||||
|
TextPluginCtags();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginCtags(void);
|
DECLARE_FACTORY(TextPluginCtags);
|
||||||
~TextPluginCtags(void);
|
virtual ~TextPluginCtags();
|
||||||
public:
|
public:
|
||||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg);
|
const ewol::object::Message& _msg);
|
||||||
// internal message :
|
// internal message :
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
};
|
};
|
||||||
|
@@ -17,22 +17,28 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
template <typename TYPE> class TextViewerPluginData : public appl::TextViewerPlugin {
|
template <typename TYPE> class TextViewerPluginData : public appl::TextViewerPlugin {
|
||||||
public:
|
protected:
|
||||||
TextViewerPluginData(void) {
|
TextViewerPluginData() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
|
addObjectType("appl::TextViewerPluginData");
|
||||||
}
|
}
|
||||||
virtual ~TextViewerPluginData(void) {
|
void init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(TextViewerPluginData);
|
||||||
|
virtual ~TextViewerPluginData() {
|
||||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||||
if (m_specificData[iii].second != NULL) {
|
if (m_specificData[iii].second != nullptr) {
|
||||||
remove(*m_specificData[iii].second);
|
remove(*m_specificData[iii].second);
|
||||||
delete(m_specificData[iii].second);
|
delete(m_specificData[iii].second);
|
||||||
m_specificData[iii].second = NULL;
|
m_specificData[iii].second = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_specificData.clear();
|
m_specificData.clear();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
std::vector<std::pair<appl::Buffer* ,TYPE* >> m_specificData;
|
std::vector<std::pair<std::shared_ptr<appl::Buffer> ,TYPE* >> m_specificData;
|
||||||
protected:
|
protected:
|
||||||
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
|
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
|
||||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||||
@@ -41,27 +47,27 @@ namespace appl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
TYPE* data = new TYPE();
|
TYPE* data = new TYPE();
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), data));
|
m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), data));
|
||||||
// create a new one ...
|
// create a new one ...
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
protected: // Wrap all element with their internal data: (do not use theses function)
|
protected: // Wrap all element with their internal data: (do not use theses function)
|
||||||
bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
TYPE* data = getDataRef(_textDrawer);
|
TYPE* data = getDataRef(_textDrawer);
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return onReceiveMessage(_textDrawer, _msg, *data);
|
return onReceiveMessageViewer(_textDrawer, _msg, *data);
|
||||||
}
|
}
|
||||||
bool onWrite(appl::TextViewer& _textDrawer,
|
bool onWrite(appl::TextViewer& _textDrawer,
|
||||||
const appl::Buffer::Iterator& _pos,
|
const appl::Buffer::Iterator& _pos,
|
||||||
const std::string& _data) {
|
const std::string& _data) {
|
||||||
TYPE* data = getDataRef(_textDrawer);
|
TYPE* data = getDataRef(_textDrawer);
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return onWrite(_textDrawer, _pos, _data, *data);
|
return onWrite(_textDrawer, _pos, _data, *data);
|
||||||
@@ -71,7 +77,7 @@ namespace appl {
|
|||||||
const std::string& _data,
|
const std::string& _data,
|
||||||
const appl::Buffer::Iterator& _posEnd) {
|
const appl::Buffer::Iterator& _posEnd) {
|
||||||
TYPE* data = getDataRef(_textDrawer);
|
TYPE* data = getDataRef(_textDrawer);
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return onReplace(_textDrawer, _pos, _data, _posEnd, *data);
|
return onReplace(_textDrawer, _pos, _data, _posEnd, *data);
|
||||||
@@ -80,16 +86,16 @@ namespace appl {
|
|||||||
const appl::Buffer::Iterator& _pos,
|
const appl::Buffer::Iterator& _pos,
|
||||||
const appl::Buffer::Iterator& _posEnd) {
|
const appl::Buffer::Iterator& _posEnd) {
|
||||||
TYPE* data = getDataRef(_textDrawer);
|
TYPE* data = getDataRef(_textDrawer);
|
||||||
if (data == NULL) {
|
if (data == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return onRemove(_textDrawer, _pos, _posEnd, *data);
|
return onRemove(_textDrawer, _pos, _posEnd, *data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg,
|
const ewol::object::Message& _msg,
|
||||||
TYPE& _data) {
|
TYPE& _data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual bool onWrite(appl::TextViewer& _textDrawer,
|
virtual bool onWrite(appl::TextViewer& _textDrawer,
|
||||||
@@ -114,10 +120,6 @@ namespace appl {
|
|||||||
virtual void remove(TYPE& _data) {
|
virtual void remove(TYPE& _data) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
public:
|
|
||||||
virtual void onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
// TODO : plop
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,13 +15,19 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TextPluginHistory"
|
#define __class__ "TextPluginHistory"
|
||||||
|
|
||||||
appl::TextPluginHistory::TextPluginHistory(void) {
|
appl::TextPluginHistory::TextPluginHistory() {
|
||||||
m_activateOnReceiveMessage = true;
|
m_activateOnReceiveMessage = true;
|
||||||
m_activateOnWrite = true;
|
m_activateOnWrite = true;
|
||||||
m_activateOnReplace = true;
|
m_activateOnReplace = true;
|
||||||
m_activateOnRemove = true;
|
m_activateOnRemove = true;
|
||||||
|
addObjectType("appl::TextPluginHistory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginHistory::init() {
|
||||||
|
appl::TextViewerPluginData<appl::PluginHistoryData>::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
|
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||||
// add event :
|
// add event :
|
||||||
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo);
|
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo);
|
||||||
@@ -34,9 +40,9 @@ void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
|
|||||||
// TODO : unknow function ...
|
// TODO : unknow function ...
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg,
|
const ewol::object::Message& _msg,
|
||||||
appl::PluginHistoryData& _data) {
|
appl::PluginHistoryData& _data) {
|
||||||
if (isEnable() == false) {
|
if (isEnable() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -44,7 +50,7 @@ bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer,
|
|||||||
if (_data.m_redo.size() == 0) {
|
if (_data.m_redo.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_data.m_redo[_data.m_redo.size()-1] == NULL) {
|
if (_data.m_redo[_data.m_redo.size()-1] == nullptr) {
|
||||||
_data.m_redo.pop_back();
|
_data.m_redo.pop_back();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -60,7 +66,7 @@ bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer,
|
|||||||
if (_data.m_undo.size() == 0) {
|
if (_data.m_undo.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_data.m_undo[_data.m_undo.size()-1] == NULL) {
|
if (_data.m_undo[_data.m_undo.size()-1] == nullptr) {
|
||||||
_data.m_undo.pop_back();
|
_data.m_undo.pop_back();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -81,11 +87,11 @@ void appl::TextPluginHistory::clearRedo(appl::PluginHistoryData& _data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (size_t iii=0; iii<_data.m_redo.size(); ++iii) {
|
for (size_t iii=0; iii<_data.m_redo.size(); ++iii) {
|
||||||
if (_data.m_redo[iii] == NULL) {
|
if (_data.m_redo[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
delete(_data.m_redo[iii]);
|
delete(_data.m_redo[iii]);
|
||||||
_data.m_redo[iii] = NULL;
|
_data.m_redo[iii] = nullptr;
|
||||||
}
|
}
|
||||||
_data.m_redo.clear();
|
_data.m_redo.clear();
|
||||||
}
|
}
|
||||||
@@ -95,11 +101,11 @@ void appl::TextPluginHistory::clearUndo(appl::PluginHistoryData& _data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (size_t iii=0; iii<_data.m_undo.size(); ++iii) {
|
for (size_t iii=0; iii<_data.m_undo.size(); ++iii) {
|
||||||
if (_data.m_undo[iii] == NULL) {
|
if (_data.m_undo[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
delete(_data.m_undo[iii]);
|
delete(_data.m_undo[iii]);
|
||||||
_data.m_undo[iii] = NULL;
|
_data.m_undo[iii] = nullptr;
|
||||||
}
|
}
|
||||||
_data.m_undo.clear();
|
_data.m_undo.clear();
|
||||||
}
|
}
|
||||||
@@ -113,13 +119,13 @@ bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
appl::History *tmpElement = new appl::History();
|
appl::History *tmpElement = new appl::History();
|
||||||
if (tmpElement != NULL) {
|
if (tmpElement != nullptr) {
|
||||||
tmpElement->m_addedText = _strData;
|
tmpElement->m_addedText = _strData;
|
||||||
tmpElement->m_posAdded = (int64_t)_pos;
|
tmpElement->m_posAdded = (int64_t)_pos;
|
||||||
tmpElement->m_endPosRemoved = (int64_t)_pos;
|
tmpElement->m_endPosRemoved = (int64_t)_pos;
|
||||||
}
|
}
|
||||||
_textDrawer.writeDirect(_strData, _pos);
|
_textDrawer.writeDirect(_strData, _pos);
|
||||||
if (tmpElement != NULL) {
|
if (tmpElement != nullptr) {
|
||||||
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
|
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
|
||||||
clearRedo(_data);
|
clearRedo(_data);
|
||||||
_data.m_undo.push_back(tmpElement);
|
_data.m_undo.push_back(tmpElement);
|
||||||
@@ -137,14 +143,14 @@ bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
appl::History *tmpElement = new appl::History();
|
appl::History *tmpElement = new appl::History();
|
||||||
if (tmpElement != NULL) {
|
if (tmpElement != nullptr) {
|
||||||
tmpElement->m_posAdded = (int64_t)_pos;
|
tmpElement->m_posAdded = (int64_t)_pos;
|
||||||
tmpElement->m_addedText = _strData;
|
tmpElement->m_addedText = _strData;
|
||||||
tmpElement->m_endPosRemoved = (int64_t)_posEnd;
|
tmpElement->m_endPosRemoved = (int64_t)_posEnd;
|
||||||
_textDrawer.copy(tmpElement->m_removedText, _pos, _posEnd);
|
_textDrawer.copy(tmpElement->m_removedText, _pos, _posEnd);
|
||||||
}
|
}
|
||||||
_textDrawer.replaceDirect(_strData, _pos, _posEnd);
|
_textDrawer.replaceDirect(_strData, _pos, _posEnd);
|
||||||
if (tmpElement != NULL) {
|
if (tmpElement != nullptr) {
|
||||||
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
|
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
|
||||||
clearRedo(_data);
|
clearRedo(_data);
|
||||||
_data.m_undo.push_back(tmpElement);
|
_data.m_undo.push_back(tmpElement);
|
||||||
@@ -161,7 +167,7 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
appl::History *tmpElement = new appl::History();
|
appl::History *tmpElement = new appl::History();
|
||||||
if (tmpElement != NULL) {
|
if (tmpElement != nullptr) {
|
||||||
tmpElement->m_addedText = "";
|
tmpElement->m_addedText = "";
|
||||||
tmpElement->m_posAdded = (int64_t)_pos;
|
tmpElement->m_posAdded = (int64_t)_pos;
|
||||||
tmpElement->m_endPosAdded = tmpElement->m_posAdded;
|
tmpElement->m_endPosAdded = tmpElement->m_posAdded;
|
||||||
@@ -176,9 +182,3 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appl::TextPluginHistory::onObjectRemove(ewol::Object* _removeObject) {
|
|
||||||
// TODO : Dependence with buffer removing ...
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class History {
|
class History {
|
||||||
public:
|
public:
|
||||||
History(void) :
|
History() :
|
||||||
m_posAdded(0),
|
m_posAdded(0),
|
||||||
m_endPosAdded(0),
|
m_endPosAdded(0),
|
||||||
m_endPosRemoved(0) {
|
m_endPosRemoved(0) {
|
||||||
@@ -36,16 +36,19 @@ namespace appl {
|
|||||||
std::vector<History*> m_redo; //!< History storing data
|
std::vector<History*> m_redo; //!< History storing data
|
||||||
};
|
};
|
||||||
class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> {
|
class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> {
|
||||||
|
protected:
|
||||||
|
TextPluginHistory();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginHistory(void);
|
DECLARE_FACTORY(TextPluginHistory);
|
||||||
virtual ~TextPluginHistory(void) { };
|
virtual ~TextPluginHistory() { };
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg,
|
const ewol::object::Message& _msg,
|
||||||
appl::PluginHistoryData& _data);
|
appl::PluginHistoryData& _data);
|
||||||
virtual bool onWrite(appl::TextViewer& _textDrawer,
|
virtual bool onWrite(appl::TextViewer& _textDrawer,
|
||||||
const appl::Buffer::Iterator& _pos,
|
const appl::Buffer::Iterator& _pos,
|
||||||
const std::string& _strData,
|
const std::string& _strData,
|
||||||
@@ -66,8 +69,6 @@ namespace appl {
|
|||||||
private:
|
private:
|
||||||
void clearRedo(appl::PluginHistoryData& _data);
|
void clearRedo(appl::PluginHistoryData& _data);
|
||||||
void clearUndo(appl::PluginHistoryData& _data);
|
void clearUndo(appl::PluginHistoryData& _data);
|
||||||
public:
|
|
||||||
virtual void onObjectRemove(ewol::Object* _removeObject);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -19,75 +19,67 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "textPluginManager"
|
#define __class__ "textPluginManager"
|
||||||
|
|
||||||
static std::vector<appl::TextViewerPlugin *>& getList(void) {
|
static std::list<std::shared_ptr<appl::TextViewerPlugin>>& getList() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::list<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnEventEntry(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnEventEntry() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnEventInput(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnEventInput() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnWrite(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnWrite() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnReplace(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnReplace() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnRemove(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnRemove() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnReceiveMessage(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListonReceiveMessageViewer() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
static std::vector<appl::TextViewerPlugin *>& getListOnCursorMove(void) {
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnCursorMove() {
|
||||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||||
return s_list;
|
return s_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::init(void) {
|
void appl::textPluginManager::init() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::unInit(void) {
|
void appl::textPluginManager::unInit() {
|
||||||
// remove all sub plugin class:
|
// remove all sub plugin class:
|
||||||
getListOnEventEntry().clear();
|
getListOnEventEntry().clear();
|
||||||
getListOnEventInput().clear();
|
getListOnEventInput().clear();
|
||||||
getListOnWrite().clear();
|
getListOnWrite().clear();
|
||||||
getListOnReplace().clear();
|
getListOnReplace().clear();
|
||||||
getListOnRemove().clear();
|
getListOnRemove().clear();
|
||||||
getListOnReceiveMessage().clear();
|
getListonReceiveMessageViewer().clear();
|
||||||
getListOnCursorMove().clear();
|
getListOnCursorMove().clear();
|
||||||
// remove all plugin:
|
|
||||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
|
||||||
if (getList()[iii] == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
delete(getList()[iii]);
|
|
||||||
getList()[iii] = NULL;
|
|
||||||
}
|
|
||||||
getList().clear();
|
getList().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::addDefaultPlugin(void) {
|
void appl::textPluginManager::addDefaultPlugin() {
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginCopy());
|
appl::textPluginManager::addPlugin(appl::TextPluginCopy::create());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginMultiLineTab());
|
appl::textPluginManager::addPlugin(appl::TextPluginMultiLineTab::create());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginAutoIndent());
|
appl::textPluginManager::addPlugin(appl::TextPluginAutoIndent::create());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginHistory());
|
appl::textPluginManager::addPlugin(appl::TextPluginHistory::create());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginRmLine());
|
appl::textPluginManager::addPlugin(appl::TextPluginRmLine::create());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginSelectAll());
|
appl::textPluginManager::addPlugin(appl::TextPluginSelectAll::create());
|
||||||
appl::textPluginManager::addPlugin(new appl::TextPluginCtags());
|
appl::textPluginManager::addPlugin(appl::TextPluginCtags::create());
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin) {
|
||||||
if (_plugin == NULL) {
|
if (_plugin == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getList().push_back(_plugin);
|
getList().push_back(_plugin);
|
||||||
@@ -107,7 +99,7 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
|||||||
getListOnRemove().push_back(_plugin);
|
getListOnRemove().push_back(_plugin);
|
||||||
}
|
}
|
||||||
if (_plugin->isAvaillableOnReceiveMessage() == true) {
|
if (_plugin->isAvaillableOnReceiveMessage() == true) {
|
||||||
getListOnReceiveMessage().push_back(_plugin);
|
getListonReceiveMessageViewer().push_back(_plugin);
|
||||||
}
|
}
|
||||||
if (_plugin->isAvaillableOnCursorMove() == true) {
|
if (_plugin->isAvaillableOnCursorMove() == true) {
|
||||||
getListOnCursorMove().push_back(_plugin);
|
getListOnCursorMove().push_back(_plugin);
|
||||||
@@ -115,31 +107,30 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
|
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
|
||||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
for (auto &it : getList()) {
|
||||||
if (getList()[iii] == NULL) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
getList()[iii]->onPluginEnable(_widget);
|
it->onPluginEnable(_widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
|
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
|
||||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
for (auto &it : getList()) {
|
||||||
if (getList()[iii] == NULL) {
|
if (it == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
getList()[iii]->onPluginDisable(_widget);
|
it->onPluginDisable(_widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||||
const ewol::event::Entry& _event) {
|
const ewol::event::Entry& _event) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnEventEntry();
|
for (auto &it : getListOnEventEntry()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onEventEntry(_textDrawer, _event) == true ) {
|
if (it->onEventEntry(_textDrawer, _event) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,12 +139,11 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
|
|
||||||
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
||||||
const ewol::event::Input& _event) {
|
const ewol::event::Input& _event) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnEventInput();
|
for (auto &it : getListOnEventInput()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onEventInput(_textDrawer, _event) == true ) {
|
if (it->onEventInput(_textDrawer, _event) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,12 +153,11 @@ bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
|||||||
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
|
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
|
||||||
const appl::Buffer::Iterator& _pos,
|
const appl::Buffer::Iterator& _pos,
|
||||||
const std::string& _data) {
|
const std::string& _data) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnWrite();
|
for (auto &it : getListOnWrite()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onWrite(_textDrawer, _pos, _data) == true ) {
|
if (it->onWrite(_textDrawer, _pos, _data) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,12 +168,11 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
|||||||
const appl::Buffer::Iterator& _pos,
|
const appl::Buffer::Iterator& _pos,
|
||||||
const std::string& _data,
|
const std::string& _data,
|
||||||
const appl::Buffer::Iterator& _posEnd) {
|
const appl::Buffer::Iterator& _posEnd) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnReplace();
|
for (auto &it : getListOnReplace()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
if (it->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,26 +182,24 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
|||||||
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||||
const appl::Buffer::Iterator& _pos,
|
const appl::Buffer::Iterator& _pos,
|
||||||
const appl::Buffer::Iterator& _posEnd) {
|
const appl::Buffer::Iterator& _posEnd) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnRemove();
|
for (auto &it : getListOnRemove()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
if (it->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnReceiveMessage();
|
for (auto &it : getListonReceiveMessageViewer()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onReceiveMessage(_textDrawer, _msg) == true ) {
|
if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,12 +208,11 @@ bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
|
|||||||
|
|
||||||
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
|
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
|
||||||
const appl::Buffer::Iterator& _pos) {
|
const appl::Buffer::Iterator& _pos) {
|
||||||
std::vector<appl::TextViewerPlugin *>& list = getListOnCursorMove();
|
for (auto &it : getListOnCursorMove()) {
|
||||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
if (it == nullptr) {
|
||||||
if (list[iii] == NULL) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (list[iii]->onCursorMove(_textDrawer, _pos) == true ) {
|
if (it->onCursorMove(_textDrawer, _pos) == true ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,20 +20,20 @@ namespace appl {
|
|||||||
/**
|
/**
|
||||||
* @brief Init the plugin manager for writer.
|
* @brief Init the plugin manager for writer.
|
||||||
*/
|
*/
|
||||||
void init(void);
|
void init();
|
||||||
/**
|
/**
|
||||||
* @brief UnInit the plugin manager for writer.
|
* @brief UnInit the plugin manager for writer.
|
||||||
*/
|
*/
|
||||||
void unInit(void);
|
void unInit();
|
||||||
/**
|
/**
|
||||||
* @brief Add default plugin list
|
* @brief Add default plugin list
|
||||||
*/
|
*/
|
||||||
void addDefaultPlugin(void);
|
void addDefaultPlugin();
|
||||||
/**
|
/**
|
||||||
* @brief Add a plugin.
|
* @brief Add a plugin.
|
||||||
* @param[in] _plugin Plugin pointer to add.
|
* @param[in] _plugin Plugin pointer to add.
|
||||||
*/
|
*/
|
||||||
void addPlugin(appl::TextViewerPlugin* _plugin);
|
void addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin);
|
||||||
/**
|
/**
|
||||||
* @brief connect a new widget to the plugin.
|
* @brief connect a new widget to the plugin.
|
||||||
* @param[in] _widget Reference on the widget caller.
|
* @param[in] _widget Reference on the widget caller.
|
||||||
@@ -98,8 +98,8 @@ namespace appl {
|
|||||||
* @param[in] _msg Generic message.
|
* @param[in] _msg Generic message.
|
||||||
* @return true if the event might not propagate anymore
|
* @return true if the event might not propagate anymore
|
||||||
*/
|
*/
|
||||||
bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg);
|
const ewol::object::Message& _msg);
|
||||||
/**
|
/**
|
||||||
* @brief Called when Cursor move of position.
|
* @brief Called when Cursor move of position.
|
||||||
* @param[in] _widget Reference on the widget caller.
|
* @param[in] _widget Reference on the widget caller.
|
||||||
|
@@ -14,8 +14,13 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TextPluginMultiLineTab"
|
#define __class__ "TextPluginMultiLineTab"
|
||||||
|
|
||||||
appl::TextPluginMultiLineTab::TextPluginMultiLineTab(void) {
|
appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
|
||||||
m_activateOnEventEntry = true;
|
m_activateOnEventEntry = true;
|
||||||
|
addObjectType("appl::TextPluginMultiLineTab");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginMultiLineTab::init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||||
@@ -47,22 +52,22 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
_textDrawer.copy(data, itStart, itStop);
|
_textDrawer.copy(data, itStart, itStop);
|
||||||
// TODO : Change this ...
|
// TODO : Change this ...
|
||||||
bool m_useTabs = true;
|
bool m_useTabs = true;
|
||||||
int32_t m_tabDist = 4;
|
size_t m_tabDist = 4;
|
||||||
|
|
||||||
if (true == _event.getSpecialKey().getShift() ) {
|
if (true == _event.getSpecialKey().getShift() ) {
|
||||||
// un-indent
|
// un-indent
|
||||||
data.insert(0, 1, u32char::Return);
|
data.insert(0, 1, u32char::Return);
|
||||||
for (int32_t iii=1; iii<data.size(); ++iii) {
|
for (size_t iii=1; iii<data.size(); ++iii) {
|
||||||
if (data[iii-1] != u32char::Return) {
|
if ((char32_t)data[iii-1] != u32char::Return) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(data[iii] == u32char::Tabulation) {
|
if((char32_t)data[iii] == u32char::Tabulation) {
|
||||||
data.erase(iii, 1);
|
data.erase(iii, 1);
|
||||||
} else if(data[iii] == u32char::Space) {
|
} else if((char32_t)data[iii] == u32char::Space) {
|
||||||
for (int32_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
|
for (size_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
|
||||||
if(data[iii] == u32char::Space) {
|
if((char32_t)data[iii] == u32char::Space) {
|
||||||
data.erase(iii, 1);
|
data.erase(iii, 1);
|
||||||
} else if(data[iii] == u32char::Tabulation) {
|
} else if((char32_t)data[iii] == u32char::Tabulation) {
|
||||||
data.erase(iii, 1);
|
data.erase(iii, 1);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -75,8 +80,8 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
} else {
|
} else {
|
||||||
// indent
|
// indent
|
||||||
data.insert(0, 1, u32char::Return);
|
data.insert(0, 1, u32char::Return);
|
||||||
for (int32_t iii=1; iii<data.size(); iii++) {
|
for (size_t iii=1; iii<data.size(); iii++) {
|
||||||
if (data[iii-1] != u32char::Return) {
|
if ((char32_t)data[iii-1] != u32char::Return) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (true == _event.getSpecialKey().getCtrl() ) {
|
if (true == _event.getSpecialKey().getCtrl() ) {
|
||||||
|
@@ -17,9 +17,12 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextPluginMultiLineTab : public appl::TextViewerPlugin {
|
class TextPluginMultiLineTab : public appl::TextViewerPlugin {
|
||||||
|
protected:
|
||||||
|
TextPluginMultiLineTab();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginMultiLineTab(void);
|
DECLARE_FACTORY(TextPluginMultiLineTab);
|
||||||
~TextPluginMultiLineTab(void) {
|
virtual ~TextPluginMultiLineTab() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
|
@@ -15,8 +15,13 @@
|
|||||||
#define __class__ "TextPluginRmLine"
|
#define __class__ "TextPluginRmLine"
|
||||||
|
|
||||||
|
|
||||||
appl::TextPluginRmLine::TextPluginRmLine(void) {
|
appl::TextPluginRmLine::TextPluginRmLine() {
|
||||||
m_activateOnReceiveMessage = true;
|
m_activateOnReceiveMessage = true;
|
||||||
|
addObjectType("appl::TextPluginRmLine");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginRmLine::init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||||
@@ -29,8 +34,8 @@ void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
|
|||||||
// TODO : unknow function ...
|
// TODO : unknow function ...
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextPluginRmLine::onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
if (isEnable() == false) {
|
if (isEnable() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -17,15 +17,18 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextPluginRmLine : public appl::TextViewerPlugin {
|
class TextPluginRmLine : public appl::TextViewerPlugin {
|
||||||
|
protected:
|
||||||
|
TextPluginRmLine();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginRmLine(void);
|
DECLARE_FACTORY(TextPluginRmLine);
|
||||||
~TextPluginRmLine(void) {
|
virtual ~TextPluginRmLine() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,8 +15,13 @@
|
|||||||
#define __class__ "TextPluginSelectAll"
|
#define __class__ "TextPluginSelectAll"
|
||||||
|
|
||||||
|
|
||||||
appl::TextPluginSelectAll::TextPluginSelectAll(void) {
|
appl::TextPluginSelectAll::TextPluginSelectAll() {
|
||||||
m_activateOnReceiveMessage = true;
|
m_activateOnReceiveMessage = true;
|
||||||
|
addObjectType("appl::TextPluginSelectAll");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::TextPluginSelectAll::init() {
|
||||||
|
appl::TextViewerPlugin::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* eventSelectAll = "plugin-select-all";
|
static const char* eventSelectAll = "plugin-select-all";
|
||||||
@@ -31,8 +36,8 @@ void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
|
|||||||
// TODO : unknow function ...
|
// TODO : unknow function ...
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TextPluginSelectAll::onReceiveMessage(appl::TextViewer& _textDrawer,
|
bool appl::TextPluginSelectAll::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||||
const ewol::object::Message& _msg) {
|
const ewol::object::Message& _msg) {
|
||||||
if (isEnable() == false) {
|
if (isEnable() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -17,15 +17,18 @@
|
|||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextPluginSelectAll : public appl::TextViewerPlugin {
|
class TextPluginSelectAll : public appl::TextViewerPlugin {
|
||||||
|
protected:
|
||||||
|
TextPluginSelectAll();
|
||||||
|
void init();
|
||||||
public:
|
public:
|
||||||
TextPluginSelectAll(void);
|
DECLARE_FACTORY(TextPluginSelectAll);
|
||||||
~TextPluginSelectAll(void) {
|
virtual ~TextPluginSelectAll() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -138,7 +138,7 @@ static int growString (vstring *s)
|
|||||||
newLength = 2 * s->size;
|
newLength = 2 * s->size;
|
||||||
newLine = (char*) realloc (s->buffer, newLength);
|
newLine = (char*) realloc (s->buffer, newLength);
|
||||||
}
|
}
|
||||||
if (newLine == NULL)
|
if (newLine == nullptr)
|
||||||
perror ("string too large");
|
perror ("string too large");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -154,13 +154,13 @@ static void copyName (tagFile *const file)
|
|||||||
{
|
{
|
||||||
size_t length;
|
size_t length;
|
||||||
const char *end = strchr (file->line.buffer, '\t');
|
const char *end = strchr (file->line.buffer, '\t');
|
||||||
if (end == NULL)
|
if (end == nullptr)
|
||||||
{
|
{
|
||||||
end = strchr (file->line.buffer, '\n');
|
end = strchr (file->line.buffer, '\n');
|
||||||
if (end == NULL)
|
if (end == nullptr)
|
||||||
end = strchr (file->line.buffer, '\r');
|
end = strchr (file->line.buffer, '\r');
|
||||||
}
|
}
|
||||||
if (end != NULL)
|
if (end != nullptr)
|
||||||
length = end - file->line.buffer;
|
length = end - file->line.buffer;
|
||||||
else
|
else
|
||||||
length = strlen (file->line.buffer);
|
length = strlen (file->line.buffer);
|
||||||
@@ -189,7 +189,7 @@ static int readTagLineRaw (tagFile *const file)
|
|||||||
reReadLine = 0;
|
reReadLine = 0;
|
||||||
*pLastChar = '\0';
|
*pLastChar = '\0';
|
||||||
line = fgets (file->line.buffer, (int) file->line.size, file->fp);
|
line = fgets (file->line.buffer, (int) file->line.size, file->fp);
|
||||||
if (line == NULL)
|
if (line == nullptr)
|
||||||
{
|
{
|
||||||
/* read error */
|
/* read error */
|
||||||
if (! feof (file->fp))
|
if (! feof (file->fp))
|
||||||
@@ -236,7 +236,7 @@ static tagResult growFields (tagFile *const file)
|
|||||||
unsigned short newCount = (unsigned short) 2 * file->fields.max;
|
unsigned short newCount = (unsigned short) 2 * file->fields.max;
|
||||||
tagExtensionField *newFields = (tagExtensionField*)
|
tagExtensionField *newFields = (tagExtensionField*)
|
||||||
realloc (file->fields.list, newCount * sizeof (tagExtensionField));
|
realloc (file->fields.list, newCount * sizeof (tagExtensionField));
|
||||||
if (newFields == NULL)
|
if (newFields == nullptr)
|
||||||
perror ("too many extension fields");
|
perror ("too many extension fields");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -251,7 +251,7 @@ static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
|
|||||||
char *const string)
|
char *const string)
|
||||||
{
|
{
|
||||||
char *p = string;
|
char *p = string;
|
||||||
while (p != NULL && *p != '\0')
|
while (p != nullptr && *p != '\0')
|
||||||
{
|
{
|
||||||
while (*p == TAB)
|
while (*p == TAB)
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
@@ -260,10 +260,10 @@ static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
|
|||||||
char *colon;
|
char *colon;
|
||||||
char *field = p;
|
char *field = p;
|
||||||
p = strchr (p, TAB);
|
p = strchr (p, TAB);
|
||||||
if (p != NULL)
|
if (p != nullptr)
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
colon = strchr (field, ':');
|
colon = strchr (field, ':');
|
||||||
if (colon == NULL)
|
if (colon == nullptr)
|
||||||
entry->kind = field;
|
entry->kind = field;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -295,19 +295,19 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
|
|||||||
char *p = file->line.buffer;
|
char *p = file->line.buffer;
|
||||||
char *tab = strchr (p, TAB);
|
char *tab = strchr (p, TAB);
|
||||||
|
|
||||||
entry->fields.list = NULL;
|
entry->fields.list = nullptr;
|
||||||
entry->fields.count = 0;
|
entry->fields.count = 0;
|
||||||
entry->kind = NULL;
|
entry->kind = nullptr;
|
||||||
entry->fileScope = 0;
|
entry->fileScope = 0;
|
||||||
|
|
||||||
entry->name = p;
|
entry->name = p;
|
||||||
if (tab != NULL)
|
if (tab != nullptr)
|
||||||
{
|
{
|
||||||
*tab = '\0';
|
*tab = '\0';
|
||||||
p = tab + 1;
|
p = tab + 1;
|
||||||
entry->file = p;
|
entry->file = p;
|
||||||
tab = strchr (p, TAB);
|
tab = strchr (p, TAB);
|
||||||
if (tab != NULL)
|
if (tab != nullptr)
|
||||||
{
|
{
|
||||||
int fieldsPresent;
|
int fieldsPresent;
|
||||||
*tab = '\0';
|
*tab = '\0';
|
||||||
@@ -321,8 +321,8 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
p = strchr (p + 1, delimiter);
|
p = strchr (p + 1, delimiter);
|
||||||
} while (p != NULL && *(p - 1) == '\\');
|
} while (p != nullptr && *(p - 1) == '\\');
|
||||||
if (p == NULL)
|
if (p == nullptr)
|
||||||
{
|
{
|
||||||
/* invalid pattern */
|
/* invalid pattern */
|
||||||
}
|
}
|
||||||
@@ -351,19 +351,19 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
|
|||||||
entry->fields.list = file->fields.list;
|
entry->fields.list = file->fields.list;
|
||||||
for (i = entry->fields.count ; i < file->fields.max ; ++i)
|
for (i = entry->fields.count ; i < file->fields.max ; ++i)
|
||||||
{
|
{
|
||||||
file->fields.list [i].key = NULL;
|
file->fields.list [i].key = nullptr;
|
||||||
file->fields.list [i].value = NULL;
|
file->fields.list [i].value = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *duplicate (const char *str)
|
static char *duplicate (const char *str)
|
||||||
{
|
{
|
||||||
char *result = NULL;
|
char *result = nullptr;
|
||||||
if (str != NULL)
|
if (str != nullptr)
|
||||||
{
|
{
|
||||||
result = strdup (str);
|
result = strdup (str);
|
||||||
if (result == NULL)
|
if (result == nullptr)
|
||||||
perror (NULL);
|
perror (nullptr);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -372,14 +372,14 @@ static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
|
|||||||
{
|
{
|
||||||
fpos_t startOfLine;
|
fpos_t startOfLine;
|
||||||
const size_t prefixLength = strlen (PseudoTagPrefix);
|
const size_t prefixLength = strlen (PseudoTagPrefix);
|
||||||
if (info != NULL)
|
if (info != nullptr)
|
||||||
{
|
{
|
||||||
info->file.format = 1;
|
info->file.format = 1;
|
||||||
info->file.sort = TAG_UNSORTED;
|
info->file.sort = TAG_UNSORTED;
|
||||||
info->program.author = NULL;
|
info->program.author = nullptr;
|
||||||
info->program.name = NULL;
|
info->program.name = nullptr;
|
||||||
info->program.url = NULL;
|
info->program.url = nullptr;
|
||||||
info->program.version = NULL;
|
info->program.version = nullptr;
|
||||||
}
|
}
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -407,7 +407,7 @@ static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
|
|||||||
file->program.url = duplicate (value);
|
file->program.url = duplicate (value);
|
||||||
else if (strcmp (key, "TAG_PROGRAM_VERSION") == 0)
|
else if (strcmp (key, "TAG_PROGRAM_VERSION") == 0)
|
||||||
file->program.version = duplicate (value);
|
file->program.version = duplicate (value);
|
||||||
if (info != NULL)
|
if (info != nullptr)
|
||||||
{
|
{
|
||||||
info->file.format = file->format;
|
info->file.format = file->format;
|
||||||
info->file.sort = file->sortMethod;
|
info->file.sort = file->sortMethod;
|
||||||
@@ -440,7 +440,7 @@ static void gotoFirstLogicalTag (tagFile *const file)
|
|||||||
static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
|
static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
|
||||||
{
|
{
|
||||||
tagFile *result = (tagFile*) calloc ((size_t) 1, sizeof (tagFile));
|
tagFile *result = (tagFile*) calloc ((size_t) 1, sizeof (tagFile));
|
||||||
if (result != NULL)
|
if (result != nullptr)
|
||||||
{
|
{
|
||||||
growString (&result->line);
|
growString (&result->line);
|
||||||
growString (&result->name);
|
growString (&result->name);
|
||||||
@@ -448,10 +448,10 @@ static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
|
|||||||
result->fields.list = (tagExtensionField*) calloc (
|
result->fields.list = (tagExtensionField*) calloc (
|
||||||
result->fields.max, sizeof (tagExtensionField));
|
result->fields.max, sizeof (tagExtensionField));
|
||||||
result->fp = fopen (filePath, "r");
|
result->fp = fopen (filePath, "r");
|
||||||
if (result->fp == NULL)
|
if (result->fp == nullptr)
|
||||||
{
|
{
|
||||||
free (result);
|
free (result);
|
||||||
result = NULL;
|
result = nullptr;
|
||||||
info->status.error_number = errno;
|
info->status.error_number = errno;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -475,15 +475,15 @@ static void terminate (tagFile *const file)
|
|||||||
free (file->name.buffer);
|
free (file->name.buffer);
|
||||||
free (file->fields.list);
|
free (file->fields.list);
|
||||||
|
|
||||||
if (file->program.author != NULL)
|
if (file->program.author != nullptr)
|
||||||
free (file->program.author);
|
free (file->program.author);
|
||||||
if (file->program.name != NULL)
|
if (file->program.name != nullptr)
|
||||||
free (file->program.name);
|
free (file->program.name);
|
||||||
if (file->program.url != NULL)
|
if (file->program.url != nullptr)
|
||||||
free (file->program.url);
|
free (file->program.url);
|
||||||
if (file->program.version != NULL)
|
if (file->program.version != nullptr)
|
||||||
free (file->program.version);
|
free (file->program.version);
|
||||||
if (file->search.name != NULL)
|
if (file->search.name != nullptr)
|
||||||
free (file->search.name);
|
free (file->search.name);
|
||||||
|
|
||||||
memset (file, 0, sizeof (tagFile));
|
memset (file, 0, sizeof (tagFile));
|
||||||
@@ -494,13 +494,13 @@ static void terminate (tagFile *const file)
|
|||||||
static tagResult readNext (tagFile *const file, tagEntry *const entry)
|
static tagResult readNext (tagFile *const file, tagEntry *const entry)
|
||||||
{
|
{
|
||||||
tagResult result;
|
tagResult result;
|
||||||
if (file == NULL || ! file->initialized)
|
if (file == nullptr || ! file->initialized)
|
||||||
result = TagFailure;
|
result = TagFailure;
|
||||||
else if (! readTagLine (file))
|
else if (! readTagLine (file))
|
||||||
result = TagFailure;
|
result = TagFailure;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (entry != NULL)
|
if (entry != nullptr)
|
||||||
parseTagLine (file, entry);
|
parseTagLine (file, entry);
|
||||||
result = TagSuccess;
|
result = TagSuccess;
|
||||||
}
|
}
|
||||||
@@ -510,13 +510,13 @@ static tagResult readNext (tagFile *const file, tagEntry *const entry)
|
|||||||
static const char *readFieldValue (
|
static const char *readFieldValue (
|
||||||
const tagEntry *const entry, const char *const key)
|
const tagEntry *const entry, const char *const key)
|
||||||
{
|
{
|
||||||
const char *result = NULL;
|
const char *result = nullptr;
|
||||||
int i;
|
int i;
|
||||||
if (strcmp (key, "kind") == 0)
|
if (strcmp (key, "kind") == 0)
|
||||||
result = entry->kind;
|
result = entry->kind;
|
||||||
else if (strcmp (key, "file") == 0)
|
else if (strcmp (key, "file") == 0)
|
||||||
result = EmptyString;
|
result = EmptyString;
|
||||||
else for (i = 0 ; i < entry->fields.count && result == NULL ; ++i)
|
else for (i = 0 ; i < entry->fields.count && result == nullptr ; ++i)
|
||||||
if (strcmp (entry->fields.list [i].key, key) == 0)
|
if (strcmp (entry->fields.list [i].key, key) == 0)
|
||||||
result = entry->fields.list [i].value;
|
result = entry->fields.list [i].value;
|
||||||
return result;
|
return result;
|
||||||
@@ -650,7 +650,7 @@ static tagResult find (tagFile *const file, tagEntry *const entry,
|
|||||||
const char *const name, const int options)
|
const char *const name, const int options)
|
||||||
{
|
{
|
||||||
tagResult result;
|
tagResult result;
|
||||||
if (file->search.name != NULL)
|
if (file->search.name != nullptr)
|
||||||
free (file->search.name);
|
free (file->search.name);
|
||||||
file->search.name = duplicate (name);
|
file->search.name = duplicate (name);
|
||||||
file->search.nameLength = strlen (name);
|
file->search.nameLength = strlen (name);
|
||||||
@@ -680,7 +680,7 @@ static tagResult find (tagFile *const file, tagEntry *const entry,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
file->search.pos = file->pos;
|
file->search.pos = file->pos;
|
||||||
if (entry != NULL)
|
if (entry != nullptr)
|
||||||
parseTagLine (file, entry);
|
parseTagLine (file, entry);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -699,7 +699,7 @@ static tagResult findNext (tagFile *const file, tagEntry *const entry)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = findSequential (file);
|
result = findSequential (file);
|
||||||
if (result == TagSuccess && entry != NULL)
|
if (result == TagSuccess && entry != nullptr)
|
||||||
parseTagLine (file, entry);
|
parseTagLine (file, entry);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -717,7 +717,7 @@ extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info)
|
|||||||
extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
|
extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
|
||||||
{
|
{
|
||||||
tagResult result = TagFailure;
|
tagResult result = TagFailure;
|
||||||
if (file != NULL && file->initialized)
|
if (file != nullptr && file->initialized)
|
||||||
{
|
{
|
||||||
file->sortMethod = type;
|
file->sortMethod = type;
|
||||||
result = TagSuccess;
|
result = TagSuccess;
|
||||||
@@ -728,7 +728,7 @@ extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
|
|||||||
extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
|
extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
|
||||||
{
|
{
|
||||||
tagResult result = TagFailure;
|
tagResult result = TagFailure;
|
||||||
if (file != NULL && file->initialized)
|
if (file != nullptr && file->initialized)
|
||||||
{
|
{
|
||||||
gotoFirstLogicalTag (file);
|
gotoFirstLogicalTag (file);
|
||||||
result = readNext (file, entry);
|
result = readNext (file, entry);
|
||||||
@@ -739,15 +739,15 @@ extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
|
|||||||
extern tagResult tagsNext (tagFile *const file, tagEntry *const entry)
|
extern tagResult tagsNext (tagFile *const file, tagEntry *const entry)
|
||||||
{
|
{
|
||||||
tagResult result = TagFailure;
|
tagResult result = TagFailure;
|
||||||
if (file != NULL && file->initialized)
|
if (file != nullptr && file->initialized)
|
||||||
result = readNext (file, entry);
|
result = readNext (file, entry);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const char *tagsField (const tagEntry *const entry, const char *const key)
|
extern const char *tagsField (const tagEntry *const entry, const char *const key)
|
||||||
{
|
{
|
||||||
const char *result = NULL;
|
const char *result = nullptr;
|
||||||
if (entry != NULL)
|
if (entry != nullptr)
|
||||||
result = readFieldValue (entry, key);
|
result = readFieldValue (entry, key);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -756,7 +756,7 @@ extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
|
|||||||
const char *const name, const int options)
|
const char *const name, const int options)
|
||||||
{
|
{
|
||||||
tagResult result = TagFailure;
|
tagResult result = TagFailure;
|
||||||
if (file != NULL && file->initialized)
|
if (file != nullptr && file->initialized)
|
||||||
result = find (file, entry, name, options);
|
result = find (file, entry, name, options);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -764,7 +764,7 @@ extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
|
|||||||
extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
|
extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
|
||||||
{
|
{
|
||||||
tagResult result = TagFailure;
|
tagResult result = TagFailure;
|
||||||
if (file != NULL && file->initialized)
|
if (file != nullptr && file->initialized)
|
||||||
result = findNext (file, entry);
|
result = findNext (file, entry);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -772,7 +772,7 @@ extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
|
|||||||
extern tagResult tagsClose (tagFile *const file)
|
extern tagResult tagsClose (tagFile *const file)
|
||||||
{
|
{
|
||||||
tagResult result = TagFailure;
|
tagResult result = TagFailure;
|
||||||
if (file != NULL && file->initialized)
|
if (file != nullptr && file->initialized)
|
||||||
{
|
{
|
||||||
terminate (file);
|
terminate (file);
|
||||||
result = TagSuccess;
|
result = TagSuccess;
|
||||||
@@ -804,7 +804,7 @@ static void printTag (const tagEntry *entry)
|
|||||||
entry->name, entry->file, entry->address.pattern);
|
entry->name, entry->file, entry->address.pattern);
|
||||||
if (extensionFields)
|
if (extensionFields)
|
||||||
{
|
{
|
||||||
if (entry->kind != NULL && entry->kind [0] != '\0')
|
if (entry->kind != nullptr && entry->kind [0] != '\0')
|
||||||
printf ("%s\tkind:%s", sep, entry->kind);
|
printf ("%s\tkind:%s", sep, entry->kind);
|
||||||
if (entry->fileScope)
|
if (entry->fileScope)
|
||||||
printf ("%s\tfile:", sep);
|
printf ("%s\tfile:", sep);
|
||||||
@@ -825,7 +825,7 @@ static void findTag (const char *const name, const int options)
|
|||||||
tagFileInfo info;
|
tagFileInfo info;
|
||||||
tagEntry entry;
|
tagEntry entry;
|
||||||
tagFile *const file = tagsOpen (TagFileName, &info);
|
tagFile *const file = tagsOpen (TagFileName, &info);
|
||||||
if (file == NULL)
|
if (file == nullptr)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
|
fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
|
||||||
ProgramName, strerror (info.status.error_number), name);
|
ProgramName, strerror (info.status.error_number), name);
|
||||||
@@ -846,12 +846,12 @@ static void findTag (const char *const name, const int options)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void listTags (void)
|
static void listTags ()
|
||||||
{
|
{
|
||||||
tagFileInfo info;
|
tagFileInfo info;
|
||||||
tagEntry entry;
|
tagEntry entry;
|
||||||
tagFile *const file = tagsOpen (TagFileName, &info);
|
tagFile *const file = tagsOpen (TagFileName, &info);
|
||||||
if (file == NULL)
|
if (file == nullptr)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
|
fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
|
||||||
ProgramName, strerror (info.status.error_number), TagFileName);
|
ProgramName, strerror (info.status.error_number), TagFileName);
|
||||||
@@ -927,7 +927,7 @@ extern int main (int argc, char **argv)
|
|||||||
++j;
|
++j;
|
||||||
if (arg [j] == '\0')
|
if (arg [j] == '\0')
|
||||||
SortMethod = TAG_SORTED;
|
SortMethod = TAG_SORTED;
|
||||||
else if (strchr ("012", arg[j]) != NULL)
|
else if (strchr ("012", arg[j]) != nullptr)
|
||||||
SortMethod = (sortType) (arg[j] - '0');
|
SortMethod = (sortType) (arg[j] - '0');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -114,7 +114,7 @@ typedef struct {
|
|||||||
/* address for locating tag in source file */
|
/* address for locating tag in source file */
|
||||||
struct {
|
struct {
|
||||||
/* pattern for locating source line
|
/* pattern for locating source line
|
||||||
* (may be NULL if not present) */
|
* (may be nullptr if not present) */
|
||||||
const char *pattern;
|
const char *pattern;
|
||||||
|
|
||||||
/* line number in source file of tag definition
|
/* line number in source file of tag definition
|
||||||
@@ -122,7 +122,7 @@ typedef struct {
|
|||||||
unsigned long lineNumber;
|
unsigned long lineNumber;
|
||||||
} address;
|
} address;
|
||||||
|
|
||||||
/* kind of tag (may by name, character, or NULL if not known) */
|
/* kind of tag (may by name, character, or nullptr if not known) */
|
||||||
const char *kind;
|
const char *kind;
|
||||||
|
|
||||||
/* is tag of file-limited scope? */
|
/* is tag of file-limited scope? */
|
||||||
|
@@ -8,4 +8,8 @@
|
|||||||
|
|
||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
|
|
||||||
const char * applLog = "edn ";
|
int32_t appl::getLogId() {
|
||||||
|
static int32_t g_val = etk::log::registerInstance("edn");
|
||||||
|
return g_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -9,19 +9,43 @@
|
|||||||
#ifndef __APPL_DEBUG_H__
|
#ifndef __APPL_DEBUG_H__
|
||||||
#define __APPL_DEBUG_H__
|
#define __APPL_DEBUG_H__
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/log.h>
|
||||||
#include <etk/debugGeneric.h>
|
|
||||||
|
|
||||||
extern const char * applLog;
|
namespace appl {
|
||||||
|
int32_t getLogId();
|
||||||
|
};
|
||||||
|
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||||
|
#define APPL_BASE(info,data) \
|
||||||
|
do { \
|
||||||
|
if (info <= etk::log::getLevel(appl::getLogId())) { \
|
||||||
|
std::stringbuf sb; \
|
||||||
|
std::ostream tmpStream(&sb); \
|
||||||
|
tmpStream << data; \
|
||||||
|
etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define APPL_CRITICAL(data) ETK_CRITICAL(applLog, data)
|
#define APPL_CRITICAL(data) APPL_BASE(1, data)
|
||||||
#define APPL_WARNING(data) ETK_WARNING(applLog, data)
|
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||||
#define APPL_ERROR(data) ETK_ERROR(applLog, data)
|
#define APPL_WARNING(data) APPL_BASE(3, data)
|
||||||
#define APPL_INFO(data) ETK_INFO(applLog, data)
|
#ifdef DEBUG
|
||||||
#define APPL_DEBUG(data) ETK_DEBUG(applLog, data)
|
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||||
#define APPL_VERBOSE(data) ETK_VERBOSE(applLog, data)
|
#define APPL_DEBUG(data) APPL_BASE(5, data)
|
||||||
#define APPL_ASSERT(cond, data) ETK_ASSERT(applLog, cond, data)
|
#define APPL_VERBOSE(data) APPL_BASE(6, data)
|
||||||
#define APPL_CHECK_INOUT(cond) ETK_CHECK_INOUT(applLog, cond)
|
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
|
||||||
#define APPL_TODO(cond) ETK_TODO(applLog, cond)
|
#else
|
||||||
|
#define APPL_INFO(data) do { } while(false)
|
||||||
|
#define APPL_DEBUG(data) do { } while(false)
|
||||||
|
#define APPL_VERBOSE(data) do { } while(false)
|
||||||
|
#define APPL_TODO(data) do { } while(false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define APPL_ASSERT(cond,data) \
|
||||||
|
do { \
|
||||||
|
if (!(cond)) { \
|
||||||
|
APPL_CRITICAL(data); \
|
||||||
|
assert(!#cond); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -18,45 +18,36 @@
|
|||||||
|
|
||||||
class myParamGlobal : public ewol::Object {
|
class myParamGlobal : public ewol::Object {
|
||||||
public:
|
public:
|
||||||
static const char * const configEOL;
|
ewol::object::Param<bool> m_displayEOL;
|
||||||
static const char * const configAutoIndent;
|
ewol::object::Param<bool> m_AutoIndent;
|
||||||
static const char * const configShowTabChar;
|
ewol::object::Param<bool> m_displayTabChar;
|
||||||
static const char * const configShowSpaceChar;
|
ewol::object::Param<bool> m_displaySpaceChar;
|
||||||
public:
|
|
||||||
bool m_displayEOL;
|
|
||||||
bool m_AutoIndent;
|
|
||||||
bool m_displayTabChar;
|
|
||||||
bool m_displaySpaceChar;
|
|
||||||
public :
|
public :
|
||||||
myParamGlobal(void) {
|
myParamGlobal() :
|
||||||
|
m_displayEOL(*this, "eol", false, "Display end of line character"),
|
||||||
|
m_AutoIndent(*this, "auto-indent", true, "Auto indent when create new line"),
|
||||||
|
m_displayTabChar(*this, "display-tab", true, "Display the Tab char"),
|
||||||
|
m_displaySpaceChar(*this, "display-space", true, "Display the space char") {
|
||||||
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
|
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
|
||||||
setName("edn_global_param");
|
setName("edn_global_param");
|
||||||
m_displayEOL=false;
|
|
||||||
m_AutoIndent = true;
|
|
||||||
m_displayTabChar = true;
|
|
||||||
m_displaySpaceChar = true;
|
|
||||||
registerConfig(configEOL, "bool", NULL, "Display end of line character");
|
|
||||||
registerConfig(configAutoIndent, "bool", NULL, "Auto indent when create new line");
|
|
||||||
registerConfig(configShowTabChar, "bool", NULL, "Display the Tab char");
|
|
||||||
registerConfig(configShowSpaceChar, "bool", NULL, "Display the space char");
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
bool onSetConfig(const ewol::object::Config& _conf) {
|
bool onSetConfig(const ewol::object::Config& _conf) {
|
||||||
// Not set the EObject node parameter (name == > not change ...)
|
// Not set the EObject node parameter (name == > not change ...)
|
||||||
if (_conf.getConfig() == configEOL) {
|
if (_conf.getConfig() == configEOL) {
|
||||||
m_displayEOL = std::stob(_conf.getData());
|
m_displayEOL = etk::string_to_bool(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_conf.getConfig() == configAutoIndent) {
|
if (_conf.getConfig() == configAutoIndent) {
|
||||||
m_AutoIndent = std::stob(_conf.getData());
|
m_AutoIndent = etk::string_to_bool(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_conf.getConfig() == configShowTabChar) {
|
if (_conf.getConfig() == configShowTabChar) {
|
||||||
m_displayTabChar = std::stob(_conf.getData());
|
m_displayTabChar = etk::string_to_bool(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_conf.getConfig() == configShowSpaceChar) {
|
if (_conf.getConfig() == configShowSpaceChar) {
|
||||||
m_displaySpaceChar = std::stob(_conf.getData());
|
m_displaySpaceChar = etk::string_to_bool(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -97,29 +88,26 @@ class myParamGlobal : public ewol::Object {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * const myParamGlobal::configEOL = "eol";
|
|
||||||
const char * const myParamGlobal::configAutoIndent = "auto-indent";
|
|
||||||
const char * const myParamGlobal::configShowTabChar = "display-tab";
|
|
||||||
const char * const myParamGlobal::configShowSpaceChar = "display-space";
|
|
||||||
|
|
||||||
static myParamGlobal& l_obj(void) {
|
static myParamGlobal& l_obj() {
|
||||||
static myParamGlobal s_obj;
|
static myParamGlobal s_obj;
|
||||||
return s_obj;
|
return s_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::init(void) {
|
void globals::init() {
|
||||||
//ewol::userConfig::addUserConfig(&l_obj());
|
//ewol::userConfig::addUserConfig(&l_obj());
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::UnInit(void) {
|
void globals::UnInit() {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
//ewol::userConfig::RmUserConfig(&l_obj());
|
//ewol::userConfig::RmUserConfig(&l_obj());
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetDisplayEndOfLine(void) {
|
bool globals::isSetDisplayEndOfLine() {
|
||||||
return l_obj().m_displayEOL;
|
return l_obj().m_displayEOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +117,7 @@ void globals::setDisplayEndOfLine(bool newVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetDisplaySpaceChar(void) {
|
bool globals::isSetDisplaySpaceChar() {
|
||||||
return l_obj().m_displaySpaceChar;
|
return l_obj().m_displaySpaceChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +126,7 @@ void globals::setDisplaySpaceChar(bool _newVal) {
|
|||||||
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetDisplayTabChar(void) {
|
bool globals::isSetDisplayTabChar() {
|
||||||
return l_obj().m_displayTabChar;
|
return l_obj().m_displayTabChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +136,7 @@ void globals::setDisplayTabChar(bool _newVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetAutoIndent(void) {
|
bool globals::isSetAutoIndent() {
|
||||||
return l_obj().m_AutoIndent;
|
return l_obj().m_AutoIndent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,16 +145,16 @@ void globals::setAutoIndent(bool _newVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::OrderTheBufferList(void) {
|
bool globals::OrderTheBufferList() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
int32_t globals::getNbColoneBorder(void) {
|
int32_t globals::getNbColoneBorder() {
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t globals::getNbLineBorder(void) {
|
int32_t globals::getNbLineBorder() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,66 +167,70 @@ static const char * const l_changeTabulation = "edn-event-change-tabulation";
|
|||||||
static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
|
static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
|
||||||
static const char * const l_changeRounded = "edn-event-change-rounded";
|
static const char * const l_changeRounded = "edn-event-change-rounded";
|
||||||
|
|
||||||
globals::ParameterGlobalsGui::ParameterGlobalsGui(void) :
|
globals::ParameterGlobalsGui::ParameterGlobalsGui() {
|
||||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
|
addObjectType("globals::ParameterGlobalsGui");
|
||||||
ewol::widget::CheckBox* myCheckbox = NULL;
|
}
|
||||||
ewol::widget::Spacer* mySpacer = NULL;
|
|
||||||
|
void globals::ParameterGlobalsGui::init() {
|
||||||
|
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
|
||||||
|
std::shared_ptr<ewol::widget::CheckBox> myCheckbox;
|
||||||
|
std::shared_ptr<ewol::widget::Spacer> mySpacer;
|
||||||
|
|
||||||
mySpacer = new ewol::widget::Spacer();
|
mySpacer = ewol::widget::Spacer::create();
|
||||||
if (NULL == mySpacer) {
|
if (nullptr == mySpacer) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
mySpacer->setExpand(bvec2(true,true));
|
mySpacer->setExpand(bvec2(true,true));
|
||||||
subWidgetAdd(mySpacer);
|
subWidgetAdd(mySpacer);
|
||||||
}
|
}
|
||||||
myCheckbox = new ewol::widget::CheckBox("Automatic Indentation");
|
myCheckbox = ewol::widget::CheckBox::create("Automatic Indentation");
|
||||||
if (NULL == myCheckbox) {
|
if (nullptr == myCheckbox) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myCheckbox->setExpand(bvec2(true,false));
|
myCheckbox->setExpand(bvec2(true,false));
|
||||||
myCheckbox->setValue(isSetAutoIndent());
|
myCheckbox->setValue(isSetAutoIndent());
|
||||||
myCheckbox->registerOnEvent(this, "clicked", l_changeIndentation);
|
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeIndentation);
|
||||||
subWidgetAdd(myCheckbox);
|
subWidgetAdd(myCheckbox);
|
||||||
}
|
}
|
||||||
myCheckbox = new ewol::widget::CheckBox("Display space char (' ')");
|
myCheckbox = ewol::widget::CheckBox::create("Display space char (' ')");
|
||||||
if (NULL == myCheckbox) {
|
if (nullptr == myCheckbox) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myCheckbox->setExpand(bvec2(true,false));
|
myCheckbox->setExpand(bvec2(true,false));
|
||||||
myCheckbox->setValue(isSetDisplaySpaceChar());
|
myCheckbox->setValue(isSetDisplaySpaceChar());
|
||||||
myCheckbox->registerOnEvent(this, "clicked", l_changeSpace);
|
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeSpace);
|
||||||
subWidgetAdd(myCheckbox);
|
subWidgetAdd(myCheckbox);
|
||||||
}
|
}
|
||||||
myCheckbox = new ewol::widget::CheckBox("Display tabulation char ('\\t')");
|
myCheckbox = ewol::widget::CheckBox::create("Display tabulation char ('\\t')");
|
||||||
if (NULL == myCheckbox) {
|
if (nullptr == myCheckbox) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myCheckbox->setExpand(bvec2(true,false));
|
myCheckbox->setExpand(bvec2(true,false));
|
||||||
myCheckbox->setValue(isSetDisplayTabChar());
|
myCheckbox->setValue(isSetDisplayTabChar());
|
||||||
myCheckbox->registerOnEvent(this, "clicked", l_changeTabulation);
|
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeTabulation);
|
||||||
subWidgetAdd(myCheckbox);
|
subWidgetAdd(myCheckbox);
|
||||||
}
|
}
|
||||||
myCheckbox = new ewol::widget::CheckBox("Display end of line ('\\n')");
|
myCheckbox = ewol::widget::CheckBox::create("Display end of line ('\\n')");
|
||||||
if (NULL == myCheckbox) {
|
if (nullptr == myCheckbox) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myCheckbox->setExpand(bvec2(true,false));
|
myCheckbox->setExpand(bvec2(true,false));
|
||||||
myCheckbox->setValue(isSetDisplayEndOfLine());
|
myCheckbox->setValue(isSetDisplayEndOfLine());
|
||||||
myCheckbox->registerOnEvent(this, "clicked", l_changeEndOfLine);
|
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeEndOfLine);
|
||||||
subWidgetAdd(myCheckbox);
|
subWidgetAdd(myCheckbox);
|
||||||
}
|
}
|
||||||
myCheckbox = new ewol::widget::CheckBox("switch Rounded/default");
|
myCheckbox = ewol::widget::CheckBox::create("switch Rounded/default");
|
||||||
if (NULL == myCheckbox) {
|
if (nullptr == myCheckbox) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
myCheckbox->setExpand(bvec2(true,false));
|
myCheckbox->setExpand(bvec2(true,false));
|
||||||
myCheckbox->setValue(isSetDisplayEndOfLine());
|
myCheckbox->setValue(isSetDisplayEndOfLine());
|
||||||
myCheckbox->registerOnEvent(this, "clicked", l_changeRounded);
|
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeRounded);
|
||||||
subWidgetAdd(myCheckbox);
|
subWidgetAdd(myCheckbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
globals::ParameterGlobalsGui::~ParameterGlobalsGui(void) {
|
globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,31 +15,34 @@
|
|||||||
|
|
||||||
namespace globals
|
namespace globals
|
||||||
{
|
{
|
||||||
void init(void);
|
void init();
|
||||||
void UnInit(void);
|
void UnInit();
|
||||||
int32_t getNbColoneBorder(void);
|
int32_t getNbColoneBorder();
|
||||||
int32_t getNbLineBorder(void);
|
int32_t getNbLineBorder();
|
||||||
|
|
||||||
bool isSetDisplayEndOfLine(void);
|
bool isSetDisplayEndOfLine();
|
||||||
void setDisplayEndOfLine(bool _newVal);
|
void setDisplayEndOfLine(bool _newVal);
|
||||||
|
|
||||||
bool isSetDisplaySpaceChar(void);
|
bool isSetDisplaySpaceChar();
|
||||||
void setDisplaySpaceChar(bool _newVal);
|
void setDisplaySpaceChar(bool _newVal);
|
||||||
|
|
||||||
bool isSetDisplayTabChar(void);
|
bool isSetDisplayTabChar();
|
||||||
void setDisplayTabChar(bool _newVal);
|
void setDisplayTabChar(bool _newVal);
|
||||||
|
|
||||||
bool isSetAutoIndent(void);
|
bool isSetAutoIndent();
|
||||||
void setAutoIndent(bool _newVal);
|
void setAutoIndent(bool _newVal);
|
||||||
|
|
||||||
void init2(void);
|
void init2();
|
||||||
|
|
||||||
bool OrderTheBufferList(void);
|
bool OrderTheBufferList();
|
||||||
|
|
||||||
class ParameterGlobalsGui : public ewol::widget::Sizer {
|
class ParameterGlobalsGui : public ewol::widget::Sizer {
|
||||||
public :
|
protected:
|
||||||
ParameterGlobalsGui(void);
|
ParameterGlobalsGui();
|
||||||
~ParameterGlobalsGui(void);
|
void init();
|
||||||
|
public:
|
||||||
|
DECLARE_FACTORY(ParameterGlobalsGui);
|
||||||
|
virtual ~ParameterGlobalsGui();
|
||||||
// herited function
|
// herited function
|
||||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||||
};
|
};
|
||||||
|
@@ -28,117 +28,108 @@
|
|||||||
#include <appl/ctags/readtags.h>
|
#include <appl/ctags/readtags.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
|
|
||||||
|
|
||||||
|
class MainApplication : public ewol::context::Application {
|
||||||
|
private:
|
||||||
|
std::shared_ptr<appl::BufferManager> m_bufferManager;
|
||||||
|
public:
|
||||||
|
bool init(ewol::Context& _context, size_t _initId) {
|
||||||
|
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||||
|
|
||||||
|
etk::theme::setName("COLOR", "color/black/");
|
||||||
|
|
||||||
|
// TODO : remove this : Move if in the windows properties
|
||||||
|
_context.setSize(vec2(800, 600));
|
||||||
|
|
||||||
|
// select internal data for font ...
|
||||||
|
_context.getFontDefault().setUseExternal(true);
|
||||||
|
#ifdef __TARGET_OS__Android
|
||||||
|
_context.getFontDefault().set("FreeSerif", 19);
|
||||||
|
#else
|
||||||
|
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// set the application icon ...
|
||||||
|
_context.setIcon("DATA:icon.png");
|
||||||
|
|
||||||
|
// init internal global value
|
||||||
|
globals::init();
|
||||||
|
|
||||||
|
// init ALL Singleton :
|
||||||
|
//()CTagsManager::getInstance();
|
||||||
|
m_bufferManager = appl::BufferManager::create();
|
||||||
|
|
||||||
|
appl::highlightManager::init();
|
||||||
|
appl::textPluginManager::init();
|
||||||
|
appl::textPluginManager::addDefaultPlugin();
|
||||||
|
|
||||||
|
// Request load of the user configuration ...
|
||||||
|
//ewol::userConfig::load();
|
||||||
|
|
||||||
|
char cCurrentPath[FILENAME_MAX];
|
||||||
|
// get the curent program folder
|
||||||
|
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||||
|
//APPL_INFO("The current working directory is " << cCurrentPath);
|
||||||
|
|
||||||
|
std::shared_ptr<MainWindows> basicWindows = MainWindows::create();
|
||||||
|
|
||||||
|
if (basicWindows == nullptr) {
|
||||||
|
APPL_ERROR("Can not allocate the basic windows");
|
||||||
|
_context.stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// create the specific windows
|
||||||
|
_context.setWindows(basicWindows);
|
||||||
|
|
||||||
|
|
||||||
|
// add files
|
||||||
|
APPL_INFO("show list of files : ");
|
||||||
|
bool ctagDetected = false;
|
||||||
|
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
||||||
|
std::string tmpppp = _context.getCmd().get(iii);
|
||||||
|
if (tmpppp == "-t") {
|
||||||
|
ctagDetected = true;
|
||||||
|
} else if (true == ctagDetected) {
|
||||||
|
etk::FSNode file(tmpppp);
|
||||||
|
std::string name = file.getName();
|
||||||
|
APPL_INFO("Load ctag file : \"" << name << "\"" );
|
||||||
|
ctagDetected = false;
|
||||||
|
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
|
||||||
|
} else {
|
||||||
|
etk::FSNode file(tmpppp);
|
||||||
|
std::string name = file.getName();
|
||||||
|
APPL_INFO("need load file : \"" << name << "\"" );
|
||||||
|
m_bufferManager->open(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
APPL_INFO(" == > init " PROJECT_NAME " (END)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void unInit(ewol::Context& _context) {
|
||||||
|
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
|
||||||
|
appl::textPluginManager::unInit();
|
||||||
|
APPL_INFO("Stop Hightlight");
|
||||||
|
appl::highlightManager::unInit();
|
||||||
|
//Kill all singleton
|
||||||
|
m_bufferManager.reset();
|
||||||
|
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||||
* @param std IO
|
* @param std IO
|
||||||
* @return std IO
|
* @return std IO
|
||||||
*/
|
*/
|
||||||
int main(int _argc, const char *_argv[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// only one things to do:
|
// second possibility
|
||||||
return ewol::run(_argc, _argv);
|
return ewol::run(new MainApplication(), _argc, _argv);
|
||||||
}
|
|
||||||
appl::BufferManager* bufferManager = NULL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief main application function initialisation
|
|
||||||
*/
|
|
||||||
bool APP_Init(ewol::Context& _context) {
|
|
||||||
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
|
||||||
|
|
||||||
etk::theme::setName("COLOR", "color/black/");
|
|
||||||
|
|
||||||
// TODO : remove this : Move if in the windows properties
|
|
||||||
_context.setSize(vec2(800, 600));
|
|
||||||
|
|
||||||
// select internal data for font ...
|
|
||||||
_context.getFontDefault().setUseExternal(true);
|
|
||||||
#ifdef __TARGET_OS__Android
|
|
||||||
_context.getFontDefault().set("FreeSerif", 19);
|
|
||||||
#else
|
|
||||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// set the application icon ...
|
|
||||||
_context.setIcon("DATA:icon.png");
|
|
||||||
|
|
||||||
// init internal global value
|
|
||||||
globals::init();
|
|
||||||
|
|
||||||
// init ALL Singleton :
|
|
||||||
//(void)CTagsManager::getInstance();
|
|
||||||
bufferManager = appl::BufferManager::keep();
|
|
||||||
|
|
||||||
appl::highlightManager::init();
|
|
||||||
appl::textPluginManager::init();
|
|
||||||
appl::textPluginManager::addDefaultPlugin();
|
|
||||||
|
|
||||||
// Request load of the user configuration ...
|
|
||||||
//ewol::userConfig::load();
|
|
||||||
|
|
||||||
char cCurrentPath[FILENAME_MAX];
|
|
||||||
// get the curent program folder
|
|
||||||
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
|
||||||
//APPL_INFO("The current working directory is " << cCurrentPath);
|
|
||||||
|
|
||||||
MainWindows* basicWindows = new MainWindows();
|
|
||||||
|
|
||||||
if (NULL == basicWindows) {
|
|
||||||
APPL_ERROR("Can not allocate the basic windows");
|
|
||||||
_context.stop();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// create the specific windows
|
|
||||||
_context.setWindows(basicWindows);
|
|
||||||
|
|
||||||
|
|
||||||
// add files
|
|
||||||
APPL_INFO("show list of files : ");
|
|
||||||
bool ctagDetected = false;
|
|
||||||
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
|
||||||
std::string tmpppp = _context.getCmd().get(iii);
|
|
||||||
if (tmpppp == "-t") {
|
|
||||||
ctagDetected = true;
|
|
||||||
} else if (true == ctagDetected) {
|
|
||||||
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
|
|
||||||
ctagDetected = false;
|
|
||||||
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, tmpppp);
|
|
||||||
} else {
|
|
||||||
APPL_INFO("need load file : \"" << tmpppp << "\"" );
|
|
||||||
bufferManager->open(tmpppp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
APPL_INFO(" == > init " PROJECT_NAME " (END)");
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief main application function Un-Initialisation
|
|
||||||
*/
|
|
||||||
void APP_UnInit(ewol::Context& _context) {
|
|
||||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
|
|
||||||
ewol::widget::Windows* tmpWindows = _context.getWindows();
|
|
||||||
|
|
||||||
_context.setWindows(NULL);
|
|
||||||
|
|
||||||
if (NULL != tmpWindows) {
|
|
||||||
delete(tmpWindows);
|
|
||||||
tmpWindows = NULL;
|
|
||||||
}
|
|
||||||
appl::textPluginManager::unInit();
|
|
||||||
|
|
||||||
APPL_INFO("Stop Hightlight");
|
|
||||||
appl::highlightManager::unInit();
|
|
||||||
//Kill all singleton
|
|
||||||
if (bufferManager != NULL) {
|
|
||||||
APPL_INFO("Stop BufferManager");
|
|
||||||
appl::BufferManager::release(bufferManager);
|
|
||||||
bufferManager = NULL;
|
|
||||||
}
|
|
||||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ def create(target):
|
|||||||
# module name is 'edn' and type binary.
|
# module name is 'edn' and type binary.
|
||||||
myModule = module.Module(__file__, 'edn', 'PACKAGE')
|
myModule = module.Module(__file__, 'edn', 'PACKAGE')
|
||||||
|
|
||||||
|
myModule.add_extra_compile_flags()
|
||||||
# add the file to compile:
|
# add the file to compile:
|
||||||
myModule.add_src_file([
|
myModule.add_src_file([
|
||||||
'appl/ctags/readtags.cpp'])
|
'appl/ctags/readtags.cpp'])
|
||||||
@@ -74,6 +75,7 @@ def create(target):
|
|||||||
myModule.copy_folder('../data/languages/bash/*.xml','languages/bash/')
|
myModule.copy_folder('../data/languages/bash/*.xml','languages/bash/')
|
||||||
myModule.copy_folder('../data/languages/boo/*.xml','languages/boo/')
|
myModule.copy_folder('../data/languages/boo/*.xml','languages/boo/')
|
||||||
myModule.copy_folder('../data/languages/c/*.xml','languages/c/')
|
myModule.copy_folder('../data/languages/c/*.xml','languages/c/')
|
||||||
|
myModule.copy_folder('../data/languages/cmake/*.xml','languages/cmake/')
|
||||||
myModule.copy_folder('../data/languages/glsl/*.xml','languages/glsl/')
|
myModule.copy_folder('../data/languages/glsl/*.xml','languages/glsl/')
|
||||||
myModule.copy_folder('../data/languages/in/*.xml','languages/in/')
|
myModule.copy_folder('../data/languages/in/*.xml','languages/in/')
|
||||||
myModule.copy_folder('../data/languages/java/*.xml','languages/java/')
|
myModule.copy_folder('../data/languages/java/*.xml','languages/java/')
|
||||||
|
@@ -1 +1 @@
|
|||||||
1.1.1
|
1.2.1
|
Reference in New Issue
Block a user