33 Commits
1.2.1 ... 1.2.3

Author SHA1 Message Date
6e3df7ef74 Update version tag: 1.2.3 2014-10-17 09:15:18 +02:00
fbf774174f Merge branch 'dev' 2014-10-17 09:10:19 +02:00
3c79dec2c8 [INTEGRATION] add color in travis build 2014-10-17 09:02:57 +02:00
7f7b3283e3 [DEV] add update of clang to set it work with timer 2014-10-17 09:00:46 +02:00
7c37d8e549 [DEV] add sub parsing of pass1 2014-10-13 22:39:49 +02:00
a201439665 [DEV] Update the parsing of many languages (pyton, cmake) is now good 2014-10-09 21:23:19 +02:00
67a08dd775 [DEBUG] correction of end of file regexp change 2014-10-08 21:32:41 +02:00
7952872980 [DEV] better regex ==> need to update alge to recognise data 2014-10-07 21:42:07 +02:00
78887e64ed [DEV] correction of the regex and add some basic test example 2014-10-07 00:45:01 +02:00
d93844d6da [DEV] first std::regex really work in c++ 2014-10-06 23:22:14 +02:00
243d7e7494 [DEV] change in etk::RegExp in std::regex 2014-10-05 23:46:57 +02:00
154351e629 [ERROR] Abandonned version in std::u32string ==> unexistant regexp 2014-10-03 21:44:13 +02:00
febbaffdf4 [DEV] {remove etk regexp dependency} big rework in progress to simplify code and use real std::regex templates 2014-10-03 00:49:26 +02:00
b890f931ca [DEV] remove problematic function parsing 2014-10-02 22:40:40 +02:00
2c3a64933d [DEV] transform plugin manager in unique resource 2014-09-18 22:27:54 +02:00
b8962cc3b9 [DEV] set travis depend on dev branch of ewol 2014-09-18 21:32:25 +02:00
f9ff0b8899 [DEBUG] remove lutinBase.py that is deprecated 2014-09-18 21:07:32 +02:00
f971c4fdfe [DEBUG]travis file error 2014-09-18 21:05:48 +02:00
6076698201 Create .travis.yml 2014-09-18 21:01:41 +02:00
c12ed9e7fa [DEBUG #9] freez correction ==> plugin data missing iterator 2014-09-18 21:01:41 +02:00
e29aa94cc5 [DEBUG #8] CLose the file after saving it when request close 2014-09-15 07:27:51 +02:00
05ac6a9210 [DEBUG #2 #7] close file and save it whan needed 2014-09-15 07:21:22 +02:00
0a054c209f [DEV] add parenting between bufferManager and Buffer 2014-09-12 22:10:32 +02:00
996fd58370 [DEBUG #1] Save file done 2014-09-12 21:52:03 +02:00
3574fd917c [DEBUG #5] correct file selection 2014-09-12 21:36:20 +02:00
b889b4aa5a [DEV] update plugin 2014-08-29 22:52:21 +02:00
668570cdc7 [DEV] start correct plugin interface 2014-08-28 22:31:00 +02:00
7e6f56a1cd [DEV] this plugin to the new ewol interface 2014-08-27 22:58:21 +02:00
a371c09e22 [DEV] update new signal system ==> run but not have many capabilities 2014-08-25 22:44:42 +02:00
cd3c5ff2d4 [DEV] update new object interface & rework global message (start) 2014-08-25 05:55:06 +02:00
686ec6d8bd [DEV] remove caller in signal emit 2014-08-22 05:21:10 +02:00
d31137e1a3 [DEBUG] gcc compilation warning 2014-08-21 21:00:13 +02:00
03fa46bbcd [DEV] rework signal interface (step 1 normalisation) 2014-08-20 22:34:31 +02:00
88 changed files with 2385 additions and 1742 deletions

41
.travis.yml Normal file
View File

@@ -0,0 +1,41 @@
# language type:
language: cpp
# compilator system:
compiler:
- clang
- gcc
# build branch requested
branches:
only:
- master
- dev
# 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:
- 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
- if [ "$CXX" == "clang++" ]; then wget http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz; fi
- if [ "$CXX" == "clang++" ]; then tar xJf clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz; fi
- if [ "$CXX" == "clang++" ]; then export PATH=$PWD/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin:$PATH; fi
# build sequence with Lutin :
script:
- if [ "$CXX" == "clang++" ]; then ./ewol/build/lutin.py -C -cclang -mdebug -p edn; fi
- if [ "$CXX" == "g++" ]; then ./ewol/build/lutin.py -C -cgcc -mdebug -p edn; fi
#send e-mail on compilation result:
notifications:
email:
- yui.heero@gmail.com

View File

@@ -1,46 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur">
<ext>*.s</ext>
<ext>*.S</ext>
<ext>*.asm</ext>
<ext>.*\.(s|S|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>/\*\*.*\*/</regex>
<regex>/\*\*.*?\*/</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>/\*.*\*/</regex>
<regex>/\*.*?\*/</regex>
</rule>
<rule name="my if 0">
<color>preprocesseur</color>
<regex>#[ \t]*if 0.*#(regexif|else)</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>\@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>
<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>
</rule>
<rule name="register list">
<color>type</color>
<regex>\@r(10|11|12|[0-9]?)|sp|lp|lr|pc\@</regex>
<regex>\b(r(10|11|12|[0-9]?)|sp|lp|lr|pc)\b</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,28 +1,28 @@
<?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>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'(\\[\\']|.)*'</regex>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</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>\@for|done|do|while|in|if|elif|then|else|fi\@</regex>
<regex>\b(for|done|do|while|in|if|elif|then|else|fi)\b</regex>
</rule>
<rule name="my Variable">
<color>keyword</color>
@@ -34,7 +34,7 @@
</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,30 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Boulou log">
<ext>*.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>"(\\[\\"]|.)*$</regex>
<regex>&quot;(.|\\[\\&quot;])*?$</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>\@'(\\[\\']|.)*$</regex>
<regex>\b&apos;(.|\\[\\&apos;])*?$</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>
@@ -33,7 +32,7 @@
<color>number</color>
<regex>[0-9]*%</regex>
</rule>
<rule name="R<EFBFBD>sultat OK">
<rule name="Résultat OK">
<color>TestResultOK</color>
<regex>\[( )*(OK|Ok|ok)( )*\]</regex>
</rule>

View File

