Merge branch 'dev'
Conflicts: sources/tag
This commit is contained in:
commit
8c3c3daf5c
@ -1,14 +1,27 @@
|
||||
[Desktop Entry]
|
||||
Version=0.3.0
|
||||
Name=Edn : Editeur de N'ours
|
||||
Exec=edn
|
||||
Icon=Edn
|
||||
Exec=edn %U
|
||||
Icon=/usr/share/edn/icon.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Development;Utility;TextEditor;
|
||||
Categories=Development;
|
||||
GenericName=Text editor
|
||||
GenericName[en]=Text editor
|
||||
GenericName[nl]=Tekst verwerker
|
||||
GenericName[fr]=éditeur de text
|
||||
GenericName[fr]=Éditeur de text
|
||||
Comment=Code editor for c, c++, php, bash, xml ...
|
||||
Comment[fr]=éditeur de text pour les language c, c++, php, bash, xml ...
|
||||
OnlyShowIn=GNOME;Unity;
|
||||
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
|
||||
StartupNotify=true
|
||||
Actions=New;
|
||||
|
||||
[Desktop Action New]
|
||||
Name=Open a New Window
|
||||
Name[fr]=Ouvrir une nouvelle fenêtre
|
||||
Name[nl]=Nieuw venster openen
|
||||
Name[en]=Open a New Window
|
||||
Exec=edn
|
||||
|
||||
#desktop-file-validate edn.desktop
|
||||
#sudo cp xxx /usr/share/applications/
|
@ -6,52 +6,41 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment multiline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>/\*\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>/\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my if 0">
|
||||
<color>preprocesseur</color>
|
||||
<start>#[ \t]*if 0</start>
|
||||
<end>#endif|#else</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#[ \t]*if 0.*#(regexif|else)</regex>
|
||||
</rule>
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#.*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>//!</start>
|
||||
<end>\n</end>
|
||||
<regex>//!.*$</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>//[ \t]*TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>(//|@)</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<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>
|
||||
<start>\@smull|ldrsh|smlal|stmdb|mul|mla|umull|ldr|add|str|mov|subs|bgt|ldmia|stmia|ldmfd|cmp|sub|strd|stmfd|bne|bhi|ldrd|mvn\@</start>
|
||||
<regex>\@smull|ldrsh|smlal|stmdb|mul|mla|umull|ldr|add|str|mov|subs|bgt|ldmia|stmia|ldmfd|cmp|sub|strd|stmfd|bne|bhi|ldrd|mvn\@</regex>
|
||||
</rule>
|
||||
<rule name="register list">
|
||||
<color>type</color>
|
||||
<start>\@r(10|11|12|[0-9]?)|sp|lp|lr|pc\@</start>
|
||||
<regex>\@r(10|11|12|[0-9]?)|sp|lp|lr|pc\@</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,45 +4,37 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="first line">
|
||||
<color>commentDoxygen</color>
|
||||
<start>#!</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#!(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="comment line">
|
||||
<color>comment</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<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>
|
||||
<start>\@for|done|do|while|in|if|elif|then|else|fi\@</start>
|
||||
<regex>\@for|done|do|while|in|if|elif|then|else|fi\@</regex>
|
||||
</rule>
|
||||
<rule name="my Variable">
|
||||
<color>keyword</color>
|
||||
<start>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</start>
|
||||
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>function (\w|_)+[ \t]*\(</start>
|
||||
<regex>function (\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,57 +4,50 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="comment ##">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>##</start>
|
||||
<end>\n</end>
|
||||
<regex>##.*$</regex>
|
||||
</rule>
|
||||
<rule name="comment #">
|
||||
<color>comment</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<regex>#.*$</regex>
|
||||
</rule>
|
||||
<rule name="notes ... ">
|
||||
<color>preprocesseur</color>
|
||||
<start>(NOTE|TODO) : </start>
|
||||
<end>\n</end>
|
||||
<regex>(NOTE|TODO) : .*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>\@'</start>
|
||||
<end>'</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<regex>\@'(\\[\\']|.)*$</regex>
|
||||
</rule>
|
||||
</pass1>
|
||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||
|
||||
<rule name="pourcentage OK">
|
||||
<color>TestResultOK</color>
|
||||
<start>100%</start>
|
||||
<regex>100%</regex>
|
||||
</rule>
|
||||
<rule name="pourcentage">
|
||||
<color>number</color>
|
||||
<start>[0-9]*%</start>
|
||||
<regex>[0-9]*%</regex>
|
||||
</rule>
|
||||
<rule name="Résultat OK">
|
||||
<color>TestResultOK</color>
|
||||
<start>\[( )*(OK|Ok|ok)( )*\]</start>
|
||||
<regex>\[( )*(OK|Ok|ok)( )*\]</regex>
|
||||
</rule>
|
||||
<rule name="resultat en erreur">
|
||||
<color>TestResultERROR</color>
|
||||
<start>\[(ERREUR|Erreur|erreur)\]</start>
|
||||
<regex>\[(ERREUR|Erreur|erreur)\]</regex>
|
||||
</rule>
|
||||
<rule name="resultat vide">
|
||||
<color>number</color>
|
||||
<start>\[( )*\]</start>
|
||||
<regex>\[( )*\]</regex>
|
||||
</rule>
|
||||
<rule name="notes ... ">
|
||||
<color>macro</color>
|
||||
<start>==></start>
|
||||
<regex>==></regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -2,135 +2,116 @@
|
||||
<EdnLang version="0.1" lang="C/C++">
|
||||
<ext>*.c</ext>
|
||||
<ext>*.cpp</ext>
|
||||
<ext>*.cxx</ext>
|
||||
<ext>*.cc</ext>
|
||||
<ext>*.h</ext>
|
||||
<ext>*.hpp</ext>
|
||||
<ext>*.hxx</ext>
|
||||
<ext>*.m</ext>
|
||||
<ext>*.mm</ext>
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment multiline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>/\*\*</start>
|
||||
<end>\*/</end>
|
||||
<rule name="macro">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_]{4,500}\@</start>
|
||||
</rule>
|
||||
<rule name="keyword">
|
||||
<color>keyword</color>
|
||||
<start>@\w*[ \t]*(\[(in|out| |,)*\])?[ \t]*([a-zA-Z0-9\-_]*)</start>
|
||||
<underColor idPThese="1"></underColor><!-- (\[(in|out| |,)*\]) -->
|
||||
<underColor idPThese="3"></underColor><!-- (([a-zA-Z0-9\-_])*) -->
|
||||
</rule>
|
||||
<regex>/\*\*.*(\*/|\e)</regex>
|
||||
</rule>
|
||||
<rule name="code Review">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>/\*[ \t]*TODO :</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*[ \t]*TODO :.*(\*/|\e)</regex>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>/\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*.*(\*/|\e)</regex>
|
||||
</rule>
|
||||
<rule name="my if 0">
|
||||
<color>preprocesseur</color>
|
||||
<start>#[ \t]*if 0</start>
|
||||
<end>#endif|#else</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#[ \t]*if 0.*#(endif|else)</regex>
|
||||
</rule>
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>//!</start>
|
||||
<end>\n</end>
|
||||
<regex>//!.*$</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>//[ \t]*TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//[ \t]*TODO[ \t]*:.*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>//</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//.*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<regex>'((\\[\\'])|.){1,2}'</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteTextError">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>'</regex>
|
||||
</rule>
|
||||
</pass1>
|
||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||
<rule name="my keyword">
|
||||
<color>keyword</color>
|
||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
|
||||
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
|
||||
</rule>
|
||||
<rule name="my function keyword">
|
||||
<color>systemFunction</color>
|
||||
<start>\@new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</start>
|
||||
<regex>\@new|delete|try|catch|memset|fopen|fread|fwrite|fgets|fclose|printf|(f|s|diag_)printf|calloc|malloc|realloc|(cyg|sup)_([a-z]|[A-Z]|[0-9]|_)+\@</regex>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@bool|BOOL|char(16_t|32_t)?|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128)\@</start>
|
||||
<regex>\@bool|BOOL|char(16_t|32_t)?|double|float|u?int(8|16|32|64|128)?(_t)?|long|short|signed|size_t|unsigned|void|(I|U)(8|16|32|64|128)\@</regex>
|
||||
</rule>
|
||||
<rule name="std type">
|
||||
<color>type</color>
|
||||
<start>\@std::(vector|(u16|u32|w)?string|codecvt_utf(16|8_utf16|8)+|complex|iterator(_traits)?|tuple(_element|_size)?|pair)\@</start>
|
||||
<regex>\@std::(vector|(u16|u32|w)?string|codecvt_utf(16|8_utf16|8)+|complex|iterator(_traits)?|tuple(_element|_size)?|pair)\@</regex>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<start>\@inline|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum\@</start>
|
||||
<regex>\@inline|const|class|virtual|private|public|protected|friend|const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum\@</regex>
|
||||
</rule>
|
||||
<rule name="my common Define">
|
||||
<color>commonDefine</color>
|
||||
<start>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</start>
|
||||
<regex>\@NULL|MAX|MIN|__LINE__|__DATA__|__FILE__|__func__|__TIME__|__STDC__\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|TRUE|false|FALSE\@</start>
|
||||
<regex>\@true|TRUE|false|FALSE\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="CPP member">
|
||||
<color>memberClass</color>
|
||||
<start>\@m_[A-Za-z_0-9]*\@</start>
|
||||
<regex>\@m_[A-Za-z_0-9]*\@</regex>
|
||||
</rule>
|
||||
<rule name="function input">
|
||||
<color>inputFunction</color>
|
||||
<start>\@_[A-Za-z_0-9]*\@</start>
|
||||
<regex>\@_[A-Za-z_0-9]*\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
<!-- With all elementes :
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>([A-Z]|_){4,500}</start>
|
||||
<regex>([A-Z]|_){4,500}</regex>
|
||||
<elemSubColor id="1">doxElem</elemSubColor>
|
||||
</rule>
|
||||
-->
|
||||
|
@ -5,53 +5,45 @@
|
||||
<pass1>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>##</start>
|
||||
<end>\n</end>
|
||||
<regex>##.*$</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>#[ \t]TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#[ \t]TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<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>
|
||||
<start>\@foreach|message|endforeach|if|else|endif|list|file|string\@</start>
|
||||
<regex>\@foreach|message|endforeach|if|else|endif|list|file|string\@</regex>
|
||||
</rule>
|
||||
<rule name="my function keyword">
|
||||
<color>systemFunction</color>
|
||||
<start>\@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\@</start>
|
||||
<regex>\@set|include_directories|add_definitions|add_library|include_directories|target_link_libraries|project|include|check_include_file|enable_testing|option|cmake_minimum_required|add_definitions|check_include_file|configure_file|include_directories|add_custom_command|add_executable|add_test\@</regex>
|
||||
</rule>
|
||||
<rule name="Variable">
|
||||
<color>inputFunction</color>
|
||||
<start>${</start>
|
||||
<end>}</end>
|
||||
<regex>\${.*}</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
|
||||
</pass2>
|
||||
|
@ -7,76 +7,65 @@
|
||||
<pass1>
|
||||
<rule name="my comment multiline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>/\*\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>/\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my if 0">
|
||||
<color>preprocesseur</color>
|
||||
<start>#[ \t]*if 0</start>
|
||||
<end>#endif|#else</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#[ \t]*if 0(\\[\\\n]|.)*#(endif|else)</regex>
|
||||
</rule>
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>//!</start>
|
||||
<end>\n</end>
|
||||
<regex>//!(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>//[ \t]*TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>//</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<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>
|
||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
|
||||
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</regex>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@void|bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</start>
|
||||
<regex>\@void|bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</regex>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<start>\@varying|uniform|attribute|precision|mediump\@</start>
|
||||
<regex>\@varying|uniform|attribute|precision|mediump\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</start>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,43 +4,37 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<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>
|
||||
<start>\@menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config\@</start>
|
||||
<regex>\@menu|endmenu|comment|if|endif|help|default|choice|endchoice|prompt|depends on|config\@</regex>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@int|hex|bool|string\@</start>
|
||||
<regex>\@int|hex|bool|string\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,84 +4,73 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment multiline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>/\*\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>/\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>//!</start>
|
||||
<end>\n</end>
|
||||
<regex>//!(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>//[ \t]*TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>//</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<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>
|
||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for\@</start>
|
||||
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for\@</regex>
|
||||
</rule>
|
||||
<rule name="my function keyword">
|
||||
<color>systemFunction</color>
|
||||
<start>\@new|try|catch|print\@</start>
|
||||
<regex>\@new|try|catch|print\@</regex>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum\@</start>
|
||||
<regex>\@boolean|byte|char|double|float|int|long|short|String|Object|Thread|void|enum\@</regex>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<start>\@import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface@</start>
|
||||
<regex>\@import|package|extends|Override|implements|const|class|abstract|private|public|protected|final|const|static|transiant|volatile|interface@</regex>
|
||||
</rule>
|
||||
<rule name="my common Define">
|
||||
<color>commonDefine</color>
|
||||
<start>\@null\@</start>
|
||||
<regex>\@null\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</start>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,31 +4,29 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<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>
|
||||
<start>\{|\}|\[|\]</start>
|
||||
<regex>\{|\}|\[|\]</regex>
|
||||
</rule>
|
||||
<rule name="separator">
|
||||
<color>error</color>
|
||||
<start>:|,</start>
|
||||
<regex>:|,</regex>
|
||||
</rule>
|
||||
<rule name="names">
|
||||
<color>functionName</color>
|
||||
<start>([a-zA-Z0-9]|-|_)*</start>
|
||||
<regex>([a-zA-Z0-9]|-|_)*</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</start>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,57 +4,49 @@
|
||||
<pass1>
|
||||
<rule name="Comment multiline">
|
||||
<color>comment</color>
|
||||
<start>\-\-\[\[</start>
|
||||
<end>\-\-\]\]</end>
|
||||
<regex>\-\-\[\[.*\-\-\]\]</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>\-\-[ \t]*TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>\-\-[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>\-\-</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>\-\-(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<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>
|
||||
<start>\@and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while\@</start>
|
||||
<regex>\@and|break|do|else|elseif|end|for|function|if|in|local|nil|not|or|repeat|return|then|until|while\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</start>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|~=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|~=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -6,38 +6,33 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<regex>'(\\[\\']|.)*'</regex>
|
||||
</rule>
|
||||
</pass1>
|
||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||
<rule name="confition">
|
||||
<color>type</color>
|
||||
<start>\@if|ifeq|ifneq|else|endif|define|endef\@</start>
|
||||
<regex>\@if|ifeq|ifneq|else|endif|define|endef\@</regex>
|
||||
</rule>
|
||||
<rule name="my keyword">
|
||||
<color>keyword</color>
|
||||
<start>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</start>
|
||||
<regex>\$\([a-zA-Z_][a-zA-Z0-9_]*\)</regex>
|
||||
</rule>
|
||||
<rule name="function call">
|
||||
<color>functionName</color>
|
||||
<start>\$\((call|info|error|warning|shell|patsubst|lastword|wildcard|addprefix|foreach|subst|word|eval)</start>
|
||||
<regex>\$\((call|info|error|warning|shell|patsubst|lastword|wildcard|addprefix|foreach|subst|word|eval)</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>:=|?=|!=|=</start>
|
||||
<regex>:=|?=|!=|=</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -5,58 +5,49 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>%%</start>
|
||||
<end>\n</end>
|
||||
<regex>%%(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>%</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>%(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start> "</start>
|
||||
<end>("|\n)</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex> ".*($|")</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start> '</start>
|
||||
<end>('|\n)</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<regex> '.*($|')</regex>
|
||||
</rule>
|
||||
<rule name="global inclusion">
|
||||
<color>preprocesseur</color>
|
||||
<start>global( |\t)+</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<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>
|
||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</start>
|
||||
<regex>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|otherwise|end\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</start>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -7,70 +7,61 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>/\*</start>
|
||||
<end>\*/</end>
|
||||
<regex>/\*.*\*/</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>//[ \t]*TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//[ \t]*TODO[ \t]*:(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment inline">
|
||||
<color>comment</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>//</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>//(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<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>
|
||||
<start>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</start>
|
||||
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</start>
|
||||
<regex>\@array|bool|boolean|double|float|int|integer|numeric|object|resource|string|unset\@</regex>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<start>\@abstract|and|as|break|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|interface|isset|list|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor\@</start>
|
||||
<regex>\@abstract|and|as|break|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|interface|isset|list|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor\@</regex>
|
||||
</rule>
|
||||
<rule name="my common Define">
|
||||
<color>commonDefine</color>
|
||||
<start>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</start>
|
||||
<regex>\@doubleval|floatval|gettype|intval|print_r|serialize|settype|strval|unserialize|var_dump|var_export\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|TRUE|false|FALSE\@</start>
|
||||
<regex>\@true|TRUE|false|FALSE\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<|>|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<|>|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -4,73 +4,70 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>"""</start>
|
||||
<end>"""</end>
|
||||
<regex>""".*"""</regex>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<regex>'''.*'''</regex>
|
||||
</rule>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>##</start>
|
||||
<end>\n</end>
|
||||
<regex>##(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>#(\\[\\\n]|.)*$</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>'</start>
|
||||
<end>'</end>
|
||||
<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>
|
||||
<start>\@if|else|elif|break|pass|continue|while|do|for|in|return\@</start>
|
||||
<regex>\@if|else|elif|break|pass|continue|while|do|for|in|return\@</regex>
|
||||
</rule>
|
||||
<rule name="my function keyword">
|
||||
<color>systemFunction</color>
|
||||
<start>\@print|len|range|del|__init__|self|os\.|sys\.|path\.\@</start>
|
||||
<regex>\@print|len|range|del|__init__|self|os\.|sys\.|path\.\@</regex>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@bool|BOOL|char|double|float\@</start>
|
||||
<regex>\@bool|BOOL|char|double|float\@</regex>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<start>\@def|class|import|from|as|try|except\@</start>
|
||||
<regex>\@def|class|import|from|as|try|except\@</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@True|False\@</start>
|
||||
<regex>\@True|False\@</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
</rule>
|
||||
<!-- With all elementes : -->
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>([A-Z]|_){4,500}</start>
|
||||
<regex>([A-Z]|_){4,500}</regex>
|
||||
<elemSubColor id="1">doxElem</elemSubColor>
|
||||
</rule>
|
||||
</pass2>
|
||||
|
@ -5,30 +5,33 @@
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="Comment">
|
||||
<color>comment</color>
|
||||
<start><!\-\-</start>
|
||||
<end>\-\-></end>
|
||||
<regex><![CDATA[<!\-\-.*\-\->]]></regex>
|
||||
<!--<regex><!\-\-.*\-\-></regex>-->
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>\@'</start>
|
||||
<end>('|\n)</end>
|
||||
<!--<EscapeChar>\</EscapeChar>-->
|
||||
<regex>\@'.*('|\n)</regex>
|
||||
</rule>
|
||||
</pass1>
|
||||
<pass2>
|
||||
<rule name="special Balise">
|
||||
<color>error</color>
|
||||
<start><\?\w*|\?></start>
|
||||
<regex><\?\w*|\?></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>
|
||||
<start></[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+|/>|></start>
|
||||
<!--<regex></[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+|/>|></regex>-->
|
||||
<regex><![CDATA[(</[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+)\@]]></regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/stdTools.h>
|
||||
#include <appl/Buffer.h>
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/context/clipBoard.h>
|
||||
@ -27,7 +28,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
|
||||
m_current = 0;
|
||||
return *this;
|
||||
}
|
||||
if (m_data != NULL) {
|
||||
if (m_data != nullptr) {
|
||||
if (m_current < m_data->m_data.size() ) {
|
||||
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
|
||||
if (nbChar != 0) {
|
||||
@ -45,7 +46,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
|
||||
|
||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- () {
|
||||
m_value = u32char::Null;
|
||||
if (m_data != NULL) {
|
||||
if (m_data != nullptr) {
|
||||
if (m_current > 0) {
|
||||
int32_t iii = -1;
|
||||
while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false
|
||||
@ -68,7 +69,7 @@ char32_t appl::Buffer::Iterator::operator* () {
|
||||
if (m_value != u32char::Null) {
|
||||
return m_value;
|
||||
}
|
||||
if (m_data == NULL) {
|
||||
if (m_data == nullptr) {
|
||||
APPL_ERROR("request an element that iterator not link");
|
||||
return m_value;
|
||||
}
|
||||
@ -127,10 +128,10 @@ appl::Buffer::Buffer() :
|
||||
m_cursorSelectPos(-1),
|
||||
m_cursorPreferredCol(-1),
|
||||
m_nbLines(1),
|
||||
m_highlight(NULL) {
|
||||
m_highlight(nullptr) {
|
||||
addObjectType("appl::Buffer");
|
||||
static int32_t bufferBaseId = 0;
|
||||
m_fileName = "No Name " + std::to_string(bufferBaseId);
|
||||
m_fileName = "No Name " + etk::to_string(bufferBaseId);
|
||||
bufferBaseId++;
|
||||
addEventId(eventIsModify);
|
||||
addEventId(eventIsSave);
|
||||
@ -138,6 +139,10 @@ appl::Buffer::Buffer() :
|
||||
addEventId(eventChangeName);
|
||||
}
|
||||
|
||||
void appl::Buffer::init() {
|
||||
ewol::Object::init();
|
||||
}
|
||||
|
||||
appl::Buffer::~Buffer() {
|
||||
|
||||
}
|
||||
@ -698,13 +703,13 @@ void appl::Buffer::setHighlightType(const std::string& _type) {
|
||||
return;
|
||||
}
|
||||
m_highlightType = _type;
|
||||
m_highlight = appl::Highlight::keep(resourceName);
|
||||
m_highlight = appl::Highlight::create(resourceName);
|
||||
generateHighLightAt(0, m_data.size());
|
||||
}
|
||||
|
||||
void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) {
|
||||
// prevent ERROR...
|
||||
if (NULL == m_highlight) {
|
||||
if (nullptr == m_highlight) {
|
||||
return;
|
||||
}
|
||||
// prevent No data Call
|
||||
@ -761,10 +766,8 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
}
|
||||
for (auto it(m_HLDataPass1.begin()+elemStart); it != m_HLDataPass1.end(); ++it) {
|
||||
//APPL_DEBUG("move element=" << i);
|
||||
it->beginStart += _nbAdded - _nbDeleted;
|
||||
it->beginStop += _nbAdded - _nbDeleted;
|
||||
it->endStart += _nbAdded - _nbDeleted;
|
||||
it->endStop += _nbAdded - _nbDeleted;
|
||||
it->start += _nbAdded - _nbDeleted;
|
||||
it->stop += _nbAdded - _nbDeleted;
|
||||
}
|
||||
//Regenerate Element inside range
|
||||
if ( startId == -1
|
||||
@ -773,13 +776,13 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
generateHighLightAt(0, m_data.size());
|
||||
} else if(-1 == startId) {
|
||||
//APPL_DEBUG("******* Regenerate START");
|
||||
generateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
|
||||
generateHighLightAt(0, m_HLDataPass1[0].start, 0);
|
||||
} else if(-1 == stopId) {
|
||||
//APPL_DEBUG("******* Regenerate STOP");
|
||||
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.size(), m_HLDataPass1.size());
|
||||
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].stop, m_data.size(), m_HLDataPass1.size());
|
||||
} else {
|
||||
//APPL_DEBUG("******* Regenerate RANGE");
|
||||
generateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
|
||||
generateHighLightAt(m_HLDataPass1[startId].stop, m_HLDataPass1[startId+1].start, startId+1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -828,7 +831,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
||||
S=-1 *************** E
|
||||
*/
|
||||
for (size_t iii = 0; iii < m_HLDataPass1.size(); ++iii) {
|
||||
if (m_HLDataPass1[iii].endStop > _startPos) {
|
||||
if (m_HLDataPass1[iii].stop > _startPos) {
|
||||
break;
|
||||
}
|
||||
_startId = iii;
|
||||
@ -849,7 +852,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
||||
elemStart = _startId+1;
|
||||
}
|
||||
for (size_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
|
||||
if (m_HLDataPass1[iii].beginStart > _endPos) {
|
||||
if (m_HLDataPass1[iii].start > _endPos) {
|
||||
_stopId = iii;
|
||||
break;
|
||||
}
|
||||
@ -857,7 +860,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
||||
}
|
||||
|
||||
void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
|
||||
if (NULL == m_highlight) {
|
||||
if (nullptr == m_highlight) {
|
||||
return;
|
||||
}
|
||||
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
|
||||
@ -871,25 +874,25 @@ void appl::Buffer::cleanHighLight() {
|
||||
|
||||
|
||||
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
|
||||
int32_t start = etk_max(0, _starPos-1);
|
||||
int32_t start = std::max((int64_t)0, _starPos-1);
|
||||
for (size_t iii = start; iii < m_HLDataPass1.size(); ++iii) {
|
||||
_starPos = iii;
|
||||
if ( m_HLDataPass1[iii].beginStart <= _pos
|
||||
&& m_HLDataPass1[iii].endStop > _pos) {
|
||||
if ( m_HLDataPass1[iii].start <= _pos
|
||||
&& m_HLDataPass1[iii].stop > _pos) {
|
||||
return &m_HLDataPass1[iii];
|
||||
}
|
||||
if(m_HLDataPass1[iii].beginStart > _pos) {
|
||||
return NULL;
|
||||
if(m_HLDataPass1[iii].start > _pos) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) {
|
||||
_MData.posHLPass1 = 0;
|
||||
_MData.posHLPass2 = 0;
|
||||
if (NULL == m_highlight) {
|
||||
if (nullptr == m_highlight) {
|
||||
return;
|
||||
}
|
||||
//int64_t timeStart = ewol::getTime();
|
||||
@ -909,24 +912,24 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
||||
endSearch = m_HLDataPass1.size();
|
||||
}
|
||||
int64_t kkk;
|
||||
for (kkk = etk_max(startId, 0); kkk < endSearch; ++kkk) {
|
||||
for (kkk = std::max(startId, (int64_t)0); kkk < endSearch; ++kkk) {
|
||||
// empty section :
|
||||
if (kkk == 0) {
|
||||
if (HLStartPos < m_HLDataPass1[kkk].beginStart) {
|
||||
if (HLStartPos < m_HLDataPass1[kkk].start) {
|
||||
APPL_VERBOSE(" == > (empty section 1 ) kkk=" << kkk <<
|
||||
" start=" << HLStartPos <<
|
||||
" stop=" << m_HLDataPass1[kkk].beginStart );
|
||||
" stop=" << m_HLDataPass1[kkk].start );
|
||||
m_highlight->parse2(HLStartPos,
|
||||
m_HLDataPass1[kkk].beginStart,
|
||||
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].endStop <<
|
||||
" stop=" << m_HLDataPass1[kkk].beginStart );
|
||||
m_highlight->parse2(m_HLDataPass1[kkk-1].endStop,
|
||||
m_HLDataPass1[kkk].beginStart,
|
||||
" 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);
|
||||
}
|
||||
@ -938,9 +941,9 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
||||
//if( k < (int32_t)m_HLDataPass1.size()) {
|
||||
if (m_HLDataPass1.size() != 0) {
|
||||
APPL_VERBOSE(" == > (empty section 3 ) kkk=" << kkk <<
|
||||
" start=" << m_HLDataPass1[kkk-1].endStop <<
|
||||
" start=" << m_HLDataPass1[kkk-1].stop <<
|
||||
" stop=" << HLStop );
|
||||
m_highlight->parse2(m_HLDataPass1[kkk-1].endStop,
|
||||
m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
|
||||
HLStop,
|
||||
_MData.HLData,
|
||||
m_data);
|
||||
@ -961,15 +964,15 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
||||
|
||||
|
||||
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos) {
|
||||
int64_t start = etk_max(0, _MData.posHLPass2-1);
|
||||
int64_t start = std::max((int64_t)0, _MData.posHLPass2-1);
|
||||
for (int64_t iii=start; iii<(int32_t)_MData.HLData.size(); iii++) {
|
||||
_MData.posHLPass2 = iii;
|
||||
if( _MData.HLData[iii].beginStart <= _pos
|
||||
&& _MData.HLData[iii].endStop > _pos)
|
||||
if( _MData.HLData[iii].start <= _pos
|
||||
&& _MData.HLData[iii].stop > _pos)
|
||||
{
|
||||
return &_MData.HLData[iii];
|
||||
}
|
||||
if(_MData.HLData[iii].beginStart > _pos) {
|
||||
if(_MData.HLData[iii].start > _pos) {
|
||||
return getElementColorAtPosition(_pos, _MData.posHLPass1);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace appl {
|
||||
*/
|
||||
Iterator():
|
||||
m_current(0),
|
||||
m_data(NULL),
|
||||
m_data(nullptr),
|
||||
m_value(u32char::Null) {
|
||||
// nothing to do ...
|
||||
};
|
||||
@ -70,7 +70,7 @@ namespace appl {
|
||||
*/
|
||||
virtual ~Iterator() {
|
||||
m_current = 0;
|
||||
m_data = NULL;
|
||||
m_data = nullptr;
|
||||
m_value = u32char::Null;
|
||||
};
|
||||
/**
|
||||
@ -78,7 +78,7 @@ namespace appl {
|
||||
* @return true if the element is present in buffer
|
||||
*/
|
||||
operator bool () const {
|
||||
if (m_data == NULL) {
|
||||
if (m_data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (m_current >= m_data->m_data.size()) {
|
||||
@ -94,7 +94,7 @@ namespace appl {
|
||||
* @return true if the element is present in buffer
|
||||
*/
|
||||
operator int64_t () const {
|
||||
if (m_data == NULL) {
|
||||
if (m_data == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (m_current < 0) {
|
||||
@ -217,7 +217,7 @@ namespace appl {
|
||||
* @return The requested position.
|
||||
*/
|
||||
int64_t getPos() const {
|
||||
if (m_data == NULL) {
|
||||
if (m_data == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (m_current < 0) {
|
||||
@ -292,8 +292,11 @@ namespace appl {
|
||||
static const char* const eventIsSave;
|
||||
static const char* const eventSelectChange;
|
||||
static const char* const eventChangeName;
|
||||
public:
|
||||
protected:
|
||||
Buffer();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(Buffer);
|
||||
virtual ~Buffer();
|
||||
private:
|
||||
bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ...
|
||||
@ -381,14 +384,14 @@ namespace appl {
|
||||
* @return position of the start selection.
|
||||
*/
|
||||
int64_t getStartSelectionPos() {
|
||||
return etk_min(m_cursorPos, m_cursorSelectPos);
|
||||
return std::min(m_cursorPos, m_cursorSelectPos);
|
||||
}
|
||||
/**
|
||||
* @brief Get the Stop position of the selection.
|
||||
* @return position of the stop selection.
|
||||
*/
|
||||
int64_t getStopSelectionPos() {
|
||||
return etk_max(m_cursorPos, m_cursorSelectPos);
|
||||
return std::max(m_cursorPos, m_cursorSelectPos);
|
||||
}
|
||||
protected:
|
||||
float m_cursorPreferredCol; //!< position of the cursor when up and down is done.
|
||||
@ -588,7 +591,7 @@ namespace appl {
|
||||
protected:
|
||||
std::string m_highlightType; //!< Name of the highlight type
|
||||
|
||||
ewol::object::Shared<appl::Highlight> m_highlight; //!< internal link with the Highlight system
|
||||
std::shared_ptr<appl::Highlight> m_highlight; //!< internal link with the Highlight system
|
||||
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
||||
public:
|
||||
/**
|
||||
|
@ -18,32 +18,34 @@
|
||||
#undef __class__
|
||||
#define __class__ "BufferManager"
|
||||
|
||||
appl::BufferManager::BufferManager() :
|
||||
ewol::Resource("???BufferManager???"),
|
||||
m_bufferSelected(NULL) {
|
||||
appl::BufferManager::BufferManager() {
|
||||
addObjectType("appl::BufferManager");
|
||||
}
|
||||
|
||||
void appl::BufferManager::init(const std::string& _uniqueName) {
|
||||
ewol::Resource::init(_uniqueName);
|
||||
}
|
||||
|
||||
appl::BufferManager::~BufferManager() {
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
|
||||
ewol::object::Shared<appl::Buffer> appl::BufferManager::createNewBuffer() {
|
||||
ewol::object::Shared<appl::Buffer> tmp = ewol::object::makeShared(new appl::Buffer());
|
||||
if (tmp == NULL) {
|
||||
std::shared_ptr<appl::Buffer> appl::BufferManager::createNewBuffer() {
|
||||
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
|
||||
if (tmp == nullptr) {
|
||||
APPL_ERROR("Can not allocate the Buffer (empty).");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
m_list.push_back(tmp);
|
||||
sendMultiCast(appl::MsgSelectNewFile, tmp->getFileName());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ewol::object::Shared<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
|
||||
std::shared_ptr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
|
||||
APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")");
|
||||
for (auto &it : m_list) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->getFileName() == _fileName) {
|
||||
@ -54,39 +56,25 @@ ewol::object::Shared<appl::Buffer> appl::BufferManager::get(const std::string& _
|
||||
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) {
|
||||
APPL_WARNING("try open a folder : " << _fileName);
|
||||
APPL_CRITICAL("plop");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> tmp = ewol::object::makeShared(new appl::Buffer());
|
||||
if (tmp == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmp = appl::Buffer::create();
|
||||
if (tmp == nullptr) {
|
||||
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
tmp->loadFile(_fileName);
|
||||
m_list.push_back(tmp);
|
||||
return tmp;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
void appl::BufferManager::setBufferSelected(ewol::object::Shared<appl::Buffer> _bufferSelected) {
|
||||
void appl::BufferManager::setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected) {
|
||||
m_bufferSelected = _bufferSelected;
|
||||
sendMultiCast(appl::MsgSelectChange, "");
|
||||
}
|
||||
|
||||
void appl::BufferManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::Resource::onObjectRemove(_object);
|
||||
if (m_bufferSelected == _object) {
|
||||
setBufferSelected(NULL);
|
||||
}
|
||||
for (auto it(m_list.begin()); it!=m_list.end(); ++it) {
|
||||
if (*it != _object) {
|
||||
continue;
|
||||
}
|
||||
m_list.erase(it);
|
||||
it = m_list.begin();
|
||||
}
|
||||
}
|
||||
|
||||
ewol::object::Shared<appl::Buffer> appl::BufferManager::get(int32_t _id) {
|
||||
std::shared_ptr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
|
||||
int32_t id = 0;
|
||||
for (auto &it : m_list) {
|
||||
if (id == _id) {
|
||||
@ -113,7 +101,7 @@ void appl::BufferManager::open(const std::string& _fileName) {
|
||||
if (exist(_fileName) == true) {
|
||||
return;
|
||||
}
|
||||
if (get(_fileName, true) == NULL) {
|
||||
if (get(_fileName, true) == nullptr) {
|
||||
return;
|
||||
}
|
||||
sendMultiCast(appl::MsgSelectNewFile, _fileName);
|
||||
@ -123,19 +111,3 @@ void appl::BufferManager::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_DEBUG("receive message !!! " << _msg);
|
||||
}
|
||||
|
||||
ewol::object::Shared<appl::BufferManager> appl::BufferManager::keep() {
|
||||
ewol::object::Shared<appl::BufferManager> object = ewol::dynamic_pointer_cast<appl::BufferManager>(getManager().localKeep("???BufferManager???"));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
// this element create a new one every time ....
|
||||
EWOL_INFO("CREATE : appl::BufferManager: ???BufferManager???");
|
||||
object = ewol::object::makeShared(new appl::BufferManager());
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ???BufferManager???");
|
||||
return NULL;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,14 @@
|
||||
|
||||
namespace appl {
|
||||
class BufferManager : public ewol::Resource {
|
||||
protected:
|
||||
BufferManager();
|
||||
public:
|
||||
BufferManager();
|
||||
void init(const std::string& _uniqueName);
|
||||
public:
|
||||
DECLARE_RESOURCE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
|
||||
virtual ~BufferManager();
|
||||
private:
|
||||
std::list<ewol::object::Owner<appl::Buffer>> m_list; // list of all buffer curently open
|
||||
std::list<std::shared_ptr<appl::Buffer>> m_list; // list of all buffer curently open
|
||||
public:
|
||||
/**
|
||||
* @brief Get a specific buffer with his name (can create a new buffer).
|
||||
@ -30,7 +32,7 @@ namespace appl {
|
||||
* @param[in] _createIfNeeded Create the buffer if not existed.
|
||||
* @return a pointer on the buffer
|
||||
*/
|
||||
ewol::object::Shared<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
|
||||
std::shared_ptr<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
|
||||
/**
|
||||
* @brief Load a specific file, event if it not existed:
|
||||
* @param[in] _fileName Name of the file to open or create.
|
||||
@ -54,38 +56,29 @@ namespace appl {
|
||||
* @param[in] _id Number of buffer
|
||||
* @return pointer on the buffer
|
||||
*/
|
||||
ewol::object::Shared<appl::Buffer> get(int32_t _id);
|
||||
std::shared_ptr<appl::Buffer> get(int32_t _id);
|
||||
/**
|
||||
* @brief Create a new buffer empty.
|
||||
* @return Created buffer or NULL.
|
||||
* @return Created buffer or nullptr.
|
||||
*/
|
||||
ewol::object::Shared<appl::Buffer> createNewBuffer();
|
||||
std::shared_ptr<appl::Buffer> createNewBuffer();
|
||||
private:
|
||||
ewol::object::Shared<appl::Buffer> m_bufferSelected;
|
||||
std::shared_ptr<appl::Buffer> m_bufferSelected;
|
||||
public:
|
||||
/**
|
||||
* @brief Set the current buffer selected
|
||||
* @param[in] _bufferSelected Pointer on the buffer selected
|
||||
*/
|
||||
void setBufferSelected(ewol::object::Shared<appl::Buffer> _bufferSelected);
|
||||
void setBufferSelected(std::shared_ptr<appl::Buffer> _bufferSelected);
|
||||
/**
|
||||
* @brief Get the current buffer selected
|
||||
* @return Pointer on the buffer selected
|
||||
*/
|
||||
ewol::object::Shared<appl::Buffer> getBufferSelected() {
|
||||
std::shared_ptr<appl::Buffer> getBufferSelected() {
|
||||
return m_bufferSelected;
|
||||
};
|
||||
public: // herited function
|
||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
public: // resource manager
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
* @note Never free this pointer by your own...
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or NULL if an error occured.
|
||||
*/
|
||||
static ewol::object::Shared<appl::BufferManager> keep();
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -18,9 +18,12 @@
|
||||
|
||||
|
||||
|
||||
appl::GlyphPainting::GlyphPainting(const std::string& _filename) :
|
||||
ewol::Resource(_filename) {
|
||||
appl::GlyphPainting::GlyphPainting() {
|
||||
addObjectType("appl::GlyphPainting");
|
||||
}
|
||||
|
||||
void appl::GlyphPainting::init(const std::string& _filename) {
|
||||
ewol::Resource::init(_filename);
|
||||
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
|
||||
reload();
|
||||
}
|
||||
@ -43,13 +46,13 @@ void appl::GlyphPainting::reload() {
|
||||
APPL_DEBUG(tmppppp);
|
||||
*/
|
||||
ejson::Array* baseArray = doc.getArray("ednColor");
|
||||
if (baseArray == NULL) {
|
||||
if (baseArray == nullptr) {
|
||||
APPL_ERROR("Can not get basic array : 'ednColor'");
|
||||
return;
|
||||
}
|
||||
for (size_t iii = 0; iii < baseArray->size(); ++iii) {
|
||||
ejson::Object* tmpObj = baseArray->getObject(iii);
|
||||
if (tmpObj == NULL) {
|
||||
if (tmpObj == nullptr) {
|
||||
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
|
||||
continue;
|
||||
}
|
||||
@ -94,20 +97,3 @@ int32_t appl::GlyphPainting::request(const std::string& _name) {
|
||||
m_list.push_back(tmpDeco);
|
||||
return m_list.size()-1;
|
||||
}
|
||||
|
||||
ewol::object::Shared<appl::GlyphPainting> appl::GlyphPainting::keep(const std::string& _filename) {
|
||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
||||
ewol::object::Shared<appl::GlyphPainting> object = ewol::dynamic_pointer_cast<appl::GlyphPainting>(getManager().localKeep(_filename));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
// this element create a new one every time ....
|
||||
EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\"");
|
||||
object = ewol::object::makeShared(new appl::GlyphPainting(_filename));
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ??GlyphPainting??");
|
||||
return NULL;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -19,8 +19,10 @@ namespace appl {
|
||||
private:
|
||||
std::vector<appl::GlyphDecoration> m_list;
|
||||
protected:
|
||||
GlyphPainting(const std::string& _filename);
|
||||
GlyphPainting();
|
||||
void init(const std::string& _filename);
|
||||
public:
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(GlyphPainting);
|
||||
virtual ~GlyphPainting();
|
||||
public:
|
||||
/**
|
||||
@ -49,14 +51,6 @@ namespace appl {
|
||||
const appl::GlyphDecoration& operator[] (int32_t _pos) const {
|
||||
return m_list[_pos];
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
* @note Never free this pointer by your own...
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or NULL if an error occured.
|
||||
*/
|
||||
static ewol::object::Shared<appl::GlyphPainting> keep(const std::string& _filename);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -21,13 +21,13 @@ 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 (NULL == tmpList[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] == NULL) {
|
||||
if (_list[jjj] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
|
||||
@ -43,18 +43,12 @@ BufferView::BufferView() :
|
||||
m_openOrderMode(false) {
|
||||
addObjectType("appl::BufferView");
|
||||
setCanHaveFocus(true);
|
||||
registerMultiCast(ednMsgBufferListChange);
|
||||
registerMultiCast(ednMsgBufferState);
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(appl::MsgSelectNewFile);
|
||||
registerMultiCast(appl::MsgSelectChange);
|
||||
registerMultiCast(appl::MsgNameChange);
|
||||
m_selectedID = -1;
|
||||
m_selectedIdRequested = -1;
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
// load color properties
|
||||
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:bufferList.json");
|
||||
m_paintingProperties = appl::GlyphPainting::create("THEME:COLOR:bufferList.json");
|
||||
// get all id properties ...
|
||||
m_colorBackground1 = m_paintingProperties->request("backgroung1");
|
||||
m_colorBackground2 = m_paintingProperties->request("backgroung2");
|
||||
@ -63,6 +57,16 @@ BufferView::BufferView() :
|
||||
m_colorTextModify = m_paintingProperties->request("textModify");
|
||||
}
|
||||
|
||||
void BufferView::init() {
|
||||
ewol::widget::List::init();
|
||||
registerMultiCast(ednMsgBufferListChange);
|
||||
registerMultiCast(ednMsgBufferState);
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(appl::MsgSelectNewFile);
|
||||
registerMultiCast(appl::MsgSelectChange);
|
||||
registerMultiCast(appl::MsgNameChange);
|
||||
}
|
||||
|
||||
BufferView::~BufferView() {
|
||||
removeAllElement();
|
||||
}
|
||||
@ -70,30 +74,30 @@ BufferView::~BufferView() {
|
||||
void BufferView::removeAllElement() {
|
||||
for(auto &it : m_list) {
|
||||
delete(it);
|
||||
it = NULL;
|
||||
it = nullptr;
|
||||
}
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) {
|
||||
if (_dataStruct == NULL) {
|
||||
if (_dataStruct == nullptr) {
|
||||
return;
|
||||
}
|
||||
// alphabetical order:
|
||||
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
||||
if (m_list[iii] == NULL) {
|
||||
if (m_list[iii] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (std::tolower(m_list[iii]->m_bufferName.getNameFile()) > std::tolower(_dataStruct->m_bufferName.getNameFile())) {
|
||||
if (etk::tolower(m_list[iii]->m_bufferName.getNameFile()) > etk::tolower(_dataStruct->m_bufferName.getNameFile())) {
|
||||
m_list.insert(m_list.begin() + iii, _dataStruct);
|
||||
_dataStruct = NULL;
|
||||
_dataStruct = nullptr;
|
||||
if (_selectNewPosition == true) {
|
||||
m_selectedID = iii;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_dataStruct != NULL) {
|
||||
if (_dataStruct != nullptr) {
|
||||
m_list.push_back(_dataStruct);
|
||||
if (_selectNewPosition == true) {
|
||||
m_selectedID = m_list.size()-1;
|
||||
@ -103,18 +107,19 @@ void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _sel
|
||||
|
||||
|
||||
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_VERBOSE("message : " << _msg);
|
||||
ewol::widget::List::onReceiveMessage(_msg);
|
||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||
ewol::object::Shared<appl::Buffer> buffer = m_bufferManager->get(_msg.getData());
|
||||
if (buffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> buffer = m_bufferManager->get(_msg.getData());
|
||||
if (buffer == nullptr) {
|
||||
APPL_ERROR("event on element nor exist : " << _msg.getData());
|
||||
return;
|
||||
}
|
||||
buffer->registerOnEvent(this, appl::Buffer::eventIsSave);
|
||||
buffer->registerOnEvent(this, appl::Buffer::eventIsModify);
|
||||
buffer->registerOnEvent(this, appl::Buffer::eventChangeName);
|
||||
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 == NULL) {
|
||||
if (tmp == nullptr) {
|
||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||
return;
|
||||
}
|
||||
@ -128,7 +133,7 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
if (_msg.getMessage() == appl::Buffer::eventChangeName) {
|
||||
for (size_t iii = 0; iii < m_list.size(); ++iii) {
|
||||
if (m_list[iii] == NULL) {
|
||||
if (m_list[iii] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) {
|
||||
@ -136,7 +141,7 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
if (m_openOrderMode == false) {
|
||||
// re-order the fine in the correct position
|
||||
appl::dataBufferStruct* tmp = m_list[iii];
|
||||
m_list[iii] = NULL;
|
||||
m_list[iii] = nullptr;
|
||||
m_list.erase(m_list.begin() + iii);
|
||||
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
|
||||
break;
|
||||
@ -154,16 +159,15 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
APPL_DEBUG("message : " << _msg);
|
||||
if (_msg.getMessage() == appl::MsgSelectChange) {
|
||||
m_selectedID = -1;
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer;
|
||||
if (m_bufferManager != NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer;
|
||||
if (m_bufferManager != nullptr) {
|
||||
tmpBuffer = m_bufferManager->getBufferSelected();
|
||||
}
|
||||
if (tmpBuffer != NULL) {
|
||||
if (tmpBuffer != nullptr) {
|
||||
for (size_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (m_list[iii] == NULL) {
|
||||
if (m_list[iii] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (m_list[iii]->m_buffer != tmpBuffer) {
|
||||
@ -185,11 +189,11 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
/*
|
||||
if (BufferManager::exist(iii)) {
|
||||
BufferText* tmpBuffer = BufferManager::get(iii);
|
||||
if (NULL != tmpBuffer) {
|
||||
if (nullptr != tmpBuffer) {
|
||||
bool isModify = tmpBuffer->isModify();
|
||||
etk::FSNode name = tmpBuffer->getFileName();
|
||||
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
|
||||
if (NULL != tmpElement) {
|
||||
if (nullptr != tmpElement) {
|
||||
m_list.push_back(tmpElement);
|
||||
} else {
|
||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||
@ -216,24 +220,6 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void BufferView::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::widget::List::onObjectRemove(_object);
|
||||
auto it(m_list.begin());
|
||||
while (it != m_list.end()) {
|
||||
if ( *it != nullptr
|
||||
&& (*it)->m_buffer == _object) {
|
||||
m_list.erase(it);
|
||||
markToRedraw();
|
||||
it = m_list.begin();
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
if (m_bufferManager == _object) {
|
||||
m_bufferManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
etk::Color<> BufferView::getBasicBG() {
|
||||
return (*m_paintingProperties)[m_colorBackground1].getForeground();
|
||||
@ -258,7 +244,7 @@ bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextT
|
||||
&& m_list[_raw] != nullptr) {
|
||||
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
|
||||
|
||||
if ( m_list[_raw]->m_buffer != NULL
|
||||
if ( m_list[_raw]->m_buffer != nullptr
|
||||
&& m_list[_raw]->m_buffer->isModify() == false) {
|
||||
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
|
||||
} else {
|
||||
@ -285,8 +271,8 @@ bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent
|
||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
if( _raw >= 0
|
||||
&& _raw<(int64_t)m_list.size()
|
||||
&& NULL != m_list[_raw]) {
|
||||
if (m_list[_raw]->m_buffer != NULL) {
|
||||
&& nullptr != m_list[_raw]) {
|
||||
if (m_list[_raw]->m_buffer != nullptr) {
|
||||
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName());
|
||||
m_selectedID = _raw;
|
||||
markToRedraw();
|
||||
|
@ -19,8 +19,8 @@ namespace appl {
|
||||
class dataBufferStruct {
|
||||
public:
|
||||
etk::FSNode m_bufferName;
|
||||
ewol::object::Shared<appl::Buffer> m_buffer;
|
||||
dataBufferStruct(const std::string& _bufferName, const ewol::object::Shared<appl::Buffer>& _buffer) :
|
||||
std::shared_ptr<appl::Buffer> m_buffer;
|
||||
dataBufferStruct(const std::string& _bufferName, const std::shared_ptr<appl::Buffer>& _buffer) :
|
||||
m_bufferName(_bufferName),
|
||||
m_buffer(_buffer) {
|
||||
|
||||
@ -31,9 +31,9 @@ namespace appl {
|
||||
|
||||
class BufferView : public ewol::widget::List {
|
||||
private:
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
private:
|
||||
ewol::object::Shared<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||
int32_t m_colorBackground1;
|
||||
int32_t m_colorBackground2;
|
||||
int32_t m_colorBackgroundSelect;
|
||||
@ -48,13 +48,15 @@ class BufferView : public ewol::widget::List {
|
||||
* @param[in] _dataStruct element to add.
|
||||
*/
|
||||
void insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition = false);
|
||||
public:
|
||||
protected:
|
||||
// Constructeur
|
||||
BufferView();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(BufferView);
|
||||
virtual ~BufferView();
|
||||
// Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
private:
|
||||
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
||||
protected:
|
||||
|
@ -40,11 +40,11 @@
|
||||
namespace appl {
|
||||
std::string getVersion() {
|
||||
#define FIRST_YEAR (2010)
|
||||
std::string tmpOutput = std::to_string(date::getYear()-FIRST_YEAR);
|
||||
std::string tmpOutput = etk::to_string(date::getYear()-FIRST_YEAR);
|
||||
tmpOutput += ".";
|
||||
tmpOutput += std::to_string(date::getMonth());
|
||||
tmpOutput += etk::to_string(date::getMonth());
|
||||
tmpOutput += ".";
|
||||
tmpOutput += std::to_string(date::getDay());
|
||||
tmpOutput += etk::to_string(date::getDay());
|
||||
return tmpOutput;
|
||||
}
|
||||
|
||||
@ -59,12 +59,15 @@ namespace appl {
|
||||
|
||||
class ParameterAboutGui : public ewol::widget::Sizer {
|
||||
public :
|
||||
ParameterAboutGui() :
|
||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
|
||||
ewol::object::Shared<ewol::widget::Spacer> mySpacer = NULL;
|
||||
ParameterAboutGui() {
|
||||
addObjectType("appl::ParameterAboutGui");
|
||||
}
|
||||
void init() {
|
||||
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
|
||||
std::shared_ptr<ewol::widget::Spacer> mySpacer;
|
||||
|
||||
mySpacer = ewol::object::makeShared(new ewol::widget::Spacer());
|
||||
if (NULL == mySpacer) {
|
||||
mySpacer = ewol::widget::Spacer::create();
|
||||
if (nullptr == mySpacer) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
mySpacer->setExpand(bvec2(true,true));
|
||||
@ -93,8 +96,8 @@ class ParameterAboutGui : public ewol::widget::Sizer {
|
||||
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
|
||||
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
|
||||
tmpLabel += "</left>";
|
||||
ewol::object::Shared<ewol::widget::Label> myLabel = ewol::object::makeShared(new ewol::widget::Label(tmpLabel));
|
||||
if (NULL == myLabel) {
|
||||
std::shared_ptr<ewol::widget::Label> myLabel = ewol::widget::Label::create(tmpLabel);
|
||||
if (nullptr == myLabel) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
myLabel->setExpand(bvec2(true,false));
|
||||
@ -121,38 +124,42 @@ const char* l_smoothMax = "tmpEvent_maxChange";
|
||||
|
||||
MainWindows::MainWindows() {
|
||||
addObjectType("appl::MainWindows");
|
||||
}
|
||||
|
||||
void MainWindows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerVert = NULL;
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerVert2 = NULL;
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerHori = NULL;
|
||||
ewol::object::Shared<appl::TextViewer> myTextView = NULL;
|
||||
ewol::object::Shared<BufferView> myBufferView = NULL;
|
||||
ewol::object::Shared<ewol::widget::Menu> myMenu = NULL;
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert = nullptr;
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = nullptr;
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
|
||||
std::shared_ptr<appl::TextViewer> myTextView = nullptr;
|
||||
std::shared_ptr<BufferView> myBufferView = nullptr;
|
||||
std::shared_ptr<ewol::widget::Menu> myMenu = nullptr;
|
||||
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
|
||||
mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||
mySizerVert->setName("plop 1111111");
|
||||
setSubWidget(mySizerVert);
|
||||
|
||||
mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
|
||||
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
|
||||
mySizerHori->setName("plop 222222222");
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
myBufferView = ewol::object::makeShared(new BufferView());
|
||||
myBufferView = BufferView::create();
|
||||
myBufferView->setName("plop 3333333");
|
||||
myBufferView->setExpand(bvec2(false,true));
|
||||
myBufferView->setFill(bvec2(true,true));
|
||||
mySizerHori->subWidgetAdd(myBufferView);
|
||||
|
||||
mySizerVert2 = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
mySizerVert2 = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||
mySizerHori->subWidgetAdd(mySizerVert2);
|
||||
mySizerVert2->setName("plop 4444444");
|
||||
// main buffer Area :
|
||||
#if defined(__TARGET_OS__Android)
|
||||
myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16));
|
||||
myTextView = appl::TextViewer::create("FreeMono;DejaVuSansMono;FreeSerif", 16);
|
||||
#else
|
||||
myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11));
|
||||
myTextView = appl::TextViewer::create("FreeMono;DejaVuSansMono;FreeSerif", 11);
|
||||
#endif
|
||||
myTextView->setName("appl-text-viewer");
|
||||
myTextView->setExpand(bvec2(true,true));
|
||||
@ -165,14 +172,14 @@ MainWindows::MainWindows() {
|
||||
mySizerVert2->subWidgetAdd(myTextView);
|
||||
*/
|
||||
// search area :
|
||||
ewol::object::Shared<appl::widget::Search> mySearch = ewol::object::makeShared(new appl::widget::Search());
|
||||
std::shared_ptr<appl::widget::Search> mySearch = appl::widget::Search::create();
|
||||
mySizerVert2->subWidgetAdd(mySearch);
|
||||
|
||||
mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
|
||||
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
|
||||
mySizerHori->setName("plop 555555");
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
|
||||
myMenu = ewol::object::makeShared(new ewol::widget::Menu());
|
||||
myMenu = ewol::widget::Menu::create();
|
||||
mySizerHori->subWidgetAdd(myMenu);
|
||||
int32_t idMenuFile = myMenu->addTitle("File");
|
||||
myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
|
||||
@ -221,7 +228,7 @@ MainWindows::MainWindows() {
|
||||
myMenu->addSpacer();
|
||||
myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
|
||||
|
||||
m_widgetLabelFileName = ewol::object::makeShared(new ewol::widget::Label("FileName"));
|
||||
m_widgetLabelFileName = ewol::widget::Label::create("FileName");
|
||||
m_widgetLabelFileName->setExpand(bvec2(true,false));
|
||||
m_widgetLabelFileName->setFill(bvec2(true,false));;
|
||||
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
|
||||
@ -282,30 +289,30 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_VERBOSE("Receive Event from the main windows: " << _msg );
|
||||
// open file Section ...
|
||||
if (_msg.getMessage() == ednMsgGuiOpen) {
|
||||
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser();
|
||||
if (tmpWidget == NULL) {
|
||||
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 == NULL) {
|
||||
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 ...)
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
|
||||
if (tmpBuffer != NULL) {
|
||||
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(this, "validate", ednEventPopUpFileSelected);
|
||||
tmpWidget->registerOnEvent(shared_from_this(), "validate", ednEventPopUpFileSelected);
|
||||
} else if (_msg.getMessage() == ednMsgProperties) {
|
||||
// Request the parameter GUI
|
||||
ewol::object::Shared<ewol::widget::Parameter> tmpWidget = ewol::object::makeShared(new ewol::widget::Parameter());
|
||||
if (NULL == tmpWidget) {
|
||||
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
|
||||
@ -342,13 +349,13 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
tmpWidget->setTitle("Properties");
|
||||
popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->menuAddGroup("Editor");
|
||||
ewol::object::Shared<ewol::Widget> tmpSubWidget = ewol::object::makeShared(new globals::ParameterGlobalsGui());
|
||||
std::shared_ptr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
|
||||
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
|
||||
tmpWidget->menuAdd("Font & Color", "", NULL);
|
||||
tmpWidget->menuAdd("Highlight", "", NULL);
|
||||
tmpWidget->menuAdd("Font & Color", "", nullptr);
|
||||
tmpWidget->menuAdd("Highlight", "", nullptr);
|
||||
tmpWidget->menuAddGroup("General");
|
||||
tmpWidget->menuAdd("Display", "", NULL);
|
||||
tmpSubWidget = ewol::object::makeShared(new ParameterAboutGui());
|
||||
tmpWidget->menuAdd("Display", "", nullptr);
|
||||
tmpSubWidget = ParameterAboutGui::create();
|
||||
tmpWidget->menuAdd("About", "", tmpSubWidget);
|
||||
}
|
||||
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
|
||||
@ -366,7 +373,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
// TODO : ...
|
||||
}
|
||||
// Note : Fore all next message we need to acces to the buffer manager ==> just check one time ...
|
||||
if (m_bufferManager == NULL) {
|
||||
if (m_bufferManager == nullptr) {
|
||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||
return;
|
||||
}
|
||||
@ -375,21 +382,21 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
|| _msg.getMessage() == appl::Buffer::eventIsSave
|
||||
|| _msg.getMessage() == appl::Buffer::eventChangeName) {
|
||||
// select a new Buffer ==> change title:
|
||||
ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == nullptr) {
|
||||
setTitle("Edn");
|
||||
if (m_widgetLabelFileName != NULL) {
|
||||
if (m_widgetLabelFileName != nullptr) {
|
||||
m_widgetLabelFileName->setLabel("");
|
||||
}
|
||||
} else {
|
||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||
tmpp->registerOnEvent(this, appl::Buffer::eventIsModify);
|
||||
tmpp->registerOnEvent(this, appl::Buffer::eventIsSave);
|
||||
tmpp->registerOnEvent(this, appl::Buffer::eventChangeName);
|
||||
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 != NULL) {
|
||||
if (m_widgetLabelFileName != nullptr) {
|
||||
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
|
||||
}
|
||||
}
|
||||
@ -402,31 +409,31 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
m_bufferManager->open(_msg.getData());
|
||||
} else if (_msg.getMessage() == ednMsgGuiSave) {
|
||||
APPL_DEBUG("Request saving the file : " << _msg.getData());
|
||||
if (std::tolower(_msg.getData()) == "current") {
|
||||
new appl::WorkerSaveFile("", false);
|
||||
if (etk::tolower(_msg.getData()) == "current") {
|
||||
appl::WorkerSaveFile::create("", false);
|
||||
return;
|
||||
} else if (std::tolower(_msg.getData()) == "all") {
|
||||
new appl::WorkerSaveAllFile();
|
||||
} else if (etk::tolower(_msg.getData()) == "all") {
|
||||
appl::WorkerSaveAllFile::create();
|
||||
return;
|
||||
} else {
|
||||
APPL_ERROR("UNKNOW request : " << _msg);
|
||||
}
|
||||
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
|
||||
new appl::WorkerSaveFile("", true);
|
||||
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") {
|
||||
new appl::WorkerCloseFile("");
|
||||
appl::WorkerCloseFile::create("");
|
||||
} else {
|
||||
new appl::WorkerCloseAllFile();
|
||||
appl::WorkerCloseAllFile::create();
|
||||
}
|
||||
} 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());
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||
return;
|
||||
}
|
||||
@ -444,8 +451,8 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||
return;
|
||||
}
|
||||
@ -455,64 +462,58 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||
return;
|
||||
}
|
||||
// note: just remove ==> no check : normal case ...
|
||||
tmpBuffer->removeObject();
|
||||
//tmpBuffer->removeObject();
|
||||
EWOL_TODO("call remove buffer ...");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void MainWindows::saveAsPopUp(const ewol::object::Shared<appl::Buffer>& _buffer) {
|
||||
if (_buffer == NULL) {
|
||||
APPL_ERROR("Call With NULL input...");
|
||||
void MainWindows::saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer) {
|
||||
if (_buffer == nullptr) {
|
||||
APPL_ERROR("Call With nullptr input...");
|
||||
return;
|
||||
}
|
||||
appl::WorkerSaveFile* tmpObject = new appl::WorkerSaveFile(_buffer->getFileName());
|
||||
std::shared_ptr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create(_buffer->getFileName());
|
||||
}
|
||||
|
||||
void MainWindows::closeNotSavedFile(const ewol::object::Shared<appl::Buffer>& _buffer) {
|
||||
if (_buffer == NULL) {
|
||||
APPL_ERROR("Call With NULL input...");
|
||||
void MainWindows::closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer) {
|
||||
if (_buffer == nullptr) {
|
||||
APPL_ERROR("Call With nullptr input...");
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<ewol::widget::StdPopUp> tmpPopUp = ewol::object::makeShared(new ewol::widget::StdPopUp());
|
||||
if (tmpPopUp == NULL) {
|
||||
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
|
||||
if (tmpPopUp == nullptr) {
|
||||
APPL_ERROR("Can not create a simple pop-up");
|
||||
return;
|
||||
}
|
||||
tmpPopUp->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...");
|
||||
ewol::object::Shared<ewol::Widget> bt = NULL;
|
||||
std::shared_ptr<ewol::Widget> bt = nullptr;
|
||||
if (_buffer->hasFileName() == true) {
|
||||
bt = tmpPopUp->addButton("Save", true);
|
||||
if (bt != NULL) {
|
||||
if (bt != nullptr) {
|
||||
// TODO : The element is removed before beeing pressed
|
||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestSaveFile, _buffer->getFileName());
|
||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFile, _buffer->getFileName());
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||
}
|
||||
}
|
||||
bt = tmpPopUp->addButton("Save As", true);
|
||||
if (bt != NULL) {
|
||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName());
|
||||
if (bt != nullptr) {
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName());
|
||||
//bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||
// TODO : Request the close when saved ...
|
||||
}
|
||||
bt = tmpPopUp->addButton("Close", true);
|
||||
if (bt != NULL) {
|
||||
bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||
if (bt != nullptr) {
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
|
||||
}
|
||||
tmpPopUp->addButton("Cancel", true);
|
||||
tmpPopUp->setRemoveOnExternClick(true);
|
||||
popUpWidgetPush(tmpPopUp);
|
||||
}
|
||||
|
||||
void MainWindows::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::widget::Windows::onObjectRemove(_removeObject);
|
||||
if (m_widgetLabelFileName == _removeObject) {
|
||||
m_widgetLabelFileName = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -19,26 +19,28 @@
|
||||
|
||||
class MainWindows : public ewol::widget::Windows {
|
||||
private:
|
||||
ewol::object::Shared<ewol::widget::Label> m_widgetLabelFileName;
|
||||
public:
|
||||
std::shared_ptr<ewol::widget::Label> m_widgetLabelFileName;
|
||||
protected:
|
||||
// Constructeur
|
||||
MainWindows();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(MainWindows);
|
||||
virtual ~MainWindows();
|
||||
private:
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
/**
|
||||
* @brief Display a pop-up to the select the name of the file.
|
||||
* @param[in] _buffer Buffer that might be saved with a new name.
|
||||
*/
|
||||
void saveAsPopUp(const ewol::object::Shared<appl::Buffer>& _buffer);
|
||||
void saveAsPopUp(const std::shared_ptr<appl::Buffer>& _buffer);
|
||||
/**
|
||||
* @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved.
|
||||
* @param[in] _buffer Buffer that might be close.
|
||||
*/
|
||||
void closeNotSavedFile(const ewol::object::Shared<appl::Buffer>& _buffer);
|
||||
void closeNotSavedFile(const std::shared_ptr<appl::Buffer>& _buffer);
|
||||
public: // Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,34 +29,32 @@ const char* const l_eventForwardCb = "appl-forward-CheckBox";
|
||||
const char* const l_eventHideBt = "appl-hide-button";
|
||||
|
||||
appl::widget::Search::Search() :
|
||||
ewol::widget::Composer(ewol::widget::Composer::file, "DATA:GUI-Search.xml"),
|
||||
m_viewerManager(NULL),
|
||||
m_forward(true),
|
||||
m_caseSensitive(false),
|
||||
m_wrap(true),
|
||||
m_searchEntry(NULL),
|
||||
m_replaceEntry(NULL) {
|
||||
m_wrap(true) {
|
||||
addObjectType("appl::widget::Search");
|
||||
// load buffer manager:onObjectRemove
|
||||
m_viewerManager = appl::ViewerManager::keep();
|
||||
}
|
||||
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(this, "SEARCH:close", "pressed", l_eventHideBt);
|
||||
registerOnEventNameWidget(this, "SEARCH:search-entry", "modify", l_eventSearchEntry);
|
||||
registerOnEventNameWidget(this, "SEARCH:search-entry", "enter", l_eventSearchEntryEnter);
|
||||
registerOnEventNameWidget(this, "SEARCH:search", "pressed", l_eventSearchBt);
|
||||
registerOnEventNameWidget(this, "SEARCH:replace-entry", "modify", l_eventReplaceEntry);
|
||||
registerOnEventNameWidget(this, "SEARCH:replace-entry", "enter", l_eventReplaceEntryEnter);
|
||||
registerOnEventNameWidget(this, "SEARCH:replace", "pressed", l_eventReplaceBt);
|
||||
registerOnEventNameWidget(this, "SEARCH:case", "value", l_eventCaseCb);
|
||||
registerOnEventNameWidget(this, "SEARCH:wrap", "value", l_eventWrapCb);
|
||||
registerOnEventNameWidget(this, "SEARCH:up-down", "value", l_eventForwardCb);
|
||||
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);
|
||||
// set default properties
|
||||
setConfigNamed("SEARCH:case", "value", std::to_string(m_caseSensitive));
|
||||
setConfigNamed("SEARCH:wrap", "value", std::to_string(m_wrap));
|
||||
setConfigNamed("SEARCH:up-down", "value", std::to_string(m_forward));
|
||||
parameterSetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
|
||||
parameterSetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
|
||||
parameterSetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
|
||||
// get widget
|
||||
m_searchEntry = ewol::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:search-entry"));
|
||||
m_replaceEntry = ewol::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:replace-entry"));
|
||||
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);
|
||||
// basicly hiden ...
|
||||
@ -68,12 +66,12 @@ appl::widget::Search::~Search() {
|
||||
}
|
||||
|
||||
void appl::widget::Search::find() {
|
||||
if (m_viewerManager == NULL) {
|
||||
if (m_viewerManager == nullptr) {
|
||||
APPL_WARNING("No viewer manager selected!!!");
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||
if (viewer == NULL) {
|
||||
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||
if (viewer == nullptr) {
|
||||
APPL_INFO("No viewer selected!!!");
|
||||
return;
|
||||
}
|
||||
@ -104,12 +102,12 @@ void appl::widget::Search::find() {
|
||||
}
|
||||
|
||||
void appl::widget::Search::replace() {
|
||||
if (m_viewerManager == NULL) {
|
||||
if (m_viewerManager == nullptr) {
|
||||
APPL_WARNING("No viewer manager selected!!!");
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||
if (viewer == NULL) {
|
||||
std::shared_ptr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||
if (viewer == nullptr) {
|
||||
APPL_INFO("No viewer selected!!!");
|
||||
return;
|
||||
}
|
||||
@ -125,35 +123,35 @@ 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 = to_u32string(_msg.getData());
|
||||
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 = to_u32string(_msg.getData());
|
||||
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 = std::stob(_msg.getData());
|
||||
m_caseSensitive = etk::string_to_bool(_msg.getData());
|
||||
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
||||
m_wrap = std::stob(_msg.getData());
|
||||
m_wrap = etk::string_to_bool(_msg.getData());
|
||||
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
||||
m_forward = std::stob(_msg.getData());
|
||||
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!= NULL) {
|
||||
if (m_searchEntry!= nullptr) {
|
||||
m_searchEntry->keepFocus();
|
||||
}
|
||||
} else {
|
||||
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|
||||
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
|
||||
if( (m_searchEntry!=nullptr && true == m_searchEntry->getFocus())
|
||||
|| (m_replaceEntry!=nullptr && true == m_replaceEntry->getFocus()) ) {
|
||||
hide();
|
||||
} else if (m_searchEntry!= NULL) {
|
||||
} else if (m_searchEntry!= nullptr) {
|
||||
m_searchEntry->keepFocus();
|
||||
} else {
|
||||
hide();
|
||||
@ -162,16 +160,3 @@ void appl::widget::Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::widget::Search::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::widget::Composer::onObjectRemove(_object);
|
||||
if (_object == m_searchEntry) {
|
||||
m_searchEntry.reset();
|
||||
}
|
||||
if (_object == m_replaceEntry) {
|
||||
m_replaceEntry.reset();
|
||||
}
|
||||
if (_object == m_viewerManager) {
|
||||
m_viewerManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,17 +18,20 @@ namespace appl {
|
||||
namespace widget {
|
||||
class Search : public ewol::widget::Composer {
|
||||
private:
|
||||
ewol::object::Shared<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||
bool m_forward;
|
||||
bool m_caseSensitive;
|
||||
bool m_wrap;
|
||||
ewol::object::Shared<ewol::widget::Entry> m_searchEntry;
|
||||
ewol::object::Shared<ewol::widget::Entry> m_replaceEntry;
|
||||
std::shared_ptr<ewol::widget::Entry> m_searchEntry;
|
||||
std::shared_ptr<ewol::widget::Entry> m_replaceEntry;
|
||||
std::u32string m_searchData;
|
||||
std::u32string m_replaceData;
|
||||
public:
|
||||
protected:
|
||||
// Constructeur
|
||||
Search();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(Search);
|
||||
virtual ~Search();
|
||||
private:
|
||||
/**
|
||||
@ -41,7 +44,6 @@ namespace appl {
|
||||
void replace();
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -23,20 +23,22 @@ appl::TagFileList::TagFileList() {
|
||||
addEventId(applEventCtagsListValidate);
|
||||
setMouseLimit(1);
|
||||
// Load color properties: (use file list to be generic ...)
|
||||
m_colorProperty = ewol::resource::ColorFile::keep("THEME:COLOR:ListFileSystem.json");
|
||||
if (m_colorProperty != NULL) {
|
||||
m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:ListFileSystem.json");
|
||||
if (m_colorProperty != nullptr) {
|
||||
m_colorIdText = m_colorProperty->request("text");
|
||||
m_colorIdBackground1 = m_colorProperty->request("background1");
|
||||
m_colorIdBackground2 = m_colorProperty->request("background2");
|
||||
m_colorIdBackgroundSelected = m_colorProperty->request("selected");
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TagFileList::init() {
|
||||
ewol::widget::List::init();
|
||||
}
|
||||
|
||||
appl::TagFileList::~TagFileList() {
|
||||
for (auto &it : m_list) {
|
||||
delete(it);
|
||||
it = NULL;
|
||||
it = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,9 +60,9 @@ uint32_t appl::TagFileList::getNuberOfRaw() {
|
||||
}
|
||||
|
||||
bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
if (_raw >= 0 && (size_t)_raw < m_list.size() && NULL != m_list[_raw]) {
|
||||
if (_raw >= 0 && (size_t)_raw < m_list.size() && nullptr != m_list[_raw]) {
|
||||
if (0 == _colomn) {
|
||||
_myTextToWrite = std::to_string(m_list[_raw]->fileLine);
|
||||
_myTextToWrite = etk::to_string(m_list[_raw]->fileLine);
|
||||
} else {
|
||||
_myTextToWrite = m_list[_raw]->filename;
|
||||
}
|
||||
@ -96,8 +98,8 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
||||
}
|
||||
if( m_selectedLine >= 0
|
||||
&& m_selectedLine < (int64_t)m_list.size()
|
||||
&& NULL != m_list[m_selectedLine] ) {
|
||||
generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||
&& nullptr != m_list[m_selectedLine] ) {
|
||||
generateEventId(event, etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||
} else {
|
||||
generateEventId(applEventCtagsListUnSelect);
|
||||
}
|
||||
@ -117,7 +119,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
||||
*/
|
||||
void appl::TagFileList::add(std::string& _file, int32_t _line) {
|
||||
appl::TagListElement *tmpFile = new appl::TagListElement(_file, _line);
|
||||
if (NULL != tmpFile) {
|
||||
if (nullptr != tmpFile) {
|
||||
m_list.push_back(tmpFile);
|
||||
}
|
||||
markToRedraw();
|
||||
|
@ -37,13 +37,16 @@ namespace appl {
|
||||
int32_t m_selectedLine;
|
||||
std::vector<appl::TagListElement*> m_list;
|
||||
protected:
|
||||
ewol::object::Shared<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
|
||||
std::shared_ptr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
|
||||
int32_t m_colorIdText; //!< Color of the text.
|
||||
int32_t m_colorIdBackground1; //!< Color of the Background.
|
||||
int32_t m_colorIdBackground2; //!< Color of the Background 2.
|
||||
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
||||
public:
|
||||
protected:
|
||||
TagFileList();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TagFileList);
|
||||
virtual ~TagFileList();
|
||||
// display API :
|
||||
virtual etk::Color<> getBasicBG();
|
||||
|
@ -34,10 +34,11 @@ appl::TagFileSelection::TagFileSelection() {
|
||||
addObjectType("appl::TagFileSelection");
|
||||
addEventId(applEventctagsSelection);
|
||||
addEventId(applEventctagsCancel);
|
||||
}
|
||||
|
||||
ewol::object::Shared<ewol::widget::Label> myWidgetTitle;
|
||||
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerVert;
|
||||
void appl::TagFileSelection::init() {
|
||||
ewol::widget::PopUp::init();
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert;
|
||||
#if defined(__TARGET_OS__Android)
|
||||
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
|
||||
#elif defined(__TARGET_OS__Windows)
|
||||
@ -46,15 +47,15 @@ appl::TagFileSelection::TagFileSelection() {
|
||||
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
|
||||
#endif
|
||||
|
||||
mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
if (NULL == mySizerVert) {
|
||||
mySizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||
if (nullptr == mySizerVert) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
mySizerVert->lockExpand(bvec2(true,true));
|
||||
mySizerVert->setExpand(bvec2(true,true));
|
||||
// set it in the pop-up-system :
|
||||
setSubWidget(mySizerVert);
|
||||
ewol::object::Shared<ewol::widget::Composer> compose = ewol::object::makeShared(new ewol::widget::Composer(ewol::widget::Composer::String,
|
||||
std::shared_ptr<ewol::widget::Composer> compose = ewol::widget::Composer::create(ewol::widget::Composer::String,
|
||||
"<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n"
|
||||
" <spacer expand=\"true,false\"/>\n"
|
||||
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
|
||||
@ -69,27 +70,28 @@ appl::TagFileSelection::TagFileSelection() {
|
||||
" <label>Cancel</label>\n"
|
||||
" </sizer>\n"
|
||||
" </button>\n"
|
||||
"</sizer>\n"));
|
||||
"</sizer>\n");
|
||||
compose->setExpand(bvec2(true,false));
|
||||
compose->setFill(bvec2(true,true));
|
||||
mySizerVert->subWidgetAdd(compose);
|
||||
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
|
||||
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
|
||||
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
|
||||
compose->registerOnEventNameWidget(shared_from_this(), "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
|
||||
|
||||
m_listTag = ewol::object::makeShared(new appl::TagFileList());
|
||||
if (NULL == m_listTag) {
|
||||
m_listTag = appl::TagFileList::create();
|
||||
if (nullptr == m_listTag) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
m_listTag->registerOnEvent(this, applEventCtagsListValidate);
|
||||
m_listTag->registerOnEvent(this, applEventCtagsListSelect);
|
||||
m_listTag->registerOnEvent(this, applEventCtagsListUnSelect);
|
||||
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListValidate);
|
||||
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListSelect);
|
||||
m_listTag->registerOnEvent(shared_from_this(), applEventCtagsListUnSelect);
|
||||
m_listTag->setExpand(bvec2(true,true));
|
||||
m_listTag->setFill(bvec2(true,true));
|
||||
mySizerVert->subWidgetAdd(m_listTag);
|
||||
}
|
||||
|
||||
myWidgetTitle = new ewol::widget::Label("Ctags Jump Selection ...");
|
||||
if (NULL == myWidgetTitle) {
|
||||
std::shared_ptr<ewol::widget::Label> myWidgetTitle;
|
||||
myWidgetTitle = ewol::widget::Label::create("Ctags Jump Selection ...");
|
||||
if (nullptr == myWidgetTitle) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
mySizerVert->subWidgetAdd(myWidgetTitle);
|
||||
@ -134,21 +136,8 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
* @param[in] jump line id
|
||||
*/
|
||||
void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) {
|
||||
if (NULL != m_listTag) {
|
||||
if (nullptr != m_listTag) {
|
||||
m_listTag->add(_file, _line);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TagFileSelection::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
// First step call parrent :
|
||||
ewol::widget::PopUp::onObjectRemove(_removeObject);
|
||||
// second step find if in all the elements ...
|
||||
if(_removeObject == m_listTag) {
|
||||
m_listTag = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -19,10 +19,13 @@ extern const char * const applEventctagsCancel;
|
||||
namespace appl {
|
||||
class TagFileSelection : public ewol::widget::PopUp {
|
||||
private:
|
||||
ewol::object::Shared<appl::TagFileList> m_listTag;
|
||||
std::shared_ptr<appl::TagFileList> m_listTag;
|
||||
std::string m_eventNamed;
|
||||
public:
|
||||
TagFileSelection();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TagFileSelection);
|
||||
virtual ~TagFileSelection();
|
||||
/**
|
||||
* @brief add a Ctags item on the curent list
|
||||
@ -32,7 +35,6 @@ namespace appl {
|
||||
void addCtagsNewItem(std::string file, int32_t line);
|
||||
public: // herited function
|
||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -28,26 +28,19 @@
|
||||
int64_t processTimeLocal = (endTime - startTime); \
|
||||
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
|
||||
|
||||
appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
||||
m_displayText(_fontName, _fontSize),
|
||||
appl::TextViewer::TextViewer() :
|
||||
m_insertMode(false) {
|
||||
addObjectType("appl::TextViewer");
|
||||
setCanHaveFocus(true);
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(ednMsgGuiFind);
|
||||
registerMultiCast(ednMsgGuiReplace);
|
||||
registerMultiCast(appl::MsgSelectGotoLine);
|
||||
registerMultiCast(appl::MsgSelectNewFile);
|
||||
registerMultiCast(appl::MsgSelectGotoLineSelect);
|
||||
setLimitScrolling(0.2);
|
||||
setSingleFinger(false);
|
||||
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_viewerManager = appl::ViewerManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
m_viewerManager = appl::ViewerManager::create();
|
||||
|
||||
// load color properties
|
||||
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:textViewer.json");
|
||||
m_paintingProperties = appl::GlyphPainting::create("THEME:COLOR:textViewer.json");
|
||||
// get all id properties ...
|
||||
m_colorBackground = m_paintingProperties->request("CODE_basicBackgroung");
|
||||
m_colorSpace = m_paintingProperties->request("CODE_space");
|
||||
@ -56,18 +49,30 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
||||
m_colorLineNumber = m_paintingProperties->request("CODE_lineNumber");
|
||||
m_colorSelection = m_paintingProperties->request("SelectedText");
|
||||
m_colorNormal = m_paintingProperties->request("normal");
|
||||
}
|
||||
|
||||
void appl::TextViewer::init(const std::string& _fontName, int32_t _fontSize) {
|
||||
ewol::widget::WidgetScrolled::init();
|
||||
m_displayText.setFont(_fontName, _fontSize);
|
||||
appl::textPluginManager::connect(*this);
|
||||
// last created has focus ...
|
||||
setCurrentSelect();
|
||||
|
||||
registerMultiCast(ednMsgBufferId);
|
||||
registerMultiCast(ednMsgGuiFind);
|
||||
registerMultiCast(ednMsgGuiReplace);
|
||||
registerMultiCast(appl::MsgSelectGotoLine);
|
||||
registerMultiCast(appl::MsgSelectNewFile);
|
||||
registerMultiCast(appl::MsgSelectGotoLineSelect);
|
||||
}
|
||||
|
||||
|
||||
appl::TextViewer::~TextViewer() {
|
||||
appl::textPluginManager::disconnect(*this);
|
||||
}
|
||||
|
||||
std::string appl::TextViewer::getBufferPath() {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return "";
|
||||
}
|
||||
std::string filename = m_buffer->getFileName();
|
||||
@ -109,7 +114,7 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
m_displayDrawing.setColor((*m_paintingProperties)[m_colorBackground].getForeground());
|
||||
m_displayDrawing.rectangleWidth(m_size);
|
||||
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
m_maxSize.setX(256);
|
||||
m_maxSize.setY(256);
|
||||
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::compositing::alignLeft);
|
||||
@ -138,7 +143,7 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
vec3 tmpCursorPosition(0, 0, -1);
|
||||
float tmpCursorLenght = -1.0;
|
||||
// real display ...
|
||||
m_displayText.setColor(etk::Color<>(0, 0, 0, 256));
|
||||
m_displayText.setColor(etk::Color<>(0, 0, 0, 255));
|
||||
float countNbLine = 1;
|
||||
int32_t countColomn = 0;
|
||||
// the siplay string :
|
||||
@ -204,7 +209,7 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
appl::DisplayHLData displayLocalSyntax;
|
||||
m_buffer->hightlightGenerateLines(displayLocalSyntax, startingIt, (m_size.y()/tmpLetterSize.y()) + 5);
|
||||
float maxSizeX = 0;
|
||||
appl::HighlightInfo * HLColor = NULL;
|
||||
appl::HighlightInfo * HLColor = nullptr;
|
||||
bool DisplayCursorAndSelection = isSelectedLast();
|
||||
appl::Buffer::Iterator it;
|
||||
for (it = startingIt;
|
||||
@ -220,12 +225,12 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
if (*it == u32char::Return) {
|
||||
countNbLine += 1;
|
||||
countColomn = 0;
|
||||
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX);
|
||||
maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
|
||||
// Display the end line position only if we have the focus ...
|
||||
if (DisplayCursorAndSelection == true) {
|
||||
if (it >= selectPosStart && it < selectPosStop) {
|
||||
ewol::compositing::Drawing& draw = m_displayText.getDrawing();
|
||||
draw.setColor(etk::Color<>(0xFF0000FF));
|
||||
draw.setColor(etk::Color<>(0xFF, 0x00, 0x00, 0xFF));
|
||||
draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f);
|
||||
draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f);
|
||||
}
|
||||
@ -242,8 +247,8 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
}
|
||||
HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (int64_t)it);
|
||||
bool haveBackground = false;
|
||||
if ( HLColor != NULL
|
||||
&& HLColor->patern != NULL) {
|
||||
if ( HLColor != nullptr
|
||||
&& HLColor->patern != nullptr) {
|
||||
m_displayText.setColor(HLColor->patern->getColorGlyph().getForeground());
|
||||
m_displayText.setColorBg(HLColor->patern->getColorGlyph().getBackground());
|
||||
haveBackground = HLColor->patern->getColorGlyph().haveBackground();
|
||||
@ -281,7 +286,7 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
tmpCursorPosition = m_displayText.getPos();
|
||||
tmpCursorLenght = 5;
|
||||
}
|
||||
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX);
|
||||
maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
|
||||
// Display cursor only if we have the focus ...
|
||||
if ( tmpCursorPosition.z() != -1
|
||||
&& getFocus() == true) {
|
||||
@ -313,7 +318,7 @@ void appl::TextViewer::onRegenerateDisplay() {
|
||||
}
|
||||
|
||||
bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
// First call plugin
|
||||
@ -429,7 +434,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
||||
keepFocus();
|
||||
}
|
||||
//tic();
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
// First call the scrolling widget :
|
||||
@ -613,7 +618,7 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
|
||||
}
|
||||
|
||||
void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
||||
if (m_buffer != NULL) {
|
||||
if (m_buffer != nullptr) {
|
||||
std::string data = ewol::context::clipBoard::get(_clipboardID);
|
||||
write(data);
|
||||
}
|
||||
@ -642,27 +647,27 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
return;
|
||||
}
|
||||
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
|
||||
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
|
||||
select(it, m_buffer->getEndLine(it));
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
|
||||
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), etk::string_to_int32_t(_msg.getData()));
|
||||
moveCursor(it);
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||
// reset scroll:
|
||||
if (m_buffer != NULL) {
|
||||
m_buffer->unRegisterOnEvent(this);
|
||||
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) {
|
||||
@ -678,12 +683,12 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
m_originScrooled = vec2(0,0);
|
||||
if (m_bufferManager != NULL) {
|
||||
if (m_bufferManager != nullptr) {
|
||||
m_buffer = m_bufferManager->get(_msg.getData());
|
||||
m_bufferManager->setBufferSelected(m_buffer);
|
||||
if (m_buffer != NULL) {
|
||||
m_buffer->registerOnEvent(this, appl::Buffer::eventIsModify);
|
||||
m_buffer->registerOnEvent(this, appl::Buffer::eventSelectChange);
|
||||
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;
|
||||
@ -699,14 +704,6 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TextViewer::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::widget::WidgetScrolled::onObjectRemove(_removeObject);
|
||||
if (m_buffer == _removeObject) {
|
||||
m_buffer = NULL;
|
||||
markToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TextViewer::onGetFocus() {
|
||||
showKeyboard();
|
||||
APPL_INFO("Focus - In");
|
||||
@ -731,7 +728,7 @@ void appl::TextViewer::setFontName(const std::string& _fontName) {
|
||||
|
||||
// TODO : Update process time ==> a little expensive (2->4ms) in end of file
|
||||
void appl::TextViewer::updateScrolling() {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
vec2 realCursorPosition(0,0);
|
||||
@ -760,7 +757,7 @@ void appl::TextViewer::updateScrolling() {
|
||||
}
|
||||
|
||||
bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -774,7 +771,7 @@ bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
|
||||
}
|
||||
|
||||
bool appl::TextViewer::write(const std::string& _data) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (m_buffer->hasTextSelected() == true) {
|
||||
@ -784,7 +781,7 @@ bool appl::TextViewer::write(const std::string& _data) {
|
||||
}
|
||||
|
||||
bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -800,7 +797,7 @@ bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Itera
|
||||
}
|
||||
|
||||
bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -816,7 +813,7 @@ bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Ite
|
||||
}
|
||||
|
||||
bool appl::TextViewer::replace(const std::string& _data) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (m_buffer->hasTextSelected() == false) {
|
||||
@ -826,7 +823,7 @@ bool appl::TextViewer::replace(const std::string& _data) {
|
||||
}
|
||||
|
||||
void appl::TextViewer::remove() {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (m_buffer->hasTextSelected() == false) {
|
||||
@ -844,7 +841,7 @@ void appl::TextViewer::remove() {
|
||||
|
||||
|
||||
void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -867,7 +864,7 @@ void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
|
||||
}
|
||||
|
||||
void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -890,7 +887,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
|
||||
}
|
||||
|
||||
void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -916,7 +913,7 @@ void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
|
||||
}
|
||||
|
||||
void appl::TextViewer::moveCursorDown(uint32_t _nbLine) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
markToRedraw();
|
||||
@ -996,14 +993,14 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
|
||||
}
|
||||
|
||||
void appl::TextViewer::setCurrentSelect() {
|
||||
if (m_viewerManager != NULL) {
|
||||
m_viewerManager->setViewerSelected(this, m_buffer);
|
||||
if (m_viewerManager != nullptr) {
|
||||
m_viewerManager->setViewerSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()), m_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
bool appl::TextViewer::isSelectedLast() {
|
||||
if (m_viewerManager != NULL) {
|
||||
return m_viewerManager->isLastSelected(this);
|
||||
if (m_viewerManager != nullptr) {
|
||||
return m_viewerManager->isLastSelected(std::dynamic_pointer_cast<appl::TextViewer>(shared_from_this()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
namespace appl {
|
||||
class TextViewer : public ewol::widget::WidgetScrolled {
|
||||
private:
|
||||
ewol::object::Shared<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||
std::shared_ptr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||
int32_t m_colorBackground;
|
||||
int32_t m_colorSpace;
|
||||
int32_t m_colorTabulation;
|
||||
@ -33,25 +33,28 @@ namespace appl {
|
||||
int32_t m_colorSelection;
|
||||
int32_t m_colorNormal;
|
||||
private:
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||
protected:
|
||||
TextViewer();
|
||||
void init(const std::string& _fontName="", int32_t _fontSize=-1);
|
||||
public:
|
||||
TextViewer(const std::string& _fontName="", int32_t _fontSize=-1);
|
||||
DECLARE_FACTORY(TextViewer);
|
||||
virtual ~TextViewer();
|
||||
private:
|
||||
ewol::object::Shared<appl::Buffer> m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
|
||||
std::shared_ptr<appl::Buffer> m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
|
||||
public:
|
||||
/**
|
||||
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
|
||||
* @return pointer on buffer
|
||||
*/
|
||||
ewol::object::Shared<appl::Buffer> internalGetBuffer() {
|
||||
std::shared_ptr<appl::Buffer> internalGetBuffer() {
|
||||
return m_buffer;
|
||||
}
|
||||
private:
|
||||
ewol::compositing::Text m_displayText; //!< Text display properties.
|
||||
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
|
||||
std::vector<std::pair<ewol::object::Shared<appl::Buffer>, vec2>> m_drawingRemenber;
|
||||
std::vector<std::pair<std::shared_ptr<appl::Buffer>, vec2>> m_drawingRemenber;
|
||||
public:
|
||||
void setFontSize(int32_t _size);
|
||||
void setFontName(const std::string& _fontName);
|
||||
@ -61,7 +64,6 @@ namespace appl {
|
||||
virtual bool calculateMinSize();
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
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);
|
||||
@ -85,7 +87,7 @@ namespace appl {
|
||||
bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd);
|
||||
bool replace(const std::string& _data);
|
||||
bool replace(const std::u32string& _data) {
|
||||
return replace(std::to_string(_data));
|
||||
return replace(etk::to_string(_data));
|
||||
}
|
||||
/**
|
||||
* @brief Remove selected data ...
|
||||
@ -95,7 +97,7 @@ namespace appl {
|
||||
* @brief Remove selected data ... (No plugin call)
|
||||
*/
|
||||
void removeDirect() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return;
|
||||
}
|
||||
m_buffer->removeSelection();
|
||||
@ -108,7 +110,7 @@ namespace appl {
|
||||
* @return true of no error occured.
|
||||
*/
|
||||
bool copy(std::string& _data) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
return m_buffer->copy(_data);
|
||||
@ -120,7 +122,7 @@ namespace appl {
|
||||
* @param[in] _posEnd End position to end replace the data.
|
||||
*/
|
||||
void copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return;
|
||||
}
|
||||
m_buffer->copy(_data, _pos, _posEnd);
|
||||
@ -132,7 +134,7 @@ namespace appl {
|
||||
* @return true if the write is done corectly
|
||||
*/
|
||||
bool writeDirect(const std::string& _data, const appl::Buffer::Iterator& _pos) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ret = m_buffer->write(_data, _pos);
|
||||
@ -147,7 +149,7 @@ namespace appl {
|
||||
* @return true if the write is done corectly
|
||||
*/
|
||||
bool replaceDirect(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ret = m_buffer->replace(_data, _pos, _posEnd);
|
||||
@ -208,14 +210,14 @@ namespace appl {
|
||||
* @return true if a display buffer is present, false otherwise.
|
||||
*/
|
||||
virtual bool hasBuffer() {
|
||||
return m_buffer != NULL;
|
||||
return m_buffer != nullptr;
|
||||
}
|
||||
/**
|
||||
* @brief Get the status of selection.
|
||||
* @return true if we have a current selection, false otherwise.
|
||||
*/
|
||||
virtual bool hasTextSelected() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
return m_buffer->hasTextSelected();
|
||||
@ -224,7 +226,7 @@ namespace appl {
|
||||
* @brief Remove Selection of the buffer.
|
||||
*/
|
||||
virtual void unSelect() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return;
|
||||
}
|
||||
m_buffer->unSelect();
|
||||
@ -235,7 +237,7 @@ namespace appl {
|
||||
* @param[in] _stop Stop position of the selection (the curor is set at this position)
|
||||
*/
|
||||
virtual void select(const appl::Buffer::Iterator& _start, const appl::Buffer::Iterator& _stop) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return;
|
||||
}
|
||||
moveCursor(_stop);
|
||||
@ -255,7 +257,7 @@ namespace appl {
|
||||
appl::Buffer::Iterator& _resultStart,
|
||||
appl::Buffer::Iterator& _resultStop,
|
||||
bool _caseSensitive = true) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ret = m_buffer->search(_pos, _search, _resultStart, _caseSensitive);
|
||||
@ -278,7 +280,7 @@ namespace appl {
|
||||
appl::Buffer::Iterator& _resultStart,
|
||||
appl::Buffer::Iterator& _resultStop,
|
||||
bool _caseSensitive = true) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ret = m_buffer->searchBack(_pos, _search, _resultStart, _caseSensitive);
|
||||
@ -297,7 +299,7 @@ namespace appl {
|
||||
bool getPosAround(const appl::Buffer::Iterator& _pos,
|
||||
appl::Buffer::Iterator &_beginPos,
|
||||
appl::Buffer::Iterator &_endPos) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return false;
|
||||
}
|
||||
return m_buffer->getPosAround(_pos, _beginPos, _endPos);
|
||||
@ -308,7 +310,7 @@ namespace appl {
|
||||
* @return The Iterator
|
||||
*/
|
||||
appl::Buffer::Iterator position(int64_t _pos) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->position(_pos);
|
||||
@ -318,7 +320,7 @@ namespace appl {
|
||||
* @return The iterator on the cursor position
|
||||
*/
|
||||
appl::Buffer::Iterator cursor() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->cursor();
|
||||
@ -328,7 +330,7 @@ namespace appl {
|
||||
* @return The iterator on the begin position
|
||||
*/
|
||||
appl::Buffer::Iterator begin() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->begin();
|
||||
@ -338,7 +340,7 @@ namespace appl {
|
||||
* @return The iterator on the end position
|
||||
*/
|
||||
appl::Buffer::Iterator end() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->end();
|
||||
@ -348,7 +350,7 @@ namespace appl {
|
||||
* @return The Iterator
|
||||
*/
|
||||
appl::Buffer::Iterator selectStart() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->selectStart();
|
||||
@ -358,7 +360,7 @@ namespace appl {
|
||||
* @return The Iterator
|
||||
*/
|
||||
appl::Buffer::Iterator selectStop() {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->selectStop();
|
||||
@ -369,7 +371,7 @@ namespace appl {
|
||||
* @return The position in the buffer of the start of the line.
|
||||
*/
|
||||
appl::Buffer::Iterator getStartLine(const appl::Buffer::Iterator& _pos) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->getStartLine(_pos);
|
||||
@ -380,7 +382,7 @@ namespace appl {
|
||||
* @return The position in the buffer of the end of the line.
|
||||
*/
|
||||
appl::Buffer::Iterator getEndLine(const appl::Buffer::Iterator& _pos) {
|
||||
if (m_buffer==NULL) {
|
||||
if (m_buffer==nullptr) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
return m_buffer->getEndLine(_pos);
|
||||
|
@ -17,57 +17,30 @@
|
||||
#undef __class__
|
||||
#define __class__ "ViewerManager"
|
||||
|
||||
appl::ViewerManager::ViewerManager() :
|
||||
ewol::Resource("???ViewerManager???"),
|
||||
m_viewer(NULL) {
|
||||
appl::ViewerManager::ViewerManager() {
|
||||
addObjectType("appl::ViewerManager");
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
}
|
||||
|
||||
void appl::ViewerManager::init(const std::string& _uniqueName) {
|
||||
ewol::Resource::init(_uniqueName);
|
||||
}
|
||||
|
||||
appl::ViewerManager::~ViewerManager() {
|
||||
|
||||
}
|
||||
|
||||
bool appl::ViewerManager::isLastSelected(const ewol::object::Shared<appl::TextViewer>& _viewer) {
|
||||
return m_viewer == _viewer;
|
||||
bool appl::ViewerManager::isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer) {
|
||||
return m_viewer.lock() == _viewer;
|
||||
}
|
||||
|
||||
void appl::ViewerManager::setViewerSelected(const ewol::object::Shared<appl::TextViewer>& _viewer, const ewol::object::Shared<appl::Buffer>& _buffer) {
|
||||
if (m_viewer == _viewer) {
|
||||
void appl::ViewerManager::setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer) {
|
||||
if (m_viewer.lock() == _viewer) {
|
||||
return;
|
||||
}
|
||||
m_viewer = _viewer;
|
||||
if (m_bufferManager != NULL) {
|
||||
if (m_bufferManager != nullptr) {
|
||||
m_bufferManager->setBufferSelected(_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::ViewerManager::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_DEBUG("receive message !!! " << _msg);
|
||||
}
|
||||
|
||||
void appl::ViewerManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::Resource:: onObjectRemove(_removeObject);
|
||||
if (_removeObject == m_viewer) {
|
||||
m_viewer.reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ewol::object::Shared<appl::ViewerManager> appl::ViewerManager::keep() {
|
||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
||||
ewol::object::Shared<appl::ViewerManager> object = ewol::dynamic_pointer_cast<appl::ViewerManager>(getManager().localKeep("???ViewerManager???"));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
// this element create a new one every time ....
|
||||
EWOL_INFO("CREATE : appl::ViewerManager: ???ViewerManager???");
|
||||
object = ewol::object::makeShared(new appl::ViewerManager());
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ???ViewerManager???");
|
||||
return NULL;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -20,41 +20,32 @@ namespace appl {
|
||||
class ViewerManager : public ewol::Resource {
|
||||
protected:
|
||||
ViewerManager();
|
||||
void init(const std::string& _uniqueName);
|
||||
public:
|
||||
DECLARE_RESOURCE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???");
|
||||
virtual ~ViewerManager();
|
||||
private:
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::TextViewer> m_viewer;
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::weak_ptr<appl::TextViewer> m_viewer;
|
||||
public:
|
||||
/**
|
||||
* @brief Set the current buffer selected
|
||||
* @param[in] _viewer Pointer on the viewer selected
|
||||
*/
|
||||
void setViewerSelected(const ewol::object::Shared<appl::TextViewer>& _viewer, const ewol::object::Shared<appl::Buffer>& _buffer);
|
||||
void setViewerSelected(const std::shared_ptr<appl::TextViewer>& _viewer, const std::shared_ptr<appl::Buffer>& _buffer);
|
||||
/**
|
||||
* @brief Get the current buffer selected
|
||||
* @return Pointer on the buffer selected
|
||||
*/
|
||||
ewol::object::Shared<appl::TextViewer> getViewerSelected() {
|
||||
return m_viewer;
|
||||
std::shared_ptr<appl::TextViewer> getViewerSelected() {
|
||||
return m_viewer.lock();
|
||||
};
|
||||
/**
|
||||
* @breif Check if the element is the last request selection
|
||||
* @param[in] _viewer element selected.
|
||||
* @return true if the element is selected
|
||||
*/
|
||||
bool isLastSelected(const ewol::object::Shared<appl::TextViewer>& _viewer);
|
||||
public: // herited function
|
||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
public: // resource manager
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
* @note Never free this pointer by your own...
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or NULL if an error occured.
|
||||
*/
|
||||
static ewol::object::Shared<appl::ViewerManager> keep();
|
||||
bool isLastSelected(const std::shared_ptr<appl::TextViewer>& _viewer);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -15,26 +15,28 @@
|
||||
|
||||
static const char* s_closeDone = "close-done";
|
||||
|
||||
appl::WorkerCloseAllFile::WorkerCloseAllFile() :
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
appl::WorkerCloseAllFile::WorkerCloseAllFile() {
|
||||
addObjectType("appl::WorkerCloseAllFile");
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
}
|
||||
|
||||
if (m_bufferManager == NULL) {
|
||||
void appl::WorkerCloseAllFile::init() {
|
||||
ewol::Object::init();
|
||||
if (m_bufferManager == nullptr) {
|
||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
// List all current open file :
|
||||
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||
if (tmpBuffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||
if (tmpBuffer == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (tmpBuffer->isModify() == false) {
|
||||
tmpBuffer->removeObject();
|
||||
APPL_TODO("destroy object");
|
||||
tmpBuffer->destroy();
|
||||
continue;
|
||||
}
|
||||
m_bufferNameList.push_back(tmpBuffer->getFileName());
|
||||
@ -45,14 +47,14 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile() :
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerCloseFile(m_bufferNameList.front()));
|
||||
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(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||
m_worker->registerOnEvent(shared_from_this(), appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||
}
|
||||
|
||||
appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
|
||||
@ -60,7 +62,7 @@ appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
|
||||
}
|
||||
|
||||
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
if (m_bufferManager == NULL) {
|
||||
if (m_bufferManager == nullptr) {
|
||||
// nothing to do in this case ==> can do nothing ...
|
||||
return;
|
||||
}
|
||||
@ -70,25 +72,14 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerCloseFile(m_bufferNameList.front()));
|
||||
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(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerCloseAllFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_worker) {
|
||||
m_worker = NULL;
|
||||
APPL_VERBOSE("AutoRemove After saving sub widget ...");
|
||||
autoDestroy();
|
||||
} else if (_removeObject == m_bufferManager) {
|
||||
m_bufferManager = NULL;
|
||||
autoDestroy();
|
||||
m_worker->registerOnEvent(shared_from_this(), appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,16 +14,18 @@
|
||||
|
||||
namespace appl {
|
||||
class WorkerCloseAllFile : public ewol::Object {
|
||||
public:
|
||||
protected:
|
||||
WorkerCloseAllFile();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(WorkerCloseAllFile);
|
||||
virtual ~WorkerCloseAllFile();
|
||||
private:
|
||||
std::vector<std::string> m_bufferNameList;
|
||||
ewol::object::Shared<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -21,25 +21,28 @@ static const char* s_saveValidate = "save-validate";
|
||||
static const char* s_closeValidate = "close-validate";
|
||||
static const char* s_saveAsDone = "save-as-done";
|
||||
|
||||
appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
m_bufferName(_bufferName),
|
||||
m_buffer(NULL),
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
appl::WorkerCloseFile::WorkerCloseFile() :
|
||||
m_buffer(nullptr),
|
||||
m_worker(nullptr),
|
||||
m_bufferManager(nullptr) {
|
||||
addObjectType("appl::WorkerCloseFile");
|
||||
addEventId(eventCloseDone);
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
}
|
||||
|
||||
if (m_bufferManager == NULL) {
|
||||
void appl::WorkerCloseFile::init(const std::string& _bufferName) {
|
||||
ewol::Object::init();
|
||||
m_bufferName = _bufferName;
|
||||
if (m_bufferManager == nullptr) {
|
||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
if (m_bufferName == "") {
|
||||
// need to find the curent file ...
|
||||
ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == nullptr) {
|
||||
APPL_ERROR("No selected buffer now ...");
|
||||
autoDestroy();
|
||||
return;
|
||||
@ -52,43 +55,43 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
return;
|
||||
}
|
||||
m_buffer = m_bufferManager->get(m_bufferName);
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
if (m_buffer->isModify() == false) {
|
||||
generateEventId(eventCloseDone);
|
||||
m_buffer->removeObject();
|
||||
m_buffer->destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
ewol::object::Shared<ewol::widget::StdPopUp> tmpPopUp = ewol::object::makeShared(new ewol::widget::StdPopUp());
|
||||
if (tmpPopUp == NULL) {
|
||||
std::shared_ptr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
|
||||
if (tmpPopUp == nullptr) {
|
||||
APPL_ERROR("Can not create a simple pop-up");
|
||||
return;
|
||||
}
|
||||
tmpPopUp->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...");
|
||||
ewol::object::Shared<ewol::Widget> bt = NULL;
|
||||
std::shared_ptr<ewol::Widget> bt = nullptr;
|
||||
if (m_buffer->hasFileName() == true) {
|
||||
bt = tmpPopUp->addButton("Save", true);
|
||||
if (bt != NULL) {
|
||||
bt->registerOnEvent(this, "pressed", s_saveValidate);
|
||||
if (bt != nullptr) {
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", s_saveValidate);
|
||||
}
|
||||
}
|
||||
bt = tmpPopUp->addButton("Save As", true);
|
||||
if (bt != NULL) {
|
||||
bt->registerOnEvent(this, "pressed", s_saveAsValidate);
|
||||
if (bt != nullptr) {
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", s_saveAsValidate);
|
||||
}
|
||||
bt = tmpPopUp->addButton("Close", true);
|
||||
if (bt != NULL) {
|
||||
bt->registerOnEvent(this, "pressed", s_closeValidate);
|
||||
if (bt != nullptr) {
|
||||
bt->registerOnEvent(shared_from_this(), "pressed", s_closeValidate);
|
||||
}
|
||||
tmpPopUp->addButton("Cancel", true);
|
||||
tmpPopUp->setRemoveOnExternClick(true);
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == nullptr) {
|
||||
APPL_ERROR("Error to get the windows.");
|
||||
autoDestroy();
|
||||
return;
|
||||
@ -101,25 +104,25 @@ appl::WorkerCloseFile::~WorkerCloseFile() {
|
||||
}
|
||||
|
||||
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
if (m_bufferManager == NULL) {
|
||||
if (m_bufferManager == nullptr) {
|
||||
// nothing to do in this case ==> can do nothing ...
|
||||
return;
|
||||
}
|
||||
APPL_DEBUG("have message : " << _msg);
|
||||
if (_msg.getMessage() == s_saveAsValidate) {
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerSaveFile(m_bufferName));
|
||||
if (m_worker != NULL) {
|
||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
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 == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
if (m_buffer->storeFile() == false) {
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
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>");
|
||||
@ -128,27 +131,14 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
}
|
||||
} else if ( _msg.getMessage() == s_closeValidate
|
||||
|| _msg.getMessage() == s_saveAsDone) {
|
||||
if (m_buffer == NULL) {
|
||||
if (m_buffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
generateEventId(eventCloseDone);
|
||||
m_buffer->removeObject();
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerCloseFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_worker) {
|
||||
m_worker = NULL;
|
||||
APPL_VERBOSE("AutoRemove After closing sub widget ...");
|
||||
autoDestroy();
|
||||
} else if (_removeObject == m_bufferManager) {
|
||||
m_bufferManager = NULL;
|
||||
autoDestroy();
|
||||
} else if (_removeObject == m_buffer) {
|
||||
m_buffer = NULL;
|
||||
autoDestroy();
|
||||
m_buffer->destroy();
|
||||
m_buffer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,18 +17,20 @@ namespace appl {
|
||||
class WorkerCloseFile : public ewol::Object {
|
||||
public:
|
||||
static const char* eventCloseDone;
|
||||
public:
|
||||
protected:
|
||||
// note : if == "" ==> current ...
|
||||
WorkerCloseFile(const std::string& _bufferName);
|
||||
WorkerCloseFile();
|
||||
void init(const std::string& _bufferName);
|
||||
public:
|
||||
DECLARE_FACTORY(WorkerCloseFile);
|
||||
virtual ~WorkerCloseFile();
|
||||
private:
|
||||
std::string m_bufferName;
|
||||
ewol::object::Shared<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
|
||||
ewol::object::Shared<appl::WorkerSaveFile> m_worker; //! sub-worker element...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
|
||||
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -15,22 +15,23 @@
|
||||
|
||||
static const char* s_saveAsDone = "save-as-done";
|
||||
|
||||
appl::WorkerSaveAllFile::WorkerSaveAllFile() :
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
appl::WorkerSaveAllFile::WorkerSaveAllFile() {
|
||||
addObjectType("appl::WorkerSaveAllFile");
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
}
|
||||
|
||||
if (m_bufferManager == NULL) {
|
||||
void appl::WorkerSaveAllFile::init() {
|
||||
ewol::Object::init();
|
||||
if (m_bufferManager == nullptr) {
|
||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
// List all current open file :
|
||||
for (int32_t iii=0; iii<m_bufferManager->size(); ++iii) {
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||
if (tmpBuffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||
if (tmpBuffer == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (tmpBuffer->isModify() == false) {
|
||||
@ -48,14 +49,14 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile() :
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerSaveFile(m_bufferNameList.front()));
|
||||
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
|
||||
// remove first element :
|
||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||
if (m_bufferNameList.size() == 0) {
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
}
|
||||
|
||||
appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
|
||||
@ -63,7 +64,7 @@ appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
|
||||
}
|
||||
|
||||
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
if (m_bufferManager == NULL) {
|
||||
if (m_bufferManager == nullptr) {
|
||||
// nothing to do in this case ==> can do nothing ...
|
||||
return;
|
||||
}
|
||||
@ -73,25 +74,14 @@ void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = new appl::WorkerSaveFile(m_bufferNameList.front());
|
||||
m_worker = appl::WorkerSaveFile::create(m_bufferNameList.front());
|
||||
// remove first element :
|
||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||
if (m_bufferNameList.size() == 0) {
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerSaveAllFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_worker) {
|
||||
m_worker = NULL;
|
||||
APPL_VERBOSE("AutoRemove After saving sub widget ...");
|
||||
autoDestroy();
|
||||
} else if (_removeObject == m_bufferManager) {
|
||||
m_bufferManager = NULL;
|
||||
autoDestroy();
|
||||
m_worker->registerOnEvent(shared_from_this(), appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,16 +14,18 @@
|
||||
|
||||
namespace appl {
|
||||
class WorkerSaveAllFile : public ewol::Object {
|
||||
public:
|
||||
protected:
|
||||
WorkerSaveAllFile();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(WorkerSaveAllFile);
|
||||
virtual ~WorkerSaveAllFile();
|
||||
private:
|
||||
std::vector<std::string> m_bufferNameList;
|
||||
ewol::object::Shared<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
std::shared_ptr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -17,24 +17,25 @@ const char* appl::WorkerSaveFile::eventSaveDone = "save-file-done";
|
||||
|
||||
static const char* s_saveAsValidate = "save-as-validate";
|
||||
|
||||
appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _forceSaveAs) :
|
||||
m_bufferName(_bufferName),
|
||||
m_chooser(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
appl::WorkerSaveFile::WorkerSaveFile() {
|
||||
addObjectType("appl::WorkerSaveFile");
|
||||
addEventId(eventSaveDone);
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
}
|
||||
|
||||
if (m_bufferManager == NULL) {
|
||||
void appl::WorkerSaveFile::init(const std::string& _bufferName, bool _forceSaveAs) {
|
||||
ewol::Object::init();
|
||||
m_bufferName = _bufferName;
|
||||
if (m_bufferManager == nullptr) {
|
||||
APPL_ERROR("can not call unexistant buffer manager ... ");
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
if (m_bufferName == "") {
|
||||
// need to find the curent file ...
|
||||
ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == nullptr) {
|
||||
APPL_ERROR("No selected buffer now ...");
|
||||
autoDestroy();
|
||||
return;
|
||||
@ -46,8 +47,8 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||
if (tmpBuffer == NULL) {
|
||||
std::shared_ptr<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||
if (tmpBuffer == nullptr) {
|
||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||
autoDestroy();
|
||||
return;
|
||||
@ -60,8 +61,8 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_chooser = ewol::object::makeShared(new ewol::widget::FileChooser());
|
||||
if (NULL == m_chooser) {
|
||||
m_chooser = ewol::widget::FileChooser::create();
|
||||
if (nullptr == m_chooser) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
autoDestroy();
|
||||
return;
|
||||
@ -71,14 +72,14 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
etk::FSNode tmpName(m_bufferName);
|
||||
m_chooser->setFolder(tmpName.getNameFolder());
|
||||
m_chooser->setFileName(tmpName.getNameFile());
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
std::shared_ptr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == nullptr) {
|
||||
APPL_ERROR("Error to get the windows.");
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
tmpWindows->popUpWidgetPush(m_chooser);
|
||||
m_chooser->registerOnEvent(this, ewol::widget::FileChooser::eventValidate, s_saveAsValidate);
|
||||
m_chooser->registerOnEvent(shared_from_this(), ewol::widget::FileChooser::eventValidate, s_saveAsValidate);
|
||||
}
|
||||
|
||||
appl::WorkerSaveFile::~WorkerSaveFile() {
|
||||
@ -86,7 +87,7 @@ appl::WorkerSaveFile::~WorkerSaveFile() {
|
||||
}
|
||||
|
||||
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
if (m_bufferManager == NULL) {
|
||||
if (m_bufferManager == nullptr) {
|
||||
// nothing to do in this case ==> can do nothing ...
|
||||
return;
|
||||
}
|
||||
@ -99,15 +100,15 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
|
||||
return;
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||
if (tmpBuffer == NULL) {
|
||||
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) {
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
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>");
|
||||
@ -117,14 +118,3 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerSaveFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_chooser) {
|
||||
m_chooser = NULL;
|
||||
APPL_VERBOSE("AutoRemove After closing sub widget ...");
|
||||
autoDestroy();
|
||||
} else if (_removeObject == m_bufferManager) {
|
||||
m_bufferManager = NULL;
|
||||
autoDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,16 +16,18 @@ namespace appl {
|
||||
class WorkerSaveFile : public ewol::Object {
|
||||
public:
|
||||
static const char* eventSaveDone;
|
||||
protected:
|
||||
WorkerSaveFile();
|
||||
void init(const std::string& _bufferName, bool _forceSaveAs=true);
|
||||
public:
|
||||
WorkerSaveFile(const std::string& _bufferName, bool _forceSaveAs=true);
|
||||
DECLARE_FACTORY(WorkerSaveFile);
|
||||
virtual ~WorkerSaveFile();
|
||||
private:
|
||||
std::string m_bufferName;
|
||||
ewol::object::Shared<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
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);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -35,12 +35,15 @@ void appl::Highlight::parseRules(exml::Element* _child,
|
||||
_mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
|
||||
}
|
||||
|
||||
appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) :
|
||||
ewol::Resource(_xmlFilename),
|
||||
m_typeName("") {
|
||||
appl::Highlight::Highlight() {
|
||||
addObjectType("appl::Highlight");
|
||||
}
|
||||
|
||||
void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _colorFile) {
|
||||
ewol::Resource::init(_xmlFilename);
|
||||
|
||||
// keep color propertiy file :
|
||||
m_paintingProperties = appl::GlyphPainting::keep(_colorFile);
|
||||
m_paintingProperties = appl::GlyphPainting::create(_colorFile);
|
||||
|
||||
exml::Document doc;
|
||||
if (doc.load(_xmlFilename) == false) {
|
||||
@ -48,7 +51,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
return;
|
||||
}
|
||||
exml::Element* root = doc.getNamed("EdnLang");
|
||||
if (NULL == root ) {
|
||||
if (nullptr == root ) {
|
||||
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ...");
|
||||
return;
|
||||
}
|
||||
@ -58,7 +61,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
// parse all the elements :
|
||||
for(size_t iii = 0; iii < root->size(); ++iii) {
|
||||
exml::Element* child = root->getElement(iii);
|
||||
if (child == NULL) {
|
||||
if (child == nullptr) {
|
||||
// trash here all that is not element ...
|
||||
continue;
|
||||
}
|
||||
@ -72,7 +75,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
// get sub Nodes ...
|
||||
for(size_t jjj=0; jjj< child->size(); jjj++) {
|
||||
exml::Element* passChild = child->getElement(jjj);
|
||||
if (passChild == NULL) {
|
||||
if (passChild == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (passChild->getValue() != "rule") {
|
||||
@ -85,7 +88,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
// get sub Nodes ...
|
||||
for(size_t jjj=0; jjj< child->size(); jjj++) {
|
||||
exml::Element* passChild = child->getElement(jjj);
|
||||
if (passChild == NULL) {
|
||||
if (passChild == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (passChild->getValue() != "rule") {
|
||||
@ -177,22 +180,22 @@ void appl::Highlight::parse(int64_t _start,
|
||||
//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 << ")" );
|
||||
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj]->getPaternString());
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer);
|
||||
if (HLP_FIND_ERROR != ret) {
|
||||
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
||||
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ")" );
|
||||
// remove element in the current List where the current Element have a end inside the next...
|
||||
int64_t kkk=_addingPos;
|
||||
while(kkk < (int64_t)_metaData.size() ) {
|
||||
if (_metaData[kkk].beginStart <= resultat.endStop) {
|
||||
if (_metaData[kkk].start <= resultat.stop) {
|
||||
// remove element
|
||||
HL_DEBUG("Erase element=" << kkk);
|
||||
_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
|
||||
elementStop = _metaData[kkk].beginStart-1;
|
||||
elementStop = _metaData[kkk].start-1;
|
||||
} else {
|
||||
// end of the buffer
|
||||
elementStop = _buffer.size();
|
||||
@ -204,9 +207,9 @@ void appl::Highlight::parse(int64_t _start,
|
||||
}
|
||||
// add curent element in the list ...
|
||||
_metaData.insert(_metaData.begin()+_addingPos, resultat);
|
||||
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
|
||||
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.start << " E=" << resultat.stop );
|
||||
// update the current research starting element: (set position at the end of the current element
|
||||
elementStart = resultat.endStop-1;
|
||||
elementStart = resultat.stop-1;
|
||||
// increment the position of insertion:
|
||||
_addingPos++;
|
||||
// We find a pattern == > Stop search for the current element
|
||||
@ -234,19 +237,23 @@ void appl::Highlight::parse2(int64_t _start,
|
||||
appl::HighlightInfo resultat;
|
||||
|
||||
while (elementStart < elementStop) {
|
||||
if (elementStart == 306) {
|
||||
//etk::log::setLevel(etk::log::logLevelVerbose);
|
||||
}
|
||||
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
|
||||
//try to fond the HL in ALL of we have
|
||||
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass2.size(); jjj++){
|
||||
enum resultFind ret = HLP_FIND_OK;
|
||||
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
|
||||
_start << "," << _buffer.size() << ")" );
|
||||
elementStart << "," << elementStop << ") in='"
|
||||
<< _buffer[elementStart] << "' " << m_listHighlightPass2[jjj]->getPaternString());
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer);
|
||||
if (HLP_FIND_ERROR != ret) {
|
||||
HL2_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
||||
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.endStop-1;
|
||||
elementStart = resultat.stop-1;
|
||||
// Exit current cycle
|
||||
break;
|
||||
}
|
||||
@ -255,21 +262,3 @@ void appl::Highlight::parse2(int64_t _start,
|
||||
elementStart++;
|
||||
}
|
||||
}
|
||||
|
||||
ewol::object::Shared<appl::Highlight> appl::Highlight::keep(const std::string& _filename) {
|
||||
//EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\"");
|
||||
ewol::object::Shared<appl::Highlight> object = ewol::dynamic_pointer_cast<appl::Highlight>(getManager().localKeep(_filename));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
EWOL_INFO("CREATE : appl::Highlight : file : \"" << _filename << "\"");
|
||||
// this element create a new one every time ....
|
||||
object = ewol::object::makeShared(new appl::Highlight(_filename, "THEME:COLOR:textViewer.json"));
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ??Highlight??");
|
||||
return NULL;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,8 @@ namespace appl {
|
||||
|
||||
class HighlightInfo {
|
||||
public:
|
||||
int32_t beginStart;
|
||||
int32_t beginStop;
|
||||
int32_t endStart;
|
||||
int32_t endStop;
|
||||
int32_t start;
|
||||
int32_t stop;
|
||||
bool notEnded;
|
||||
appl::HighlightPattern* patern; // pointer on class :
|
||||
};
|
||||
@ -35,11 +33,13 @@ namespace appl {
|
||||
namespace appl {
|
||||
class Highlight : public ewol::Resource {
|
||||
private:
|
||||
ewol::object::Shared<appl::GlyphPainting> m_paintingProperties;
|
||||
protected:
|
||||
// Constructeur
|
||||
Highlight(const std::string& _xmlFilename, const std::string& _colorFile);
|
||||
std::shared_ptr<appl::GlyphPainting> m_paintingProperties;
|
||||
public:
|
||||
// Constructeur
|
||||
Highlight();
|
||||
void init(const std::string& _xmlFilename, const std::string& _colorFile = "THEME:COLOR:textViewer.json");
|
||||
public:
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(Highlight);
|
||||
virtual ~Highlight();
|
||||
private:
|
||||
std::string m_typeName; //!< descriptive string type like "C/C++"
|
||||
@ -68,14 +68,6 @@ namespace appl {
|
||||
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)) )
|
||||
public:
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
* @note Never free this pointer by your own...
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or NULL if an error occured.
|
||||
*/
|
||||
static ewol::object::Shared<appl::Highlight> keep(const std::string& _filename);
|
||||
public: // herited function :
|
||||
virtual void updateContext() {
|
||||
// no upfate to do ...
|
||||
|
@ -17,14 +17,14 @@
|
||||
|
||||
// TODO : Review this in a generic unique resource ...
|
||||
|
||||
static std::vector<ewol::object::Shared<appl::Highlight>>& s_list() {
|
||||
static std::vector<ewol::object::Shared<appl::Highlight>> list;
|
||||
static std::vector<std::shared_ptr<appl::Highlight>>& s_list() {
|
||||
static std::vector<std::shared_ptr<appl::Highlight>> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
void appl::highlightManager::init() {
|
||||
std::vector<ewol::object::Shared<appl::Highlight>>& hlList = s_list();
|
||||
std::vector<std::shared_ptr<appl::Highlight>>& hlList = s_list();
|
||||
if (hlList.size() != 0) {
|
||||
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
||||
hlList.clear();
|
||||
@ -34,7 +34,7 @@ void appl::highlightManager::init() {
|
||||
// get the subfolder list :
|
||||
std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false);
|
||||
for (auto &it : list) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->getNodeType() != etk::FSN_FOLDER) {
|
||||
@ -42,8 +42,8 @@ void appl::highlightManager::init() {
|
||||
}
|
||||
std::string filename = it->getName() + "/highlight.xml";
|
||||
APPL_DEBUG("Load xml name : " << filename);
|
||||
ewol::object::Shared<appl::Highlight> myHightLine = appl::Highlight::keep(filename);
|
||||
if (myHightLine != NULL) {
|
||||
std::shared_ptr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
|
||||
if (myHightLine != nullptr) {
|
||||
hlList.push_back(myHightLine);
|
||||
} else {
|
||||
APPL_ERROR("Can not allocate HighLight");
|
||||
@ -52,7 +52,7 @@ void appl::highlightManager::init() {
|
||||
// display :
|
||||
/*
|
||||
for (auto &it : hlList) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
it->display();
|
||||
@ -61,7 +61,7 @@ void appl::highlightManager::init() {
|
||||
}
|
||||
|
||||
void appl::highlightManager::unInit() {
|
||||
std::vector<ewol::object::Shared<Highlight>>& hlList = s_list();
|
||||
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
|
||||
if (hlList.size() == 0) {
|
||||
APPL_DEBUG("HighlightManager ==> no highlight");
|
||||
hlList.clear();
|
||||
@ -75,9 +75,9 @@ std::string appl::highlightManager::getTypeExtention(const std::string& _extenti
|
||||
return "";
|
||||
}
|
||||
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
|
||||
std::vector<ewol::object::Shared<Highlight>>& hlList = s_list();
|
||||
std::vector<std::shared_ptr<Highlight>>& hlList = s_list();
|
||||
for (auto &it : hlList) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
APPL_DEBUG(" check : " << it->getTypeName());
|
||||
@ -95,7 +95,7 @@ std::string appl::highlightManager::getFileWithTypeType(const std::string& _type
|
||||
return "";
|
||||
}
|
||||
for (auto &it : s_list()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->getTypeName() == _type) {
|
||||
|
@ -13,43 +13,27 @@
|
||||
#undef __class__
|
||||
#define __class__ "HighlightPattern"
|
||||
|
||||
appl::HighlightPattern::HighlightPattern(const ewol::object::Shared<appl::GlyphPainting>& _glyphPainting) :
|
||||
appl::HighlightPattern::HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting) :
|
||||
m_glyphPainting(_glyphPainting),
|
||||
m_paternName(""),
|
||||
m_regExpStart(nullptr),
|
||||
m_regExpStop(nullptr),
|
||||
m_regExp(nullptr),
|
||||
m_colorName(""),
|
||||
m_escapeChar(u32char::Null),
|
||||
m_multiline(false),
|
||||
m_level(0) {
|
||||
m_regExpStart = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
|
||||
m_regExp = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
|
||||
}
|
||||
|
||||
appl::HighlightPattern::~HighlightPattern() {
|
||||
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
|
||||
if (m_regExpStart == NULL) {
|
||||
void appl::HighlightPattern::setPatern(std::string& _regExp) {
|
||||
if (m_regExp == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_regExpStart->compile(_regExp);
|
||||
m_regExp->compile(_regExp);
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
|
||||
m_regExpStop.reset();
|
||||
if (_regExp.size() != 0) {
|
||||
m_regExpStop = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
|
||||
if (m_regExpStop != NULL) {
|
||||
m_regExpStop->compile(_regExp);
|
||||
} else {
|
||||
APPL_ERROR("Allocation error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setEscapeChar(const char32_t& _EscapeChar) {
|
||||
m_escapeChar = _EscapeChar;
|
||||
std::string appl::HighlightPattern::getPaternString() {
|
||||
return m_regExp->getRegExDecorated();
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
|
||||
@ -59,17 +43,9 @@ 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(" == > regExpStart \"" << m_regExpStart->getRegExp() << "\"");
|
||||
if (m_regExpStop != NULL) {
|
||||
APPL_INFO(" == > regExpStop \"" << m_regExpStop->getRegExp() << "\"");
|
||||
}
|
||||
if (m_multiline == true) {
|
||||
APPL_INFO(" == > multiline pattern: YES");
|
||||
} else {
|
||||
APPL_INFO(" == > multiline pattern: NO");
|
||||
}
|
||||
APPL_INFO("patern : '" << m_paternName << "' level=" << m_level );
|
||||
APPL_INFO(" == > colorName '" << m_colorName << "'");
|
||||
APPL_INFO(" == > regExp '" << m_regExp->getRegExp() << "'");
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||
@ -77,9 +53,7 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||
/*
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>$</end>
|
||||
<multiline>yes</multiline>
|
||||
<regex>#</regex>
|
||||
</rule>
|
||||
*/
|
||||
//--------------------------------------------------------------------------------------------
|
||||
@ -93,7 +67,7 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||
setLevel(_level);
|
||||
|
||||
exml::Element* xChild = _child->getNamed("color");
|
||||
if (NULL != xChild) {
|
||||
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);
|
||||
@ -101,30 +75,13 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||
setColorGlyph(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = _child->getNamed("start");
|
||||
if (NULL != xChild) {
|
||||
xChild = _child->getNamed("regex");
|
||||
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);
|
||||
std::string myEdnData = myData;
|
||||
setPaternStart(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = _child->getNamed("end");
|
||||
if (NULL != xChild) {
|
||||
std::string myData = xChild->getText();
|
||||
if (myData.size() != 0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
std::string myEdnData = myData;
|
||||
setPaternStop(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = _child->getNamed("EscapeChar");
|
||||
if (NULL != xChild) {
|
||||
std::string myData = xChild->getText();
|
||||
if (myData.size() != 0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
setEscapeChar(myData[0]);
|
||||
setPatern(myEdnData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,41 +92,17 @@ enum resultFind appl::HighlightPattern::find(int32_t _start,
|
||||
appl::HighlightInfo& _resultat,
|
||||
etk::Buffer& _buffer) {
|
||||
//APPL_DEBUG(" try to find the element");
|
||||
_resultat.beginStart = -1;
|
||||
_resultat.beginStop = -1;
|
||||
_resultat.endStart = -1;
|
||||
_resultat.endStop = -1;
|
||||
_resultat.start = -1;
|
||||
_resultat.stop = -1;
|
||||
_resultat.notEnded = false;
|
||||
_resultat.patern = this;
|
||||
|
||||
// when we have only one element:
|
||||
if (m_regExpStop == NULL) {
|
||||
if (true == m_regExpStart->processOneElement(_buffer, _start, _stop)) {
|
||||
_resultat.beginStart = m_regExpStart->start();
|
||||
_resultat.beginStop = m_regExpStart->stop();
|
||||
_resultat.endStart = m_regExpStart->start();
|
||||
_resultat.endStop = m_regExpStart->stop();
|
||||
if (true == m_regExp->processOneElement(_buffer, _start, _stop)) {
|
||||
_resultat.start = m_regExp->start();
|
||||
_resultat.stop = m_regExp->stop();
|
||||
return HLP_FIND_OK;
|
||||
}
|
||||
//APPL_DEBUG("NOT find hightlightpatern ...");
|
||||
return HLP_FIND_ERROR;
|
||||
}
|
||||
// try while we find the first element
|
||||
if (m_regExpStart->processOneElement(_buffer, _start, _stop, m_escapeChar) == false) {
|
||||
return HLP_FIND_ERROR;
|
||||
}
|
||||
_resultat.beginStart = m_regExpStart->start();
|
||||
_resultat.beginStop = m_regExpStart->stop();
|
||||
if (m_regExpStop->parse(_buffer, _resultat.beginStop, _stop, m_escapeChar) == true) {
|
||||
_resultat.endStart = m_regExpStop->start();
|
||||
_resultat.endStop = m_regExpStop->stop();
|
||||
return HLP_FIND_OK;
|
||||
} else {
|
||||
_resultat.endStart = _stop+1;
|
||||
_resultat.endStop = _stop+1;
|
||||
_resultat.notEnded = true;
|
||||
return HLP_FIND_OK_NO_END;
|
||||
}
|
||||
//APPL_DEBUG("NOT find start hightlightpatern ...");
|
||||
return HLP_FIND_ERROR;
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ enum resultFind {
|
||||
namespace appl {
|
||||
class HighlightPattern {
|
||||
private:
|
||||
ewol::object::Shared<appl::GlyphPainting> m_glyphPainting;
|
||||
std::shared_ptr<appl::GlyphPainting> m_glyphPainting;
|
||||
public:
|
||||
// Constructeur
|
||||
HighlightPattern(const ewol::object::Shared<appl::GlyphPainting>& _glyphPainting);
|
||||
HighlightPattern(const std::shared_ptr<appl::GlyphPainting>& _glyphPainting);
|
||||
virtual ~HighlightPattern();
|
||||
private:
|
||||
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||
@ -44,13 +44,10 @@ namespace appl {
|
||||
return m_paternName;
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExpStart; //!< Start of Regular expression
|
||||
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExp; //!< Start of Regular expression
|
||||
public:
|
||||
void setPaternStart(std::string& _regExp);
|
||||
private:
|
||||
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExpStop; //!< Stop of Regular Expression
|
||||
public:
|
||||
void setPaternStop(std::string& _regExp);
|
||||
void setPatern(std::string& _regExp);
|
||||
std::string getPaternString();
|
||||
private:
|
||||
std::string m_colorName; //!< Current color name
|
||||
int32_t m_colorId; //!< Id of the the glyph painting
|
||||
@ -59,16 +56,6 @@ namespace appl {
|
||||
const appl::GlyphDecoration& getColorGlyph() {
|
||||
return (*m_glyphPainting)[m_colorId];
|
||||
};
|
||||
private:
|
||||
char32_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
||||
public:
|
||||
void setEscapeChar(const char32_t& _EscapeChar);
|
||||
private:
|
||||
bool m_multiline; //!< The patern is multiline
|
||||
public:
|
||||
void setMultiline(bool _enable) {
|
||||
m_multiline = _enable;
|
||||
};
|
||||
private:
|
||||
int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher ....
|
||||
public:
|
||||
|
@ -26,6 +26,10 @@ appl::TextViewerPlugin::TextViewerPlugin() :
|
||||
addObjectType("appl::TextViewerPlugin");
|
||||
}
|
||||
|
||||
void appl::TextViewerPlugin::init() {
|
||||
ewol::Object::init();
|
||||
}
|
||||
|
||||
appl::TextViewerPlugin::~TextViewerPlugin() {
|
||||
if (m_isEnable == false) {
|
||||
return;
|
||||
|
@ -17,8 +17,11 @@
|
||||
namespace appl {
|
||||
class TextViewerPlugin : public ewol::Object {
|
||||
friend class appl::TextViewer;
|
||||
public:
|
||||
protected:
|
||||
TextViewerPlugin();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextViewerPlugin);
|
||||
virtual ~TextViewerPlugin();
|
||||
private:
|
||||
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
||||
|
@ -20,6 +20,10 @@ appl::TextPluginAutoIndent::TextPluginAutoIndent() {
|
||||
addObjectType("appl::TextPluginAutoIndent");
|
||||
}
|
||||
|
||||
void appl::TextPluginAutoIndent::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Entry& _event) {
|
||||
if (isEnable() == false) {
|
||||
|
@ -17,8 +17,11 @@
|
||||
|
||||
namespace appl {
|
||||
class TextPluginAutoIndent : public appl::TextViewerPlugin {
|
||||
public:
|
||||
protected:
|
||||
TextPluginAutoIndent();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginAutoIndent);
|
||||
virtual ~TextPluginAutoIndent() {
|
||||
// nothing to do ...
|
||||
};
|
||||
|
@ -20,6 +20,10 @@ appl::TextPluginCopy::TextPluginCopy() {
|
||||
addObjectType("appl::TextPluginCopy");
|
||||
}
|
||||
|
||||
void appl::TextPluginCopy::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiCopy);
|
||||
|
@ -17,8 +17,11 @@
|
||||
|
||||
namespace appl {
|
||||
class TextPluginCopy : public appl::TextViewerPlugin {
|
||||
public:
|
||||
protected:
|
||||
TextPluginCopy();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginCopy);
|
||||
virtual ~TextPluginCopy() {
|
||||
// nothing to do ...
|
||||
};
|
||||
|
@ -21,12 +21,18 @@
|
||||
appl::TextPluginCtags::TextPluginCtags() :
|
||||
m_tagFolderBase(""),
|
||||
m_tagFilename(""),
|
||||
m_ctagFile(NULL) {
|
||||
m_ctagFile(nullptr) {
|
||||
m_activateOnReceiveMessage = true;
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
addObjectType("appl::TextPluginCtags");
|
||||
}
|
||||
|
||||
void appl::TextPluginCtags::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
|
||||
appl::TextPluginCtags::~TextPluginCtags() {
|
||||
|
||||
}
|
||||
@ -58,7 +64,7 @@ void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
}
|
||||
|
||||
void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
||||
if (m_ctagFile == NULL) {
|
||||
if (m_ctagFile == nullptr) {
|
||||
APPL_WARNING("No ctags file open");
|
||||
return;
|
||||
}
|
||||
@ -79,8 +85,8 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
||||
|
||||
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
|
||||
APPL_INFO("Multiple file destination ...");
|
||||
ewol::object::Shared<appl::TagFileSelection> tmpWidget = ewol::object::makeShared(new appl::TagFileSelection());
|
||||
if (NULL == tmpWidget) {
|
||||
std::shared_ptr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
|
||||
if (nullptr == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
|
||||
@ -92,7 +98,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(this, applEventctagsSelection, eventOpenCtagsSelectReturn);
|
||||
tmpWidget->registerOnEvent(shared_from_this(), applEventctagsSelection, eventOpenCtagsSelectReturn);
|
||||
}
|
||||
} else {
|
||||
jumpFile(myfile.getName(), lineID - 1);
|
||||
@ -102,19 +108,19 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
||||
void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _lineId) {
|
||||
// save the current file in the history
|
||||
// TODO : registerHistory();
|
||||
if (m_bufferManager != NULL) {
|
||||
if (m_bufferManager != nullptr) {
|
||||
m_bufferManager->open(_filename);
|
||||
}
|
||||
sendMultiCast(appl::MsgSelectChange, _filename);
|
||||
sendMultiCast(appl::MsgSelectGotoLineSelect, std::to_string(_lineId));
|
||||
sendMultiCast(appl::MsgSelectGotoLineSelect, etk::to_string(_lineId));
|
||||
}
|
||||
|
||||
void appl::TextPluginCtags::loadTagFile() {
|
||||
tagFileInfo info;
|
||||
// close previous tag file
|
||||
if (NULL != m_ctagFile) {
|
||||
if (nullptr != m_ctagFile) {
|
||||
tagsClose(m_ctagFile);
|
||||
m_ctagFile = NULL;
|
||||
m_ctagFile = nullptr;
|
||||
}
|
||||
if (m_tagFilename == "") {
|
||||
return;
|
||||
@ -122,7 +128,7 @@ void appl::TextPluginCtags::loadTagFile() {
|
||||
// load (open) the tag file :
|
||||
APPL_INFO("try to open tag file : " << m_tagFilename);
|
||||
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
|
||||
if (NULL != m_ctagFile) {
|
||||
if (nullptr != m_ctagFile) {
|
||||
APPL_INFO("open exuberant Ctags file is OK ...");
|
||||
} else {
|
||||
APPL_INFO("Error to open ctags file ...");
|
||||
@ -139,7 +145,7 @@ void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
|
||||
<< "\" at line="<< (int32_t)_entry->address.lineNumber);
|
||||
|
||||
APPL_INFO("Extention field : ");
|
||||
if (_entry->kind != NULL && _entry->kind [0] != '\0') {
|
||||
if (_entry->kind != nullptr && _entry->kind [0] != '\0') {
|
||||
APPL_INFO(" kind : " << _entry->kind);
|
||||
}
|
||||
if (_entry->fileScope) {
|
||||
@ -175,8 +181,8 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
|
||||
}
|
||||
if (_msg.getMessage() == eventOpenCtagsFile) {
|
||||
APPL_INFO("Request opening ctag file");
|
||||
ewol::object::Shared<ewol::widget::FileChooser> tmpWidget = ewol::object::makeShared(new ewol::widget::FileChooser());
|
||||
if (NULL == tmpWidget) {
|
||||
std::shared_ptr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
|
||||
if (nullptr == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
return true;
|
||||
}
|
||||
@ -189,7 +195,7 @@ bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer
|
||||
tmpWidget->setFolder(path);
|
||||
}
|
||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn);
|
||||
tmpWidget->registerOnEvent(shared_from_this(), "validate", eventOpenCtagsOpenFileReturn);
|
||||
return true;
|
||||
} else if (_msg.getMessage() == eventJumpDestination) {
|
||||
if (_textDrawer.hasBuffer() == false) {
|
||||
|
@ -33,9 +33,12 @@ namespace appl {
|
||||
void printTag(const tagEntry *_entry);
|
||||
void jumpTo(const std::string& _name);
|
||||
void jumpFile(const std::string& _filename, int64_t _lineId);
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public:
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
protected:
|
||||
TextPluginCtags();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginCtags);
|
||||
virtual ~TextPluginCtags();
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
|
@ -17,23 +17,28 @@
|
||||
|
||||
namespace appl {
|
||||
template <typename TYPE> class TextViewerPluginData : public appl::TextViewerPlugin {
|
||||
public:
|
||||
protected:
|
||||
TextViewerPluginData() {
|
||||
// nothing to do ...
|
||||
addObjectType("appl::TextViewerPluginData");
|
||||
}
|
||||
void init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
public:
|
||||
DECLARE_FACTORY(TextViewerPluginData);
|
||||
virtual ~TextViewerPluginData() {
|
||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||
if (m_specificData[iii].second != NULL) {
|
||||
if (m_specificData[iii].second != nullptr) {
|
||||
remove(*m_specificData[iii].second);
|
||||
delete(m_specificData[iii].second);
|
||||
m_specificData[iii].second = NULL;
|
||||
m_specificData[iii].second = nullptr;
|
||||
}
|
||||
}
|
||||
m_specificData.clear();
|
||||
}
|
||||
private:
|
||||
std::vector<std::pair<ewol::object::Shared<appl::Buffer> ,TYPE* >> m_specificData;
|
||||
std::vector<std::pair<std::shared_ptr<appl::Buffer> ,TYPE* >> m_specificData;
|
||||
protected:
|
||||
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
|
||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||
@ -42,8 +47,8 @@ namespace appl {
|
||||
}
|
||||
}
|
||||
TYPE* data = new TYPE();
|
||||
if (data == NULL) {
|
||||
return NULL;
|
||||
if (data == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), data));
|
||||
// create a new one ...
|
||||
@ -53,7 +58,7 @@ namespace appl {
|
||||
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
TYPE* data = getDataRef(_textDrawer);
|
||||
if (data == NULL) {
|
||||
if (data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return onReceiveMessageViewer(_textDrawer, _msg, *data);
|
||||
@ -62,7 +67,7 @@ namespace appl {
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _data) {
|
||||
TYPE* data = getDataRef(_textDrawer);
|
||||
if (data == NULL) {
|
||||
if (data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return onWrite(_textDrawer, _pos, _data, *data);
|
||||
@ -72,7 +77,7 @@ namespace appl {
|
||||
const std::string& _data,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
TYPE* data = getDataRef(_textDrawer);
|
||||
if (data == NULL) {
|
||||
if (data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return onReplace(_textDrawer, _pos, _data, _posEnd, *data);
|
||||
@ -81,7 +86,7 @@ namespace appl {
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
TYPE* data = getDataRef(_textDrawer);
|
||||
if (data == NULL) {
|
||||
if (data == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return onRemove(_textDrawer, _pos, _posEnd, *data);
|
||||
@ -115,16 +120,6 @@ namespace appl {
|
||||
virtual void remove(TYPE& _data) {
|
||||
return;
|
||||
};
|
||||
public:
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
appl::TextViewerPlugin::onObjectRemove(_object);
|
||||
for (auto it(m_specificData.begin()); it != m_specificData.end(); ++it) {
|
||||
if (it->first == _object) {
|
||||
m_specificData.erase(it);
|
||||
it = m_specificData.begin();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -23,6 +23,11 @@ appl::TextPluginHistory::TextPluginHistory() {
|
||||
addObjectType("appl::TextPluginHistory");
|
||||
}
|
||||
|
||||
void appl::TextPluginHistory::init() {
|
||||
appl::TextViewerPluginData<appl::PluginHistoryData>::init();
|
||||
}
|
||||
|
||||
|
||||
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo);
|
||||
@ -45,7 +50,7 @@ bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDraw
|
||||
if (_data.m_redo.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
if (_data.m_redo[_data.m_redo.size()-1] == NULL) {
|
||||
if (_data.m_redo[_data.m_redo.size()-1] == nullptr) {
|
||||
_data.m_redo.pop_back();
|
||||
return true;
|
||||
}
|
||||
@ -61,7 +66,7 @@ bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDraw
|
||||
if (_data.m_undo.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
if (_data.m_undo[_data.m_undo.size()-1] == NULL) {
|
||||
if (_data.m_undo[_data.m_undo.size()-1] == nullptr) {
|
||||
_data.m_undo.pop_back();
|
||||
return true;
|
||||
}
|
||||
@ -82,11 +87,11 @@ void appl::TextPluginHistory::clearRedo(appl::PluginHistoryData& _data) {
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<_data.m_redo.size(); ++iii) {
|
||||
if (_data.m_redo[iii] == NULL) {
|
||||
if (_data.m_redo[iii] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
delete(_data.m_redo[iii]);
|
||||
_data.m_redo[iii] = NULL;
|
||||
_data.m_redo[iii] = nullptr;
|
||||
}
|
||||
_data.m_redo.clear();
|
||||
}
|
||||
@ -96,11 +101,11 @@ void appl::TextPluginHistory::clearUndo(appl::PluginHistoryData& _data) {
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<_data.m_undo.size(); ++iii) {
|
||||
if (_data.m_undo[iii] == NULL) {
|
||||
if (_data.m_undo[iii] == nullptr) {
|
||||
continue;
|
||||
}
|
||||
delete(_data.m_undo[iii]);
|
||||
_data.m_undo[iii] = NULL;
|
||||
_data.m_undo[iii] = nullptr;
|
||||
}
|
||||
_data.m_undo.clear();
|
||||
}
|
||||
@ -114,13 +119,13 @@ bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer,
|
||||
return false;
|
||||
}
|
||||
appl::History *tmpElement = new appl::History();
|
||||
if (tmpElement != NULL) {
|
||||
if (tmpElement != nullptr) {
|
||||
tmpElement->m_addedText = _strData;
|
||||
tmpElement->m_posAdded = (int64_t)_pos;
|
||||
tmpElement->m_endPosRemoved = (int64_t)_pos;
|
||||
}
|
||||
_textDrawer.writeDirect(_strData, _pos);
|
||||
if (tmpElement != NULL) {
|
||||
if (tmpElement != nullptr) {
|
||||
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
|
||||
clearRedo(_data);
|
||||
_data.m_undo.push_back(tmpElement);
|
||||
@ -138,14 +143,14 @@ bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer,
|
||||
return false;
|
||||
}
|
||||
appl::History *tmpElement = new appl::History();
|
||||
if (tmpElement != NULL) {
|
||||
if (tmpElement != nullptr) {
|
||||
tmpElement->m_posAdded = (int64_t)_pos;
|
||||
tmpElement->m_addedText = _strData;
|
||||
tmpElement->m_endPosRemoved = (int64_t)_posEnd;
|
||||
_textDrawer.copy(tmpElement->m_removedText, _pos, _posEnd);
|
||||
}
|
||||
_textDrawer.replaceDirect(_strData, _pos, _posEnd);
|
||||
if (tmpElement != NULL) {
|
||||
if (tmpElement != nullptr) {
|
||||
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
|
||||
clearRedo(_data);
|
||||
_data.m_undo.push_back(tmpElement);
|
||||
@ -162,7 +167,7 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
|
||||
return false;
|
||||
}
|
||||
appl::History *tmpElement = new appl::History();
|
||||
if (tmpElement != NULL) {
|
||||
if (tmpElement != nullptr) {
|
||||
tmpElement->m_addedText = "";
|
||||
tmpElement->m_posAdded = (int64_t)_pos;
|
||||
tmpElement->m_endPosAdded = tmpElement->m_posAdded;
|
||||
@ -177,10 +182,3 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
|
||||
}
|
||||
|
||||
|
||||
void appl::TextPluginHistory::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
appl::TextViewerPluginData<appl::PluginHistoryData>::onObjectRemove(_object);
|
||||
// TODO : Dependence with buffer removing ...
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -36,8 +36,11 @@ namespace appl {
|
||||
std::vector<History*> m_redo; //!< History storing data
|
||||
};
|
||||
class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> {
|
||||
public:
|
||||
protected:
|
||||
TextPluginHistory();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginHistory);
|
||||
virtual ~TextPluginHistory() { };
|
||||
private:
|
||||
public:
|
||||
@ -66,8 +69,6 @@ namespace appl {
|
||||
private:
|
||||
void clearRedo(appl::PluginHistoryData& _data);
|
||||
void clearUndo(appl::PluginHistoryData& _data);
|
||||
public:
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -19,36 +19,36 @@
|
||||
#undef __class__
|
||||
#define __class__ "textPluginManager"
|
||||
|
||||
static std::list<ewol::object::Owner<appl::TextViewerPlugin>>& getList() {
|
||||
static std::list<ewol::object::Owner<appl::TextViewerPlugin>> s_list;
|
||||
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<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventEntry() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> 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<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventInput() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> 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<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnWrite() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> 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<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnReplace() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> 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<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnRemove() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> 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<ewol::object::Shared<appl::TextViewerPlugin>>& getListonReceiveMessageViewer() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> 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<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnCursorMove() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
static std::vector<std::shared_ptr<appl::TextViewerPlugin>>& getListOnCursorMove() {
|
||||
static std::vector<std::shared_ptr<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
|
||||
@ -69,17 +69,17 @@ void appl::textPluginManager::unInit() {
|
||||
}
|
||||
|
||||
void appl::textPluginManager::addDefaultPlugin() {
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginCopy()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginMultiLineTab()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginAutoIndent()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginHistory()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginRmLine()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginSelectAll()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginCtags()));
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginCopy::create());
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginMultiLineTab::create());
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginAutoIndent::create());
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginHistory::create());
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginRmLine::create());
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginSelectAll::create());
|
||||
appl::textPluginManager::addPlugin(appl::TextPluginCtags::create());
|
||||
}
|
||||
|
||||
void appl::textPluginManager::addPlugin(const ewol::object::Shared<appl::TextViewerPlugin>& _plugin) {
|
||||
if (_plugin == NULL) {
|
||||
void appl::textPluginManager::addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin) {
|
||||
if (_plugin == nullptr) {
|
||||
return;
|
||||
}
|
||||
getList().push_back(_plugin);
|
||||
@ -108,7 +108,7 @@ void appl::textPluginManager::addPlugin(const ewol::object::Shared<appl::TextVie
|
||||
|
||||
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
|
||||
for (auto &it : getList()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
it->onPluginEnable(_widget);
|
||||
@ -117,7 +117,7 @@ void appl::textPluginManager::connect(appl::TextViewer& _widget) {
|
||||
|
||||
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
|
||||
for (auto &it : getList()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
it->onPluginDisable(_widget);
|
||||
@ -127,7 +127,7 @@ void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
|
||||
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Entry& _event) {
|
||||
for (auto &it : getListOnEventEntry()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onEventEntry(_textDrawer, _event) == true ) {
|
||||
@ -140,7 +140,7 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Input& _event) {
|
||||
for (auto &it : getListOnEventInput()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onEventInput(_textDrawer, _event) == true ) {
|
||||
@ -154,7 +154,7 @@ bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _data) {
|
||||
for (auto &it : getListOnWrite()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onWrite(_textDrawer, _pos, _data) == true ) {
|
||||
@ -169,7 +169,7 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
||||
const std::string& _data,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
for (auto &it : getListOnReplace()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
||||
@ -183,7 +183,7 @@ bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
for (auto &it : getListOnRemove()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
||||
@ -196,7 +196,7 @@ bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||
bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
for (auto &it : getListonReceiveMessageViewer()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) {
|
||||
@ -209,7 +209,7 @@ bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDraw
|
||||
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos) {
|
||||
for (auto &it : getListOnCursorMove()) {
|
||||
if (it == NULL) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (it->onCursorMove(_textDrawer, _pos) == true ) {
|
||||
|
@ -33,7 +33,7 @@ namespace appl {
|
||||
* @brief Add a plugin.
|
||||
* @param[in] _plugin Plugin pointer to add.
|
||||
*/
|
||||
void addPlugin(const ewol::object::Shared<appl::TextViewerPlugin>& _plugin);
|
||||
void addPlugin(const std::shared_ptr<appl::TextViewerPlugin>& _plugin);
|
||||
/**
|
||||
* @brief connect a new widget to the plugin.
|
||||
* @param[in] _widget Reference on the widget caller.
|
||||
|
@ -19,6 +19,10 @@ appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
|
||||
addObjectType("appl::TextPluginMultiLineTab");
|
||||
}
|
||||
|
||||
void appl::TextPluginMultiLineTab::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Entry& _event) {
|
||||
if (isEnable() == false) {
|
||||
|
@ -17,8 +17,11 @@
|
||||
|
||||
namespace appl {
|
||||
class TextPluginMultiLineTab : public appl::TextViewerPlugin {
|
||||
public:
|
||||
protected:
|
||||
TextPluginMultiLineTab();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginMultiLineTab);
|
||||
virtual ~TextPluginMultiLineTab() {
|
||||
// nothing to do ...
|
||||
};
|
||||
|
@ -20,6 +20,10 @@ appl::TextPluginRmLine::TextPluginRmLine() {
|
||||
addObjectType("appl::TextPluginRmLine");
|
||||
}
|
||||
|
||||
void appl::TextPluginRmLine::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
// add event :
|
||||
_textDrawer.ext_registerMultiCast(ednMsgGuiRm);
|
||||
|
@ -17,8 +17,11 @@
|
||||
|
||||
namespace appl {
|
||||
class TextPluginRmLine : public appl::TextViewerPlugin {
|
||||
public:
|
||||
protected:
|
||||
TextPluginRmLine();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginRmLine);
|
||||
virtual ~TextPluginRmLine() {
|
||||
// nothing to do ...
|
||||
};
|
||||
|
@ -20,6 +20,10 @@ appl::TextPluginSelectAll::TextPluginSelectAll() {
|
||||
addObjectType("appl::TextPluginSelectAll");
|
||||
}
|
||||
|
||||
void appl::TextPluginSelectAll::init() {
|
||||
appl::TextViewerPlugin::init();
|
||||
}
|
||||
|
||||
static const char* eventSelectAll = "plugin-select-all";
|
||||
|
||||
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
|
@ -17,8 +17,11 @@
|
||||
|
||||
namespace appl {
|
||||
class TextPluginSelectAll : public appl::TextViewerPlugin {
|
||||
public:
|
||||
protected:
|
||||
TextPluginSelectAll();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TextPluginSelectAll);
|
||||
virtual ~TextPluginSelectAll() {
|
||||
// nothing to do ...
|
||||
};
|
||||
|
@ -138,7 +138,7 @@ static int growString (vstring *s)
|
||||
newLength = 2 * s->size;
|
||||
newLine = (char*) realloc (s->buffer, newLength);
|
||||
}
|
||||
if (newLine == NULL)
|
||||
if (newLine == nullptr)
|
||||
perror ("string too large");
|
||||
else
|
||||
{
|
||||
@ -154,13 +154,13 @@ static void copyName (tagFile *const file)
|
||||
{
|
||||
size_t length;
|
||||
const char *end = strchr (file->line.buffer, '\t');
|
||||
if (end == NULL)
|
||||
if (end == nullptr)
|
||||
{
|
||||
end = strchr (file->line.buffer, '\n');
|
||||
if (end == NULL)
|
||||
if (end == nullptr)
|
||||
end = strchr (file->line.buffer, '\r');
|
||||
}
|
||||
if (end != NULL)
|
||||
if (end != nullptr)
|
||||
length = end - file->line.buffer;
|
||||
else
|
||||
length = strlen (file->line.buffer);
|
||||
@ -189,7 +189,7 @@ static int readTagLineRaw (tagFile *const file)
|
||||
reReadLine = 0;
|
||||
*pLastChar = '\0';
|
||||
line = fgets (file->line.buffer, (int) file->line.size, file->fp);
|
||||
if (line == NULL)
|
||||
if (line == nullptr)
|
||||
{
|
||||
/* read error */
|
||||
if (! feof (file->fp))
|
||||
@ -236,7 +236,7 @@ static tagResult growFields (tagFile *const file)
|
||||
unsigned short newCount = (unsigned short) 2 * file->fields.max;
|
||||
tagExtensionField *newFields = (tagExtensionField*)
|
||||
realloc (file->fields.list, newCount * sizeof (tagExtensionField));
|
||||
if (newFields == NULL)
|
||||
if (newFields == nullptr)
|
||||
perror ("too many extension fields");
|
||||
else
|
||||
{
|
||||
@ -251,7 +251,7 @@ static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
|
||||
char *const string)
|
||||
{
|
||||
char *p = string;
|
||||
while (p != NULL && *p != '\0')
|
||||
while (p != nullptr && *p != '\0')
|
||||
{
|
||||
while (*p == TAB)
|
||||
*p++ = '\0';
|
||||
@ -260,10 +260,10 @@ static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
|
||||
char *colon;
|
||||
char *field = p;
|
||||
p = strchr (p, TAB);
|
||||
if (p != NULL)
|
||||
if (p != nullptr)
|
||||
*p++ = '\0';
|
||||
colon = strchr (field, ':');
|
||||
if (colon == NULL)
|
||||
if (colon == nullptr)
|
||||
entry->kind = field;
|
||||
else
|
||||
{
|
||||
@ -295,19 +295,19 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
|
||||
char *p = file->line.buffer;
|
||||
char *tab = strchr (p, TAB);
|
||||
|
||||
entry->fields.list = NULL;
|
||||
entry->fields.list = nullptr;
|
||||
entry->fields.count = 0;
|
||||
entry->kind = NULL;
|
||||
entry->kind = nullptr;
|
||||
entry->fileScope = 0;
|
||||
|
||||
entry->name = p;
|
||||
if (tab != NULL)
|
||||
if (tab != nullptr)
|
||||
{
|
||||
*tab = '\0';
|
||||
p = tab + 1;
|
||||
entry->file = p;
|
||||
tab = strchr (p, TAB);
|
||||
if (tab != NULL)
|
||||
if (tab != nullptr)
|
||||
{
|
||||
int fieldsPresent;
|
||||
*tab = '\0';
|
||||
@ -321,8 +321,8 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
|
||||
do
|
||||
{
|
||||
p = strchr (p + 1, delimiter);
|
||||
} while (p != NULL && *(p - 1) == '\\');
|
||||
if (p == NULL)
|
||||
} while (p != nullptr && *(p - 1) == '\\');
|
||||
if (p == nullptr)
|
||||
{
|
||||
/* invalid pattern */
|
||||
}
|
||||
@ -351,19 +351,19 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
|
||||
entry->fields.list = file->fields.list;
|
||||
for (i = entry->fields.count ; i < file->fields.max ; ++i)
|
||||
{
|
||||
file->fields.list [i].key = NULL;
|
||||
file->fields.list [i].value = NULL;
|
||||
file->fields.list [i].key = nullptr;
|
||||
file->fields.list [i].value = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static char *duplicate (const char *str)
|
||||
{
|
||||
char *result = NULL;
|
||||
if (str != NULL)
|
||||
char *result = nullptr;
|
||||
if (str != nullptr)
|
||||
{
|
||||
result = strdup (str);
|
||||
if (result == NULL)
|
||||
perror (NULL);
|
||||
if (result == nullptr)
|
||||
perror (nullptr);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -372,14 +372,14 @@ static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
|
||||
{
|
||||
fpos_t startOfLine;
|
||||
const size_t prefixLength = strlen (PseudoTagPrefix);
|
||||
if (info != NULL)
|
||||
if (info != nullptr)
|
||||
{
|
||||
info->file.format = 1;
|
||||
info->file.sort = TAG_UNSORTED;
|
||||
info->program.author = NULL;
|
||||
info->program.name = NULL;
|
||||
info->program.url = NULL;
|
||||
info->program.version = NULL;
|
||||
info->program.author = nullptr;
|
||||
info->program.name = nullptr;
|
||||
info->program.url = nullptr;
|
||||
info->program.version = nullptr;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
@ -407,7 +407,7 @@ static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
|
||||
file->program.url = duplicate (value);
|
||||
else if (strcmp (key, "TAG_PROGRAM_VERSION") == 0)
|
||||
file->program.version = duplicate (value);
|
||||
if (info != NULL)
|
||||
if (info != nullptr)
|
||||
{
|
||||
info->file.format = file->format;
|
||||
info->file.sort = file->sortMethod;
|
||||
@ -440,7 +440,7 @@ static void gotoFirstLogicalTag (tagFile *const file)
|
||||
static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
|
||||
{
|
||||
tagFile *result = (tagFile*) calloc ((size_t) 1, sizeof (tagFile));
|
||||
if (result != NULL)
|
||||
if (result != nullptr)
|
||||
{
|
||||
growString (&result->line);
|
||||
growString (&result->name);
|
||||
@ -448,10 +448,10 @@ static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
|
||||
result->fields.list = (tagExtensionField*) calloc (
|
||||
result->fields.max, sizeof (tagExtensionField));
|
||||
result->fp = fopen (filePath, "r");
|
||||
if (result->fp == NULL)
|
||||
if (result->fp == nullptr)
|
||||
{
|
||||
free (result);
|
||||
result = NULL;
|
||||
result = nullptr;
|
||||
info->status.error_number = errno;
|
||||
}
|
||||
else
|
||||
@ -475,15 +475,15 @@ static void terminate (tagFile *const file)
|
||||
free (file->name.buffer);
|
||||
free (file->fields.list);
|
||||
|
||||
if (file->program.author != NULL)
|
||||
if (file->program.author != nullptr)
|
||||
free (file->program.author);
|
||||
if (file->program.name != NULL)
|
||||
if (file->program.name != nullptr)
|
||||
free (file->program.name);
|
||||
if (file->program.url != NULL)
|
||||
if (file->program.url != nullptr)
|
||||
free (file->program.url);
|
||||
if (file->program.version != NULL)
|
||||
if (file->program.version != nullptr)
|
||||
free (file->program.version);
|
||||
if (file->search.name != NULL)
|
||||
if (file->search.name != nullptr)
|
||||
free (file->search.name);
|
||||
|
||||
memset (file, 0, sizeof (tagFile));
|
||||
@ -494,13 +494,13 @@ static void terminate (tagFile *const file)
|
||||
static tagResult readNext (tagFile *const file, tagEntry *const entry)
|
||||
{
|
||||
tagResult result;
|
||||
if (file == NULL || ! file->initialized)
|
||||
if (file == nullptr || ! file->initialized)
|
||||
result = TagFailure;
|
||||
else if (! readTagLine (file))
|
||||
result = TagFailure;
|
||||
else
|
||||
{
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
parseTagLine (file, entry);
|
||||
result = TagSuccess;
|
||||
}
|
||||
@ -510,13 +510,13 @@ static tagResult readNext (tagFile *const file, tagEntry *const entry)
|
||||
static const char *readFieldValue (
|
||||
const tagEntry *const entry, const char *const key)
|
||||
{
|
||||
const char *result = NULL;
|
||||
const char *result = nullptr;
|
||||
int i;
|
||||
if (strcmp (key, "kind") == 0)
|
||||
result = entry->kind;
|
||||
else if (strcmp (key, "file") == 0)
|
||||
result = EmptyString;
|
||||
else for (i = 0 ; i < entry->fields.count && result == NULL ; ++i)
|
||||
else for (i = 0 ; i < entry->fields.count && result == nullptr ; ++i)
|
||||
if (strcmp (entry->fields.list [i].key, key) == 0)
|
||||
result = entry->fields.list [i].value;
|
||||
return result;
|
||||
@ -650,7 +650,7 @@ static tagResult find (tagFile *const file, tagEntry *const entry,
|
||||
const char *const name, const int options)
|
||||
{
|
||||
tagResult result;
|
||||
if (file->search.name != NULL)
|
||||
if (file->search.name != nullptr)
|
||||
free (file->search.name);
|
||||
file->search.name = duplicate (name);
|
||||
file->search.nameLength = strlen (name);
|
||||
@ -680,7 +680,7 @@ static tagResult find (tagFile *const file, tagEntry *const entry,
|
||||
else
|
||||
{
|
||||
file->search.pos = file->pos;
|
||||
if (entry != NULL)
|
||||
if (entry != nullptr)
|
||||
parseTagLine (file, entry);
|
||||
}
|
||||
return result;
|
||||
@ -699,7 +699,7 @@ static tagResult findNext (tagFile *const file, tagEntry *const entry)
|
||||
else
|
||||
{
|
||||
result = findSequential (file);
|
||||
if (result == TagSuccess && entry != NULL)
|
||||
if (result == TagSuccess && entry != nullptr)
|
||||
parseTagLine (file, entry);
|
||||
}
|
||||
return result;
|
||||
@ -717,7 +717,7 @@ extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info)
|
||||
extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
|
||||
{
|
||||
tagResult result = TagFailure;
|
||||
if (file != NULL && file->initialized)
|
||||
if (file != nullptr && file->initialized)
|
||||
{
|
||||
file->sortMethod = type;
|
||||
result = TagSuccess;
|
||||
@ -728,7 +728,7 @@ extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
|
||||
extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
|
||||
{
|
||||
tagResult result = TagFailure;
|
||||
if (file != NULL && file->initialized)
|
||||
if (file != nullptr && file->initialized)
|
||||
{
|
||||
gotoFirstLogicalTag (file);
|
||||
result = readNext (file, entry);
|
||||
@ -739,15 +739,15 @@ extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
|
||||
extern tagResult tagsNext (tagFile *const file, tagEntry *const entry)
|
||||
{
|
||||
tagResult result = TagFailure;
|
||||
if (file != NULL && file->initialized)
|
||||
if (file != nullptr && file->initialized)
|
||||
result = readNext (file, entry);
|
||||
return result;
|
||||
}
|
||||
|
||||
extern const char *tagsField (const tagEntry *const entry, const char *const key)
|
||||
{
|
||||
const char *result = NULL;
|
||||
if (entry != NULL)
|
||||
const char *result = nullptr;
|
||||
if (entry != nullptr)
|
||||
result = readFieldValue (entry, key);
|
||||
return result;
|
||||
}
|
||||
@ -756,7 +756,7 @@ extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
|
||||
const char *const name, const int options)
|
||||
{
|
||||
tagResult result = TagFailure;
|
||||
if (file != NULL && file->initialized)
|
||||
if (file != nullptr && file->initialized)
|
||||
result = find (file, entry, name, options);
|
||||
return result;
|
||||
}
|
||||
@ -764,7 +764,7 @@ extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
|
||||
extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
|
||||
{
|
||||
tagResult result = TagFailure;
|
||||
if (file != NULL && file->initialized)
|
||||
if (file != nullptr && file->initialized)
|
||||
result = findNext (file, entry);
|
||||
return result;
|
||||
}
|
||||
@ -772,7 +772,7 @@ extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
|
||||
extern tagResult tagsClose (tagFile *const file)
|
||||
{
|
||||
tagResult result = TagFailure;
|
||||
if (file != NULL && file->initialized)
|
||||
if (file != nullptr && file->initialized)
|
||||
{
|
||||
terminate (file);
|
||||
result = TagSuccess;
|
||||
@ -804,7 +804,7 @@ static void printTag (const tagEntry *entry)
|
||||
entry->name, entry->file, entry->address.pattern);
|
||||
if (extensionFields)
|
||||
{
|
||||
if (entry->kind != NULL && entry->kind [0] != '\0')
|
||||
if (entry->kind != nullptr && entry->kind [0] != '\0')
|
||||
printf ("%s\tkind:%s", sep, entry->kind);
|
||||
if (entry->fileScope)
|
||||
printf ("%s\tfile:", sep);
|
||||
@ -825,7 +825,7 @@ static void findTag (const char *const name, const int options)
|
||||
tagFileInfo info;
|
||||
tagEntry entry;
|
||||
tagFile *const file = tagsOpen (TagFileName, &info);
|
||||
if (file == NULL)
|
||||
if (file == nullptr)
|
||||
{
|
||||
fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
|
||||
ProgramName, strerror (info.status.error_number), name);
|
||||
@ -851,7 +851,7 @@ static void listTags ()
|
||||
tagFileInfo info;
|
||||
tagEntry entry;
|
||||
tagFile *const file = tagsOpen (TagFileName, &info);
|
||||
if (file == NULL)
|
||||
if (file == nullptr)
|
||||
{
|
||||
fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
|
||||
ProgramName, strerror (info.status.error_number), TagFileName);
|
||||
@ -927,7 +927,7 @@ extern int main (int argc, char **argv)
|
||||
++j;
|
||||
if (arg [j] == '\0')
|
||||
SortMethod = TAG_SORTED;
|
||||
else if (strchr ("012", arg[j]) != NULL)
|
||||
else if (strchr ("012", arg[j]) != nullptr)
|
||||
SortMethod = (sortType) (arg[j] - '0');
|
||||
else
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ typedef struct {
|
||||
/* address for locating tag in source file */
|
||||
struct {
|
||||
/* pattern for locating source line
|
||||
* (may be NULL if not present) */
|
||||
* (may be nullptr if not present) */
|
||||
const char *pattern;
|
||||
|
||||
/* line number in source file of tag definition
|
||||
@ -122,7 +122,7 @@ typedef struct {
|
||||
unsigned long lineNumber;
|
||||
} address;
|
||||
|
||||
/* kind of tag (may by name, character, or NULL if not known) */
|
||||
/* kind of tag (may by name, character, or nullptr if not known) */
|
||||
const char *kind;
|
||||
|
||||
/* is tag of file-limited scope? */
|
||||
|
@ -18,45 +18,36 @@
|
||||
|
||||
class myParamGlobal : public ewol::Object {
|
||||
public:
|
||||
static const char * const configEOL;
|
||||
static const char * const configAutoIndent;
|
||||
static const char * const configShowTabChar;
|
||||
static const char * const configShowSpaceChar;
|
||||
ewol::object::Param<bool> m_displayEOL;
|
||||
ewol::object::Param<bool> m_AutoIndent;
|
||||
ewol::object::Param<bool> m_displayTabChar;
|
||||
ewol::object::Param<bool> m_displaySpaceChar;
|
||||
public :
|
||||
bool m_displayEOL;
|
||||
bool m_AutoIndent;
|
||||
bool m_displayTabChar;
|
||||
bool m_displaySpaceChar;
|
||||
public :
|
||||
myParamGlobal() {
|
||||
myParamGlobal() :
|
||||
m_displayEOL(*this, "eol", false, "Display end of line character"),
|
||||
m_AutoIndent(*this, "auto-indent", true, "Auto indent when create new line"),
|
||||
m_displayTabChar(*this, "display-tab", true, "Display the Tab char"),
|
||||
m_displaySpaceChar(*this, "display-space", true, "Display the space char") {
|
||||
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
|
||||
setName("edn_global_param");
|
||||
m_displayEOL=false;
|
||||
m_AutoIndent = true;
|
||||
m_displayTabChar = true;
|
||||
m_displaySpaceChar = true;
|
||||
registerConfig(configEOL, "bool", NULL, "Display end of line character");
|
||||
registerConfig(configAutoIndent, "bool", NULL, "Auto indent when create new line");
|
||||
registerConfig(configShowTabChar, "bool", NULL, "Display the Tab char");
|
||||
registerConfig(configShowSpaceChar, "bool", NULL, "Display the space char");
|
||||
}
|
||||
|
||||
/*
|
||||
bool onSetConfig(const ewol::object::Config& _conf) {
|
||||
// Not set the EObject node parameter (name == > not change ...)
|
||||
if (_conf.getConfig() == configEOL) {
|
||||
m_displayEOL = std::stob(_conf.getData());
|
||||
m_displayEOL = etk::string_to_bool(_conf.getData());
|
||||
return true;
|
||||
}
|
||||
if (_conf.getConfig() == configAutoIndent) {
|
||||
m_AutoIndent = std::stob(_conf.getData());
|
||||
m_AutoIndent = etk::string_to_bool(_conf.getData());
|
||||
return true;
|
||||
}
|
||||
if (_conf.getConfig() == configShowTabChar) {
|
||||
m_displayTabChar = std::stob(_conf.getData());
|
||||
m_displayTabChar = etk::string_to_bool(_conf.getData());
|
||||
return true;
|
||||
}
|
||||
if (_conf.getConfig() == configShowSpaceChar) {
|
||||
m_displaySpaceChar = std::stob(_conf.getData());
|
||||
m_displaySpaceChar = etk::string_to_bool(_conf.getData());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -97,12 +88,9 @@ class myParamGlobal : public ewol::Object {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
const char * const myParamGlobal::configEOL = "eol";
|
||||
const char * const myParamGlobal::configAutoIndent = "auto-indent";
|
||||
const char * const myParamGlobal::configShowTabChar = "display-tab";
|
||||
const char * const myParamGlobal::configShowSpaceChar = "display-space";
|
||||
|
||||
static myParamGlobal& l_obj() {
|
||||
static myParamGlobal s_obj;
|
||||
@ -179,61 +167,65 @@ 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() :
|
||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
|
||||
ewol::widget::CheckBox* myCheckbox = NULL;
|
||||
ewol::widget::Spacer* mySpacer = NULL;
|
||||
globals::ParameterGlobalsGui::ParameterGlobalsGui() {
|
||||
addObjectType("globals::ParameterGlobalsGui");
|
||||
}
|
||||
|
||||
mySpacer = new ewol::widget::Spacer();
|
||||
if (NULL == mySpacer) {
|
||||
void globals::ParameterGlobalsGui::init() {
|
||||
ewol::widget::Sizer::init(ewol::widget::Sizer::modeVert);
|
||||
std::shared_ptr<ewol::widget::CheckBox> myCheckbox;
|
||||
std::shared_ptr<ewol::widget::Spacer> mySpacer;
|
||||
|
||||
mySpacer = ewol::widget::Spacer::create();
|
||||
if (nullptr == mySpacer) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
mySpacer->setExpand(bvec2(true,true));
|
||||
subWidgetAdd(mySpacer);
|
||||
}
|
||||
myCheckbox = new ewol::widget::CheckBox("Automatic Indentation");
|
||||
if (NULL == myCheckbox) {
|
||||
myCheckbox = ewol::widget::CheckBox::create("Automatic Indentation");
|
||||
if (nullptr == myCheckbox) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
myCheckbox->setExpand(bvec2(true,false));
|
||||
myCheckbox->setValue(isSetAutoIndent());
|
||||
myCheckbox->registerOnEvent(this, "clicked", l_changeIndentation);
|
||||
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeIndentation);
|
||||
subWidgetAdd(myCheckbox);
|
||||
}
|
||||
myCheckbox = new ewol::widget::CheckBox("Display space char (' ')");
|
||||
if (NULL == myCheckbox) {
|
||||
myCheckbox = ewol::widget::CheckBox::create("Display space char (' ')");
|
||||
if (nullptr == myCheckbox) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
myCheckbox->setExpand(bvec2(true,false));
|
||||
myCheckbox->setValue(isSetDisplaySpaceChar());
|
||||
myCheckbox->registerOnEvent(this, "clicked", l_changeSpace);
|
||||
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeSpace);
|
||||
subWidgetAdd(myCheckbox);
|
||||
}
|
||||
myCheckbox = new ewol::widget::CheckBox("Display tabulation char ('\\t')");
|
||||
if (NULL == myCheckbox) {
|
||||
myCheckbox = ewol::widget::CheckBox::create("Display tabulation char ('\\t')");
|
||||
if (nullptr == myCheckbox) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
myCheckbox->setExpand(bvec2(true,false));
|
||||
myCheckbox->setValue(isSetDisplayTabChar());
|
||||
myCheckbox->registerOnEvent(this, "clicked", l_changeTabulation);
|
||||
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeTabulation);
|
||||
subWidgetAdd(myCheckbox);
|
||||
}
|
||||
myCheckbox = new ewol::widget::CheckBox("Display end of line ('\\n')");
|
||||
if (NULL == myCheckbox) {
|
||||
myCheckbox = ewol::widget::CheckBox::create("Display end of line ('\\n')");
|
||||
if (nullptr == myCheckbox) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
myCheckbox->setExpand(bvec2(true,false));
|
||||
myCheckbox->setValue(isSetDisplayEndOfLine());
|
||||
myCheckbox->registerOnEvent(this, "clicked", l_changeEndOfLine);
|
||||
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeEndOfLine);
|
||||
subWidgetAdd(myCheckbox);
|
||||
}
|
||||
myCheckbox = new ewol::widget::CheckBox("switch Rounded/default");
|
||||
if (NULL == myCheckbox) {
|
||||
myCheckbox = ewol::widget::CheckBox::create("switch Rounded/default");
|
||||
if (nullptr == myCheckbox) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
myCheckbox->setExpand(bvec2(true,false));
|
||||
myCheckbox->setValue(isSetDisplayEndOfLine());
|
||||
myCheckbox->registerOnEvent(this, "clicked", l_changeRounded);
|
||||
myCheckbox->registerOnEvent(shared_from_this(), "clicked", l_changeRounded);
|
||||
subWidgetAdd(myCheckbox);
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,11 @@ namespace globals
|
||||
bool OrderTheBufferList();
|
||||
|
||||
class ParameterGlobalsGui : public ewol::widget::Sizer {
|
||||
public :
|
||||
protected:
|
||||
ParameterGlobalsGui();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(ParameterGlobalsGui);
|
||||
virtual ~ParameterGlobalsGui();
|
||||
// herited function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
|
@ -28,22 +28,12 @@
|
||||
#include <appl/ctags/readtags.h>
|
||||
#include <appl/globalMsg.h>
|
||||
|
||||
/**
|
||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
// only one things to do:
|
||||
return ewol::run(_argc, _argv);
|
||||
}
|
||||
ewol::object::Shared<appl::BufferManager> bufferManager = NULL;
|
||||
|
||||
/**
|
||||
* @brief main application function initialisation
|
||||
*/
|
||||
bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
|
||||
_nbInitStep = 1;
|
||||
class MainApplication : public ewol::context::Application {
|
||||
private:
|
||||
std::shared_ptr<appl::BufferManager> m_bufferManager;
|
||||
public:
|
||||
bool init(ewol::Context& _context, size_t _initId) {
|
||||
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||
|
||||
etk::theme::setName("COLOR", "color/black/");
|
||||
@ -67,7 +57,7 @@ bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
|
||||
|
||||
// init ALL Singleton :
|
||||
//()CTagsManager::getInstance();
|
||||
bufferManager = appl::BufferManager::keep();
|
||||
m_bufferManager = appl::BufferManager::create();
|
||||
|
||||
appl::highlightManager::init();
|
||||
appl::textPluginManager::init();
|
||||
@ -84,7 +74,7 @@ bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
|
||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||
//APPL_INFO("The current working directory is " << cCurrentPath);
|
||||
|
||||
ewol::object::Shared<MainWindows> basicWindows = ewol::object::makeShared(new MainWindows());
|
||||
std::shared_ptr<MainWindows> basicWindows = MainWindows::create();
|
||||
|
||||
if (basicWindows == nullptr) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
@ -112,25 +102,34 @@ bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("need load file : \"" << name << "\"" );
|
||||
bufferManager->open(name);
|
||||
m_bufferManager->open(name);
|
||||
}
|
||||
}
|
||||
|
||||
APPL_INFO(" == > init " PROJECT_NAME " (END)");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief main application function Un-Initialisation
|
||||
*/
|
||||
void APP_UnInit(ewol::Context& _context) {
|
||||
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
|
||||
bufferManager.reset();
|
||||
m_bufferManager.reset();
|
||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
// second possibility
|
||||
return ewol::run(new MainApplication(), _argc, _argv);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
1.2.0
|
||||
1.2.1
|
Loading…
x
Reference in New Issue
Block a user