4 Commits

Author SHA1 Message Date
fbf774174f Merge branch 'dev' 2014-10-17 09:10:19 +02:00
8c3c3daf5c Merge branch 'dev'
Conflicts:
	sources/tag
2014-08-18 22:57:06 +02:00
440f4c7093 Update version tag: 1.2.0 2014-06-03 22:27:31 +02:00
a01d121036 Update version tag: 1.1.2 2014-06-03 22:22:20 +02:00
101 changed files with 2062 additions and 2785 deletions

View File

@@ -1,70 +1,39 @@
language:
- cpp
sudo: false
# language type:
language: cpp
# compilator system:
compiler:
- clang
- gcc
os:
- linux
- osx
- clang
- gcc
# build branch requested
branches:
only:
- master
- dev
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
# previous actions:
before_script:
- git clone https://github.com/HeeroYui/ewol.git
- cd ewol; git checkout origin/dev -b dev; cd ..
- cd ewol; git submodule init; cd ..
- cd ewol; git submodule update; cd ..
install:
- echo "BUILDER = $BUILDER"
- echo "BOARD = $BOARD"
- echo "CONF = $CONF"
- pip install --user lutin
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; fi
- if [ "$CXX" == "g++" ]; then sudo apt-get update -qq; fi
- if [ "$CXX" == "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" == "g++" ]; then sudo rm /usr/bin/gcc /usr/bin/g++; fi
- if [ "$CXX" == "g++" ]; then sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc; fi
- if [ "$CXX" == "g++" ]; then sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++; fi
env:
matrix:
- CONF=debug BOARD=Linux
#- CONF=debug BOARD=Windows
#- CONF=debug BOARD=Android
- CONF=release BOARD=Linux
#- CONF=release BOARD=Windows
#- CONF=release BOARD=Android
exclude:
- compiler: clang
env: BOARD=Windows
- compiler: clang
env: BOARD=Android
before_script:
- cd ..
- mkdir bin
- curl https://storage.googleapis.com/git-repo-downloads/repo > bin/repo
- chmod a+x bin/repo
- git config --global user.email "travis@travis.com"
- git config --global user.name "Travis"
- git config --global color.ui "auto"
- git config --global core.editor "vi"
- mkdir framework
- cd framework
- ../bin/repo init -u https://github.com/HeeroYui/manifest.git
- ../bin/repo sync -j8
- cd ..
- pwd
- ls -l
- if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi
- if [ "$CXX" == "g++" ]; then COMPILATOR_OPTION="--compilator-version=4.9"; else COMPILATOR_OPTION=""; fi
# build sequence with Lutin :
script:
- lutin -C -P -t $BOARD -c $BUILDER $COMPILATOR_OPTION -m $CONF -p edn
- if [ "$CXX" == "clang++" ]; then ./ewol/build/lutin.py -cclang -mdebug -p edn; fi
- if [ "$CXX" == "g++" ]; then ./ewol/build/lutin.py -cgcc -mdebug -p edn; fi
#send e-mail on compilation result:
notifications:
email:
- yui.heero@gmail.com

View File

@@ -5,69 +5,41 @@ Edn
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
[![Build Status](https://travis-ci.org/HeeroYui/edn.svg?branch=dev)](https://travis-ci.org/HeeroYui/edn)
Instructions
============
need google repo:
-----------------
download the software :
see: http://source.android.com/source/downloading.html#installing-repo
mkdir yourDevFolder
cd yourDevFolder
git clone git://github.com/HeeroYui/ewol.git
cd ewol
git submodule init
git submodule update
cd ..
git clone git://github.com/HeeroYui/edn.git
cd edn
mkdir ~/.bin
PATH=~/.bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+x ~/.bin/repo
download Build system:
----------------------
sudo pip install lutin
sudo pip install pillow
download the Framework:
----------------------
mkdir -p WORKING_DIRECTORY/framework
cd WORKING_DIRECTORY/framework
repo init -u git://github.com/atria-soft/manifest.git
repo sync -j8
cd ../..
download the software:
----------------------
mkdir -p WORKING_DIRECTORY/application
cd WORKING_DIRECTORY/application
git clone https://github.com/HeeroYui/edn.git
cd ../..
Compile software:
-----------------
cd WORKING_DIRECTORY
lutin -C -P edn
(debug) Compile software & Run debug version:
lutin -C -P -m debug edn
# or
lutin -C -P -c clang -m debug edn
# full compile and run:
lutin -C -P -m debug edn?build?run:--elog-level=5
../ewol/build/lutin.py --color --mode=debug
or
../ewol/build/lutin.py --color --compilator=clang --mode=debug
./out/Linux/debug/staging/edn//usr/bin/edn -l6 yourFile.txt
Note : -l6 corespond at the LOG level to display.
(release) Compile software & install:
(release) Compile software & install & run:
# generate binary, tree, package and install it ...
lutin -C -P edn?install
../ewol/build/lutin.py -c edn-install
edn exemple.txt
(Android) Compile software & install
cd yourDevFolder
mkdir andoid
cd android
download here in "sdk" and "ndk" the coresponding SDK and NDK of Android:
@@ -76,14 +48,18 @@ Compile software:
==> you need to download sub package of the NDK (refer to the NDK doccumentation) but only supported android version >4.0
cd ..
# Generate package and install on Android device (in debug mode a generic key is set)
lutin -C -P -t Android -m debug edn?install
../ewol/build/lutin.py --color --target=Android --mode=debug edn-install
# to show the log :
lutin -C -P -t Android edn?log
../ewol/build/lutin.py --target=Android edn-log
(Windows) Compile software
(Windows) Compile software & install
cd yourDevFolder
../ewol/build/lutin.py --color --target=Windows --mode=debug edn
#we have many problem for windows compilation now...
lutin -C -P -t Windows -m debug edn
(MAC) All needed and some useful packages
@@ -92,7 +68,8 @@ Compile software:
- Xcode ==> for all developement packages
- in Xcode : XCode->Setting->Download and install component: "Command Line Tools"
lutin -C -P -m debug edn
cd yourDevFolder
../ewol/build/lutin.py --color --mode=debug edn
(IOs) All needed and some useful packages
@@ -103,14 +80,22 @@ Compile software:
for porting on IOs you need a developper account
cd yourDevFolder
# compile and install on simulator (no developper account needed)
lutin -C -P -t IOs -m debug --simulation edn?install
../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
lutin -C -P -t IOs -m debug edn?install
../ewol/build/lutin.py --color --target=IOs --mode=debug edn-intall
# compile and install on board and debug mode :
lutin -C -P -t IOs -m debug --simulation edn?log
../ewol/build/lutin.py --color --target=IOs --mode=debug edn-log
On linux you can generate 3 board in one time
=============================================
cd yourDevFolder/edn
../ewol/build/lutin.py --color --target=Linux --mode=debug edn --target=Windows --mode=debug edn --target=Android --mode=debug edn
Dependency packages
===================

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<composer expand="true,false" fill="true,false">
<composer>
<sizer mode="hori" expand="true,false" fill="true" lock="true">
<button name="SEARCH:close">
<image src="THEME:GUI:Remove.edf" fill="true" size="7,7mm" distance-field="true"/>
@@ -13,16 +13,60 @@
<image src="THEME:GUI:Replace.edf" fill="true" size="7,7mm" distance-field="true"/>
</button>
<button name="SEARCH:case" toggle="true">
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="_T(Close search bar)" distance-field="true"/>
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="_T(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 name="SEARCH:wrap" toggle="true">
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="_T(Close search bar)" distance-field="true"/>
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="_T(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 name="SEARCH:up-down" toggle="true">
<image src="THEME:GUI:Up.edf" fill="true" size="7,7mm" hover="_T(Close search bar)" distance-field="true"/>
<image src="THEME:GUI:Down.edf" fill="true" size="7,7mm" hover="_T(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"/>
</button>
<!--
<image src="THEME:GUI:Add.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:AtoZ.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Attache.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:CaseSensitive.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Close.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Contact.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Down.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:FavoriteDisable.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:FavoriteEnable.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:FavoriteMiddle.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:File.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Folder.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Forbidden.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Help.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Home.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Info.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:List.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Load.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Lock.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Next.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:OpenMenu.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Parameter.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Undo.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Trash.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Search.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:SDCard.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Save.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Replace.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Remove.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Remove2.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Redo.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Quit.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Previous.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Update.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Up.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Validate.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:VolumeMax.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:VolumeMute.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:Warning.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:WhereAmI.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:WrapAround.svg" fill="true" size="7,7mm"/>
<image src="THEME:GUI:ZoomIn.svg" fill="true" size="7,7mm"/>
-->
</sizer>
</composer>

View File

@@ -1,53 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur">
<ext>.*\.(s|S|asm|ASM)</ext>
<ext>*.s</ext>
<ext>*.S</ext>
<ext>*.asm</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<regex>
<start>/\*(\*|!)</start>
<stop>\*/</stop>
</regex>
<regex>/\*\*.*\*/</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>/\*</start>
<stop>\*/</stop>
</regex>
<regex>/\*.*\*/</regex>
</rule>
<rule name="my if 0">
<color>preprocesseur</color>
<regex>
<start>#[ \t]*if 0</start>
<stop>#(endif|else)</stop>
</regex>
<regex>#[ \t]*if 0.*#(regexif|else)</regex>
</rule>
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#.*?$</regex>
<regex>#.*$</regex>
</rule>
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>//!.*?$</regex>
<regex>//!.*$</regex>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>//[ \t]*TODO[ \t]*:.*?$</regex>
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>//.*?$</regex>
<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>\b(smull|ldrsh|smlal|stmdb|mul|mla|umull|ldr|add|str|mov|subs|bgt|ldmia|stmia|ldmfd|cmp|sub|strd|stmfd|bne|bhi|ldrd|mvn)\b</regex>
<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 name="register list">
<color>type</color>
<regex>\b(r(10|11|12|[0-9]?)|sp|lp|lr|pc)\b</regex>
<regex>\@r(10|11|12|[0-9]?)|sp|lp|lr|pc\@</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,40 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Bash script">
<ext>.*\.sh</ext>
<ext>*.sh</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="first line">
<color>commentDoxygen</color>
<regex>#!(.|\\[\\\n])*?$</regex>
<regex>#!(\\[\\\n]|.)*$</regex>
</rule>
<rule name="comment line">
<color>comment</color>
<regex>#(.|\\[\\\n])*?$</regex>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</regex>
<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>\b(for|done|do|while|in|if|elif|then|else|fi)\b</regex>
<regex>\@for|done|do|while|in|if|elif|then|else|fi\@</regex>
</rule>
<rule name="my Variable">
<color>keyword</color>
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>function (\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,29 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Boulou log">
<ext>.*\.(boo|BOO)</ext>
<ext>*.boo</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="comment ##">
<color>SYNTAX_ERROR</color>
<regex>##.*?$</regex>
<regex>##.*$</regex>
</rule>
<rule name="comment #">
<color>comment</color>
<regex>#.*?$</regex>
<regex>#.*$</regex>
</rule>
<rule name="notes ... ">
<color>preprocesseur</color>
<regex>(NOTE|TODO) : .*?$</regex>
<regex>(NOTE|TODO) : .*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?$</regex>
<regex>"(\\[\\"]|.)*$</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>\b&apos;(.|\\[\\&apos;])*?$</regex>
<regex>\@'(\\[\\']|.)*$</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="pourcentage OK">
<color>TestResultOK</color>
<regex>100%</regex>
@@ -32,7 +33,7 @@
<color>number</color>
<regex>[0-9]*%</regex>
</rule>
<rule name="Résultat OK">
<rule name="R<EFBFBD>sultat OK">
<color>TestResultOK</color>
<regex>\[( )*(OK|Ok|ok)( )*\]</regex>
</rule>

View File