@@ -1,119 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<ext>.*\.(c|cpp|cxx|cc|h|hpp|hxx|m|mm)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<rule name="doxygen multiline">
<color>commentDoxygen</color>
<regex>/\*\*.*(\*/|\e)</regex>
<regex>/\*(\*|!)(.|\r|\n)*?\*/</regex>
<sub>doxyparse</sub>
</rule>
<rule name="code Review">
<color>SYNTAX_ERROR</color>
<regex>/\*[ \t]*TODO :.*(\*/|\e)</regex>
</rule>
<rule name="my comment multiline">
<rule name="comment multiline">
<color>comment</color>
<regex>/\*.*(\*/|\e)</regex>
<regex>/\*(.|\r|\n)*?(\*/|\0)</regex>
<sub>TODO</sub>
</rule>
<rule name="my if 0">
<rule name="comment miltiline ERROR">
<color>SYNTAX_ERROR</color>
<regex>/\*(.|\r|\n)*</regex>
</rule>
<rule name="#if 0">
<color>preprocesseur</color>
<regex>#[ \t]*if 0.*#(endif|else)</regex>
<regex>#[ \t]*if 0(.|\r|\n)*?#(endif|else)</regex>
</rule>
<rule name="my preprocesseur">
<rule name="#if 0 ERROR">
<color>SYNTAX_ERROR</color>
<regex>#[ \t]*if 0(.|\r|\n)*</regex>
</rule>
<rule name="#preproc">
<color>preprocesseur</color>
<regex>#(\\[\\\n]|.)*$</regex>
<regex>#(.|\\[\\\n])*</regex>
</rule>
<rule name="my comment doxygen">
<rule name="inline doxygen">
<color>commentDoxygen</color>
<regex>//!.*$</regex>
<regex>//!.*</regex>
<sub>doxyparse</sub>
</rule>
<rule name="my todo comment">
<color>SYNTAX_ERROR</color>
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
</rule>
<rule name="my comment">
<rule name="inline comment">
<color>comment</color>
<regex>//.*$</regex>
<regex>//.*</regex>
<sub>TODO</sub>
</rule>
<rule name="doubleQuteText">
<rule name="double quote text">
<color>doubleQuoteText</color>
<regex>"(\\[\\"]|.)*"</regex>
<regex>"(.|\\[\\"])*?"</regex> <!-- " -->
</rule>
<rule name="simpleQuteText">
<rule name="simple quote text">
<color>doubleQuoteText</color>
<regex>'((\\[\\'])|.){1,2}'</regex>
</rule>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</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>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
<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>\@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>
<regex>\b(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]|_)+)\b</regex>
</rule>
<rule name="my type">
<color>type</color>
<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>
<regex>\b(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))\b</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>
<regex>\bstd::[\w:]*\b</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<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>
<regex>\b(inline|const|class|namespace|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)\b</regex>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<regex>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</regex>
<regex>\b(NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|TRUE|false|FALSE\@</regex>
<regex>\b(true|TRUE|false|FALSE)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
<rule name="CPP member">
<color>memberClass</color>
<regex>\@m_[A-Za-z_0-9]*\@</regex>
<regex>\bm_\w+\b</regex>
</rule>
<rule name="function input">
<color>inputFunction</color>
<regex>\@_[A-Za-z_0-9]*\@</regex>
<regex>\b_\w+\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b((\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>
<!-- With all elementes :
<rule name="BIG LETTER">
<color>macro</color>
<regex>([A-Z]|_){4,500}</regex>
<elemSubColor id="1">doxElem</elemSubColor>
</rule>
-->
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;</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,50 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="C/C++">
<EdnLang version="0.1" lang="cmake">
<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>"(\\[\\"]|.)*$</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword">
<color>keyword</color>
<regex>\@foreach|message|endforeach|if|else|endif|list|file|string\@</regex>
<regex>\b(foreach|message|endforeach|if|else|endif|list|file|string)\b</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\@set|include_directories|add_definitions|add_library|include_directories|target_link_libraries|project|include|check_include_file|enable_testing|option|cmake_minimum_required|add_definitions|check_include_file|configure_file|include_directories|add_custom_command|add_executable|add_test\@</regex>
<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>
</rule>
<rule name="Variable">
<color>inputFunction</color>
<regex>\${.*}</regex>
<regex>\$\{.*\}</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b(\w|_)+[ \t]*\(</regex>
</rule>
<rule name="files path">
<color>memberClass</color>
<regex>[\w-]*(\.|/)\w*</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Glsl">
<ext>*.glsl</ext>
<ext>*.vert</ext>
<ext>*.frag</ext>
<ext>*.prog</ext>
<ext>.*\.(glsl|vert|frag|prog)</ext>
<pass1>
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
@@ -15,57 +12,57 @@
</rule>
<rule name="my if 0">
<color>preprocesseur</color>
<regex>#[ \t]*if 0(\\[\\\n]|.)*#(endif|else)</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>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
<regex>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)\b</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\@void|bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</regex>
<regex>\b(void|bool|float|int|(vec|mat|ivect|bvect)[2-4])\b</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\@varying|uniform|attribute|precision|mediump\@</regex>
<regex>\b(varying|uniform|attribute|precision|mediump)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|false\@</regex>
<regex>\b(true|false)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b(\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>"(\\[\\"]|.)*$</regex>
<regex>&quot;(.|\\[\\&quot;])*?$</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'(\\[\\']|.)*$</regex>
<regex>&apos;(.|\\[\\&apos;])*?$</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>\@menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config\@</regex>
<regex>\b(menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config)\b</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\@int|hex|bool|string\@</regex>
<regex>\b(int|hex|bool|string)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</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,76 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Java">
<ext>*.java</ext>
<ext>.*\.java</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>
<regex>/\*\*.*\*/</regex>
<regex>/\*\*.*?\*/</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>/\*.*\*/</regex>
<regex>/\*.*?\*/</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>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'(\\[\\']|.)*'</regex>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</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>\@return|goto|if|else|case|default|switch|break|continue|while|do|for\@</regex>
<regex>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for)\b</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\@new|try|catch|print\@</regex>
<regex>\b(new|try|catch|print)\b</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\@boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum\@</regex>
<regex>\b(boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum)\b</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\@import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface@</regex>
<regex>\b(import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface)\b</regex>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<regex>\@null\@</regex>
<regex>\bnull\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|false\@</regex>
<regex>\b(true|false)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b[A-Z_][A-Z_0-9]{3,500}\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b(\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,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Json">
<ext>*.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>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
@@ -18,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>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|false\@</regex>
<regex>\b(true|false)\b</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,52 +1,52 @@
<?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>\-\-\[\[.*\-\-\]\]</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>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'(\\[\\']|.)*'</regex>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</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>\@and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while\@</regex>
<regex>\b(and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|false\@</regex>
<regex>\b(true|false)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b(\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,30 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Makefiles">
<ext>Makefile</ext>
<ext>*.mk</ext>
<ext>*.global</ext>
<ext>.*\.(mk|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>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'(\\[\\']|.)*'</regex>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="confition">
<color>type</color>
<regex>\@if|ifeq|ifneq|else|endif|define|endef\@</regex>
<regex>\b(if|ifeq|ifneq|else|endif|define|endef)\b</regex>
</rule>
<rule name="my keyword">
<color>keyword</color>
<regex>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</regex>
<regex>\b\([a-zA-Z_][a-zA-Z0-9_]*\)</regex>
</rule>
<rule name="function call">
<color>functionName</color>
@@ -32,7 +31,7 @@
</rule>
<rule name="condition">
<color>boolean</color>
<regex>:=|?=|!=|=</regex>
<regex>:=|\?=|!=|=</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,53 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Matlab">
<ext>*.m</ext>
<ext>*.M</ext>
<ext>.*\.(m|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> ".*($|")</regex>
<regex> &quot;.*?($|&quot;)</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex> '.*($|')</regex>
<regex> &apos;.*?($|&apos;)</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>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</regex>
<regex>\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end)\b</regex>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|false\@</regex>
<regex>\b(true|false)\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b(\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>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,33 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Php: pretty home page">
<ext>*.php</ext>
<ext>*.php3</ext>
<ext>*.php4</ext>
<ext>*.phtml</ext>
<ext>.*\.(php|php3|php4|phtml)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline">
<color>comment</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 inline">
<color>comment</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>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'(\\[\\']|.)*'</regex>
<regex>&apos;(.|\\[\\&apos;])*?&apos;</regex>
</rule>
</pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
@@ -37,31 +34,31 @@
</rule>
<rule name="my type">
<color>type</color>
<regex>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</regex>
<regex>\b(array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset)\b</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<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>
<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>
</rule>
<rule name="my common Define">
<color>commonDefine</color>
<regex>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</regex>
<regex>\b(doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@true|TRUE|false|FALSE\@</regex>
<regex>\b(true|TRUE|false|FALSE)\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b\w+[ \t]*\(</regex>
</rule>
<rule name="condition">
<color>boolean</color>
<regex>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}|</regex>
<regex>==|&lt;=|&gt;=|!=|&lt;|&gt;|&amp;&amp;|\{|\}</regex>
</rule>
</pass2>
</EdnLang>

View File

@@ -1,74 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Python">
<ext>*.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>""".*"""</regex>
<regex>&quot;&quot;&quot;(.|\r|\n)*?&quot;&quot;&quot;</regex>
</rule>
<rule name="my comment multiline">
<color>comment</color>
<regex>'''.*'''</regex>
<regex>'''(.|\r|\n)*?'''</regex>
</rule>
<rule name="comment multiline Error">
<color>SYNTAX_ERROR</color>
<regex>(&quot;&quot;&quot;|''')(.|\n|\r)*</regex>
</rule>
<rule name="my comment doxygen">
<color>commentDoxygen</color>
<regex>##(\\[\\\n]|.)*$</regex>
<regex>##.*</regex>
</rule>
<rule name="my comment">
<color>comment</color>
<regex>#(\\[\\\n]|.)*$</regex>
<regex>#.*</regex>
</rule>
<rule name="doubleQuteText">
<color>doubleQuoteText</color>
<regex>"(\\[\\"]|.)*"</regex>
<regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
</rule>
<rule name="simpleQuteText">
<color>doubleQuoteText</color>
<regex>'((\\[\\'])|.)*'</regex>
<regex>&apos;((\\[\\&apos;])|.)*?&apos;</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>\@if|else|elif|break|pass|continue|while|do|for|in|return\@</regex>
<regex>\b(if|else|elif|break|pass|continue|while|do|for|in|return)\b</regex>
</rule>
<rule name="my function keyword">
<color>systemFunction</color>
<regex>\@print|len|range|del|__init__|self|os\.|sys\.|path\.\@</regex>
<regex>\b(print|len|range|del|__init__|self|os\.|sys\.|path\.)\b</regex>
</rule>
<rule name="my type">
<color>type</color>
<regex>\@bool|BOOL|char|double|float\@</regex>
<regex>\b(bool|BOOL|char|double|float)\b</regex>
</rule>
<rule name="my storage keyword">
<color>storageKeyword</color>
<regex>\@def|class|import|from|as|try|except\@</regex>
<regex>\b(def|class|import|from|as|try|except)\b</regex>
</rule>
<rule name="numeric constant">
<color>number</color>
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
<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>
</rule>
<rule name="my boolean">
<color>boolean</color>
<regex>\@True|False\@</regex>
<regex>\b(True|False)\b</regex>
</rule>
<rule name="BIG LETTER">
<color>macro</color>
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
<regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule>
<rule name="Function name">
<color>functionName</color>
<regex>\@(\w|_)+[ \t]*\(</regex>
<regex>\b(\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>
<!-- With all elementes : -->
<rule name="BIG LETTER">
<color>macro</color>
<regex>([A-Z]|_){4,500}</regex>
<elemSubColor id="1">doxElem</elemSubColor>
<rule name="simpleQuteTextError">
<color>SYNTAX_ERROR</color>
<regex>&apos;|&quot;</regex>
</rule>
</pass2>
</EdnLang>

View File

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

View File

@@ -27,5 +27,8 @@
{ name:"functionName", foreground:"#24d1e0", bold:true},
{ name:"TestResultOK", foreground:"#000000", background:"#00FF00", bold:true},
{ name:"TestResultERROR", FG:"#000000", background:"#FF0000", bold:true}
{ name:"doxygen-key", foreground:"#dc3700", bold:true, italic:false},
{ name:"doxygen-in-out", foreground:"#dc7000", bold:true, italic:false},
]
}

View File

@@ -9,6 +9,7 @@
{ 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:"inputFunction", foreground:"#B80000", bold:true, italic:true},
@@ -26,6 +27,9 @@
{ name:"functionName", foreground:"#09857e", bold:true},
{ name:"TestResultOK", foreground:"#000000", background:"#009c00", bold:true},
{ name:"TestResultERROR", foreground:"#000000", background:"#c20000", bold:true}
{ name:"doxygen-key", foreground:"#dc3700", bold:true, italic:false},
{ name:"doxygen-in-out", foreground:"#dc7000", bold:true, italic:false},
]
}

View File

@@ -1,6 +0,0 @@
#!/usr/bin/python
import lutinModule
import lutinTools
lutinModule.import_path(lutinTools.get_current_path(__file__) + "/sources/")
lutinModule.import_path(lutinTools.get_current_path(__file__) + "/../ewol/")

View File

@@ -17,11 +17,6 @@
#undef __class__
#define __class__ "Buffer"
const char* const appl::Buffer::eventIsModify = "edn-is-modify";
const char* const appl::Buffer::eventIsSave = "edn-is-save";
const char* const appl::Buffer::eventSelectChange = "edn-select-change";
const char* const appl::Buffer::eventChangeName = "edn-buffer-name-change";
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
m_value = u32char::Null;
if (m_current < 0) {
@@ -29,7 +24,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
return *this;
}
if (m_data != nullptr) {
if (m_current < m_data->m_data.size() ) {
if (m_current < (int64_t)m_data->m_data.size() ) {
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
if (nbChar != 0) {
m_current+=nbChar;
@@ -37,7 +32,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
m_current++;
}
}
if (m_current >= m_data->m_data.size()) {
if (m_current >= (int64_t)m_data->m_data.size()) {
m_current = m_data->m_data.size();
}
}
@@ -74,7 +69,7 @@ char32_t appl::Buffer::Iterator::operator* () {
return m_value;
}
if ( m_current < 0
|| m_current >= m_data->m_data.size()) {
|| m_current >= (int64_t)m_data->m_data.size()) {
APPL_ERROR("request an element out of bounding !!! 0 <= " << m_current << " < " << m_data->m_data.size());
return m_value;
}
@@ -82,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<m_data->m_data.size(); ++iii) {
for (int32_t iii=1; iii<nbChar && m_current+iii<(int64_t)m_data->m_data.size(); ++iii) {
tmpVal[iii] = m_data->m_data[m_current+iii];
}
// transform ...
@@ -119,8 +114,11 @@ appl::Buffer::Iterator appl::Buffer::selectStop() {
return position( getStopSelectionPos() );
}
appl::Buffer::Buffer() :
signalIsModify(*this, "is-modify"),
signalIsSave(*this, "is-save"),
signalSelectChange(*this, "select-change"),
signalChangeName(*this, "change-name"),
m_hasFileName(false),
m_fileName(""),
m_isModify(false),
@@ -133,10 +131,6 @@ appl::Buffer::Buffer() :
static int32_t bufferBaseId = 0;
m_fileName = "No Name " + etk::to_string(bufferBaseId);
bufferBaseId++;
addEventId(eventIsModify);
addEventId(eventIsSave);
addEventId(eventSelectChange);
addEventId(eventChangeName);
}
void appl::Buffer::init() {
@@ -144,7 +138,7 @@ void appl::Buffer::init() {
}
appl::Buffer::~Buffer() {
APPL_ERROR("REAL remove buffer : '" << m_name << "'");
}
bool appl::Buffer::loadFile(const std::string& _name) {
@@ -158,13 +152,20 @@ bool appl::Buffer::loadFile(const std::string& _name) {
m_cursorPos = 0;
setHighlightType("");
m_nbLines = 0;
if (m_data.dumpFrom(m_fileName) == true ) {
countNumberofLine();
tryFindHighlightType();
m_isModify = false;
return true;
if (file.exist() == false) {
APPL_ERROR("File : '" << m_fileName << "' does not exist...");
return false;
}
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();
countNumberofLine();
tryFindHighlightType();
m_isModify = false;
return true;
}
void appl::Buffer::setFileName(const std::string& _name) {
@@ -176,17 +177,21 @@ void appl::Buffer::setFileName(const std::string& _name) {
}
m_fileName = name;
m_hasFileName = true;
generateEventId(eventChangeName);
signalChangeName.emit();
setModification(true);
}
bool appl::Buffer::storeFile() {
if (m_data.dumpIn(m_fileName) == true) {
APPL_INFO("saving file : " << m_fileName);
setModification(false);
return true;
etk::FSNode file(m_fileName);
if (file.fileOpenWrite() == false) {
APPL_ERROR("File : '" << m_fileName << "' Fail to open in write mode");
return false;
}
return false;
file.fileWriteAll(m_data);
file.fileClose();
APPL_INFO("saving file : " << m_fileName);
setModification(false);
return true;
}
void appl::Buffer::setModification(bool _status) {
@@ -195,9 +200,9 @@ void appl::Buffer::setModification(bool _status) {
}
m_isModify = _status;
if (m_isModify == true) {
generateEventId(eventIsModify);
signalIsModify.emit();
} else {
generateEventId(eventIsSave);
signalIsSave.emit();
}
}
@@ -420,13 +425,13 @@ void appl::Buffer::moveCursor(int64_t _pos) {
if (m_cursorPos == m_cursorSelectPos) {
m_cursorSelectPos = -1;
}
generateEventId(eventSelectChange);
signalSelectChange.emit();
return;
}
// move mode
m_cursorPos = _pos;
m_cursorSelectPos = -1;
generateEventId(eventSelectChange);
signalSelectChange.emit();
}
bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
@@ -519,12 +524,12 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
void appl::Buffer::setSelectionPos(const appl::Buffer::Iterator& _pos) {
m_cursorSelectPos = _pos;
generateEventId(eventSelectChange);
signalSelectChange.emit();
}
void appl::Buffer::unSelect() {
m_cursorSelectPos = -1;
generateEventId(eventSelectChange);
signalSelectChange.emit();
}
static const char *ControlCodeTable[32] = {
@@ -644,7 +649,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(position, (int8_t*)(_data.c_str()), _data.size());
m_data.insert((size_t)position, _data);
if (m_cursorPos < 0) {
m_cursorPos = 0;
}
@@ -661,7 +666,7 @@ bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterato
if (position < 0){
position = 0;
}
m_data.replace(position, (int64_t)_posEnd-(int64_t)_pos, (int8_t*)(_data.c_str()), _data.size());
m_data.replace(m_data.begin() + position, m_data.begin() + (int64_t)_posEnd, _data.begin(), _data.end());
regenerateHighLightAt(position, (int64_t)_posEnd-(int64_t)_pos, _data.size());
m_selectMode = false;
moveCursor(position+_data.size());
@@ -676,7 +681,7 @@ void appl::Buffer::removeSelection() {
}
int64_t startPos = getStartSelectionPos();
int64_t endPos = getStopSelectionPos();
m_data.remove(startPos, endPos-startPos);
m_data.erase(startPos, endPos-startPos);
regenerateHighLightAt(startPos, endPos-startPos, 0);
m_selectMode = false;
moveCursor(startPos);
@@ -686,7 +691,7 @@ void appl::Buffer::removeSelection() {
void appl::Buffer::tryFindHighlightType() {
etk::FSNode file(m_fileName);
std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention());
std::string type = appl::highlightManager::getTypeFile(file.getNameFile());
if (type.size() == 0) {
return;
}
@@ -718,7 +723,7 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
return;
}
// normal case
//APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
APPL_VERBOSE("(_pos="<<_pos<<", _nbDeleted="<<_nbDeleted<<", _nbAdded=" << _nbAdded << "\");");
int64_t posEnd = _pos + _nbDeleted;
// search position of the old element to reparse IT...
int64_t startId;
@@ -731,32 +736,45 @@ 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();
} else if (startId == -1) {
APPL_VERBOSE("1 * clear");
} else if (startId <= -1) {
if (stopId == 0){
m_HLDataPass1.erase(m_HLDataPass1.begin());
//APPL_DEBUG("1 * Erase 0");
APPL_VERBOSE("1 * Erase 0");
} else {
m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId);
//APPL_DEBUG("2 * Erase 0->" << stopId);
APPL_VERBOSE("2 * Erase 0->" << stopId);
}
} else if (stopId == -1) {
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end");
} else if (stopId <= -1) {
APPL_VERBOSE("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_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId);
APPL_VERBOSE("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId+1);
if (stopId == currentSize-1) {
stopId = -1;
}
}
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
APPL_VERBOSE(" list afterRemove:");
for (auto &elem : m_HLDataPass1) {
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
}
// update position after the range position :
int64_t elemStart;
if (startId == -1) {
@@ -770,18 +788,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_DEBUG("******* Regenerate ALL");
if ( startId <= -1
&& stopId <= -1) {
APPL_VERBOSE("******* Regenerate ALL");
generateHighLightAt(0, m_data.size());
} else if(-1 == startId) {
//APPL_DEBUG("******* Regenerate START");
} else if(startId <= -1) {
APPL_VERBOSE("******* Regenerate START");
generateHighLightAt(0, m_HLDataPass1[0].start, 0);
} else if(-1 == stopId) {
//APPL_DEBUG("******* Regenerate STOP");
} else if(stopId <= -1) {
APPL_VERBOSE("******* Regenerate STOP");
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].stop, m_data.size(), m_HLDataPass1.size());
} else {
//APPL_DEBUG("******* Regenerate RANGE");
APPL_VERBOSE("******* Regenerate RANGE");
generateHighLightAt(m_HLDataPass1[startId].stop, m_HLDataPass1[startId+1].start, startId+1);
}
}
@@ -920,22 +938,24 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
" start=" << HLStartPos <<
" stop=" << m_HLDataPass1[kkk].start );
m_highlight->parse2(HLStartPos,
m_HLDataPass1[kkk].start,
_MData.HLData,
m_data);
m_HLDataPass1[kkk].start,
_MData.HLData,
m_data);
} // else : nothing to do ...
} else {
APPL_VERBOSE(" == > (empty section 2 ) kkk=" << kkk <<
" start=" << m_HLDataPass1[kkk-1].stop <<
" stop=" << m_HLDataPass1[kkk].start );
m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
m_HLDataPass1[kkk].start,
_MData.HLData,
m_data);
m_HLDataPass1[kkk].start,
_MData.HLData,
m_data);
}
// under section :
//APPL_DEBUG(" == > (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
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);
}
if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.size()) {
@@ -944,16 +964,16 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
" start=" << m_HLDataPass1[kkk-1].stop <<
" stop=" << HLStop );
m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
HLStop,
_MData.HLData,
m_data);
HLStop,
_MData.HLData,
m_data);
} else {
APPL_VERBOSE(" == > (empty section 4 ) kkk=" << kkk <<
" start=0 stop=" << HLStop );
m_highlight->parse2(0,
HLStop,
_MData.HLData,
m_data);
HLStop,
_MData.HLData,
m_data);
}
}
/*
@@ -993,3 +1013,41 @@ uint32_t appl::Buffer::getCursorLinesId() {
}
return line;
}
namespace etk {
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<std::shared_ptr<appl::Buffer>>(const std::shared_ptr<appl::Buffer>& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
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<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) {
return _obj.getFileName();
}
template<> std::u32string to_u32string<appl::Buffer>(const appl::Buffer& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<appl::Buffer>(appl::Buffer& _variableRet, const std::string& _value) {
_variableRet.loadFile(_value);
return true;
}
template<> bool from_string<appl::Buffer>(appl::Buffer& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
};

View File

@@ -17,6 +17,7 @@
#include <ewol/widget/Widget.h>
#include <ewol/compositing/Text.h>
#include <appl/Highlight.h>
#include <ewol/object/Signal.h>
namespace appl {
@@ -81,7 +82,7 @@ namespace appl {
if (m_data == nullptr) {
return false;
}
if (m_current >= m_data->m_data.size()) {
if (m_current >= (int64_t)m_data->m_data.size()) {
return false;
}
if (m_current < 0) {
@@ -100,8 +101,8 @@ namespace appl {
if (m_current < 0) {
return 0;
}
if (m_current > m_data->m_data.size()) {
return m_data->m_data.size();
if (m_current > (int64_t)m_data->m_data.size()) {
return (int64_t)m_data->m_data.size();
}
return m_current;
};
@@ -223,7 +224,7 @@ namespace appl {
if (m_current < 0) {
return 0;
}
if (m_current >= m_data->m_data.size()) {
if (m_current >= (int64_t)m_data->m_data.size()) {
return m_data->m_data.size()-1;
}
return m_current;
@@ -288,10 +289,10 @@ namespace appl {
friend class Buffer;
};
public:
static const char* const eventIsModify;
static const char* const eventIsSave;
static const char* const eventSelectChange;
static const char* const eventChangeName;
ewol::object::Signal<void> signalIsModify;
ewol::object::Signal<void> signalIsSave;
ewol::object::Signal<void> signalSelectChange;
ewol::object::Signal<void> signalChangeName;
protected:
Buffer();
void init();
@@ -305,14 +306,14 @@ namespace appl {
/**
* @brief get the curent filename of the Buffer
*/
const std::string& getFileName() {
const std::string& getFileName() const {
return m_fileName;
}
/**
* @brief Check if the buffer has a real filename.
* @return the status of the existance of a name.
*/
bool hasFileName() {
bool hasFileName() const {
return m_hasFileName;
}
/**
@@ -347,9 +348,9 @@ namespace appl {
*/
void setModification(bool _status);
protected:
etk::Buffer m_data; //!< copy of the file buffer
std::string m_data; //!< copy of the file buffer
public:
etk::Buffer& getData() {
std::string& getData() {
return m_data;
};
protected:

View File

@@ -18,7 +18,11 @@
#undef __class__
#define __class__ "BufferManager"
appl::BufferManager::BufferManager() {
appl::BufferManager::BufferManager() :
signalNewBuffer(*this, "new-buffer"),
signalSelectFile(*this, "select-buffer"),
signalTextSelectionChange(*this, "text-selection-change"),
signalRemoveBuffer(*this, "remove-buffer") {
addObjectType("appl::BufferManager");
}
@@ -37,13 +41,19 @@ std::shared_ptr<appl::Buffer> appl::BufferManager::createNewBuffer() {
APPL_ERROR("Can not allocate the Buffer (empty).");
return nullptr;
}
tmp->setParent(shared_from_this());
m_list.push_back(tmp);
sendMultiCast(appl::MsgSelectNewFile, tmp->getFileName());
APPL_INFO("Create a new Buffer");
signalNewBuffer.emit(tmp->getFileName());
APPL_INFO("Create a new Buffer (done)");
APPL_INFO("select Buffer");
signalSelectFile.emit(tmp->getFileName());
APPL_INFO("select Buffer (done)");
return tmp;
}
std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")");
APPL_INFO("get('" << _fileName << "'," << _createIfNeeded << ")");
for (auto &it : m_list) {
if (it == nullptr) {
continue;
@@ -63,15 +73,26 @@ std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileN
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
return nullptr;
}
tmp->setParent(shared_from_this());
tmp->loadFile(_fileName);
m_list.push_back(tmp);
APPL_INFO("Creata a open Buffer");
signalNewBuffer.emit(tmp->getFileName());
APPL_INFO("Creata a open Buffer (done)");
return tmp;
}
return nullptr;
}
void appl::BufferManager::setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected) {
m_bufferSelected = _bufferSelected;
sendMultiCast(appl::MsgSelectChange, "");
if (m_bufferSelected == nullptr) {
APPL_ERROR("select a NULL buffer ...");
return;
}
APPL_INFO("Set buffer selected");
//signalSelectFile.emit(m_bufferSelected->getName());
APPL_INFO("Set buffer selected (done)");
}
std::shared_ptr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
@@ -99,15 +120,42 @@ bool appl::BufferManager::exist(const std::string& _fileName) {
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);
return;
}
if (get(_fileName, true) == nullptr) {
APPL_ERROR("Error get '" << _fileName << "' ... ");
return;
}
sendMultiCast(appl::MsgSelectNewFile, _fileName);
signalSelectFile.emit(_fileName);
}
void appl::BufferManager::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_DEBUG("receive message !!! " << _msg);
}
void appl::BufferManager::requestDestroyFromChild(const std::shared_ptr<Object>& _child) {
APPL_WARNING("Buffer request a close...");
bool find = false;
int32_t newValue = -1;
auto it = m_list.begin();
while(it != m_list.end()) {
if (*it == nullptr) {
it = m_list.erase(it);
continue;
}
if (*it == _child) {
it = m_list.erase(it);
find = true;
break;
}
newValue++;
++it;
}
if (find == true) {
signalRemoveBuffer.emit(std::dynamic_pointer_cast<appl::Buffer>(_child));
}
if (m_bufferSelected == _child) {
APPL_ERROR("is selected");
signalSelectFile.emit("");
m_bufferSelected = nullptr;
}
}

View File

@@ -18,6 +18,11 @@
namespace appl {
class BufferManager : public ewol::Resource {
public:
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:
@@ -77,8 +82,8 @@ namespace appl {
std::shared_ptr<appl::Buffer> getBufferSelected() {
return m_bufferSelected;
};
public: // herited function
void onReceiveMessage(const ewol::object::Message& _msg);
private:
void requestDestroyFromChild(const std::shared_ptr<Object>& _child);
};
};

View File

@@ -17,20 +17,15 @@
#undef __class__
#define __class__ "BufferView"
static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
std::vector<appl::dataBufferStruct *> tmpList = _list;
// TODO : write it better
static void SortElementList(std::vector<appl::dataBufferStruct>& _list) {
std::vector<appl::dataBufferStruct> tmpList = _list;
_list.clear();
for(size_t iii=0; iii<tmpList.size(); iii++) {
if (nullptr == tmpList[iii]) {
continue;
}
size_t findPos = 0;
for(size_t jjj=0; jjj<_list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (_list[jjj] == nullptr) {
continue;
}
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
if (tmpList[iii].m_bufferName.getNameFile() > _list[jjj].m_bufferName.getNameFile()) {
findPos = jjj+1;
}
}
@@ -59,12 +54,11 @@ BufferView::BufferView() :
void BufferView::init() {
ewol::widget::List::init();
registerMultiCast(ednMsgBufferListChange);
registerMultiCast(ednMsgBufferState);
registerMultiCast(ednMsgBufferId);
registerMultiCast(appl::MsgSelectNewFile);
registerMultiCast(appl::MsgSelectChange);
registerMultiCast(appl::MsgNameChange);
if (m_bufferManager != nullptr) {
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);
}
}
BufferView::~BufferView() {
@@ -72,154 +66,95 @@ BufferView::~BufferView() {
}
void BufferView::removeAllElement() {
for(auto &it : m_list) {
delete(it);
it = nullptr;
}
m_list.clear();
}
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) {
if (_dataStruct == nullptr) {
return;
}
void BufferView::insertAlphabetic(const appl::dataBufferStruct& _dataStruct, bool _selectNewPosition) {
// alphabetical order:
for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii] == nullptr) {
continue;
}
if (etk::tolower(m_list[iii]->m_bufferName.getNameFile()) > etk::tolower(_dataStruct->m_bufferName.getNameFile())) {
if (etk::tolower(m_list[iii].m_bufferName.getNameFile()) > etk::tolower(_dataStruct.m_bufferName.getNameFile())) {
m_list.insert(m_list.begin() + iii, _dataStruct);
_dataStruct = nullptr;
if (_selectNewPosition == true) {
m_selectedID = iii;
}
break;
return;
}
}
if (_dataStruct != nullptr) {
m_list.push_back(_dataStruct);
if (_selectNewPosition == true) {
m_selectedID = m_list.size()-1;
}
m_list.push_back(_dataStruct);
if (_selectNewPosition == true) {
m_selectedID = m_list.size()-1;
}
}
void BufferView::onCallbackNewBuffer(const std::string& _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.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);
}
markToRedraw();
}
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_VERBOSE("message : " << _msg);
ewol::widget::List::onReceiveMessage(_msg);
if (_msg.getMessage() == appl::MsgSelectNewFile) {
std::shared_ptr<appl::Buffer> buffer = m_bufferManager->get(_msg.getData());
if (buffer == nullptr) {
APPL_ERROR("event on element nor exist : " << _msg.getData());
return;
// TODO : Review this callback with the real shared_ptr on the buffer ...
void BufferView::onCallbackselectNewFile(const std::string& _value) {
m_selectedID = -1;
for (size_t iii=0; iii<m_list.size(); iii++) {
if (m_list[iii].m_buffer == nullptr) {
continue;
}
buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventIsSave);
buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventIsModify);
buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventChangeName);
appl::dataBufferStruct* tmp = new appl::dataBufferStruct(_msg.getData(), buffer);
if (tmp == nullptr) {
APPL_ERROR("Allocation error of the tmp buffer list element");
return;
if (m_list[iii].m_buffer->getFileName() != _value) {
continue;
}
if (m_openOrderMode == true) {
m_list.push_back(tmp);
} else {
insertAlphabetic(tmp);
}
markToRedraw();
return;
m_selectedID = iii;
break;
}
if (_msg.getMessage() == appl::Buffer::eventChangeName) {
for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii] == nullptr) {
continue;
}
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) {
m_list[iii]->m_bufferName = m_list[iii]->m_buffer->getFileName();
if (m_openOrderMode == false) {
// re-order the fine in the correct position
appl::dataBufferStruct* tmp = m_list[iii];
m_list[iii] = nullptr;
m_list.erase(m_list.begin() + iii);
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
break;
}
}
}
markToRedraw();
return;
}
if (_msg.getMessage() == appl::Buffer::eventIsSave) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::Buffer::eventIsModify) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectChange) {
m_selectedID = -1;
std::shared_ptr<appl::Buffer> tmpBuffer;
if (m_bufferManager != nullptr) {
tmpBuffer = m_bufferManager->getBufferSelected();
}
if (tmpBuffer != nullptr) {
for (size_t iii=0; iii<m_list.size(); iii++) {
if (m_list[iii] == nullptr) {
continue;
}
if (m_list[iii]->m_buffer != tmpBuffer) {
continue;
}
m_selectedID = iii;
markToRedraw();
}
void BufferView::onCallbackChangeName() {
for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii].m_bufferName != m_list[iii].m_buffer->getFileName()) {
m_list[iii].m_bufferName = m_list[iii].m_buffer->getFileName();
if (m_openOrderMode == false) {
// re-order the fine in the correct position
appl::dataBufferStruct tmp = m_list[iii];
m_list.erase(m_list.begin() + iii);
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
break;
}
}
markToRedraw();
return;
}
if (_msg.getMessage() == ednMsgBufferListChange) {
// clean The list
removeAllElement();
// get all the buffer name and properties:
size_t nbBufferOpen = 0; // BufferManager::size();
for (size_t iii=0; iii<nbBufferOpen; iii++) {
/*
if (BufferManager::exist(iii)) {
BufferText* tmpBuffer = BufferManager::get(iii);
if (nullptr != tmpBuffer) {
bool isModify = tmpBuffer->isModify();
etk::FSNode name = tmpBuffer->getFileName();
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
if (nullptr != tmpElement) {
m_list.push_back(tmpElement);
} else {
APPL_ERROR("Allocation error of the tmp buffer list element");
}
}
}
*/
}
if (true == globals::OrderTheBufferList() ) {
SortElementList(m_list);
}
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferId) {
m_selectedIdRequested = 0; //BufferManager::getSelected();
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferState) {
// update list of modify section ...
for (auto &it : m_list) {
if (it != nullptr) {
//it->m_isModify = BufferManager::get(it->m_bufferID)->isModify();
}
}
markToRedraw();
}
markToRedraw();
}
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()) {
if (it->m_buffer == _buffer) {
it = m_list.erase(it);
m_selectedID = -1;
} else {
++it;
}
}
markToRedraw();
}
void BufferView::onCallbackIsSave() {
markToRedraw();
}
void BufferView::onCallbackIsModify() {
markToRedraw();
}
etk::Color<> BufferView::getBasicBG() {
return (*m_paintingProperties)[m_colorBackground1].getForeground();
@@ -240,12 +175,11 @@ uint32_t BufferView::getNuberOfRaw() {
bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
if( _raw >= 0
&& _raw<(int64_t)m_list.size()
&& m_list[_raw] != nullptr) {
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
&& _raw<(int64_t)m_list.size() ) {
_myTextToWrite = m_list[_raw].m_bufferName.getNameFile();
if ( m_list[_raw]->m_buffer != nullptr
&& m_list[_raw]->m_buffer->isModify() == false) {
if ( m_list[_raw].m_buffer != nullptr
&& m_list[_raw].m_buffer->isModify() == false) {
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
} else {
_fg = (*m_paintingProperties)[m_colorTextModify].getForeground();
@@ -265,17 +199,16 @@ bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextT
return true;
}
bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y)
{
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()
&& nullptr != m_list[_raw]) {
if (m_list[_raw]->m_buffer != nullptr) {
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName());
m_selectedID = _raw;
markToRedraw();
&& _raw<(int64_t)m_list.size()) {
if (m_list[_raw].m_buffer != nullptr) {
if (m_bufferManager != nullptr) {
APPL_INFO("Select file :" << m_list[_raw].m_buffer->getFileName() << " in list");
m_bufferManager->open(m_list[_raw].m_buffer->getFileName());
}
return true;
}
}

View File

@@ -42,12 +42,12 @@ class BufferView : public ewol::widget::List {
private:
int32_t m_selectedIdRequested;
int32_t m_selectedID;
std::vector<appl::dataBufferStruct*> m_list;
std::vector<appl::dataBufferStruct> m_list;
/**
* @brief Insert the element in the alphabetic order.
* @param[in] _dataStruct element to add.
*/
void insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition = false);
void insertAlphabetic(const appl::dataBufferStruct& _dataStruct, bool _selectNewPosition = false);
protected:
// Constructeur
BufferView();
@@ -55,8 +55,6 @@ class BufferView : public ewol::widget::List {
public:
DECLARE_FACTORY(BufferView);
virtual ~BufferView();
// Derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
private:
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
protected:
@@ -69,6 +67,13 @@ class BufferView : public ewol::widget::List {
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 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 std::shared_ptr<appl::Buffer>& _buffer);
};

View File

@@ -172,105 +172,66 @@ void MainWindows::init() {
mySizerVert2->subWidgetAdd(myTextView);
*/
// search area :
std::shared_ptr<appl::widget::Search> mySearch = appl::widget::Search::create();
mySizerVert2->subWidgetAdd(mySearch);
m_widgetSearch = appl::widget::Search::create();
mySizerVert2->subWidgetAdd(m_widgetSearch);
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
mySizerHori->setName("plop 555555");
mySizerVert->subWidgetAdd(mySizerHori);
myMenu = ewol::widget::Menu::create();
myMenu->setName("appl-menu-interface");
mySizerHori->subWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->addTitle("File");
myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
myMenu->add(idMenuFile, "New", "", "menu:new");
myMenu->addSpacer();
myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", ednMsgGuiOpen);
myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", ednMsgGuiClose, "current");
myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", ednMsgGuiSave, "current");
myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
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, "Exit", "", ednMsgGuiExit);
myMenu->addSpacer();
myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", ednMsgProperties);
myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", "menu:property");
int32_t idMenuEdit = myMenu->addTitle("Edit");
myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", ednMsgGuiUndo);
myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", ednMsgGuiRedo);
myMenu->addSpacer();
myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
myMenu->addSpacer();
myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
myMenu->add(idMenuEdit, "Goto line ...","", "menu:goto-line");
int32_t idMenuSearch = myMenu->addTitle("Search");
myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", ednMsgGuiSearch);
myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", ednMsgGuiReplace);
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, "Find (previous)","", ednMsgGuiFind, "Previous");
myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
/* ==> must be in the pluggin list control ...
int32_t idMenuCTags = myMenu->addTitle("C-tags");
myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
*/
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", "", appl::MsgNameGuiChangeColor, "color/black/");
myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "color/white/");
myMenu->add(idMenugDisplay, "Shape square", "", l_MsgNameGuiChangeShape, "shape/square/");
myMenu->add(idMenugDisplay, "Shape round", "", l_MsgNameGuiChangeShape, "shape/round/");
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, "Reload openGl Shader", "", ednMsgGuiReloadShader);
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 ...
// (shift, control, alt, meta, char32_t unicodeValue, const char * generateEventId, std::string& data)
shortCutAdd("ctrl+o", ednMsgGuiOpen, "", true);
shortCutAdd("ctrl+n", ednMsgGuiNew, "", true);
shortCutAdd("ctrl+o", "menu:open");
shortCutAdd("ctrl+n", "menu:new");
shortCutAdd("ctrl+s", ednMsgGuiSave, "current", true);
shortCutAdd("ctrl+shift+s", ednMsgGuiSave, "All", true);
shortCutAdd("ctrl+s", "menu:save");
shortCutAdd("ctrl+shift+s", "menu:save-all");
shortCutAdd("ctrl+q", ednMsgGuiClose, "current", true);
shortCutAdd("ctrl+shift+q", ednMsgGuiClose, "All", true);
shortCutAdd("ctrl+q", "menu:close");
shortCutAdd("ctrl+shift+q", "menu:close-all");
shortCutAdd("ctrl+z", ednMsgGuiUndo, "", true);
shortCutAdd("ctrl+shift+z", ednMsgGuiRedo, "", true);
shortCutAdd("ctrl+l", "menu:goto-line");
shortCutAdd("ctrl+l", ednMsgGuiGotoLine, "???", true);
shortCutAdd("ctrl+f", ednMsgGuiSearch, "", true);
shortCutAdd("F12", ednMsgGuiReloadShader, "", true);
//shortCutAdd("ctrl+d", ednMsgGuiCtags, "Jump", true);
// Generic event ...
registerMultiCast(ednMsgGuiSave);
registerMultiCast(ednMsgGuiSaveAs);
registerMultiCast(ednMsgProperties);
registerMultiCast(ednMsgGuiNew);
registerMultiCast(ednMsgGuiOpen);
registerMultiCast(ednMsgGuiClose);
// to update the title ...
registerMultiCast(ednMsgBufferState);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiReloadShader);
registerMultiCast(appl::MsgNameGuiChangeColor);
registerMultiCast(l_MsgNameGuiChangeShape);
registerMultiCast(appl::MsgSelectNewFile);
shortCutAdd("ctrl+f", "menu:search");
shortCutAdd("F12", "menu:reloade-shader");
// 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);
}
@@ -279,154 +240,79 @@ MainWindows::~MainWindows() {
}
const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
void MainWindows::onCallbackShortCut(const std::string& _value) {
APPL_WARNING("Event from ShortCut : " << _value);
onCallbackMenuEvent(_value);
}
void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::Windows::onReceiveMessage(_msg);
APPL_VERBOSE("Receive Event from the main windows: " << _msg );
// open file Section ...
if (_msg.getMessage() == ednMsgGuiOpen) {
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not open File chooser !!! ");
return;
void MainWindows::onCallbackMenuEvent(const std::string& _value) {
APPL_WARNING("Event from Menu : " << _value);
if (_value == "menu:new") {
if (m_bufferManager != nullptr) {
m_bufferManager->createNewBuffer();
}
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 ...)
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != nullptr) {
etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->setFolder(tmpFile.getNameFolder());
}
// apply widget pop-up ...
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(shared_from_this(), "validate", ednEventPopUpFileSelected);
} else if (_msg.getMessage() == ednMsgProperties) {
// Request the parameter GUI
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");
} else {
#ifdef SDGSDFGSDFGSDFGSDFGSTERGDHFGHFDS
std::string menuDescription = "<title>Properties</title>\n";
menuDescription += "<group>\n";
menuDescription += " <title>Editor</title>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Editor Interface</title>\n";
menuDescription += " <short-title>Editor</short-title>\n";
menuDescription += " <widget>appl-text-viewer</widget>\n";
menuDescription += " </menu>\n";
menuDescription += "</group>\n";
menuDescription += "<group>\n";
menuDescription += " <title>Gui</title>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Font selection</title>\n";
menuDescription += " <short-title>Font</short-title>\n";
menuDescription += " <widget></widget>\n";
menuDescription += " </menu>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Color selection</title>\n";
menuDescription += " <short-title>Color</short-title>\n";
menuDescription += " <widget></widget>\n";
menuDescription += " </menu>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Theme selection</title>\n";
menuDescription += " <short-title>Theme</short-title>\n";
menuDescription += " <widget></widget>\n";
menuDescription += " </menu>\n";
menuDescription += "</group>\n";
tmpWidget->setMenu(menuDescription);
#endif
tmpWidget->setTitle("Properties");
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);
}
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
etk::theme::setName("COLOR", _msg.getData());
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == l_MsgNameGuiChangeShape) {
etk::theme::setName("GUI", _msg.getData());
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiExit) {
// TODO : ...
}
// Note : Fore all next message we need to acces to the buffer manager ==> just check one time ...
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
if ( _msg.getMessage() == appl::MsgSelectNewFile
|| _msg.getMessage() == appl::Buffer::eventIsModify
|| _msg.getMessage() == appl::Buffer::eventIsSave
|| _msg.getMessage() == appl::Buffer::eventChangeName) {
// select a new Buffer ==> change title:
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
setTitle("Edn");
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel("");
}
} else {
if (_msg.getMessage() == appl::MsgSelectNewFile) {
tmpp->registerOnEvent(shared_from_this(), appl::Buffer::eventIsModify);
tmpp->registerOnEvent(shared_from_this(), appl::Buffer::eventIsSave);
tmpp->registerOnEvent(shared_from_this(), appl::Buffer::eventChangeName);
}
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
} else if (_msg.getMessage() == ednMsgGuiNew) {
m_bufferManager->createNewBuffer();
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.getData());
m_bufferManager->open(_msg.getData());
} else if (_msg.getMessage() == ednMsgGuiSave) {
APPL_DEBUG("Request saving the file : " << _msg.getData());
if (etk::tolower(_msg.getData()) == "current") {
appl::WorkerSaveFile::create("", false);
return;
} else if (etk::tolower(_msg.getData()) == "all") {
appl::WorkerSaveAllFile::create();
return;
} else {
APPL_ERROR("UNKNOW request : " << _msg);
}
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
} else if (_value == "menu:open") {
displayOpen();
} else if (_value == "menu:close") {
std::shared_ptr<appl::WorkerCloseFile> worker = appl::WorkerCloseFile::create();
worker->startAction("");
} else if (_value == "menu:close-all") {
appl::WorkerCloseAllFile::create();
} else if (_value == "menu:save") {
appl::WorkerSaveFile::create("", false);
} else if (_value == "menu:save-all") {
appl::WorkerSaveAllFile::create();
} else if (_value == "menu:save-as") {
appl::WorkerSaveFile::create("", true);
} else if (_msg.getMessage() == ednMsgGuiClose) {
// Get a ref on the buffer selected (if null, no buffer was selected ...)
if (_msg.getData() == "current") {
appl::WorkerCloseFile::create("");
} else {
appl::WorkerCloseAllFile::create();
} else if (_value == "menu:property") {
displayProperty();
} else if (_value == "menu:search") {
if (m_widgetSearch == nullptr) {
return;
}
if (m_widgetSearch->isHide()) {
m_widgetSearch->show();
m_widgetSearch->selectSearch();
} else {
m_widgetSearch->hide();
}
} else if (_value == "menu:replace") {
if (m_widgetSearch == nullptr) {
return;
}
if (m_widgetSearch->isHide()) {
m_widgetSearch->show();
m_widgetSearch->selectReplace();
} else {
m_widgetSearch->hide();
}
} else if (_value == "menu:find:previous") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:find:next") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:find:all") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:find:none") {
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, 12));
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else if ( _value == "menu:shape:shape/square/"
|| _value == "menu:shape:shape/round/") {
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 {
APPL_ERROR("Event from Menu UNKNOW : '" << _value << "'");
}
}
/* TODO :
} else if (_msg.getMessage() == mainWindowsRequestSaveFile) { // return after a choice of close...
if (m_bufferManager->exist(_msg.getData()) == false) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
@@ -471,7 +357,106 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
//tmpBuffer->removeObject();
EWOL_TODO("call remove buffer ...");
}
return;
*/
void MainWindows::displayOpen() {
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not open File chooser !!! ");
return;
}
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 ...)
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != nullptr) {
etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->setFolder(tmpFile.getNameFolder());
}
// apply widget pop-up ...
popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.bind(shared_from_this(), &MainWindows::onCallbackPopUpFileSelected);
}
void MainWindows::displayProperty() {
// Request the parameter GUI
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");
} else {
#ifdef SDGSDFGSDFGSDFGSDFGSTERGDHFGHFDS
std::string menuDescription = "<title>Properties</title>\n";
menuDescription += "<group title='Editor'>\n";
menuDescription += " <menu title='Editor Interface' short-title='Editor' widget='appl-text-viewer'>\n";
menuDescription += "</group>\n";
menuDescription += "<group title='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";
tmpWidget->setMenu(menuDescription);
#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) {
APPL_INFO("onCallbackselectNewFile(" << _value << ")");
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
// TODO : Remove all previous binding from the old buffer ...
onCallbackTitleUpdate();
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp != nullptr) {
tmpp->signalIsSave.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
tmpp->signalIsModify.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
tmpp->signalChangeName.bind(shared_from_this(), &MainWindows::onCallbackTitleUpdate);
}
}
void MainWindows::onCallbackPopUpFileSelected(const std::string& _value) {
APPL_INFO("onCallbackPopUpFileSelected(" << _value << ")");
APPL_DEBUG("Request opening the file : " << _value);
m_bufferManager->open(_value);
}
void MainWindows::onCallbackTitleUpdate() {
APPL_INFO("onCallbackTitleUpdate()");
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
// select a new Buffer ==> change title:
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
setTitle("Edn");
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel("");
}
} else {
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
}
void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) {
@@ -494,24 +479,24 @@ void MainWindows::closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer
}
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> bt = nullptr;
std::shared_ptr<ewol::widget::Button> bt = nullptr;
if (_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true);
if (bt != nullptr) {
// TODO : The element is removed before beeing pressed
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFile, _buffer->getFileName());
bt->registerOnEvent(shared_from_this(), "pressed", 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("Save As", true);
if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->registerOnEvent(this, "pressed", 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("Close", true);
if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : bt->signalPressed.bind(shared_from_this(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
}
tmpPopUp->addButton("Cancel", true);
tmpPopUp->setRemoveOnExternClick(true);

View File

@@ -16,10 +16,12 @@
#include <appl/BufferManager.h>
#include <ewol/widget/Label.h>
#include <appl/BufferManager.h>
#include <appl/Gui/Search.h>
class MainWindows : public ewol::widget::Windows {
private:
std::shared_ptr<ewol::widget::Label> m_widgetLabelFileName;
std::shared_ptr<appl::widget::Search> m_widgetSearch;
protected:
// Constructeur
MainWindows();
@@ -39,8 +41,14 @@ class MainWindows : public ewol::widget::Windows {
* @param[in] _buffer Buffer that might be close.
*/
void closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer);
public: // Derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
void displayOpen();
void displayProperty();
private:
void onCallbackPopUpFileSelected(const std::string& _value);
void onCallbackTitleUpdate();
void onCallbackMenuEvent(const std::string& _value);
void onCallbackShortCut(const std::string& _value);
void onCallbackselectNewFile(const std::string& _value);
};

View File

@@ -12,6 +12,8 @@
#include "appl/Gui/TextViewer.h"
#include "appl/Gui/MainWindows.h"
#include "appl/globalMsg.h"
#include <ewol/widget/Button.h>
#include <ewol/widget/Entry.h>
#undef __class__
@@ -38,25 +40,23 @@ void appl::widget::Search::init() {
ewol::widget::Composer::init(ewol::widget::Composer::file, "DATA:GUI-Search.xml");
m_viewerManager = appl::ViewerManager::create();
// link event
registerOnEventNameWidget(shared_from_this(), "SEARCH:close", "pressed", l_eventHideBt);
registerOnEventNameWidget(shared_from_this(), "SEARCH:search-entry", "modify", l_eventSearchEntry);
registerOnEventNameWidget(shared_from_this(), "SEARCH:search-entry", "enter", l_eventSearchEntryEnter);
registerOnEventNameWidget(shared_from_this(), "SEARCH:search", "pressed", l_eventSearchBt);
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace-entry", "modify", l_eventReplaceEntry);
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace-entry", "enter", l_eventReplaceEntryEnter);
registerOnEventNameWidget(shared_from_this(), "SEARCH:replace", "pressed", l_eventReplaceBt);
registerOnEventNameWidget(shared_from_this(), "SEARCH:case", "value", l_eventCaseCb);
registerOnEventNameWidget(shared_from_this(), "SEARCH:wrap", "value", l_eventWrapCb);
registerOnEventNameWidget(shared_from_this(), "SEARCH:up-down", "value", l_eventForwardCb);
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
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 = std::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:search-entry"));
m_replaceEntry = std::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:replace-entry"));
// Display and hide event:
registerMultiCast(ednMsgGuiSearch);
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 ...
hide();
}
@@ -118,45 +118,50 @@ void appl::widget::Search::replace() {
viewer->replace(m_replaceData);
}
void appl::widget::Search::OnCallbackHide() {
hide();
}
void appl::widget::Search::OnCallbackSearchValue(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
}
void appl::widget::Search::OnCallbackSearch() {
find();
}
void appl::widget::Search::OnCallbackSearchEntryValidate(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
find();
}
void appl::widget::Search::OnCallbackReplaceValue(const std::string& _value) {
m_replaceData = etk::to_u32string(_value);
}
void appl::widget::Search::OnCallbackReplace() {
replace();
find();
}
void appl::widget::Search::OnCallbackReplaceEntryValidate(const std::string& _value) {
m_replaceData = etk::to_u32string(_value);
replace();
find();
}
void appl::widget::Search::OnCallbackCase(const bool& _value) {
m_caseSensitive = _value;
}
void appl::widget::Search::OnCallbackWrap(const bool& _value) {
m_wrap = _value;
}
void appl::widget::Search::OnCallbackForward(const bool& _value) {
m_forward = _value;
}
void appl::widget::Search::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::Composer::onReceiveMessage(_msg);
APPL_INFO("Search receive message : " << _msg);
if ( _msg.getMessage() == l_eventSearchEntry) {
m_searchData = etk::to_u32string(_msg.getData());
} else if ( _msg.getMessage() == l_eventSearchEntryEnter
|| _msg.getMessage() == l_eventSearchBt) {
find();
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
m_replaceData = etk::to_u32string(_msg.getData());
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter
|| _msg.getMessage() == l_eventReplaceBt) {
replace();
find();
} else if ( _msg.getMessage() == l_eventCaseCb) {
m_caseSensitive = etk::string_to_bool(_msg.getData());
} else if ( _msg.getMessage() == l_eventWrapCb) {
m_wrap = etk::string_to_bool(_msg.getData());
} else if ( _msg.getMessage() == l_eventForwardCb) {
m_forward = etk::string_to_bool(_msg.getData());
} else if ( _msg.getMessage() == l_eventHideBt) {
hide();
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
if (true == isHide()) {
show();
if (m_searchEntry!= nullptr) {
m_searchEntry->keepFocus();
}
} else {
if( (m_searchEntry!=nullptr && true == m_searchEntry->getFocus())
|| (m_replaceEntry!=nullptr && true == m_replaceEntry->getFocus()) ) {
hide();
} else if (m_searchEntry!= nullptr) {
m_searchEntry->keepFocus();
} else {
hide();
}
}
void appl::widget::Search::selectSearch() {
if (m_searchEntry!= nullptr) {
m_searchEntry->keepFocus();
}
}
void appl::widget::Search::selectReplace() {
if (m_replaceEntry!= nullptr) {
m_replaceEntry->keepFocus();
}
}

View File

@@ -42,8 +42,20 @@ namespace appl {
* @brief Replace the current selected text.
*/
void replace();
public: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
public:
void selectSearch();
void selectReplace();
private: // callback functions
void OnCallbackHide();
void OnCallbackSearchValue(const std::string& _value);
void OnCallbackSearch();
void OnCallbackSearchEntryValidate(const std::string& _value);
void OnCallbackReplaceValue(const std::string& _value);
void OnCallbackReplace();
void OnCallbackReplaceEntryValidate(const std::string& _value);
void OnCallbackCase(const bool& _value);
void OnCallbackWrap(const bool& _value);
void OnCallbackForward(const bool& _value);
};
};
};

View File

@@ -12,15 +12,12 @@
#undef __class__
#define __class__ "TagFileList"
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
appl::TagFileList::TagFileList() {
appl::TagFileList::TagFileList() :
signalSelect(*this, "select"),
signalValidate(*this, "validate"),
signalUnSelect(*this, "unselect") {
addObjectType("appl::TagFileList");
m_selectedLine = -1;
addEventId(applEventCtagsListSelect);
addEventId(applEventCtagsListValidate);
setMouseLimit(1);
// Load color properties: (use file list to be generic ...)
m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:ListFileSystem.json");
@@ -92,16 +89,16 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
} else {
m_selectedLine = _raw;
}
const char * event = applEventCtagsListValidate;
if (previousRaw != m_selectedLine) {
event = applEventCtagsListSelect;
}
if( m_selectedLine >= 0
&& m_selectedLine < (int64_t)m_list.size()
&& nullptr != m_list[m_selectedLine] ) {
generateEventId(event, etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
if (previousRaw != m_selectedLine) {
signalSelect.emit(etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
} else {
signalValidate.emit(etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
}
} else {
generateEventId(applEventCtagsListUnSelect);
signalUnSelect.emit();
}
// need to regenerate the display of the list :
markToRedraw();

View File

@@ -13,11 +13,6 @@
#include <ewol/widget/List.h>
#include <ewol/resource/ColorFile.h>
extern const char * const applEventCtagsListSelect;
extern const char * const applEventCtagsListValidate;
extern const char * const applEventCtagsListUnSelect;
namespace appl {
class TagListElement {
public:
@@ -33,6 +28,10 @@ namespace appl {
};
};
class TagFileList : public ewol::widget::List {
public:
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;

View File

@@ -26,14 +26,18 @@
#define __class__ "TagFileSelection"
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
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() {
appl::TagFileSelection::TagFileSelection() :
signalSelect(*this, "select"),
signalCancel(*this, "cancel") {
addObjectType("appl::TagFileSelection");
addEventId(applEventctagsSelection);
addEventId(applEventctagsCancel);
}
void appl::TagFileSelection::init() {
@@ -74,16 +78,16 @@ void appl::TagFileSelection::init() {
compose->setExpand(bvec2(true,false));
compose->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(compose);
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
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 (nullptr == m_listTag) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListValidate);
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListSelect);
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListUnSelect);
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);
@@ -104,30 +108,34 @@ appl::TagFileSelection::~TagFileSelection() {
}
void appl::TagFileSelection::onReceiveMessage(const ewol::object::Message& _msg) {
EWOL_INFO("ctags LIST ... : " << _msg );
if (_msg.getMessage() == applEventctagsSelection) {
if (m_eventNamed!="") {
generateEventId(applEventctagsSelection, m_eventNamed);
// == > Auto remove ...
autoDestroy();
}
} else if (_msg.getMessage() == applEventCtagsListSelect) {
m_eventNamed = _msg.getData();
} else if (_msg.getMessage() == applEventCtagsListUnSelect) {
m_eventNamed = "";
} else if (_msg.getMessage() == applEventCtagsListValidate) {
generateEventId(applEventctagsSelection, _msg.getData());
// == > Auto remove ...
autoDestroy();
} else if (_msg.getMessage() == applEventctagsCancel) {
generateEventId(applEventctagsCancel, "");
void appl::TagFileSelection::onCallbackCtagsSelection() {
if (m_eventNamed!="") {
signalSelect.emit(m_eventNamed);
// == > Auto remove ...
autoDestroy();
}
return;
};
}
void appl::TagFileSelection::onCallbackCtagsCancel() {
signalCancel.emit();
// == > Auto remove ...
autoDestroy();
}
void appl::TagFileSelection::onCallbackCtagsListValidate(const std::string& _value) {
signalSelect.emit(_value);
// == > Auto remove ...
autoDestroy();
}
void appl::TagFileSelection::onCallbackCtagsListSelect(const std::string& _value) {
m_eventNamed = _value;
}
void appl::TagFileSelection::onCallbackCtagsListUnSelect() {
m_eventNamed = "";
}
/**

View File

@@ -13,11 +13,11 @@
#include <ewol/widget/PopUp.h>
#include <appl/Gui/TagFileList.h>
extern const char * const applEventctagsSelection;
extern const char * const applEventctagsCancel;
namespace appl {
class TagFileSelection : public ewol::widget::PopUp {
public:
ewol::object::Signal<std::string> signalSelect;
ewol::object::Signal<void> signalCancel;
private:
std::shared_ptr<appl::TagFileList> m_listTag;
std::string m_eventNamed;
@@ -33,8 +33,12 @@ namespace appl {
* @param[in] jump line id
*/
void addCtagsNewItem(std::string file, int32_t line);
public: // herited function
void onReceiveMessage(const ewol::object::Message& _msg);
public: // callback function
void onCallbackCtagsSelection();
void onCallbackCtagsCancel();
void onCallbackCtagsListValidate(const std::string& _value);
void onCallbackCtagsListSelect(const std::string& _value);
void onCallbackCtagsListUnSelect();
};
};

View File

@@ -28,6 +28,10 @@
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() :
m_insertMode(false) {
addObjectType("appl::TextViewer");
@@ -37,6 +41,7 @@ appl::TextViewer::TextViewer() :
// load buffer manager:
m_bufferManager = appl::BufferManager::create();
m_pluginManager = appl::textPluginManager::create();
m_viewerManager = appl::ViewerManager::create();
// load color properties
@@ -54,21 +59,78 @@ appl::TextViewer::TextViewer() :
void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
ewol::widget::WidgetScrolled::init();
m_displayText.setFont(_fontName, _fontSize);
appl::textPluginManager::connect(*this);
m_pluginManager->connect(*this);
// last created has focus ...
setCurrentSelect();
signalShortcut.bind(shared_from_this(), &appl::TextViewer::onCallbackShortCut);
/*
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiFind);
registerMultiCast(ednMsgGuiReplace);
registerMultiCast(appl::MsgSelectGotoLine);
registerMultiCast(appl::MsgSelectNewFile);
registerMultiCast(appl::MsgSelectGotoLineSelect);
*/
if (m_bufferManager != nullptr) {
m_bufferManager->signalSelectFile.bind(shared_from_this(), &appl::TextViewer::onCallbackselectNewFile);
}
}
appl::TextViewer::~TextViewer() {
m_pluginManager->disconnect(*this);
}
void appl::TextViewer::onCallbackShortCut(const std::string& _value) {
if (m_pluginManager->onReceiveShortCut(*this, _value) == true) {
return;
}
}
appl::TextViewer::~TextViewer() {
appl::textPluginManager::disconnect(*this);
void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
// reset scroll:
if (m_buffer != nullptr) {
m_buffer->unBindAll(shared_from_this());
bool needAdd = true;
auto it = m_drawingRemenber.begin();
while (it != m_drawingRemenber.end()) {
std::shared_ptr<appl::Buffer> tmpBuff = it->first.lock();
if (tmpBuff == nullptr) {
it = m_drawingRemenber.erase(it);
continue;
}
if (tmpBuff == m_buffer) {
it->second = m_originScrooled;
APPL_VERBOSE("store origin : " << m_originScrooled);
needAdd = false;
break;
}
++it;
}
if (needAdd == true) {
m_drawingRemenber.push_back(std::make_pair(std::weak_ptr<appl::Buffer>(m_buffer), m_originScrooled));
APPL_VERBOSE("Push origin : " << m_originScrooled);
}
}
m_originScrooled = vec2(0,0);
if (m_bufferManager != nullptr) {
m_buffer = m_bufferManager->get(_value);
m_bufferManager->setBufferSelected(m_buffer);
if (m_buffer != nullptr) {
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;
APPL_VERBOSE("retrive origin : " << m_originScrooled);
// TODO : Check if this element is not out of the display text ...
break;
}
}
}
}
markToRedraw();
return;
}
std::string appl::TextViewer::getBufferPath() {
@@ -322,7 +384,7 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
return false;
}
// First call plugin
if (appl::textPluginManager::onEventEntry(*this, _event) == true) {
if (m_pluginManager->onEventEntry(*this, _event) == true) {
markToRedraw();
return true;
}
@@ -444,7 +506,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
}
APPL_VERBOSE("event : " << _event);
// Second call plugin
if (appl::textPluginManager::onEventInput(*this, _event) == true) {
if (m_pluginManager->onEventInput(*this, _event) == true) {
markToRedraw();
return true;
}
@@ -461,9 +523,9 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
}
if ( _event.getId() == 12
&& _event.getStatus() == ewol::key::statusSingle) {
APPL_DEBUG("kjhkjhkjh");
APPL_TODO("RAT5 SAVE button ==> TODO implement");
// Rat5 save event
sendMultiCast(ednMsgGuiSave, "current");
//sendMultiCast(ednMsgGuiSave, "current");
return true;
}
// just forward event == > manage directly in the buffer
@@ -625,84 +687,13 @@ void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboard
markToRedraw();
}
void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::WidgetScrolled::onReceiveMessage(_msg);
APPL_VERBOSE("receive msg: " << _msg);
// First call plugin
if (appl::textPluginManager::onReceiveMessageViewer(*this, _msg) == true) {
markToRedraw();
return;
}
// event needed even if selection of buffer is not done ...
if (_msg.getMessage() == appl::Buffer::eventIsModify) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::Buffer::eventSelectChange) {
markToRedraw();
return;
}
// If not the last buffer selected, then no event parsing ...
if (isSelectedLast() == false) {
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
if (m_buffer == nullptr) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
select(it, m_buffer->getEndLine(it));
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
if (m_buffer == nullptr) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
moveCursor(it);
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectNewFile) {
// reset scroll:
if (m_buffer != nullptr) {
m_buffer->unRegisterOnEvent(shared_from_this());
bool needAdd = true;
for (size_t iii=0; iii<m_drawingRemenber.size(); ++iii) {
if (m_drawingRemenber[iii].first == m_buffer) {
m_drawingRemenber[iii].second = m_originScrooled;
APPL_VERBOSE("store origin : " << m_originScrooled);
needAdd = false;
break;
}
}
if (needAdd == true) {
m_drawingRemenber.push_back(std::make_pair(m_buffer, m_originScrooled));
APPL_VERBOSE("Push origin : " << m_originScrooled);
}
}
m_originScrooled = vec2(0,0);
if (m_bufferManager != nullptr) {
m_buffer = m_bufferManager->get(_msg.getData());
m_bufferManager->setBufferSelected(m_buffer);
if (m_buffer != nullptr) {
m_buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventIsModify);
m_buffer->registerOnEvent(shared_from_this(), appl::Buffer::eventSelectChange);
for (auto element : m_drawingRemenber) {
if (element.first == m_buffer) {
m_originScrooled = element.second;
APPL_VERBOSE("retrive origin : " << m_originScrooled);
// TODO : Check if this element is not out of the display text ...
break;
}
}
}
}
markToRedraw();
return;
}
void appl::TextViewer::onCallbackIsModify() {
markToRedraw();
}
void appl::TextViewer::onCallbackSelectChange() {
markToRedraw();
}
void appl::TextViewer::onGetFocus() {
showKeyboard();
@@ -761,7 +752,7 @@ bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
return false;
}
markToRedraw();
if (appl::textPluginManager::onCursorMove(*this, _pos) == true) {
if (m_pluginManager->onCursorMove(*this, _pos) == true) {
updateScrolling();
return true;
}
@@ -785,13 +776,13 @@ bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Itera
return false;
}
markToRedraw();
if (appl::textPluginManager::onWrite(*this, _pos, _data) == true) {
if (m_pluginManager->onWrite(*this, _pos, _data) == true) {
// no call of the move cursor, because pluging might call theses function to copy and cut data...
updateScrolling();
return true;
}
bool ret = m_buffer->write(_data, _pos);
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor());
m_pluginManager->onCursorMove(*this, m_buffer->cursor());
updateScrolling();
return ret;
}
@@ -801,13 +792,13 @@ bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Ite
return false;
}
markToRedraw();
if (appl::textPluginManager::onReplace(*this, _pos, _data, _posEnd) == true) {
if (m_pluginManager->onReplace(*this, _pos, _data, _posEnd) == true) {
// no call of the move cursor, because pluging might call theses function to copy and cut data...
updateScrolling();
return true;
}
bool ret = m_buffer->replace(_data, _pos, _posEnd);
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor());
m_pluginManager->onCursorMove(*this, m_buffer->cursor());
updateScrolling();
return ret;
}
@@ -831,11 +822,11 @@ void appl::TextViewer::remove() {
return;
}
markToRedraw();
if (appl::textPluginManager::onRemove(*this, m_buffer->selectStart(), m_buffer->selectStop()) == true) {
if (m_pluginManager->onRemove(*this, m_buffer->selectStart(), m_buffer->selectStop()) == true) {
return;
}
m_buffer->removeSelection();
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor());
m_pluginManager->onCursorMove(*this, m_buffer->cursor());
}

View File

@@ -22,6 +22,7 @@
#include <utility>
namespace appl {
class textPluginManager;
class TextViewer : public ewol::widget::WidgetScrolled {
private:
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
@@ -34,6 +35,7 @@ namespace appl {
int32_t m_colorNormal;
private:
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();
@@ -54,7 +56,7 @@ namespace appl {
private:
ewol::compositing::Text m_displayText; //!< Text display properties.
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
std::vector<std::pair<std::shared_ptr<appl::Buffer>, vec2>> m_drawingRemenber;
std::vector<std::pair<std::weak_ptr<appl::Buffer>, vec2>> m_drawingRemenber;
public:
void setFontSize(int32_t _size);
void setFontName(const std::string& _fontName);
@@ -63,7 +65,6 @@ namespace appl {
public: // Derived function
virtual bool calculateMinSize();
virtual void onRegenerateDisplay();
virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual bool onEventInput(const ewol::event::Input& _event);
virtual bool onEventEntry(const ewol::event::Entry& _event);
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
@@ -391,21 +392,31 @@ namespace appl {
* @brief Register of the arrival of a Multicast message
* @param[in] _messageId Event Id waiting for...
*/
// TODO : Remove
void ext_registerMultiCast(const char* const _messageId) {
registerMultiCast(_messageId);
//registerMultiCast(_messageId);
}
/**
* @brief add a specific shortcut with his description
* @param[in] _descriptiveString Description string of the shortcut
* @param[in] _generateEventId Event generic of the element
* @param[in] _data Associate data wit the event
* @param[in] _generateEventName Event generic of the element
*/
virtual void ext_shortCutAdd(const char * _descriptiveString,
const char * _generateEventId,
std::string _data="",
bool _broadcast=false) {
shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
virtual void ext_shortCutAdd(const std::string& _descriptiveString,
const std::string& _generateEventName) {
shortCutAdd(_descriptiveString, _generateEventName);
}
/**
* @brief Remove a specific shortcut with his event name
* @param[in] _generateEventName Event of the element shortcut
*/
virtual void ext_shortCutRm(const std::string& _generateEventName) {
shortCutRemove(_generateEventName);
}
private: // callback fundtions
void onCallbackIsModify();
void onCallbackShortCut(const std::string& _value);
void onCallbackSelectChange();
void onCallbackselectNewFile(const std::string& _value);
};
};

View File

@@ -41,6 +41,6 @@ void appl::ViewerManager::setViewerSelected(const std::shared_ptr<appl::TextView
}
m_viewer = _viewer;
if (m_bufferManager != nullptr) {
m_bufferManager->setBufferSelected(_buffer);
//m_bufferManager->setBufferSelected(_buffer);
}
}

View File

@@ -13,8 +13,6 @@
#undef __class__
#define __class__ "WorkerCloseAllFile"
static const char* s_closeDone = "close-done";
appl::WorkerCloseAllFile::WorkerCloseAllFile() {
addObjectType("appl::WorkerCloseAllFile");
// load buffer manager:
@@ -22,10 +20,10 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile() {
}
void appl::WorkerCloseAllFile::init() {
ewol::Object::init();
ewol::object::Worker::init();
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy();
destroy();
return;
}
// List all current open file :
@@ -43,43 +41,43 @@ void appl::WorkerCloseAllFile::init() {
}
// checkif an element has something to do in the queue
if (m_bufferNameList.size() == 0) {
autoDestroy();
destroy();
return;
}
// create the worker :
m_worker = appl::WorkerCloseFile::create(m_bufferNameList.front());
m_worker = appl::WorkerCloseFile::create();
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());
if (m_bufferNameList.size() == 0) {
autoDestroy();
destroy();
return;
}
m_worker->registerOnEvent(shared_from_this(), appl::WorkerCloseFile::eventCloseDone, s_closeDone);
}
appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
APPL_ERROR("Remove Worker");
}
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
void appl::WorkerCloseAllFile::onCallbackCloseDone() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
return;
}
if (_msg.getMessage() == s_closeDone) {
if (m_bufferNameList.size() == 0) {
autoDestroy();
return;
}
// create the worker :
m_worker = appl::WorkerCloseFile::create(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) {
autoDestroy();
return;
}
m_worker->registerOnEvent(shared_from_this(), appl::WorkerCloseFile::eventCloseDone, s_closeDone);
if (m_bufferNameList.size() == 0) {
destroy();
return;
}
// create the worker :
m_worker = appl::WorkerCloseFile::create();
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());
if (m_bufferNameList.size() == 0) {
destroy();
return;
}
}

View File

@@ -9,11 +9,12 @@
#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>
namespace appl {
class WorkerCloseAllFile : public ewol::Object {
class WorkerCloseAllFile : public ewol::object::Worker {
protected:
WorkerCloseAllFile();
void init();
@@ -24,8 +25,8 @@ namespace appl {
std::vector<std::string> m_bufferNameList;
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: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
public: // callback function
void onCallbackCloseDone();
};
};

View File

@@ -14,29 +14,26 @@
#undef __class__
#define __class__ "WorkerCloseFile"
const char* appl::WorkerCloseFile::eventCloseDone = "close-file-done";
static const char* s_saveAsValidate = "save-as-validate";
static const char* s_saveValidate = "save-validate";
static const char* s_closeValidate = "close-validate";
static const char* s_saveAsDone = "save-as-done";
appl::WorkerCloseFile::WorkerCloseFile() :
signalCloseDone(*this, "close-file-done"),
signalAbort(*this, "close-file-abort"),
m_buffer(nullptr),
m_worker(nullptr),
m_bufferManager(nullptr) {
addObjectType("appl::WorkerCloseFile");
addEventId(eventCloseDone);
// load buffer manager:
m_bufferManager = appl::BufferManager::create();
}
void appl::WorkerCloseFile::init(const std::string& _bufferName) {
ewol::Object::init();
void appl::WorkerCloseFile::init() {
ewol::object::Worker::init();
}
void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
m_bufferName = _bufferName;
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy();
destroy();
return;
}
if (m_bufferName == "") {
@@ -44,101 +41,132 @@ void appl::WorkerCloseFile::init(const std::string& _bufferName) {
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ...");
autoDestroy();
destroy();
return;
}
m_bufferName = tmpp->getFileName();
}
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to close an non-existant file :" << m_bufferName);
autoDestroy();
destroy();
return;
}
m_buffer = m_bufferManager->get(m_bufferName);
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy();
destroy();
return;
}
if (m_buffer->isModify() == false) {
generateEventId(eventCloseDone);
signalCloseDone.emit();
m_buffer->destroy();
destroy();
return;
}
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->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> bt = nullptr;
std::shared_ptr<ewol::widget::Button> bt = nullptr;
if (m_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true);
if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", s_saveValidate);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveValidate);
}
}
bt = tmpPopUp->addButton("Save As", true);
if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", s_saveAsValidate);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
}
bt = tmpPopUp->addButton("Close", true);
if (bt != nullptr) {
bt->registerOnEvent(shared_from_this(), "pressed", s_closeValidate);
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
}
bt = tmpPopUp->addButton("Cancel", true);
if (bt != nullptr) {
bt->signalPressed.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel);
}
tmpPopUp->addButton("Cancel", true);
tmpPopUp->setRemoveOnExternClick(true);
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows.");
autoDestroy();
destroy();
return;
}
tmpWindows->popUpWidgetPush(tmpPopUp);
}
appl::WorkerCloseFile::~WorkerCloseFile() {
APPL_ERROR("Remove Worker");
}
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
void appl::WorkerCloseFile::onCallbackCancel() {
APPL_VERBOSE("Cancel signal ...");
signalAbort.emit();
destroy();
}
void appl::WorkerCloseFile::onCallbackSaveAsValidate() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
return;
}
APPL_DEBUG("have message : " << _msg);
if (_msg.getMessage() == s_saveAsValidate) {
m_worker = appl::WorkerSaveFile::create(m_bufferName);
if (m_worker != nullptr) {
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
}
} else if (_msg.getMessage() == s_saveValidate) {
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
autoDestroy();
return;
}
if (m_buffer->storeFile() == false) {
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>");
} else {
generateEventId(eventCloseDone);
}
} else if ( _msg.getMessage() == s_closeValidate
|| _msg.getMessage() == s_saveAsDone) {
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy();
return;
}
generateEventId(eventCloseDone);
m_buffer->destroy();
m_buffer.reset();
m_worker = appl::WorkerSaveFile::create(m_bufferName);
if (m_worker != nullptr) {
m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackClose);
m_worker->signalAbort.bind(shared_from_this(), &appl::WorkerCloseFile::onCallbackCancel);
}
}
void appl::WorkerCloseFile::onCallbackSaveValidate() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
signalAbort.emit();
destroy();
return;
}
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
signalAbort.emit();
destroy();
return;
}
if (m_buffer->storeFile() == false) {
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();
m_buffer.reset();
signalCloseDone.emit();
}
destroy();
}
void appl::WorkerCloseFile::onCallbackClose() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
signalAbort.emit();
destroy();
return;
}
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
signalAbort.emit();
destroy();
return;
}
m_buffer->destroy();
m_buffer.reset();
signalCloseDone.emit();
destroy();
}

View File

@@ -9,28 +9,38 @@
#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>
#include <appl/Gui/WorkerSaveFile.h>
namespace appl {
class WorkerCloseFile : public ewol::Object {
class WorkerCloseFile : public ewol::object::Worker {
public:
static const char* eventCloseDone;
ewol::object::Signal<void> signalCloseDone;
ewol::object::Signal<void> signalAbort;
protected:
// note : if == "" ==> current ...
WorkerCloseFile();
void init(const std::string& _bufferName);
void init();
public:
DECLARE_FACTORY(WorkerCloseFile);
virtual ~WorkerCloseFile();
public:
/**
* @brief Action to do
*/
void startAction(const std::string& _bufferName);
private:
std::string m_bufferName;
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: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
public: // callback Functions
void onCallbackSaveAsValidate();
void onCallbackSaveValidate();
void onCallbackClose();
void onCallbackCancel();
};
};

View File

@@ -13,8 +13,6 @@
#undef __class__
#define __class__ "WorkerSaveAllFile"
static const char* s_saveAsDone = "save-as-done";
appl::WorkerSaveAllFile::WorkerSaveAllFile() {
addObjectType("appl::WorkerSaveAllFile");
// load buffer manager:
@@ -22,10 +20,10 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile() {
}
void appl::WorkerSaveAllFile::init() {
ewol::Object::init();
ewol::object::Worker::init();
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy();
destroy();
return;
}
// List all current open file :
@@ -45,7 +43,7 @@ void appl::WorkerSaveAllFile::init() {
}
// checkif an element has something to do in the queue
if (m_bufferNameList.size() == 0) {
autoDestroy();
destroy();
return;
}
// create the worker :
@@ -53,35 +51,33 @@ void appl::WorkerSaveAllFile::init() {
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) {
autoDestroy();
destroy();
return;
}
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
m_worker->signalSaveDone.bind(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}
appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
APPL_ERROR("Remove Worker");
}
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
void appl::WorkerSaveAllFile::onCallbackSaveAsDone() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
return;
}
if (_msg.getMessage() == s_saveAsDone) {
if (m_bufferNameList.size() == 0) {
autoDestroy();
return;
}
// create the worker :
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) {
autoDestroy();
return;
}
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
if (m_bufferNameList.size() == 0) {
destroy();
return;
}
// create the worker :
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.bind(shared_from_this(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
}

View File

@@ -9,11 +9,12 @@
#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>
namespace appl {
class WorkerSaveAllFile : public ewol::Object {
class WorkerSaveAllFile : public ewol::object::Worker {
protected:
WorkerSaveAllFile();
void init();
@@ -24,8 +25,8 @@ namespace appl {
std::vector<std::string> m_bufferNameList;
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: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
public: // callback function
void onCallbackSaveAsDone();
};
};

View File

@@ -13,23 +13,21 @@
#undef __class__
#define __class__ "WorkerSaveFile"
const char* appl::WorkerSaveFile::eventSaveDone = "save-file-done";
static const char* s_saveAsValidate = "save-as-validate";
appl::WorkerSaveFile::WorkerSaveFile() {
appl::WorkerSaveFile::WorkerSaveFile() :
signalSaveDone(*this, "save-file-done"),
signalAbort(*this, "save-file-abort") {
addObjectType("appl::WorkerSaveFile");
addEventId(eventSaveDone);
// load buffer manager:
m_bufferManager = appl::BufferManager::create();
}
void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveAs) {
ewol::Object::init();
ewol::object::Worker::init();
m_bufferName = _bufferName;
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy();
destroy();
return;
}
if (m_bufferName == "") {
@@ -37,34 +35,34 @@ void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveA
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ...");
autoDestroy();
destroy();
return;
}
m_bufferName = tmpp->getFileName();
}
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
autoDestroy();
destroy();
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy();
destroy();
return;
}
if (_forceSaveAs == false) {
if (tmpBuffer->hasFileName() == true) {
tmpBuffer->storeFile();
generateEventId(eventSaveDone);
autoDestroy();
signalSaveDone.emit();
destroy();
return;
}
}
m_chooser = ewol::widget::FileChooser::create();
if (nullptr == m_chooser) {
APPL_ERROR("Can not allocate widget == > display might be in error");
autoDestroy();
destroy();
return;
}
m_chooser->setTitle("Save files As...");
@@ -75,46 +73,56 @@ void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveA
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows.");
autoDestroy();
destroy();
return;
}
tmpWindows->popUpWidgetPush(m_chooser);
m_chooser->registerOnEvent(shared_from_this(), ewol::widget::FileChooser::eventValidate, s_saveAsValidate);
m_chooser->signalValidate.bind(shared_from_this(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
m_chooser->signalCancel.bind(shared_from_this(), &appl::WorkerSaveFile::onCallbackCancel);
}
appl::WorkerSaveFile::~WorkerSaveFile() {
APPL_ERROR("Remove Worker");
}
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
void appl::WorkerSaveFile::onCallbackCancel() {
signalAbort.emit();
destroy();
}
void appl::WorkerSaveFile::onCallbackSaveAsValidate(const std::string& _value) {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
destroy();
return;
}
if (_msg.getMessage() == s_saveAsValidate) {
if (_msg.getData() == "") {
APPL_ERROR(" might be an error of the File chooser system...");
return;
}
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
return;
}
tmpBuffer->setFileName(_msg.getData());
if (tmpBuffer->storeFile() == false) {
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
return;
}
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
} else {
generateEventId(eventSaveDone);
}
if (_value == "") {
APPL_ERROR(" might be an error of the File chooser system...");
destroy();
return;
}
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
destroy();
return;
}
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
destroy();
return;
}
tmpBuffer->setFileName(_value);
if (tmpBuffer->storeFile() == false) {
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();
}
destroy();
}

View File

@@ -10,12 +10,14 @@
#define __WORKER_SAVE_FILE_H__
#include <ewol/widget/meta/FileChooser.h>
#include <ewol/object/Worker.h>
#include <appl/BufferManager.h>
namespace appl {
class WorkerSaveFile : public ewol::Object {
class WorkerSaveFile : public ewol::object::Worker {
public:
static const char* eventSaveDone;
ewol::object::Signal<void> signalSaveDone;
ewol::object::Signal<void> signalAbort;
protected:
WorkerSaveFile();
void init(const std::string& _bufferName, bool _forceSaveAs=true);
@@ -26,8 +28,9 @@ namespace appl {
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: // derived function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
public: // callback function
void onCallbackSaveAsValidate(const std::string& _value);
void onCallbackCancel();
};
};

View File

@@ -10,6 +10,7 @@
#include <appl/global.h>
#include <appl/Highlight.h>
#include <exml/exml.h>
#include <ewol/ewol.h>
#include <ewol/resource/Manager.h>
@@ -24,17 +25,6 @@
//#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) {
// Create the patern ...
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
// parse under Element
myPattern->parseRules(_child, _level);
// add element in the list
_mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
}
appl::Highlight::Highlight() {
addObjectType("appl::Highlight");
}
@@ -82,7 +72,8 @@ void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
continue;
}
parseRules(passChild, m_listHighlightPass1, level1++);
// Create the patern in list
m_listHighlightPass1.push_back(HighlightPattern(m_paintingProperties, passChild, level1++));
}
} else if (child->getValue() == "pass2") {
// get sub Nodes ...
@@ -95,7 +86,30 @@ void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
continue;
}
parseRules(passChild, m_listHighlightPass2, level2++);
// Create the patern in list
m_listHighlightPass2.push_back(HighlightPattern(m_paintingProperties, passChild, level2++));
}
} else if (child->getValue() == "pass") {
std::string attributeName = child->getAttribute("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 it = m_listHighlightNamed.find(attributeName);
int32_t level3=0;
// get sub Nodes ...
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]" );
continue;
}
// add element in the list
it->second.push_back(HighlightPattern(m_paintingProperties, passChild, level3++));
}
} else {
APPL_ERROR("(l "<< child->getPos() << ") node not suported : \""<< child->getValue() << "\" must be [ext,pass1,pass2]" );
@@ -112,13 +126,28 @@ appl::Highlight::~Highlight() {
m_listExtentions.clear();
}
bool appl::Highlight::hasExtention(const std::string& _ext) {
bool appl::Highlight::isCompatible(const std::string& _name) {
for (auto &it : m_listExtentions) {
APPL_VERBOSE(" check : " << it << "=?=" << _ext);
if ( it == "*." + _ext
|| it == _ext) {
return true;
APPL_VERBOSE(" 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;
}
if (resultMatch[0].first != _name.begin()) {
continue;
}
if (resultMatch[0].second != _name.end()) {
continue;
}
return true;
}
return false;
}
@@ -150,13 +179,20 @@ void appl::Highlight::display() {
}
// display all elements
for (auto &it : m_listHighlightPass1) {
APPL_INFO(" Pass 1 : " << it->getName() );
//m_listHighlightPass1[iii]->display();
APPL_INFO(" Pass 1 : " << it.getName() );
//it.display();
}
// display all elements
for (auto &it : m_listHighlightPass2) {
APPL_INFO(" pass 2 : " << it->getName() );
//m_listHighlightPass2[iii]->display();
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();
}
}
@@ -167,7 +203,7 @@ void appl::Highlight::parse(int64_t _start,
int64_t _stop,
std::vector<appl::HighlightInfo> & _metaData,
int64_t _addingPos,
etk::Buffer & _buffer) {
std::string& _buffer) {
if (0 > _addingPos) {
_addingPos = 0;
}
@@ -175,16 +211,26 @@ 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);
//HL_DEBUG("Parse element in the buffer pos=" << elementStart);
int64_t currentTime = ewol::getTime();
//try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
enum resultFind ret = HLP_FIND_OK;
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj]->getPaternString());
/*
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());
}
*/
// Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer);
ret = m_listHighlightPass1[jjj].find(elementStart, _buffer.size(), resultat, _buffer);
if (HLP_FIND_ERROR != ret) {
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ")" );
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());
// 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() ) {
@@ -194,7 +240,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 befor the end of the next element
// just before the end of the next element
elementStop = _metaData[kkk].start-1;
} else {
// end of the buffer
@@ -219,17 +265,25 @@ 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,
etk::Buffer &_buffer) {
std::string&_buffer) {
HL2_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() <<
" == > position search: (" << _start << "," << _stop << ")" );
int64_t elementStart = _start;
@@ -243,18 +297,15 @@ void appl::Highlight::parse2(int64_t _start,
//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++){
enum resultFind ret = HLP_FIND_OK;
enum resultFind ret;
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
elementStart << "," << elementStop << ") in='"
<< _buffer[elementStart] << "' " << m_listHighlightPass2[jjj]->getPaternString());
elementStart << "," << elementStop << ") in='"
<< _buffer[elementStart] << "' " << m_listHighlightPass2[jjj].getPaternString());
// Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer);
ret = m_listHighlightPass2[jjj].find(elementStart, elementStop, resultat, _buffer);
if (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;
}
}
@@ -262,3 +313,46 @@ void appl::Highlight::parse2(int64_t _start,
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){
enum resultFind ret;
HL2_DEBUG("Parse HL position search: (" << elementStart << "," << elementStop << ") in='" << _buffer[elementStart] << "' " << it.getPaternString());
// Stop the search to the end (to get the end of the pattern)
ret = it.find(elementStart, elementStop, resultat, _buffer);
if (ret != HLP_FIND_ERROR) {
_metaData.push_back(resultat);
elementStart = resultat.stop-1;
break;
}
}
// Go to the next element (and search again ...).
elementStart++;
}
}

View File

@@ -19,7 +19,7 @@ namespace appl {
int32_t start;
int32_t stop;
bool notEnded;
appl::HighlightPattern* patern; // pointer on class :
appl::HighlightPattern* patern;
};
};
@@ -44,30 +44,35 @@ 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 hasExtention(const std::string& _ext);
bool isCompatible(const std::string& _name);
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,
etk::Buffer &_buffer);
std::string& _buffer);
void parse2(int64_t _start,
int64_t _stop,
std::vector<appl::HighlightInfo> &_metaData,
etk::Buffer &_buffer);
std::vector<appl::HighlightInfo>& _metaData,
std::string& _buffer);
void parseSubElement(const appl::HighlightInfo& _upper,
std::vector<appl::HighlightInfo>& _metaData,
std::string &_buffer);
private:
void parseRules(exml::Element* _child,
std::vector<std::unique_ptr<HighlightPattern>> &_mListPatern,
int32_t _level);
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<std::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)) )
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...
public: // herited function :
virtual void updateContext() {
// no upfate to do ...

View File

@@ -70,19 +70,19 @@ void appl::highlightManager::unInit() {
hlList.clear();
}
std::string appl::highlightManager::getTypeExtention(const std::string& _extention) {
if (_extention.size() == 0) {
std::string appl::highlightManager::getTypeFile(const std::string& _fileName) {
if (_fileName.size() == 0) {
return "";
}
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
APPL_DEBUG("Try to find type for extention : '" << _fileName << "' 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->hasExtention(_extention) == true) {
APPL_DEBUG("Find type for extention : " << _extention
if (it->isCompatible(_fileName) == true) {
APPL_DEBUG("Find type for extention : " << _fileName
<< " type : " << it->getTypeName());
return it->getTypeName();
}

View File

@@ -27,10 +27,10 @@ namespace appl {
void unInit();
/**
* @brief Un-Init the Highlight manager
* @param[in] extention of the file
* @param[in] _fileName name of the file
* @return type of highlight
*/
std::string getTypeExtention(const std::string& _extention);
std::string getTypeFile(const std::string& _fileName);
/**
* @brief Get filename with type.
* @param[in] _type Type name of the highlight.

View File

@@ -13,30 +13,49 @@
#undef __class__
#define __class__ "HighlightPattern"
appl::HighlightPattern::HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting) :
appl::HighlightPattern::HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting, exml::Element* _child, int32_t _level) :
m_glyphPainting(_glyphPainting),
m_paternName(""),
m_regExp(nullptr),
m_hasParsingError(true),
m_regexValue(""),
m_regExp(),
m_colorName(""),
m_level(0) {
m_regExp = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
parseRules(_child, _level);
}
appl::HighlightPattern::HighlightPattern() :
m_glyphPainting(),
m_paternName(""),
m_hasParsingError(true),
m_regexValue(""),
m_regExp(),
m_colorName(""),
m_level(0) {
}
appl::HighlightPattern::~HighlightPattern() {
}
void appl::HighlightPattern::setPatern(std::string& _regExp) {
if (m_regExp == nullptr) {
return;
void appl::HighlightPattern::setPatern(const std::string& _regExp) {
m_regexValue = _regExp;
APPL_DEBUG("parse regex='" << _regExp << "'");
try {
m_regExp.assign(_regExp, std::regex_constants::optimize | std::regex_constants::ECMAScript);
//m_regExp.assign(_regExp, std::regex_constants::optimize | std::regex_constants::extended);
m_hasParsingError = false;
} catch (std::regex_error e) {
m_hasParsingError = true;
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << _regExp);
}
m_regExp->compile(_regExp);
}
std::string appl::HighlightPattern::getPaternString() {
return m_regExp->getRegExDecorated();
return m_regexValue;
}
void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
void appl::HighlightPattern::setColorGlyph(const std::string& _colorName) {
m_colorName = _colorName;
m_colorId = m_glyphPainting->request(m_colorName);
APPL_VERBOSE("Resuest color name '" << m_colorName << "' => id=" << m_colorId);
@@ -45,7 +64,8 @@ void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
void appl::HighlightPattern::display() {
APPL_INFO("patern : '" << m_paternName << "' level=" << m_level );
APPL_INFO(" == > colorName '" << m_colorName << "'");
APPL_INFO(" == > regExp '" << m_regExp->getRegExp() << "'");
//APPL_INFO(" == > regExp '" << m_regExp.getRegExp() << "'");
APPL_INFO(" == > regex '" << m_regexValue << "'");
}
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
@@ -54,10 +74,11 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
<rule name="my preprocesseur">
<color>preprocesseur</color>
<regex>#</regex>
<sub>namexxx</sub>
</rule>
*/
//--------------------------------------------------------------------------------------------
// process attribute
// process attribute
std::string highLightName = _child->getAttribute("name");
std::string myEdnDataTmp = "???";
if (highLightName.size()!=0) {
@@ -71,8 +92,7 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
std::string myData = xChild->getText();
if (myData.size() != 0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
std::string myEdnData = myData;
setColorGlyph(myEdnData);
setColorGlyph(myData);
}
}
xChild = _child->getNamed("regex");
@@ -80,29 +100,71 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
std::string myData = xChild->getText();
if (myData.size() != 0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
std::string myEdnData = myData;
setPatern(myEdnData);
setPatern(myData);
}
}
xChild = _child->getNamed("sub");
if (nullptr != xChild) {
std::string myData = xChild->getText();
if (myData.size() != 0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
setSubPatternName(myData);
}
}
}
enum resultFind appl::HighlightPattern::find(int32_t _start,
int32_t _stop,
appl::HighlightInfo& _resultat,
etk::Buffer& _buffer) {
int32_t _stop,
appl::HighlightInfo& _resultat,
const std::string& _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 HLP_FIND_ERROR;
}
// when we have only one element:
if (true == m_regExp->processOneElement(_buffer, _start, _stop)) {
_resultat.start = m_regExp->start();
_resultat.stop = m_regExp->stop();
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;
}
std::regex_search(_buffer.begin() + _start, _buffer.begin() + _stop, resultMatch, m_regExp, flags);
if (resultMatch.size() > 0) {
_resultat.start = std::distance(_buffer.begin(), resultMatch[0].first);
_resultat.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) << "'");
TK_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);
TK_DEBUG(" [" << iii << "] " << posStart << " to " << posStop);
}
}
*/
return HLP_FIND_OK;
}
//APPL_DEBUG("NOT find hightlightpatern ...");
return HLP_FIND_ERROR;
}

View File

@@ -14,9 +14,9 @@
class HighlightPattern;
#include <etk/RegExp.h>
#include <appl/GlyphPainting.h>
#include <vector>
#include <regex>
#include <exml/exml.h>
#include <etk/Buffer.h>
@@ -32,27 +32,39 @@ namespace appl {
std::shared_ptr<appl::GlyphPainting> m_glyphPainting;
public:
// Constructeur
HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting);
HighlightPattern();
HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting, exml::Element* _child, int32_t _level);
virtual ~HighlightPattern();
private:
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
public:
void setName(std::string& _name) {
void setName(const std::string& _name) {
m_paternName = _name;
};
std::string getName() {
const std::string& getName() {
return m_paternName;
};
private:
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExp; //!< Start of Regular expression
std::string m_paternSubName; //!< Sub patern name if needed
public:
void setPatern(std::string& _regExp);
void setSubPatternName(const std::string& _name) {
m_paternSubName = _name;
};
const std::string& getSubPatternName() {
return m_paternSubName;
};
private:
bool m_hasParsingError;
std::string m_regexValue;
std::regex m_regExp; //!< Start of Regular expression
public:
void setPatern(const std::string& _regExp);
std::string getPaternString();
private:
std::string m_colorName; //!< Current color name
int32_t m_colorId; //!< Id of the the glyph painting
public:
void setColorGlyph(std::string& _colorName);
void setColorGlyph(const std::string& _colorName);
const appl::GlyphDecoration& getColorGlyph() {
return (*m_glyphPainting)[m_colorId];
};
@@ -82,7 +94,7 @@ namespace appl {
enum resultFind find(int32_t _start,
int32_t _stop,
appl::HighlightInfo& _resultat,
etk::Buffer& _buffer);
const std::string& _buffer);
void parseRules(exml::Element* _child, int32_t _level);
};

View File

@@ -8,6 +8,7 @@
#include <appl/TextPlugin.h>
#include <appl/TextPluginManager.h>
#include <appl/debug.h>
#undef __class__
@@ -21,21 +22,31 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_activateOnWrite(false),
m_activateOnReplace(false),
m_activateOnRemove(false),
m_activateOnReceiveMessage(false),
m_activateOnReceiveShortCut(false),
m_activateOnCursorMove(false) {
addObjectType("appl::TextViewerPlugin");
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");
}
// get a reference on the plugin manager...
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;
}
m_isEnable = false;
onPluginDisable();
onPluginGlobalDisable();
}
void appl::TextViewerPlugin::setEnableStatus(bool _status) {
@@ -44,9 +55,9 @@ void appl::TextViewerPlugin::setEnableStatus(bool _status) {
}
m_isEnable = _status;
if (m_isEnable == true) {
onPluginEnable();
onPluginGlobalEnable();
} else {
onPluginDisable();
onPluginGlobalDisable();
}
}

View File

@@ -13,16 +13,23 @@
#include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h>
#include <ewol/compositing/Text.h>
#include <ewol/widget/Menu.h>
namespace appl {
class textPluginManager;
class TextViewerPlugin : public ewol::Object {
friend class appl::TextViewer;
protected:
std::weak_ptr<appl::textPluginManager> m_pluginManager;
protected:
TextViewerPlugin();
void init();
void init(const std::string& _name);
public:
DECLARE_FACTORY(TextViewerPlugin);
virtual ~TextViewerPlugin();
protected:
std::weak_ptr<ewol::widget::Menu> m_menuInterface;
private:
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
public:
@@ -42,13 +49,13 @@ namespace appl {
/**
* @brief On plugin global enable.
*/
virtual void onPluginEnable() {
virtual void onPluginGlobalEnable() {
// nothing to do here ...
};
/**
* @brief On plugin global disable.
*/
virtual void onPluginDisable() {
virtual void onPluginGlobalDisable() {
// nothing to do here ...
};
/**
@@ -174,23 +181,22 @@ namespace appl {
return false;
};
protected:
bool m_activateOnReceiveMessage; //!< onReceiveMessage is availlable for this plugin.
bool m_activateOnReceiveShortCut; //!< onReceiveShortCut is availlable for this plugin.
public:
/**
* @brief Get the availlability of a callback
* @return true if availlable
*/
bool isAvaillableOnReceiveMessage() {
return m_activateOnReceiveMessage;
bool isAvaillableOnReceiveShortCut() {
return m_activateOnReceiveShortCut;
}
/**
* @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller.
* @param[in] _msg Generic message.
* @param[in] _shortCutName Generic message requested.
* @return true if the event might not propagate anymore
*/
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName) {
return false;
}
protected:

View File

@@ -15,8 +15,13 @@
#define __class__ "TextPluginCopy"
appl::TextPluginCopy::TextPluginCopy() {
m_activateOnReceiveMessage = true;
appl::TextPluginCopy::TextPluginCopy() :
m_menuIdTitle(-1),
m_menuIdCopy(-1),
m_menuIdCut(-1),
m_menuIdPast(-1),
m_menuIdRemove(-1) {
m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginCopy");
}
@@ -26,25 +31,47 @@ void appl::TextPluginCopy::init() {
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event :
_textDrawer.ext_registerMultiCast(ednMsgGuiCopy);
_textDrawer.ext_registerMultiCast(ednMsgGuiPaste);
_textDrawer.ext_registerMultiCast(ednMsgGuiCut);
_textDrawer.ext_shortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
_textDrawer.ext_shortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
_textDrawer.ext_shortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
m_menuIdCopy = menu->add(m_menuIdTitle, "Copy", "", "appl::TextPluginCopy::menu:copy");
m_menuIdCut = menu->add(m_menuIdTitle, "Cut", "", "appl::TextPluginCopy::menu:cut");
m_menuIdPast = menu->add(m_menuIdTitle, "Paste", "", "appl::TextPluginCopy::menu:past");
m_menuIdRemove = menu->add(m_menuIdTitle, "Remove", "", "appl::TextPluginCopy::menu:remove");
}
}
_textDrawer.ext_shortCutAdd("ctrl+x", "appl::TextPluginCopy::cut");
_textDrawer.ext_shortCutAdd("ctrl+c", "appl::TextPluginCopy::copy");
_textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
}
void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ...
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::cut");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::copy");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::Paste");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRemove);
menu->remove(m_menuIdPast);
menu->remove(m_menuIdCut);
menu->remove(m_menuIdCopy);
menu->remove(m_menuIdTitle);
}
m_menuIdTitle = -1;
m_menuIdCopy = -1;
m_menuIdCut = -1;
m_menuIdPast = -1;
m_menuIdRemove = -1;
}
bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
bool appl::TextPluginCopy::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
if (isEnable() == false) {
return false;
}
if ( _msg.getMessage() == ednMsgGuiCopy
|| _msg.getMessage() == ednMsgGuiCut) {
if ( _shortCutName == "appl::TextPluginCopy::copy"
|| _shortCutName == "appl::TextPluginCopy::cut") {
if (_textDrawer.hasBuffer() == true) {
std::string value;
_textDrawer.copy(value);
@@ -52,11 +79,11 @@ bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardStd, value);
}
}
if (_msg.getMessage() == ednMsgGuiCut) {
if (_shortCutName == "appl::TextPluginCopy::cut") {
_textDrawer.remove();
}
return true;
} else if (_msg.getMessage() == ednMsgGuiPaste) {
} else if (_shortCutName == "appl::TextPluginCopy::Paste") {
if (_textDrawer.hasBuffer() == true) {
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd);
}

View File

@@ -17,6 +17,12 @@
namespace appl {
class TextPluginCopy : public appl::TextViewerPlugin {
private:
int32_t m_menuIdTitle;
int32_t m_menuIdCopy;
int32_t m_menuIdCut;
int32_t m_menuIdPast;
int32_t m_menuIdRemove;
protected:
TextPluginCopy();
void init();
@@ -28,7 +34,7 @@ namespace appl {
public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
};
};

View File

@@ -22,7 +22,7 @@ appl::TextPluginCtags::TextPluginCtags() :
m_tagFolderBase(""),
m_tagFilename(""),
m_ctagFile(nullptr) {
m_activateOnReceiveMessage = true;
m_activateOnReceiveShortCut = true;
// load buffer manager:
m_bufferManager = appl::BufferManager::create();
addObjectType("appl::TextPluginCtags");
@@ -37,30 +37,17 @@ appl::TextPluginCtags::~TextPluginCtags() {
}
const char* eventJumpDestination = "event-plugin-ctags-jump-destination";
const char* eventJumpBack = "event-plugin-ctags-jump-back";
const char* eventOpenCtagsFile = "event-plugin-ctags-open";
const char* eventOpenCtagsOpenFileReturn = "event-plugin-ctags-open-file-return";
const char* eventOpenCtagsSelectReturn = "event-plugin-ctags-select-file-return";
void appl::TextPluginCtags::onPluginEnable(appl::TextViewer& _textDrawer) {
// Add local event of this object (no dependency with the viewer ...
/*
registerMultiCast(ednMsgGuiCtags);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgCtagsLoadFile);
*/
// add event :
_textDrawer.ext_registerMultiCast(eventJumpDestination);
_textDrawer.ext_registerMultiCast(eventJumpBack);
_textDrawer.ext_registerMultiCast(eventOpenCtagsFile);
_textDrawer.ext_shortCutAdd("ctrl+d", eventJumpDestination);
_textDrawer.ext_shortCutAdd("ctrl+shift+d", eventJumpBack);
_textDrawer.ext_shortCutAdd("ctrl+alt+d", eventOpenCtagsFile);
_textDrawer.ext_shortCutAdd("ctrl+d", "appl::TextPluginCtags::JumpDestination");
_textDrawer.ext_shortCutAdd("ctrl+shift+d", "appl::TextPluginCtags::JumpBack");
_textDrawer.ext_shortCutAdd("ctrl+alt+d", "appl::TextPluginCtags::OpenCtagsFile");
}
void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ...
_textDrawer.ext_shortCutRm("appl::TextPluginCtags::JumpDestination");
_textDrawer.ext_shortCutRm("appl::TextPluginCtags::JumpBack");
_textDrawer.ext_shortCutRm("appl::TextPluginCtags::OpenCtagsFile");
}
void appl::TextPluginCtags::jumpTo(const std::string& _name) {
@@ -98,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->registerOnEvent(shared_from_this(), applEventctagsSelection, eventOpenCtagsSelectReturn);
tmpWidget->signalSelect.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
}
} else {
jumpFile(myfile.getName(), lineID - 1);
@@ -111,8 +98,8 @@ void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _line
if (m_bufferManager != nullptr) {
m_bufferManager->open(_filename);
}
sendMultiCast(appl::MsgSelectChange, _filename);
sendMultiCast(appl::MsgSelectGotoLineSelect, etk::to_string(_lineId));
//sendMultiCast(appl::MsgSelectGotoLineSelect, etk::to_string(_lineId));
APPL_TODO("request jup at line ...");
}
void appl::TextPluginCtags::loadTagFile() {
@@ -157,29 +144,30 @@ void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
#endif
}
void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg) {
if (_msg.getMessage() == eventOpenCtagsOpenFileReturn) {
// open the new one :
etk::FSNode tmpFilename = _msg.getData();
m_tagFilename = tmpFilename.getNameFile();
m_tagFolderBase = tmpFilename.getNameFolder();
APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
loadTagFile();
} else if (_msg.getMessage() == eventOpenCtagsSelectReturn) {
// parse the input data
char tmp[4096];
int32_t lineID;
// TODO : Review this ...
sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp);
jumpFile(tmp, lineID - 1);
}
void appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn(const std::string& _value) {
// open the new one :
etk::FSNode tmpFilename = _value;
m_tagFilename = tmpFilename.getNameFile();
m_tagFolderBase = tmpFilename.getNameFolder();
APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
loadTagFile();
}
bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
void appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn(const std::string& _value) {
// parse the input data
char tmp[4096];
int32_t lineID;
// TODO : Review this ...
sscanf(_value.c_str(), "%d:%s", &lineID, tmp);
jumpFile(tmp, lineID - 1);
}
bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
if (isEnable() == false) {
return false;
}
if (_msg.getMessage() == eventOpenCtagsFile) {
if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
APPL_INFO("Request opening ctag file");
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (nullptr == tmpWidget) {
@@ -195,9 +183,9 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
tmpWidget->setFolder(path);
}
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(shared_from_this(), "validate", eventOpenCtagsOpenFileReturn);
tmpWidget->signalValidate.bind(shared_from_this(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
return true;
} else if (_msg.getMessage() == eventJumpDestination) {
} else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
if (_textDrawer.hasBuffer() == false) {
return false;
}
@@ -215,7 +203,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
}
jumpTo(textToSearch);
return true;
} else if (_msg.getMessage() == eventJumpBack) {
} else if (_shortCutName == "appl::TextPluginCtags::JumpBack") {
if (_textDrawer.hasBuffer() == false) {
return false;
}

View File

@@ -43,10 +43,11 @@ namespace appl {
public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg);
// internal message :
virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName);
// callback function:
void onCallbackOpenCtagsOpenFileReturn(const std::string& _value);
void onCallbackOpenCtagsSelectReturn(const std::string& _value);
};
};

View File

@@ -25,6 +25,9 @@ namespace appl {
void init() {
appl::TextViewerPlugin::init();
}
void init(const std::string& _name) {
appl::TextViewerPlugin::init(_name);
}
public:
DECLARE_FACTORY(TextViewerPluginData);
virtual ~TextViewerPluginData() {
@@ -38,13 +41,21 @@ namespace appl {
m_specificData.clear();
}
private:
std::vector<std::pair<std::shared_ptr<appl::Buffer> ,TYPE* >> m_specificData;
std::vector<std::pair<std::weak_ptr<appl::Buffer> ,TYPE* >> m_specificData;
protected:
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
if (m_specificData[iii].first == _textDrawer.internalGetBuffer()) {
return m_specificData[iii].second;
auto it = m_specificData.begin();
while(it != m_specificData.end()) {
std::shared_ptr<appl::Buffer> buf = it->first.lock();
if (buf == nullptr) {
delete(it->second);
it->second = nullptr;
it = m_specificData.erase(it);
}
if (buf == _textDrawer.internalGetBuffer()) {
return it->second;
}
++it;
}
TYPE* data = new TYPE();
if (data == nullptr) {
@@ -55,13 +66,13 @@ namespace appl {
return data;
}
protected: // Wrap all element with their internal data: (do not use theses function)
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
TYPE* data = getDataRef(_textDrawer);
if (data == nullptr) {
return false;
}
return onReceiveMessageViewer(_textDrawer, _msg, *data);
return onDataReceiveShortCut(_textDrawer, _shortCutName, *data);
}
bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
@@ -70,7 +81,7 @@ namespace appl {
if (data == nullptr) {
return false;
}
return onWrite(_textDrawer, _pos, _data, *data);
return onDataWrite(_textDrawer, _pos, _data, *data);
}
bool onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
@@ -80,7 +91,7 @@ namespace appl {
if (data == nullptr) {
return false;
}
return onReplace(_textDrawer, _pos, _data, _posEnd, *data);
return onDataReplace(_textDrawer, _pos, _data, _posEnd, *data);
}
bool onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
@@ -89,32 +100,32 @@ namespace appl {
if (data == nullptr) {
return false;
}
return onRemove(_textDrawer, _pos, _posEnd, *data);
return onDataRemove(_textDrawer, _pos, _posEnd, *data);
}
public:
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg,
TYPE& _data) {
virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName,
TYPE& _data) {
return false;
}
virtual bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
TYPE& _data) {
virtual bool onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
TYPE& _data) {
return false;
}
virtual bool onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
const appl::Buffer::Iterator& _posEnd,
TYPE& _data) {
virtual bool onDataReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
const appl::Buffer::Iterator& _posEnd,
TYPE& _data) {
return false;
}
virtual bool onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd,
TYPE& _data) {
virtual bool onDataRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd,
TYPE& _data) {
return false;
}
virtual void remove(TYPE& _data) {

View File

@@ -15,8 +15,11 @@
#undef __class__
#define __class__ "TextPluginHistory"
appl::TextPluginHistory::TextPluginHistory() {
m_activateOnReceiveMessage = true;
appl::TextPluginHistory::TextPluginHistory() :
m_menuIdTitle(-1),
m_menuIdUndo(-1),
m_menuIdRedo(-1) {
m_activateOnReceiveShortCut = true;
m_activateOnWrite = true;
m_activateOnReplace = true;
m_activateOnRemove = true;
@@ -29,24 +32,40 @@ void appl::TextPluginHistory::init() {
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
m_menuIdUndo = menu->add(m_menuIdTitle, "Undo", "THEME:GUI:Undo.edf", "appl::TextPluginHistory::menu:undo");
m_menuIdRedo = menu->add(m_menuIdTitle, "Redo", "THEME:GUI:Redo.edf", "appl::TextPluginHistory::menu:redo");
}
}
// add event :
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo);
_textDrawer.ext_registerMultiCast(ednMsgGuiUndo);
_textDrawer.ext_shortCutAdd("ctrl+z", ednMsgGuiUndo);
_textDrawer.ext_shortCutAdd("ctrl+shift+z", ednMsgGuiRedo);
_textDrawer.ext_shortCutAdd("ctrl+z", "appl::TextPluginHistory::Undo");
_textDrawer.ext_shortCutAdd("ctrl+shift+z", "appl::TextPluginHistory::Redo");
}
void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ...
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Undo");
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Redo");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRedo);
menu->remove(m_menuIdUndo);
menu->remove(m_menuIdTitle);
}
m_menuIdTitle = -1;
m_menuIdUndo = -1;
m_menuIdRedo = -1;
}
bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg,
appl::PluginHistoryData& _data) {
bool appl::TextPluginHistory::onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName,
appl::PluginHistoryData& _data) {
if (isEnable() == false) {
return false;
}
if (_msg.getMessage() == ednMsgGuiRedo) {
if (_shortCutName == "appl::TextPluginHistory::Redo") {
if (_data.m_redo.size() == 0) {
return true;
}
@@ -62,7 +81,7 @@ bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDraw
_textDrawer.position(tmpElement->m_endPosRemoved) );
return true;
} else if (_msg.getMessage() == ednMsgGuiUndo) {
} else if (_shortCutName == "appl::TextPluginHistory::Undo") {
if (_data.m_undo.size() == 0) {
return true;
}
@@ -111,10 +130,10 @@ void appl::TextPluginHistory::clearUndo(appl::PluginHistoryData& _data) {
}
bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
appl::PluginHistoryData& _data) {
bool appl::TextPluginHistory::onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
appl::PluginHistoryData& _data) {
if (isEnable() == false) {
return false;
}
@@ -130,15 +149,18 @@ bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer,
clearRedo(_data);
_data.m_undo.push_back(tmpElement);
}
appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.cursor());
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
return true;
}
bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data) {
bool appl::TextPluginHistory::onDataReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data) {
if (isEnable() == false) {
return false;
}
@@ -155,14 +177,17 @@ bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer,
clearRedo(_data);
_data.m_undo.push_back(tmpElement);
}
appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.cursor());
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
return true;
}
bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data) {
bool appl::TextPluginHistory::onDataRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data) {
if (isEnable() == false) {
return false;
}
@@ -177,7 +202,10 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
_data.m_undo.push_back(tmpElement);
}
_textDrawer.removeDirect();
appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.cursor());
std::shared_ptr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
return true;
}

View File

@@ -36,6 +36,10 @@ namespace appl {
std::vector<History*> m_redo; //!< History storing data
};
class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> {
private:
int32_t m_menuIdTitle;
int32_t m_menuIdUndo;
int32_t m_menuIdRedo;
protected:
TextPluginHistory();
void init();
@@ -46,22 +50,22 @@ namespace appl {
public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg,
appl::PluginHistoryData& _data);
virtual bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
appl::PluginHistoryData& _data);
virtual bool onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data);
virtual bool onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data);
virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName,
appl::PluginHistoryData& _data);
virtual bool onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
appl::PluginHistoryData& _data);
virtual bool onDataReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _strData,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data);
virtual bool onDataRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data);
virtual void remove(appl::PluginHistoryData& _data) {
clearRedo(_data);
clearUndo(_data);

View File

@@ -19,53 +19,11 @@
#undef __class__
#define __class__ "textPluginManager"
static std::list<std::shared_ptr<appl::TextViewerPlugin>>& getList() {
static std::list<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnEventEntry() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnEventInput() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnWrite() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnReplace() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnRemove() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListonReceiveMessageViewer() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnCursorMove() {
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
return s_list;
}
void appl::textPluginManager::init() {
appl::textPluginManager::textPluginManager() {
}
void appl::textPluginManager::unInit() {
// remove all sub plugin class:
getListOnEventEntry().clear();
getListOnEventInput().clear();
getListOnWrite().clear();
getListOnReplace().clear();
getListOnRemove().clear();
getListonReceiveMessageViewer().clear();
getListOnCursorMove().clear();
getList().clear();
void appl::textPluginManager::init(const std::string& _name) {
ewol::Resource::init(_name);
}
void appl::textPluginManager::addDefaultPlugin() {
@@ -82,32 +40,38 @@ void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPl
if (_plugin == nullptr) {
return;
}
getList().push_back(_plugin);
APPL_DEBUG("Add plugin : " << _plugin->getObjectType());
m_list.push_back(_plugin);
if (_plugin->isAvaillableOnEventEntry() == true) {
getListOnEventEntry().push_back(_plugin);
m_listOnEventEntry.push_back(_plugin);
}
if (_plugin->isAvaillableOnEventInput() == true) {
getListOnEventInput().push_back(_plugin);
m_listOnEventInput.push_back(_plugin);
}
if (_plugin->isAvaillableOnWrite() == true) {
getListOnWrite().push_back(_plugin);
m_listOnWrite.push_back(_plugin);
}
if (_plugin->isAvaillableOnReplace() == true) {
getListOnReplace().push_back(_plugin);
m_listOnReplace.push_back(_plugin);
}
if (_plugin->isAvaillableOnRemove() == true) {
getListOnRemove().push_back(_plugin);
m_listOnRemove.push_back(_plugin);
}
if (_plugin->isAvaillableOnReceiveMessage() == true) {
getListonReceiveMessageViewer().push_back(_plugin);
if (_plugin->isAvaillableOnReceiveShortCut() == true) {
m_listOnReceiveShortCutViewer.push_back(_plugin);
}
if (_plugin->isAvaillableOnCursorMove() == true) {
getListOnCursorMove().push_back(_plugin);
m_listOnCursorMove.push_back(_plugin);
}
std::shared_ptr<appl::TextViewer> viewer = m_currentViewer.lock();
if (viewer != nullptr) {
_plugin->onPluginEnable(*viewer);
}
}
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
for (auto &it : getList()) {
m_currentViewer = std::dynamic_pointer_cast<appl::TextViewer>(_widget.shared_from_this());
for (auto &it : m_list) {
if (it == nullptr) {
continue;
}
@@ -116,7 +80,8 @@ void appl::textPluginManager::connect(appl::TextViewer& _widget) {
}
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
for (auto &it : getList()) {
m_currentViewer.reset();
for (auto &it : m_list) {
if (it == nullptr) {
continue;
}
@@ -126,7 +91,7 @@ void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event) {
for (auto &it : getListOnEventEntry()) {
for (auto &it : m_listOnEventEntry) {
if (it == nullptr) {
continue;
}
@@ -139,7 +104,7 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
const ewol::event::Input& _event) {
for (auto &it : getListOnEventInput()) {
for (auto &it : m_listOnEventInput) {
if (it == nullptr) {
continue;
}
@@ -153,7 +118,7 @@ bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _data) {
for (auto &it : getListOnWrite()) {
for (auto &it : m_listOnWrite) {
if (it == nullptr) {
continue;
}
@@ -168,7 +133,7 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _data,
const appl::Buffer::Iterator& _posEnd) {
for (auto &it : getListOnReplace()) {
for (auto &it : m_listOnReplace) {
if (it == nullptr) {
continue;
}
@@ -182,7 +147,7 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd) {
for (auto &it : getListOnRemove()) {
for (auto &it : m_listOnRemove) {
if (it == nullptr) {
continue;
}
@@ -193,13 +158,13 @@ bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
return false;
}
bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
for (auto &it : getListonReceiveMessageViewer()) {
bool appl::textPluginManager::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
for (auto &it : m_listOnReceiveShortCutViewer) {
if (it == nullptr) {
continue;
}
if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) {
if (it->onReceiveShortCut(_textDrawer, _shortCutName) == true ) {
return true;
}
}
@@ -208,7 +173,7 @@ bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDraw
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos) {
for (auto &it : getListOnCursorMove()) {
for (auto &it : m_listOnCursorMove) {
if (it == nullptr) {
continue;
}

View File

@@ -16,98 +16,106 @@
#include <appl/TextPlugin.h>
namespace appl {
namespace textPluginManager {
/**
* @brief Init the plugin manager for writer.
*/
void init();
/**
* @brief UnInit the plugin manager for writer.
*/
void unInit();
/**
* @brief Add default plugin list
*/
void addDefaultPlugin();
/**
* @brief Add a plugin.
* @param[in] _plugin Plugin pointer to add.
*/
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.
*/
void connect(appl::TextViewer& _widget);
/**
* @brief dis-connect a new widget to the plugin.
* @param[in] _widget Reference on the widget caller.
*/
void disconnect(appl::TextViewer& _widget);
/**
* @brief On entry event call.
* @param[in] _widget Reference on the widget caller.
* @param[in] _event Generic event.
* @return true if the event might not propagate anymore.
*/
bool onEventEntry(appl::TextViewer& _widget,
const ewol::event::Entry& _event);
/**
* @brief On Input event call.
* @param[in] _widget Reference on the widget caller.
* @param[in] _event Generic event.
* @return true if the event might not propagate anymore
*/
bool onEventInput(appl::TextViewer& _textDrawer,
const ewol::event::Input& _event);
/**
* @brief Called when data is written in the buffer.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _data Input stream written.
* @return true if the event might not propagate anymore
*/
bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _data);
/**
* @brief Called when data is written in the buffer, and some are removed.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _data Input stream written.
* @param[in] _posEnd end replace position.
* @return true if the event might not propagate anymore
*/
bool onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _data,
const appl::Buffer::Iterator& _posEnd);
/**
* @brief Called when data is removed.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _posEnd end replace position.
* @return true if the event might not propagate anymore
*/
bool onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd);
/**
* @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller.
* @param[in] _msg Generic message.
* @return true if the event might not propagate anymore
*/
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg);
/**
* @brief Called when Cursor move of position.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos New cursor position.
* @return true if the event might not propagate anymore
*/
bool onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos);
class textPluginManager : public ewol::Resource {
private:
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);
public:
DECLARE_RESOURCE_SINGLE_FACTORY(textPluginManager, "plugin-Manager");
virtual ~textPluginManager() {};
/**
* @brief Add default plugin list
*/
void addDefaultPlugin();
/**
* @brief Add a plugin.
* @param[in] _plugin Plugin pointer to add.
*/
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.
*/
void connect(appl::TextViewer& _widget);
/**
* @brief dis-connect a new widget to the plugin.
* @param[in] _widget Reference on the widget caller.
*/
void disconnect(appl::TextViewer& _widget);
/**
* @brief On entry event call.
* @param[in] _widget Reference on the widget caller.
* @param[in] _event Generic event.
* @return true if the event might not propagate anymore.
*/
bool onEventEntry(appl::TextViewer& _widget,
const ewol::event::Entry& _event);
/**
* @brief On Input event call.
* @param[in] _widget Reference on the widget caller.
* @param[in] _event Generic event.
* @return true if the event might not propagate anymore
*/
bool onEventInput(appl::TextViewer& _textDrawer,
const ewol::event::Input& _event);
/**
* @brief Called when data is written in the buffer.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _data Input stream written.
* @return true if the event might not propagate anymore
*/
bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _data);
/**
* @brief Called when data is written in the buffer, and some are removed.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _data Input stream written.
* @param[in] _posEnd end replace position.
* @return true if the event might not propagate anymore
*/
bool onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const std::string& _data,
const appl::Buffer::Iterator& _posEnd);
/**
* @brief Called when data is removed.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _posEnd end replace position.
* @return true if the event might not propagate anymore
*/
bool onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd);
/**
* @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller.
* @param[in] _shortCutName shortcut properties.
* @return true if the event might not propagate anymore
*/
bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName);
/**
* @brief Called when Cursor move of position.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos New cursor position.
* @return true if the event might not propagate anymore
*/
bool onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos);
};
};

View File

@@ -16,7 +16,7 @@
appl::TextPluginRmLine::TextPluginRmLine() {
m_activateOnReceiveMessage = true;
m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginRmLine");
}
@@ -26,20 +26,19 @@ void appl::TextPluginRmLine::init() {
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event :
_textDrawer.ext_registerMultiCast(ednMsgGuiRm);
_textDrawer.ext_shortCutAdd("ctrl+w", ednMsgGuiRm);
_textDrawer.ext_shortCutAdd("ctrl+w", "appl::TextPluginRmLine::Rm");
}
void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ...
_textDrawer.ext_shortCutRm("appl::TextPluginRmLine::Rm");
}
bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
bool appl::TextPluginRmLine::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
if (isEnable() == false) {
return false;
}
if (_msg.getMessage() == ednMsgGuiRm) {
if (_shortCutName == "appl::TextPluginRmLine::Rm") {
if (_textDrawer.hasBuffer() == false) {
return false;
}

View File

@@ -28,7 +28,7 @@ namespace appl {
public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
};
};

View File

@@ -15,8 +15,11 @@
#define __class__ "TextPluginSelectAll"
appl::TextPluginSelectAll::TextPluginSelectAll() {
m_activateOnReceiveMessage = true;
appl::TextPluginSelectAll::TextPluginSelectAll() :
m_menuIdTitle(-1),
m_menuIdSelectAll(-1),
m_menuIdSelectNone(-1) {
m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginSelectAll");
}
@@ -24,29 +27,53 @@ void appl::TextPluginSelectAll::init() {
appl::TextViewerPlugin::init();
}
static const char* eventSelectAll = "plugin-select-all";
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
m_menuIdSelectAll = menu->add(m_menuIdTitle, "Select All","", "appl::TextPluginSelectAll::menu:select-all");
m_menuIdSelectNone = menu->add(m_menuIdTitle, "Un-Select","", "appl::TextPluginSelectAll::menu:select-none");
}
}
// add event :
_textDrawer.ext_registerMultiCast(eventSelectAll);
_textDrawer.ext_shortCutAdd("ctrl+a", eventSelectAll);
_textDrawer.ext_shortCutAdd("ctrl+a", "appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutAdd("ctrl+shift+a", "appl::TextPluginSelectAll::None");
}
void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ...
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::None");
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdSelectNone);
menu->remove(m_menuIdSelectAll);
menu->remove(m_menuIdTitle);
}
m_menuIdTitle = -1;
m_menuIdSelectAll = -1;
m_menuIdSelectNone = -1;
}
bool appl::TextPluginSelectAll::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) {
bool appl::TextPluginSelectAll::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
if (isEnable() == false) {
return false;
}
if (_msg.getMessage() == eventSelectAll) {
if (_shortCutName == "appl::TextPluginSelectAll::All") {
if (_textDrawer.hasBuffer() == false) {
return false;
}
_textDrawer.select(_textDrawer.begin(), _textDrawer.end());
return true;
}
if (_shortCutName == "appl::TextPluginSelectAll::None") {
if (_textDrawer.hasBuffer() == false) {
return false;
}
_textDrawer.unSelect();
return true;
}
return false;
}

View File

@@ -20,6 +20,9 @@ namespace appl {
protected:
TextPluginSelectAll();
void init();
int32_t m_menuIdTitle;
int32_t m_menuIdSelectAll;
int32_t m_menuIdSelectNone;
public:
DECLARE_FACTORY(TextPluginSelectAll);
virtual ~TextPluginSelectAll() {
@@ -28,7 +31,7 @@ namespace appl {
public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
};
};

View File

@@ -31,64 +31,6 @@ class myParamGlobal : public ewol::Object {
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
setName("edn_global_param");
}
/*
bool onSetConfig(const ewol::object::Config& _conf) {
// Not set the EObject node parameter (name == > not change ...)
if (_conf.getConfig() == configEOL) {
m_displayEOL = etk::string_to_bool(_conf.getData());
return true;
}
if (_conf.getConfig() == configAutoIndent) {
m_AutoIndent = etk::string_to_bool(_conf.getData());
return true;
}
if (_conf.getConfig() == configShowTabChar) {
m_displayTabChar = etk::string_to_bool(_conf.getData());
return true;
}
if (_conf.getConfig() == configShowSpaceChar) {
m_displaySpaceChar = etk::string_to_bool(_conf.getData());
return true;
}
return false;
}
bool onGetConfig(const char* _config, std::string& _result) const {
// Not set the EObject node parameter (name == > not change ...)
if (_config == configEOL) {
if (true == m_displayEOL) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configAutoIndent) {
if (true == m_AutoIndent) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configShowTabChar) {
if (true == m_displayTabChar) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configShowSpaceChar) {
if (true == m_displaySpaceChar) {
_result = "true";
} else {
_result = "false";
}
return true;
}
return false;
}
*/
};
@@ -161,11 +103,6 @@ int32_t globals::getNbLineBorder() {
#include <ewol/widget/CheckBox.h>
#include <ewol/widget/Spacer.h>
static const char * const l_changeIndentation = "edn-event-change-indentation";
static const char * const l_changeSpace = "edn-event-change-spaces";
static const char * const l_changeTabulation = "edn-event-change-tabulation";
static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
static const char * const l_changeRounded = "edn-event-change-rounded";
globals::ParameterGlobalsGui::ParameterGlobalsGui() {
addObjectType("globals::ParameterGlobalsGui");
@@ -189,7 +126,7 @@ void globals::ParameterGlobalsGui::init() {
} else {
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetAutoIndent());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeIndentation);
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create("Display space char (' ')");
@@ -198,7 +135,7 @@ void globals::ParameterGlobalsGui::init() {
} else {
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplaySpaceChar());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeSpace);
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackSpace);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create("Display tabulation char ('\\t')");
@@ -207,7 +144,7 @@ void globals::ParameterGlobalsGui::init() {
} else {
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayTabChar());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeTabulation);
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create("Display end of line ('\\n')");
@@ -216,7 +153,7 @@ void globals::ParameterGlobalsGui::init() {
} else {
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeEndOfLine);
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create("switch Rounded/default");
@@ -225,7 +162,7 @@ void globals::ParameterGlobalsGui::init() {
} else {
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeRounded);
myCheckbox->signalValue.bind(shared_from_this(), &globals::ParameterGlobalsGui::onCallbackRounded);
subWidgetAdd(myCheckbox);
}
}
@@ -235,43 +172,28 @@ globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
}
void globals::ParameterGlobalsGui::onReceiveMessage(const ewol::object::Message& _msg) {
ewol::widget::Sizer::onReceiveMessage(_msg);
if (_msg.getMessage() == l_changeEndOfLine) {
if (_msg.getData() == "true") {
setDisplayEndOfLine(true);
} else {
setDisplayEndOfLine(false);
}
} else if (_msg.getMessage() == l_changeIndentation) {
if (_msg.getData() == "true") {
setAutoIndent(true);
} else {
setAutoIndent(false);
}
} else if (_msg.getMessage() == l_changeSpace) {
if (_msg.getData() == "true") {
setDisplaySpaceChar(true);
} else {
setDisplaySpaceChar(false);
}
} else if (_msg.getMessage() == l_changeTabulation) {
if (_msg.getData() == "true") {
setDisplayTabChar(true);
} else {
setDisplayTabChar(false);
}
} else if (_msg.getMessage() == l_changeRounded) {
if (_msg.getData() == "true") {
etk::theme::setName("GUI", "rounded");;
} else {
etk::theme::setName("GUI", "default");;
}
// Reload shaders and graphic system ...
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
}
void globals::ParameterGlobalsGui::onCallbackEndOfLine(const bool& _value) {
setDisplayEndOfLine(_value);
}
void globals::ParameterGlobalsGui::onCallbackIndentation(const bool& _value) {
setAutoIndent(_value);
}
void globals::ParameterGlobalsGui::onCallbackSpace(const bool& _value) {
setDisplaySpaceChar(_value);
}
void globals::ParameterGlobalsGui::onCallbackTabulation(const bool& _value) {
setDisplayTabChar(_value);
}
void globals::ParameterGlobalsGui::onCallbackRounded(const bool& _value) {
if (_value == true) {
etk::theme::setName("GUI", "rounded");;
} else {
etk::theme::setName("GUI", "default");;
}
// Reload shaders and graphic system ...
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
}

View File

@@ -43,8 +43,11 @@ namespace globals
public:
DECLARE_FACTORY(ParameterGlobalsGui);
virtual ~ParameterGlobalsGui();
// herited function
virtual void onReceiveMessage(const ewol::object::Message& _msg);
void onCallbackEndOfLine(const bool& _value);
void onCallbackIndentation(const bool& _value);
void onCallbackSpace(const bool& _value);
void onCallbackTabulation(const bool& _value);
void onCallbackRounded(const bool& _value);
};
}

View File

@@ -1,66 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#include <appl/globalMsg.h>
////////////////////////////////////////////////////////////////////////
// Event of the gui request something :
////////////////////////////////////////////////////////////////////////
extern const char* const ednMsgGuiNew = "edn-Msg-Gui-New";
extern const char* const ednMsgGuiOpen = "edn-Msg-Gui-Open";
extern const char* const ednMsgGuiClose = "edn-Msg-Gui-Close";
extern const char* const ednMsgGuiSave = "edn-Msg-Gui-Save";
extern const char* const ednMsgGuiSaveAs = "edn-Msg-Gui-SaveAs";
extern const char* const ednMsgProperties = "edn-Msg-Gui-Properties";
extern const char* const ednMsgGuiExit = "edn-Msg-Gui-quit";
extern const char* const ednMsgGuiUndo = "edn-Msg-Gui-Undo";
extern const char* const ednMsgGuiRedo = "edn-Msg-Gui-Redo";
extern const char* const ednMsgGuiCopy = "edn-Msg-Gui-Copy";
extern const char* const ednMsgGuiCut = "edn-Msg-Gui-Cut";
extern const char* const ednMsgGuiPaste = "edn-Msg-Gui-Paste";
extern const char* const ednMsgGuiRm = "edn-Msg-Gui-Rm";
extern const char* const ednMsgGuiSelect = "edn-Msg-Gui-Select";
extern const char* const ednMsgGuiGotoLine = "edn-Msg-Gui-GotoLine";
extern const char* const ednMsgGuiSearch = "edn-Msg-Gui-Search";
extern const char* const ednMsgGuiReplace = "edn-Msg-Gui-Replace";
extern const char* const ednMsgGuiFind = "edn-Msg-Gui-Find";
extern const char* const ednMsgGuiShowSpaces = "edn-Msg-Gui-ShowSpaces";
extern const char* const ednMsgGuiShowEndOfLine = "edn-Msg-Gui-ShowEndOfLine";
extern const char* const ednMsgGuiCtags = "edn-Msg-Gui-CTags";
extern const char* const ednMsgCtagsLoadFile = "edn-Msg-CTags-direct-load";
extern const char* const ednMsgGuiReloadShader = "edn-Msg-Gui-ReloadOpenGlShader";
////////////////////////////////////////////////////////////////////////
// Event internal :
////////////////////////////////////////////////////////////////////////
extern const char* const ednMsgBufferState = "edn-Msg-Buffer-State";
extern const char* const ednMsgBufferName = "edn-Msg-Buffer-Name";
extern const char* const ednMsgBufferId = "edn-Msg-Buffer-Id";
extern const char* const ednMsgCodeViewSelectedId = "edn-Msg-CodeView-Select-Id";
extern const char* const ednMsgOpenFile = "edn-Msg-OpenFile";
extern const char* const ednMsgBufferListChange = "edn-Msg-BufferListChange";
extern const char* const ednMsgBufferColor = "edn-Msg-Buffer-Color";
extern const char* const appl::MsgSelectNewFile = "edn-msg-select-new-file";
extern const char* const appl::MsgSelectChange = "edn-msg-select-change";
extern const char* const appl::MsgNameChange = "edn-msg-buffer-name-change";
extern const char* const appl::MsgNameGuiChangeColor = "edn-Msg-Gui-Change-color";
extern const char* const appl::MsgSelectGotoLine = "edn-Msg-Gui-goto-line";
extern const char* const appl::MsgSelectGotoLineSelect = "edn-Msg-Gui-goto-line-select";

View File

@@ -1,68 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __MSG_BROADCAST_H__
#define __MSG_BROADCAST_H__
////////////////////////////////////////////////////////////////////////
// Event of the gui request something :
////////////////////////////////////////////////////////////////////////
extern const char* const ednMsgGuiNew; // data : ""
extern const char* const ednMsgGuiOpen; // data : ""
extern const char* const ednMsgGuiClose; // data : "current" "All"
extern const char* const ednMsgGuiSave; // data : ""
extern const char* const ednMsgGuiSaveAs; // data : ""
extern const char* const ednMsgProperties; // data : ""
extern const char* const ednMsgGuiExit; // data : ""
extern const char* const ednMsgGuiUndo; // data : ""
extern const char* const ednMsgGuiRedo; // data : ""
extern const char* const ednMsgGuiCopy; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiCut; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiPaste; // data : "STD" "Middle" "1" ... "9"
extern const char* const ednMsgGuiRm; // data : "Word" "Line" "Paragraph"
extern const char* const ednMsgGuiSelect; // data : "ALL" "NONE"
extern const char* const ednMsgGuiGotoLine; // data : "???" / "1" ... "999999999999"
extern const char* const ednMsgGuiSearch; // data : ""
extern const char* const ednMsgGuiReplace; // data : "Normal" "All"
extern const char* const ednMsgGuiFind; // data : "Next" "Previous" "All" "None"
extern const char* const ednMsgGuiShowSpaces; // data : "enable" "disable"
extern const char* const ednMsgGuiShowEndOfLine; // data : "enable" "disable"
extern const char* const ednMsgGuiCtags; // data : "Load" "ReLoad" "Jump" "Back"
extern const char* const ednMsgCtagsLoadFile; // data : "filename of the ctags file"
extern const char* const ednMsgGuiReloadShader; // data : ""
////////////////////////////////////////////////////////////////////////
// Event internal :
////////////////////////////////////////////////////////////////////////
extern const char* const ednMsgBufferState; // data : "Saved" "Modify" "HasHistory" "HasNotHistory" "HasFutureHistory" "HasNotFutureHistory"
extern const char* const ednMsgBufferName; // data : "filename"
extern const char* const ednMsgBufferId; // data : "0" ... "99999999999"
extern const char* const ednMsgCodeViewSelectedId; // data : "0" ... "99999999999"
extern const char* const ednMsgOpenFile; // data : "/Compleate/file/name.xx"
extern const char* const ednMsgBufferListChange; // data : ""
extern const char* const ednMsgBufferColor; // data : "new"
namespace appl {
extern const char* const MsgSelectNewFile; // data : "buffer/name"
extern const char* const MsgSelectChange; // data : ""
extern const char* const MsgNameChange; // data : ""
extern const char* const MsgNameGuiChangeColor; // data : "Black" "White"
extern const char* const MsgSelectGotoLine; // data : "75822"
extern const char* const MsgSelectGotoLineSelect; // data : "75822"
};
#endif

View File

@@ -32,6 +32,7 @@
class MainApplication : public ewol::context::Application {
private:
std::shared_ptr<appl::BufferManager> m_bufferManager;
std::shared_ptr<appl::textPluginManager> m_pluginManager;
public:
bool init(ewol::Context& _context, size_t _initId) {
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
@@ -58,10 +59,9 @@ class MainApplication : public ewol::context::Application {
// init ALL Singleton :
//()CTagsManager::getInstance();
m_bufferManager = appl::BufferManager::create();
m_pluginManager = appl::textPluginManager::create();
appl::highlightManager::init();
appl::textPluginManager::init();
appl::textPluginManager::addDefaultPlugin();
// Request load of the user configuration ...
//ewol::userConfig::load();
@@ -84,6 +84,8 @@ class MainApplication : public ewol::context::Application {
// create the specific windows
_context.setWindows(basicWindows);
// need to add default plugin, because they depend on the Menu widget wich might be named : "appl-menu-interface"
m_pluginManager->addDefaultPlugin();
// add files
APPL_INFO("show list of files : ");
@@ -97,7 +99,7 @@ class MainApplication : public ewol::context::Application {
std::string name = file.getName();
APPL_INFO("Load ctag file : \"" << name << "\"" );
ctagDetected = false;
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
//_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
} else {
etk::FSNode file(tmpppp);
std::string name = file.getName();
@@ -111,10 +113,10 @@ class MainApplication : public ewol::context::Application {
}
void unInit(ewol::Context& _context) {
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
appl::textPluginManager::unInit();
APPL_INFO("Stop Hightlight");
appl::highlightManager::unInit();
//Kill all singleton
m_pluginManager.reset();
m_bufferManager.reset();
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
}

View File

@@ -102,9 +102,12 @@ def create(target):
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>"])

View File

@@ -1 +1 @@
1.2.1
1.2.3

1
sources/tagCode Normal file
View File

@@ -0,0 +1 @@
7

52
test/CMakeLists.txt Normal file
View File

@@ -0,0 +1,52 @@
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})

0
test/Makefile Normal file
View File

0
test/asm.asm Normal file
View File

0
test/bash.bash Normal file
View File

0
test/boo.boo Normal file
View File

164
test/cpp.cpp Normal file
View File

@@ -0,0 +1,164 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD 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

0
test/html.html Normal file
View File

0
test/in.in Normal file
View File

0
test/java.java Normal file
View File

0
test/lua.lua Normal file
View File

0
test/matlab.m Normal file
View File

62
test/php.php Normal file
View File

@@ -0,0 +1,62 @@
<?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;
}
?>

44
test/python.py Normal file
View File

@@ -0,0 +1,44 @@
#!/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 ...

52
test/vertexShader.frag Normal file
View File

@@ -0,0 +1,52 @@
/**
* 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
}

12
test/xml.xml Normal file
View File

@@ -0,0 +1,12 @@
<?declaration attr="plop"?>
<node>
<node2 attribute="da\"ta string">
<emptyNode/>
<!-- comment -->
direct data
<!-- multiline comment
<inCommentNode/>
-->
<![CDATA[ raw data ]]>
</node2>
<node>