@@ -1,134 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="C">
<ext>.*\.(c|C|m|M)</ext>
<!--might be : <ext>.*\.(c|h|m)</ext>-->
<EdnLang version="0.1" lang="C/C++">
<ext>*.c</ext>
<ext>*.cpp</ext>
<ext>*.cxx</ext>
<ext>*.cc</ext>
<ext>*.h</ext>
<ext>*.hpp</ext>
<ext>*.hxx</ext>
<ext>*.m</ext>
<ext>*.mm</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<regex>
<start>/\*(\*|!)</start>
<stop>\*/</stop>
</regex>
<sub>doxyparse</sub>
<regex>/\*\*.*(\*/|\e)</regex>
</rule>
<rule name="comment multiline">
<rule name="code Review">
<color>SYNTAX_ERROR</color>
<regex>/\*[ \t]*TODO :.*(\*/|\e)</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>/\*</start>
<stop>\*/</stop>
</regex>
<sub>TODO</sub>
<regex>/\*.*(\*/|\e)</regex>
</rule>
<rule name="comment multiline ERROR">
<color>SYNTAX_ERROR</color>
<regex>
<start>/\*</start>
</regex>
</rule>
<rule name="#if 0">
<rule name="my if 0">
<color>preprocesseur</color>
<regex>
<start>#[ \t]*if 0</start>
<stop>#(endif|else)</stop>
</regex>
<regex>#[ \t]*if 0.*#(endif|else)</regex>
</rule>
<rule name="#if 0 ERROR">
<color>SYNTAX_ERROR</color>
<regex>
<start>#[ \t]*if 0</start>
</regex>
</rule>
<rule name="#preproc">
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#(.|\\[\\\n])*</regex>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="inline doxygen">
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>//!.*</regex>
<sub>doxyparse</sub>
<regex>//!.*$</regex>
</rule>
<rule name="inline comment">
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>//.*</regex>
<sub>TODO</sub>
<regex>//.*$</regex>
</rule>
<rule name="double quote text">
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex> <!-- " -->
<regex>"(\\[\\"]|.)*"</regex><!-- " -->
</rule>
<rule name="simple quote text">
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;\\?.&apos;</regex>
<regex>'((\\[\\'])|.){1,2}'</regex>
</rule>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</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>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)\b</regex>
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\b(memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc)\b</regex>
<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 name="my type">
<color>type</color>
<regex>\b(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))\b</regex>
<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 name="std type">
<color>type</color>
<regex>\@std::(vector|(u16|u32|w)?string|codecvt_utf(16|8_utf16|8)+|complex|iterator(_traits)?|tuple(_element|_size)?|pair)\@</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\b(inline|const|const|extern|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)\b</regex>
<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 name="my common Define">
<color>commonDefine</color>
<regex>\b(NULL|MAX|MIN|__(LINE|DATA|FILE|func|TIME|STDC|PRETTY_FUNCTION|FUNCTION)__)\b</regex>
<regex>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(TRUE|FALSE)\b</regex>
<regex>\@true|TRUE|false|FALSE\@</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<rule name="CPP member">
<color>memberClass</color>
<regex>\@m_[A-Za-z_0-9]*\@</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
<regex>\@_[A-Za-z_0-9]*\@</regex>
<max>false</max>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\b((\w|_)+[ \t]*\()</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;</regex>
<!-- With all elementes :
<rule name="BIG LETTER">
<color>macro</color>
<regex>([A-Z]|_){4,500}</regex>
<elemSubColor id="1">doxElem</elemSubColor>
</rule>
-->
</pass2>
<pass name="doxyparse">
<rule name="key">
<color>doxygen-key</color>
<regex>(@|\\)[\t ]*\w+</regex>
</rule>
<rule name="in-out">
<color>doxygen-in-out</color>
<regex>\[(in|in,out|out)\]</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
</rule>
</pass>
<pass name="TODO">
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>TODO[ \t]*:.*</regex>
</rule>
</pass>
</EdnLang>

View File

@@ -1,53 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="cmake">
<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>
<regex>##.*$</regex>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>#[ \t]TODO[ \t]*:(.|\\[\\\n])*</regex>
<regex>#[ \t]TODO[ \t]*:(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>#(.|\\[\\\n])*</regex>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<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>\b(foreach|message|endforeach|if|else|endif|list|file|string)\b</regex>
<regex>\@foreach|message|endforeach|if|else|endif|list|file|string\@</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\b(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|find_package|pkg_check_modules|set_target_properties|source_group)\b</regex>
<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>
<regex>\${.*}</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\b(\w|_)+[ \t]*\(</regex>
</rule>
<rule name="files path">
<color>memberClass</color>
<regex>[\w-]*(\.|/)\w*</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
</pass2>
</EdnLang>

View File

@@ -1,149 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="C++">
<ext>.*\.(cpp|CPP|cxx|CXX|cc|CC|hpp|HPP|hxx|HXX|h|H|mm|MM|c++|C++|m++|M++|mpp|MPP)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<color>commentDoxygen</color>
<regex>
<start>/\*(\*|!)</start>
<stop>\*/</stop>
</regex>
<sub>doxyparse</sub>
</rule>
<rule name="comment multiline">
<color>comment</color>
<regex>
<start>/\*</start>
<stop>\*/</stop>
</regex>
<sub>TODO</sub>
</rule>
<rule name="comment multiline ERROR">
<color>SYNTAX_ERROR</color>
<regex>
<start>/\*</start>
</regex>
</rule>
<rule name="#if 0">
<color>preprocesseur</color>
<regex>
<start>#[ \t]*if 0</start>
<stop>#e(ndif|lse)</stop>
</regex>
</rule>
<rule name="#if 0 ERROR">
<color>SYNTAX_ERROR</color>
<regex>
<start>#[ \t]*if 0</start>
</regex>
</rule>
<rule name="#preproc">
<color>preprocesseur</color>
<regex>#(.|\\[\\\n])*</regex>
</rule>
<rule name="inline doxygen">
<color>commentDoxygen</color>
<regex>//!.*</regex>
<sub>doxyparse</sub>
</rule>
<rule name="inline comment">
<color>comment</color>
<regex>//.*</regex>
<sub>TODO</sub>
</rule>
<rule name="double quote text">
<color>doubleQuoteText</color>
<regex>(U|u|u8)?&quot;(.|\\[\\&quot;])*?&quot;</regex> <!-- " -->
</rule>
<rule name="simple quote text">
<color>doubleQuoteText</color>
<regex>&apos;\\?.&apos;</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="old school elements">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;|NULL|MAX|MIN|TRUE|FALSE|calloc|malloc|realloc|free|BOOL</regex>
</rule>
<rule name="my keyword">
<color>keyword</color>
<regex>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)\b</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\b(new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|(reinterpret|static|dynamic|const)_cast)\b</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\b(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))\b</regex>
</rule>
<rule name="std type">
<color>type</color>
<regex>\b(std(11)?|boost)::[\w:]*</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\b(inline|const|class|namespace|virtual|private|public|protected|friend|const|extern|mutable|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum|override|final)\b</regex>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<regex>\b(nullptr|__(LINE|DATA|FILE|func|TIME|STDC|PRETTY_FUNCTION|FUNCTION)__)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(LL|L|l|UL|ul|u|U|F|f)?)\b</regex>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\b(true|false)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
<rule name="CPP member">
<color>memberClass</color>
<regex>\b((m|s|p|s|g)_|property|signal)\w+\b</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\b((\w|_)+[ \t]*\()</regex>
</rule>
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
</rule>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;</regex>
</rule>
</pass2>
<pass name="doxyparse">
<rule name="knownkey">
<color>doxygen-key-known</color>
<regex>(@|\\)[\t ]*(addindex|addtogroup|anchor|arg|attention|author|authors|a|brief|bug|b|callgraph|category|cite|class|code|cond|copybrief|copydetails|copydoc|copyright|date|def|defgroup|deprecated|details|diafile|dir|docbookonly|dontinclude|dot|dotfile|else|elseif|em|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endif|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|endverbatim|enduml|endxmlonly|enum|example|exception|extends|e|file|fn|headerfile|hidecallergraph|hidecallgraph|hideinitializer|htmlinclude|htmlonly|idlexcept|ifnot|if|image|implements|includelineno|include|ingroup|internal|invariant|interface|latexinclude|latexonly|line|link|license|li|mainpage|manonly|memberof|msc|mscfile|name|namespace|nosubgrouping|note|n|overload|package|page|paragraph|param|parblock|par|post|pre|private|privatesection|property|protected|protectedsection|protocol|public|publicsection|pure|p|refitem|ref|related|relates|relatedalso|relatesalso|remark|remarks|result|return|returns|retval|rtfonly|sa|secreflist|section|see|short|showinitializer|since|skip|skipline|snippet|startuml|struct|subpage|subsection|subsubsection|tableofcontents|test|throw|throws|todo|tparam|typedef|union|until|var|verbatim|verbinclude|version|vhdlflow|warning|weakgroup|xmlonly|xrefitem)</regex>
</rule>
<rule name="key">
<color>doxygen-key</color>
<regex>(@|\\)[\t ]*\w+</regex>
</rule>
<rule name="in-out">
<color>doxygen-in-out</color>
<regex>\[(in|in,out|out)\]</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
</rule>
</pass>
<pass name="TODO">
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>TODO[ \t]*:.*</regex>
</rule>
</pass>
</EdnLang>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="gcov">
<ext>.*\.(gcov)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Not parsed">
<color>normal</color>
<regex>( )+-\:.*</regex>
</rule>
<rule name="Not executed">
<color>SYNTAX_ERROR</color>
<regex>( )+(#)+\:.*</regex>
</rule>
<rule name="Not parsed">
<color>number</color>
<regex>( )+[0-9]+\:.*</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
</pass2>
</EdnLang>

View File

@@ -1,77 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Glsl">
<ext>.*\.(glsl|vert|frag|prog)</ext>
<ext>*.glsl</ext>
<ext>*.vert</ext>
<ext>*.frag</ext>
<ext>*.prog</ext>
<pass1>
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<regex>
<start>/\*(\*|!)</start>
<stop>\*/</stop>
</regex>
<regex>/\*\*.*\*/</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>/\*</start>
<stop>\*/</stop>
</regex>
<regex>/\*.*\*/</regex>
</rule>
<rule name="my if 0">
<color>preprocesseur</color>
<regex>
<start>#[ \t]*if 0</start>
<stop>#(endif|else)</stop>
</regex>
<regex>#[ \t]*if 0(\\[\\\n]|.)*#(endif|else)</regex>
</rule>
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#(.|\\[\\\n])*$</regex>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>//!(.|\\[\\\n])*$</regex>
<regex>//!(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>//[ \t]*TODO[ \t]*:(.|\\[\\\n])*$</regex>
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>//(.|\\[\\\n])*$</regex>
<regex>//(\\[\\\n]|.)*$</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>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)\b</regex>
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\b(void|bool|float|int|(vec|mat|ivec|bvec)[2-4])\b</regex>
<regex>\@void|bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\b(varying|uniform|attribute|precision|mediump)\b</regex>
<regex>\@varying|uniform|attribute|precision|mediump\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(true|false)\b</regex>
<regex>\@true|false\@</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\b(\w|_)+[ \t]*\(</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,40 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Kernel conf file">
<ext>.*\.in</ext>
<ext>*.in</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#(.|\\[\\\n])*?$</regex>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?$</regex>
<regex>"(\\[\\"]|.)*$</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;(.|\\[\\&apos;])*?$</regex>
<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>\b(menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config)\b</regex>
<regex>\@menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config\@</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\b(int|hex|bool|string)\b</regex>
<regex>\@int|hex|bool|string\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,116 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Java">
<ext>.*\.(java|JAVA)</ext>
<ext>*.java</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<regex>
<start>/\*(\*|!)</start>
<stop>\*/</stop>
</regex>
<sub>doxyparse</sub>
<regex>/\*\*.*\*/</regex>
</rule>
<rule name="comment multiline">
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>/\*</start>
<stop>\*/</stop>
</regex>
<sub>TODO</sub>
<regex>/\*.*\*/</regex>
</rule>
<rule name="comment multiline ERROR">
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>//!(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>
<start>/\*(\*|!)</start>
</regex>
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
</rule>
<rule name="inline doxygen">
<color>commentDoxygen</color>
<regex>//!.*$</regex>
<sub>doxyparse</sub>
</rule>
<rule name="inline comment">
<rule name="my comment">
<color>comment</color>
<regex>//.*$</regex>
<sub>TODO</sub>
<regex>//(\\[\\\n]|.)*$</regex>
</rule>
<rule name="double quote text">
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>(U|u|u8)?&quot;(.|\\[\\&quot;])*?&quot;</regex> <!-- " -->
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="simple quote text">
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;\\?.&apos;</regex>
<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>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for)\b</regex>
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for\@</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\b(new|try|catch|print)\b</regex>
<regex>\@new|try|catch|print\@</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\b(boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum)\b</regex>
<regex>\@boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum\@</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\b(import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface)\b</regex>
<regex>\@import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface@</regex>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<regex>\bnull\b</regex>
<regex>\@null\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(true|false)\b</regex>
<regex>\@true|false\@</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b[A-Z_][A-Z_0-9]{3,500}\b</regex>
</rule>
<rule name="java member">
<color>memberClass</color>
<regex>\bm_\w+\b</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\b((\w|_)+[ \t]*\()</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
</pass2>
<pass name="doxyparse">
<rule name="key">
<color>doxygen-key</color>
<regex>(@|\\)[\t ]*\w+</regex>
</rule>
<rule name="in-out">
<color>doxygen-in-out</color>
<regex>\[(in|in,out|out)\]</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
</rule>
</pass>
<pass name="TODO">
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>TODO[ \t]*:.*</regex>
</rule>
</pass>
</EdnLang>

View File

@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Json">
<ext>.*\.(json|JSON)</ext>
<ext>*.json</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>#.*</regex>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
@@ -22,15 +18,15 @@
</rule>
<rule name="names">
<color>functionName</color>
<regex>([a-zA-Z0-9]|-|_)+</regex>
<regex>([a-zA-Z0-9]|-|_)*</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(true|false)\b</regex>
<regex>\@true|false\@</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,55 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Lua">
<ext>.*\.lua</ext>
<ext>*.lua</ext>
<pass1>
<rule name="Comment multiline">
<color>comment</color>
<regex>
<start>\-\-\[\[</start>
<stop>\-\-\]\]</stop>
</regex>
<regex>\-\-\[\[.*\-\-\]\]</regex>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>\-\-[ \t]*TODO[ \t]*:(.|\\[\\\n])*?$</regex>
<regex>\-\-[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>\-\-(.|\\[\\\n])*?$</regex>
<regex>\-\-(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</regex>
<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>\b(and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while)\b</regex>
<regex>\@and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(true|false)\b</regex>
<regex>\@true|false\@</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\b(\w|_)+[ \t]*\(</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|~=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|~=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,29 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Makefiles">
<ext>Makefile</ext>
<ext>.*\.(mk|global)</ext>
<ext>*.mk</ext>
<ext>*.global</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#(.|\\[\\\n])*?$</regex>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</regex>
<regex>'(\\[\\']|.)*'</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="confition">
<color>type</color>
<regex>\b(if|ifeq|ifneq|else|endif|define|endef)\b</regex>
<regex>\@if|ifeq|ifneq|else|endif|define|endef\@</regex>
</rule>
<rule name="my keyword">
<color>keyword</color>
<regex>\b\([a-zA-Z_][a-zA-Z0-9_]*\)</regex>
<regex>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</regex>
</rule>
<rule name="function call">
<color>functionName</color>
@@ -31,7 +32,7 @@
</rule>
<rule name="condition">
<color>boolean</color>
<regex>:=|\?=|!=|=</regex>
<regex>:=|?=|!=|=</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,52 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Matlab">
<ext>.*\.(m|M)</ext>
<ext>*.m</ext>
<ext>*.M</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>%%(.|\\[\\\n])*?$</regex>
<regex>%%(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>%(.|\\[\\\n])*?$</regex>
<regex>%(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex> &quot;.*?($|&quot;)</regex>
<regex> ".*($|")</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex> &apos;.*?($|&apos;)</regex>
<regex> '.*($|')</regex>
</rule>
<rule name="global inclusion">
<color>preprocesseur</color>
<regex>global( |\t)+(.|\\[\\\n])*?$</regex>
<regex>global( |\t)+(\\[\\\n]|.)*$</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>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end)\b</regex>
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</regex>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\b(true|false)\b</regex>
<regex>\@true|false\@</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\b(\w|_)+[ \t]*\(</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,120 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="PHP">
<ext>.*\.(php(3|4|5|6|7|8)|PHP(3|4|5|6|7|8)|phtml|php|PHP)</ext>
<EdnLang version="0.1" lang="Php: pretty home page">
<ext>*.php</ext>
<ext>*.php3</ext>
<ext>*.php4</ext>
<ext>*.phtml</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<color>commentDoxygen</color>
<regex>
<start>/\*(\*|!)</start>
<stop>\*/</stop>
</regex>
<sub>doxyparse</sub>
</rule>
<rule name="comment multiline">
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>/\*</start>
<stop>\*/</stop>
</regex>
<sub>TODO</sub>
<regex>/\*.*\*/</regex>
</rule>
<rule name="comment multiline ERROR">
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>
<start>/\*(\*|!)</start>
</regex>
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
</rule>
<rule name="inline doxygen">
<color>commentDoxygen</color>
<regex>//!.*$</regex>
<sub>doxyparse</sub>
</rule>
<rule name="inline comment">
<rule name="my comment inline">
<color>comment</color>
<regex>(//|#).*$</regex>
<sub>TODO</sub>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>//(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</regex>
<regex>'(\\[\\']|.)*'</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="start-stop-php">
<color>macro</color>
<regex>(&lt;\?\w+|\?&gt;)</regex>
</rule>
<rule name="my keyword">
<color>inputFunction</color>
<regex>\$_[a-zA-Z_][a-zA-Z0-9_]*\b</regex>
</rule>
<rule name="my keyword">
<color>keyword</color>
<regex>\$[a-zA-Z_][a-zA-Z0-9_]*\b</regex>
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\b(array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset)\b</regex>
<regex>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\b(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)\b</regex>
<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 name="my common Define">
<color>commonDefine</color>
<regex>\b(doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export)\b</regex>
<regex>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(TRUE|FALSE)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@true|TRUE|false|FALSE\@</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\b\w+[ \t]*\(</regex>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}</regex>
</rule>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</regex>
</rule>
</pass2>
<pass name="doxyparse">
<rule name="knownkey">
<color>doxygen-key-known</color>
<regex>(@|\\)[\t ]*(addindex|addtogroup|anchor|arg|attention|author|authors|a|brief|bug|b|callgraph|category|cite|class|code|cond|copybrief|copydetails|copydoc|copyright|date|def|defgroup|deprecated|details|diafile|dir|docbookonly|dontinclude|dot|dotfile|else|elseif|em|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endif|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|endverbatim|enduml|endxmlonly|enum|example|exception|extends|e|file|fn|headerfile|hidecallergraph|hidecallgraph|hideinitializer|htmlinclude|htmlonly|idlexcept|ifnot|if|image|implements|includelineno|include|ingroup|internal|invariant|interface|latexinclude|latexonly|line|link|license|li|mainpage|manonly|memberof|msc|mscfile|name|namespace|nosubgrouping|note|n|overload|package|page|paragraph|param|parblock|par|post|pre|private|privatesection|property|protected|protectedsection|protocol|public|publicsection|pure|p|refitem|ref|related|relates|relatedalso|relatesalso|remark|remarks|result|return|returns|retval|rtfonly|sa|secreflist|section|see|short|showinitializer|since|skip|skipline|snippet|startuml|struct|subpage|subsection|subsubsection|tableofcontents|test|throw|throws|todo|tparam|typedef|union|until|var|verbatim|verbinclude|version|vhdlflow|warning|weakgroup|xmlonly|xrefitem)</regex>
</rule>
<rule name="key">
<color>doxygen-key</color>
<regex>(@|\\)[\t ]*\w+</regex>
</rule>
<rule name="in-out">
<color>doxygen-in-out</color>
<regex>\[(in|in,out|out)\]</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
</rule>
</pass>
<pass name="TODO">
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>TODO[ \t]*:.*</regex>
</rule>
</pass>
</EdnLang>

View File

@@ -1,154 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Python">
<ext>.*\.(py|PY)</ext>
<ext>*.py</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>&quot;&quot;&quot;</start>
<stop>&quot;&quot;&quot;</stop>
</regex>
<regex>""".*"""</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>
<start>'''</start>
<stop>'''</stop>
</regex>
</rule>
<rule name="comment multiline Error">
<color>SYNTAX_ERROR</color>
<regex>
<start>(&quot;&quot;&quot;|''')</start>
</regex>
<regex>'''.*'''</regex>
</rule>
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>##.*</regex>
<sub>doxyparse</sub>
<regex>##(\\[\\\n]|.)*$</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>#.*</regex>
<sub>TODO</sub>
<regex>#(\\[\\\n]|.)*$</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>&apos;((\\[\\&apos;])|.)*?&apos;</regex>
</rule>
<rule name="internalParameter">
<color>normal</color>
<regex>self\.\w*</regex>
<sub>parameter_internal</sub>
</rule>
<rule name="Function name private">
<color>functionNamePrivate</color>
<regex>\b_(\w|_)+[ \t]*\(</regex>
<sub>checkCamelCaseError</sub>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\b(\w|_)+[ \t]*\(</regex>
<sub>checkCamelCaseError</sub>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_(\w|_)+\b</regex>
<sub>checkCamelCaseError</sub>
<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>\b(if|else|elif|break|pass|continue|while|do|for|in|return)\b</regex>
<regex>\@if|else|elif|break|pass|continue|while|do|for|in|return\@</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\b(print|len|range|del|__init__|self|os\.|sys\.|path\.)\b</regex>
<regex>\@print|len|range|del|__init__|self|os\.|sys\.|path\.\@</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\b(bool|BOOL|char|double|float)\b</regex>
<regex>\@bool|BOOL|char|double|float\@</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\b(def|class|import|from|as|try|except)\b</regex>
<regex>\@def|class|import|from|as|try|except\@</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
<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="my boolean">
<color>boolean</color>
<regex>\b(True|False)\b</regex>
<regex>\@True|False\@</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
</rule>
<!--
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
</rule>
-->
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;{1,2}|&gt;{1,2}|&amp;&amp;|\{|\}|</regex>
</rule>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;</regex>
<!-- With all elementes : -->
<rule name="BIG LETTER">
<color>macro</color>
<regex>([A-Z]|_){4,500}</regex>
<elemSubColor id="1">doxElem</elemSubColor>
</rule>
</pass2>
<pass name="doxyparse">
<rule name="knownkey">
<color>doxygen-key-known</color>
<regex>(@|\\)[\t ]*(addindex|addtogroup|anchor|arg|attention|author|authors|a|brief|bug|b|callgraph|category|cite|class|code|cond|copybrief|copydetails|copydoc|copyright|date|def|defgroup|deprecated|details|diafile|dir|docbookonly|dontinclude|dot|dotfile|else|elseif|em|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endif|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|endverbatim|enduml|endxmlonly|enum|example|exception|extends|e|file|fn|headerfile|hidecallergraph|hidecallgraph|hideinitializer|htmlinclude|htmlonly|idlexcept|ifnot|if|image|implements|includelineno|include|ingroup|internal|invariant|interface|latexinclude|latexonly|line|link|license|li|mainpage|manonly|memberof|msc|mscfile|name|namespace|nosubgrouping|note|n|overload|package|page|paragraph|param|parblock|par|post|pre|private|privatesection|property|protected|protectedsection|protocol|public|publicsection|pure|p|refitem|ref|related|relates|relatedalso|relatesalso|remark|remarks|result|return|returns|retval|rtfonly|sa|secreflist|section|see|short|showinitializer|since|skip|skipline|snippet|startuml|struct|subpage|subsection|subsubsection|tableofcontents|test|throw|throws|todo|tparam|typedef|union|until|var|verbatim|verbinclude|version|vhdlflow|warning|weakgroup|xmlonly|xrefitem)</regex>
</rule>
<rule name="key">
<color>doxygen-key</color>
<regex>(@|\\)[\t ]*\w+</regex>
</rule>
<rule name="in-out">
<color>doxygen-in-out</color>
<regex>\[(in|in,out|out)\]</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\b_\w+\b</regex>
</rule>
</pass>
<pass name="TODO">
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>TODO[ \t]*:.*</regex>
</rule>
</pass>
<pass name="parameter_internal">
<rule name="self">
<color>systemFunction</color>
<regex>self</regex>
</rule>
<rule name="function input">
<color>memberClassPrivate</color>
<regex>_[a-z0-9_]+</regex>
</rule>
<rule name="function input">
<color>memberClass</color>
<regex>[a-z0-9_]+</regex>
</rule>
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>_\w+</regex>
</rule>
<rule name="function input">
<color>SYNTAX_ERROR</color>
<regex>\w+</regex>
</rule>
</pass>
<pass name="checkCamelCaseError">
<rule name="Function name ERROR (camel case ...)">
<color>SYNTAX_ERROR</color>
<regex>[A-Z]</regex>
</rule>
</pass>
</EdnLang>

View File

@@ -1,80 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.2" lang="XML">
<ext>.*\.(xml|XML|svg|SVG|html|HTML|htm|HTM|tpl|TPL)</ext>
<ext>*.xml</ext>
<ext>*.svg</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Comment">
<color>comment</color>
<regex>
<start>&lt;!\-\-</start>
<stop>\-\-&gt;</stop>
</regex>
<regex><![CDATA[<!\-\-.*\-\->]]></regex>
<!--<regex>&lt;!\-\-.*\-\-&gt;</regex>-->
</rule>
<rule name="CDATA">
<color>macro</color>
<regex>
<start>&lt;!\[CDATA\[</start>
<stop>\]\]&gt;</stop>
</regex>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>"(\\[\\"]|.)*"</regex>
</rule>
<rule name="stop balise">
<color>functionName</color>
<regex>&lt;/[ \t]*\w+?[ \t]*&gt;</regex>
</rule>
<rule name="stop balise">
<color>SYNTAX_ERROR</color>
<regex>
<start>&lt;/</start>
<stop>&gt;</stop>
</regex>
</rule>
<rule name="start balise">
<color>normal</color>
<regex>
<start>&lt;</start>
<stop>&gt;</stop>
</regex>
<sub>parseInsideBalise</sub>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>\@'.*('|\n)</regex>
</rule>
</pass1>
<pass2>
<rule name="start balise">
<color>commonDefine</color>
<regex>&amp;(gt|lt|amp|apos|quot);</regex>
</rule>
<rule name="start balise">
<color>error</color>
<regex>&gt;|&lt;|&amp;|&apos;|&quot;</regex>
</rule>
</pass2>
<pass name="parseInsideBalise">
<rule name="special Balise">
<color>error</color>
<regex>&lt;\?\w*|\?&gt;</regex>
</rule>
<rule name="open balise">
<!--
<rule name="normale Balise2">
<color>functionName</color>
<regex>&lt;[ \t]*[0-9a-zA-Z_]+</regex>
<regex><![CDATA[(</[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+)(/>|>)]]></regex>
</rule>
<rule name="close balise">
-->
<rule name="normale Balise">
<color>functionName</color>
<regex>/?&gt;</regex>
<!--<regex>&lt;/[0-9a-zA-Z_]+|&lt;[0-9a-zA-Z_]+|/&gt;|&gt;</regex>-->
<regex><![CDATA[(</[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+)\@]]></regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>&quot;(.|\r|\n|\\\\|\\&quot;)*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>\b&apos;(.|\r|\n)*?(&apos;|\n)</regex>
</rule>
<rule name="condition">
<color>boolean</color>
<regex>=</regex>
</rule>
<rule name="condition">
<color>keyword</color>
<regex>\w+</regex>
</rule>
</pass>
</pass2>
</EdnLang>

View File

@@ -14,7 +14,6 @@
{ name:"storageKeyword", foreground:"#5c8fed"},
{ name:"inputFunction", foreground:"#B80000", bold:true, italic:true},
{ name:"memberClass", foreground:"#7c5406", bold:true},
{ name:"memberClassPrivate", foreground:"#7c2400", bold:true},
{ name:"number", foreground:"#00ff00"},
{ name:"systemFunction", foreground:"#ffff00"},
{ name:"commonDefine", foreground:"#56bf10"},
@@ -26,12 +25,7 @@
{ name:"macro", foreground:"#6c09c8", bold:true},
{ name:"SYNTAX_ERROR", foreground:"#000000", background:"#FF0000", bold:true},
{ name:"functionName", foreground:"#24d1e0", bold:true},
{ name:"functionNamePrivate", foreground:"#24d190", bold:true},
{ name:"TestResultOK", foreground:"#000000", background:"#00FF00", bold:true},
{ name:"TestResultERROR", FG:"#000000", background:"#FF0000", bold:true}
{ name:"doxygen-key-known", foreground:"#Fc4700", bold:true, italic:false},
{ name:"doxygen-key", foreground:"#dc3700", bold:true, italic:false},
{ name:"doxygen-in-out", foreground:"#dc7000", bold:true, italic:false},
]
}

View File

@@ -9,10 +9,8 @@
{ name:"SelectedText", foreground:"#292929", background:"#009ce7"},
{ name:"error", foreground:"#FF0000"},
{ name:"doubleQuoteText", foreground:"#008e00"},
{ name:"type", foreground:"#376d0a", bold:true},
{ name:"memberClass", foreground:"#7c5406", bold:true},
{ name:"memberClassPrivate", foreground:"#7c2400", bold:true},
{ name:"inputFunction", foreground:"#B80000", bold:true, italic:true},
{ name:"storageKeyword", foreground:"#466cb4"},
{ name:"number", foreground:"#007b00"},
@@ -26,13 +24,8 @@
{ name:"macro", foreground:"#571793", bold:true},
{ name:"SYNTAX_ERROR", foreground:"#000000", background:"#c20000", bold:true},
{ name:"functionName", foreground:"#09857e", bold:true},
{ name:"functionNamePrivate", foreground:"#09854e", bold:true},
{ name:"TestResultOK", foreground:"#000000", background:"#009c00", bold:true},
{ name:"TestResultERROR", foreground:"#000000", background:"#c20000", bold:true}
{ name:"doxygen-key-known", foreground:"#Fc4700", bold:true, italic:false},
{ name:"doxygen-key", foreground:"#dc3700", bold:true, italic:false},
{ name:"doxygen-in-out", foreground:"#dc7000", bold:true, italic:false},
]
}

View File

@@ -1,134 +0,0 @@
#!/usr/bin/python
import lutin.module as module
import lutin.tools as tools
import lutin.debug as debug
import os
def get_type():
return "BINARY"
def get_name():
return "Editeur de N'ours"
def get_desc():
return "Text editor for sources code with ctags management"
def get_licence():
return "GPL-3"
def get_compagny_type():
return "org"
def get_compagny_name():
return "Edouard DUPIN"
def get_maintainer():
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
def get_version():
return [1,3,0]
def get_version_id():
return 6
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
my_module.add_extra_compile_flags()
my_module.add_src_file([
'sources/appl/ctags/readtags.cpp'
])
my_module.add_src_file([
'sources/appl/debug.cpp',
'sources/appl/global.cpp',
'sources/appl/globalMsg.cpp',
'sources/appl/init.cpp'
])
# Gui:
my_module.add_src_file([
'sources/appl/Gui/BufferView.cpp',
'sources/appl/Gui/TextViewer.cpp',
'sources/appl/Gui/ViewerManager.cpp',
'sources/appl/Gui/MainWindows.cpp',
'sources/appl/Gui/Search.cpp',
'sources/appl/Gui/TagFileSelection.cpp',
'sources/appl/Gui/TagFileList.cpp',
'sources/appl/Gui/WorkerSaveFile.cpp',
'sources/appl/Gui/WorkerSaveAllFile.cpp',
'sources/appl/Gui/WorkerCloseFile.cpp',
'sources/appl/Gui/WorkerCloseAllFile.cpp'
])
# All needed for the buffer management :
my_module.add_src_file([
'sources/appl/Buffer.cpp',
'sources/appl/BufferManager.cpp',
'sources/appl/TextPlugin.cpp',
'sources/appl/TextPluginCopy.cpp',
'sources/appl/TextPluginMultiLineTab.cpp',
'sources/appl/TextPluginAutoIndent.cpp',
'sources/appl/TextPluginHistory.cpp',
'sources/appl/TextPluginRmLine.cpp',
'sources/appl/TextPluginSelectAll.cpp',
'sources/appl/TextPluginCtags.cpp',
'sources/appl/TextPluginManager.cpp'
])
# Generic color management for the text editor :
my_module.add_src_file([
'sources/appl/GlyphDecoration.cpp',
'sources/appl/GlyphPainting.cpp'
])
# syntax coloration for the text editor
my_module.add_src_file([
'sources/appl/HighlightPattern.cpp',
'sources/appl/Highlight.cpp',
'sources/appl/HighlightManager.cpp'
])
my_module.add_module_depend(['ewol'])
my_module.copy_path('data/icon.*','')
my_module.copy_path('data/languages/gcov/*.xml','languages/gcov/')
my_module.copy_path('data/languages/asm/*.xml','languages/asm/')
my_module.copy_path('data/languages/bash/*.xml','languages/bash/')
my_module.copy_path('data/languages/boo/*.xml','languages/boo/')
my_module.copy_path('data/languages/cpp/*.xml','languages/cpp/')
my_module.copy_path('data/languages/c/*.xml','languages/c/')
my_module.copy_path('data/languages/cmake/*.xml','languages/cmake/')
my_module.copy_path('data/languages/glsl/*.xml','languages/glsl/')
my_module.copy_path('data/languages/in/*.xml','languages/in/')
my_module.copy_path('data/languages/java/*.xml','languages/java/')
my_module.copy_path('data/languages/json/*.xml','languages/json/')
my_module.copy_path('data/languages/lua/*.xml','languages/lua/')
my_module.copy_path('data/languages/makefile/*.xml','languages/makefile/')
my_module.copy_path('data/languages/matlab/*.xml','languages/matlab/')
my_module.copy_path('data/languages/php/*.xml','languages/php/')
my_module.copy_path('data/languages/xml/*.xml','languages/xml/')
my_module.copy_path('data/languages/python/*.xml','languages/python/')
my_module.copy_path('data/theme/default/*.svg','theme/shape/square/')
my_module.copy_path('data/theme/default/*.edf','theme/shape/square/')
my_module.copy_path('data/theme/colorWhite/*.json','theme/color/white/')
my_module.copy_path('data/theme/colorBlack/*.json','theme/color/black/')
my_module.copy_path('data/GUI-Search.xml','')
my_module.add_path(os.path.join(tools.get_current_path(__file__), "sources"))
my_module.copy_file("data/Font/freefont/FreeSerif.ttf","fonts/FreeSerif.ttf")
my_module.copy_path("data/Font/freefont/FreeMon*.ttf","fonts/")
my_module.compile_flags('c', [
"-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
])
versionIDCode = str(get_version_id())
# set the package properties:
my_module.pkg_set("VERSION_CODE", versionIDCode)
if target.name=="MacOs":
my_module.pkg_set("ICON", os.path.join(tools.get_current_path(__file__), "data/icon.icns"))
else:
my_module.pkg_set("ICON", os.path.join(tools.get_current_path(__file__), "data/icon.png"))
my_module.pkg_set("SECTION", ["Development", "Editors"])
my_module.pkg_set("PRIORITY", "optional")
my_module.pkg_add("RIGHT", "WRITE_EXTERNAL_STORAGE")
my_module.pkg_add("RIGHT", "SET_ORIENTATION")
return my_module

View File

@@ -1,15 +1,22 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <etk/types.h>
#include <etk/stdTools.h>
#include <appl/Buffer.h>
#include <appl/debug.h>
#include <gale/context/clipBoard.h>
#include <ewol/context/clipBoard.h>
#include <appl/HighlightManager.h>
#undef __class__
#define __class__ "Buffer"
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
m_value = u32char::Null;
if (m_current < 0) {
@@ -17,7 +24,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
return *this;
}
if (m_data != nullptr) {
if (m_current < (int64_t)m_data->m_data.size() ) {
if (m_current < m_data->m_data.size() ) {
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
if (nbChar != 0) {
m_current+=nbChar;
@@ -25,7 +32,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
m_current++;
}
}
if (m_current >= (int64_t)m_data->m_data.size()) {
if (m_current >= m_data->m_data.size()) {
m_current = m_data->m_data.size();
}
}
@@ -62,7 +69,7 @@ char32_t appl::Buffer::Iterator::operator* () {
return m_value;
}
if ( m_current < 0
|| m_current >= (int64_t)m_data->m_data.size()) {
|| m_current >= m_data->m_data.size()) {
APPL_ERROR("request an element out of bounding !!! 0 <= " << m_current << " < " << m_data->m_data.size());
return m_value;
}
@@ -70,7 +77,7 @@ char32_t appl::Buffer::Iterator::operator* () {
memset(tmpVal, 0, sizeof(tmpVal));
tmpVal[0] = m_data->m_data[m_current];
int8_t nbChar = utf8::theoricLen(tmpVal[0]);
for (int32_t iii=1; iii<nbChar && m_current+iii<(int64_t)m_data->m_data.size(); ++iii) {
for (int32_t iii=1; iii<nbChar && m_current+iii<m_data->m_data.size(); ++iii) {
tmpVal[iii] = m_data->m_data[m_current+iii];
}
// transform ...
@@ -108,10 +115,10 @@ appl::Buffer::Iterator appl::Buffer::selectStop() {
}
appl::Buffer::Buffer() :
signalIsModify(this, "is-modify", ""),
signalIsSave(this, "is-save", ""),
signalSelectChange(this, "select-change", ""),
signalChangeName(this, "change-name", ""),
signalIsModify(*this, "is-modify"),
signalIsSave(*this, "is-save"),
signalSelectChange(*this, "select-change"),
signalChangeName(*this, "change-name"),
m_hasFileName(false),
m_fileName(""),
m_isModify(false),
@@ -131,7 +138,7 @@ void appl::Buffer::init() {
}
appl::Buffer::~Buffer() {
APPL_ERROR("REAL remove buffer : '" << propertyName << "'");
APPL_ERROR("REAL remove buffer : '" << m_name << "'");
}
bool appl::Buffer::loadFile(const std::string& _name) {
@@ -145,20 +152,13 @@ bool appl::Buffer::loadFile(const std::string& _name) {
m_cursorPos = 0;
setHighlightType("");
m_nbLines = 0;
if (file.exist() == false) {
APPL_ERROR("File : '" << m_fileName << "' does not exist...");
return false;
}
if (file.fileOpenRead() == false) {
APPL_ERROR("File : '" << m_fileName << "' Fail to open in read mode");
return false;
}
m_data = file.fileReadAllString();
file.fileClose();
if (m_data.dumpFrom(m_fileName) == true ) {
countNumberofLine();
tryFindHighlightType();
m_isModify = false;
return true;
}
return false;
}
void appl::Buffer::setFileName(const std::string& _name) {
@@ -175,16 +175,12 @@ void appl::Buffer::setFileName(const std::string& _name) {
}
bool appl::Buffer::storeFile() {
etk::FSNode file(m_fileName);
if (file.fileOpenWrite() == false) {
APPL_ERROR("File : '" << m_fileName << "' Fail to open in write mode");
return false;
}
file.fileWriteAll(m_data);
file.fileClose();
if (m_data.dumpIn(m_fileName) == true) {
APPL_INFO("saving file : " << m_fileName);
setModification(false);
return true;
}
return false;
}
void appl::Buffer::setModification(bool _status) {
@@ -642,7 +638,7 @@ bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator&
position = 0;
}
APPL_VERBOSE("write at pos: " << (int64_t)_pos << " ==> " << position << " data : " << _data);
m_data.insert((size_t)position, _data);
m_data.insert(position, (int8_t*)(_data.c_str()), _data.size());
if (m_cursorPos < 0) {
m_cursorPos = 0;
}
@@ -659,7 +655,7 @@ bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterato
if (position < 0){
position = 0;
}
m_data.replace(m_data.begin() + position, m_data.begin() + (int64_t)_posEnd, _data.begin(), _data.end());
m_data.replace(position, (int64_t)_posEnd-(int64_t)_pos, (int8_t*)(_data.c_str()), _data.size());
regenerateHighLightAt(position, (int64_t)_posEnd-(int64_t)_pos, _data.size());
m_selectMode = false;
moveCursor(position+_data.size());
@@ -674,7 +670,7 @@ void appl::Buffer::removeSelection() {
}
int64_t startPos = getStartSelectionPos();
int64_t endPos = getStopSelectionPos();
m_data.erase(startPos, endPos-startPos);
m_data.remove(startPos, endPos-startPos);
regenerateHighLightAt(startPos, endPos-startPos, 0);
m_selectMode = false;
moveCursor(startPos);
@@ -684,7 +680,7 @@ void appl::Buffer::removeSelection() {
void appl::Buffer::tryFindHighlightType() {
etk::FSNode file(m_fileName);
std::string type = appl::highlightManager::getTypeFile(file.getNameFile());
std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention());
if (type.size() == 0) {
return;
}
@@ -707,7 +703,7 @@ void appl::Buffer::setHighlightType(const std::string& _type) {
void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) {
// prevent ERROR...
if (m_highlight == nullptr) {
if (nullptr == m_highlight) {
return;
}
// prevent No data Call
@@ -716,7 +712,7 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
return;
}
// normal case
APPL_VERBOSE("(_pos="<<_pos<<", _nbDeleted="<<_nbDeleted<<", _nbAdded=" << _nbAdded << "\");");
//APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
int64_t posEnd = _pos + _nbDeleted;
// search position of the old element to reparse IT...
int64_t startId;
@@ -730,47 +726,34 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
// find element previous
findMainHighLightPosition(_pos, posEnd, startId, stopId, true);
APPL_VERBOSE(" list old parse:");
for (auto &elem : m_HLDataPass1) {
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
}
// Remove previous element to prevent many errors like parsing of // for example
startId--;
APPL_VERBOSE("Find startId=" << startId << " stopId=" << stopId << " list size=" << m_HLDataPass1.size());
// remove deprecated element
if ( startId <= -1
&& stopId <= -1) {
if ( startId == -1
&& stopId == -1) {
m_HLDataPass1.clear();
APPL_VERBOSE("1 * clear");
} else if (startId <= -1) {
} else if (startId == -1) {
if (stopId == 0){
m_HLDataPass1.erase(m_HLDataPass1.begin());
APPL_VERBOSE("1 * Erase 0");
//APPL_DEBUG("1 * Erase 0");
} else {
m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId);
APPL_VERBOSE("2 * Erase 0->" << stopId);
//APPL_DEBUG("2 * Erase 0->" << stopId);
}
} else if (stopId <= -1) {
APPL_VERBOSE("3 * Erase " << startId+1 << "-> end");
} else if (stopId == -1) {
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end());
stopId = -1;
} else {
int32_t currentSize = m_HLDataPass1.size();
APPL_VERBOSE("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId+1);
//APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId);
if (stopId == currentSize-1) {
stopId = -1;
}
}
APPL_VERBOSE(" list afterRemove:");
for (auto &elem : m_HLDataPass1) {
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
}
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
// update position after the range position :
int64_t elemStart;
if (startId <= -1) {
if (startId == -1) {
elemStart = 0;
} else {
elemStart = startId+1;
@@ -781,18 +764,18 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
it->stop += _nbAdded - _nbDeleted;
}
//Regenerate Element inside range
if ( startId <= -1
&& stopId <= -1) {
APPL_VERBOSE("******* Regenerate ALL");
if ( startId == -1
&& stopId == -1) {
//APPL_DEBUG("******* Regenerate ALL");
generateHighLightAt(0, m_data.size());
} else if(startId <= -1) {
APPL_VERBOSE("******* Regenerate START");
} else if(-1 == startId) {
//APPL_DEBUG("******* Regenerate START");
generateHighLightAt(0, m_HLDataPass1[0].start, 0);
} else if(stopId <= -1) {
APPL_VERBOSE("******* Regenerate STOP");
} else if(-1 == stopId) {
//APPL_DEBUG("******* Regenerate STOP");
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].stop, m_data.size(), m_HLDataPass1.size());
} else {
APPL_VERBOSE("******* Regenerate RANGE");
//APPL_DEBUG("******* Regenerate RANGE");
generateHighLightAt(m_HLDataPass1[startId].stop, m_HLDataPass1[startId+1].start, startId+1);
}
}
@@ -871,7 +854,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
}
void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
if (m_highlight == nullptr) {
if (nullptr == m_highlight) {
return;
}
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
@@ -903,7 +886,7 @@ appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) {
_MData.posHLPass1 = 0;
_MData.posHLPass2 = 0;
if (m_highlight == nullptr) {
if (nullptr == m_highlight) {
return;
}
//int64_t timeStart = ewol::getTime();
@@ -945,10 +928,8 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
m_data);
}
// under section :
APPL_VERBOSE(" == > (under section ) kkk="<<kkk<<" start="<<m_HLDataPass1[kkk].start<<" stop="<<m_HLDataPass1[kkk].stop << " subSectionOfID=" << 99999999);
m_highlight->parseSubElement(m_HLDataPass1[kkk],
_MData.HLData,
m_data);
//APPL_DEBUG(" == > (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
}
if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.size()) {
@@ -1008,24 +989,24 @@ uint32_t appl::Buffer::getCursorLinesId() {
}
namespace etk {
template<> std::string to_string<ememory::SharedPtr<appl::Buffer>>(const ememory::SharedPtr<appl::Buffer>& _obj) {
template<> std::string to_string<std::shared_ptr<appl::Buffer>>(const std::shared_ptr<appl::Buffer>& _obj) {
if (_obj != nullptr) {
return _obj->getFileName();
}
return "";
}
template<> std::u32string to_u32string<ememory::SharedPtr<appl::Buffer>>(const ememory::SharedPtr<appl::Buffer>& _obj) {
template<> std::u32string to_u32string<std::shared_ptr<appl::Buffer>>(const std::shared_ptr<appl::Buffer>& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<ememory::SharedPtr<appl::Buffer>>(ememory::SharedPtr<appl::Buffer>& _variableRet, const std::string& _value) {
template<> bool from_string<std::shared_ptr<appl::Buffer>>(std::shared_ptr<appl::Buffer>& _variableRet, const std::string& _value) {
if (_variableRet != nullptr) {
_variableRet->loadFile(_value);
return true;
}
return false;
}
template<> bool from_string<ememory::SharedPtr<appl::Buffer>>(ememory::SharedPtr<appl::Buffer>& _variableRet, const std::u32string& _value) {
template<> bool from_string<std::shared_ptr<appl::Buffer>>(std::shared_ptr<appl::Buffer>& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> std::string to_string<appl::Buffer>(const appl::Buffer& _obj) {
@@ -1044,8 +1025,3 @@ namespace etk {
}
};
#include <esignal/details/Signal.hxx>
// declare for signal event
ESIGNAL_DECLARE_SIGNAL(ememory::SharedPtr<appl::Buffer>);

View File

@@ -1,18 +1,23 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_BUFFER_H__
#define __APPL_BUFFER_H__
#include <etk/types.h>
#include <etk/os/FSNode.h>
#include <ewol/ewol.h>
#include <etk/Buffer.h>
#include <ewol/object/Object.h>
#include <ewol/widget/Widget.h>
#include <ewol/compositing/Text.h>
#include <appl/Highlight.h>
#include <esignal/Signal.h>
#include <ewol/object/Signal.h>
namespace appl {
@@ -22,9 +27,6 @@ namespace appl {
int64_t posHLPass1;
int64_t posHLPass2;
};
class Buffer;
using BufferShared = ememory::SharedPtr<appl::Buffer>;
using BufferWeak = ememory::WeakPtr<appl::Buffer>;
class Buffer : public ewol::Object {
public:
class Iterator {
@@ -80,7 +82,7 @@ namespace appl {
if (m_data == nullptr) {
return false;
}
if (m_current >= (int64_t)m_data->m_data.size()) {
if (m_current >= m_data->m_data.size()) {
return false;
}
if (m_current < 0) {
@@ -99,8 +101,8 @@ namespace appl {
if (m_current < 0) {
return 0;
}
if (m_current > (int64_t)m_data->m_data.size()) {
return (int64_t)m_data->m_data.size();
if (m_current > m_data->m_data.size()) {
return m_data->m_data.size();
}
return m_current;
};
@@ -222,7 +224,7 @@ namespace appl {
if (m_current < 0) {
return 0;
}
if (m_current >= (int64_t)m_data->m_data.size()) {
if (m_current >= m_data->m_data.size()) {
return m_data->m_data.size()-1;
}
return m_current;
@@ -287,10 +289,10 @@ namespace appl {
friend class Buffer;
};
public:
esignal::Signal<> signalIsModify;
esignal::Signal<> signalIsSave;
esignal::Signal<> signalSelectChange;
esignal::Signal<> signalChangeName;
ewol::object::Signal<void> signalIsModify;
ewol::object::Signal<void> signalIsSave;
ewol::object::Signal<void> signalSelectChange;
ewol::object::Signal<void> signalChangeName;
protected:
Buffer();
void init();
@@ -337,7 +339,7 @@ namespace appl {
* @breif get the status of file modification.
* @return true if file is modify.
*/
bool isModify() const {
bool isModify() {
return m_isModify;
}
/**
@@ -346,9 +348,9 @@ namespace appl {
*/
void setModification(bool _status);
protected:
std::string m_data; //!< copy of the file buffer
etk::Buffer m_data; //!< copy of the file buffer
public:
std::string& getData() {
etk::Buffer& getData() {
return m_data;
};
protected:
@@ -590,7 +592,7 @@ namespace appl {
protected:
std::string m_highlightType; //!< Name of the highlight type
ememory::SharedPtr<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
public:
/**
@@ -622,4 +624,7 @@ namespace appl {
void hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines);
appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos);
};
}
};
#endif

View File

@@ -1,8 +1,11 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <etk/types.h>
#include <etk/os/FSNode.h>
#include <appl/debug.h>
@@ -10,29 +13,35 @@
#include <appl/BufferManager.h>
#include <ewol/object/Object.h>
#include <ewol/object/Manager.h>
#include <esignal/Signal.h>
#include <gale/resource/Manager.h>
#include <ewol/resource/Manager.h>
#undef __class__
#define __class__ "BufferManager"
appl::BufferManager::BufferManager() :
signalNewBuffer(this, "new-buffer", ""),
signalSelectFile(this, "select-buffer", ""),
signalTextSelectionChange(this, "text-selection-change", ""),
signalRemoveBuffer(this, "remove-buffer", "") {
signalNewBuffer(*this, "new-buffer"),
signalSelectFile(*this, "select-buffer"),
signalTextSelectionChange(*this, "text-selection-change"),
signalRemoveBuffer(*this, "remove-buffer") {
addObjectType("appl::BufferManager");
}
void appl::BufferManager::init(const std::string& _uniqueName) {
ewol::Resource::init(_uniqueName);
}
appl::BufferManager::~BufferManager() {
m_list.clear();
}
ememory::SharedPtr<appl::Buffer> appl::BufferManager::createNewBuffer() {
ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
std::shared_ptr<appl::Buffer> appl::BufferManager::createNewBuffer() {
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
if (tmp == nullptr) {
APPL_ERROR("Can not allocate the Buffer (empty).");
return nullptr;
}
tmp->setParent(ewol::Object::sharedFromThis());
tmp->setParent(shared_from_this());
m_list.push_back(tmp);
APPL_INFO("Create a new Buffer");
signalNewBuffer.emit(tmp->getFileName());
@@ -43,7 +52,7 @@ ememory::SharedPtr<appl::Buffer> appl::BufferManager::createNewBuffer() {
return tmp;
}
ememory::SharedPtr<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) {
APPL_INFO("get('" << _fileName << "'," << _createIfNeeded << ")");
for (auto &it : m_list) {
if (it == nullptr) {
@@ -54,17 +63,17 @@ ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(const std::string& _fi
}
}
if (_createIfNeeded == true) {
if (etk::FSNodeGetType(_fileName) == etk::typeNode_folder) {
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) {
APPL_WARNING("try open a folder : " << _fileName);
APPL_CRITICAL("plop");
return nullptr;
}
ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
if (tmp == nullptr) {
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
return nullptr;
}
tmp->setParent(ewol::Object::sharedFromThis());
tmp->setParent(shared_from_this());
tmp->loadFile(_fileName);
m_list.push_back(tmp);
APPL_INFO("Creata a open Buffer");
@@ -75,20 +84,18 @@ ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(const std::string& _fi
return nullptr;
}
void appl::BufferManager::setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected) {
void appl::BufferManager::setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected) {
m_bufferSelected = _bufferSelected;
if (m_bufferSelected == nullptr) {
APPL_ERROR("select a NULL buffer ...");
propertySetOnWidgetNamed("appl-widget-display-name", "value", "---");
return;
}
APPL_INFO("Set buffer selected");
//signalSelectFile.emit(m_bufferSelected->getName());
//propertySetOnWidgetNamed("appl-widget-display-name", "value", m_bufferSelected->getName());
APPL_INFO("Set buffer selected (done)");
}
ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
std::shared_ptr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
int32_t id = 0;
for (auto &it : m_list) {
if (id == _id) {
@@ -115,7 +122,6 @@ void appl::BufferManager::open(const std::string& _fileName) {
if (exist(_fileName) == true) {
APPL_WARNING(" the element '" << _fileName << "' already exist ... just reselect it ...");
signalSelectFile.emit(_fileName);
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(_fileName));
return;
}
if (get(_fileName, true) == nullptr) {
@@ -123,10 +129,10 @@ void appl::BufferManager::open(const std::string& _fileName) {
return;
}
signalSelectFile.emit(_fileName);
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(_fileName));
}
void appl::BufferManager::requestDestroyFromChild(const ememory::SharedPtr<Object>& _child) {
void appl::BufferManager::requestDestroyFromChild(const std::shared_ptr<Object>& _child) {
APPL_WARNING("Buffer request a close...");
bool find = false;
int32_t newValue = -1;
@@ -145,28 +151,11 @@ void appl::BufferManager::requestDestroyFromChild(const ememory::SharedPtr<Objec
++it;
}
if (find == true) {
signalRemoveBuffer.emit(ememory::dynamicPointerCast<appl::Buffer>(_child));
signalRemoveBuffer.emit(std::dynamic_pointer_cast<appl::Buffer>(_child));
}
if (m_bufferSelected == _child) {
if ( it != m_list.end()
&& *it != nullptr) {
APPL_VERBOSE("Remove buffer select new one");
signalSelectFile.emit((*it)->getFileName());
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName((*it)->getFileName()));
APPL_VERBOSE("Remove buffer select new one (done)");
return;
}
if ( m_list.size() != 0
&& m_list.back() != nullptr) {
APPL_VERBOSE("Remove buffer select new one (last)");
signalSelectFile.emit(m_list.back()->getFileName());
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(m_list.back()->getFileName()));
APPL_VERBOSE("Remove buffer select new one (done)");
return;
}
APPL_ERROR("is selected");
signalSelectFile.emit("");
propertySetOnWidgetNamed("appl-widget-display-name", "value", "---");
m_bufferSelected = nullptr;
}
}

View File

@@ -1,34 +1,35 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __BUFFER_MANAGER_H__
#define __BUFFER_MANAGER_H__
#include <list>
#include <appl/Buffer.h>
#include <appl/globalMsg.h>
#include <ewol/widget/Widget.h>
#include <gale/resource/Resource.h>
#include <ewol/resource/Resource.h>
namespace appl {
class BufferManager;
using BufferManagerShared = ememory::SharedPtr<appl::BufferManager>;
using BufferManagerWeak = ememory::WeakPtr<appl::BufferManager>;
// TODO: This is a service ...
class BufferManager : public ewol::Object {
class BufferManager : public ewol::Resource {
public:
esignal::Signal<std::string> signalNewBuffer;
esignal::Signal<std::string> signalSelectFile;
esignal::Signal<> signalTextSelectionChange;
esignal::Signal<ememory::SharedPtr<appl::Buffer>> signalRemoveBuffer;
ewol::object::Signal<std::string> signalNewBuffer;
ewol::object::Signal<std::string> signalSelectFile;
ewol::object::Signal<void> signalTextSelectionChange;
ewol::object::Signal<std::shared_ptr<appl::Buffer>> signalRemoveBuffer;
protected:
BufferManager();
void init(const std::string& _uniqueName);
public:
DECLARE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
DECLARE_RESOURCE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
virtual ~BufferManager();
private:
std::list<ememory::SharedPtr<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:
/**
* @brief Get a specific buffer with his name (can create a new buffer).
@@ -36,7 +37,7 @@ namespace appl {
* @param[in] _createIfNeeded Create the buffer if not existed.
* @return a pointer on the buffer
*/
ememory::SharedPtr<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:
* @param[in] _fileName Name of the file to open or create.
@@ -60,44 +61,31 @@ namespace appl {
* @param[in] _id Number of buffer
* @return pointer on the buffer
*/
ememory::SharedPtr<appl::Buffer> get(int32_t _id);
std::shared_ptr<appl::Buffer> get(int32_t _id);
/**
* @brief Create a new buffer empty.
* @return Created buffer or nullptr.
*/
ememory::SharedPtr<appl::Buffer> createNewBuffer();
std::shared_ptr<appl::Buffer> createNewBuffer();
private:
ememory::SharedPtr<appl::Buffer> m_bufferSelected;
std::shared_ptr<appl::Buffer> m_bufferSelected;
public:
/**
* @brief Set the current buffer selected
* @param[in] _bufferSelected Pointer on the buffer selected
*/
void setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected);
void setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected);
/**
* @brief Get the current buffer selected
* @return Pointer on the buffer selected
*/
ememory::SharedPtr<appl::Buffer> getBufferSelected() {
std::shared_ptr<appl::Buffer> getBufferSelected() {
return m_bufferSelected;
};
private:
void requestDestroyFromChild(const ememory::SharedPtr<Object>& _child);
public:
// generic iterators:
std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator begin() const {
return m_list.begin();
}
std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator end() const {
return m_list.end();
}
std::list<ememory::SharedPtr<appl::Buffer>>::iterator begin() {
return m_list.begin();
}
std::list<ememory::SharedPtr<appl::Buffer>>::iterator end() {
return m_list.end();
}
void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
};
}
};
#endif

View File

@@ -1,40 +1,51 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/GlyphDecoration.h>
#undef __class__
#define __class__ "GlyphDecoration"
appl::GlyphDecoration::GlyphDecoration(const std::string &_newColorName) :
m_colorName(_newColorName),
m_colorFG(etk::color::black),
m_colorBG(etk::color::none),
m_italic(false),
m_bold(false) {
APPL_VERBOSE("create");
m_bold(false)
{
APPL_VERBOSE("New(" << __class__ << ")");
}
void appl::GlyphDecoration::setItalic(bool _enable) {
void appl::GlyphDecoration::setItalic(bool _enable)
{
m_italic = _enable;
if (_enable == true) {
if (true == _enable) {
APPL_VERBOSE("color : \"" << m_colorName << "\" enable italic");
} else {
APPL_VERBOSE("color : \"" << m_colorName << "\" disable italic");
}
}
void appl::GlyphDecoration::setBold(bool _enable) {
void appl::GlyphDecoration::setBold(bool _enable)
{
m_bold = _enable;
if (_enable == true) {
if (true == _enable) {
APPL_VERBOSE("color : \"" << m_colorName << "\" enable bold");
} else {
APPL_VERBOSE("color : \"" << m_colorName << "\" disable bold");
}
}
std::ostream& appl::operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj) {
std::ostream& appl::operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj)
{
_os << "{fg=" << _obj.getForeground();
_os << ",bg=" << _obj.getBackground();
_os << ",italic=" << _obj.getItalic();

View File

@@ -1,9 +1,13 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __GLYPH_DECORATION_H__
#define __GLYPH_DECORATION_H__
#include <etk/Color.h>
#include <etk/types.h>
@@ -115,4 +119,6 @@ namespace appl {
std::ostream& operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj);
}
#endif

View File

@@ -1,23 +1,30 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/GlyphPainting.h>
#include <ejson/ejson.h>
#include <etk/os/FSNode.h>
#include <gale/resource/Manager.h>
#include <ewol/resource/Manager.h>
#undef __class__
#define __class__ "GlyphPainting"
appl::GlyphPainting::GlyphPainting() {
addResourceType("appl::GlyphPainting");
addObjectType("appl::GlyphPainting");
}
void appl::GlyphPainting::init(const std::string& _filename) {
gale::Resource::init(_filename);
APPL_DEBUG("SFP : load \"" << _filename << "\"");
ewol::Resource::init(_filename);
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
reload();
}
@@ -27,7 +34,7 @@ appl::GlyphPainting::~GlyphPainting() {
void appl::GlyphPainting::reload() {
ejson::Document doc;
if (doc.load(m_name) == false) {
if (false == doc.load(m_name)) {
APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName());
return;
}
@@ -38,22 +45,22 @@ void appl::GlyphPainting::reload() {
doc.generate(tmppppp);
APPL_DEBUG(tmppppp);
*/
ejson::Array baseArray = doc["ednColor"].toArray();
if (baseArray.exist() == false) {
ejson::Array* baseArray = doc.getArray("ednColor");
if (baseArray == nullptr) {
APPL_ERROR("Can not get basic array : 'ednColor'");
return;
}
for (const auto it : baseArray) {
ejson::Object tmpObj = it.toObject();
if (tmpObj.exist() == false) {
APPL_DEBUG(" can not get object in 'ednColor' it=" << it);
for (size_t iii = 0; iii < baseArray->size(); ++iii) {
ejson::Object* tmpObj = baseArray->getObject(iii);
if (tmpObj == nullptr) {
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
continue;
}
std::string name = tmpObj["name"].toString().get();
std::string background = tmpObj["background"].toString().get("#FFF0");
std::string foreground = tmpObj["foreground"].toString().get("#000F");
bool italic = tmpObj["italic"].toBoolean().get(false);
bool bold = tmpObj["bold"].toBoolean().get(false);
std::string name = tmpObj->getStringValue("name", "");
std::string background = tmpObj->getStringValue("background", "#FFF0");
std::string foreground = tmpObj->getStringValue("foreground", "#000F");
bool italic = tmpObj->getBooleanValue("italic", false);
bool bold = tmpObj->getBooleanValue("bold", false);
APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'");
bool findElement = false;
for (size_t jjj=0; jjj<m_list.size(); ++jjj) {

View File

@@ -1,17 +1,21 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_GLYPH_PAINTING_H__
#define __APPL_GLYPH_PAINTING_H__
#include <etk/types.h>
#include <ewol/debug.h>
#include <gale/resource/Resource.h>
#include <ewol/resource/Resource.h>
#include <appl/GlyphDecoration.h>
namespace appl {
class GlyphPainting : public gale::Resource {
class GlyphPainting : public ewol::Resource {
private:
std::vector<appl::GlyphDecoration> m_list;
protected:
@@ -48,6 +52,7 @@ namespace appl {
return m_list[_pos];
}
};
}
};
#endif

View File

@@ -1,8 +1,11 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/Gui/BufferView.h>
@@ -11,6 +14,9 @@
#include <appl/Gui/MainWindows.h>
#include <ewol/object/Object.h>
#undef __class__
#define __class__ "BufferView"
// TODO : write it better
static void SortElementList(std::vector<appl::dataBufferStruct>& _list) {
std::vector<appl::dataBufferStruct> tmpList = _list;
@@ -31,6 +37,7 @@ static void SortElementList(std::vector<appl::dataBufferStruct>& _list) {
BufferView::BufferView() :
m_openOrderMode(false) {
addObjectType("appl::BufferView");
setCanHaveFocus(true);
m_selectedID = -1;
m_selectedIdRequested = -1;
// load buffer manager:
@@ -47,12 +54,10 @@ BufferView::BufferView() :
void BufferView::init() {
ewol::widget::List::init();
propertyHide.set(true);
propertyCanFocus.set(true);
if (m_bufferManager != nullptr) {
m_bufferManager->signalNewBuffer.connect(sharedFromThis(), &BufferView::onCallbackNewBuffer);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &BufferView::onCallbackselectNewFile);
m_bufferManager->signalRemoveBuffer.connect(sharedFromThis(), &BufferView::onCallbackBufferRemoved);
m_bufferManager->signalNewBuffer.bind(shared_from_this(), &BufferView::onCallbackNewBuffer);
m_bufferManager->signalSelectFile.bind(shared_from_this(), &BufferView::onCallbackselectNewFile);
m_bufferManager->signalRemoveBuffer.bind(shared_from_this(), &BufferView::onCallbackBufferRemoved);
}
}
@@ -82,27 +87,20 @@ void BufferView::insertAlphabetic(const appl::dataBufferStruct& _dataStruct, boo
}
void BufferView::onCallbackNewBuffer(const std::string& _value) {
ememory::SharedPtr<appl::Buffer> buffer = m_bufferManager->get(_value);
std::shared_ptr<appl::Buffer> buffer = m_bufferManager->get(_value);
if (buffer == nullptr) {
APPL_ERROR("event on element nor exist : " << _value);
return;
}
buffer->signalIsSave.connect(sharedFromThis(), &BufferView::onCallbackIsSave);
buffer->signalIsModify.connect(sharedFromThis(), &BufferView::onCallbackIsModify);
buffer->signalChangeName.connect(sharedFromThis(), &BufferView::onCallbackChangeName);
buffer->signalIsSave.bind(shared_from_this(), &BufferView::onCallbackIsSave);
buffer->signalIsModify.bind(shared_from_this(), &BufferView::onCallbackIsModify);
buffer->signalChangeName.bind(shared_from_this(), &BufferView::onCallbackChangeName);
appl::dataBufferStruct tmp(_value, buffer);
if (m_openOrderMode == true) {
m_list.push_back(tmp);
} else {
insertAlphabetic(tmp);
}
if (m_list.size() <= 1) {
propertyHide.set(true);
propertySetOnWidgetNamed("appl-Buffer-viewer-separator", "hide", "true");
} else {
propertyHide.set(false);
propertySetOnWidgetNamed("appl-Buffer-viewer-separator", "hide", "false");
}
markToRedraw();
}
@@ -138,7 +136,7 @@ void BufferView::onCallbackChangeName() {
markToRedraw();
}
void BufferView::onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>& _buffer) {
void BufferView::onCallbackBufferRemoved(const std::shared_ptr<appl::Buffer>& _buffer) {
APPL_ERROR("request remove buffer:");
auto it = m_list.begin();
while (it != m_list.end()) {
@@ -149,11 +147,6 @@ void BufferView::onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>&
++it;
}
}
if (m_list.size() <= 1) {
propertyHide.set(true);
} else {
propertyHide.set(false);
}
markToRedraw();
}
void BufferView::onCallbackIsSave() {
@@ -206,8 +199,8 @@ bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextT
return true;
}
bool BufferView::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
if (1 == _IdInput && _typeEvent == gale::key::status::pressSingle) {
bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) {
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
if( _raw >= 0
&& _raw<(int64_t)m_list.size()) {

View File

@@ -1,9 +1,13 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __BUFFER_VIEW_H__
#define __BUFFER_VIEW_H__
#include <appl/debug.h>
#include <appl/BufferManager.h>
@@ -15,8 +19,8 @@ namespace appl {
class dataBufferStruct {
public:
etk::FSNode m_bufferName;
ememory::SharedPtr<appl::Buffer> m_buffer;
dataBufferStruct(const std::string& _bufferName, const ememory::SharedPtr<appl::Buffer>& _buffer) :
std::shared_ptr<appl::Buffer> m_buffer;
dataBufferStruct(const std::string& _bufferName, const std::shared_ptr<appl::Buffer>& _buffer) :
m_bufferName(_bufferName),
m_buffer(_buffer) {
@@ -25,14 +29,11 @@ namespace appl {
};
};
class BufferView;
using BufferViewShared = ememory::SharedPtr<BufferView>;
using BufferViewWeak = ememory::WeakPtr<BufferView>;
class BufferView : public ewol::widget::List {
private:
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
private:
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground1;
int32_t m_colorBackground2;
int32_t m_colorBackgroundSelect;
@@ -65,13 +66,17 @@ class BufferView : public ewol::widget::List {
virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
virtual uint32_t getNuberOfRaw();
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 gale::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);
private: //callback function:
void onCallbackChangeName();
void onCallbackIsSave();
void onCallbackIsModify();
void onCallbackNewBuffer(const std::string& _value);
void onCallbackselectNewFile(const std::string& _value);
void onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>& _buffer);
void onCallbackBufferRemoved(const std::shared_ptr<appl::Buffer>& _buffer);
};
#endif

View File

@@ -1,8 +1,12 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/Gui/MainWindows.h>
@@ -26,6 +30,7 @@
#include <ewol/widget/Manager.h>
#include <ewol/object/Object.h>
#include <ewol/context/Context.h>
#include <date/date.h>
#include <ewol/widget/meta/StdPopUp.h>
#include <appl/Gui/WorkerSaveFile.h>
#include <appl/Gui/WorkerSaveAllFile.h>
@@ -34,11 +39,21 @@
namespace appl {
std::string getVersion() {
return APPL_VERSION;
#define FIRST_YEAR (2010)
std::string tmpOutput = etk::to_string(date::getYear()-FIRST_YEAR);
tmpOutput += ".";
tmpOutput += etk::to_string(date::getMonth());
tmpOutput += ".";
tmpOutput += etk::to_string(date::getDay());
return tmpOutput;
}
}
#undef __class__
#define __class__ "AboutGui"
#include <ewol/widget/Label.h>
#include <ewol/widget/Spacer.h>
@@ -48,21 +63,31 @@ class ParameterAboutGui : public ewol::widget::Sizer {
addObjectType("appl::ParameterAboutGui");
}
void init() {
propertyMode.setDirectCheck(ewol::widget::Sizer::modeVert);
ewol::widget::Sizer::init();
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
std::shared_ptr<ewol::widget::Spacer> mySpacer;
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == nullptr) {
if (nullptr == mySpacer) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->propertyExpand.set(bvec2(true,true));
mySpacer->setExpand(bvec2(true,true));
subWidgetAdd(mySpacer);
}
std::string tmpLabel = "<left>";
tmpLabel += " <b>Editeur De N'ours</b> : v:";
tmpLabel += appl::getVersion();
tmpLabel += "<br/>";
tmpLabel += " <b>Build Time</b> : ";
tmpLabel += date::getYear();
tmpLabel += "/";
tmpLabel += date::getMonth();
tmpLabel += "/";
tmpLabel += date::getDay();
tmpLabel += " ";
tmpLabel += date::getHour();
tmpLabel += "h";
tmpLabel += date::getMinute();
tmpLabel += "<br/>";
tmpLabel += " <b>Website</b> : https://github.com/HeeroYui/edn<br/>";
tmpLabel += " <b>License</b> : GPL v3<br/>";
tmpLabel += " <b>Copyright</b> : 2010 Edouard DUPIN<br/>";
@@ -71,12 +96,11 @@ class ParameterAboutGui : public ewol::widget::Sizer {
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
tmpLabel += "</left>";
ememory::SharedPtr<ewol::widget::Label> myLabel = ewol::widget::Label::create();
if (myLabel == nullptr) {
std::shared_ptr<ewol::widget::Label> myLabel = ewol::widget::Label::create(tmpLabel);
if (nullptr == myLabel) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myLabel->propertyValue.set(tmpLabel);
myLabel->propertyExpand.set(bvec2(true,false));
myLabel->setExpand(bvec2(true,false));
subWidgetAdd(myLabel);
}
};
@@ -85,6 +109,18 @@ class ParameterAboutGui : public ewol::widget::Sizer {
};
};
// Local main windows event :
static const char* mainWindowsRequestSaveFile = "appl-event-main-windows-save-file";
static const char* mainWindowsRequestSaveFileAs = "appl-event-main-windows-save-file-as";
static const char* mainWindowsRequestcloseFileNoCheck = "appl-event-main-windows-close-file-no-check";
static const char* l_MsgNameGuiChangeShape = "appl-event-main-windows-Change-shape";
const char* l_smoothChick = "tmpEvent_smooth";
const char* l_smoothMin = "tmpEvent_minChange";
const char* l_smoothMax = "tmpEvent_maxChange";
#undef __class__
#define __class__ "MainWindows"
MainWindows::MainWindows() {
addObjectType("appl::MainWindows");
@@ -93,123 +129,90 @@ MainWindows::MainWindows() {
void MainWindows::init() {
ewol::widget::Windows::init();
APPL_DEBUG("CREATE WINDOWS ... ");
ewol::widget::SizerShared mySizerVert;
ewol::widget::SizerShared mySizerVert2;
ewol::widget::SizerShared mySizerHori;
ememory::SharedPtr<appl::TextViewer> myTextView;
ememory::SharedPtr<appl::TextViewer> myTextView2;
ememory::SharedPtr<BufferView> myBufferView;
ewol::widget::MenuShared myMenu;
std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr;
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = nullptr;
std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
std::shared_ptr<appl::TextViewer> myTextView = nullptr;
std::shared_ptr<BufferView> myBufferView = nullptr;
std::shared_ptr<ewol::widget::Menu> myMenu = nullptr;
// load buffer manager:
m_bufferManager = appl::BufferManager::create();
m_viewerManager = appl::ViewerManager::create();
mySizerVert = ewol::widget::Sizer::create();
mySizerVert->propertyName.set("plop 1111111");
mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
mySizerVert->setName("plop 1111111");
setSubWidget(mySizerVert);
mySizerHori = ewol::widget::Sizer::create();
mySizerHori->propertyName.set("plop 222222222");
mySizerHori->propertyMode.set(ewol::widget::Sizer::modeHori);
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
mySizerHori->setName("plop 222222222");
mySizerVert->subWidgetAdd(mySizerHori);
myBufferView = BufferView::create();
myBufferView->propertyName.set("plop 3333333");
myBufferView->propertyExpand.set(bvec2(false,true));
myBufferView->propertyFill.set(bvec2(true,true));
myBufferView->setName("plop 3333333");
myBufferView->setExpand(bvec2(false,true));
myBufferView->setFill(bvec2(true,true));
mySizerHori->subWidgetAdd(myBufferView);
ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();
mySpacer->propertyName.set("appl-Buffer-viewer-separator");
mySpacer->propertyColor.set(etk::color::black);
mySpacer->propertyMinSize.set(gale::Dimension(vec2(2,2), gale::distance::pixel));
mySpacer->propertyExpand.set(bvec2(false,true));
mySpacer->propertyFill.set(bvec2(true,true));
mySpacer->propertyHide.set(true);
mySizerHori->subWidgetAdd(mySpacer);
mySizerVert2 = ewol::widget::Sizer::create();
mySizerVert2->propertyMode.set(ewol::widget::Sizer::modeVert);
mySizerVert2 = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
mySizerHori->subWidgetAdd(mySizerVert2);
mySizerVert2->propertyName.set("appl-view-code-sizer");
mySizerVert2->setName("plop 4444444");
// main buffer Area :
#if defined(__TARGET_OS__Android)
int32_t sizeText = 16;
myTextView = appl::TextViewer::create("FreeMono;DejaVuSansMono;FreeSerif", 16);
#else
int32_t sizeText = 11;
myTextView = appl::TextViewer::create("FreeMono;DejaVuSansMono;FreeSerif", 11);
#endif
myTextView2 = appl::TextViewer::create("font-size", sizeText);
myTextView2->propertyName.set("appl-text-viewer2");
myTextView2->propertyExpand.set(bvec2(true,true));
myTextView2->propertyFill.set(bvec2(true,true));
myTextView2->propertyHide.set(true);
mySizerVert2->subWidgetAdd(myTextView2);
mySpacer = ewol::widget::Spacer::create();
mySpacer->propertyName.set("appl-text-separator");
mySpacer->propertyColor.set(etk::color::black);
mySpacer->propertyMinSize.set(gale::Dimension(vec2(2,2), gale::distance::pixel));
mySpacer->propertyExpand.set(bvec2(true,false));
mySpacer->propertyFill.set(bvec2(true,true));
mySpacer->propertyHide.set(true);
mySizerVert2->subWidgetAdd(mySpacer);
myTextView = appl::TextViewer::create("font-size", sizeText);
myTextView->propertyName.set("appl-text-viewer1");
myTextView->propertyExpand.set(bvec2(true,true));
myTextView->propertyFill.set(bvec2(true,true));
myTextView->setName("appl-text-viewer");
myTextView->setExpand(bvec2(true,true));
myTextView->setFill(bvec2(true,true));
mySizerVert2->subWidgetAdd(myTextView);
// search area:
/*
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11);
myTextView->setExpand(bvec2(true,true));
myTextView->setFill(bvec2(true,true));
mySizerVert2->subWidgetAdd(myTextView);
*/
// search area :
m_widgetSearch = appl::widget::Search::create();
mySizerVert2->subWidgetAdd(m_widgetSearch);
mySizerHori = ewol::widget::Sizer::create();
mySizerHori->propertyName.set("plop 555555");
mySizerHori->propertyMode.set(ewol::widget::Sizer::modeHori);
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
mySizerHori->setName("plop 555555");
mySizerVert->subWidgetAdd(mySizerHori);
myMenu = ewol::widget::Menu::create();
myMenu->propertyName.set("appl-menu-interface");
myMenu->setName("appl-menu-interface");
mySizerHori->subWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->addTitle("_T{File}");
myMenu->add(idMenuFile, "_T{New}", "", "menu:new");
int32_t idMenuFile = myMenu->addTitle("File");
myMenu->add(idMenuFile, "New", "", "menu:new");
myMenu->addSpacer();
myMenu->add(idMenuFile, "_T{Open}", "THEME:GUI:Load.edf", "menu:open");
myMenu->add(idMenuFile, "_T{Close}", "THEME:GUI:Close.edf", "menu:close");
myMenu->add(idMenuFile, "_T{Close (all)}", "", "menu:close-all");
myMenu->add(idMenuFile, "_T{Save}", "THEME:GUI:Save.edf", "menu:save");
myMenu->add(idMenuFile, "_T{Save As ...}", "", "menu:save-as");
myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", "menu:open");
myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", "menu:close");
myMenu->add(idMenuFile, "Close (all)", "", "menu:close-all");
myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", "menu:save");
myMenu->add(idMenuFile, "Save As ...", "", "menu:save-as");
myMenu->addSpacer();
myMenu->add(idMenuFile, "_T{Properties}", "THEME:GUI:Parameter.edf", "menu:property");
int32_t idMenuEdit = myMenu->addTitle("_T{Edit}");
myMenu->add(idMenuEdit, "_T{Goto line ...}","", "menu:goto-line");
int32_t idMenuSearch = myMenu->addTitle("_T{Search}");
myMenu->add(idMenuSearch, "_T{Search}", "THEME:GUI:Search.edf", "menu:search");
myMenu->add(idMenuSearch, "_T{Replace}", "THEME:GUI:Replace.edf", "menu:replace");
myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", "menu:property");
int32_t idMenuEdit = myMenu->addTitle("Edit");
myMenu->add(idMenuEdit, "Goto line ...","", "menu:goto-line");
int32_t idMenuSearch = myMenu->addTitle("Search");
myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", "menu:search");
myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", "menu:replace");
myMenu->addSpacer();
myMenu->add(idMenuSearch, "_T{Find (previous)}","", "menu:find:previous");
myMenu->add(idMenuSearch, "_T{Find (next)}", "", "menu:find:next");
myMenu->add(idMenuSearch, "_T{Find (all)}", "", "menu:find:all");
myMenu->add(idMenuSearch, "_T{Un-Select}", "", "menu:find:none");
int32_t idMenugDisplay = myMenu->addTitle("_T{Display}");
myMenu->add(idMenugDisplay, "_T{Color Black}", "", "menu:color:color/black/");
myMenu->add(idMenugDisplay, "_T{Color White}", "", "menu:color:color/white/");
myMenu->add(idMenugDisplay, "_T{Shape square}", "", "menu:shape:shape/square/");
myMenu->add(idMenugDisplay, "_T{Shape round}", "", "menu:shape:shape/round/");
myMenu->add(idMenuSearch, "Find (previous)","", "menu:find:previous");
myMenu->add(idMenuSearch, "Find (next)", "", "menu:find:next");
myMenu->add(idMenuSearch, "Find (all)", "", "menu:find:all");
myMenu->add(idMenuSearch, "Un-Select", "", "menu:find:none");
int32_t idMenugDisplay = myMenu->addTitle("Display");
myMenu->add(idMenugDisplay, "Color Black", "", "menu:color:color/black/");
myMenu->add(idMenugDisplay, "Color White", "", "menu:color:color/white/");
myMenu->add(idMenugDisplay, "Shape square", "", "menu:shape:shape/square/");
myMenu->add(idMenugDisplay, "Shape round", "", "menu:shape:shape/round/");
myMenu->addSpacer();
myMenu->add(idMenugDisplay, "_T{Reload openGl Shader}", "", "menu:reloadShape");
myMenu->addSpacer();
myMenu->add(idMenugDisplay, "_T{Split}", "", "menu:split:enable");
myMenu->add(idMenugDisplay, "_T{Unsplit}", "", "menu:split:disable");
myMenu->add(idMenugDisplay, "_T{Vertical}", "", "menu:split:vert");
myMenu->add(idMenugDisplay, "_T{Horizontal}", "", "menu:split:hori");
myMenu->signalSelect.connect(sharedFromThis(), &MainWindows::onCallbackMenuEvent);
m_widgetLabelFileName = ewol::widget::Label::create();
m_widgetLabelFileName->propertyValue.set("FileName");
m_widgetLabelFileName->propertyName.set("appl-widget-display-name");
m_widgetLabelFileName->propertyExpand.set(bvec2(true,false));
m_widgetLabelFileName->propertyFill.set(bvec2(true,false));;
myMenu->add(idMenugDisplay, "Reload openGl Shader", "", "menu:reloadShape");
myMenu->signalSelect.bind(shared_from_this(), &MainWindows::onCallbackMenuEvent);
m_widgetLabelFileName = ewol::widget::Label::create("FileName");
m_widgetLabelFileName->setExpand(bvec2(true,false));
m_widgetLabelFileName->setFill(bvec2(true,false));;
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
// add generic shortcut ...
@@ -226,9 +229,9 @@ void MainWindows::init() {
shortCutAdd("ctrl+f", "menu:search");
shortCutAdd("F12", "menu:reloade-shader");
// TODO : auto-connect on shortcut event ==> maybe do beter later ...
signalShortcut.connect(sharedFromThis(), &MainWindows::onCallbackShortCut);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &MainWindows::onCallbackselectNewFile);
// TODO : auto-bind on shortcut event ==> maybe do beter later ...
signalShortcut.bind(shared_from_this(), &MainWindows::onCallbackShortCut);
m_bufferManager->signalSelectFile.bind(shared_from_this(), &MainWindows::onCallbackShortCut);
}
@@ -236,6 +239,8 @@ MainWindows::~MainWindows() {
}
void MainWindows::onCallbackShortCut(const std::string& _value) {
APPL_WARNING("Event from ShortCut : " << _value);
onCallbackMenuEvent(_value);
@@ -250,7 +255,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
} else if (_value == "menu:open") {
displayOpen();
} else if (_value == "menu:close") {
ememory::SharedPtr<appl::WorkerCloseFile> worker = appl::WorkerCloseFile::create();
std::shared_ptr<appl::WorkerCloseFile> worker = appl::WorkerCloseFile::create();
worker->startAction("");
} else if (_value == "menu:close-all") {
appl::WorkerCloseAllFile::create();
@@ -266,41 +271,21 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
if (m_widgetSearch == nullptr) {
return;
}
if (m_widgetSearch->propertyHide.get() == true) {
m_widgetSearch->propertyHide.set(false);
if (m_widgetSearch->isHide()) {
m_widgetSearch->show();
m_widgetSearch->selectSearch();
} else {
if (m_widgetSearch->isSelectSearch()) {
m_widgetSearch->propertyHide.set(true);
if (m_viewerManager != nullptr) {
ememory::SharedPtr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
}
} else {
m_widgetSearch->selectSearch();
}
m_widgetSearch->hide();
}
} else if (_value == "menu:replace") {
if (m_widgetSearch == nullptr) {
return;
}
if (m_widgetSearch->propertyHide.get() == true) {
m_widgetSearch->propertyHide.set(false);
if (m_widgetSearch->isHide()) {
m_widgetSearch->show();
m_widgetSearch->selectReplace();
} else {
if (m_widgetSearch->isSelectReplace()) {
m_widgetSearch->propertyHide.set(true);
if (m_viewerManager != nullptr) {
ememory::SharedPtr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
}
} else {
m_widgetSearch->selectReplace();
}
m_widgetSearch->hide();
}
} else if (_value == "menu:find:previous") {
APPL_TODO("Event from Menu : " << _value);
@@ -312,34 +297,17 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_TODO("Event from Menu : " << _value);
} else if ( _value == "menu:color:color/black/"
|| _value == "menu:color:color/white/") {
etk::theme::setName("COLOR", std::string(_value, 11));
EWOL_ERROR("Select Shape or Color : 'COLOR'='" << std::string(_value, 11) << "'");
etk::theme::setName("COLOR", std::string(_value, 12));
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if ( _value == "menu:shape:shape/square/"
|| _value == "menu:shape:shape/round/") {
EWOL_ERROR("Select Shape or Color : 'GUI'='" << std::string(_value, 11) << "'");
etk::theme::setName("GUI", std::string(_value, 11));
etk::theme::setName("GUI", std::string(_value, 12));
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_value == "menu:reloadShape") {
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_value == "menu:split:enable") {
propertySetOnWidgetNamed("appl-text-viewer2", "hide", "false");
propertySetOnWidgetNamed("appl-text-separator", "hide", "false");
} else if (_value == "menu:split:disable") {
propertySetOnWidgetNamed("appl-text-viewer2", "hide", "true");
propertySetOnWidgetNamed("appl-text-separator", "hide", "true");
} else if (_value == "menu:split:vert") {
propertySetOnWidgetNamed("appl-view-code-sizer", "mode", "vert");
propertySetOnWidgetNamed("appl-text-separator", "expand", "true,false");
} else if (_value == "menu:split:hori") {
propertySetOnWidgetNamed("appl-view-code-sizer", "mode", "hori");
propertySetOnWidgetNamed("appl-text-separator", "expand", "false,true");
} else if (_value == "menu:reloade-shader") {
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else {
APPL_ERROR("Event from Menu UNKNOW : '" << _value << "'");
}
@@ -350,7 +318,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return;
}
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData());
return;
@@ -369,7 +337,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return;
}
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData());
return;
@@ -380,7 +348,7 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return;
}
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData());
return;
@@ -392,60 +360,77 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
*/
void MainWindows::displayOpen() {
ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not open File chooser !!! ");
return;
}
tmpWidget->propertyLabelTitle.set("_T{Open files ...}");
tmpWidget->propertyLabelValidate.set("_T{Open}");
tmpWidget->setTitle("Open files ...");
tmpWidget->setValidateLabel("Open");
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
// Get a ref on the buffer selected (if null, no buffer was selected ...)
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != nullptr) {
etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->propertyPath.set(tmpFile.getNameFolder());
tmpWidget->setFolder(tmpFile.getNameFolder());
}
// apply widget pop-up ...
popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.connect(sharedFromThis(), &MainWindows::onCallbackPopUpFileSelected);
tmpWidget->signalValidate.bind(shared_from_this(), &MainWindows::onCallbackPopUpFileSelected);
}
void MainWindows::displayProperty() {
// Request the parameter GUI
ememory::SharedPtr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
if (tmpWidget == nullptr) {
std::shared_ptr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
if (nullptr == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
return;
}
#if 0
} else {
#ifdef SDGSDFGSDFGSDFGSDFGSTERGDHFGHFDS
std::string menuDescription = "<title>Properties</title>\n";
menuDescription += "<group title='_T{Editor}'>\n";
menuDescription += " <menu title='_T{Editor Interface}' short-title='Editor' widget='appl-text-viewer'>\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 title='_T{Gui}'>\n";
menuDescription += " <menu title='Font selection' short-title='Font' widget=''>\n";
menuDescription += " <menu title='Color selection' short-title='Color' widget=''>\n";
menuDescription += " <menu title='Theme selection' short-title='Theme' widget=''>\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);
#else
tmpWidget->propertyLabelTitle.set("_T{Properties}");
popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("_T{Editor}");
ememory::SharedPtr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
tmpWidget->menuAdd("_T{Editor}", "", tmpSubWidget);
tmpWidget->menuAdd("_T{Font & Color}", "", nullptr);
tmpWidget->menuAdd("_T{Highlight}", "", nullptr);
tmpWidget->menuAddGroup("_T{General}");
tmpWidget->menuAdd("_T{Display}", "", nullptr);
tmpSubWidget = ParameterAboutGui::create();
tmpWidget->menuAdd("_T{About}", "", tmpSubWidget);
#endif
tmpWidget->setTitle("Properties");
popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("Editor");
std::shared_ptr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
tmpWidget->menuAdd("Font & Color", "", nullptr);
tmpWidget->menuAdd("Highlight", "", nullptr);
tmpWidget->menuAddGroup("General");
tmpWidget->menuAdd("Display", "", nullptr);
tmpSubWidget = ParameterAboutGui::create();
tmpWidget->menuAdd("About", "", tmpSubWidget);
}
}
void MainWindows::onCallbackselectNewFile(const std::string& _value) {
@@ -454,15 +439,13 @@ void MainWindows::onCallbackselectNewFile(const std::string& _value) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
m_connectionSave.disconnect();
m_connectionModify.disconnect();
m_connectionSaveName.disconnect();
// TODO : Remove all previous binding from the old buffer ...
onCallbackTitleUpdate();
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp != nullptr) {
m_connectionSave = tmpp->signalIsSave.connect(this, &MainWindows::onCallbackTitleUpdate);
m_connectionModify = tmpp->signalIsModify.connect(this, &MainWindows::onCallbackTitleUpdate);
m_connectionSaveName = tmpp->signalChangeName.connect(this, &MainWindows::onCallbackTitleUpdate);
tmpp->signalIsSave.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
tmpp->signalIsModify.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
tmpp->signalChangeName.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
}
}
@@ -479,61 +462,61 @@ void MainWindows::onCallbackTitleUpdate() {
return;
}
// select a new Buffer ==> change title:
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
propertyTitle.set("Edn");
setTitle("Edn");
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->propertyValue.set("");
m_widgetLabelFileName->setLabel("");
}
} else {
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
propertyTitle.set(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->propertyValue.set(nameFileSystem + (tmpp->isModify()==true?" *":""));
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
}
void MainWindows::saveAsPopUp(const ememory::SharedPtr<appl::Buffer>& _buffer) {
void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) {
APPL_ERROR("Call With nullptr input...");
return;
}
ememory::SharedPtr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create("buffer-name", _buffer->getFileName());
std::shared_ptr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create(_buffer->getFileName());
}
void MainWindows::closeNotSavedFile(const ememory::SharedPtr<appl::Buffer>& _buffer) {
void MainWindows::closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) {
APPL_ERROR("Call With nullptr input...");
return;
}
ememory::SharedPtr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
if (tmpPopUp == nullptr) {
APPL_ERROR("Can not create a simple pop-up");
return;
}
tmpPopUp->propertyTitle.set("<bold>_T{Close un-saved file:}</bold>");
tmpPopUp->propertyComment.set("_T{The file named:} <i>\"" + _buffer->getFileName() + "\"</i> _T{is curently modify.} <br/>_T{If you don't saves these modifications,<br/>they will be definitly lost...}");
ememory::SharedPtr<ewol::widget::Button> bt = nullptr;
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...");
std::shared_ptr<ewol::widget::Button> bt = nullptr;
if (_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("_T{Save}", true);
bt = tmpPopUp->addButton("Save", true);
if (bt != nullptr) {
// TODO : The element is removed before beeing pressed
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFile, _buffer->getFileName());
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestSaveFile, _buffer->getFileName());
// TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
}
}
bt = tmpPopUp->addButton("_T{Save As}", true);
bt = tmpPopUp->addButton("Save As", true);
if (bt != nullptr) {
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : Request the close when saved ...
}
bt = tmpPopUp->addButton("_T{Close}", true);
bt = tmpPopUp->addButton("Close", true);
if (bt != nullptr) {
// TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
}
tmpPopUp->addButton("_T{Cancel}", true);
tmpPopUp->propertyCloseOutEvent.set(true);
tmpPopUp->addButton("Cancel", true);
tmpPopUp->setRemoveOnExternClick(true);
popUpWidgetPush(tmpPopUp);
}

View File

@@ -1,9 +1,13 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __MAIN_WINDOWS_H__
#define __MAIN_WINDOWS_H__
#include <appl/debug.h>
#include <appl/globalMsg.h>
@@ -13,14 +17,11 @@
#include <ewol/widget/Label.h>
#include <appl/BufferManager.h>
#include <appl/Gui/Search.h>
#include <appl/Gui/ViewerManager.h>
class MainWindows : public ewol::widget::Windows {
private:
ewol::widget::LabelShared m_widgetLabelFileName;
appl::widget::SearchShared m_widgetSearch;
esignal::Connection m_connectionSave;
esignal::Connection m_connectionModify;
esignal::Connection m_connectionSaveName;
std::shared_ptr<ewol::widget::Label> m_widgetLabelFileName;
std::shared_ptr<appl::widget::Search> m_widgetSearch;
protected:
// Constructeur
MainWindows();
@@ -29,18 +30,17 @@ class MainWindows : public ewol::widget::Windows {
DECLARE_FACTORY(MainWindows);
virtual ~MainWindows();
private:
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< 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.
* @param[in] _buffer Buffer that might be saved with a new name.
*/
void saveAsPopUp(const ememory::SharedPtr<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.
* @param[in] _buffer Buffer that might be close.
*/
void closeNotSavedFile(const ememory::SharedPtr<appl::Buffer>& _buffer);
void closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer);
void displayOpen();
void displayProperty();
private:
@@ -52,3 +52,6 @@ class MainWindows : public ewol::widget::Windows {
};
#endif

View File

@@ -1,8 +1,11 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include "appl/global.h"
#include "appl/Gui/Search.h"
#include "appl/BufferManager.h"
@@ -12,6 +15,21 @@
#include <ewol/widget/Button.h>
#include <ewol/widget/Entry.h>
#undef __class__
#define __class__ "Search"
const char* const l_eventSearchEntry = "appl-search-entry";
const char* const l_eventSearchEntryEnter = "appl-search-entry-enter";
const char* const l_eventReplaceEntry = "appl-replace-entry";
const char* const l_eventReplaceEntryEnter = "appl-replace-entry-enter";
const char* const l_eventSearchBt = "appl-search-button";
const char* const l_eventReplaceBt = "appl-replace-button";
const char* const l_eventCaseCb = "appl-case-sensitive-CheckBox";
const char* const l_eventWrapCb = "appl-wrap-CheckBox";
const char* const l_eventForwardCb = "appl-forward-CheckBox";
const char* const l_eventHideBt = "appl-hide-button";
appl::widget::Search::Search() :
m_forward(true),
m_caseSensitive(false),
@@ -19,29 +37,28 @@ appl::widget::Search::Search() :
addObjectType("appl::widget::Search");
}
void appl::widget::Search::init() {
ewol::widget::Composer::init();
loadFromFile("DATA:GUI-Search.xml");
ewol::widget::Composer::init(ewol::widget::Composer::file, "DATA:GUI-Search.xml");
m_viewerManager = appl::ViewerManager::create();
// link event
subBind(ewol::widget::Button, "SEARCH:close", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackHide);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackSearchValue);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackSearchEntryValidate);
subBind(ewol::widget::Button, "SEARCH:search", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackSearch);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceValue);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackReplace);
subBind(ewol::widget::Button, "SEARCH:case", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackCase);
subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap);
subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward);
subBind(ewol::widget::Button, "SEARCH:close", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackHide);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackSearchValue);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackSearchEntryValidate);
subBind(ewol::widget::Button, "SEARCH:search", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackSearch);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, shared_from_this(), &appl::widget::Search::OnCallbackReplaceValue);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, shared_from_this(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, shared_from_this(), &appl::widget::Search::OnCallbackReplace);
subBind(ewol::widget::Button, "SEARCH:case", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackCase);
subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackWrap);
subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, shared_from_this(), &appl::widget::Search::OnCallbackForward);
// set default properties
propertySetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
propertySetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
propertySetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
parameterSetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
parameterSetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
parameterSetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
// get widget
m_searchEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
m_searchEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
// basicly hiden ...
propertyHide.set(true);
hide();
}
appl::widget::Search::~Search() {
@@ -53,7 +70,7 @@ void appl::widget::Search::find() {
APPL_WARNING("No viewer manager selected!!!");
return;
}
ememory::SharedPtr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == nullptr) {
APPL_INFO("No viewer selected!!!");
return;
@@ -89,7 +106,7 @@ void appl::widget::Search::replace() {
APPL_WARNING("No viewer manager selected!!!");
return;
}
ememory::SharedPtr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == nullptr) {
APPL_INFO("No viewer selected!!!");
return;
@@ -102,7 +119,7 @@ void appl::widget::Search::replace() {
}
void appl::widget::Search::OnCallbackHide() {
propertyHide.set(true);
hide();
}
void appl::widget::Search::OnCallbackSearchValue(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
@@ -137,28 +154,14 @@ void appl::widget::Search::OnCallbackForward(const bool& _value) {
}
void appl::widget::Search::selectSearch() {
if (m_searchEntry != nullptr) {
if (m_searchEntry!= nullptr) {
m_searchEntry->keepFocus();
}
}
bool appl::widget::Search::isSelectSearch() {
if (m_searchEntry != nullptr) {
return m_searchEntry->getFocus();
}
return false;
}
void appl::widget::Search::selectReplace() {
if (m_replaceEntry != nullptr) {
if (m_replaceEntry!= nullptr) {
m_replaceEntry->keepFocus();
}
}
bool appl::widget::Search::isSelectReplace() {
if (m_replaceEntry != nullptr) {
return m_replaceEntry->getFocus();
}
return false;
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __SEARCH_H__
#define __SEARCH_H__
#include <appl/debug.h>
#include <ewol/widget/Composer.h>
#include <ewol/widget/Entry.h>
@@ -11,17 +16,14 @@
#include <appl/Gui/ViewerManager.h>
namespace appl {
namespace widget {
class Search;
using SearchShared = ememory::SharedPtr<appl::widget::Search>;
using SearchWeak = ememory::WeakPtr<appl::widget::Search>;
class Search : public ewol::widget::Composer {
private:
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
bool m_forward;
bool m_caseSensitive;
bool m_wrap;
ememory::SharedPtr<ewol::widget::Entry> m_searchEntry;
ememory::SharedPtr<ewol::widget::Entry> m_replaceEntry;
std::shared_ptr<ewol::widget::Entry> m_searchEntry;
std::shared_ptr<ewol::widget::Entry> m_replaceEntry;
std::u32string m_searchData;
std::u32string m_replaceData;
protected:
@@ -42,9 +44,7 @@ namespace appl {
void replace();
public:
void selectSearch();
bool isSelectSearch();
void selectReplace();
bool isSelectReplace();
private: // callback functions
void OnCallbackHide();
void OnCallbackSearchValue(const std::string& _value);
@@ -58,5 +58,7 @@ namespace appl {
void OnCallbackForward(const bool& _value);
};
};
}
};
#endif

View File

@@ -1,15 +1,21 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <etk/tool.h>
#include <appl/Gui/TagFileList.h>
#undef __class__
#define __class__ "TagFileList"
appl::TagFileList::TagFileList() :
signalSelect(this, "select", ""),
signalValidate(this, "validate", ""),
signalUnSelect(this, "unselect", "") {
signalSelect(*this, "select"),
signalValidate(*this, "validate"),
signalUnSelect(*this, "unselect") {
addObjectType("appl::TagFileList");
m_selectedLine = -1;
setMouseLimit(1);
@@ -73,8 +79,8 @@ bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _
};
bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
if (_typeEvent == gale::key::status::pressSingle) {
bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
if (_typeEvent == ewol::key::statusSingle) {
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
if (_IdInput == 1) {
int32_t previousRaw = m_selectedLine;

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_CTAGS_LIST_H__
#define __APPL_CTAGS_LIST_H__
#include <appl/debug.h>
#include <ewol/widget/List.h>
#include <ewol/resource/ColorFile.h>
@@ -24,14 +29,14 @@ namespace appl {
};
class TagFileList : public ewol::widget::List {
public:
esignal::Signal<std::string> signalSelect;
esignal::Signal<std::string> signalValidate;
esignal::Signal<> signalUnSelect;
ewol::object::Signal<std::string> signalSelect;
ewol::object::Signal<std::string> signalValidate;
ewol::object::Signal<void> signalUnSelect;
private:
int32_t m_selectedLine;
std::vector<appl::TagListElement*> m_list;
protected:
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
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.
@@ -48,7 +53,7 @@ namespace appl {
bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
uint32_t getNuberOfRaw();
bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
bool onItemEvent(int32_t _IdInput, enum gale::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:
/**
* @brief add a Ctags item on the curent list
@@ -57,5 +62,10 @@ namespace appl {
*/
void add(std::string& _file, int32_t _line);
};
}
};
#endif

View File

@@ -1,8 +1,11 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/Gui/TagFileSelection.h>
#include <ewol/widget/Sizer.h>
#include <ewol/widget/List.h>
@@ -17,72 +20,87 @@
#include <ewol/ewol.h>
#undef __class__
#define __class__ "TagFileSelection"
static const char * const applEventctagsSelection = "appl-event-ctags-validate";
static const char * const applEventctagsCancel = "appl-event-ctags-cancel";
static const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
static const char * const applEventCtagsListSelect = "appl-event-ctags-list-selected";
static const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-selected";
appl::TagFileSelection::TagFileSelection() :
signalSelect(this, "select", ""),
signalCancel(this, "cancel", "") {
signalSelect(*this, "select"),
signalCancel(*this, "cancel") {
addObjectType("appl::TagFileSelection");
}
void appl::TagFileSelection::init() {
ewol::widget::PopUp::init();
ewol::widget::SizerShared mySizerVert;
std::shared_ptr<ewol::widget::Sizer> mySizerVert;
#if defined(__TARGET_OS__Android)
propertyMinSize.set(gale::Dimension(vec2(90,90), gale::distance::pourcent));
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
#elif defined(__TARGET_OS__Windows)
propertyMinSize.set(gale::Dimension(vec2(80,80), gale::distance::pourcent));
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#else
propertyMinSize.set(gale::Dimension(vec2(80,80), gale::distance::pourcent));
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#endif
mySizerVert = ewol::widget::Sizer::create();
if (mySizerVert == nullptr) {
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
if (nullptr == mySizerVert) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
return;
}
mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
mySizerVert->propertyLockExpand.set(bvec2(true,true));
mySizerVert->propertyExpand.set(bvec2(true,true));
} else {
mySizerVert->lockExpand(bvec2(true,true));
mySizerVert->setExpand(bvec2(true,true));
// set it in the pop-up-system :
setSubWidget(mySizerVert);
ewol::WidgetShared compose = ewol::widget::composerGenerateString(
"<sizer mode='hori' expand='true,false' lock='false,true'>\n"
" <spacer expand='true,false'/>\n"
" <button name='PLUGIN-CTAGS-jump' expand='false' fill='true'>"
" <sizer mode='hori'>\n"
" <image src='THEME:GUI:Load.svg' fill='true' size='10,10mm'/>\n"
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"
" <spacer expand=\"true,false\"/>\n"
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:Load.svg\" fill=\"true\" size=\"10,10mm\"/>\n"
" <label>Jump</label>\n"
" </sizer>\n"
" </button>\n"
" <button name='PLUGIN-CTAGS-cancel' expand='false' fill='true'>"
" <sizer mode='hori'>\n"
" <image src='THEME:GUI:Remove.svg' fill='true' size='10,10mm'/>\n"
" <button name=\"PLUGIN-CTAGS-cancel\" expand=\"false\" fill=\"true\">"
" <sizer mode=\"hori\">\n"
" <image src=\"THEME:GUI:Remove.svg\" fill=\"true\" size=\"10,10mm\"/>\n"
" <label>Cancel</label>\n"
" </sizer>\n"
" </button>\n"
"</sizer>\n");
compose->setExpand(bvec2(true,false));
compose->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(compose);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsSelection);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsCancel);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-jump", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsSelection);
externSubBind(compose, ewol::widget::Button, "PLUGIN-CTAGS-cancel", signalPressed, shared_from_this(), &appl::TagFileSelection::onCallbackCtagsCancel);
m_listTag = appl::TagFileList::create();
if (m_listTag == nullptr) {
if (nullptr == m_listTag) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
m_listTag->signalValidate.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListValidate);
m_listTag->signalSelect.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListSelect);
m_listTag->signalUnSelect.connect(sharedFromThis(), &appl::TagFileSelection::onCallbackCtagsListUnSelect);
m_listTag->propertyExpand.set(bvec2(true,true));
m_listTag->propertyFill.set(bvec2(true,true));
m_listTag->signalValidate.bind(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListValidate);
m_listTag->signalSelect.bind(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListSelect);
m_listTag->signalUnSelect.bind(shared_from_this(), &appl::TagFileSelection::onCallbackCtagsListUnSelect);
m_listTag->setExpand(bvec2(true,true));
m_listTag->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(m_listTag);
}
ewol::widget::LabelShared myWidgetTitle = ewol::widget::Label::create();
if (myWidgetTitle == nullptr) {
std::shared_ptr<ewol::widget::Label> myWidgetTitle;
myWidgetTitle = ewol::widget::Label::create("Ctags Jump Selection ...");
if (nullptr == myWidgetTitle) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
return;
}
myWidgetTitle->propertyValue.set("Ctags Jump Selection ...");
} else {
mySizerVert->subWidgetAdd(myWidgetTitle);
}
}
}
@@ -91,7 +109,7 @@ appl::TagFileSelection::~TagFileSelection() {
}
void appl::TagFileSelection::onCallbackCtagsSelection() {
if (m_eventNamed != "") {
if (m_eventNamed!="") {
signalSelect.emit(m_eventNamed);
// == > Auto remove ...
autoDestroy();
@@ -126,7 +144,7 @@ void appl::TagFileSelection::onCallbackCtagsListUnSelect() {
* @param[in] jump line id
*/
void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) {
if (m_listTag != nullptr) {
if (nullptr != m_listTag) {
m_listTag->add(_file, _line);
}
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_CTAGS_SELECTION_H__
#define __APPL_CTAGS_SELECTION_H__
#include <appl/debug.h>
#include <ewol/widget/PopUp.h>
#include <appl/Gui/TagFileList.h>
@@ -11,10 +16,10 @@
namespace appl {
class TagFileSelection : public ewol::widget::PopUp {
public:
esignal::Signal<std::string> signalSelect;
esignal::Signal<> signalCancel;
ewol::object::Signal<std::string> signalSelect;
ewol::object::Signal<void> signalCancel;
private:
ememory::SharedPtr<appl::TagFileList> m_listTag;
std::shared_ptr<appl::TagFileList> m_listTag;
std::string m_eventNamed;
public:
TagFileSelection();
@@ -35,5 +40,8 @@ namespace appl {
void onCallbackCtagsListSelect(const std::string& _value);
void onCallbackCtagsListUnSelect();
};
}
};
#endif

View File

@@ -1,19 +1,24 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/Gui/TextViewer.h>
#include <appl/BufferManager.h>
#include <gale/context/clipBoard.h>
#include <ewol/context/clipBoard.h>
#include <ewol/widget/Manager.h>
#include <appl/Gui/ViewerManager.h>
#include <ewol/object/Object.h>
#include <appl/TextPluginManager.h>
#include <etk/stdTools.h>
#undef __class__
#define __class__ "TextViewer"
#define tic() \
int64_t startTime = ewol::getTime();
@@ -23,12 +28,14 @@
int64_t processTimeLocal = (endTime - startTime); \
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
static const char* const appl_Buffer_eventIsModify = "buffer-is-modify";
static const char* const appl_Buffer_eventSelectChange = "buffer-select-change";
appl::TextViewer::TextViewer() :
propertyFontName(this, "font-name", "FreeMono;DejaVuSansMono;FreeSerif", "Name of the font for the displayed text", &appl::TextViewer::onChangePropertyFontName),
propertyFontSize(this, "font-size", 12, "Size of the font for the displayed text", &appl::TextViewer::onChangePropertyFontSize),
m_insertMode(false) {
addObjectType("appl::TextViewer");
setCanHaveFocus(true);
setLimitScrolling(0.2);
setSingleFinger(false);
@@ -49,14 +56,13 @@ appl::TextViewer::TextViewer() :
m_colorNormal = m_paintingProperties->request("normal");
}
void appl::TextViewer::init() {
void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
ewol::widget::WidgetScrolled::init();
propertyCanFocus.set(true);
m_displayText.setFont(*propertyFontName, *propertyFontSize);
m_displayText.setFont(_fontName, _fontSize);
m_pluginManager->connect(*this);
// last created has focus ...
setCurrentSelect();
signalShortcut.connect(sharedFromThis(), &appl::TextViewer::onCallbackShortCut);
signalShortcut.bind(shared_from_this(), &appl::TextViewer::onCallbackShortCut);
/*
registerMultiCast(ednMsgBufferId);
@@ -66,9 +72,7 @@ void appl::TextViewer::init() {
registerMultiCast(appl::MsgSelectGotoLineSelect);
*/
if (m_bufferManager != nullptr) {
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &appl::TextViewer::onCallbackselectNewFile);
} else {
APPL_CRITICAL("Buffer manager has not been created at the init");
m_bufferManager->signalSelectFile.bind(shared_from_this(), &appl::TextViewer::onCallbackselectNewFile);
}
}
@@ -84,18 +88,13 @@ void appl::TextViewer::onCallbackShortCut(const std::string& _value) {
void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
APPL_INFO("Select new file: " << _value);
if (isSelectedLast() == false) {
return;
}
// reset scroll:
if (m_buffer != nullptr) {
m_buffer->signals.disconnect(sharedFromThis());
m_buffer->unBindAll(shared_from_this());
bool needAdd = true;
auto it = m_drawingRemenber.begin();
while (it != m_drawingRemenber.end()) {
ememory::SharedPtr<appl::Buffer> tmpBuff = it->first.lock();
std::shared_ptr<appl::Buffer> tmpBuff = it->first.lock();
if (tmpBuff == nullptr) {
it = m_drawingRemenber.erase(it);
continue;
@@ -109,7 +108,7 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
++it;
}
if (needAdd == true) {
m_drawingRemenber.push_back(std::make_pair(ememory::WeakPtr<appl::Buffer>(m_buffer), m_originScrooled));
m_drawingRemenber.push_back(std::make_pair(std::weak_ptr<appl::Buffer>(m_buffer), m_originScrooled));
APPL_VERBOSE("Push origin : " << m_originScrooled);
}
}
@@ -118,8 +117,8 @@ void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
m_buffer = m_bufferManager->get(_value);
m_bufferManager->setBufferSelected(m_buffer);
if (m_buffer != nullptr) {
m_buffer->signalIsModify.connect(sharedFromThis(), &appl::TextViewer::onCallbackIsModify);
m_buffer->signalSelectChange.connect(sharedFromThis(), &appl::TextViewer::onCallbackSelectChange);
m_buffer->signalIsModify.bind(shared_from_this(), &appl::TextViewer::onCallbackIsModify);
m_buffer->signalSelectChange.bind(shared_from_this(), &appl::TextViewer::onCallbackSelectChange);
for (auto element : m_drawingRemenber) {
if (element.first.lock() == m_buffer) {
m_originScrooled = element.second;
@@ -146,6 +145,10 @@ std::string appl::TextViewer::getBufferPath() {
return std::string(filename, 0, pos);
}
void appl::TextViewer::changeZoom(float _range) {
m_displayText.setFontSize(m_displayText.getSize() + _range);
markToRedraw();
}
bool appl::TextViewer::calculateMinSize() {
m_minSize.setValue(50,50);
@@ -160,7 +163,7 @@ void appl::TextViewer::onDraw() {
}
void appl::TextViewer::onRegenerateDisplay() {
if (needRedraw() == false) {
if (false == needRedraw()) {
return;
}
//tic();
@@ -176,8 +179,7 @@ void appl::TextViewer::onRegenerateDisplay() {
if (m_buffer == nullptr) {
m_maxSize.setX(256);
m_maxSize.setY(256);
float textEndAlignament = std::max(11.0f, m_size.x()-20.0f);
m_displayText.setTextAlignement(10, textEndAlignament, ewol::compositing::alignLeft);
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::compositing::alignLeft);
m_displayText.setRelPos(vec3(10, 0, 0));
std::string tmpString("<br/>\n"
"<font color=\"red\">\n"
@@ -387,9 +389,9 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
return true;
}
// just forward event == > manage directly in the buffer
if (_event.getType() == gale::key::keyboard::character) {
if (_event.getType() == ewol::key::keyboardChar) {
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (_event.getStatus() != gale::key::status::down) {
if (_event.getStatus() != ewol::key::statusDown) {
return false;
}
char32_t localValue = _event.getChar();
@@ -439,44 +441,44 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
return true;
}
// move events ...
if (_event.getStatus() == gale::key::status::down) {
if (_event.getStatus() == ewol::key::statusDown) {
// selection when shift is set:
m_buffer->setSelectMode(_event.getSpecialKey().getShift());
// check selection event ...
switch(_event.getType()) {
case gale::key::keyboard::insert:
case ewol::key::keyboardInsert:
m_insertMode = m_insertMode==true?false:true;
markToRedraw();
break;
case gale::key::keyboard::left:
case ewol::key::keyboardLeft:
//APPL_INFO("keyEvent : <LEFT>");
moveCursorLeft();
break;
case gale::key::keyboard::right:
case ewol::key::keyboardRight:
//APPL_INFO("keyEvent : <RIGHT>");
moveCursorRight();
break;
case gale::key::keyboard::up:
case ewol::key::keyboardUp:
//APPL_INFO("keyEvent : <UP>");
moveCursorUp(1);
break;
case gale::key::keyboard::down:
case ewol::key::keyboardDown:
//APPL_INFO("keyEvent : <DOWN>");
moveCursorDown(1);
break;
case gale::key::keyboard::pageUp:
case ewol::key::keyboardPageUp:
//APPL_INFO("keyEvent : <PAGE-UP>");
moveCursorUp(15); // TODO : Set the real number of line ...
break;
case gale::key::keyboard::pageDown:
case ewol::key::keyboardPageDown:
//APPL_INFO("keyEvent : <PAGE-DOWN>");
moveCursorDown(15); // TODO : Set the real number of line ...
break;
case gale::key::keyboard::start:
case ewol::key::keyboardStart:
//APPL_INFO("keyEvent : <Start of line>");
moveCursorLeft(moveEnd);
break;
case gale::key::keyboard::end:
case ewol::key::keyboardEnd:
//APPL_INFO("keyEvent : <End of line>");
moveCursorRight(moveEnd);
break;
@@ -490,7 +492,7 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
if ( _event.getId() != 0
&& _event.getStatus() == gale::key::status::down) {
&& _event.getStatus() == ewol::key::statusDown) {
keepFocus();
}
//tic();
@@ -502,11 +504,13 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
markToRedraw();
return true;
}
APPL_VERBOSE("event : " << _event);
// Second call plugin
if (m_pluginManager->onEventInput(*this, _event) == true) {
markToRedraw();
return true;
}
APPL_VERBOSE("event2 : " << _event);
vec2 relativePos = relativePosition(_event.getPos());
// offset for the lineNumber:
relativePos -= vec2(m_lastOffsetDisplay, 0);
@@ -518,7 +522,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
relativePos.setX(0);
}
if ( _event.getId() == 12
&& _event.getStatus() == gale::key::status::pressSingle) {
&& _event.getStatus() == ewol::key::statusSingle) {
APPL_TODO("RAT5 SAVE button ==> TODO implement");
// Rat5 save event
//sendMultiCast(ednMsgGuiSave, "current");
@@ -527,8 +531,8 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
// just forward event == > manage directly in the buffer
if (_event.getId() == 1) {
// mouse selection :
//if (_event.getType() == gale::key::typeMouse) {
if (_event.getStatus() == gale::key::status::down) {
//if (_event.getType() == ewol::key::typeMouse) {
if (_event.getStatus() == ewol::key::statusDown) {
//if (_event.getSpecialKey().isSetShift() == false) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
m_buffer->setSelectMode(false);
@@ -537,7 +541,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
markToRedraw();
return true;
//}
} else if (_event.getStatus() == gale::key::status::up) {
} else if (_event.getStatus() == ewol::key::statusUp) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
moveCursor(newPos);
m_buffer->setSelectMode(false);
@@ -545,41 +549,41 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
std::string value;
m_buffer->copy(value);
if (value.size() != 0) {
gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value);
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardSelection, value);
}
markToRedraw();
return true;
}
//}
if (_event.getStatus() == gale::key::status::pressSingle) {
if ( _event.getType() == gale::key::type::mouse
|| _event.getType() == gale::key::type::finger) {
if (_event.getStatus() == ewol::key::statusSingle) {
if ( _event.getType() == ewol::key::typeMouse
|| _event.getType() == ewol::key::typeFinger) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
moveCursor(newPos);
markToRedraw();
return true;
}
} else if (_event.getStatus() == gale::key::status::pressDouble) {
} else if (_event.getStatus() == ewol::key::statusDouble) {
mouseEventDouble();
// Copy selection :
std::string value;
m_buffer->copy(value);
if (value.size() != 0) {
gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value);
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardSelection, value);
}
markToRedraw();
return true;
} else if (_event.getStatus() == gale::key::status::pressTriple) {
} else if (_event.getStatus() == ewol::key::statusTriple) {
mouseEventTriple();
// Copy selection :
std::string value;
m_buffer->copy(value);
if (value.size() != 0) {
gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value);
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardSelection, value);
}
markToRedraw();
return true;
} else if (_event.getStatus() == gale::key::status::move) {
} else if (_event.getStatus() == ewol::key::statusMove) {
if (m_buffer->getSelectMode() == true) {
//int64_t timeStart = ewol::getTime();
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
@@ -597,10 +601,10 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
}
}
} else if (2 == _event.getId()) {
if (gale::key::status::pressSingle == _event.getStatus()) {
if (ewol::key::statusSingle == _event.getStatus()) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos);
moveCursor(newPos);
gale::context::clipBoard::request(gale::context::clipBoard::clipboardSelection);
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardSelection);
markToRedraw();
return true;
}
@@ -675,9 +679,9 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
return m_buffer->end();
}
void appl::TextViewer::onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID) {
void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
if (m_buffer != nullptr) {
std::string data = gale::context::clipBoard::get(_clipboardID);
std::string data = ewol::context::clipBoard::get(_clipboardID);
write(data);
}
markToRedraw();
@@ -704,13 +708,13 @@ void appl::TextViewer::onLostFocus() {
markToRedraw();
}
void appl::TextViewer::onChangePropertyFontSize() {
m_displayText.setFontSize(*propertyFontSize);
setScrollingSize(*propertyFontSize*3.0*1.46); // 1.46 is a magic number ...
void appl::TextViewer::setFontSize(int32_t _size) {
m_displayText.setFontSize(_size);
setScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ...
}
void appl::TextViewer::onChangePropertyFontName() {
m_displayText.setFontName(*propertyFontName);
void appl::TextViewer::setFontName(const std::string& _fontName) {
m_displayText.setFontName(_fontName);
}
// TODO : Update process time ==> a little expensive (2->4ms) in end of file
@@ -981,13 +985,13 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
void appl::TextViewer::setCurrentSelect() {
if (m_viewerManager != nullptr) {
m_viewerManager->setViewerSelected(ememory::dynamicPointerCast<appl::TextViewer>(sharedFromThis()), m_buffer);
m_viewerManager->setViewerSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()), m_buffer);
}
}
bool appl::TextViewer::isSelectedLast() {
if (m_viewerManager != nullptr) {
return m_viewerManager->isLastSelected(ememory::dynamicPointerCast<appl::TextViewer>(sharedFromThis()));
return m_viewerManager->isLastSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()));
}
return false;
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_VIEWER_H__
#define __APPL_TEXT_VIEWER_H__
#include <appl/debug.h>
#include <appl/Buffer.h>
#include <appl/globalMsg.h>
@@ -18,15 +23,9 @@
namespace appl {
class textPluginManager;
class TextViewer;
using TextViewerShared = ememory::SharedPtr<appl::TextViewer>;
using TextViewerWeak = ememory::WeakPtr<appl::TextViewer>;
class TextViewer : public ewol::widget::WidgetScrolled {
private:
eproperty::Value<std::string> propertyFontName; //!< name of the font to display text.
eproperty::Value<int32_t> propertyFontSize; //!< Size of the font to display text.
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground;
int32_t m_colorSpace;
int32_t m_colorTabulation;
@@ -35,32 +34,32 @@ namespace appl {
int32_t m_colorSelection;
int32_t m_colorNormal;
private:
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::textPluginManager> m_pluginManager; //!< Plugin manager interface
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::textPluginManager> m_pluginManager; //!< Plugin manager interface
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
protected:
TextViewer();
void init();
void init(const std::string& _fontName="", int32_t _fontSize=-1);
public:
DECLARE_FACTORY(TextViewer);
virtual ~TextViewer();
private:
ememory::SharedPtr<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:
/**
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
* @return pointer on buffer
*/
ememory::SharedPtr<appl::Buffer> internalGetBuffer() {
std::shared_ptr<appl::Buffer> internalGetBuffer() {
return m_buffer;
}
private:
ewol::compositing::Text m_displayText; //!< Text display properties.
ewol::compositing::Drawing m_displayDrawing; //!< Other display requested.
std::vector<std::pair<ememory::WeakPtr<appl::Buffer>, vec2>> m_drawingRemenber;
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
std::vector<std::pair<std::weak_ptr<appl::Buffer>, vec2>> m_drawingRemenber;
public:
virtual void onChangePropertyFontSize();
virtual void onChangePropertyFontName();
void setFontSize(int32_t _size);
void setFontName(const std::string& _fontName);
protected: // derived function
virtual void onDraw();
public: // Derived function
@@ -68,9 +67,10 @@ namespace appl {
virtual void onRegenerateDisplay();
virtual bool onEventInput(const ewol::event::Input& _event);
virtual bool onEventEntry(const ewol::event::Entry& _event);
virtual void onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID);
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
virtual void onGetFocus();
virtual void onLostFocus();
virtual void changeZoom(float _range);
private:
float m_lastOffsetDisplay; //!< Line number ofssed in the display
private:
@@ -418,5 +418,7 @@ namespace appl {
void onCallbackSelectChange();
void onCallbackselectNewFile(const std::string& _value);
};
}
};
#endif

View File

@@ -1,15 +1,21 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/Gui/ViewerManager.h>
#include <appl/Gui/TextViewer.h>
#include <ewol/object/Object.h>
#include <ewol/object/Manager.h>
#include <gale/resource/Manager.h>
#include <ewol/resource/Manager.h>
#undef __class__
#define __class__ "ViewerManager"
appl::ViewerManager::ViewerManager() {
addObjectType("appl::ViewerManager");
@@ -17,19 +23,19 @@ appl::ViewerManager::ViewerManager() {
m_bufferManager = appl::BufferManager::create();
}
void appl::ViewerManager::init(const std::string& _uniqueName) {
ewol::Resource::init(_uniqueName);
}
appl::ViewerManager::~ViewerManager() {
}
ememory::SharedPtr<appl::TextViewer> appl::ViewerManager::getViewerSelected() {
return m_viewer.lock();
}
bool appl::ViewerManager::isLastSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer) {
bool appl::ViewerManager::isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer) {
return m_viewer.lock() == _viewer;
}
void appl::ViewerManager::setViewerSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer, const ememory::SharedPtr<appl::Buffer>& _buffer) {
void appl::ViewerManager::setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer) {
if (m_viewer.lock() == _viewer) {
return;
}

View File

@@ -1,45 +1,53 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __VIEWER_MANAGER_H__
#define __VIEWER_MANAGER_H__
#include <appl/Buffer.h>
#include <appl/globalMsg.h>
#include <ewol/widget/Widget.h>
#include <gale/resource/Resource.h>
#include <ewol/resource/Resource.h>
#include <appl/BufferManager.h>
namespace appl {
class TextViewer;
class ViewerManager;
using ViewerManagerShared = ememory::SharedPtr<appl::ViewerManager>;
using ViewerManagerWeak = ememory::WeakPtr<appl::ViewerManager>;
class ViewerManager : public ewol::Object {
class ViewerManager : public ewol::Resource {
protected:
ViewerManager();
void init(const std::string& _uniqueName);
public:
DECLARE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???");
DECLARE_RESOURCE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???");
virtual ~ViewerManager();
private:
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::WeakPtr<appl::TextViewer> m_viewer;
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::weak_ptr<appl::TextViewer> m_viewer;
public:
/**
* @brief Set the current buffer selected
* @param[in] _viewer Pointer on the viewer selected
*/
void setViewerSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer, const ememory::SharedPtr<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
* @return Pointer on the buffer selected
*/
ememory::SharedPtr<appl::TextViewer> getViewerSelected();
std::shared_ptr<appl::TextViewer> getViewerSelected() {
return m_viewer.lock();
};
/**
* @breif Check if the element is the last request selection
* @param[in] _viewer element selected.
* @return true if the element is selected
*/
bool isLastSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer);
bool isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer);
};
}
};
#endif

View File

@@ -1,12 +1,18 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <ewol/context/Context.h>
#include <appl/debug.h>
#include <appl/Gui/WorkerCloseAllFile.h>
#undef __class__
#define __class__ "WorkerCloseAllFile"
appl::WorkerCloseAllFile::WorkerCloseAllFile() {
addObjectType("appl::WorkerCloseAllFile");
// load buffer manager:
@@ -22,7 +28,7 @@ void appl::WorkerCloseAllFile::init() {
}
// List all current open file :
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
if (tmpBuffer == nullptr) {
continue;
}
@@ -40,7 +46,7 @@ void appl::WorkerCloseAllFile::init() {
}
// create the worker :
m_worker = appl::WorkerCloseFile::create();
m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->signalCloseDone.bind(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->startAction(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
@@ -65,7 +71,7 @@ void appl::WorkerCloseAllFile::onCallbackCloseDone() {
}
// create the worker :
m_worker = appl::WorkerCloseFile::create();
m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->signalCloseDone.bind(shared_from_this(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->startAction(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __WORKER_CLOSE_ALL_FILE_H__
#define __WORKER_CLOSE_ALL_FILE_H__
#include <ewol/object/Worker.h>
#include <appl/BufferManager.h>
#include <appl/Gui/WorkerCloseFile.h>
@@ -18,9 +23,12 @@ namespace appl {
virtual ~WorkerCloseAllFile();
private:
std::vector<std::string> m_bufferNameList;
ememory::SharedPtr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback function
void onCallbackCloseDone();
};
}
};
#endif

View File

@@ -1,17 +1,22 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <ewol/context/Context.h>
#include <appl/debug.h>
#include <appl/Gui/WorkerCloseFile.h>
#include <ewol/widget/meta/StdPopUp.h>
#include <ewol/tools/message.h>
#undef __class__
#define __class__ "WorkerCloseFile"
appl::WorkerCloseFile::WorkerCloseFile() :
signalCloseDone(this, "close-file-done", ""),
signalAbort(this, "close-file-abort", ""),
signalCloseDone(*this, "close-file-done"),
signalAbort(*this, "close-file-abort"),
m_buffer(nullptr),
m_worker(nullptr),
m_bufferManager(nullptr) {
@@ -33,7 +38,7 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
}
if (m_bufferName == "") {
// need to find the curent file ...
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ...");
destroy();
@@ -59,35 +64,35 @@ void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
return;
}
ememory::SharedPtr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
if (tmpPopUp == nullptr) {
APPL_ERROR("Can not create a simple pop-up");
destroy();
return;
}
tmpPopUp->propertyTitle.set("<bold>_T{Close un-saved file:}</bold>");
tmpPopUp->propertyComment.set("_T{The file named:} <i>'" + m_buffer->getFileName() + "'</i> _T{is curently modify.}<br/>_T{If you don't saves these modifications,}<br/>_T{they will be definitly lost...}");
ememory::SharedPtr<ewol::widget::Button> bt = nullptr;
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...");
std::shared_ptr<ewol::widget::Button> bt = nullptr;
if (m_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("_T{Save}", true);
bt = tmpPopUp->addButton("Save", true);
if (bt != nullptr) {
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveValidate);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveValidate);
}
}
bt = tmpPopUp->addButton("_T{Save As}", true);
bt = tmpPopUp->addButton("Save As", true);
if (bt != nullptr) {
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
}
bt = tmpPopUp->addButton("_T{Close}", true);
bt = tmpPopUp->addButton("Close", true);
if (bt != nullptr) {
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
}
bt = tmpPopUp->addButton("_T{Cancel}", true);
bt = tmpPopUp->addButton("Cancel", true);
if (bt != nullptr) {
bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel);
}
tmpPopUp->propertyCloseOutEvent.set(true);
ememory::SharedPtr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
tmpPopUp->setRemoveOnExternClick(true);
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows.");
destroy();
@@ -111,10 +116,10 @@ void appl::WorkerCloseFile::onCallbackSaveAsValidate() {
// nothing to do in this case ==> can do nothing ...
return;
}
m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferName);
m_worker = appl::WorkerSaveFile::create(m_bufferName);
if (m_worker != nullptr) {
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose);
m_worker->signalAbort.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel);
m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
m_worker->signalAbort.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel);
}
}
@@ -132,7 +137,11 @@ void appl::WorkerCloseFile::onCallbackSaveValidate() {
return;
}
if (m_buffer->storeFile() == false) {
ewol::tools::message::displayWarning("We can not save the file : <br/><i>" + m_buffer->getFileName() + "</i>");
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
return;
}
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + m_buffer->getFileName() + "</i>");
signalAbort.emit();
} else {
m_buffer->destroy();

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __WORKER_CLOSE_FILE_H__
#define __WORKER_CLOSE_FILE_H__
#include <ewol/object/Worker.h>
#include <ewol/widget/meta/FileChooser.h>
#include <appl/BufferManager.h>
@@ -12,8 +17,8 @@
namespace appl {
class WorkerCloseFile : public ewol::object::Worker {
public:
esignal::Signal<> signalCloseDone;
esignal::Signal<> signalAbort;
ewol::object::Signal<void> signalCloseDone;
ewol::object::Signal<void> signalAbort;
protected:
// note : if == "" ==> current ...
WorkerCloseFile();
@@ -28,14 +33,15 @@ namespace appl {
void startAction(const std::string& _bufferName);
private:
std::string m_bufferName;
ememory::SharedPtr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
ememory::SharedPtr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback Functions
void onCallbackSaveAsValidate();
void onCallbackSaveValidate();
void onCallbackClose();
void onCallbackCancel();
};
}
};
#endif

View File

@@ -1,12 +1,18 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <ewol/context/Context.h>
#include <appl/debug.h>
#include <appl/Gui/WorkerSaveAllFile.h>
#undef __class__
#define __class__ "WorkerSaveAllFile"
appl::WorkerSaveAllFile::WorkerSaveAllFile() {
addObjectType("appl::WorkerSaveAllFile");
// load buffer manager:
@@ -21,17 +27,18 @@ void appl::WorkerSaveAllFile::init() {
return;
}
// List all current open file :
for (auto &it : *m_bufferManager) {
if (it == nullptr) {
for (int32_t iii=0; iii<m_bufferManager->size(); ++iii) {
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
if (tmpBuffer == nullptr) {
continue;
}
if (it->isModify() == false) {
if (tmpBuffer->isModify() == false) {
continue;
}
if (it->hasFileName() == false) {
m_bufferNameList.push_back(it->getFileName());
if (tmpBuffer->hasFileName() == false) {
m_bufferNameList.push_back(tmpBuffer->getFileName());
} else {
it->storeFile();
tmpBuffer->storeFile();
}
}
// checkif an element has something to do in the queue
@@ -40,14 +47,14 @@ void appl::WorkerSaveAllFile::init() {
return;
}
// create the worker :
m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferNameList.front());
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) {
destroy();
return;
}
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}
appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
@@ -64,13 +71,13 @@ void appl::WorkerSaveAllFile::onCallbackSaveAsDone() {
return;
}
// create the worker :
m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferNameList.front());
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) {
destroy();
return;
}
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __WORKER_SAVE_ALL_FILE_H__
#define __WORKER_SAVE_ALL_FILE_H__
#include <ewol/object/Worker.h>
#include <appl/BufferManager.h>
#include <appl/Gui/WorkerSaveFile.h>
@@ -18,10 +23,11 @@ namespace appl {
virtual ~WorkerSaveAllFile();
private:
std::vector<std::string> m_bufferNameList;
ememory::SharedPtr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback function
void onCallbackSaveAsDone();
};
}
};
#endif

View File

@@ -1,52 +1,57 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <ewol/context/Context.h>
#include <appl/debug.h>
#include <appl/Gui/WorkerSaveFile.h>
#include <ewol/tools/message.h>
#undef __class__
#define __class__ "WorkerSaveFile"
appl::WorkerSaveFile::WorkerSaveFile() :
signalSaveDone(this, "save-file-done", ""),
signalAbort(this, "save-file-abort", ""),
propertyBufferName(this, "buffer-name", "", ""),
propertyForceSave(this, "force-save", false, "request save in all case") {
signalSaveDone(*this, "save-file-done"),
signalAbort(*this, "save-file-abort") {
addObjectType("appl::WorkerSaveFile");
// load buffer manager:
m_bufferManager = appl::BufferManager::create();
}
void appl::WorkerSaveFile::init() {
void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveAs) {
ewol::object::Worker::init();
m_bufferName = _bufferName;
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
destroy();
return;
}
if (*propertyBufferName == "") {
if (m_bufferName == "") {
// need to find the curent file ...
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ...");
destroy();
return;
}
propertyBufferName.setDirect(tmpp->getFileName());
m_bufferName = tmpp->getFileName();
}
if (m_bufferManager->exist(*propertyBufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << *propertyBufferName);
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
destroy();
return;
}
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << *propertyBufferName);
APPL_ERROR("Error to get the buffer : " << m_bufferName);
destroy();
return;
}
if (*propertyForceSave == false) {
if (_forceSaveAs == false) {
if (tmpBuffer->hasFileName() == true) {
tmpBuffer->storeFile();
signalSaveDone.emit();
@@ -55,25 +60,25 @@ void appl::WorkerSaveFile::init() {
}
}
m_chooser = ewol::widget::FileChooser::create();
if (m_chooser == nullptr) {
if (nullptr == m_chooser) {
APPL_ERROR("Can not allocate widget == > display might be in error");
destroy();
return;
}
m_chooser->propertyLabelTitle.set("_T{Save files As...}");
m_chooser->propertyLabelValidate.set("_T{Save}");
etk::FSNode tmpName(*propertyBufferName);
m_chooser->propertyPath.set(tmpName.getNameFolder());
m_chooser->propertyFile.set(tmpName.getNameFile());
ememory::SharedPtr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
m_chooser->setTitle("Save files As...");
m_chooser->setValidateLabel("Save");
etk::FSNode tmpName(m_bufferName);
m_chooser->setFolder(tmpName.getNameFolder());
m_chooser->setFileName(tmpName.getNameFile());
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows.");
destroy();
return;
}
tmpWindows->popUpWidgetPush(m_chooser);
m_chooser->signalValidate.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
m_chooser->signalCancel.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackCancel);
m_chooser->signalValidate.bind(shared_from_this(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
m_chooser->signalCancel.bind(shared_from_this(), &appl::WorkerSaveFile::onCallbackCancel);
}
appl::WorkerSaveFile::~WorkerSaveFile() {
@@ -96,20 +101,25 @@ void appl::WorkerSaveFile::onCallbackSaveAsValidate(const std::string& _value) {
destroy();
return;
}
if (m_bufferManager->exist(*propertyBufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << *propertyBufferName);
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
destroy();
return;
}
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << *propertyBufferName);
APPL_ERROR("Error to get the buffer : " << m_bufferName);
destroy();
return;
}
tmpBuffer->setFileName(_value);
if (tmpBuffer->storeFile() == false) {
ewol::tools::message::displayWarning("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
destroy();
return;
}
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
} else {
signalSaveDone.emit();
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __WORKER_SAVE_FILE_H__
#define __WORKER_SAVE_FILE_H__
#include <ewol/widget/meta/FileChooser.h>
#include <ewol/object/Worker.h>
#include <appl/BufferManager.h>
@@ -11,22 +16,22 @@
namespace appl {
class WorkerSaveFile : public ewol::object::Worker {
public:
esignal::Signal<> signalSaveDone;
esignal::Signal<> signalAbort;
eproperty::Value<std::string> propertyBufferName;
eproperty::Value<bool> propertyForceSave;
ewol::object::Signal<void> signalSaveDone;
ewol::object::Signal<void> signalAbort;
protected:
WorkerSaveFile();
void init();
void init(const std::string& _bufferName, bool _forceSaveAs=true);
public:
DECLARE_FACTORY(WorkerSaveFile);
virtual ~WorkerSaveFile();
private:
ememory::SharedPtr<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
std::string m_bufferName;
std::shared_ptr<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // callback function
void onCallbackSaveAsValidate(const std::string& _value);
void onCallbackCancel();
};
}
};
#endif

View File

@@ -1,14 +1,20 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/Highlight.h>
#include <exml/exml.h>
#include <ewol/ewol.h>
#include <gale/resource/Manager.h>
#include <ewol/resource/Manager.h>
#undef __class__
#define __class__ "Highlight"
// first pass
//#define HL_DEBUG APPL_INFO
@@ -18,12 +24,24 @@
//#define HL2_DEBUG APPL_INFO
#define HL2_DEBUG APPL_VERBOSE
void appl::Highlight::parseRules(exml::Element* _child,
std::vector<std::unique_ptr<HighlightPattern>>& _mListPatern,
int32_t _level,
bool forceMaximize) {
// Create the patern ...
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
// parse under Element
myPattern->parseRules(_child, _level, forceMaximize);
// add element in the list
_mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
}
appl::Highlight::Highlight() {
addResourceType("appl::Highlight");
addObjectType("appl::Highlight");
}
void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _colorFile) {
gale::Resource::init(_xmlFilename);
ewol::Resource::init(_xmlFilename);
// keep color propertiy file :
m_paintingProperties = appl::GlyphPainting::create(_colorFile);
@@ -33,79 +51,55 @@ void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _
APPL_ERROR(" can not load file XML : " << _xmlFilename);
return;
}
exml::Element root = doc.nodes["EdnLang"];
if (root.exist() == false) {
APPL_ERROR("(l ?) main node not find: 'EdnLang' ...");
exml::Element* root = doc.getNamed("EdnLang");
if (nullptr == root ) {
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ...");
return;
}
m_typeName = root.attributes["lang"];
m_typeName = root->getAttribute("lang");
int32_t level1 = 0;
int32_t level2 = 0;
// parse all the elements :
for (const auto it : root.nodes) {
const exml::Element child = it.toElement();
if (child.exist() == false) {
for(size_t iii = 0; iii < root->size(); ++iii) {
exml::Element* child = root->getElement(iii);
if (child == nullptr) {
// trash here all that is not element ...
continue;
}
if (child.getValue() == "ext") {
std::string myData = child.getText();
if (child->getValue() == "ext") {
std::string myData = child->getText();
if (myData.size()!=0) {
//HL_DEBUG("(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
m_listExtentions.push_back(myData);
}
} else if (child.getValue() == "pass1") {
} else if (child->getValue() == "pass1") {
// get sub Nodes ...
for (const auto it2 : child.nodes) {
const exml::Element passChild = it2.toElement();
if (passChild.exist() == false) {
for(size_t jjj=0; jjj< child->size(); jjj++) {
exml::Element* passChild = child->getElement(jjj);
if (passChild == nullptr) {
continue;
}
if (passChild.getValue() != "rule") {
APPL_ERROR("(l "<< passChild.getPos() << ") node not suported : '"<< passChild.getValue() << "' must be [rule]" );
if (passChild->getValue() != "rule") {
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
continue;
}
// Create the patern in list
m_listHighlightPass1.push_back(HighlightPattern(m_paintingProperties, passChild, level1++));
parseRules(passChild, m_listHighlightPass1, level1++);
}
} else if (child.getValue() == "pass2") {
} else if (child->getValue() == "pass2") {
// get sub Nodes ...
for (const auto it2 : child.nodes) {
const exml::Element passChild = it2.toElement();
if (passChild.exist() == false) {
for(size_t jjj=0; jjj< child->size(); jjj++) {
exml::Element* passChild = child->getElement(jjj);
if (passChild == nullptr) {
continue;
}
if (passChild.getValue() != "rule") {
APPL_ERROR("(l "<< passChild.getPos() << ") node not suported : '"<< passChild.getValue() << "' must be [rule]" );
if (passChild->getValue() != "rule") {
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
continue;
}
// Create the patern in list
m_listHighlightPass2.push_back(HighlightPattern(m_paintingProperties, passChild, level2++));
}
} else if (child.getValue() == "pass") {
std::string attributeName = child.attributes["name"];
if (attributeName == "") {
APPL_ERROR("Can not parse an element pass with no attribute name ... ligne=" << child.getPos());
continue;
}
m_listHighlightNamed.insert(std::pair<std::string, std::vector<HighlightPattern>>(attributeName, std::vector<HighlightPattern>()));
auto it3 = m_listHighlightNamed.find(attributeName);
int32_t level3=0;
// get sub Nodes ...
for (const auto it2 : child.nodes) {
const exml::Element passChild = it2.toElement();
if (passChild.exist() == false) {
continue;
}
if (passChild.getValue() != "rule") {
APPL_ERROR("(l "<< passChild.getPos() << ") node not suported : '"<< passChild.getValue() << "' must be [rule]" );
continue;
}
// add element in the list
it3->second.push_back(HighlightPattern(m_paintingProperties, passChild, level3++));
parseRules(passChild, m_listHighlightPass2, level2++, true);
}
} else {
APPL_ERROR("(l "<< child.getPos() << ") node not suported : '"<< child.getValue() << "' must be [ext,pass1,pass2]" );
APPL_ERROR("(l "<< child->getPos() << ") node not suported : \""<< child->getValue() << "\" must be [ext,pass1,pass2]" );
}
}
}
@@ -119,30 +113,14 @@ appl::Highlight::~Highlight() {
m_listExtentions.clear();
}
bool appl::Highlight::isCompatible(const std::string& _name) {
bool appl::Highlight::hasExtention(const std::string& _ext) {
for (auto &it : m_listExtentions) {
APPL_DEBUG(" check : " << it << "=?=" << _name);
std::regex expression;
try {
expression.assign(it, std::regex_constants::optimize | std::regex_constants::ECMAScript);
} catch (std::regex_error e) {
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << it);
continue;
}
std::smatch resultMatch;
std::regex_search(_name.begin(), _name.end(), resultMatch, expression, std::regex_constants::match_continuous);
if (resultMatch.size() <= 0) {
continue;
}
APPL_VERBOSE(" - begin=" << std::distance(_name.begin(), resultMatch[0].first) << " end=" << std::distance(_name.begin(), resultMatch[0].second));
if (resultMatch[0].first != _name.begin()) {
continue;
}
if (resultMatch[0].second != _name.end()) {
continue;
}
APPL_VERBOSE(" check : " << it << "=?=" << _ext);
if ( it == "*." + _ext
|| it == _ext) {
return true;
}
}
return false;
}
@@ -173,20 +151,13 @@ void appl::Highlight::display() {
}
// display all elements
for (auto &it : m_listHighlightPass1) {
APPL_INFO(" Pass 1 : " << it.getName() );
//it.display();
APPL_INFO(" Pass 1 : " << it->getName() );
//m_listHighlightPass1[iii]->display();
}
// display all elements
for (auto &it : m_listHighlightPass2) {
APPL_INFO(" pass 2 : " << it.getName() );
//it.display();
}
for (auto &it : m_listHighlightNamed) {
APPL_INFO(" pass * : " << it.first << " : ");
for (auto &it2 : it.second) {
APPL_INFO(" " << it2.getName() );
//it.display();
}
//it.display();
APPL_INFO(" pass 2 : " << it->getName() );
//m_listHighlightPass2[iii]->display();
}
}
@@ -197,7 +168,7 @@ void appl::Highlight::parse(int64_t _start,
int64_t _stop,
std::vector<appl::HighlightInfo> & _metaData,
int64_t _addingPos,
std::string& _buffer) {
etk::Buffer & _buffer) {
if (0 > _addingPos) {
_addingPos = 0;
}
@@ -205,26 +176,16 @@ void appl::Highlight::parse(int64_t _start,
int64_t elementStart = _start;
int64_t elementStop = _stop;
appl::HighlightInfo resultat;
int64_t startTime = ewol::getTime();
while (elementStart <= elementStop) {
//HL_DEBUG("Parse element in the buffer pos=" << elementStart);
int64_t currentTime = ewol::getTime();
HL_DEBUG("Parse element in the buffer pos=" << elementStart);
//try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
bool ret = true;
/*
if (_buffer[elementStart] == '\n') {
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='\\n' " << m_listHighlightPass1[jjj].getPaternString());
} else {
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj].getPaternString());
}
*/
enum resultFind ret = HLP_FIND_OK;
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)
ret = m_listHighlightPass1[jjj].find(elementStart, _buffer.size(), resultat, _buffer);
if (ret == true) {
int64_t currentTimeEnd = ewol::getTime();
int64_t deltaTime = currentTimeEnd - currentTime;
HL_DEBUG("Find Pattern in the Buffer : time=" << (float)deltaTime/1000.0f << " ms (" << resultat.start << "," << resultat.stop << ") startPos=" << elementStart << " for=" << m_listHighlightPass1[jjj].getPaternString().first << " " << m_listHighlightPass1[jjj].getPaternString().second);
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer);
if (HLP_FIND_ERROR != ret) {
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...
int64_t kkk=_addingPos;
while(kkk < (int64_t)_metaData.size() ) {
@@ -234,7 +195,7 @@ void appl::Highlight::parse(int64_t _start,
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
// Increase the end of search
if (kkk < (int64_t)_metaData.size()) {
// just before the end of the next element
// just befor the end of the next element
elementStop = _metaData[kkk].start-1;
} else {
// end of the buffer
@@ -259,25 +220,17 @@ void appl::Highlight::parse(int64_t _start,
// Go to the next element (and search again ...).
elementStart++;
}
int64_t stopTime = ewol::getTime();
int64_t deltaTimeGlobal = stopTime - startTime;
APPL_DEBUG("parse in time=" << (float)deltaTimeGlobal/1000.0f << " ms ");
}
/**
* @brief second pass of the hightlight
* @param[in] _start Start searching data
* @param[in] _stop End searching data
* @param[out] _metaData Output list of all find patern
* @param[in] _buffer buffer where we need to search data
*
*/
void appl::Highlight::parse2(int64_t _start,
int64_t _stop,
std::vector<appl::HighlightInfo>& _metaData,
std::string& _buffer) {
std::vector<appl::HighlightInfo> &_metaData,
etk::Buffer &_buffer) {
HL2_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() <<
" == > position search: (" << _start << "," << _stop << ")" );
int64_t elementStart = _start;
@@ -286,63 +239,23 @@ void appl::Highlight::parse2(int64_t _start,
while (elementStart < elementStop) {
if (elementStart == 306) {
//elog::setLevel(elog::logLevelVerbose);
//etk::log::setLevel(etk::log::logLevelVerbose);
}
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
//try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<int64_t(m_listHighlightPass2.size()); jjj++){
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass2.size(); jjj++){
enum resultFind ret = HLP_FIND_OK;
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
elementStart << "," << elementStop << ") in='"
<< /*_buffer[elementStart]*/ std::string(_buffer.begin()+elementStart,_buffer.begin()+elementStop) << "' " << m_listHighlightPass2[jjj].getPaternString().first << " " << m_listHighlightPass1[jjj].getPaternString().second);
<< _buffer[elementStart] << "' " << m_listHighlightPass2[jjj]->getPaternString());
// Stop the search to the end (to get the end of the pattern)
bool ret = m_listHighlightPass2[jjj].find(elementStart, elementStop, resultat, _buffer);
if (ret == true) {
// find an element:
_metaData.push_back(resultat);
HL2_DEBUG("data='" << std::string(_buffer.begin()+elementStart,_buffer.begin()+resultat.stop) << "'");
elementStart = resultat.stop-1;
break;
}
}
// Go to the next element (and search again ...).
elementStart++;
}
}
/**
* @brief second pass of the hightlight pattern (have found something before)
* @param[in] _upper upper pattern to find the data
* @param[out] _metaData Output list of all find patern
* @param[in] _buffer buffer where we need to search data
*/
void appl::Highlight::parseSubElement(const appl::HighlightInfo& _upper,
std::vector<appl::HighlightInfo> &_metaData,
std::string &_buffer) {
if (_upper.patern->getSubPatternName().size() == 0) {
return;
}
HL2_DEBUG("Parse element 0 => " << m_listHighlightNamed.size() <<
" == > position search: (" << _upper.start << "," << _upper.stop << ")" );
int64_t elementStart = _upper.start;
int64_t elementStop = _upper.stop;
appl::HighlightInfo resultat;
// Find element in the list:
auto itHL = m_listHighlightNamed.find(_upper.patern->getSubPatternName());
if (itHL == m_listHighlightNamed.end()) {
APPL_ERROR("Patern does not exist : " << _upper.patern->getSubPatternName() << " note : Removing it ...");
_upper.patern->setSubPatternName("");
return;
}
while (elementStart < elementStop) {
//try to fond the HL in ALL of we have
for (auto &it : itHL->second){
HL2_DEBUG("Parse HL position search: (" << elementStart << "," << elementStop << ") in='" << _buffer[elementStart] << "' " << it.getPaternString().first << " " << it.getPaternString().second);
// Stop the search to the end (to get the end of the pattern)
bool ret = it.find(elementStart, elementStop, resultat, _buffer);
if (ret == true) {
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer);
if (ret != HLP_FIND_ERROR) {
HL2_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ")" );
// add curent element in the list ...
_metaData.push_back(resultat);
elementStart = resultat.stop-1;
// Exit current cycle
break;
}
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__
namespace appl {
class Highlight;
@@ -14,20 +19,21 @@ namespace appl {
int32_t start;
int32_t stop;
bool notEnded;
appl::HighlightPattern* patern;
appl::HighlightPattern* patern; // pointer on class :
};
}
};
#include <ememory/memory.h>
#include <memory>
#include <etk/os/FSNode.h>
#include <appl/HighlightPattern.h>
#include <appl/GlyphPainting.h>
#include <etk/Buffer.h>
#include <exml/exml.h>
namespace appl {
class Highlight : public gale::Resource {
class Highlight : public ewol::Resource {
private:
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties;
std::shared_ptr<appl::GlyphPainting> m_paintingProperties;
public:
// Constructeur
Highlight();
@@ -38,41 +44,42 @@ namespace appl {
private:
std::string m_typeName; //!< descriptive string type like "C/C++"
public:
/**
* @brief Get the Type of the Hightlight like c++/Bash/...
* @return descriptive string
*/
const std::string& getTypeName() {
return m_typeName;
}
public:
bool isCompatible(const std::string& _name);
bool hasExtention(const std::string& _ext);
bool fileNameCompatible(const std::string& _fileName);
void display();
void parse(int64_t _start,
int64_t _stop,
std::vector<appl::HighlightInfo>& _metaData,
std::vector<appl::HighlightInfo> &_metaData,
int64_t _addingPos,
std::string& _buffer);
etk::Buffer &_buffer);
void parse2(int64_t _start,
int64_t _stop,
std::vector<appl::HighlightInfo>& _metaData,
std::string& _buffer);
void parseSubElement(const appl::HighlightInfo& _upper,
std::vector<appl::HighlightInfo>& _metaData,
std::string &_buffer);
std::vector<appl::HighlightInfo> &_metaData,
etk::Buffer &_buffer);
private:
void parseRules(exml::Element* _child,
std::vector<std::unique_ptr<HighlightPattern>> &_mListPatern,
int32_t _level,
bool forceMaximize=false);
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<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::map<std::string, std::vector<HighlightPattern>> m_listHighlightNamed; //!< list of all sub partern to parse...
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<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: // herited function :
virtual bool updateContext() {
virtual void updateContext() {
// no upfate to do ...
return true;
};
};
}
};
#endif

View File

@@ -1,25 +1,30 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/HighlightManager.h>
#include <ewol/object/Object.h>
#include <ewol/object/Manager.h>
#undef __class__
#define __class__ "highlightManager"
// TODO : Review this in a generic unique resource ...
static std::vector<ememory::SharedPtr<appl::Highlight>>& s_list() {
static std::vector<ememory::SharedPtr<appl::Highlight>> list;
static std::vector<std::shared_ptr<appl::Highlight>>& s_list() {
static std::vector<std::shared_ptr<appl::Highlight>> list;
return list;
}
void appl::highlightManager::init() {
std::vector<ememory::SharedPtr<appl::Highlight>>& hlList = s_list();
std::vector<std::shared_ptr<appl::Highlight>>& hlList = s_list();
if (hlList.size() != 0) {
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
hlList.clear();
@@ -32,20 +37,13 @@ void appl::highlightManager::init() {
if (it == nullptr) {
continue;
}
if (it->getNodeType() != etk::typeNode_folder) {
if (it->getNodeType() != etk::FSN_FOLDER) {
continue;
}
std::string filename = it->getName() + "/highlight.xml";
APPL_DEBUG("Load xml name : " << filename);
ememory::SharedPtr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
std::shared_ptr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
if (myHightLine != nullptr) {
// Check if the language name already exist
for (auto &it2 : hlList) {
if ( it2 != nullptr
&& it2->getTypeName() == myHightLine->getTypeName() ) {
APPL_WARNING("LANGUAGE : replace pattern name: '" << myHightLine->getTypeName() << "' with file '" << filename << "' replace: " << it2->getName());
}
}
hlList.push_back(myHightLine);
} else {
APPL_ERROR("Can not allocate HighLight");
@@ -63,7 +61,7 @@ void appl::highlightManager::init() {
}
void appl::highlightManager::unInit() {
std::vector<ememory::SharedPtr<Highlight>>& hlList = s_list();
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
if (hlList.size() == 0) {
APPL_DEBUG("HighlightManager ==> no highlight");
hlList.clear();
@@ -72,19 +70,19 @@ void appl::highlightManager::unInit() {
hlList.clear();
}
std::string appl::highlightManager::getTypeFile(const std::string& _fileName) {
if (_fileName.size() == 0) {
std::string appl::highlightManager::getTypeExtention(const std::string& _extention) {
if (_extention.size() == 0) {
return "";
}
APPL_DEBUG("Try to find type for extention : '" << _fileName << "' in " << s_list().size() << " types");
std::vector<ememory::SharedPtr<Highlight>>& hlList = s_list();
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
for (auto &it : hlList) {
if (it == nullptr) {
continue;
}
APPL_DEBUG(" check : " << it->getTypeName());
if (it->isCompatible(_fileName) == true) {
APPL_DEBUG("Find type for extention : " << _fileName
if (it->hasExtention(_extention) == true) {
APPL_DEBUG("Find type for extention : " << _extention
<< " type : " << it->getTypeName());
return it->getTypeName();
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __HIGHLIGHT_MANAGER_H__
#define __HIGHLIGHT_MANAGER_H__
#include <etk/types.h>
#include <appl/globalMsg.h>
@@ -22,10 +27,10 @@ namespace appl {
void unInit();
/**
* @brief Un-Init the Highlight manager
* @param[in] _fileName name of the file
* @param[in] extention of the file
* @return type of highlight
*/
std::string getTypeFile(const std::string& _fileName);
std::string getTypeExtention(const std::string& _extention);
/**
* @brief Get filename with type.
* @param[in] _type Type name of the highlight.
@@ -38,5 +43,8 @@ namespace appl {
*/
std::vector<std::string> getTypeList();
};
}
};
#endif

View File

@@ -1,69 +1,43 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
#include <appl/global.h>
#include <appl/HighlightPattern.h>
appl::HighlightPattern::HighlightPattern(const ememory::SharedPtr<appl::GlyphPainting>& _glyphPainting, const exml::Element& _child, int32_t _level) :
#undef __class__
#define __class__ "HighlightPattern"
appl::HighlightPattern::HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting) :
m_glyphPainting(_glyphPainting),
m_paternName(""),
m_hasParsingError(true),
m_regexValue(),
m_hasEndRegEx(false),
m_regExp(),
m_regExp(nullptr),
m_colorName(""),
m_level(0) {
parseRules(_child, _level);
}
appl::HighlightPattern::HighlightPattern() :
m_glyphPainting(),
m_paternName(""),
m_hasParsingError(true),
m_regexValue(),
m_hasEndRegEx(false),
m_regExp(),
m_colorName(""),
m_level(0) {
m_regExp = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
}
appl::HighlightPattern::~HighlightPattern() {
}
void appl::HighlightPattern::setPatern(const std::string& _regExp, const std::string& _regExpStop, bool _hasEndRegEx) {
m_regexValue[0] = _regExp;
m_regexValue[1] = _regExpStop;
m_hasEndRegEx = _hasEndRegEx;
APPL_DEBUG("parse regex='" << _regExp << "' -> '" << _regExpStop << "'");
m_hasParsingError = false;
if (_regExp != "") {
try {
m_regExp[0].assign(_regExp, std::regex_constants::optimize | std::regex_constants::ECMAScript);
} catch (std::regex_error e) {
m_hasParsingError = true;
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << _regExp);
}
}
if (_regExpStop != "") {
try {
m_regExp[1].assign(_regExpStop, std::regex_constants::optimize | std::regex_constants::ECMAScript);
} catch (std::regex_error e) {
m_hasParsingError = true;
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << _regExpStop);
}
void appl::HighlightPattern::setPatern(std::string& _regExp, bool forceMaximize) {
if (m_regExp == nullptr) {
return;
}
m_regExp->compile(_regExp);
m_regExp->setMaximize(forceMaximize);
}
std::string appl::HighlightPattern::getPaternString() {
return m_regExp->getRegExDecorated();
}
std::pair<std::string,std::string> appl::HighlightPattern::getPaternString() {
return std::make_pair(m_regexValue[0], m_regexValue[1]);
}
void appl::HighlightPattern::setColorGlyph(const std::string& _colorName) {
void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
m_colorName = _colorName;
m_colorId = m_glyphPainting->request(m_colorName);
APPL_VERBOSE("Resuest color name '" << m_colorName << "' => id=" << m_colorId);
@@ -72,21 +46,21 @@ void appl::HighlightPattern::setColorGlyph(const std::string& _colorName) {
void appl::HighlightPattern::display() {
APPL_INFO("patern : '" << m_paternName << "' level=" << m_level );
APPL_INFO(" == > colorName '" << m_colorName << "'");
APPL_INFO(" == > regex '" << m_regexValue[0] << "' ==> '" << m_regexValue[1] << "'");
APPL_INFO(" == > regExp '" << m_regExp->getRegExp() << "'");
}
void appl::HighlightPattern::parseRules(const exml::Element& _child, int32_t _level) {
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level, bool forceMaximize) {
//--------------------------------------------------------------------------------------------
/*
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#</regex>
<sub>namexxx</sub>
<max>false</max>
</rule>
*/
//--------------------------------------------------------------------------------------------
// process attribute
std::string highLightName = _child.attributes["name"];
std::string highLightName = _child->getAttribute("name");
std::string myEdnDataTmp = "???";
if (highLightName.size()!=0) {
myEdnDataTmp = highLightName;
@@ -94,154 +68,47 @@ void appl::HighlightPattern::parseRules(const exml::Element& _child, int32_t _le
setName(myEdnDataTmp);
setLevel(_level);
exml::Element xChild = _child.nodes["color"];
if (xChild.exist() == true) {
std::string myData = xChild.getText();
exml::Element* xChild = _child->getNamed("color");
if (nullptr != xChild) {
std::string myData = xChild->getText();
if (myData.size() != 0) {
setColorGlyph(myData);
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
std::string myEdnData = myData;
setColorGlyph(myEdnData);
}
}
std::string paterStart;
std::string paterStop;
xChild = _child.nodes["regex"];
if (xChild.exist() == true) {
if (xChild.nodes.size() == 1 && xChild.nodes[0].getType() == exml::nodeType::text) {
std::string myData = xChild.getText();
xChild = _child->getNamed("max");
if (nullptr != xChild) {
forceMaximize = etk::string_to_bool(xChild->getText());
}
xChild = _child->getNamed("regex");
if (nullptr != xChild) {
std::string myData = xChild->getText();
if (myData.size() != 0) {
paterStart = myData;
}
setPatern(paterStart);
} else {
exml::Element xxChild = xChild.nodes["start"];
if (xxChild.exist() == true) {
std::string myData = xxChild.getText();
if (myData.size() != 0) {
paterStart = myData;
}
}
xxChild = xChild.nodes["stop"];
if (xxChild.exist() == true) {
std::string myData = xxChild.getText();
if (myData.size() != 0) {
paterStop = myData;
}
}
setPatern(paterStart, paterStop, true);
}
}
xChild = _child.nodes["sub"];
if (xChild.exist() == true) {
std::string myData = xChild.getText();
if (myData.size() != 0) {
setSubPatternName(myData);
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
std::string myEdnData = myData;
setPatern(myEdnData, forceMaximize);
}
}
}
static std::pair<int64_t,int64_t> findRegex(int32_t _start,
int32_t _stop,
std::regex& _regex,
const std::string& _buffer) {
std::smatch resultMatch;
std::regex_constants::match_flag_type flags = std::regex_constants::match_continuous; // check only the match at the first character.
//APPL_DEBUG("find data at : start=" << _start << " stop=" << _stop << " regex='" << m_regexValue << "'");
if ((int64_t)_stop <= (int64_t)_buffer.size()) {
char val = _buffer[_stop];
if ( val != '\n'
&& val != '\r') {
//after last char ==> not end of line ($ would not work))
flags |= std::regex_constants::match_not_eol;
}
/*
if (!( ('a' <= val && val <= 'z')
|| ('A' <= val && val <= 'Z')
|| ('0' <= val && val <= '9')
|| val == '_')) {
flags |= std::regex_constants::match_not_eow;
}
*/
}
if (_start>0) {
flags |= std::regex_constants::match_prev_avail;
}
if ( _stop < 0
|| size_t(_stop) > _buffer.size()) {
APPL_ERROR(" error in indexing for regex ... _stop=" << _stop << " >= _buffer.size()=" << _buffer.size());
return std::pair<int64_t,int64_t>(-1,0);
}
if ( _start < 0
|| size_t(_start) > _buffer.size()) {
APPL_ERROR(" error in indexing for regex ... _start=" << _start << " >= _buffer.size()=" << _buffer.size());
return std::pair<int64_t,int64_t>(-1,0);
}
if (_start > _stop) {
APPL_ERROR(" error in indexing for regex ... _start=" << _start << " > _stop=" << _stop);
return std::pair<int64_t,int64_t>(-1,0);
}
std::regex_search(_buffer.begin() + _start, _buffer.begin() + _stop, resultMatch, _regex, flags);
if (resultMatch.size() > 0) {
int64_t start = std::distance(_buffer.begin(), resultMatch[0].first);
int64_t stop = std::distance(_buffer.begin(), resultMatch[0].second);
//APPL_DEBUG("find data at : start=" << _resultat.start << " stop=" << _resultat.stop << " data='" <<std::string(_buffer, _resultat.start, _resultat.stop-_resultat.start) << "'" );
/*
if (true){
//TK_DEBUG("in line : '" << etk::to_string(_buffer) << "'");
APPL_DEBUG(" Find " << resultMatch.size() << " elements");
for (size_t iii=0; iii<resultMatch.size(); ++iii) {
int32_t posStart = std::distance(_buffer.begin(), resultMatch[iii].first);
int32_t posStop = std::distance(_buffer.begin(), resultMatch[iii].second);
APPL_DEBUG(" [" << iii << "] " << posStart << " to " << posStop);
}
}
*/
return std::pair<int64_t,int64_t>(start,stop);
}
return std::pair<int64_t,int64_t>(-1,0);
}
bool appl::HighlightPattern::find(int32_t _start,
enum resultFind appl::HighlightPattern::find(int32_t _start,
int32_t _stop,
appl::HighlightInfo& _resultat,
const std::string& _buffer) {
etk::Buffer& _buffer) {
//APPL_DEBUG(" try to find the element");
_resultat.start = -1;
_resultat.stop = -1;
_resultat.notEnded = false;
_resultat.patern = this;
if (m_hasParsingError == true) {
return false;
// when we have only one element:
if (true == m_regExp->processOneElement(_buffer, _start, _stop)) {
_resultat.start = m_regExp->start();
_resultat.stop = m_regExp->stop();
return HLP_FIND_OK;
}
// phase 1 start regEx or global regex:
if (m_regexValue[0].size() == 0) {
return false;
}
std::pair<int64_t,int64_t> ret0 = findRegex(_start, _stop, m_regExp[0], _buffer);
if (ret0.first >= 0) {
_resultat.start = ret0.first;
_resultat.stop = ret0.second;
//APPL_DEBUG("find data at : start=" << _resultat.start << " stop=" << _resultat.stop << " data='" <<std::string(_buffer, _resultat.start, _resultat.stop-_resultat.start) << "'" );
// second step : Complex searching ...
if (m_hasEndRegEx == true) {
// when no regex specify ==> get all the buffer ...
if (m_regexValue[1].size() == 0) {
_resultat.stop = _stop;
return true;
}
_start = _resultat.stop;
while (_start < _stop) {
std::pair<int64_t,int64_t> ret1 = findRegex(_start, _stop, m_regExp[1], _buffer);
if (ret1.first >= 0) {
_resultat.stop = ret1.second;
return true;
}
_start++;
}
_resultat.stop = _stop;
_resultat.notEnded = true; // TODO : Manege back the not ended ...
return false;
}
return true;
}
return false;
//APPL_DEBUG("NOT find hightlightpatern ...");
return HLP_FIND_ERROR;
}

View File

@@ -1,58 +1,58 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#include <appl/Highlight.h>
#ifndef __HIGHLIGHT_PATTERN_H__
#define __HIGHLIGHT_PATTERN_H__
class HighlightPattern;
#include <etk/RegExp.h>
#include <appl/GlyphPainting.h>
#include <vector>
#include <regex>
#include <exml/exml.h>
#include <etk/Buffer.h>
enum resultFind {
HLP_FIND_ERROR,
HLP_FIND_OK,
HLP_FIND_OK_NO_END,
};
namespace appl {
class HighlightPattern {
private:
ememory::SharedPtr<appl::GlyphPainting> m_glyphPainting;
std::shared_ptr<appl::GlyphPainting> m_glyphPainting;
public:
// Constructeur
HighlightPattern();
HighlightPattern(const ememory::SharedPtr<appl::GlyphPainting>& _glyphPainting, const exml::Element& _child, int32_t _level);
HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting);
virtual ~HighlightPattern();
private:
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
public:
void setName(const std::string& _name) {
void setName(std::string& _name) {
m_paternName = _name;
};
const std::string& getName() {
std::string getName() {
return m_paternName;
};
private:
std::string m_paternSubName; //!< Sub patern name if needed
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExp; //!< Start of Regular expression
public:
void setSubPatternName(const std::string& _name) {
m_paternSubName = _name;
};
const std::string& getSubPatternName() {
return m_paternSubName;
};
private:
bool m_hasParsingError;
std::string m_regexValue[2];
bool m_hasEndRegEx;
std::regex m_regExp[2]; //!< Start of Regular expression
public:
void setPatern(const std::string& _regExp, const std::string& _regExpStop="", bool _hasEndRegEx=false);
std::pair<std::string,std::string> getPaternString();
void setPatern(std::string& _regExp, bool forceMaximize=false);
std::string getPaternString();
private:
std::string m_colorName; //!< Current color name
int32_t m_colorId; //!< Id of the the glyph painting
public:
void setColorGlyph(const std::string& _colorName);
void setColorGlyph(std::string& _colorName);
const appl::GlyphDecoration& getColorGlyph() {
return (*m_glyphPainting)[m_colorId];
};
@@ -75,15 +75,19 @@ namespace appl {
* @param[in] _stop End of the possibility whe search can continue
* @param[out] _resultat Position where find data
* @param[in] _buffer : Where to search data
* @return true We find a compleate pattern
* @return false Not find the pattern
* @return HLP_FIND_OK We find a compleate pattern
* @return HLP_FIND_OK_NO_END Xe find a partial pattern (missing end)
* @return HLP_FIND_ERROR Not find the pattern
*/
bool find(int32_t _start,
enum resultFind find(int32_t _start,
int32_t _stop,
appl::HighlightInfo& _resultat,
const std::string& _buffer);
etk::Buffer& _buffer);
void parseRules(const exml::Element& _child, int32_t _level);
void parseRules(exml::Element* _child, int32_t _level, bool forceMaximize=false);
};
}
};
#endif

View File

@@ -1,12 +1,20 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPlugin.h>
#include <appl/TextPluginManager.h>
#include <appl/debug.h>
#undef __class__
#define __class__ "TextViewerPlugin"
appl::TextViewerPlugin::TextViewerPlugin() :
m_isEnable(true),
m_activateOnEventEntry(false),
@@ -17,7 +25,7 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_activateOnReceiveShortCut(false),
m_activateOnCursorMove(false) {
addObjectType("appl::TextViewerPlugin");
m_menuInterface = ememory::dynamicPointerCast<ewol::widget::Menu>(getObjectNamed("appl-menu-interface"));
m_menuInterface = std::dynamic_pointer_cast<ewol::widget::Menu>(getObjectNamed("appl-menu-interface"));
if (m_menuInterface.expired() == true) {
APPL_ERROR("Can not acces to the Menu interface");
}
@@ -25,6 +33,14 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_pluginManager = appl::textPluginManager::create();
}
void appl::TextViewerPlugin::init() {
ewol::Object::init();
}
void appl::TextViewerPlugin::init(const std::string& _name) {
ewol::Object::init(_name);
}
appl::TextViewerPlugin::~TextViewerPlugin() {
if (m_isEnable == false) {
return;

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_H__
#define __APPL_TEXT_PLUGIN_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -12,20 +17,19 @@
namespace appl {
class textPluginManager;
class TextViewerPlugin;
using TextViewerPluginShared = ememory::SharedPtr<TextViewerPlugin>;
using TextViewerPluginWeak = ememory::WeakPtr<TextViewerPlugin>;
class TextViewerPlugin : public ewol::Object {
friend class appl::TextViewer;
protected:
ememory::WeakPtr<appl::textPluginManager> m_pluginManager;
std::weak_ptr<appl::textPluginManager> m_pluginManager;
protected:
TextViewerPlugin();
void init();
void init(const std::string& _name);
public:
DECLARE_FACTORY(TextViewerPlugin);
virtual ~TextViewerPlugin();
protected:
ewol::widget::MenuWeak m_menuInterface;
std::weak_ptr<ewol::widget::Menu> m_menuInterface;
private:
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
public:
@@ -216,5 +220,7 @@ namespace appl {
return false;
}
};
}
};
#endif

View File

@@ -1,17 +1,28 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginAutoIndent.h>
#include <gale/context/clipBoard.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginAutoIndent"
appl::TextPluginAutoIndent::TextPluginAutoIndent() {
m_activateOnEventEntry = true;
addObjectType("appl::TextPluginAutoIndent");
}
void appl::TextPluginAutoIndent::init() {
appl::TextViewerPlugin::init();
}
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event) {
@@ -20,10 +31,10 @@ bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
}
//APPL_DEBUG("KB EVENT : " << _event);
// just forward event == > manage directly in the buffer
if (_event.getType() != gale::key::keyboard::character) {
if (_event.getType() != ewol::key::keyboardChar) {
return false;
}
if (_event.getStatus() != gale::key::status::down) {
if (_event.getStatus() != ewol::key::statusDown) {
return false;
}
if (_event.getChar() != u32char::Return) {

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_AUTO_INDENT_H__
#define __APPL_TEXT_PLUGIN_AUTO_INDENT_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -14,6 +19,7 @@ namespace appl {
class TextPluginAutoIndent : public appl::TextViewerPlugin {
protected:
TextPluginAutoIndent();
void init();
public:
DECLARE_FACTORY(TextPluginAutoIndent);
virtual ~TextPluginAutoIndent() {
@@ -23,5 +29,7 @@ namespace appl {
virtual bool onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event);
};
}
};
#endif

View File

@@ -1,13 +1,20 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginCopy.h>
#include <gale/context/clipBoard.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginCopy"
appl::TextPluginCopy::TextPluginCopy() :
m_menuIdTitle(-1),
m_menuIdCopy(-1),
@@ -18,9 +25,13 @@ appl::TextPluginCopy::TextPluginCopy() :
addObjectType("appl::TextPluginCopy");
}
void appl::TextPluginCopy::init() {
appl::TextViewerPlugin::init();
}
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event :
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
@@ -39,7 +50,7 @@ void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::cut");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::copy");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::Paste");
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRemove);
menu->remove(m_menuIdPast);
@@ -65,7 +76,7 @@ bool appl::TextPluginCopy::onReceiveShortCut(appl::TextViewer& _textDrawer,
std::string value;
_textDrawer.copy(value);
if (value.size() != 0) {
gale::context::clipBoard::set(gale::context::clipBoard::clipboardStd, value);
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardStd, value);
}
}
if (_shortCutName == "appl::TextPluginCopy::cut") {
@@ -74,7 +85,7 @@ bool appl::TextPluginCopy::onReceiveShortCut(appl::TextViewer& _textDrawer,
return true;
} else if (_shortCutName == "appl::TextPluginCopy::Paste") {
if (_textDrawer.hasBuffer() == true) {
gale::context::clipBoard::request(gale::context::clipBoard::clipboardStd);
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd);
}
return true;
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_COPY_H__
#define __APPL_TEXT_PLUGIN_COPY_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -20,6 +25,7 @@ namespace appl {
int32_t m_menuIdRemove;
protected:
TextPluginCopy();
void init();
public:
DECLARE_FACTORY(TextPluginCopy);
virtual ~TextPluginCopy() {
@@ -30,5 +36,7 @@ namespace appl {
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
};
}
};
#endif

View File

@@ -1,15 +1,23 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginCtags.h>
#include <gale/context/clipBoard.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#include <ewol/widget/meta/FileChooser.h>
#include <ewol/context/Context.h>
#include <appl/Gui/TagFileSelection.h>
#undef __class__
#define __class__ "TextPluginCtags"
appl::TextPluginCtags::TextPluginCtags() :
m_tagFolderBase(""),
m_tagFilename(""),
@@ -20,6 +28,11 @@ appl::TextPluginCtags::TextPluginCtags() :
addObjectType("appl::TextPluginCtags");
}
void appl::TextPluginCtags::init() {
appl::TextViewerPlugin::init();
}
appl::TextPluginCtags::~TextPluginCtags() {
}
@@ -59,8 +72,8 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
APPL_INFO("Multiple file destination ...");
ememory::SharedPtr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
if (tmpWidget == nullptr) {
std::shared_ptr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
if (nullptr == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
@@ -72,7 +85,7 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->signalSelect.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
tmpWidget->signalSelect.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
}
} else {
jumpFile(myfile.getName(), lineID - 1);
@@ -156,21 +169,21 @@ bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
}
if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
APPL_INFO("Request opening ctag file");
ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (tmpWidget == nullptr) {
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (nullptr == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
return true;
}
tmpWidget->propertyLabelTitle.set("Open Exuberant Ctags file");
tmpWidget->propertyLabelValidate.set("Open");
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->propertyPath.set(path);
tmpWidget->setFolder(path);
}
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
tmpWidget->signalValidate.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
return true;
} else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
if (_textDrawer.hasBuffer() == false) {

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_CTAGS_H__
#define __APPL_TEXT_PLUGIN_CTAGS_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -28,9 +33,10 @@ namespace appl {
void printTag(const tagEntry *_entry);
void jumpTo(const std::string& _name);
void jumpFile(const std::string& _filename, int64_t _lineId);
ememory::SharedPtr<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:
DECLARE_FACTORY(TextPluginCtags);
virtual ~TextPluginCtags();
@@ -43,5 +49,7 @@ namespace appl {
void onCallbackOpenCtagsOpenFileReturn(const std::string& _value);
void onCallbackOpenCtagsSelectReturn(const std::string& _value);
};
}
};
#endif

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_DATA_H__
#define __APPL_TEXT_PLUGIN_DATA_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -17,39 +22,48 @@ namespace appl {
// nothing to do ...
addObjectType("appl::TextViewerPluginData");
}
void init() {
appl::TextViewerPlugin::init();
}
void init(const std::string& _name) {
appl::TextViewerPlugin::init(_name);
}
public:
DECLARE_FACTORY(TextViewerPluginData);
virtual ~TextViewerPluginData() {
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
if (m_specificData[iii].second != nullptr) {
remove(*m_specificData[iii].second);
delete(m_specificData[iii].second);
m_specificData[iii].second = nullptr;
}
}
m_specificData.clear();
}
private:
std::vector<std::pair<ememory::WeakPtr<appl::Buffer> ,std::unique_ptr<TYPE>>> m_specificData;
std::vector<std::pair<std::weak_ptr<appl::Buffer> ,TYPE* >> m_specificData;
protected:
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
auto it = m_specificData.begin();
while(it != m_specificData.end()) {
ememory::SharedPtr<appl::Buffer> buf = it->first.lock();
std::shared_ptr<appl::Buffer> buf = it->first.lock();
if (buf == nullptr) {
delete(it->second);
it->second = nullptr;
it = m_specificData.erase(it);
continue;
}
if (buf == _textDrawer.internalGetBuffer()) {
return it->second.get();
return it->second;
}
++it;
}
std::unique_ptr<TYPE> data(new TYPE());
TYPE* data = new TYPE();
if (data == nullptr) {
return nullptr;
}
m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), std::move(data)));
m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), data));
// create a new one ...
return data.get();
return data;
}
protected: // Wrap all element with their internal data: (do not use theses function)
bool onReceiveShortCut(appl::TextViewer& _textDrawer,
@@ -118,5 +132,7 @@ namespace appl {
return;
};
};
}
};
#endif

View File

@@ -1,12 +1,20 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginHistory.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#include <appl/TextPluginManager.h>
#undef __class__
#define __class__ "TextPluginHistory"
appl::TextPluginHistory::TextPluginHistory() :
m_menuIdTitle(-1),
m_menuIdUndo(-1),
@@ -18,9 +26,13 @@ appl::TextPluginHistory::TextPluginHistory() :
addObjectType("appl::TextPluginHistory");
}
void appl::TextPluginHistory::init() {
appl::TextViewerPluginData<appl::PluginHistoryData>::init();
}
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
@@ -36,7 +48,7 @@ void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Undo");
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Redo");
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRedo);
menu->remove(m_menuIdUndo);
@@ -137,7 +149,7 @@ bool appl::TextPluginHistory::onDataWrite(appl::TextViewer& _textDrawer,
clearRedo(_data);
_data.m_undo.push_back(tmpElement);
}
ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
@@ -165,7 +177,7 @@ bool appl::TextPluginHistory::onDataReplace(appl::TextViewer& _textDrawer,
clearRedo(_data);
_data.m_undo.push_back(tmpElement);
}
ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
@@ -190,7 +202,7 @@ bool appl::TextPluginHistory::onDataRemove(appl::TextViewer& _textDrawer,
_data.m_undo.push_back(tmpElement);
}
_textDrawer.removeDirect();
ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_HISTORY_H__
#define __APPL_TEXT_PLUGIN_HISTORY_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -37,6 +42,7 @@ namespace appl {
int32_t m_menuIdRedo;
protected:
TextPluginHistory();
void init();
public:
DECLARE_FACTORY(TextPluginHistory);
virtual ~TextPluginHistory() { };
@@ -68,5 +74,7 @@ namespace appl {
void clearRedo(appl::PluginHistoryData& _data);
void clearUndo(appl::PluginHistoryData& _data);
};
}
};
#endif

View File

@@ -1,8 +1,11 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginManager.h>
#include <appl/debug.h>
#include <appl/TextPluginCopy.h>
@@ -13,11 +16,14 @@
#include <appl/TextPluginSelectAll.h>
#include <appl/TextPluginCtags.h>
#undef __class__
#define __class__ "textPluginManager"
appl::textPluginManager::textPluginManager() {
}
void appl::textPluginManager::init(const std::string& _name) {
gale::Resource::init(_name);
ewol::Resource::init(_name);
}
void appl::textPluginManager::addDefaultPlugin() {
@@ -30,7 +36,7 @@ void appl::textPluginManager::addDefaultPlugin() {
appl::textPluginManager::addPlugin(appl::TextPluginCtags::create());
}
void appl::textPluginManager::addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin) {
void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin) {
if (_plugin == nullptr) {
return;
}
@@ -57,14 +63,14 @@ void appl::textPluginManager::addPlugin(ememory::SharedPtr<appl::TextViewerPlugi
if (_plugin->isAvaillableOnCursorMove() == true) {
m_listOnCursorMove.push_back(_plugin);
}
ememory::SharedPtr<appl::TextViewer> viewer = m_currentViewer.lock();
std::shared_ptr<appl::TextViewer> viewer = m_currentViewer.lock();
if (viewer != nullptr) {
_plugin->onPluginEnable(*viewer);
}
}
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
m_currentViewer = ememory::dynamicPointerCast<appl::TextViewer>(_widget.sharedFromThis());
m_currentViewer = std::dynamic_pointer_cast<appl::TextViewer>(_widget.shared_from_this());
for (auto &it : m_list) {
if (it == nullptr) {
continue;

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_MANAGER_H__
#define __APPL_TEXT_PLUGIN_MANAGER_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -11,17 +16,17 @@
#include <appl/TextPlugin.h>
namespace appl {
class textPluginManager : public gale::Resource {
class textPluginManager : public ewol::Resource {
private:
ememory::WeakPtr<appl::TextViewer> m_currentViewer;
std::list<ememory::SharedPtr<appl::TextViewerPlugin>> m_list;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventEntry;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventInput;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnWrite;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReplace;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnRemove;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReceiveShortCutViewer;
std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnCursorMove;
std::weak_ptr<appl::TextViewer> m_currentViewer;
std::list<std::shared_ptr<appl::TextViewerPlugin>> m_list;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnEventEntry;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnEventInput;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnWrite;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnReplace;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnRemove;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnReceiveShortCutViewer;
std::vector<std::shared_ptr<appl::TextViewerPlugin>> m_listOnCursorMove;
protected:
textPluginManager();
void init(const std::string& _name);
@@ -36,7 +41,7 @@ namespace appl {
* @brief Add a plugin.
* @param[in] _plugin Plugin pointer to add.
*/
void addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin);
void addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin);
/**
* @brief connect a new widget to the plugin.
* @param[in] _widget Reference on the widget caller.
@@ -112,5 +117,7 @@ namespace appl {
bool onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos);
};
}
};
#endif

View File

@@ -1,27 +1,38 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginMultiLineTab.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginMultiLineTab"
appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
m_activateOnEventEntry = true;
addObjectType("appl::TextPluginMultiLineTab");
}
void appl::TextPluginMultiLineTab::init() {
appl::TextViewerPlugin::init();
}
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event) {
if (isEnable() == false) {
return false;
}
if (_event.getType() != gale::key::keyboard::character) {
if (_event.getType() != ewol::key::keyboardChar) {
return false;
}
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (_event.getStatus() != gale::key::status::down) {
if (_event.getStatus() != ewol::key::statusDown) {
return false;
}
char32_t localValue = _event.getChar();

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_MULTI_LINE_TAB_H__
#define __APPL_TEXT_PLUGIN_MULTI_LINE_TAB_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -14,6 +19,7 @@ namespace appl {
class TextPluginMultiLineTab : public appl::TextViewerPlugin {
protected:
TextPluginMultiLineTab();
void init();
public:
DECLARE_FACTORY(TextPluginMultiLineTab);
virtual ~TextPluginMultiLineTab() {
@@ -23,5 +29,8 @@ namespace appl {
virtual bool onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event);
};
}
};
#endif

View File

@@ -1,16 +1,28 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginRmLine.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginRmLine"
appl::TextPluginRmLine::TextPluginRmLine() {
m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginRmLine");
}
void appl::TextPluginRmLine::init() {
appl::TextViewerPlugin::init();
}
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event :

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_RM_LINE_H__
#define __APPL_TEXT_RM_LINE_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -14,6 +19,7 @@ namespace appl {
class TextPluginRmLine : public appl::TextViewerPlugin {
protected:
TextPluginRmLine();
void init();
public:
DECLARE_FACTORY(TextPluginRmLine);
virtual ~TextPluginRmLine() {
@@ -24,5 +30,7 @@ namespace appl {
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
};
}
};
#endif

View File

@@ -1,11 +1,20 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/TextPluginSelectAll.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginSelectAll"
appl::TextPluginSelectAll::TextPluginSelectAll() :
m_menuIdTitle(-1),
m_menuIdSelectAll(-1),
@@ -14,9 +23,12 @@ appl::TextPluginSelectAll::TextPluginSelectAll() :
addObjectType("appl::TextPluginSelectAll");
}
void appl::TextPluginSelectAll::init() {
appl::TextViewerPlugin::init();
}
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
@@ -32,7 +44,7 @@ void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::None");
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdSelectNone);
menu->remove(m_menuIdSelectAll);

View File

@@ -1,9 +1,14 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __APPL_TEXT_PLUGIN_SELECT_ALL_H__
#define __APPL_TEXT_PLUGIN_SELECT_ALL_H__
#include <etk/types.h>
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
@@ -14,6 +19,7 @@ namespace appl {
class TextPluginSelectAll : public appl::TextViewerPlugin {
protected:
TextPluginSelectAll();
void init();
int32_t m_menuIdTitle;
int32_t m_menuIdSelectAll;
int32_t m_menuIdSelectNone;
@@ -27,5 +33,7 @@ namespace appl {
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
};
}
};
#endif

View File

@@ -1,11 +1,15 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/debug.h>
int32_t appl::getLogId() {
static int32_t g_val = elog::registerInstance("edn");
static int32_t g_val = etk::log::registerInstance("edn");
return g_val;
}

View File

@@ -1,16 +1,29 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#include <elog/log.h>
#ifndef __APPL_DEBUG_H__
#define __APPL_DEBUG_H__
#include <etk/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
// 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) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)
@@ -35,3 +48,4 @@ namespace appl {
} \
} while (0)
#endif

View File

@@ -1,29 +1,35 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/global.h>
#include <appl/globalMsg.h>
#include <ewol/object/Object.h>
#include <ewol/context/Context.h>
#include <gale/resource/Manager.h>
#include <ewol/resource/Manager.h>
#include <etk/os/FSNode.h>
#undef __class__
#define __class__ "globals"
class myParamGlobal : public ewol::Object {
public:
eproperty::Value<bool> m_displayEOL;
eproperty::Value<bool> m_AutoIndent;
eproperty::Value<bool> m_displayTabChar;
eproperty::Value<bool> m_displaySpaceChar;
ewol::object::Param<bool> m_displayEOL;
ewol::object::Param<bool> m_AutoIndent;
ewol::object::Param<bool> m_displayTabChar;
ewol::object::Param<bool> m_displaySpaceChar;
public :
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_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)
propertyName.set("edn_global_param");
setName("edn_global_param");
}
};
@@ -48,7 +54,7 @@ bool globals::isSetDisplayEndOfLine() {
}
void globals::setDisplayEndOfLine(bool newVal) {
l_obj().m_displayEOL.set(newVal);
l_obj().m_displayEOL = newVal;
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
}
@@ -58,7 +64,7 @@ bool globals::isSetDisplaySpaceChar() {
}
void globals::setDisplaySpaceChar(bool _newVal) {
l_obj().m_displaySpaceChar.set(_newVal);
l_obj().m_displaySpaceChar = _newVal;
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
}
// -----------------------------------------------------------
@@ -67,7 +73,7 @@ bool globals::isSetDisplayTabChar() {
}
void globals::setDisplayTabChar(bool _newVal) {
l_obj().m_displayTabChar.set(_newVal);
l_obj().m_displayTabChar = _newVal;
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
}
@@ -77,7 +83,7 @@ bool globals::isSetAutoIndent() {
}
void globals::setAutoIndent(bool _newVal) {
l_obj().m_AutoIndent.set(_newVal);
l_obj().m_AutoIndent = _newVal;
}
// -----------------------------------------------------------
@@ -103,67 +109,60 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui() {
}
void globals::ParameterGlobalsGui::init() {
ewol::widget::Sizer::init();
propertyMode.set(ewol::widget::Sizer::modeVert);
ememory::SharedPtr<ewol::widget::CheckBox> myCheckbox;
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
std::shared_ptr<ewol::widget::CheckBox> myCheckbox;
std::shared_ptr<ewol::widget::Spacer> mySpacer;
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == nullptr) {
if (nullptr == mySpacer) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->propertyExpand.set(bvec2(true,true));
mySpacer->setExpand(bvec2(true,true));
subWidgetAdd(mySpacer);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
myCheckbox = ewol::widget::CheckBox::create("Automatic Indentation");
if (nullptr == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Automatic Indentation");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetAutoIndent());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetAutoIndent());
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
myCheckbox = ewol::widget::CheckBox::create("Display space char (' ')");
if (nullptr == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display space char (' ')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplaySpaceChar());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplaySpaceChar());
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackSpace);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
myCheckbox = ewol::widget::CheckBox::create("Display tabulation char ('\\t')");
if (nullptr == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display tabulation char ('\\t')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayTabChar());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayTabChar());
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
myCheckbox = ewol::widget::CheckBox::create("Display end of line ('\\n')");
if (nullptr == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display end of line ('\\n')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
myCheckbox = ewol::widget::CheckBox::create("switch Rounded/default");
if (nullptr == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("switch Rounded/default");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackRounded);
subWidgetAdd(myCheckbox);
}
}

View File

@@ -1,13 +1,20 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#pragma once
#ifndef __TOOLS_GLOBALS_H__
#define __TOOLS_GLOBALS_H__
#include <appl/debug.h>
#include <ewol/widget/Sizer.h>
namespace globals {
namespace globals
{
void init();
void UnInit();
int32_t getNbColoneBorder();
@@ -42,6 +49,9 @@ namespace globals {
void onCallbackTabulation(const bool& _value);
void onCallbackRounded(const bool& _value);
};
}
#endif

View File

@@ -1,8 +1,11 @@
/** @file
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <etk/types.h>
#include <ewol/ewol.h>
#include <ewol/object/Object.h>
@@ -14,7 +17,7 @@
#include <etk/tool.h>
#include <unistd.h>
//#include <ewol/config.h>
#include <gale/context/commandLine.h>
#include <ewol/context/commandLine.h>
//#include <ewol/UserConfig.h>
#include <ewol/context/Context.h>
#include <appl/TextPluginManager.h>
@@ -25,30 +28,20 @@
#include <appl/ctags/readtags.h>
#include <appl/globalMsg.h>
class MainApplication : public ewol::context::Application {
private:
ememory::SharedPtr<appl::BufferManager> m_bufferManager;
ememory::SharedPtr<appl::textPluginManager> m_pluginManager;
std::shared_ptr<appl::BufferManager> m_bufferManager;
std::shared_ptr<appl::textPluginManager> m_pluginManager;
public:
virtual void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h"
|| tmpppp == "--help") {
APPL_INFO(" -t c-flags-file-name" );
APPL_INFO(" -h/--help display this help" );
exit(0);
}
}
//etk::theme::setName("COLOR", "color/black/");
etk::theme::setName("COLOR", "color/white/");
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));
_context.setTitle("edn");
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
#ifdef __TARGET_OS__Android
@@ -59,35 +52,34 @@ class MainApplication : public ewol::context::Application {
// set the application icon ...
_context.setIcon("DATA:icon.png");
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
}
void onStart(ewol::Context& _context) override {
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
// init internal global value
globals::init();
// init ALL Singleton :
//()CTagsManager::getInstance();
m_bufferManager = appl::BufferManager::create();
m_pluginManager = appl::textPluginManager::create();
appl::highlightManager::init();
// Request load of the user configuration ...
//ewol::userConfig::load();
char cCurrentPath[FILENAME_MAX];
// get the curent program folder
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
return;
return false;
}
cCurrentPath[FILENAME_MAX - 1] = '\0';
//APPL_INFO("The current working directory is " << cCurrentPath);
ememory::SharedPtr<MainWindows> basicWindows = MainWindows::create();
std::shared_ptr<MainWindows> basicWindows = MainWindows::create();
if (basicWindows == nullptr) {
APPL_ERROR("Can not allocate the basic windows");
_context.exit(-1);
return;
_context.stop();
return false;
}
// create the specific windows
_context.setWindows(basicWindows);
@@ -108,38 +100,25 @@ class MainApplication : public ewol::context::Application {
APPL_INFO("Load ctag file : \"" << name << "\"" );
ctagDetected = false;
//_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
} else if ( tmpppp == "-h"
|| tmpppp == "--help") {
// nothing to do ...
} else {
etk::FSNode file(tmpppp);
if (file.getNodeType() == etk::typeNode_file) {
std::string name = file.getName();
APPL_INFO("need load file : \"" << name << "\"" );
m_bufferManager->open(name);
}
}
}
APPL_INFO("==> START ... " PROJECT_NAME " (END)");
return;
APPL_INFO(" == > init " PROJECT_NAME " (END)");
return true;
}
void onStop(ewol::Context& _context) override {
APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
void unInit(ewol::Context& _context) {
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
APPL_INFO("Stop Hightlight");
appl::highlightManager::unInit();
//Kill all singleton
m_pluginManager.reset();
m_bufferManager.reset();
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
}
void onKillDemand(ewol::Context& _context) override {
APPL_INFO("==> User demand kill ... " PROJECT_NAME " (START)");
if (m_bufferManager == nullptr) {
_context.exit(0);
}
APPL_TODO("Implement the check of buffer not saved ...");
_context.exit(0);
APPL_INFO("==> User demand kill ... " PROJECT_NAME " (END)");
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
}
};
@@ -151,11 +130,6 @@ class MainApplication : public ewol::context::Application {
* @return std IO
*/
int main(int _argc, const char *_argv[]) {
/*
APPL_ERROR(" base signature = " << typeid(&MainApplication::init).name());
APPL_ERROR(" base signature = " << typeid(std::string).name());
APPL_CRITICAL(" END ");
*/
// second possibility
return ewol::run(new MainApplication(), _argc, _argv);
}

129
sources/lutin_edn.py Executable file
View File

@@ -0,0 +1,129 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
import lutinDebug as debug
import datetime
def get_desc():
return "EDN application N'ours editor (Editeur De N'ours)"
def create(target):
# module name is 'edn' and type binary.
myModule = module.Module(__file__, 'edn', 'PACKAGE')
myModule.add_extra_compile_flags()
# add the file to compile:
myModule.add_src_file([
'appl/ctags/readtags.cpp'])
myModule.add_src_file([
'appl/debug.cpp',
'appl/global.cpp',
'appl/globalMsg.cpp',
'appl/init.cpp'])
# Gui:
myModule.add_src_file([
'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'])
# All needed for the buffer management :
myModule.add_src_file([
'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'])
# Generic color management for the text editor :
myModule.add_src_file([
'appl/GlyphDecoration.cpp',
'appl/GlyphPainting.cpp'])
# syntax coloration for the text editor
myModule.add_src_file([
'appl/HighlightPattern.cpp',
'appl/Highlight.cpp',
'appl/HighlightManager.cpp'])
myModule.add_module_depend('ewol')
myModule.compile_flags_CC([
"-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""
])
#myModule.copy_file('../data/icon.png','icon.png')
myModule.copy_folder('../data/icon.*','')
myModule.copy_folder('../data/languages/asm/*.xml','languages/asm/')
myModule.copy_folder('../data/languages/bash/*.xml','languages/bash/')
myModule.copy_folder('../data/languages/boo/*.xml','languages/boo/')
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/in/*.xml','languages/in/')
myModule.copy_folder('../data/languages/java/*.xml','languages/java/')
myModule.copy_folder('../data/languages/json/*.xml','languages/json/')
myModule.copy_folder('../data/languages/lua/*.xml','languages/lua/')
myModule.copy_folder('../data/languages/makefile/*.xml','languages/makefile/')
myModule.copy_folder('../data/languages/matlab/*.xml','languages/matlab/')
myModule.copy_folder('../data/languages/php/*.xml','languages/php/')
myModule.copy_folder('../data/languages/xml/*.xml','languages/xml/')
myModule.copy_folder('../data/languages/python/*.xml','languages/python/')
myModule.copy_folder('../data/theme/default/*.svg','theme/shape/square/')
myModule.copy_folder('../data/theme/default/*.edf','theme/shape/square/')
myModule.copy_folder('../data/theme/colorWhite/*.json','theme/color/white/')
myModule.copy_folder('../data/theme/colorBlack/*.json','theme/color/black/')
myModule.copy_folder('../data/GUI-Search.xml','')
myModule.add_path(tools.get_current_path(__file__))
myModule.copy_file("../data/Font/freefont/FreeSerif.ttf","fonts/FreeSerif.ttf")
myModule.copy_folder("../data/Font/freefont/FreeMon*.ttf","fonts/")
tagFile = tools.get_current_path(__file__) + "/tag"
versionID = tools.file_read_data(tagFile)
myModule.compile_flags_CC([
"-DAPPL_VERSION=\"\\\"" + versionID + "\\\"\""
])
tagFile = tools.get_current_path(__file__) + "/tagCode"
versionIDCode = tools.file_read_data(tagFile)
# set the package properties :
myModule.pkg_set("VERSION", versionID)
myModule.pkg_set("VERSION_CODE", versionIDCode)
myModule.pkg_set("COMPAGNY_TYPE", "org")
myModule.pkg_set("COMPAGNY_NAME", "Edouard DUPIN")
myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
if target.name=="MacOs":
myModule.pkg_set("ICON", tools.get_current_path(__file__) + "/../data/icon.icns")
else:
myModule.pkg_set("ICON", tools.get_current_path(__file__) + "/../data/icon.png")
myModule.pkg_set("SECTION", ["Development", "Editors"])
myModule.pkg_set("PRIORITY", "optional")
myModule.pkg_set("DESCRIPTION", "Text editor for sources code with ctags management")
myModule.pkg_set("NAME", "Editeur de N'ours")
myModule.pkg_add("RIGHT", "WRITE_EXTERNAL_STORAGE")
myModule.pkg_add("RIGHT", "SET_ORIENTATION")
# add the currrent module at the
return myModule

View File

@@ -1 +1 @@
1.2-dev
1.2.2

View File

@@ -1 +1 @@
5
6

View File

@@ -1,52 +0,0 @@
set(GAMEPLAY_SRC
src/AbsoluteLayout.cpp
src/AbsoluteLayout.h
src/BoundingBox.h
src/Transform.h
src/Vector2.cpp
src/Vector2.h
src/lua/lua_ThemeUVs.h
src/lua/lua_Touch.cpp
src/lua/lua_Touch.h
src/lua/lua_TouchTouchEvent.cpp
src/lua/lua_TouchTouchEvent
)
include_directories(
src
../external-deps/lua/include
../external-deps/bullet/include
../external-deps/png/include
../external-deps/zlib/include
../external-deps/oggvorbis/include
../external-deps/openal/include
../external-deps/glew/include
)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK2 REQUIRED gtk+-2.0)
include_directories(${GTK2_INCLUDE_DIRS})
add_definitions(${GTK2_CFLAGS_OTHER})
add_definitions(-D__linux__)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-lstdc++)
add_library(gameplay STATIC
${GAMEPLAY_SRC}
${GAMEPLAY_LUA}
)
set_target_properties(gameplay PROPERTIES
OUTPUT_NAME "gameplay"
CLEAN_DIRECT_OUTPUT 1
VERSION ${GAMEPLAY_VERSION}
)
source_group(lua FILES ${GAMEPLAY_LUA})
source_group(res FILES ${GAMEPLAY_RES} ${GAMEPLAY_RES} ${GAMEPLAY_RES_SHADERS} ${GAMEPLAY_RES_UI})
source_group(src FILES ${GAMEPLAY_SRC})

View File

View File

View File

View File

View File

@@ -1,161 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2010, Edouard DUPIN, all right reserved
* @license GPL v3 (see license file)
*/
#ifndef __EWOL_WIDGET_H__
#define __EWOL_WIDGET_H__
#include <ewol/object/Object.h>
#include <ewol/Dimension.h>
'dfgd\'fg'
'e' sdfsdf '\e'
"dqf\"gsdfg" // \\ \n "
// TODO : sqdkfjsdldkqfj
example_param
=_param
_
_s
_3RTDRsdfqsd
m_
m_d6
namespace ewol {
class Widget;
namespace widget {
class Manager;
class Windows;
};
};
#include <etk/types.h>
#include <vector>
#include <etk/math/Vector2D.h>
#include <ewol/debug.h>
#include <ewol/context/clipBoard.h>
#include <ewol/key/key.h>
#include <ewol/context/cursor.h>
#include <ewol/event/Input.h>
#include <ewol/event/Entry.h>
#include <ewol/event/Time.h>
#define ULTIMATE_MAX_SIZE (99999999)
namespace ewol {
#if 0
/**
* @not_in_doc
*/
#endif
class DrawProperty{
/*
/--> m_windowsSize
*--------------------------------------------------*
| g |
| |
| m_size |
| / |
| o-------------------o |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| o-------------------o |
| / |
| m_origin |
| |
*--------------------------------------------------*
/
(0,0)
*/
public :
ivec2 m_windowsSize; //!< Windows compleate size
ivec2 m_origin; //!< Windows clipping upper widget (can not be <0)
ivec2 m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize)
void limit(const vec2& _origin, const vec2& _size);
};
std::ostream& operator <<(std::ostream& _os, const ewol::DrawProperty& _obj);
/**
* @brief Gravity of the widget property
* @not_in_doc
*/
enum gravity {
gravityCenter=0x00, //!< gravity is in certer
gravityTopLeft=0x05,
gravityTop=0x01,
gravityTopRight=0x03,
gravityRight=0x02,
gravityButtomRight=0x06,
gravityButtom=0x04,
gravityButtomLeft=0x0C,
gravityLeft=0x08,
};
std::ostream& operator <<(std::ostream& _os, const enum ewol::gravity _obj);
std::string gravityToString(const enum ewol::gravity _obj);
enum ewol::gravity stringToGravity(const std::string& _obj);
/**
* @not_in_doc
*/
class EventShortCut {
public:
bool broadcastEvent; //!< if it is true, then the message is sent to all the system
const char* generateEventId; //!< Local generated event
std::string eventData; //!< data link with the event
ewol::key::Special specialKey; //!< special board key
char32_t unicodeValue; //!< 0 if not used
enum ewol::key::keyboard keyboardMoveValue; //!< ewol::EVENT_KB_MOVE_TYPE_NONE if not used
EventShortCut(void) {
broadcastEvent = false;
generateEventId = NULL;
eventData = "";
unicodeValue = 0;
keyboardMoveValue = ewol::key::keyboardUnknow;
};
~EventShortCut(void) { };
};
/**
* @brief Widget class is the main widget interface, it hase some generic properties:
* :** known his parent
* :** Can be display at a special position with a special scale
* :** Can get focus
* :** Receive Event (keyboard / mouse / ...)
*
*/
class Widget : public ewol::Object {
public:
// Config list of properties
static const char* const configFill;
static const char* const configExpand;
static const char* const configHide;
static const char* const configFocus;
static const char* const configMinSize;
static const char* const configMaxSize;
static const char* const configGravity;
public:
/**
* @brief Constructor of the widget classes
* @return (no execption generated (not managed in embended platform))
*/
Widget(void);
/**
* @brief Destructor of the widget classes
*/
virtual ~Widget(void) {
vec2 plop = vec2(15.2, 56.6f);
}
};
};
#endif

View File

View File

View File

View File

View File

View File

@@ -1,62 +0,0 @@
<?php
include_once(SITE_MODULE."plop.php");
//define('DEFAULT_PLUGIN_PATH','plugin_wiki/');
define('ABSPATH',dirname(__FILE__).'/');
//Tableau contenant la liste des module
$module_list = array(array( 'state' => false,
'level' => -1,
'name' => "",
'class' => NULL));
// supression de cet <20>l<EFBFBD>ment inutil...
array_pop($module_list);
function ShowModuleList(){
global $module_list;
$output = "";
//On liste simplement les module ouvert:
$output .= '<div class="matrice"><table cellspacing="1">';
$output .= '<tr>';
foreach($module_list as $element) {
$output .= '</tr>';
}
$output .= '</table></div>';
return $output;
}
function addModule($module_name) {
// element global :
global $module_list;
if (file_exists($module_file)) {
//On inclu le module
include_once($module_file);
} else {
// nothing to do ...
}
}
class ModuleSite{
// description du plugin
protected $description;
// level d'utilisation du plugin
private $useLevel;
// version du plugin
public $version;
/*!
* @brief Contructeur de base
* @param ---
* @return ---
*/
function ModuleSite($_nomDuModule) {
$this->description = "---";
$this->useLevel = 1024;
$this->version = "00.00";
return false;
}
?>

View File

@@ -1,44 +0,0 @@
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
def get_desc():
return "gameplay : video game engine (based on bullet lib)"
"""
multline comment
"""
'''
multline comment
'''
def create(target):
myModule = module.Module(__file__, 'gameplay', 'LIBRARY')
# add the file to compile:
myModule.add_src_file([
'ege/debug.cpp',
'ege/AudioElement.cpp',
'ege/AudioEngine.cpp',
'ege/Camera.cpp'
])
# myModule.copy_folder('data/ParticuleMesh.*','')
# name of the dependency
myModule.add_module_depend(['etk', 'ewol', 'bullet'])
myModule.compile_flags_CC([
'-Wno-write-strings',
'-Wall'])
myModule.add_export_path(tools.get_current_path(__file__))
# add the currrent module at the
return myModule
"""
multline comment error ...

View File

@@ -1,52 +0,0 @@
/**
* Doxygen comment
*/
/* simple comment */
#if 0
remove value
#else
#endif
varying void
uniform bool
attribute float
precision int
mediump vec2
mediump vec3
mediump vec4
mediump mat2
mediump mat3
mediump mat4
mediump ivect2
mediump ivect3
mediump ivect4
mediump bvect2
mediump bvect3
mediump bvect4
//! inline doxygen comment
void emptyFunction() {
}
// inline comment
void main() {
return
goto
if
else
case
default
switch
break
continue
while
do
for
sizeof
MACRO_VALUE
}

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