124 Commits

Author SHA1 Message Date
f10f23219b Update README.md 2016-09-01 08:25:36 +02:00
6a937ebb8c [RELEASE] create release 1.3.0 2016-08-31 23:55:01 +02:00
da184c6767 [DEV] update esignal removing ISignal 2016-08-04 22:23:19 +02:00
4667e78aa6 [DEBUG] correct some un-understanding not parse file type like hxx 2016-07-24 14:42:50 +02:00
c7de44171d [DEBUG] remove a error warning (bad patch but it work) 2016-07-24 14:29:27 +02:00
8d22c48dc3 [DEBUG] correct all xml config language 2016-07-21 15:57:06 +02:00
8094d7c5ab [DEBUG] correct the regex error in the super size regex pattern (.|\n|\r)*? ==> bad patern 2016-07-21 15:29:56 +02:00
64b9f31a53 [DEV] update new ememory::SharedPtr 2016-07-19 22:03:39 +02:00
c284ad0b3a [DEV] clean header file 2016-05-02 22:01:55 +02:00
8eb7fe9839 [DEV] remove __class__ 2016-05-02 21:29:34 +02:00
0b84458985 [DEV] update the change on 'enum' to 'enum class' 2016-04-29 23:16:07 +02:00
c0de59ac9a [DEV] update las t ejson 2016-04-29 21:47:54 +02:00
dbc6b3439d [DEV] update new ejson interface 2016-04-20 21:19:11 +02:00
c7efaf95ab [DEV] corrrect internal bug link with exml portage 2016-04-19 22:05:42 +02:00
ac0ab974f6 [DEV] Update with the new exml API 2016-04-18 21:01:17 +02:00
1a2f0b6d91 [DEV] update etk::FSNode 2016-04-08 22:10:37 +02:00
235847a1c6 [DEV] not-in-doc ==> not_in_doc and add parsing in c++ 2016-04-01 21:30:23 +02:00
948e672eb1 [DEV] try to find reg-ex bug 2016-03-20 22:46:45 +01:00
bc7ed8f729 [DEV] remove dependency of date 2016-03-17 22:52:51 +01:00
0d47ff22e2 [DEV] update new ewol 2016-03-16 23:09:36 +01:00
c251a419ad [DEBUG] correct the bug of close file and open again ar seg-fault when write 2016-03-15 22:33:06 +01:00
a265735cd1 [DEBUG] correct many bugs 2016-03-10 23:48:07 +01:00
1821f2927b [DEBUG] correct some super integration bug 2016-03-10 22:37:37 +01:00
badb11d80d [DEV] update new property interface 2016-03-02 09:32:23 +01:00
499dfcffe6 [DEV] update new e-property 2016-02-24 22:31:46 +01:00
3f5d2abc41 [DEV] update new esignal (not build) 2016-02-19 23:33:00 +01:00
3e3c47cfa9 [DEV] update new ewol interface 2016-02-15 22:04:10 +01:00
c0705be42c [DEV] add personnal parameter 2016-02-12 23:50:20 +01:00
9f96beced2 [DEV] update to the hide implementation of esignal implementation 2016-02-11 22:39:40 +01:00
aed62ff58b [DEV] update externalisation of signal and property 2016-02-11 21:45:21 +01:00
2d4aac44fb [DEV] change build position 2016-01-15 21:18:24 +01:00
d3d4650d62 [DEV] correct the regex parsing error in the second highlight pass 2016-01-15 00:01:58 +01:00
c9b86afea0 [DEBUG] set correct name of buffer 2015-10-21 22:12:01 +02:00
d1f0caf386 [DEBUG] set back the close buffer 2015-10-21 22:12:01 +02:00
6980c78684 [DEV] update Doc 2015-10-15 08:36:21 +02:00
b5ef639438 [DEV] update new lutin 0.8.0 2015-10-14 21:21:03 +02:00
590e84e486 [DEV] change package in library ==> change idea of a package 2015-09-11 22:26:32 +02:00
cca05c01c0 [DEV] update new lutin 2015-09-10 21:32:50 +02:00
dbac89199f [DEV] correct application interface (update) 2015-09-07 22:15:33 +02:00
52ee889ee5 [DEV] update error of parsing c++ 2015-08-28 22:39:32 +02:00
893213c6c9 Update README.md 2015-08-26 14:04:42 +02:00
b5ff73e030 [DEV] add gcov parsing 2015-08-25 21:21:41 +02:00
82836ac045 [CI] update travis with new interface (no sudo) 2015-08-24 23:55:27 +02:00
0db5f0c528 [DEV] better parsing python, php and cpp 2015-08-24 22:03:07 +02:00
f6c4f4f9b3 [DEV] better parsing python, php and cpp 2015-08-24 22:03:07 +02:00
2028030df6 [DEV] better parsing python, php and cpp 2015-08-24 22:03:07 +02:00
c6269cbfd6 [DEV] update language xml and php 2015-08-22 10:15:58 +02:00
d2a7464341 [DEV] typo error 2015-08-21 23:56:17 +02:00
1fcf8b8a74 [DEV] update at the new low level gale interface 2015-08-11 23:21:41 +02:00
ad32734537 [DEV] update the parsing of java an python 2015-07-01 21:40:47 +02:00
89afc13dce [CI] pip for lutin error binary name 2015-05-21 22:30:58 +02:00
32b0b76fb9 [DEV] update search access and unaccess 2015-05-21 21:21:01 +02:00
4e527931c7 [CI] travis update for lutin pip & ewol repo interface 2015-05-20 21:13:48 +02:00
e0bf7c77c2 [DEV] help command line 2015-05-12 21:16:32 +02:00
2a467a7a5d [BUILD] update new lutin 0.5.3 2015-05-08 22:47:23 +02:00
386f5ed011 [CI] update travis build 2015-04-22 21:29:53 +02:00
1359193a63 [DEV] update to etk buffer remove 2015-04-06 21:06:01 +02:00
192bd045fa [DEV] update new exml interface 2015-01-14 21:10:23 +01:00
0f64bad930 [DEV] update new ejson interface 2015-01-12 23:20:23 +01:00
d2e9ab8b1a [DEV] add split of view ==> integration not ended, but it work 2014-11-14 23:57:29 +01:00
e17c9f9cf7 [API] update new Parameter API 2014-10-29 22:54:43 +01:00
7340844d12 [API] update new signal interface 2014-10-29 21:16:56 +01:00
bd9e5f03f4 [DEV] feature hide buffer list when number of buffer <= 1 2014-10-27 21:24:48 +01:00
2330788ace [VALGRING] error in some system access 2014-10-23 23:52:19 +02:00
e3dc686ec9 [DEBUG] C syntax error display in c++ 2014-10-21 23:19:02 +02:00
3f4a71065d [DEV] separate c++ & C and add filename in title 2014-10-21 21:18:50 +02:00
cefe0aacdb [INTEGRATION] update travis compilation 2014-10-17 22:12:43 +02:00
3c79dec2c8 [INTEGRATION] add color in travis build 2014-10-17 09:02:57 +02:00
7f7b3283e3 [DEV] add update of clang to set it work with timer 2014-10-17 09:00:46 +02:00
7c37d8e549 [DEV] add sub parsing of pass1 2014-10-13 22:39:49 +02:00
a201439665 [DEV] Update the parsing of many languages (pyton, cmake) is now good 2014-10-09 21:23:19 +02:00
67a08dd775 [DEBUG] correction of end of file regexp change 2014-10-08 21:32:41 +02:00
7952872980 [DEV] better regex ==> need to update alge to recognise data 2014-10-07 21:42:07 +02:00
78887e64ed [DEV] correction of the regex and add some basic test example 2014-10-07 00:45:01 +02:00
d93844d6da [DEV] first std::regex really work in c++ 2014-10-06 23:22:14 +02:00
243d7e7494 [DEV] change in etk::RegExp in std::regex 2014-10-05 23:46:57 +02:00
154351e629 [ERROR] Abandonned version in std::u32string ==> unexistant regexp 2014-10-03 21:44:13 +02:00
febbaffdf4 [DEV] {remove etk regexp dependency} big rework in progress to simplify code and use real std::regex templates 2014-10-03 00:49:26 +02:00
b890f931ca [DEV] remove problematic function parsing 2014-10-02 22:40:40 +02:00
2c3a64933d [DEV] transform plugin manager in unique resource 2014-09-18 22:27:54 +02:00
b8962cc3b9 [DEV] set travis depend on dev branch of ewol 2014-09-18 21:32:25 +02:00
f9ff0b8899 [DEBUG] remove lutinBase.py that is deprecated 2014-09-18 21:07:32 +02:00
f971c4fdfe [DEBUG]travis file error 2014-09-18 21:05:48 +02:00
6076698201 Create .travis.yml 2014-09-18 21:01:41 +02:00
c12ed9e7fa [DEBUG #9] freez correction ==> plugin data missing iterator 2014-09-18 21:01:41 +02:00
e29aa94cc5 [DEBUG #8] CLose the file after saving it when request close 2014-09-15 07:27:51 +02:00
05ac6a9210 [DEBUG #2 #7] close file and save it whan needed 2014-09-15 07:21:22 +02:00
0a054c209f [DEV] add parenting between bufferManager and Buffer 2014-09-12 22:10:32 +02:00
996fd58370 [DEBUG #1] Save file done 2014-09-12 21:52:03 +02:00
3574fd917c [DEBUG #5] correct file selection 2014-09-12 21:36:20 +02:00
b889b4aa5a [DEV] update plugin 2014-08-29 22:52:21 +02:00
668570cdc7 [DEV] start correct plugin interface 2014-08-28 22:31:00 +02:00
7e6f56a1cd [DEV] this plugin to the new ewol interface 2014-08-27 22:58:21 +02:00
a371c09e22 [DEV] update new signal system ==> run but not have many capabilities 2014-08-25 22:44:42 +02:00
cd3c5ff2d4 [DEV] update new object interface & rework global message (start) 2014-08-25 05:55:06 +02:00
686ec6d8bd [DEV] remove caller in signal emit 2014-08-22 05:21:10 +02:00
d31137e1a3 [DEBUG] gcc compilation warning 2014-08-21 21:00:13 +02:00
03fa46bbcd [DEV] rework signal interface (step 1 normalisation) 2014-08-20 22:34:31 +02:00
7da1beb12d [CLEAN] remove unneeded code 2014-08-19 21:47:33 +02:00
ddd21072b5 [DEV] plop 2014-08-17 23:30:37 +02:00
bf7899e045 [DEV] remove function onObjectRemove 2014-08-15 23:28:04 +02:00
3f0febce28 [DEV] change default Instance 2014-08-13 22:30:47 +02:00
5a924f7c9d [DEV] remove cyclic dependence on shared_ptr 2014-08-08 23:25:43 +02:00
39801fd265 [DEV] start dev with generic std::shared_ptr ==> basic work 2014-08-07 23:41:48 +02:00
ebdfd8be4c [DEV] update regexp of the languages 2014-08-01 23:44:34 +02:00
1d60917575 [DEBUG] correct C regExp 2014-07-30 23:24:26 +02:00
86d54590c0 [DEV] update new regexp system (not work correctly and only for C++) 2014-07-29 15:36:12 +02:00
b9a1c026fa [DEV] remove etk_min and etk_max & etk::Color<> interface 2014-07-03 21:03:26 +02:00
4942765ccf [DEV] add file chooser in shared mode 2014-06-30 22:36:36 +02:00
a425bdc17b [DEV] change manager interface in application 2014-06-30 22:36:36 +02:00
7d7d66d121 [DEV] change NULL ==> nullptr 2014-06-30 22:36:36 +02:00
55e05d24a3 [DEV] update new interface EWOL ewol::constext::Application 2014-06-30 22:36:36 +02:00
173e57342d [TAG] create 1.2-dev tag 2014-06-30 22:36:36 +02:00
09425067dc [DEV] remove to many request of focus 2014-06-03 22:19:00 +02:00
780234de13 [DEBUG] remove error in the HL update 2014-06-02 21:40:02 +02:00
c421bd5f90 [DEV] remove compilation warning 2014-06-02 21:04:35 +02:00
3ec3fa00d9 [DEV] work corectly with refcounting object (and remove some memory leek at close) 2014-05-27 21:43:02 +02:00
9b21e5c769 [DEV] correction some internal memory leek 2014-05-26 21:42:51 +02:00
2157099f0a [DEV] new staep to owner 2014-05-25 21:17:06 +02:00
d18b202e75 [DEV] init remove remove windows 2014-05-23 12:37:38 +02:00
63834fe960 [DEBUG] plugin are object ==> set it in shared pointer 2014-05-22 22:06:13 +02:00
cab0e6009d [DEV] update to the new API, system start but not compleately work 2014-05-20 23:26:14 +02:00
08261def10 [DEV] start rework on shared pointer 2014-05-20 21:35:41 +02:00
304ac2ba45 [DEV] start rework for dev interface of ewol 2014-05-19 22:30:39 +02:00
109 changed files with 4523 additions and 4150 deletions

70
.travis.yml Normal file
View File

@@ -0,0 +1,70 @@
language:
- cpp
sudo: false
compiler:
- clang
- gcc
os:
- linux
- osx
branches:
only:
- master
- dev
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
install:
- echo "BUILDER = $BUILDER"
- echo "BOARD = $BOARD"
- echo "CONF = $CONF"
- pip install --user lutin
env:
matrix:
- CONF=debug BOARD=Linux
#- CONF=debug BOARD=Windows
#- CONF=debug BOARD=Android
- CONF=release BOARD=Linux
#- CONF=release BOARD=Windows
#- CONF=release BOARD=Android
exclude:
- compiler: clang
env: BOARD=Windows
- compiler: clang
env: BOARD=Android
before_script:
- cd ..
- mkdir bin
- curl https://storage.googleapis.com/git-repo-downloads/repo > bin/repo
- chmod a+x bin/repo
- git config --global user.email "travis@travis.com"
- git config --global user.name "Travis"
- git config --global color.ui "auto"
- git config --global core.editor "vi"
- mkdir framework
- cd framework
- ../bin/repo init -u https://github.com/HeeroYui/manifest.git
- ../bin/repo sync -j8
- cd ..
- pwd
- ls -l
- if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi
- if [ "$CXX" == "g++" ]; then COMPILATOR_OPTION="--compilator-version=4.9"; else COMPILATOR_OPTION=""; fi
script:
- lutin -C -P -t $BOARD -c $BUILDER $COMPILATOR_OPTION -m $CONF -p edn
notifications:
email:
- yui.heero@gmail.com

View File

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

View File

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

View File

@@ -1,14 +1,27 @@
[Desktop Entry] [Desktop Entry]
Version=0.3.0
Name=Edn : Editeur de N'ours Name=Edn : Editeur de N'ours
Exec=edn Exec=edn %U
Icon=Edn Icon=/usr/share/edn/icon.png
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Development;Utility;TextEditor; Categories=Development;
GenericName=Text editor GenericName=Text editor
GenericName[en]=Text editor GenericName[en]=Text editor
GenericName[nl]=Tekst verwerker GenericName[nl]=Tekst verwerker
GenericName[fr]=éditeur de text GenericName[fr]=Éditeur de text
Comment=Code editor for c, c++, php, bash, xml ... Comment=Code editor for c, c++, php, bash, xml ...
Comment[fr]=éditeur de text pour les language c, c++, php, bash, xml ... Comment[fr]=éditeur de text pour les language c, c++, php, bash, xml ...
OnlyShowIn=GNOME;Unity;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Actions=New;
[Desktop Action New]
Name=Open a New Window
Name[fr]=Ouvrir une nouvelle fenêtre
Name[nl]=Nieuw venster openen
Name[en]=Open a New Window
Exec=edn
#desktop-file-validate edn.desktop
#sudo cp xxx /usr/share/applications/

0
data/lang/EN.json Normal file
View File

0
data/lang/FR.json Normal file
View File

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,58 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="C/C++"> <EdnLang version="0.1" lang="cmake">
<ext>CMakeLists.txt</ext> <ext>CMakeLists.txt</ext>
<ext>CMakeCache.txt</ext> <ext>CMakeCache.txt</ext>
<pass1> <pass1>
<rule name="my comment doxygen"> <rule name="my comment doxygen">
<color>commentDoxygen</color> <color>commentDoxygen</color>
<start>##</start> <regex>##.*</regex>
<end>\n</end>
</rule> </rule>
<rule name="my todo comment"> <rule name="my todo comment">
<color>SYNTAX_ERROR</color> <color>SYNTAX_ERROR</color>
<start>#[ \t]TODO[ \t]*:</start> <regex>#[ \t]TODO[ \t]*:(.|\\[\\\n])*</regex>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule> </rule>
<rule name="my comment"> <rule name="my comment">
<color>comment</color> <color>comment</color>
<start>#</start> <regex>#(.|\\[\\\n])*</regex>
<end>\n</end>
<EscapeChar>\</EscapeChar>
</rule> </rule>
<rule name="doubleQuteText"> <rule name="doubleQuteText">
<color>doubleQuoteText</color> <color>doubleQuoteText</color>
<start>"</start> <regex>&quot;(.|\\[\\&quot;])*?&quot;</regex>
<end>"</end>
<EscapeChar>\</EscapeChar>
</rule> </rule>
</pass1> </pass1>
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear --> <pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
<rule name="my keyword"> <rule name="my keyword">
<color>keyword</color> <color>keyword</color>
<start>\@foreach|message|endforeach|if|else|endif|list|file|string\@</start> <regex>\b(foreach|message|endforeach|if|else|endif|list|file|string)\b</regex>
</rule> </rule>
<rule name="my function keyword"> <rule name="my function keyword">
<color>systemFunction</color> <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>\b(set|include_directories|add_definitions|add_library|include_directories|target_link_libraries|project|include|check_include_file|enable_testing|option|cmake_minimum_required|add_definitions|check_include_file|configure_file|include_directories|add_custom_command|add_executable|add_test|find_package|pkg_check_modules|set_target_properties|source_group)\b</regex>
</rule> </rule>
<rule name="Variable"> <rule name="Variable">
<color>inputFunction</color> <color>inputFunction</color>
<start>${</start> <regex>\$\{.*\}</regex>
<end>}</end>
</rule> </rule>
<rule name="numeric constant"> <rule name="numeric constant">
<color>number</color> <color>number</color>
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start> <regex>\b(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)\b</regex>
</rule> </rule>
<rule name="BIG LETTER"> <rule name="BIG LETTER">
<color>macro</color> <color>macro</color>
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start> <regex>\b([A-Z_][A-Z_0-9]{3,500})\b</regex>
</rule> </rule>
<rule name="Function name"> <rule name="Function name">
<color>functionName</color> <color>functionName</color>
<start>\@(\w|_)+[ \t]*\(</start> <regex>\b(\w|_)+[ \t]*\(</regex>
</rule>
<rule name="files path">
<color>memberClass</color>
<regex>[\w-]*(\.|/)\w*</regex>
</rule> </rule>
</pass2> </pass2>
</EdnLang> </EdnLang>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

134
lutin_edn.py Normal file
View File

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

View File

@@ -1,34 +1,23 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <etk/types.h> #include <etk/types.h>
#include <etk/stdTools.h>
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <ewol/context/clipBoard.h> #include <gale/context/clipBoard.h>
#include <appl/HighlightManager.h> #include <appl/HighlightManager.h>
#undef __class__
#define __class__ "Buffer"
const char* const appl::Buffer::eventIsModify = "edn-is-modify";
const char* const appl::Buffer::eventIsSave = "edn-is-save";
const char* const appl::Buffer::eventSelectChange = "edn-select-change";
const char* const appl::Buffer::eventChangeName = "edn-buffer-name-change";
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () { appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
m_value = u32char::Null; m_value = u32char::Null;
if (m_current < 0) { if (m_current < 0) {
m_current = 0; m_current = 0;
return *this; return *this;
} }
if (m_data != NULL) { if (m_data != nullptr) {
if (m_current < m_data->m_data.size() ) { if (m_current < (int64_t)m_data->m_data.size() ) {
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]); int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
if (nbChar != 0) { if (nbChar != 0) {
m_current+=nbChar; m_current+=nbChar;
@@ -36,7 +25,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
m_current++; m_current++;
} }
} }
if (m_current >= m_data->m_data.size()) { if (m_current >= (int64_t)m_data->m_data.size()) {
m_current = m_data->m_data.size(); m_current = m_data->m_data.size();
} }
} }
@@ -45,7 +34,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- () { appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- () {
m_value = u32char::Null; m_value = u32char::Null;
if (m_data != NULL) { if (m_data != nullptr) {
if (m_current > 0) { if (m_current > 0) {
int32_t iii = -1; int32_t iii = -1;
while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false
@@ -68,12 +57,12 @@ char32_t appl::Buffer::Iterator::operator* () {
if (m_value != u32char::Null) { if (m_value != u32char::Null) {
return m_value; return m_value;
} }
if (m_data == NULL) { if (m_data == nullptr) {
APPL_ERROR("request an element that iterator not link"); APPL_ERROR("request an element that iterator not link");
return m_value; return m_value;
} }
if ( m_current < 0 if ( m_current < 0
|| m_current >= m_data->m_data.size()) { || m_current >= (int64_t)m_data->m_data.size()) {
APPL_ERROR("request an element out of bounding !!! 0 <= " << m_current << " < " << m_data->m_data.size()); APPL_ERROR("request an element out of bounding !!! 0 <= " << m_current << " < " << m_data->m_data.size());
return m_value; return m_value;
} }
@@ -81,7 +70,7 @@ char32_t appl::Buffer::Iterator::operator* () {
memset(tmpVal, 0, sizeof(tmpVal)); memset(tmpVal, 0, sizeof(tmpVal));
tmpVal[0] = m_data->m_data[m_current]; tmpVal[0] = m_data->m_data[m_current];
int8_t nbChar = utf8::theoricLen(tmpVal[0]); int8_t nbChar = utf8::theoricLen(tmpVal[0]);
for (int32_t iii=1; iii<nbChar && m_current+iii<m_data->m_data.size(); ++iii) { for (int32_t iii=1; iii<nbChar && m_current+iii<(int64_t)m_data->m_data.size(); ++iii) {
tmpVal[iii] = m_data->m_data[m_current+iii]; tmpVal[iii] = m_data->m_data[m_current+iii];
} }
// transform ... // transform ...
@@ -118,8 +107,11 @@ appl::Buffer::Iterator appl::Buffer::selectStop() {
return position( getStopSelectionPos() ); return position( getStopSelectionPos() );
} }
appl::Buffer::Buffer() : appl::Buffer::Buffer() :
signalIsModify(this, "is-modify", ""),
signalIsSave(this, "is-save", ""),
signalSelectChange(this, "select-change", ""),
signalChangeName(this, "change-name", ""),
m_hasFileName(false), m_hasFileName(false),
m_fileName(""), m_fileName(""),
m_isModify(false), m_isModify(false),
@@ -127,21 +119,19 @@ appl::Buffer::Buffer() :
m_cursorSelectPos(-1), m_cursorSelectPos(-1),
m_cursorPreferredCol(-1), m_cursorPreferredCol(-1),
m_nbLines(1), m_nbLines(1),
m_highlight(NULL) { m_highlight(nullptr) {
addObjectType("appl::Buffer"); addObjectType("appl::Buffer");
static int32_t bufferBaseId = 0; static int32_t bufferBaseId = 0;
m_fileName = "No Name " + std::to_string(bufferBaseId); m_fileName = "No Name " + etk::to_string(bufferBaseId);
bufferBaseId++; bufferBaseId++;
addEventId(eventIsModify); }
addEventId(eventIsSave);
addEventId(eventSelectChange); void appl::Buffer::init() {
addEventId(eventChangeName); ewol::Object::init();
} }
appl::Buffer::~Buffer() { appl::Buffer::~Buffer() {
if (m_highlight == NULL) { APPL_ERROR("REAL remove buffer : '" << propertyName << "'");
appl::Highlight::release(m_highlight);
}
} }
bool appl::Buffer::loadFile(const std::string& _name) { bool appl::Buffer::loadFile(const std::string& _name) {
@@ -155,13 +145,20 @@ bool appl::Buffer::loadFile(const std::string& _name) {
m_cursorPos = 0; m_cursorPos = 0;
setHighlightType(""); setHighlightType("");
m_nbLines = 0; m_nbLines = 0;
if (m_data.dumpFrom(m_fileName) == true ) { if (file.exist() == false) {
countNumberofLine(); APPL_ERROR("File : '" << m_fileName << "' does not exist...");
tryFindHighlightType(); return false;
m_isModify = false;
return true;
} }
return false; if (file.fileOpenRead() == false) {
APPL_ERROR("File : '" << m_fileName << "' Fail to open in read mode");
return false;
}
m_data = file.fileReadAllString();
file.fileClose();
countNumberofLine();
tryFindHighlightType();
m_isModify = false;
return true;
} }
void appl::Buffer::setFileName(const std::string& _name) { void appl::Buffer::setFileName(const std::string& _name) {
@@ -173,17 +170,21 @@ void appl::Buffer::setFileName(const std::string& _name) {
} }
m_fileName = name; m_fileName = name;
m_hasFileName = true; m_hasFileName = true;
generateEventId(eventChangeName); signalChangeName.emit();
setModification(true); setModification(true);
} }
bool appl::Buffer::storeFile() { bool appl::Buffer::storeFile() {
if (m_data.dumpIn(m_fileName) == true) { etk::FSNode file(m_fileName);
APPL_INFO("saving file : " << m_fileName); if (file.fileOpenWrite() == false) {
setModification(false); APPL_ERROR("File : '" << m_fileName << "' Fail to open in write mode");
return true; return false;
} }
return false; file.fileWriteAll(m_data);
file.fileClose();
APPL_INFO("saving file : " << m_fileName);
setModification(false);
return true;
} }
void appl::Buffer::setModification(bool _status) { void appl::Buffer::setModification(bool _status) {
@@ -192,9 +193,9 @@ void appl::Buffer::setModification(bool _status) {
} }
m_isModify = _status; m_isModify = _status;
if (m_isModify == true) { if (m_isModify == true) {
generateEventId(eventIsModify); signalIsModify.emit();
} else { } else {
generateEventId(eventIsSave); signalIsSave.emit();
} }
} }
@@ -301,7 +302,7 @@ bool appl::Buffer::search(const appl::Buffer::Iterator& _pos,
for (Iterator it = _pos; for (Iterator it = _pos;
(bool)it == true; (bool)it == true;
++it) { ++it) {
if (tolower(*it) == firstElement) { if ((char32_t)tolower(*it) == firstElement) {
// find the first char ==> check next... // find the first char ==> check next...
bool find = true; bool find = true;
Iterator tmp = it; Iterator tmp = it;
@@ -373,7 +374,7 @@ bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos,
(bool)it == true; (bool)it == true;
--it) { --it) {
//APPL_DEBUG("compare : " << *it << " ?= " << _search); //APPL_DEBUG("compare : " << *it << " ?= " << _search);
if (tolower(*it) == lastElement) { if ((char32_t)tolower(*it) == lastElement) {
// find the last char ==> check previous... // find the last char ==> check previous...
bool find = true; bool find = true;
_result = it; _result = it;
@@ -417,13 +418,13 @@ void appl::Buffer::moveCursor(int64_t _pos) {
if (m_cursorPos == m_cursorSelectPos) { if (m_cursorPos == m_cursorSelectPos) {
m_cursorSelectPos = -1; m_cursorSelectPos = -1;
} }
generateEventId(eventSelectChange); signalSelectChange.emit();
return; return;
} }
// move mode // move mode
m_cursorPos = _pos; m_cursorPos = _pos;
m_cursorSelectPos = -1; m_cursorSelectPos = -1;
generateEventId(eventSelectChange); signalSelectChange.emit();
} }
bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos, bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
@@ -516,12 +517,12 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
void appl::Buffer::setSelectionPos(const appl::Buffer::Iterator& _pos) { void appl::Buffer::setSelectionPos(const appl::Buffer::Iterator& _pos) {
m_cursorSelectPos = _pos; m_cursorSelectPos = _pos;
generateEventId(eventSelectChange); signalSelectChange.emit();
} }
void appl::Buffer::unSelect() { void appl::Buffer::unSelect() {
m_cursorSelectPos = -1; m_cursorSelectPos = -1;
generateEventId(eventSelectChange); signalSelectChange.emit();
} }
static const char *ControlCodeTable[32] = { static const char *ControlCodeTable[32] = {
@@ -641,7 +642,7 @@ bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator&
position = 0; position = 0;
} }
APPL_VERBOSE("write at pos: " << (int64_t)_pos << " ==> " << position << " data : " << _data); APPL_VERBOSE("write at pos: " << (int64_t)_pos << " ==> " << position << " data : " << _data);
m_data.insert(position, (int8_t*)(_data.c_str()), _data.size()); m_data.insert((size_t)position, _data);
if (m_cursorPos < 0) { if (m_cursorPos < 0) {
m_cursorPos = 0; m_cursorPos = 0;
} }
@@ -658,7 +659,7 @@ bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterato
if (position < 0){ if (position < 0){
position = 0; position = 0;
} }
m_data.replace(position, (int64_t)_posEnd-(int64_t)_pos, (int8_t*)(_data.c_str()), _data.size()); m_data.replace(m_data.begin() + position, m_data.begin() + (int64_t)_posEnd, _data.begin(), _data.end());
regenerateHighLightAt(position, (int64_t)_posEnd-(int64_t)_pos, _data.size()); regenerateHighLightAt(position, (int64_t)_posEnd-(int64_t)_pos, _data.size());
m_selectMode = false; m_selectMode = false;
moveCursor(position+_data.size()); moveCursor(position+_data.size());
@@ -673,7 +674,7 @@ void appl::Buffer::removeSelection() {
} }
int64_t startPos = getStartSelectionPos(); int64_t startPos = getStartSelectionPos();
int64_t endPos = getStopSelectionPos(); int64_t endPos = getStopSelectionPos();
m_data.remove(startPos, endPos-startPos); m_data.erase(startPos, endPos-startPos);
regenerateHighLightAt(startPos, endPos-startPos, 0); regenerateHighLightAt(startPos, endPos-startPos, 0);
m_selectMode = false; m_selectMode = false;
moveCursor(startPos); moveCursor(startPos);
@@ -683,7 +684,7 @@ void appl::Buffer::removeSelection() {
void appl::Buffer::tryFindHighlightType() { void appl::Buffer::tryFindHighlightType() {
etk::FSNode file(m_fileName); etk::FSNode file(m_fileName);
std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention()); std::string type = appl::highlightManager::getTypeFile(file.getNameFile());
if (type.size() == 0) { if (type.size() == 0) {
return; return;
} }
@@ -694,21 +695,19 @@ void appl::Buffer::tryFindHighlightType() {
void appl::Buffer::setHighlightType(const std::string& _type) { void appl::Buffer::setHighlightType(const std::string& _type) {
m_highlightType = ""; m_highlightType = "";
cleanHighLight(); cleanHighLight();
if (m_highlight == NULL) { m_highlight.reset();
appl::Highlight::release(m_highlight);
}
std::string resourceName = appl::highlightManager::getFileWithTypeType(_type); std::string resourceName = appl::highlightManager::getFileWithTypeType(_type);
if (resourceName == "") { if (resourceName == "") {
return; return;
} }
m_highlightType = _type; m_highlightType = _type;
m_highlight = appl::Highlight::keep(resourceName); m_highlight = appl::Highlight::create(resourceName);
generateHighLightAt(0, m_data.size()); generateHighLightAt(0, m_data.size());
} }
void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) { void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) {
// prevent ERROR... // prevent ERROR...
if (NULL == m_highlight) { if (m_highlight == nullptr) {
return; return;
} }
// prevent No data Call // prevent No data Call
@@ -717,7 +716,7 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
return; return;
} }
// normal case // normal case
//APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");"); APPL_VERBOSE("(_pos="<<_pos<<", _nbDeleted="<<_nbDeleted<<", _nbAdded=" << _nbAdded << "\");");
int64_t posEnd = _pos + _nbDeleted; int64_t posEnd = _pos + _nbDeleted;
// search position of the old element to reparse IT... // search position of the old element to reparse IT...
int64_t startId; int64_t startId;
@@ -730,60 +729,71 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
} }
// find element previous // find element previous
findMainHighLightPosition(_pos, posEnd, startId, stopId, true); findMainHighLightPosition(_pos, posEnd, startId, stopId, true);
APPL_VERBOSE(" list old parse:");
for (auto &elem : m_HLDataPass1) {
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
}
// Remove previous element to prevent many errors like parsing of // for example
startId--;
APPL_VERBOSE("Find startId=" << startId << " stopId=" << stopId << " list size=" << m_HLDataPass1.size());
// remove deprecated element // remove deprecated element
if ( startId == -1 if ( startId <= -1
&& stopId == -1) { && stopId <= -1) {
m_HLDataPass1.clear(); m_HLDataPass1.clear();
} else if (startId == -1) { APPL_VERBOSE("1 * clear");
} else if (startId <= -1) {
if (stopId == 0){ if (stopId == 0){
m_HLDataPass1.erase(m_HLDataPass1.begin()); m_HLDataPass1.erase(m_HLDataPass1.begin());
//APPL_DEBUG("1 * Erase 0"); APPL_VERBOSE("1 * Erase 0");
} else { } else {
m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId); m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId);
//APPL_DEBUG("2 * Erase 0->" << stopId); APPL_VERBOSE("2 * Erase 0->" << stopId);
} }
} else if (stopId == -1) { } else if (stopId <= -1) {
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end"); APPL_VERBOSE("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end()); m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end());
stopId = -1; stopId = -1;
} else { } else {
int32_t currentSize = m_HLDataPass1.size(); int32_t currentSize = m_HLDataPass1.size();
//APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" ); APPL_VERBOSE("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId); m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId+1);
if (stopId == currentSize-1) { if (stopId == currentSize-1) {
stopId = -1; stopId = -1;
} }
} }
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1); APPL_VERBOSE(" list afterRemove:");
for (auto &elem : m_HLDataPass1) {
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
}
// update position after the range position : // update position after the range position :
int64_t elemStart; int64_t elemStart;
if (startId == -1) { if (startId <= -1) {
elemStart = 0; elemStart = 0;
} else { } else {
elemStart = startId+1; elemStart = startId+1;
} }
for (int64_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { for (auto it(m_HLDataPass1.begin()+elemStart); it != m_HLDataPass1.end(); ++it) {
//APPL_DEBUG("move element=" << i); //APPL_DEBUG("move element=" << i);
m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted; it->start += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted; it->stop += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].endStart += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].endStop += _nbAdded - _nbDeleted;
} }
//Regenerate Element inside range //Regenerate Element inside range
if ( startId == -1 if ( startId <= -1
&& stopId == -1) { && stopId <= -1) {
//APPL_DEBUG("******* Regenerate ALL"); APPL_VERBOSE("******* Regenerate ALL");
generateHighLightAt(0, m_data.size()); generateHighLightAt(0, m_data.size());
} else if(-1 == startId) { } else if(startId <= -1) {
//APPL_DEBUG("******* Regenerate START"); APPL_VERBOSE("******* Regenerate START");
generateHighLightAt(0, m_HLDataPass1[0].beginStart, 0); generateHighLightAt(0, m_HLDataPass1[0].start, 0);
} else if(-1 == stopId) { } else if(stopId <= -1) {
//APPL_DEBUG("******* Regenerate STOP"); APPL_VERBOSE("******* Regenerate STOP");
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.size(), m_HLDataPass1.size()); generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].stop, m_data.size(), m_HLDataPass1.size());
} else { } else {
//APPL_DEBUG("******* Regenerate RANGE"); APPL_VERBOSE("******* 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);
} }
} }
@@ -831,8 +841,8 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
------------ ------------- ---------- ------------ ------------- ----------
S=-1 *************** E S=-1 *************** E
*/ */
for (int32_t iii = 0; iii < m_HLDataPass1.size(); ++iii) { for (size_t iii = 0; iii < m_HLDataPass1.size(); ++iii) {
if (m_HLDataPass1[iii].endStop > _startPos) { if (m_HLDataPass1[iii].stop > _startPos) {
break; break;
} }
_startId = iii; _startId = iii;
@@ -852,8 +862,8 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
} else { } else {
elemStart = _startId+1; elemStart = _startId+1;
} }
for (int32_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { for (size_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
if (m_HLDataPass1[iii].beginStart > _endPos) { if (m_HLDataPass1[iii].start > _endPos) {
_stopId = iii; _stopId = iii;
break; break;
} }
@@ -861,7 +871,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
} }
void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) { void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
if (NULL == m_highlight) { if (m_highlight == nullptr) {
return; return;
} }
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos); //APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
@@ -875,25 +885,25 @@ void appl::Buffer::cleanHighLight() {
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) { appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
int32_t start = etk_max(0, _starPos-1); int32_t start = std::max((int64_t)0, _starPos-1);
for (int32_t iii = start; iii < m_HLDataPass1.size(); ++iii) { for (size_t iii = start; iii < m_HLDataPass1.size(); ++iii) {
_starPos = iii; _starPos = iii;
if ( m_HLDataPass1[iii].beginStart <= _pos if ( m_HLDataPass1[iii].start <= _pos
&& m_HLDataPass1[iii].endStop > _pos) { && m_HLDataPass1[iii].stop > _pos) {
return &m_HLDataPass1[iii]; return &m_HLDataPass1[iii];
} }
if(m_HLDataPass1[iii].beginStart > _pos) { if(m_HLDataPass1[iii].start > _pos) {
return NULL; return nullptr;
} }
} }
return NULL; return nullptr;
} }
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) { void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines) {
_MData.posHLPass1 = 0; _MData.posHLPass1 = 0;
_MData.posHLPass2 = 0; _MData.posHLPass2 = 0;
if (NULL == m_highlight) { if (m_highlight == nullptr) {
return; return;
} }
//int64_t timeStart = ewol::getTime(); //int64_t timeStart = ewol::getTime();
@@ -913,48 +923,50 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
endSearch = m_HLDataPass1.size(); endSearch = m_HLDataPass1.size();
} }
int64_t kkk; int64_t kkk;
for (kkk = etk_max(startId, 0); kkk < endSearch; ++kkk) { for (kkk = std::max(startId, (int64_t)0); kkk < endSearch; ++kkk) {
// empty section : // empty section :
if (kkk == 0) { if (kkk == 0) {
if (HLStartPos < m_HLDataPass1[kkk].beginStart) { if (HLStartPos < m_HLDataPass1[kkk].start) {
APPL_VERBOSE(" == > (empty section 1 ) kkk=" << kkk << APPL_VERBOSE(" == > (empty section 1 ) kkk=" << kkk <<
" start=" << HLStartPos << " start=" << HLStartPos <<
" stop=" << m_HLDataPass1[kkk].beginStart ); " stop=" << m_HLDataPass1[kkk].start );
m_highlight->parse2(HLStartPos, m_highlight->parse2(HLStartPos,
m_HLDataPass1[kkk].beginStart, m_HLDataPass1[kkk].start,
_MData.HLData, _MData.HLData,
m_data); m_data);
} // else : nothing to do ... } // else : nothing to do ...
} else { } else {
APPL_VERBOSE(" == > (empty section 2 ) kkk=" << kkk << APPL_VERBOSE(" == > (empty section 2 ) kkk=" << kkk <<
" start=" << m_HLDataPass1[kkk-1].endStop << " start=" << m_HLDataPass1[kkk-1].stop <<
" stop=" << m_HLDataPass1[kkk].beginStart ); " stop=" << m_HLDataPass1[kkk].start );
m_highlight->parse2(m_HLDataPass1[kkk-1].endStop, m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
m_HLDataPass1[kkk].beginStart, m_HLDataPass1[kkk].start,
_MData.HLData, _MData.HLData,
m_data); m_data);
} }
// under section : // under section :
//APPL_DEBUG(" == > (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999); APPL_VERBOSE(" == > (under section ) kkk="<<kkk<<" start="<<m_HLDataPass1[kkk].start<<" stop="<<m_HLDataPass1[kkk].stop << " subSectionOfID=" << 99999999);
// TODO : ... m_highlight->parseSubElement(m_HLDataPass1[kkk],
_MData.HLData,
m_data);
} }
if (endSearch == (int32_t)m_HLDataPass1.size() ){ if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.size()) { //if( k < (int32_t)m_HLDataPass1.size()) {
if (m_HLDataPass1.size() != 0) { if (m_HLDataPass1.size() != 0) {
APPL_VERBOSE(" == > (empty section 3 ) kkk=" << kkk << APPL_VERBOSE(" == > (empty section 3 ) kkk=" << kkk <<
" start=" << m_HLDataPass1[kkk-1].endStop << " start=" << m_HLDataPass1[kkk-1].stop <<
" stop=" << HLStop ); " stop=" << HLStop );
m_highlight->parse2(m_HLDataPass1[kkk-1].endStop, m_highlight->parse2(m_HLDataPass1[kkk-1].stop,
HLStop, HLStop,
_MData.HLData, _MData.HLData,
m_data); m_data);
} else { } else {
APPL_VERBOSE(" == > (empty section 4 ) kkk=" << kkk << APPL_VERBOSE(" == > (empty section 4 ) kkk=" << kkk <<
" start=0 stop=" << HLStop ); " start=0 stop=" << HLStop );
m_highlight->parse2(0, m_highlight->parse2(0,
HLStop, HLStop,
_MData.HLData, _MData.HLData,
m_data); m_data);
} }
} }
/* /*
@@ -965,15 +977,15 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos) { appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos) {
int64_t start = etk_max(0, _MData.posHLPass2-1); int64_t start = std::max((int64_t)0, _MData.posHLPass2-1);
for (int64_t iii=start; iii<(int32_t)_MData.HLData.size(); iii++) { for (int64_t iii=start; iii<(int32_t)_MData.HLData.size(); iii++) {
_MData.posHLPass2 = iii; _MData.posHLPass2 = iii;
if( _MData.HLData[iii].beginStart <= _pos if( _MData.HLData[iii].start <= _pos
&& _MData.HLData[iii].endStop > _pos) && _MData.HLData[iii].stop > _pos)
{ {
return &_MData.HLData[iii]; return &_MData.HLData[iii];
} }
if(_MData.HLData[iii].beginStart > _pos) { if(_MData.HLData[iii].start > _pos) {
return getElementColorAtPosition(_pos, _MData.posHLPass1); return getElementColorAtPosition(_pos, _MData.posHLPass1);
} }
} }
@@ -994,3 +1006,46 @@ uint32_t appl::Buffer::getCursorLinesId() {
} }
return line; return line;
} }
namespace etk {
template<> std::string to_string<ememory::SharedPtr<appl::Buffer>>(const ememory::SharedPtr<appl::Buffer>& _obj) {
if (_obj != nullptr) {
return _obj->getFileName();
}
return "";
}
template<> std::u32string to_u32string<ememory::SharedPtr<appl::Buffer>>(const ememory::SharedPtr<appl::Buffer>& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<ememory::SharedPtr<appl::Buffer>>(ememory::SharedPtr<appl::Buffer>& _variableRet, const std::string& _value) {
if (_variableRet != nullptr) {
_variableRet->loadFile(_value);
return true;
}
return false;
}
template<> bool from_string<ememory::SharedPtr<appl::Buffer>>(ememory::SharedPtr<appl::Buffer>& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
template<> std::string to_string<appl::Buffer>(const appl::Buffer& _obj) {
return _obj.getFileName();
}
template<> std::u32string to_u32string<appl::Buffer>(const appl::Buffer& _obj) {
return etk::to_u32string(etk::to_string(_obj));
}
template<> bool from_string<appl::Buffer>(appl::Buffer& _variableRet, const std::string& _value) {
_variableRet.loadFile(_value);
return true;
}
template<> bool from_string<appl::Buffer>(appl::Buffer& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
}
};
#include <esignal/details/Signal.hxx>
// declare for signal event
ESIGNAL_DECLARE_SIGNAL(ememory::SharedPtr<appl::Buffer>);

View File

@@ -1,22 +1,18 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_BUFFER_H__
#define __APPL_BUFFER_H__
#include <etk/types.h> #include <etk/types.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <etk/Buffer.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/compositing/Text.h> #include <ewol/compositing/Text.h>
#include <appl/Highlight.h> #include <appl/Highlight.h>
#include <esignal/Signal.h>
namespace appl { namespace appl {
@@ -26,6 +22,9 @@ namespace appl {
int64_t posHLPass1; int64_t posHLPass1;
int64_t posHLPass2; int64_t posHLPass2;
}; };
class Buffer;
using BufferShared = ememory::SharedPtr<appl::Buffer>;
using BufferWeak = ememory::WeakPtr<appl::Buffer>;
class Buffer : public ewol::Object { class Buffer : public ewol::Object {
public: public:
class Iterator { class Iterator {
@@ -40,7 +39,7 @@ namespace appl {
*/ */
Iterator(): Iterator():
m_current(0), m_current(0),
m_data(NULL), m_data(nullptr),
m_value(u32char::Null) { m_value(u32char::Null) {
// nothing to do ... // nothing to do ...
}; };
@@ -68,9 +67,9 @@ namespace appl {
/** /**
* @brief Basic destructor * @brief Basic destructor
*/ */
~Iterator() { virtual ~Iterator() {
m_current = 0; m_current = 0;
m_data = NULL; m_data = nullptr;
m_value = u32char::Null; m_value = u32char::Null;
}; };
/** /**
@@ -78,10 +77,10 @@ namespace appl {
* @return true if the element is present in buffer * @return true if the element is present in buffer
*/ */
operator bool () const { operator bool () const {
if (m_data == NULL) { if (m_data == nullptr) {
return false; return false;
} }
if (m_current >= m_data->m_data.size()) { if (m_current >= (int64_t)m_data->m_data.size()) {
return false; return false;
} }
if (m_current < 0) { if (m_current < 0) {
@@ -94,14 +93,14 @@ namespace appl {
* @return true if the element is present in buffer * @return true if the element is present in buffer
*/ */
operator int64_t () const { operator int64_t () const {
if (m_data == NULL) { if (m_data == nullptr) {
return 0; return 0;
} }
if (m_current < 0) { if (m_current < 0) {
return 0; return 0;
} }
if (m_current > m_data->m_data.size()) { if (m_current > (int64_t)m_data->m_data.size()) {
return m_data->m_data.size(); return (int64_t)m_data->m_data.size();
} }
return m_current; return m_current;
}; };
@@ -217,13 +216,13 @@ namespace appl {
* @return The requested position. * @return The requested position.
*/ */
int64_t getPos() const { int64_t getPos() const {
if (m_data == NULL) { if (m_data == nullptr) {
return 0; return 0;
} }
if (m_current < 0) { if (m_current < 0) {
return 0; return 0;
} }
if (m_current >= m_data->m_data.size()) { if (m_current >= (int64_t)m_data->m_data.size()) {
return m_data->m_data.size()-1; return m_data->m_data.size()-1;
} }
return m_current; return m_current;
@@ -248,7 +247,7 @@ namespace appl {
}; };
Iterator operator+ (const size_t _val) const { Iterator operator+ (const size_t _val) const {
Iterator tmpp(*this); Iterator tmpp(*this);
for (int64_t iii=0; iii<_val; ++iii) { for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
++tmpp; ++tmpp;
} }
return tmpp; return tmpp;
@@ -273,7 +272,7 @@ namespace appl {
}; };
Iterator operator- (const size_t _val) const { Iterator operator- (const size_t _val) const {
Iterator tmpp(*this); Iterator tmpp(*this);
for (int64_t iii=0; iii<_val; ++iii) { for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
--tmpp; --tmpp;
} }
return tmpp; return tmpp;
@@ -288,13 +287,16 @@ namespace appl {
friend class Buffer; friend class Buffer;
}; };
public: public:
static const char* const eventIsModify; esignal::Signal<> signalIsModify;
static const char* const eventIsSave; esignal::Signal<> signalIsSave;
static const char* const eventSelectChange; esignal::Signal<> signalSelectChange;
static const char* const eventChangeName; esignal::Signal<> signalChangeName;
public: protected:
Buffer(); Buffer();
~Buffer(); void init();
public:
DECLARE_FACTORY(Buffer);
virtual ~Buffer();
private: private:
bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ... bool m_hasFileName; //!< when new file, the buffer has no name ==> but it might be reference with a single name ...
std::string m_fileName; //!< name of the file (with his path) std::string m_fileName; //!< name of the file (with his path)
@@ -302,14 +304,14 @@ namespace appl {
/** /**
* @brief get the curent filename of the Buffer * @brief get the curent filename of the Buffer
*/ */
const std::string& getFileName() { const std::string& getFileName() const {
return m_fileName; return m_fileName;
} }
/** /**
* @brief Check if the buffer has a real filename. * @brief Check if the buffer has a real filename.
* @return the status of the existance of a name. * @return the status of the existance of a name.
*/ */
bool hasFileName() { bool hasFileName() const {
return m_hasFileName; return m_hasFileName;
} }
/** /**
@@ -335,7 +337,7 @@ namespace appl {
* @breif get the status of file modification. * @breif get the status of file modification.
* @return true if file is modify. * @return true if file is modify.
*/ */
bool isModify() { bool isModify() const {
return m_isModify; return m_isModify;
} }
/** /**
@@ -344,9 +346,9 @@ namespace appl {
*/ */
void setModification(bool _status); void setModification(bool _status);
protected: protected:
etk::Buffer m_data; //!< copy of the file buffer std::string m_data; //!< copy of the file buffer
public: public:
etk::Buffer& getData() { std::string& getData() {
return m_data; return m_data;
}; };
protected: protected:
@@ -381,14 +383,14 @@ namespace appl {
* @return position of the start selection. * @return position of the start selection.
*/ */
int64_t getStartSelectionPos() { int64_t getStartSelectionPos() {
return etk_min(m_cursorPos, m_cursorSelectPos); return std::min(m_cursorPos, m_cursorSelectPos);
} }
/** /**
* @brief Get the Stop position of the selection. * @brief Get the Stop position of the selection.
* @return position of the stop selection. * @return position of the stop selection.
*/ */
int64_t getStopSelectionPos() { int64_t getStopSelectionPos() {
return etk_max(m_cursorPos, m_cursorSelectPos); return std::max(m_cursorPos, m_cursorSelectPos);
} }
protected: protected:
float m_cursorPreferredCol; //!< position of the cursor when up and down is done. float m_cursorPreferredCol; //!< position of the cursor when up and down is done.
@@ -588,7 +590,7 @@ namespace appl {
protected: protected:
std::string m_highlightType; //!< Name of the highlight type std::string m_highlightType; //!< Name of the highlight type
appl::Highlight* m_highlight; //!< internal link with the Highlight system ememory::SharedPtr<appl::Highlight> m_highlight; //!< internal link with the Highlight system
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1 std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
public: public:
/** /**
@@ -620,7 +622,4 @@ namespace appl {
void hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines); void hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines);
appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos); appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos);
}; };
}; }
#endif

View File

@@ -1,11 +1,8 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <etk/types.h> #include <etk/types.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <appl/debug.h> #include <appl/debug.h>
@@ -13,96 +10,101 @@
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/object/Manager.h> #include <ewol/object/Manager.h>
#include <ewol/resource/Manager.h> #include <esignal/Signal.h>
#include <gale/resource/Manager.h>
#undef __class__
#define __class__ "BufferManager"
appl::BufferManager::BufferManager() : appl::BufferManager::BufferManager() :
ewol::Resource("???BufferManager???"), signalNewBuffer(this, "new-buffer", ""),
m_bufferSelected(NULL) { signalSelectFile(this, "select-buffer", ""),
signalTextSelectionChange(this, "text-selection-change", ""),
signalRemoveBuffer(this, "remove-buffer", "") {
addObjectType("appl::BufferManager"); addObjectType("appl::BufferManager");
} }
appl::BufferManager::~BufferManager() { appl::BufferManager::~BufferManager() {
int32_t previousCount = m_list.size();
for (int32_t iii = m_list.size()-1; iii >= 0 ; --iii) {
if (m_list[iii] == NULL) {
continue;
}
delete(m_list[iii]);
if (previousCount == m_list.size()) {
APPL_ERROR("Error in removing buffer !! ");
}
previousCount = m_list.size();
}
m_list.clear(); m_list.clear();
} }
appl::Buffer* appl::BufferManager::createNewBuffer() { ememory::SharedPtr<appl::Buffer> appl::BufferManager::createNewBuffer() {
appl::Buffer* tmp = new appl::Buffer(); ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
if (tmp == NULL) { if (tmp == nullptr) {
APPL_ERROR("Can not allocate the Buffer (empty)."); APPL_ERROR("Can not allocate the Buffer (empty).");
return NULL; return nullptr;
} }
tmp->setParent(ewol::Object::sharedFromThis());
m_list.push_back(tmp); m_list.push_back(tmp);
sendMultiCast(appl::MsgSelectNewFile, tmp->getFileName()); APPL_INFO("Create a new Buffer");
signalNewBuffer.emit(tmp->getFileName());
APPL_INFO("Create a new Buffer (done)");
APPL_INFO("select Buffer");
signalSelectFile.emit(tmp->getFileName());
APPL_INFO("select Buffer (done)");
return tmp; return tmp;
} }
appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) { ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")"); APPL_INFO("get('" << _fileName << "'," << _createIfNeeded << ")");
for (int32_t iii = 0; iii < m_list.size(); ++iii) { for (auto &it : m_list) {
if (m_list[iii] == NULL) { if (it == nullptr) {
continue; continue;
} }
if (m_list[iii]->getFileName() == _fileName) { if (it->getFileName() == _fileName) {
return m_list[iii]; return it;
} }
} }
if (_createIfNeeded == true) { if (_createIfNeeded == true) {
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) { if (etk::FSNodeGetType(_fileName) == etk::typeNode_folder) {
APPL_WARNING("try open a folder : " << _fileName); APPL_WARNING("try open a folder : " << _fileName);
APPL_CRITICAL("plop"); APPL_CRITICAL("plop");
return NULL; return nullptr;
} }
appl::Buffer* tmp = new appl::Buffer(); ememory::SharedPtr<appl::Buffer> tmp = appl::Buffer::create();
if (tmp == NULL) { if (tmp == nullptr) {
APPL_ERROR("Can not allocate the Buffer class : " << _fileName); APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
return NULL; return nullptr;
} }
tmp->setParent(ewol::Object::sharedFromThis());
tmp->loadFile(_fileName); tmp->loadFile(_fileName);
m_list.push_back(tmp); m_list.push_back(tmp);
APPL_INFO("Creata a open Buffer");
signalNewBuffer.emit(tmp->getFileName());
APPL_INFO("Creata a open Buffer (done)");
return tmp; return tmp;
} }
return NULL; return nullptr;
}
void appl::BufferManager::setBufferSelected(appl::Buffer* _bufferSelected) {
m_bufferSelected = _bufferSelected;
sendMultiCast(appl::MsgSelectChange, "");
} }
void appl::BufferManager::onObjectRemove(ewol::Object * _removeObject) { void appl::BufferManager::setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected) {
if (m_bufferSelected == _removeObject) { m_bufferSelected = _bufferSelected;
setBufferSelected(NULL); if (m_bufferSelected == nullptr) {
} APPL_ERROR("select a NULL buffer ...");
for (int32_t iii = 0; iii < m_list.size(); ++iii) { propertySetOnWidgetNamed("appl-widget-display-name", "value", "---");
if (m_list[iii] != _removeObject) {
continue;
}
m_list[iii] = NULL;
m_list.erase(m_list.begin()+iii);
return; return;
} }
APPL_INFO("Set buffer selected");
//signalSelectFile.emit(m_bufferSelected->getName());
//propertySetOnWidgetNamed("appl-widget-display-name", "value", m_bufferSelected->getName());
APPL_INFO("Set buffer selected (done)");
}
ememory::SharedPtr<appl::Buffer> appl::BufferManager::get(int32_t _id) {
int32_t id = 0;
for (auto &it : m_list) {
if (id == _id) {
return it;
}
id++;
}
return m_list.back();
} }
bool appl::BufferManager::exist(const std::string& _fileName) { bool appl::BufferManager::exist(const std::string& _fileName) {
for (int32_t iii = 0; iii < m_list.size(); ++iii) { for (auto &it : m_list) {
if (m_list[iii] == NULL) { if (it == nullptr) {
continue; continue;
} }
if (m_list[iii]->getFileName() == _fileName) { if (it->getFileName() == _fileName) {
return true; return true;
} }
} }
@@ -111,40 +113,60 @@ bool appl::BufferManager::exist(const std::string& _fileName) {
void appl::BufferManager::open(const std::string& _fileName) { void appl::BufferManager::open(const std::string& _fileName) {
if (exist(_fileName) == true) { if (exist(_fileName) == true) {
APPL_WARNING(" the element '" << _fileName << "' already exist ... just reselect it ...");
signalSelectFile.emit(_fileName);
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(_fileName));
return; return;
} }
if (get(_fileName, true) == NULL) { if (get(_fileName, true) == nullptr) {
APPL_ERROR("Error get '" << _fileName << "' ... ");
return; return;
} }
sendMultiCast(appl::MsgSelectNewFile, _fileName); signalSelectFile.emit(_fileName);
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(_fileName));
} }
void appl::BufferManager::onReceiveMessage(const ewol::object::Message& _msg) { void appl::BufferManager::requestDestroyFromChild(const ememory::SharedPtr<Object>& _child) {
APPL_DEBUG("receive message !!! " << _msg); APPL_WARNING("Buffer request a close...");
bool find = false;
int32_t newValue = -1;
auto it = m_list.begin();
while(it != m_list.end()) {
if (*it == nullptr) {
it = m_list.erase(it);
continue;
}
if (*it == _child) {
it = m_list.erase(it);
find = true;
break;
}
newValue++;
++it;
}
if (find == true) {
signalRemoveBuffer.emit(ememory::dynamicPointerCast<appl::Buffer>(_child));
}
if (m_bufferSelected == _child) {
if ( it != m_list.end()
&& *it != nullptr) {
APPL_VERBOSE("Remove buffer select new one");
signalSelectFile.emit((*it)->getFileName());
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName((*it)->getFileName()));
APPL_VERBOSE("Remove buffer select new one (done)");
return;
}
if ( m_list.size() != 0
&& m_list.back() != nullptr) {
APPL_VERBOSE("Remove buffer select new one (last)");
signalSelectFile.emit(m_list.back()->getFileName());
propertySetOnWidgetNamed("appl-widget-display-name", "value", etk::FSNodeGetRealName(m_list.back()->getFileName()));
APPL_VERBOSE("Remove buffer select new one (done)");
return;
}
signalSelectFile.emit("");
propertySetOnWidgetNamed("appl-widget-display-name", "value", "---");
m_bufferSelected = nullptr;
}
} }
appl::BufferManager* appl::BufferManager::keep() {
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
appl::BufferManager* object = static_cast<appl::BufferManager*>(getManager().localKeep("???BufferManager???"));
if (NULL != object) {
return object;
}
// this element create a new one every time ....
EWOL_INFO("CREATE : appl::BufferManager: ???BufferManager???");
object = new appl::BufferManager();
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ???BufferManager???");
return NULL;
}
getManager().localAdd(object);
return object;
}
void appl::BufferManager::release(appl::BufferManager*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@@ -1,26 +1,34 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __BUFFER_MANAGER_H__ #include <list>
#define __BUFFER_MANAGER_H__
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/resource/Resource.h> #include <gale/resource/Resource.h>
namespace appl { namespace appl {
class BufferManager : public ewol::Resource { class BufferManager;
using BufferManagerShared = ememory::SharedPtr<appl::BufferManager>;
using BufferManagerWeak = ememory::WeakPtr<appl::BufferManager>;
// TODO: This is a service ...
class BufferManager : public ewol::Object {
public:
esignal::Signal<std::string> signalNewBuffer;
esignal::Signal<std::string> signalSelectFile;
esignal::Signal<> signalTextSelectionChange;
esignal::Signal<ememory::SharedPtr<appl::Buffer>> signalRemoveBuffer;
protected: protected:
BufferManager(); BufferManager();
~BufferManager(); public:
DECLARE_SINGLE_FACTORY(BufferManager, "???Buffer_Manager???");
virtual ~BufferManager();
private: private:
std::vector<appl::Buffer*> m_list; // list of all buffer curently open std::list<ememory::SharedPtr<appl::Buffer>> m_list; // list of all buffer curently open
public: public:
/** /**
* @brief Get a specific buffer with his name (can create a new buffer). * @brief Get a specific buffer with his name (can create a new buffer).
@@ -28,7 +36,7 @@ namespace appl {
* @param[in] _createIfNeeded Create the buffer if not existed. * @param[in] _createIfNeeded Create the buffer if not existed.
* @return a pointer on the buffer * @return a pointer on the buffer
*/ */
appl::Buffer* get(const std::string& _fileName, bool _createIfNeeded=false); ememory::SharedPtr<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
/** /**
* @brief Load a specific file, event if it not existed: * @brief Load a specific file, event if it not existed:
* @param[in] _fileName Name of the file to open or create. * @param[in] _fileName Name of the file to open or create.
@@ -52,47 +60,44 @@ namespace appl {
* @param[in] _id Number of buffer * @param[in] _id Number of buffer
* @return pointer on the buffer * @return pointer on the buffer
*/ */
appl::Buffer* get(int32_t _id) { ememory::SharedPtr<appl::Buffer> get(int32_t _id);
return m_list[_id];
}
/** /**
* @brief Create a new buffer empty. * @brief Create a new buffer empty.
* @return Created buffer or NULL. * @return Created buffer or nullptr.
*/ */
appl::Buffer* createNewBuffer(); ememory::SharedPtr<appl::Buffer> createNewBuffer();
private: private:
appl::Buffer* m_bufferSelected; ememory::SharedPtr<appl::Buffer> m_bufferSelected;
public: public:
/** /**
* @brief Set the current buffer selected * @brief Set the current buffer selected
* @param[in] _bufferSelected Pointer on the buffer selected * @param[in] _bufferSelected Pointer on the buffer selected
*/ */
void setBufferSelected(appl::Buffer* _bufferSelected); void setBufferSelected(ememory::SharedPtr<appl::Buffer> _bufferSelected);
/** /**
* @brief Get the current buffer selected * @brief Get the current buffer selected
* @return Pointer on the buffer selected * @return Pointer on the buffer selected
*/ */
appl::Buffer* getBufferSelected() { ememory::SharedPtr<appl::Buffer> getBufferSelected() {
return m_bufferSelected; return m_bufferSelected;
}; };
public: // herited function private:
void onReceiveMessage(const ewol::object::Message& _msg); void requestDestroyFromChild(const ememory::SharedPtr<Object>& _child);
void onObjectRemove(ewol::Object * _removeObject); public:
public: // resource manager // generic iterators:
/** std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator begin() const {
* @brief keep the resource pointer. return m_list.begin();
* @note Never free this pointer by your own... }
* @param[in] _filename Name of the configuration file. std::list<ememory::SharedPtr<appl::Buffer>>::const_iterator end() const {
* @return pointer on the resource or NULL if an error occured. return m_list.end();
*/ }
static appl::BufferManager* keep(); std::list<ememory::SharedPtr<appl::Buffer>>::iterator begin() {
/** return m_list.begin();
* @brief release the keeped resources }
* @param[in,out] reference on the object pointer std::list<ememory::SharedPtr<appl::Buffer>>::iterator end() {
*/ return m_list.end();
static void release(appl::BufferManager*& _object); }
}; };
}; }
#endif

View File

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

View File

@@ -1,13 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __GLYPH_DECORATION_H__
#define __GLYPH_DECORATION_H__
#include <etk/Color.h> #include <etk/Color.h>
#include <etk/types.h> #include <etk/types.h>
@@ -17,7 +13,7 @@ namespace appl {
public: public:
// Constructeur // Constructeur
GlyphDecoration(const std::string& _newColorName = "no_name"); GlyphDecoration(const std::string& _newColorName = "no_name");
~GlyphDecoration() { virtual ~GlyphDecoration() {
// nothing to do ... // nothing to do ...
}; };
private: private:
@@ -119,6 +115,4 @@ namespace appl {
std::ostream& operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj); std::ostream& operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj);
} }
#endif

View File

@@ -1,27 +1,23 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/GlyphPainting.h> #include <appl/GlyphPainting.h>
#include <ejson/ejson.h> #include <ejson/ejson.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#undef __class__
#define __class__ "GlyphPainting"
appl::GlyphPainting::GlyphPainting() {
addResourceType("appl::GlyphPainting");
}
appl::GlyphPainting::GlyphPainting(const std::string& _filename) : void appl::GlyphPainting::init(const std::string& _filename) {
ewol::Resource(_filename) { gale::Resource::init(_filename);
addObjectType("appl::GlyphPainting"); APPL_DEBUG("SFP : load \"" << _filename << "\"");
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
reload(); reload();
} }
@@ -31,7 +27,7 @@ appl::GlyphPainting::~GlyphPainting() {
void appl::GlyphPainting::reload() { void appl::GlyphPainting::reload() {
ejson::Document doc; ejson::Document doc;
if (false == doc.load(m_name)) { if (doc.load(m_name) == false) {
APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName());
return; return;
} }
@@ -42,25 +38,25 @@ void appl::GlyphPainting::reload() {
doc.generate(tmppppp); doc.generate(tmppppp);
APPL_DEBUG(tmppppp); APPL_DEBUG(tmppppp);
*/ */
ejson::Array* baseArray = doc.getArray("ednColor"); ejson::Array baseArray = doc["ednColor"].toArray();
if (baseArray == NULL) { if (baseArray.exist() == false) {
APPL_ERROR("Can not get basic array : 'ednColor'"); APPL_ERROR("Can not get basic array : 'ednColor'");
return; return;
} }
for (int32_t iii = 0; iii < baseArray->size(); ++iii) { for (const auto it : baseArray) {
ejson::Object* tmpObj = baseArray->getObject(iii); ejson::Object tmpObj = it.toObject();
if (tmpObj == NULL) { if (tmpObj.exist() == false) {
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii); APPL_DEBUG(" can not get object in 'ednColor' it=" << it);
continue; continue;
} }
std::string name = tmpObj->getStringValue("name", ""); std::string name = tmpObj["name"].toString().get();
std::string background = tmpObj->getStringValue("background", "#FFF0"); std::string background = tmpObj["background"].toString().get("#FFF0");
std::string foreground = tmpObj->getStringValue("foreground", "#000F"); std::string foreground = tmpObj["foreground"].toString().get("#000F");
bool italic = tmpObj->getBooleanValue("italic", false); bool italic = tmpObj["italic"].toBoolean().get(false);
bool bold = tmpObj->getBooleanValue("bold", false); bool bold = tmpObj["bold"].toBoolean().get(false);
APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'"); APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'");
bool findElement = false; bool findElement = false;
for (int32_t jjj=0; jjj<m_list.size(); ++jjj) { for (size_t jjj=0; jjj<m_list.size(); ++jjj) {
if (m_list[jjj].getName() != name) { if (m_list[jjj].getName() != name) {
continue; continue;
} }
@@ -84,7 +80,7 @@ void appl::GlyphPainting::reload() {
int32_t appl::GlyphPainting::request(const std::string& _name) { int32_t appl::GlyphPainting::request(const std::string& _name) {
for (int32_t iii=0; iii<m_list.size(); ++iii) { for (size_t iii=0; iii<m_list.size(); ++iii) {
if (m_list[iii].getName() == _name) { if (m_list[iii].getName() == _name) {
return iii; return iii;
} }
@@ -94,30 +90,3 @@ int32_t appl::GlyphPainting::request(const std::string& _name) {
m_list.push_back(tmpDeco); m_list.push_back(tmpDeco);
return m_list.size()-1; return m_list.size()-1;
} }
appl::GlyphPainting* appl::GlyphPainting::keep(const std::string& _filename) {
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
appl::GlyphPainting* object = static_cast<appl::GlyphPainting*>(getManager().localKeep(_filename));
if (NULL != object) {
return object;
}
// this element create a new one every time ....
EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\"");
object = new appl::GlyphPainting(_filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ??GlyphPainting??");
return NULL;
}
getManager().localAdd(object);
return object;
}
void appl::GlyphPainting::release(appl::GlyphPainting*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@@ -1,25 +1,24 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_GLYPH_PAINTING_H__
#define __APPL_GLYPH_PAINTING_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/resource/Resource.h> #include <gale/resource/Resource.h>
#include <appl/GlyphDecoration.h> #include <appl/GlyphDecoration.h>
namespace appl { namespace appl {
class GlyphPainting : public ewol::Resource { class GlyphPainting : public gale::Resource {
private: private:
std::vector<appl::GlyphDecoration> m_list; std::vector<appl::GlyphDecoration> m_list;
protected: protected:
GlyphPainting(const std::string& _filename); GlyphPainting();
void init(const std::string& _filename);
public:
DECLARE_RESOURCE_NAMED_FACTORY(GlyphPainting);
virtual ~GlyphPainting(); virtual ~GlyphPainting();
public: public:
/** /**
@@ -48,21 +47,7 @@ namespace appl {
const appl::GlyphDecoration& operator[] (int32_t _pos) const { const appl::GlyphDecoration& operator[] (int32_t _pos) const {
return m_list[_pos]; return m_list[_pos];
} }
public:
/**
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured.
*/
static appl::GlyphPainting* keep(const std::string& _filename);
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::GlyphPainting*& _object);
}; };
}; }
#endif

View File

@@ -1,11 +1,8 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/Gui/BufferView.h> #include <appl/Gui/BufferView.h>
@@ -14,23 +11,15 @@
#include <appl/Gui/MainWindows.h> #include <appl/Gui/MainWindows.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#undef __class__ // TODO : write it better
#define __class__ "BufferView" static void SortElementList(std::vector<appl::dataBufferStruct>& _list) {
std::vector<appl::dataBufferStruct> tmpList = _list;
static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
std::vector<appl::dataBufferStruct *> tmpList = _list;
_list.clear(); _list.clear();
for(int32_t iii=0; iii<tmpList.size(); iii++) { for(size_t iii=0; iii<tmpList.size(); iii++) {
if (NULL == tmpList[iii]) { size_t findPos = 0;
continue; for(size_t jjj=0; jjj<_list.size(); jjj++) {
}
int32_t findPos = 0;
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\""); //EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (_list[jjj] == NULL) { if (tmpList[iii].m_bufferName.getNameFile() > _list[jjj].m_bufferName.getNameFile()) {
continue;
}
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
findPos = jjj+1; findPos = jjj+1;
} }
} }
@@ -42,19 +31,12 @@ static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
BufferView::BufferView() : BufferView::BufferView() :
m_openOrderMode(false) { m_openOrderMode(false) {
addObjectType("appl::BufferView"); addObjectType("appl::BufferView");
setCanHaveFocus(true);
registerMultiCast(ednMsgBufferListChange);
registerMultiCast(ednMsgBufferState);
registerMultiCast(ednMsgBufferId);
registerMultiCast(appl::MsgSelectNewFile);
registerMultiCast(appl::MsgSelectChange);
registerMultiCast(appl::MsgNameChange);
m_selectedID = -1; m_selectedID = -1;
m_selectedIdRequested = -1; m_selectedIdRequested = -1;
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
// load color properties // load color properties
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:bufferList.json"); m_paintingProperties = appl::GlyphPainting::create("THEME:COLOR:bufferList.json");
// get all id properties ... // get all id properties ...
m_colorBackground1 = m_paintingProperties->request("backgroung1"); m_colorBackground1 = m_paintingProperties->request("backgroung1");
m_colorBackground2 = m_paintingProperties->request("backgroung2"); m_colorBackground2 = m_paintingProperties->request("backgroung2");
@@ -63,179 +45,123 @@ BufferView::BufferView() :
m_colorTextModify = m_paintingProperties->request("textModify"); m_colorTextModify = m_paintingProperties->request("textModify");
} }
void BufferView::init() {
ewol::widget::List::init();
propertyHide.set(true);
propertyCanFocus.set(true);
if (m_bufferManager != nullptr) {
m_bufferManager->signalNewBuffer.connect(sharedFromThis(), &BufferView::onCallbackNewBuffer);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &BufferView::onCallbackselectNewFile);
m_bufferManager->signalRemoveBuffer.connect(sharedFromThis(), &BufferView::onCallbackBufferRemoved);
}
}
BufferView::~BufferView() { BufferView::~BufferView() {
removeAllElement(); removeAllElement();
} }
void BufferView::removeAllElement() { void BufferView::removeAllElement() {
for(int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = NULL;
}
}
m_list.clear(); m_list.clear();
if (m_bufferManager != NULL) {
appl::BufferManager::release(m_bufferManager);
}
} }
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) { void BufferView::insertAlphabetic(const appl::dataBufferStruct& _dataStruct, bool _selectNewPosition) {
if (_dataStruct == NULL) {
return;
}
// alphabetical order: // alphabetical order:
for (size_t iii = 0; iii < m_list.size(); ++iii) { for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii] == NULL) { if (etk::tolower(m_list[iii].m_bufferName.getNameFile()) > etk::tolower(_dataStruct.m_bufferName.getNameFile())) {
continue;
}
if (std::tolower(m_list[iii]->m_bufferName.getNameFile()) > std::tolower(_dataStruct->m_bufferName.getNameFile())) {
m_list.insert(m_list.begin() + iii, _dataStruct); m_list.insert(m_list.begin() + iii, _dataStruct);
_dataStruct = NULL;
if (_selectNewPosition == true) { if (_selectNewPosition == true) {
m_selectedID = iii; m_selectedID = iii;
} }
break; return;
} }
} }
if (_dataStruct != NULL) { m_list.push_back(_dataStruct);
m_list.push_back(_dataStruct); if (_selectNewPosition == true) {
if (_selectNewPosition == true) { m_selectedID = m_list.size()-1;
m_selectedID = m_list.size()-1;
}
} }
} }
void BufferView::onCallbackNewBuffer(const std::string& _value) {
ememory::SharedPtr<appl::Buffer> buffer = m_bufferManager->get(_value);
if (buffer == nullptr) {
APPL_ERROR("event on element nor exist : " << _value);
return;
}
buffer->signalIsSave.connect(sharedFromThis(), &BufferView::onCallbackIsSave);
buffer->signalIsModify.connect(sharedFromThis(), &BufferView::onCallbackIsModify);
buffer->signalChangeName.connect(sharedFromThis(), &BufferView::onCallbackChangeName);
appl::dataBufferStruct tmp(_value, buffer);
if (m_openOrderMode == true) {
m_list.push_back(tmp);
} else {
insertAlphabetic(tmp);
}
if (m_list.size() <= 1) {
propertyHide.set(true);
propertySetOnWidgetNamed("appl-Buffer-viewer-separator", "hide", "true");
} else {
propertyHide.set(false);
propertySetOnWidgetNamed("appl-Buffer-viewer-separator", "hide", "false");
}
markToRedraw();
}
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) { // TODO : Review this callback with the real shared_ptr on the buffer ...
ewol::widget::List::onReceiveMessage(_msg); void BufferView::onCallbackselectNewFile(const std::string& _value) {
if (_msg.getMessage() == appl::MsgSelectNewFile) { m_selectedID = -1;
appl::Buffer* buffer = m_bufferManager->get(_msg.getData()); for (size_t iii=0; iii<m_list.size(); iii++) {
if (buffer == NULL) { if (m_list[iii].m_buffer == nullptr) {
APPL_ERROR("event on element nor exist : " << _msg.getData()); continue;
return;
} }
buffer->registerOnEvent(this, appl::Buffer::eventIsSave); if (m_list[iii].m_buffer->getFileName() != _value) {
buffer->registerOnEvent(this, appl::Buffer::eventIsModify); continue;
buffer->registerOnEvent(this, appl::Buffer::eventChangeName);
appl::dataBufferStruct* tmp = new appl::dataBufferStruct(_msg.getData(), buffer);
if (tmp == NULL) {
APPL_ERROR("Allocation error of the tmp buffer list element");
return;
} }
if (m_openOrderMode == true) { m_selectedID = iii;
m_list.push_back(tmp); break;
} else {
insertAlphabetic(tmp);
}
markToRedraw();
return;
} }
if (_msg.getMessage() == appl::Buffer::eventChangeName) { markToRedraw();
for (size_t iii = 0; iii < m_list.size(); ++iii) { }
if (m_list[iii] == NULL) {
continue; void BufferView::onCallbackChangeName() {
} for (size_t iii = 0; iii < m_list.size(); ++iii) {
if (m_list[iii]->m_bufferName != m_list[iii]->m_buffer->getFileName()) { if (m_list[iii].m_bufferName != m_list[iii].m_buffer->getFileName()) {
m_list[iii]->m_bufferName = m_list[iii]->m_buffer->getFileName(); m_list[iii].m_bufferName = m_list[iii].m_buffer->getFileName();
if (m_openOrderMode == false) { if (m_openOrderMode == false) {
// re-order the fine in the correct position // re-order the fine in the correct position
appl::dataBufferStruct* tmp = m_list[iii]; appl::dataBufferStruct tmp = m_list[iii];
m_list[iii] = NULL; m_list.erase(m_list.begin() + iii);
m_list.erase(m_list.begin() + iii); insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
insertAlphabetic(tmp, (iii == m_selectedID));
break;
}
}
}
markToRedraw();
return;
}
if (_msg.getMessage() == appl::Buffer::eventIsSave) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::Buffer::eventIsModify) {
markToRedraw();
return;
}
APPL_DEBUG("message : " << _msg);
if (_msg.getMessage() == appl::MsgSelectChange) {
m_selectedID = -1;
appl::Buffer* tmpBuffer = NULL;
if (m_bufferManager != NULL) {
tmpBuffer = m_bufferManager->getBufferSelected();
}
if (tmpBuffer != NULL) {
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (m_list[iii] == NULL) {
continue;
}
if (m_list[iii]->m_buffer != tmpBuffer) {
continue;
}
m_selectedID = iii;
break; break;
} }
} }
markToRedraw();
return;
}
if (_msg.getMessage() == ednMsgBufferListChange) {
// clean The list
removeAllElement();
// get all the buffer name and properties:
int32_t nbBufferOpen = 0; // BufferManager::size();
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
/*
if (BufferManager::exist(iii)) {
BufferText* tmpBuffer = BufferManager::get(iii);
if (NULL != tmpBuffer) {
bool isModify = tmpBuffer->isModify();
etk::FSNode name = tmpBuffer->getFileName();
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
if (NULL != tmpElement) {
m_list.push_back(tmpElement);
} else {
APPL_ERROR("Allocation error of the tmp buffer list element");
}
}
}
*/
}
if (true == globals::OrderTheBufferList() ) {
SortElementList(m_list);
}
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferId) {
m_selectedIdRequested = 0; //BufferManager::getSelected();
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferState) {
// update list of modify section ...
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
//m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify();
}
}
markToRedraw();
} }
markToRedraw();
} }
void BufferView::onObjectRemove(ewol::Object* _removeObject) { void BufferView::onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>& _buffer) {
ewol::widget::List::onObjectRemove(_removeObject); APPL_ERROR("request remove buffer:");
for (int32_t iii=0; iii<m_list.size(); iii++) { auto it = m_list.begin();
if (m_list[iii] == NULL) { while (it != m_list.end()) {
continue; if (it->m_buffer == _buffer) {
it = m_list.erase(it);
m_selectedID = -1;
} else {
++it;
} }
if (m_list[iii]->m_buffer != _removeObject) {
continue;
}
m_list.erase(m_list.begin()+iii);
markToRedraw();
return;
} }
if (m_list.size() <= 1) {
propertyHide.set(true);
} else {
propertyHide.set(false);
}
markToRedraw();
}
void BufferView::onCallbackIsSave() {
markToRedraw();
}
void BufferView::onCallbackIsModify() {
markToRedraw();
} }
etk::Color<> BufferView::getBasicBG() { etk::Color<> BufferView::getBasicBG() {
return (*m_paintingProperties)[m_colorBackground1].getForeground(); return (*m_paintingProperties)[m_colorBackground1].getForeground();
@@ -256,12 +182,11 @@ uint32_t BufferView::getNuberOfRaw() {
bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
if( _raw >= 0 if( _raw >= 0
&& _raw<m_list.size() && _raw<(int64_t)m_list.size() ) {
&& NULL != m_list[_raw]) { _myTextToWrite = m_list[_raw].m_bufferName.getNameFile();
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
if ( m_list[_raw]->m_buffer != NULL if ( m_list[_raw].m_buffer != nullptr
&& m_list[_raw]->m_buffer->isModify() == false) { && m_list[_raw].m_buffer->isModify() == false) {
_fg = (*m_paintingProperties)[m_colorTextNormal].getForeground(); _fg = (*m_paintingProperties)[m_colorTextNormal].getForeground();
} else { } else {
_fg = (*m_paintingProperties)[m_colorTextModify].getForeground(); _fg = (*m_paintingProperties)[m_colorTextModify].getForeground();
@@ -281,17 +206,16 @@ bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextT
return true; return true;
} }
bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) bool BufferView::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
{ if (1 == _IdInput && _typeEvent == gale::key::status::pressSingle) {
if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) {
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw ); APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
if( _raw >= 0 if( _raw >= 0
&& _raw<m_list.size() && _raw<(int64_t)m_list.size()) {
&& NULL != m_list[_raw]) { if (m_list[_raw].m_buffer != nullptr) {
if (m_list[_raw]->m_buffer != NULL) { if (m_bufferManager != nullptr) {
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName()); APPL_INFO("Select file :" << m_list[_raw].m_buffer->getFileName() << " in list");
m_selectedID = _raw; m_bufferManager->open(m_list[_raw].m_buffer->getFileName());
markToRedraw(); }
return true; return true;
} }
} }

View File

@@ -1,13 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __BUFFER_VIEW_H__
#define __BUFFER_VIEW_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
@@ -15,28 +11,28 @@
#include <ewol/widget/List.h> #include <ewol/widget/List.h>
#include <ewol/widget/Windows.h> #include <ewol/widget/Windows.h>
namespace appl namespace appl {
{ class dataBufferStruct {
class dataBufferStruct
{
public: public:
etk::FSNode m_bufferName; etk::FSNode m_bufferName;
appl::Buffer* m_buffer; ememory::SharedPtr<appl::Buffer> m_buffer;
dataBufferStruct(const std::string& _bufferName, appl::Buffer* _buffer) : dataBufferStruct(const std::string& _bufferName, const ememory::SharedPtr<appl::Buffer>& _buffer) :
m_bufferName(_bufferName), m_bufferName(_bufferName),
m_buffer(_buffer) { m_buffer(_buffer) {
}; };
~dataBufferStruct() { }; virtual ~dataBufferStruct() { };
}; };
}; };
class BufferView : public ewol::widget::List class BufferView;
{ using BufferViewShared = ememory::SharedPtr<BufferView>;
using BufferViewWeak = ememory::WeakPtr<BufferView>;
class BufferView : public ewol::widget::List {
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
private: private:
appl::GlyphPainting* m_paintingProperties; //!< element painting property ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground1; int32_t m_colorBackground1;
int32_t m_colorBackground2; int32_t m_colorBackground2;
int32_t m_colorBackgroundSelect; int32_t m_colorBackgroundSelect;
@@ -45,19 +41,19 @@ class BufferView : public ewol::widget::List
private: private:
int32_t m_selectedIdRequested; int32_t m_selectedIdRequested;
int32_t m_selectedID; int32_t m_selectedID;
std::vector<appl::dataBufferStruct*> m_list; std::vector<appl::dataBufferStruct> m_list;
/** /**
* @brief Insert the element in the alphabetic order. * @brief Insert the element in the alphabetic order.
* @param[in] _dataStruct element to add. * @param[in] _dataStruct element to add.
*/ */
void insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition = false); void insertAlphabetic(const appl::dataBufferStruct& _dataStruct, bool _selectNewPosition = false);
public: protected:
// Constructeur // Constructeur
BufferView(); BufferView();
~BufferView(); void init();
// Derived function public:
virtual void onReceiveMessage(const ewol::object::Message& _msg); DECLARE_FACTORY(BufferView);
virtual void onObjectRemove(ewol::Object* _removeObject); virtual ~BufferView();
private: private:
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
protected: protected:
@@ -69,10 +65,13 @@ class BufferView : public ewol::widget::List
virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
virtual uint32_t getNuberOfRaw(); virtual uint32_t getNuberOfRaw();
virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
private: //callback function:
void onCallbackChangeName();
void onCallbackIsSave();
void onCallbackIsModify();
void onCallbackNewBuffer(const std::string& _value);
void onCallbackselectNewFile(const std::string& _value);
void onCallbackBufferRemoved(const ememory::SharedPtr<appl::Buffer>& _buffer);
}; };
#endif

View File

@@ -1,12 +1,8 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/Gui/MainWindows.h> #include <appl/Gui/MainWindows.h>
@@ -30,7 +26,6 @@
#include <ewol/widget/Manager.h> #include <ewol/widget/Manager.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <date/date.h>
#include <ewol/widget/meta/StdPopUp.h> #include <ewol/widget/meta/StdPopUp.h>
#include <appl/Gui/WorkerSaveFile.h> #include <appl/Gui/WorkerSaveFile.h>
#include <appl/Gui/WorkerSaveAllFile.h> #include <appl/Gui/WorkerSaveAllFile.h>
@@ -39,52 +34,35 @@
namespace appl { namespace appl {
std::string getVersion() { std::string getVersion() {
#define FIRST_YEAR (2010) return APPL_VERSION;
std::string tmpOutput = std::to_string(date::getYear()-FIRST_YEAR);
tmpOutput += ".";
tmpOutput += std::to_string(date::getMonth());
tmpOutput += ".";
tmpOutput += std::to_string(date::getDay());
return tmpOutput;
} }
} }
#undef __class__
#define __class__ "AboutGui"
#include <ewol/widget/Label.h> #include <ewol/widget/Label.h>
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
class ParameterAboutGui : public ewol::widget::Sizer { class ParameterAboutGui : public ewol::widget::Sizer {
public : public :
ParameterAboutGui() : ParameterAboutGui() {
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) { addObjectType("appl::ParameterAboutGui");
ewol::widget::Spacer* mySpacer = NULL; }
void init() {
propertyMode.setDirectCheck(ewol::widget::Sizer::modeVert);
ewol::widget::Sizer::init();
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
mySpacer = new ewol::widget::Spacer(); mySpacer = ewol::widget::Spacer::create();
if (NULL == mySpacer) { if (mySpacer == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
mySpacer->setExpand(bvec2(true,true)); mySpacer->propertyExpand.set(bvec2(true,true));
subWidgetAdd(mySpacer); subWidgetAdd(mySpacer);
} }
std::string tmpLabel = "<left>"; std::string tmpLabel = "<left>";
tmpLabel += " <b>Editeur De N'ours</b> : v:"; tmpLabel += " <b>Editeur De N'ours</b> : v:";
tmpLabel += appl::getVersion(); tmpLabel += appl::getVersion();
tmpLabel += "<br/>"; tmpLabel += "<br/>";
tmpLabel += " <b>Build Time</b> : ";
tmpLabel += date::getYear();
tmpLabel += "/";
tmpLabel += date::getMonth();
tmpLabel += "/";
tmpLabel += date::getDay();
tmpLabel += " ";
tmpLabel += date::getHour();
tmpLabel += "h";
tmpLabel += date::getMinute();
tmpLabel += "<br/>";
tmpLabel += " <b>Website</b> : https://github.com/HeeroYui/edn<br/>"; tmpLabel += " <b>Website</b> : https://github.com/HeeroYui/edn<br/>";
tmpLabel += " <b>License</b> : GPL v3<br/>"; tmpLabel += " <b>License</b> : GPL v3<br/>";
tmpLabel += " <b>Copyright</b> : 2010 Edouard DUPIN<br/>"; tmpLabel += " <b>Copyright</b> : 2010 Edouard DUPIN<br/>";
@@ -93,11 +71,12 @@ class ParameterAboutGui : public ewol::widget::Sizer {
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>"; tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>"; tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
tmpLabel += "</left>"; tmpLabel += "</left>";
ewol::widget::Label* myLabel = new ewol::widget::Label(tmpLabel); ememory::SharedPtr<ewol::widget::Label> myLabel = ewol::widget::Label::create();
if (NULL == myLabel) { if (myLabel == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myLabel->setExpand(bvec2(true,false)); myLabel->propertyValue.set(tmpLabel);
myLabel->propertyExpand.set(bvec2(true,false));
subWidgetAdd(myLabel); subWidgetAdd(myLabel);
} }
}; };
@@ -106,324 +85,273 @@ class ParameterAboutGui : public ewol::widget::Sizer {
}; };
}; };
// Local main windows event :
static const char* mainWindowsRequestSaveFile = "appl-event-main-windows-save-file";
static const char* mainWindowsRequestSaveFileAs = "appl-event-main-windows-save-file-as";
static const char* mainWindowsRequestcloseFileNoCheck = "appl-event-main-windows-close-file-no-check";
static const char* l_MsgNameGuiChangeShape = "appl-event-main-windows-Change-shape";
const char* l_smoothChick = "tmpEvent_smooth";
const char* l_smoothMin = "tmpEvent_minChange";
const char* l_smoothMax = "tmpEvent_maxChange";
#undef __class__
#define __class__ "MainWindows"
MainWindows::MainWindows() { MainWindows::MainWindows() {
addObjectType("appl::MainWindows"); addObjectType("appl::MainWindows");
}
void MainWindows::init() {
ewol::widget::Windows::init();
APPL_DEBUG("CREATE WINDOWS ... "); APPL_DEBUG("CREATE WINDOWS ... ");
ewol::widget::Sizer * mySizerVert = NULL; ewol::widget::SizerShared mySizerVert;
ewol::widget::Sizer * mySizerVert2 = NULL; ewol::widget::SizerShared mySizerVert2;
ewol::widget::Sizer * mySizerHori = NULL; ewol::widget::SizerShared mySizerHori;
//ewol::Button * myButton = NULL; ememory::SharedPtr<appl::TextViewer> myTextView;
appl::TextViewer * myTextView = NULL; ememory::SharedPtr<appl::TextViewer> myTextView2;
BufferView * myBufferView = NULL; ememory::SharedPtr<BufferView> myBufferView;
ewol::widget::Menu * myMenu = NULL; ewol::widget::MenuShared myMenu;
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
m_viewerManager = appl::ViewerManager::create();
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert); mySizerVert = ewol::widget::Sizer::create();
mySizerVert->propertyName.set("plop 1111111");
mySizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
setSubWidget(mySizerVert); setSubWidget(mySizerVert);
mySizerHori = ewol::widget::Sizer::create();
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori); mySizerHori->propertyName.set("plop 222222222");
mySizerHori->propertyMode.set(ewol::widget::Sizer::modeHori);
mySizerVert->subWidgetAdd(mySizerHori); mySizerVert->subWidgetAdd(mySizerHori);
myBufferView = new BufferView(); myBufferView = BufferView::create();
myBufferView->setExpand(bvec2(false,true)); myBufferView->propertyName.set("plop 3333333");
myBufferView->setFill(bvec2(true,true)); myBufferView->propertyExpand.set(bvec2(false,true));
myBufferView->propertyFill.set(bvec2(true,true));
mySizerHori->subWidgetAdd(myBufferView); mySizerHori->subWidgetAdd(myBufferView);
mySizerVert2 = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert); ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();
mySpacer->propertyName.set("appl-Buffer-viewer-separator");
mySpacer->propertyColor.set(etk::color::black);
mySpacer->propertyMinSize.set(gale::Dimension(vec2(2,2), gale::distance::pixel));
mySpacer->propertyExpand.set(bvec2(false,true));
mySpacer->propertyFill.set(bvec2(true,true));
mySpacer->propertyHide.set(true);
mySizerHori->subWidgetAdd(mySpacer);
mySizerVert2 = ewol::widget::Sizer::create();
mySizerVert2->propertyMode.set(ewol::widget::Sizer::modeVert);
mySizerHori->subWidgetAdd(mySizerVert2); mySizerHori->subWidgetAdd(mySizerVert2);
mySizerVert2->propertyName.set("appl-view-code-sizer");
// main buffer Area : // main buffer Area :
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16); int32_t sizeText = 16;
#else #else
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11); int32_t sizeText = 11;
#endif #endif
myTextView->setName("appl-text-viewer"); myTextView2 = appl::TextViewer::create("font-size", sizeText);
myTextView->setExpand(bvec2(true,true)); myTextView2->propertyName.set("appl-text-viewer2");
myTextView->setFill(bvec2(true,true)); myTextView2->propertyExpand.set(bvec2(true,true));
myTextView2->propertyFill.set(bvec2(true,true));
myTextView2->propertyHide.set(true);
mySizerVert2->subWidgetAdd(myTextView2);
mySpacer = ewol::widget::Spacer::create();
mySpacer->propertyName.set("appl-text-separator");
mySpacer->propertyColor.set(etk::color::black);
mySpacer->propertyMinSize.set(gale::Dimension(vec2(2,2), gale::distance::pixel));
mySpacer->propertyExpand.set(bvec2(true,false));
mySpacer->propertyFill.set(bvec2(true,true));
mySpacer->propertyHide.set(true);
mySizerVert2->subWidgetAdd(mySpacer);
myTextView = appl::TextViewer::create("font-size", sizeText);
myTextView->propertyName.set("appl-text-viewer1");
myTextView->propertyExpand.set(bvec2(true,true));
myTextView->propertyFill.set(bvec2(true,true));
mySizerVert2->subWidgetAdd(myTextView); mySizerVert2->subWidgetAdd(myTextView);
/*
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11); // search area:
myTextView->setExpand(bvec2(true,true)); m_widgetSearch = appl::widget::Search::create();
myTextView->setFill(bvec2(true,true)); mySizerVert2->subWidgetAdd(m_widgetSearch);
mySizerVert2->subWidgetAdd(myTextView);
*/
// search area :
Search * mySearch = new Search();
mySizerVert2->subWidgetAdd(mySearch);
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori); mySizerHori = ewol::widget::Sizer::create();
mySizerHori->propertyName.set("plop 555555");
mySizerHori->propertyMode.set(ewol::widget::Sizer::modeHori);
mySizerVert->subWidgetAdd(mySizerHori); mySizerVert->subWidgetAdd(mySizerHori);
myMenu = new ewol::widget::Menu(); myMenu = ewol::widget::Menu::create();
myMenu->propertyName.set("appl-menu-interface");
mySizerHori->subWidgetAdd(myMenu); mySizerHori->subWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->addTitle("File"); int32_t idMenuFile = myMenu->addTitle("_T{File}");
myMenu->add(idMenuFile, "New", "", ednMsgGuiNew); myMenu->add(idMenuFile, "_T{New}", "", "menu:new");
myMenu->addSpacer(); myMenu->addSpacer();
myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", ednMsgGuiOpen); myMenu->add(idMenuFile, "_T{Open}", "THEME:GUI:Load.edf", "menu:open");
myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", ednMsgGuiClose, "current"); myMenu->add(idMenuFile, "_T{Close}", "THEME:GUI:Close.edf", "menu:close");
myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All"); myMenu->add(idMenuFile, "_T{Close (all)}", "", "menu:close-all");
myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", ednMsgGuiSave, "current"); myMenu->add(idMenuFile, "_T{Save}", "THEME:GUI:Save.edf", "menu:save");
myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs); myMenu->add(idMenuFile, "_T{Save As ...}", "", "menu:save-as");
myMenu->addSpacer(); myMenu->addSpacer();
//myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit); myMenu->add(idMenuFile, "_T{Properties}", "THEME:GUI:Parameter.edf", "menu:property");
int32_t idMenuEdit = myMenu->addTitle("_T{Edit}");
myMenu->add(idMenuEdit, "_T{Goto line ...}","", "menu:goto-line");
int32_t idMenuSearch = myMenu->addTitle("_T{Search}");
myMenu->add(idMenuSearch, "_T{Search}", "THEME:GUI:Search.edf", "menu:search");
myMenu->add(idMenuSearch, "_T{Replace}", "THEME:GUI:Replace.edf", "menu:replace");
myMenu->addSpacer(); myMenu->addSpacer();
myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", ednMsgProperties); myMenu->add(idMenuSearch, "_T{Find (previous)}","", "menu:find:previous");
int32_t idMenuEdit = myMenu->addTitle("Edit"); myMenu->add(idMenuSearch, "_T{Find (next)}", "", "menu:find:next");
myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", ednMsgGuiUndo); myMenu->add(idMenuSearch, "_T{Find (all)}", "", "menu:find:all");
myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", ednMsgGuiRedo); myMenu->add(idMenuSearch, "_T{Un-Select}", "", "menu:find:none");
int32_t idMenugDisplay = myMenu->addTitle("_T{Display}");
myMenu->add(idMenugDisplay, "_T{Color Black}", "", "menu:color:color/black/");
myMenu->add(idMenugDisplay, "_T{Color White}", "", "menu:color:color/white/");
myMenu->add(idMenugDisplay, "_T{Shape square}", "", "menu:shape:shape/square/");
myMenu->add(idMenugDisplay, "_T{Shape round}", "", "menu:shape:shape/round/");
myMenu->addSpacer(); myMenu->addSpacer();
myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD"); myMenu->add(idMenugDisplay, "_T{Reload openGl Shader}", "", "menu:reloadShape");
myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
myMenu->addSpacer(); myMenu->addSpacer();
myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL"); myMenu->add(idMenugDisplay, "_T{Split}", "", "menu:split:enable");
myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE"); myMenu->add(idMenugDisplay, "_T{Unsplit}", "", "menu:split:disable");
myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???"); myMenu->add(idMenugDisplay, "_T{Vertical}", "", "menu:split:vert");
int32_t idMenuSearch = myMenu->addTitle("Search"); myMenu->add(idMenugDisplay, "_T{Horizontal}", "", "menu:split:hori");
myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", ednMsgGuiSearch); myMenu->signalSelect.connect(sharedFromThis(), &MainWindows::onCallbackMenuEvent);
myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", ednMsgGuiReplace); m_widgetLabelFileName = ewol::widget::Label::create();
myMenu->addSpacer(); m_widgetLabelFileName->propertyValue.set("FileName");
myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous"); m_widgetLabelFileName->propertyName.set("appl-widget-display-name");
myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next"); m_widgetLabelFileName->propertyExpand.set(bvec2(true,false));
myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All"); m_widgetLabelFileName->propertyFill.set(bvec2(true,false));;
myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
/* ==> must be in the pluggin list control ...
int32_t idMenuCTags = myMenu->addTitle("C-tags");
myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
*/
int32_t idMenugDisplay = myMenu->addTitle("Display");
myMenu->add(idMenugDisplay, "Color Black", "", appl::MsgNameGuiChangeColor, "color/black/");
myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "color/white/");
myMenu->add(idMenugDisplay, "Shape square", "", l_MsgNameGuiChangeShape, "shape/square/");
myMenu->add(idMenugDisplay, "Shape round", "", l_MsgNameGuiChangeShape, "shape/round/");
myMenu->addSpacer();
myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
m_widgetLabelFileName = new ewol::widget::Label("FileName");
m_widgetLabelFileName->setExpand(bvec2(true,false));
m_widgetLabelFileName->setFill(bvec2(true,false));;
mySizerHori->subWidgetAdd(m_widgetLabelFileName); mySizerHori->subWidgetAdd(m_widgetLabelFileName);
// add generic shortcut ... // add generic shortcut ...
// (shift, control, alt, meta, char32_t unicodeValue, const char * generateEventId, std::string& data) shortCutAdd("ctrl+o", "menu:open");
shortCutAdd("ctrl+o", ednMsgGuiOpen, "", true); shortCutAdd("ctrl+n", "menu:new");
shortCutAdd("ctrl+n", ednMsgGuiNew, "", true);
shortCutAdd("ctrl+s", ednMsgGuiSave, "current", true); shortCutAdd("ctrl+s", "menu:save");
shortCutAdd("ctrl+shift+s", ednMsgGuiSave, "All", true); shortCutAdd("ctrl+shift+s", "menu:save-all");
shortCutAdd("ctrl+q", ednMsgGuiClose, "current", true); shortCutAdd("ctrl+q", "menu:close");
shortCutAdd("ctrl+shift+q", ednMsgGuiClose, "All", true); shortCutAdd("ctrl+shift+q", "menu:close-all");
shortCutAdd("ctrl+z", ednMsgGuiUndo, "", true); shortCutAdd("ctrl+l", "menu:goto-line");
shortCutAdd("ctrl+shift+z", ednMsgGuiRedo, "", true);
shortCutAdd("ctrl+l", ednMsgGuiGotoLine, "???", true); shortCutAdd("ctrl+f", "menu:search");
shortCutAdd("F12", "menu:reloade-shader");
shortCutAdd("ctrl+f", ednMsgGuiSearch, "", true); // TODO : auto-connect on shortcut event ==> maybe do beter later ...
shortCutAdd("F12", ednMsgGuiReloadShader, "", true); signalShortcut.connect(sharedFromThis(), &MainWindows::onCallbackShortCut);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &MainWindows::onCallbackselectNewFile);
//shortCutAdd("ctrl+d", ednMsgGuiCtags, "Jump", true);
// Generic event ...
registerMultiCast(ednMsgGuiSave);
registerMultiCast(ednMsgGuiSaveAs);
registerMultiCast(ednMsgProperties);
registerMultiCast(ednMsgGuiNew);
registerMultiCast(ednMsgGuiOpen);
registerMultiCast(ednMsgGuiClose);
// to update the title ...
registerMultiCast(ednMsgBufferState);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiReloadShader);
registerMultiCast(appl::MsgNameGuiChangeColor);
registerMultiCast(l_MsgNameGuiChangeShape);
registerMultiCast(appl::MsgSelectNewFile);
} }
MainWindows::~MainWindows() { MainWindows::~MainWindows() {
appl::BufferManager::release(m_bufferManager);
} }
void MainWindows::onCallbackShortCut(const std::string& _value) {
APPL_WARNING("Event from ShortCut : " << _value);
onCallbackMenuEvent(_value);
}
const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected"; void MainWindows::onCallbackMenuEvent(const std::string& _value) {
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected"; APPL_WARNING("Event from Menu : " << _value);
if (_value == "menu:new") {
if (m_bufferManager != nullptr) {
void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) { m_bufferManager->createNewBuffer();
ewol::widget::Windows::onReceiveMessage(_msg); }
} else if (_value == "menu:open") {
APPL_VERBOSE("Receive Event from the main windows: " << _msg ); displayOpen();
// open file Section ... } else if (_value == "menu:close") {
if (_msg.getMessage() == ednMsgGuiOpen) { ememory::SharedPtr<appl::WorkerCloseFile> worker = appl::WorkerCloseFile::create();
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser(); worker->startAction("");
if (tmpWidget == NULL) { } else if (_value == "menu:close-all") {
APPL_ERROR("Can not open File chooser !!! "); appl::WorkerCloseAllFile::create();
} else if (_value == "menu:save") {
appl::WorkerSaveFile::create("", false);
} else if (_value == "menu:save-all") {
appl::WorkerSaveAllFile::create();
} else if (_value == "menu:save-as") {
appl::WorkerSaveFile::create("", true);
} else if (_value == "menu:property") {
displayProperty();
} else if (_value == "menu:search") {
if (m_widgetSearch == nullptr) {
return; return;
} }
tmpWidget->setTitle("Open files ..."); if (m_widgetSearch->propertyHide.get() == true) {
tmpWidget->setValidateLabel("Open"); m_widgetSearch->propertyHide.set(false);
if (m_bufferManager == NULL) { m_widgetSearch->selectSearch();
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
// Get a ref on the buffer selected (if null, no buffer was selected ...)
appl::Buffer* tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != NULL) {
etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->setFolder(tmpFile.getNameFolder());
}
// apply widget pop-up ...
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, "validate", ednEventPopUpFileSelected);
} else if (_msg.getMessage() == ednMsgProperties) {
// Request the parameter GUI
ewol::widget::Parameter* tmpWidget = new ewol::widget::Parameter();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
#ifdef SDGSDFGSDFGSDFGSDFGSTERGDHFGHFDS if (m_widgetSearch->isSelectSearch()) {
std::string menuDescription = "<title>Properties</title>\n"; m_widgetSearch->propertyHide.set(true);
menuDescription += "<group>\n"; if (m_viewerManager != nullptr) {
menuDescription += " <title>Editor</title>\n"; ememory::SharedPtr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
menuDescription += " <menu>\n"; if (tmp != nullptr) {
menuDescription += " <title>Editor Interface</title>\n"; tmp->keepFocus();
menuDescription += " <short-title>Editor</short-title>\n"; }
menuDescription += " <widget>appl-text-viewer</widget>\n"; }
menuDescription += " </menu>\n"; } else {
menuDescription += "</group>\n"; m_widgetSearch->selectSearch();
menuDescription += "<group>\n"; }
menuDescription += " <title>Gui</title>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Font selection</title>\n";
menuDescription += " <short-title>Font</short-title>\n";
menuDescription += " <widget></widget>\n";
menuDescription += " </menu>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Color selection</title>\n";
menuDescription += " <short-title>Color</short-title>\n";
menuDescription += " <widget></widget>\n";
menuDescription += " </menu>\n";
menuDescription += " <menu>\n";
menuDescription += " <title>Theme selection</title>\n";
menuDescription += " <short-title>Theme</short-title>\n";
menuDescription += " <widget></widget>\n";
menuDescription += " </menu>\n";
menuDescription += "</group>\n";
tmpWidget->setMenu(menuDescription);
#endif
tmpWidget->setTitle("Properties");
popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("Editor");
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
tmpWidget->menuAdd("Font & Color", "", NULL);
tmpWidget->menuAdd("Highlight", "", NULL);
tmpWidget->menuAddGroup("General");
tmpWidget->menuAdd("Display", "", NULL);
tmpSubWidget = new ParameterAboutGui();
tmpWidget->menuAdd("About", "", tmpSubWidget);
} }
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) { } else if (_value == "menu:replace") {
etk::theme::setName("COLOR", _msg.getData()); if (m_widgetSearch == nullptr) {
return;
}
if (m_widgetSearch->propertyHide.get() == true) {
m_widgetSearch->propertyHide.set(false);
m_widgetSearch->selectReplace();
} else {
if (m_widgetSearch->isSelectReplace()) {
m_widgetSearch->propertyHide.set(true);
if (m_viewerManager != nullptr) {
ememory::SharedPtr<appl::TextViewer> tmp = m_viewerManager->getViewerSelected();
if (tmp != nullptr) {
tmp->keepFocus();
}
}
} else {
m_widgetSearch->selectReplace();
}
}
} else if (_value == "menu:find:previous") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:find:next") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:find:all") {
APPL_TODO("Event from Menu : " << _value);
} else if (_value == "menu:find:none") {
APPL_TODO("Event from Menu : " << _value);
} else if ( _value == "menu:color:color/black/"
|| _value == "menu:color:color/white/") {
etk::theme::setName("COLOR", std::string(_value, 11));
EWOL_ERROR("Select Shape or Color : 'COLOR'='" << std::string(_value, 11) << "'");
ewol::getContext().getResourcesManager().reLoadResources(); ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll(); ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == l_MsgNameGuiChangeShape) { } else if ( _value == "menu:shape:shape/square/"
etk::theme::setName("GUI", _msg.getData()); || _value == "menu:shape:shape/round/") {
EWOL_ERROR("Select Shape or Color : 'GUI'='" << std::string(_value, 11) << "'");
etk::theme::setName("GUI", std::string(_value, 11));
ewol::getContext().getResourcesManager().reLoadResources(); ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll(); ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiReloadShader) { } else if (_value == "menu:reloadShape") {
ewol::getContext().getResourcesManager().reLoadResources(); ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll(); ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiExit) { } else if (_value == "menu:split:enable") {
// TODO : ... propertySetOnWidgetNamed("appl-text-viewer2", "hide", "false");
propertySetOnWidgetNamed("appl-text-separator", "hide", "false");
} else if (_value == "menu:split:disable") {
propertySetOnWidgetNamed("appl-text-viewer2", "hide", "true");
propertySetOnWidgetNamed("appl-text-separator", "hide", "true");
} else if (_value == "menu:split:vert") {
propertySetOnWidgetNamed("appl-view-code-sizer", "mode", "vert");
propertySetOnWidgetNamed("appl-text-separator", "expand", "true,false");
} else if (_value == "menu:split:hori") {
propertySetOnWidgetNamed("appl-view-code-sizer", "mode", "hori");
propertySetOnWidgetNamed("appl-text-separator", "expand", "false,true");
} else if (_value == "menu:reloade-shader") {
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
} else {
APPL_ERROR("Event from Menu UNKNOW : '" << _value << "'");
} }
// Note : Fore all next message we need to acces to the buffer manager ==> just check one time ... }
if (m_bufferManager == NULL) { /* TODO :
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
if ( _msg.getMessage() == appl::MsgSelectNewFile
|| _msg.getMessage() == appl::Buffer::eventIsModify
|| _msg.getMessage() == appl::Buffer::eventIsSave
|| _msg.getMessage() == appl::Buffer::eventChangeName) {
// select a new Buffer ==> change title:
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) {
setTitle("Edn");
if (m_widgetLabelFileName != NULL) {
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);
}
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != NULL) {
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
} else if (_msg.getMessage() == ednMsgGuiNew) {
m_bufferManager->createNewBuffer();
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.getData());
m_bufferManager->open(_msg.getData());
} else if (_msg.getMessage() == ednMsgGuiSave) {
APPL_DEBUG("Request saving the file : " << _msg.getData());
if (std::tolower(_msg.getData()) == "current") {
new appl::WorkerSaveFile("", false);
return;
} else if (std::tolower(_msg.getData()) == "all") {
new appl::WorkerSaveAllFile();
return;
} else {
APPL_ERROR("UNKNOW request : " << _msg);
}
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
new appl::WorkerSaveFile("", 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("");
} else {
new appl::WorkerCloseAllFile();
}
} else if (_msg.getMessage() == mainWindowsRequestSaveFile) { // return after a choice of close... } else if (_msg.getMessage() == mainWindowsRequestSaveFile) { // return after a choice of close...
if (m_bufferManager->exist(_msg.getData()) == false) { if (m_bufferManager->exist(_msg.getData()) == false) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData()); ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == NULL) { if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData()); APPL_ERROR("Error to get the buffer : " << _msg.getData());
return; return;
} }
@@ -441,8 +369,8 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData()); ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == NULL) { if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData()); APPL_ERROR("Error to get the buffer : " << _msg.getData());
return; return;
} }
@@ -452,64 +380,160 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_ERROR("Try to save an non-existant file :" << _msg.getData()); APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData()); ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
if (tmpBuffer == NULL) { if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << _msg.getData()); APPL_ERROR("Error to get the buffer : " << _msg.getData());
return; return;
} }
// note: just remove ==> no check : normal case ... // note: just remove ==> no check : normal case ...
tmpBuffer->removeObject(); //tmpBuffer->removeObject();
EWOL_TODO("call remove buffer ...");
} }
return; */
}
void MainWindows::saveAsPopUp(appl::Buffer* _buffer) { void MainWindows::displayOpen() {
if (_buffer == NULL) { ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
APPL_ERROR("Call With NULL input..."); if (tmpWidget == nullptr) {
APPL_ERROR("Can not open File chooser !!! ");
return; return;
} }
appl::WorkerSaveFile* tmpObject = new appl::WorkerSaveFile(_buffer->getFileName()); tmpWidget->propertyLabelTitle.set("_T{Open files ...}");
} tmpWidget->propertyLabelValidate.set("_T{Open}");
if (m_bufferManager == nullptr) {
void MainWindows::closeNotSavedFile(appl::Buffer* _buffer) { APPL_ERROR("can not call unexistant buffer manager ... ");
if (_buffer == NULL) {
APPL_ERROR("Call With NULL input...");
return; return;
} }
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp(); // Get a ref on the buffer selected (if null, no buffer was selected ...)
if (tmpPopUp == NULL) { ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
if (tmpBuffer != nullptr) {
etk::FSNode tmpFile = tmpBuffer->getFileName();
tmpWidget->propertyPath.set(tmpFile.getNameFolder());
}
// apply widget pop-up ...
popUpWidgetPush(tmpWidget);
tmpWidget->signalValidate.connect(sharedFromThis(), &MainWindows::onCallbackPopUpFileSelected);
}
void MainWindows::displayProperty() {
// Request the parameter GUI
ememory::SharedPtr<ewol::widget::Parameter> tmpWidget = ewol::widget::Parameter::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
return;
}
#if 0
std::string menuDescription = "<title>Properties</title>\n";
menuDescription += "<group title='_T{Editor}'>\n";
menuDescription += " <menu title='_T{Editor Interface}' short-title='Editor' widget='appl-text-viewer'>\n";
menuDescription += "</group>\n";
menuDescription += "<group title='_T{Gui}'>\n";
menuDescription += " <menu title='Font selection' short-title='Font' widget=''>\n";
menuDescription += " <menu title='Color selection' short-title='Color' widget=''>\n";
menuDescription += " <menu title='Theme selection' short-title='Theme' widget=''>\n";
menuDescription += "</group>\n";
tmpWidget->setMenu(menuDescription);
#else
tmpWidget->propertyLabelTitle.set("_T{Properties}");
popUpWidgetPush(tmpWidget);
tmpWidget->menuAddGroup("_T{Editor}");
ememory::SharedPtr<ewol::Widget> tmpSubWidget = globals::ParameterGlobalsGui::create();
tmpWidget->menuAdd("_T{Editor}", "", tmpSubWidget);
tmpWidget->menuAdd("_T{Font & Color}", "", nullptr);
tmpWidget->menuAdd("_T{Highlight}", "", nullptr);
tmpWidget->menuAddGroup("_T{General}");
tmpWidget->menuAdd("_T{Display}", "", nullptr);
tmpSubWidget = ParameterAboutGui::create();
tmpWidget->menuAdd("_T{About}", "", tmpSubWidget);
#endif
}
void MainWindows::onCallbackselectNewFile(const std::string& _value) {
APPL_INFO("onCallbackselectNewFile(" << _value << ")");
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
m_connectionSave.disconnect();
m_connectionModify.disconnect();
m_connectionSaveName.disconnect();
onCallbackTitleUpdate();
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp != nullptr) {
m_connectionSave = tmpp->signalIsSave.connect(this, &MainWindows::onCallbackTitleUpdate);
m_connectionModify = tmpp->signalIsModify.connect(this, &MainWindows::onCallbackTitleUpdate);
m_connectionSaveName = tmpp->signalChangeName.connect(this, &MainWindows::onCallbackTitleUpdate);
}
}
void MainWindows::onCallbackPopUpFileSelected(const std::string& _value) {
APPL_INFO("onCallbackPopUpFileSelected(" << _value << ")");
APPL_DEBUG("Request opening the file : " << _value);
m_bufferManager->open(_value);
}
void MainWindows::onCallbackTitleUpdate() {
APPL_INFO("onCallbackTitleUpdate()");
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... ");
return;
}
// select a new Buffer ==> change title:
ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == nullptr) {
propertyTitle.set("Edn");
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->propertyValue.set("");
}
} else {
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
propertyTitle.set(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
if (m_widgetLabelFileName != nullptr) {
m_widgetLabelFileName->propertyValue.set(nameFileSystem + (tmpp->isModify()==true?" *":""));
}
}
}
void MainWindows::saveAsPopUp(const ememory::SharedPtr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) {
APPL_ERROR("Call With nullptr input...");
return;
}
ememory::SharedPtr<appl::WorkerSaveFile> tmpObject = appl::WorkerSaveFile::create("buffer-name", _buffer->getFileName());
}
void MainWindows::closeNotSavedFile(const ememory::SharedPtr<appl::Buffer>& _buffer) {
if (_buffer == nullptr) {
APPL_ERROR("Call With nullptr input...");
return;
}
ememory::SharedPtr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
if (tmpPopUp == nullptr) {
APPL_ERROR("Can not create a simple pop-up"); APPL_ERROR("Can not create a simple pop-up");
return; return;
} }
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>"); tmpPopUp->propertyTitle.set("<bold>_T{Close un-saved file:}</bold>");
tmpPopUp->setComment("The file named : <i>\"" + _buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost..."); tmpPopUp->propertyComment.set("_T{The file named:} <i>\"" + _buffer->getFileName() + "\"</i> _T{is curently modify.} <br/>_T{If you don't saves these modifications,<br/>they will be definitly lost...}");
ewol::Widget* bt = NULL; ememory::SharedPtr<ewol::widget::Button> bt = nullptr;
if (_buffer->hasFileName() == true) { if (_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true); bt = tmpPopUp->addButton("_T{Save}", true);
if (bt != NULL) { if (bt != nullptr) {
// TODO : The element is removed before beeing pressed // TODO : The element is removed before beeing pressed
bt->registerOnEvent(this, "pressed", mainWindowsRequestSaveFile, _buffer->getFileName()); // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFile, _buffer->getFileName());
bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
} }
} }
bt = tmpPopUp->addButton("Save As", true); bt = tmpPopUp->addButton("_T{Save As}", true);
if (bt != NULL) { if (bt != nullptr) {
bt->registerOnEvent(this, "pressed", mainWindowsRequestSaveFileAs, _buffer->getFileName()); // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestSaveFileAs, _buffer->getFileName());
//bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); //bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
// TODO : Request the close when saved ... // TODO : Request the close when saved ...
} }
bt = tmpPopUp->addButton("Close", true); bt = tmpPopUp->addButton("_T{Close}", true);
if (bt != NULL) { if (bt != nullptr) {
bt->registerOnEvent(this, "pressed", mainWindowsRequestcloseFileNoCheck, _buffer->getFileName()); // TODO : bt->signalPressed.connect(sharedFromThis(), mainWindowsRequestcloseFileNoCheck, _buffer->getFileName());
} }
tmpPopUp->addButton("Cancel", true); tmpPopUp->addButton("_T{Cancel}", true);
tmpPopUp->setRemoveOnExternClick(true); tmpPopUp->propertyCloseOutEvent.set(true);
popUpWidgetPush(tmpPopUp); popUpWidgetPush(tmpPopUp);
} }
void MainWindows::onObjectRemove(ewol::Object* _removeObject) {
ewol::widget::Windows::onObjectRemove(_removeObject);
if (m_widgetLabelFileName == _removeObject) {
m_widgetLabelFileName = NULL;
}
}

View File

@@ -1,13 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __MAIN_WINDOWS_H__
#define __MAIN_WINDOWS_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
@@ -16,32 +12,43 @@
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <ewol/widget/Label.h> #include <ewol/widget/Label.h>
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <appl/Gui/Search.h>
#include <appl/Gui/ViewerManager.h>
class MainWindows : public ewol::widget::Windows { class MainWindows : public ewol::widget::Windows {
private: private:
ewol::widget::Label* m_widgetLabelFileName; ewol::widget::LabelShared m_widgetLabelFileName;
public: appl::widget::SearchShared m_widgetSearch;
esignal::Connection m_connectionSave;
esignal::Connection m_connectionModify;
esignal::Connection m_connectionSaveName;
protected:
// Constructeur // Constructeur
MainWindows(); MainWindows();
~MainWindows(); void init();
public:
DECLARE_FACTORY(MainWindows);
virtual ~MainWindows();
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
/** /**
* @brief Display a pop-up to the select the name of the file. * @brief Display a pop-up to the select the name of the file.
* @param[in] _buffer Buffer that might be saved with a new name. * @param[in] _buffer Buffer that might be saved with a new name.
*/ */
void saveAsPopUp(appl::Buffer* _buffer); void saveAsPopUp(const ememory::SharedPtr<appl::Buffer>& _buffer);
/** /**
* @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved. * @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved.
* @param[in] _buffer Buffer that might be close. * @param[in] _buffer Buffer that might be close.
*/ */
void closeNotSavedFile(appl::Buffer* _buffer); void closeNotSavedFile(const ememory::SharedPtr<appl::Buffer>& _buffer);
public: // Derived function void displayOpen();
virtual void onReceiveMessage(const ewol::object::Message& _msg); void displayProperty();
virtual void onObjectRemove(ewol::Object * _removeObject); private:
void onCallbackPopUpFileSelected(const std::string& _value);
void onCallbackTitleUpdate();
void onCallbackMenuEvent(const std::string& _value);
void onCallbackShortCut(const std::string& _value);
void onCallbackselectNewFile(const std::string& _value);
}; };
#endif

View File

@@ -1,79 +1,60 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include "appl/global.h" #include "appl/global.h"
#include "appl/Gui/Search.h" #include "appl/Gui/Search.h"
#include "appl/BufferManager.h" #include "appl/BufferManager.h"
#include "appl/Gui/TextViewer.h" #include "appl/Gui/TextViewer.h"
#include "appl/Gui/MainWindows.h" #include "appl/Gui/MainWindows.h"
#include "appl/globalMsg.h" #include "appl/globalMsg.h"
#include <ewol/widget/Button.h>
#include <ewol/widget/Entry.h>
appl::widget::Search::Search() :
#undef __class__
#define __class__ "Search"
const char* const l_eventSearchEntry = "appl-search-entry";
const char* const l_eventSearchEntryEnter = "appl-search-entry-enter";
const char* const l_eventReplaceEntry = "appl-replace-entry";
const char* const l_eventReplaceEntryEnter = "appl-replace-entry-enter";
const char* const l_eventSearchBt = "appl-search-button";
const char* const l_eventReplaceBt = "appl-replace-button";
const char* const l_eventCaseCb = "appl-case-sensitive-CheckBox";
const char* const l_eventWrapCb = "appl-wrap-CheckBox";
const char* const l_eventForwardCb = "appl-forward-CheckBox";
const char* const l_eventHideBt = "appl-hide-button";
Search::Search() :
ewol::widget::Composer(ewol::widget::Composer::file, "DATA:GUI-Search.xml"),
m_viewerManager(NULL),
m_forward(true), m_forward(true),
m_caseSensitive(false), m_caseSensitive(false),
m_wrap(true), m_wrap(true) {
m_searchEntry(NULL), addObjectType("appl::widget::Search");
m_replaceEntry(NULL) { }
addObjectType("appl::Search"); void appl::widget::Search::init() {
// load buffer manager: ewol::widget::Composer::init();
m_viewerManager = appl::ViewerManager::keep(); loadFromFile("DATA:GUI-Search.xml");
m_viewerManager = appl::ViewerManager::create();
// link event // link event
registerOnEventNameWidget(this, "SEARCH:close", "pressed", l_eventHideBt); subBind(ewol::widget::Button, "SEARCH:close", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackHide);
registerOnEventNameWidget(this, "SEARCH:search-entry", "modify", l_eventSearchEntry); subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackSearchValue);
registerOnEventNameWidget(this, "SEARCH:search-entry", "enter", l_eventSearchEntryEnter); subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackSearchEntryValidate);
registerOnEventNameWidget(this, "SEARCH:search", "pressed", l_eventSearchBt); subBind(ewol::widget::Button, "SEARCH:search", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackSearch);
registerOnEventNameWidget(this, "SEARCH:replace-entry", "modify", l_eventReplaceEntry); subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceValue);
registerOnEventNameWidget(this, "SEARCH:replace-entry", "enter", l_eventReplaceEntryEnter); subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
registerOnEventNameWidget(this, "SEARCH:replace", "pressed", l_eventReplaceBt); subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackReplace);
registerOnEventNameWidget(this, "SEARCH:case", "value", l_eventCaseCb); subBind(ewol::widget::Button, "SEARCH:case", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackCase);
registerOnEventNameWidget(this, "SEARCH:wrap", "value", l_eventWrapCb); subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap);
registerOnEventNameWidget(this, "SEARCH:up-down", "value", l_eventForwardCb); subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward);
// set default properties // set default properties
setConfigNamed("SEARCH:case", "value", std::to_string(m_caseSensitive)); propertySetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
setConfigNamed("SEARCH:wrap", "value", std::to_string(m_wrap)); propertySetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
setConfigNamed("SEARCH:up-down", "value", std::to_string(m_forward)); propertySetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
// get widget // get widget
m_searchEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:search-entry")); m_searchEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:replace-entry")); m_replaceEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
// Display and hide event:
registerMultiCast(ednMsgGuiSearch);
// basicly hiden ... // basicly hiden ...
hide(); propertyHide.set(true);
} }
Search::~Search() { appl::widget::Search::~Search() {
appl::ViewerManager::release(m_viewerManager);
} }
void Search::find() { void appl::widget::Search::find() {
if (m_viewerManager == NULL) { if (m_viewerManager == nullptr) {
APPL_WARNING("No viewer manager selected!!!"); APPL_WARNING("No viewer manager selected!!!");
return; return;
} }
appl::TextViewer* viewer = m_viewerManager->getViewerSelected(); ememory::SharedPtr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == NULL) { if (viewer == nullptr) {
APPL_INFO("No viewer selected!!!"); APPL_INFO("No viewer selected!!!");
return; return;
} }
@@ -103,13 +84,13 @@ void Search::find() {
} }
} }
void Search::replace() { void appl::widget::Search::replace() {
if (m_viewerManager == NULL) { if (m_viewerManager == nullptr) {
APPL_WARNING("No viewer manager selected!!!"); APPL_WARNING("No viewer manager selected!!!");
return; return;
} }
appl::TextViewer* viewer = m_viewerManager->getViewerSelected(); ememory::SharedPtr<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
if (viewer == NULL) { if (viewer == nullptr) {
APPL_INFO("No viewer selected!!!"); APPL_INFO("No viewer selected!!!");
return; return;
} }
@@ -120,58 +101,64 @@ void Search::replace() {
viewer->replace(m_replaceData); viewer->replace(m_replaceData);
} }
void appl::widget::Search::OnCallbackHide() {
propertyHide.set(true);
}
void appl::widget::Search::OnCallbackSearchValue(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
}
void appl::widget::Search::OnCallbackSearch() {
find();
}
void appl::widget::Search::OnCallbackSearchEntryValidate(const std::string& _value) {
m_searchData = etk::to_u32string(_value);
find();
}
void appl::widget::Search::OnCallbackReplaceValue(const std::string& _value) {
m_replaceData = etk::to_u32string(_value);
}
void appl::widget::Search::OnCallbackReplace() {
replace();
find();
}
void appl::widget::Search::OnCallbackReplaceEntryValidate(const std::string& _value) {
m_replaceData = etk::to_u32string(_value);
replace();
find();
}
void appl::widget::Search::OnCallbackCase(const bool& _value) {
m_caseSensitive = _value;
}
void appl::widget::Search::OnCallbackWrap(const bool& _value) {
m_wrap = _value;
}
void appl::widget::Search::OnCallbackForward(const bool& _value) {
m_forward = _value;
}
void Search::onReceiveMessage(const ewol::object::Message& _msg) { void appl::widget::Search::selectSearch() {
ewol::widget::Composer::onReceiveMessage(_msg); if (m_searchEntry != nullptr) {
APPL_INFO("Search receive message : " << _msg); m_searchEntry->keepFocus();
if ( _msg.getMessage() == l_eventSearchEntry) {
m_searchData = 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());
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter
|| _msg.getMessage() == l_eventReplaceBt) {
replace();
find();
} else if ( _msg.getMessage() == l_eventCaseCb) {
m_caseSensitive = std::stob(_msg.getData());
} else if ( _msg.getMessage() == l_eventWrapCb) {
m_wrap = std::stob(_msg.getData());
} else if ( _msg.getMessage() == l_eventForwardCb) {
m_forward = std::stob(_msg.getData());
} else if ( _msg.getMessage() == l_eventHideBt) {
hide();
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
if (true == isHide()) {
show();
if (m_searchEntry!= NULL) {
m_searchEntry->keepFocus();
}
} else {
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
hide();
} else if (m_searchEntry!= NULL) {
m_searchEntry->keepFocus();
} else {
hide();
}
}
} }
} }
void Search::onObjectRemove(ewol::Object * _removeObject) { bool appl::widget::Search::isSelectSearch() {
ewol::widget::Composer::onObjectRemove(_removeObject); if (m_searchEntry != nullptr) {
if (_removeObject == m_searchEntry) { return m_searchEntry->getFocus();
m_searchEntry = NULL;
} }
if (_removeObject == m_replaceEntry) { return false;
m_replaceEntry = NULL; }
}
if (_removeObject == m_viewerManager) { void appl::widget::Search::selectReplace() {
m_viewerManager = NULL; if (m_replaceEntry != nullptr) {
m_replaceEntry->keepFocus();
} }
} }
bool appl::widget::Search::isSelectReplace() {
if (m_replaceEntry != nullptr) {
return m_replaceEntry->getFocus();
}
return false;
}

View File

@@ -1,48 +1,62 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __SEARCH_H__
#define __SEARCH_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <ewol/widget/Composer.h> #include <ewol/widget/Composer.h>
#include <ewol/widget/Entry.h> #include <ewol/widget/Entry.h>
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/Gui/ViewerManager.h> #include <appl/Gui/ViewerManager.h>
namespace appl {
class Search : public ewol::widget::Composer { namespace widget {
private: class Search;
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager using SearchShared = ememory::SharedPtr<appl::widget::Search>;
bool m_forward; using SearchWeak = ememory::WeakPtr<appl::widget::Search>;
bool m_caseSensitive; class Search : public ewol::widget::Composer {
bool m_wrap; private:
ewol::widget::Entry* m_searchEntry; ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
ewol::widget::Entry* m_replaceEntry; bool m_forward;
std::u32string m_searchData; bool m_caseSensitive;
std::u32string m_replaceData; bool m_wrap;
public: ememory::SharedPtr<ewol::widget::Entry> m_searchEntry;
// Constructeur ememory::SharedPtr<ewol::widget::Entry> m_replaceEntry;
Search(); std::u32string m_searchData;
~Search(); std::u32string m_replaceData;
private: protected:
/** // Constructeur
* @brief Find the next element that corespond at the search Search();
*/ void init();
void find(); public:
/** DECLARE_FACTORY(Search);
* @brief Replace the current selected text. virtual ~Search();
*/ private:
void replace(); /**
public: // derived function * @brief Find the next element that corespond at the search
virtual void onReceiveMessage(const ewol::object::Message& _msg); */
virtual void onObjectRemove(ewol::Object * _removeObject); void find();
}; /**
* @brief Replace the current selected text.
#endif */
void replace();
public:
void selectSearch();
bool isSelectSearch();
void selectReplace();
bool isSelectReplace();
private: // callback functions
void OnCallbackHide();
void OnCallbackSearchValue(const std::string& _value);
void OnCallbackSearch();
void OnCallbackSearchEntryValidate(const std::string& _value);
void OnCallbackReplaceValue(const std::string& _value);
void OnCallbackReplace();
void OnCallbackReplaceEntryValidate(const std::string& _value);
void OnCallbackCase(const bool& _value);
void OnCallbackWrap(const bool& _value);
void OnCallbackForward(const bool& _value);
};
};
}

View File

@@ -1,44 +1,36 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <etk/tool.h> #include <etk/tool.h>
#include <appl/Gui/TagFileList.h> #include <appl/Gui/TagFileList.h>
#undef __class__ appl::TagFileList::TagFileList() :
#define __class__ "TagFileList" signalSelect(this, "select", ""),
signalValidate(this, "validate", ""),
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select"; signalUnSelect(this, "unselect", "") {
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
appl::TagFileList::TagFileList() {
addObjectType("appl::TagFileList"); addObjectType("appl::TagFileList");
m_selectedLine = -1; m_selectedLine = -1;
addEventId(applEventCtagsListSelect);
addEventId(applEventCtagsListValidate);
setMouseLimit(1); setMouseLimit(1);
// Load color properties: (use file list to be generic ...) // Load color properties: (use file list to be generic ...)
m_colorProperty = ewol::resource::ColorFile::keep("THEME:COLOR:ListFileSystem.json"); m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:ListFileSystem.json");
if (m_colorProperty != NULL) { if (m_colorProperty != nullptr) {
m_colorIdText = m_colorProperty->request("text"); m_colorIdText = m_colorProperty->request("text");
m_colorIdBackground1 = m_colorProperty->request("background1"); m_colorIdBackground1 = m_colorProperty->request("background1");
m_colorIdBackground2 = m_colorProperty->request("background2"); m_colorIdBackground2 = m_colorProperty->request("background2");
m_colorIdBackgroundSelected = m_colorProperty->request("selected"); m_colorIdBackgroundSelected = m_colorProperty->request("selected");
} }
} }
void appl::TagFileList::init() {
ewol::widget::List::init();
}
appl::TagFileList::~TagFileList() { appl::TagFileList::~TagFileList() {
for (int32_t iii=0; iii<m_list.size(); iii++) { for (auto &it : m_list) {
delete(m_list[iii]); delete(it);
m_list[iii] = NULL; it = nullptr;
} }
ewol::resource::ColorFile::release(m_colorProperty);
} }
etk::Color<> appl::TagFileList::getBasicBG() { etk::Color<> appl::TagFileList::getBasicBG() {
@@ -59,9 +51,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) { bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
if (_raw >= 0 && _raw < m_list.size() && NULL != m_list[_raw]) { if (_raw >= 0 && (size_t)_raw < m_list.size() && nullptr != m_list[_raw]) {
if (0 == _colomn) { if (0 == _colomn) {
_myTextToWrite = std::to_string(m_list[_raw]->fileLine); _myTextToWrite = etk::to_string(m_list[_raw]->fileLine);
} else { } else {
_myTextToWrite = m_list[_raw]->filename; _myTextToWrite = m_list[_raw]->filename;
} }
@@ -81,26 +73,26 @@ bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _
}; };
bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) { bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
if (_typeEvent == ewol::key::statusSingle) { if (_typeEvent == gale::key::status::pressSingle) {
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw ); EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
if (_IdInput == 1) { if (_IdInput == 1) {
int32_t previousRaw = m_selectedLine; int32_t previousRaw = m_selectedLine;
if (_raw > m_list.size() ) { if (_raw > (int64_t)m_list.size() ) {
m_selectedLine = -1; m_selectedLine = -1;
} else { } else {
m_selectedLine = _raw; m_selectedLine = _raw;
} }
const char * event = applEventCtagsListValidate;
if (previousRaw != m_selectedLine) {
event = applEventCtagsListSelect;
}
if( m_selectedLine >= 0 if( m_selectedLine >= 0
&& m_selectedLine < m_list.size() && m_selectedLine < (int64_t)m_list.size()
&& NULL != m_list[m_selectedLine] ) { && nullptr != m_list[m_selectedLine] ) {
generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename); if (previousRaw != m_selectedLine) {
signalSelect.emit(etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
} else {
signalValidate.emit(etk::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
}
} else { } else {
generateEventId(applEventCtagsListUnSelect); signalUnSelect.emit();
} }
// need to regenerate the display of the list : // need to regenerate the display of the list :
markToRedraw(); markToRedraw();
@@ -118,7 +110,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
*/ */
void appl::TagFileList::add(std::string& _file, int32_t _line) { void appl::TagFileList::add(std::string& _file, int32_t _line) {
appl::TagListElement *tmpFile = new appl::TagListElement(_file, _line); appl::TagListElement *tmpFile = new appl::TagListElement(_file, _line);
if (NULL != tmpFile) { if (nullptr != tmpFile) {
m_list.push_back(tmpFile); m_list.push_back(tmpFile);
} }
markToRedraw(); markToRedraw();

View File

@@ -1,23 +1,13 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_CTAGS_LIST_H__
#define __APPL_CTAGS_LIST_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <ewol/widget/List.h> #include <ewol/widget/List.h>
#include <ewol/resource/ColorFile.h> #include <ewol/resource/ColorFile.h>
extern const char * const applEventCtagsListSelect;
extern const char * const applEventCtagsListValidate;
extern const char * const applEventCtagsListUnSelect;
namespace appl { namespace appl {
class TagListElement { class TagListElement {
public: public:
@@ -28,30 +18,37 @@ namespace appl {
fileLine(_line) { fileLine(_line) {
}; };
~TagListElement() { virtual ~TagListElement() {
}; };
}; };
class TagFileList : public ewol::widget::List { class TagFileList : public ewol::widget::List {
public:
esignal::Signal<std::string> signalSelect;
esignal::Signal<std::string> signalValidate;
esignal::Signal<> signalUnSelect;
private: private:
int32_t m_selectedLine; int32_t m_selectedLine;
std::vector<appl::TagListElement*> m_list; std::vector<appl::TagListElement*> m_list;
protected: protected:
ewol::resource::ColorFile* m_colorProperty; //!< theme color property. ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
int32_t m_colorIdText; //!< Color of the text. int32_t m_colorIdText; //!< Color of the text.
int32_t m_colorIdBackground1; //!< Color of the Background. int32_t m_colorIdBackground1; //!< Color of the Background.
int32_t m_colorIdBackground2; //!< Color of the Background 2. int32_t m_colorIdBackground2; //!< Color of the Background 2.
int32_t m_colorIdBackgroundSelected; //!< Color of line selected. int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
public: protected:
TagFileList(); TagFileList();
~TagFileList(); void init();
public:
DECLARE_FACTORY(TagFileList);
virtual ~TagFileList();
// display API : // display API :
virtual etk::Color<> getBasicBG(); virtual etk::Color<> getBasicBG();
uint32_t getNuberOfColomn(); uint32_t getNuberOfColomn();
bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
uint32_t getNuberOfRaw(); uint32_t getNuberOfRaw();
bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
public: public:
/** /**
* @brief add a Ctags item on the curent list * @brief add a Ctags item on the curent list
@@ -60,10 +57,5 @@ namespace appl {
*/ */
void add(std::string& _file, int32_t _line); void add(std::string& _file, int32_t _line);
}; };
}; }
#endif

View File

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

View File

@@ -1,28 +1,26 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_CTAGS_SELECTION_H__
#define __APPL_CTAGS_SELECTION_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <ewol/widget/PopUp.h> #include <ewol/widget/PopUp.h>
#include <appl/Gui/TagFileList.h> #include <appl/Gui/TagFileList.h>
extern const char * const applEventctagsSelection;
extern const char * const applEventctagsCancel;
namespace appl { namespace appl {
class TagFileSelection : public ewol::widget::PopUp { class TagFileSelection : public ewol::widget::PopUp {
public:
esignal::Signal<std::string> signalSelect;
esignal::Signal<> signalCancel;
private: private:
appl::TagFileList* m_listTag; ememory::SharedPtr<appl::TagFileList> m_listTag;
std::string m_eventNamed; std::string m_eventNamed;
public: public:
TagFileSelection(); TagFileSelection();
void init();
public:
DECLARE_FACTORY(TagFileSelection);
virtual ~TagFileSelection(); virtual ~TagFileSelection();
/** /**
* @brief add a Ctags item on the curent list * @brief add a Ctags item on the curent list
@@ -30,12 +28,12 @@ namespace appl {
* @param[in] jump line id * @param[in] jump line id
*/ */
void addCtagsNewItem(std::string file, int32_t line); void addCtagsNewItem(std::string file, int32_t line);
public: // herited function public: // callback function
void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackCtagsSelection();
void onObjectRemove(ewol::Object * _removeObject); void onCallbackCtagsCancel();
void onCallbackCtagsListValidate(const std::string& _value);
void onCallbackCtagsListSelect(const std::string& _value);
void onCallbackCtagsListUnSelect();
}; };
}; }
#endif

View File

@@ -1,24 +1,19 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <ewol/context/clipBoard.h> #include <gale/context/clipBoard.h>
#include <ewol/widget/Manager.h> #include <ewol/widget/Manager.h>
#include <appl/Gui/ViewerManager.h> #include <appl/Gui/ViewerManager.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/TextPluginManager.h> #include <appl/TextPluginManager.h>
#include <etk/stdTools.h>
#undef __class__
#define __class__ "TextViewer"
#define tic() \ #define tic() \
int64_t startTime = ewol::getTime(); int64_t startTime = ewol::getTime();
@@ -28,27 +23,22 @@
int64_t processTimeLocal = (endTime - startTime); \ int64_t processTimeLocal = (endTime - startTime); \
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms"); APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
m_buffer(NULL), appl::TextViewer::TextViewer() :
m_displayText(_fontName, _fontSize), propertyFontName(this, "font-name", "FreeMono;DejaVuSansMono;FreeSerif", "Name of the font for the displayed text", &appl::TextViewer::onChangePropertyFontName),
propertyFontSize(this, "font-size", 12, "Size of the font for the displayed text", &appl::TextViewer::onChangePropertyFontSize),
m_insertMode(false) { m_insertMode(false) {
addObjectType("appl::TextViewer"); addObjectType("appl::TextViewer");
setCanHaveFocus(true);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiFind);
registerMultiCast(ednMsgGuiReplace);
registerMultiCast(appl::MsgSelectGotoLine);
registerMultiCast(appl::MsgSelectNewFile);
registerMultiCast(appl::MsgSelectGotoLineSelect);
setLimitScrolling(0.2); setLimitScrolling(0.2);
setSingleFinger(false); setSingleFinger(false);
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
m_viewerManager = appl::ViewerManager::keep(); m_pluginManager = appl::textPluginManager::create();
m_viewerManager = appl::ViewerManager::create();
// load color properties // load color properties
m_paintingProperties = appl::GlyphPainting::keep("THEME:COLOR:textViewer.json"); m_paintingProperties = appl::GlyphPainting::create("THEME:COLOR:textViewer.json");
// get all id properties ... // get all id properties ...
m_colorBackground = m_paintingProperties->request("CODE_basicBackgroung"); m_colorBackground = m_paintingProperties->request("CODE_basicBackgroung");
m_colorSpace = m_paintingProperties->request("CODE_space"); m_colorSpace = m_paintingProperties->request("CODE_space");
@@ -57,21 +47,95 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
m_colorLineNumber = m_paintingProperties->request("CODE_lineNumber"); m_colorLineNumber = m_paintingProperties->request("CODE_lineNumber");
m_colorSelection = m_paintingProperties->request("SelectedText"); m_colorSelection = m_paintingProperties->request("SelectedText");
m_colorNormal = m_paintingProperties->request("normal"); m_colorNormal = m_paintingProperties->request("normal");
}
appl::textPluginManager::connect(*this);
void appl::TextViewer::init() {
ewol::widget::WidgetScrolled::init();
propertyCanFocus.set(true);
m_displayText.setFont(*propertyFontName, *propertyFontSize);
m_pluginManager->connect(*this);
// last created has focus ... // last created has focus ...
setCurrentSelect(); setCurrentSelect();
signalShortcut.connect(sharedFromThis(), &appl::TextViewer::onCallbackShortCut);
/*
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgGuiFind);
registerMultiCast(ednMsgGuiReplace);
registerMultiCast(appl::MsgSelectGotoLine);
registerMultiCast(appl::MsgSelectGotoLineSelect);
*/
if (m_bufferManager != nullptr) {
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &appl::TextViewer::onCallbackselectNewFile);
} else {
APPL_CRITICAL("Buffer manager has not been created at the init");
}
} }
appl::TextViewer::~TextViewer() { appl::TextViewer::~TextViewer() {
appl::textPluginManager::disconnect(*this); m_pluginManager->disconnect(*this);
appl::GlyphPainting::release(m_paintingProperties); }
appl::BufferManager::release(m_bufferManager);
appl::ViewerManager::release(m_viewerManager); void appl::TextViewer::onCallbackShortCut(const std::string& _value) {
if (m_pluginManager->onReceiveShortCut(*this, _value) == true) {
return;
}
}
void appl::TextViewer::onCallbackselectNewFile(const std::string& _value) {
APPL_INFO("Select new file: " << _value);
if (isSelectedLast() == false) {
return;
}
// reset scroll:
if (m_buffer != nullptr) {
m_buffer->signals.disconnect(sharedFromThis());
bool needAdd = true;
auto it = m_drawingRemenber.begin();
while (it != m_drawingRemenber.end()) {
ememory::SharedPtr<appl::Buffer> tmpBuff = it->first.lock();
if (tmpBuff == nullptr) {
it = m_drawingRemenber.erase(it);
continue;
}
if (tmpBuff == m_buffer) {
it->second = m_originScrooled;
APPL_VERBOSE("store origin : " << m_originScrooled);
needAdd = false;
break;
}
++it;
}
if (needAdd == true) {
m_drawingRemenber.push_back(std::make_pair(ememory::WeakPtr<appl::Buffer>(m_buffer), m_originScrooled));
APPL_VERBOSE("Push origin : " << m_originScrooled);
}
}
m_originScrooled = vec2(0,0);
if (m_bufferManager != nullptr) {
m_buffer = m_bufferManager->get(_value);
m_bufferManager->setBufferSelected(m_buffer);
if (m_buffer != nullptr) {
m_buffer->signalIsModify.connect(sharedFromThis(), &appl::TextViewer::onCallbackIsModify);
m_buffer->signalSelectChange.connect(sharedFromThis(), &appl::TextViewer::onCallbackSelectChange);
for (auto element : m_drawingRemenber) {
if (element.first.lock() == m_buffer) {
m_originScrooled = element.second;
APPL_VERBOSE("retrive origin : " << m_originScrooled);
// TODO : Check if this element is not out of the display text ...
break;
}
}
}
}
markToRedraw();
return;
} }
std::string appl::TextViewer::getBufferPath() { std::string appl::TextViewer::getBufferPath() {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return ""; return "";
} }
std::string filename = m_buffer->getFileName(); std::string filename = m_buffer->getFileName();
@@ -82,10 +146,6 @@ std::string appl::TextViewer::getBufferPath() {
return std::string(filename, 0, pos); return std::string(filename, 0, pos);
} }
void appl::TextViewer::changeZoom(float _range) {
m_displayText.setFontSize(m_displayText.getSize() + _range);
markToRedraw();
}
bool appl::TextViewer::calculateMinSize() { bool appl::TextViewer::calculateMinSize() {
m_minSize.setValue(50,50); m_minSize.setValue(50,50);
@@ -100,7 +160,7 @@ void appl::TextViewer::onDraw() {
} }
void appl::TextViewer::onRegenerateDisplay() { void appl::TextViewer::onRegenerateDisplay() {
if (false == needRedraw()) { if (needRedraw() == false) {
return; return;
} }
//tic(); //tic();
@@ -113,10 +173,11 @@ void appl::TextViewer::onRegenerateDisplay() {
m_displayDrawing.setColor((*m_paintingProperties)[m_colorBackground].getForeground()); m_displayDrawing.setColor((*m_paintingProperties)[m_colorBackground].getForeground());
m_displayDrawing.rectangleWidth(m_size); m_displayDrawing.rectangleWidth(m_size);
if (m_buffer == NULL) { if (m_buffer == nullptr) {
m_maxSize.setX(256); m_maxSize.setX(256);
m_maxSize.setY(256); m_maxSize.setY(256);
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::compositing::alignLeft); float textEndAlignament = std::max(11.0f, m_size.x()-20.0f);
m_displayText.setTextAlignement(10, textEndAlignament, ewol::compositing::alignLeft);
m_displayText.setRelPos(vec3(10, 0, 0)); m_displayText.setRelPos(vec3(10, 0, 0));
std::string tmpString("<br/>\n" std::string tmpString("<br/>\n"
"<font color=\"red\">\n" "<font color=\"red\">\n"
@@ -142,7 +203,7 @@ void appl::TextViewer::onRegenerateDisplay() {
vec3 tmpCursorPosition(0, 0, -1); vec3 tmpCursorPosition(0, 0, -1);
float tmpCursorLenght = -1.0; float tmpCursorLenght = -1.0;
// real display ... // real display ...
m_displayText.setColor(etk::Color<>(0, 0, 0, 256)); m_displayText.setColor(etk::Color<>(0, 0, 0, 255));
float countNbLine = 1; float countNbLine = 1;
int32_t countColomn = 0; int32_t countColomn = 0;
// the siplay string : // the siplay string :
@@ -208,7 +269,7 @@ void appl::TextViewer::onRegenerateDisplay() {
appl::DisplayHLData displayLocalSyntax; appl::DisplayHLData displayLocalSyntax;
m_buffer->hightlightGenerateLines(displayLocalSyntax, startingIt, (m_size.y()/tmpLetterSize.y()) + 5); m_buffer->hightlightGenerateLines(displayLocalSyntax, startingIt, (m_size.y()/tmpLetterSize.y()) + 5);
float maxSizeX = 0; float maxSizeX = 0;
appl::HighlightInfo * HLColor = NULL; appl::HighlightInfo * HLColor = nullptr;
bool DisplayCursorAndSelection = isSelectedLast(); bool DisplayCursorAndSelection = isSelectedLast();
appl::Buffer::Iterator it; appl::Buffer::Iterator it;
for (it = startingIt; for (it = startingIt;
@@ -224,12 +285,12 @@ void appl::TextViewer::onRegenerateDisplay() {
if (*it == u32char::Return) { if (*it == u32char::Return) {
countNbLine += 1; countNbLine += 1;
countColomn = 0; countColomn = 0;
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX); maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
// Display the end line position only if we have the focus ... // Display the end line position only if we have the focus ...
if (DisplayCursorAndSelection == true) { if (DisplayCursorAndSelection == true) {
if (it >= selectPosStart && it < selectPosStop) { if (it >= selectPosStart && it < selectPosStop) {
ewol::compositing::Drawing& draw = m_displayText.getDrawing(); ewol::compositing::Drawing& draw = m_displayText.getDrawing();
draw.setColor(etk::Color<>(0xFF0000FF)); draw.setColor(etk::Color<>(0xFF, 0x00, 0x00, 0xFF));
draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f); draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f);
draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f); draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f);
} }
@@ -246,8 +307,8 @@ void appl::TextViewer::onRegenerateDisplay() {
} }
HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (int64_t)it); HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (int64_t)it);
bool haveBackground = false; bool haveBackground = false;
if ( HLColor != NULL if ( HLColor != nullptr
&& HLColor->patern != NULL) { && HLColor->patern != nullptr) {
m_displayText.setColor(HLColor->patern->getColorGlyph().getForeground()); m_displayText.setColor(HLColor->patern->getColorGlyph().getForeground());
m_displayText.setColorBg(HLColor->patern->getColorGlyph().getBackground()); m_displayText.setColorBg(HLColor->patern->getColorGlyph().getBackground());
haveBackground = HLColor->patern->getColorGlyph().haveBackground(); haveBackground = HLColor->patern->getColorGlyph().haveBackground();
@@ -285,7 +346,7 @@ void appl::TextViewer::onRegenerateDisplay() {
tmpCursorPosition = m_displayText.getPos(); tmpCursorPosition = m_displayText.getPos();
tmpCursorLenght = 5; tmpCursorLenght = 5;
} }
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX); maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
// Display cursor only if we have the focus ... // Display cursor only if we have the focus ...
if ( tmpCursorPosition.z() != -1 if ( tmpCursorPosition.z() != -1
&& getFocus() == true) { && getFocus() == true) {
@@ -317,18 +378,18 @@ void appl::TextViewer::onRegenerateDisplay() {
} }
bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) { bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
// First call plugin // First call plugin
if (appl::textPluginManager::onEventEntry(*this, _event) == true) { if (m_pluginManager->onEventEntry(*this, _event) == true) {
markToRedraw(); markToRedraw();
return true; return true;
} }
// just forward event == > manage directly in the buffer // just forward event == > manage directly in the buffer
if (_event.getType() == ewol::key::keyboardChar) { if (_event.getType() == gale::key::keyboard::character) {
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent); //APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (_event.getStatus() != ewol::key::statusDown) { if (_event.getStatus() != gale::key::status::down) {
return false; return false;
} }
char32_t localValue = _event.getChar(); char32_t localValue = _event.getChar();
@@ -378,44 +439,44 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
return true; return true;
} }
// move events ... // move events ...
if (_event.getStatus() == ewol::key::statusDown) { if (_event.getStatus() == gale::key::status::down) {
// selection when shift is set: // selection when shift is set:
m_buffer->setSelectMode(_event.getSpecialKey().getShift()); m_buffer->setSelectMode(_event.getSpecialKey().getShift());
// check selection event ... // check selection event ...
switch(_event.getType()) { switch(_event.getType()) {
case ewol::key::keyboardInsert: case gale::key::keyboard::insert:
m_insertMode = m_insertMode==true?false:true; m_insertMode = m_insertMode==true?false:true;
markToRedraw(); markToRedraw();
break; break;
case ewol::key::keyboardLeft: case gale::key::keyboard::left:
//APPL_INFO("keyEvent : <LEFT>"); //APPL_INFO("keyEvent : <LEFT>");
moveCursorLeft(); moveCursorLeft();
break; break;
case ewol::key::keyboardRight: case gale::key::keyboard::right:
//APPL_INFO("keyEvent : <RIGHT>"); //APPL_INFO("keyEvent : <RIGHT>");
moveCursorRight(); moveCursorRight();
break; break;
case ewol::key::keyboardUp: case gale::key::keyboard::up:
//APPL_INFO("keyEvent : <UP>"); //APPL_INFO("keyEvent : <UP>");
moveCursorUp(1); moveCursorUp(1);
break; break;
case ewol::key::keyboardDown: case gale::key::keyboard::down:
//APPL_INFO("keyEvent : <DOWN>"); //APPL_INFO("keyEvent : <DOWN>");
moveCursorDown(1); moveCursorDown(1);
break; break;
case ewol::key::keyboardPageUp: case gale::key::keyboard::pageUp:
//APPL_INFO("keyEvent : <PAGE-UP>"); //APPL_INFO("keyEvent : <PAGE-UP>");
moveCursorUp(15); // TODO : Set the real number of line ... moveCursorUp(15); // TODO : Set the real number of line ...
break; break;
case ewol::key::keyboardPageDown: case gale::key::keyboard::pageDown:
//APPL_INFO("keyEvent : <PAGE-DOWN>"); //APPL_INFO("keyEvent : <PAGE-DOWN>");
moveCursorDown(15); // TODO : Set the real number of line ... moveCursorDown(15); // TODO : Set the real number of line ...
break; break;
case ewol::key::keyboardStart: case gale::key::keyboard::start:
//APPL_INFO("keyEvent : <Start of line>"); //APPL_INFO("keyEvent : <Start of line>");
moveCursorLeft(moveEnd); moveCursorLeft(moveEnd);
break; break;
case ewol::key::keyboardEnd: case gale::key::keyboard::end:
//APPL_INFO("keyEvent : <End of line>"); //APPL_INFO("keyEvent : <End of line>");
moveCursorRight(moveEnd); moveCursorRight(moveEnd);
break; break;
@@ -428,11 +489,12 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
} }
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) { bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
if (_event.getId() != 0) { if ( _event.getId() != 0
&& _event.getStatus() == gale::key::status::down) {
keepFocus(); keepFocus();
} }
//tic(); //tic();
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
// First call the scrolling widget : // First call the scrolling widget :
@@ -440,13 +502,11 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
markToRedraw(); markToRedraw();
return true; return true;
} }
APPL_VERBOSE("event : " << _event);
// Second call plugin // Second call plugin
if (appl::textPluginManager::onEventInput(*this, _event) == true) { if (m_pluginManager->onEventInput(*this, _event) == true) {
markToRedraw(); markToRedraw();
return true; return true;
} }
APPL_VERBOSE("event2 : " << _event);
vec2 relativePos = relativePosition(_event.getPos()); vec2 relativePos = relativePosition(_event.getPos());
// offset for the lineNumber: // offset for the lineNumber:
relativePos -= vec2(m_lastOffsetDisplay, 0); relativePos -= vec2(m_lastOffsetDisplay, 0);
@@ -458,17 +518,17 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
relativePos.setX(0); relativePos.setX(0);
} }
if ( _event.getId() == 12 if ( _event.getId() == 12
&& _event.getStatus() == ewol::key::statusSingle) { && _event.getStatus() == gale::key::status::pressSingle) {
APPL_DEBUG("kjhkjhkjh"); APPL_TODO("RAT5 SAVE button ==> TODO implement");
// Rat5 save event // Rat5 save event
sendMultiCast(ednMsgGuiSave, "current"); //sendMultiCast(ednMsgGuiSave, "current");
return true; return true;
} }
// just forward event == > manage directly in the buffer // just forward event == > manage directly in the buffer
if (_event.getId() == 1) { if (_event.getId() == 1) {
// mouse selection : // mouse selection :
//if (_event.getType() == ewol::key::typeMouse) { //if (_event.getType() == gale::key::typeMouse) {
if (_event.getStatus() == ewol::key::statusDown) { if (_event.getStatus() == gale::key::status::down) {
//if (_event.getSpecialKey().isSetShift() == false) { //if (_event.getSpecialKey().isSetShift() == false) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos); appl::Buffer::Iterator newPos = getMousePosition(relativePos);
m_buffer->setSelectMode(false); m_buffer->setSelectMode(false);
@@ -477,7 +537,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
markToRedraw(); markToRedraw();
return true; return true;
//} //}
} else if (_event.getStatus() == ewol::key::statusUp) { } else if (_event.getStatus() == gale::key::status::up) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos); appl::Buffer::Iterator newPos = getMousePosition(relativePos);
moveCursor(newPos); moveCursor(newPos);
m_buffer->setSelectMode(false); m_buffer->setSelectMode(false);
@@ -485,41 +545,41 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
std::string value; std::string value;
m_buffer->copy(value); m_buffer->copy(value);
if (value.size() != 0) { if (value.size() != 0) {
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardSelection, value); gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value);
} }
markToRedraw(); markToRedraw();
return true; return true;
} }
//} //}
if (_event.getStatus() == ewol::key::statusSingle) { if (_event.getStatus() == gale::key::status::pressSingle) {
if ( _event.getType() == ewol::key::typeMouse if ( _event.getType() == gale::key::type::mouse
|| _event.getType() == ewol::key::typeFinger) { || _event.getType() == gale::key::type::finger) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos); appl::Buffer::Iterator newPos = getMousePosition(relativePos);
moveCursor(newPos); moveCursor(newPos);
markToRedraw(); markToRedraw();
return true; return true;
} }
} else if (_event.getStatus() == ewol::key::statusDouble) { } else if (_event.getStatus() == gale::key::status::pressDouble) {
mouseEventDouble(); mouseEventDouble();
// Copy selection : // Copy selection :
std::string value; std::string value;
m_buffer->copy(value); m_buffer->copy(value);
if (value.size() != 0) { if (value.size() != 0) {
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardSelection, value); gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value);
} }
markToRedraw(); markToRedraw();
return true; return true;
} else if (_event.getStatus() == ewol::key::statusTriple) { } else if (_event.getStatus() == gale::key::status::pressTriple) {
mouseEventTriple(); mouseEventTriple();
// Copy selection : // Copy selection :
std::string value; std::string value;
m_buffer->copy(value); m_buffer->copy(value);
if (value.size() != 0) { if (value.size() != 0) {
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardSelection, value); gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value);
} }
markToRedraw(); markToRedraw();
return true; return true;
} else if (_event.getStatus() == ewol::key::statusMove) { } else if (_event.getStatus() == gale::key::status::move) {
if (m_buffer->getSelectMode() == true) { if (m_buffer->getSelectMode() == true) {
//int64_t timeStart = ewol::getTime(); //int64_t timeStart = ewol::getTime();
appl::Buffer::Iterator newPos = getMousePosition(relativePos); appl::Buffer::Iterator newPos = getMousePosition(relativePos);
@@ -537,10 +597,10 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
} }
} }
} else if (2 == _event.getId()) { } else if (2 == _event.getId()) {
if (ewol::key::statusSingle == _event.getStatus()) { if (gale::key::status::pressSingle == _event.getStatus()) {
appl::Buffer::Iterator newPos = getMousePosition(relativePos); appl::Buffer::Iterator newPos = getMousePosition(relativePos);
moveCursor(newPos); moveCursor(newPos);
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardSelection); gale::context::clipBoard::request(gale::context::clipBoard::clipboardSelection);
markToRedraw(); markToRedraw();
return true; return true;
} }
@@ -615,100 +675,21 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
return m_buffer->end(); return m_buffer->end();
} }
void appl::TextViewer::onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) { void appl::TextViewer::onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID) {
if (m_buffer != NULL) { if (m_buffer != nullptr) {
std::string data = ewol::context::clipBoard::get(_clipboardID); std::string data = gale::context::clipBoard::get(_clipboardID);
write(data); write(data);
} }
markToRedraw(); markToRedraw();
} }
void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) { void appl::TextViewer::onCallbackIsModify() {
ewol::widget::WidgetScrolled::onReceiveMessage(_msg); markToRedraw();
APPL_VERBOSE("receive msg: " << _msg); }
// First call plugin void appl::TextViewer::onCallbackSelectChange() {
if (appl::textPluginManager::onReceiveMessage(*this, _msg) == true) { markToRedraw();
markToRedraw();
return;
}
// event needed even if selection of buffer is not done ...
if (_msg.getMessage() == appl::Buffer::eventIsModify) {
markToRedraw();
return;
}
if (_msg.getMessage() == appl::Buffer::eventSelectChange) {
markToRedraw();
return;
}
// If not the last buffer selected, then no event parsing ...
if (isSelectedLast() == false) {
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLineSelect) {
if (m_buffer == NULL) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
select(it, m_buffer->getEndLine(it));
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectGotoLine) {
if (m_buffer == NULL) {
return;
}
appl::Buffer::Iterator it = m_buffer->countForwardNLines(m_buffer->begin(), std::stoi(_msg.getData()));
moveCursor(it);
markToRedraw();
return;
}
if (_msg.getMessage() == appl::MsgSelectNewFile) {
// reset scroll:
if (m_buffer != NULL) {
m_buffer->unRegisterOnEvent(this);
bool needAdd = true;
for (size_t iii=0; iii<m_drawingRemenber.size(); ++iii) {
if (m_drawingRemenber[iii].first == m_buffer) {
m_drawingRemenber[iii].second = m_originScrooled;
APPL_VERBOSE("store origin : " << m_originScrooled);
needAdd = false;
break;
}
}
if (needAdd == true) {
m_drawingRemenber.push_back(std::make_pair(m_buffer, m_originScrooled));
APPL_VERBOSE("Push origin : " << m_originScrooled);
}
}
m_originScrooled = vec2(0,0);
if (m_bufferManager != NULL) {
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);
for (auto element : m_drawingRemenber) {
if (element.first == m_buffer) {
m_originScrooled = element.second;
APPL_VERBOSE("retrive origin : " << m_originScrooled);
// TODO : Check if this element is not out of the display text ...
break;
}
}
}
}
markToRedraw();
return;
}
} }
void appl::TextViewer::onObjectRemove(ewol::Object* _removeObject) {
ewol::widget::WidgetScrolled::onObjectRemove(_removeObject);
if (m_buffer == _removeObject) {
m_buffer = NULL;
markToRedraw();
}
}
void appl::TextViewer::onGetFocus() { void appl::TextViewer::onGetFocus() {
showKeyboard(); showKeyboard();
@@ -723,18 +704,18 @@ void appl::TextViewer::onLostFocus() {
markToRedraw(); markToRedraw();
} }
void appl::TextViewer::setFontSize(int32_t _size) { void appl::TextViewer::onChangePropertyFontSize() {
m_displayText.setFontSize(_size); m_displayText.setFontSize(*propertyFontSize);
setScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ... setScrollingSize(*propertyFontSize*3.0*1.46); // 1.46 is a magic number ...
} }
void appl::TextViewer::setFontName(const std::string& _fontName) { void appl::TextViewer::onChangePropertyFontName() {
m_displayText.setFontName(_fontName); m_displayText.setFontName(*propertyFontName);
} }
// TODO : Update process time ==> a little expensive (2->4ms) in end of file // TODO : Update process time ==> a little expensive (2->4ms) in end of file
void appl::TextViewer::updateScrolling() { void appl::TextViewer::updateScrolling() {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return; return;
} }
vec2 realCursorPosition(0,0); vec2 realCursorPosition(0,0);
@@ -763,11 +744,11 @@ void appl::TextViewer::updateScrolling() {
} }
bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) { bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
markToRedraw(); markToRedraw();
if (appl::textPluginManager::onCursorMove(*this, _pos) == true) { if (m_pluginManager->onCursorMove(*this, _pos) == true) {
updateScrolling(); updateScrolling();
return true; return true;
} }
@@ -777,7 +758,7 @@ bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
} }
bool appl::TextViewer::write(const std::string& _data) { bool appl::TextViewer::write(const std::string& _data) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
if (m_buffer->hasTextSelected() == true) { if (m_buffer->hasTextSelected() == true) {
@@ -787,39 +768,39 @@ bool appl::TextViewer::write(const std::string& _data) {
} }
bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) { bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
markToRedraw(); markToRedraw();
if (appl::textPluginManager::onWrite(*this, _pos, _data) == true) { if (m_pluginManager->onWrite(*this, _pos, _data) == true) {
// no call of the move cursor, because pluging might call theses function to copy and cut data... // no call of the move cursor, because pluging might call theses function to copy and cut data...
updateScrolling(); updateScrolling();
return true; return true;
} }
bool ret = m_buffer->write(_data, _pos); bool ret = m_buffer->write(_data, _pos);
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor()); m_pluginManager->onCursorMove(*this, m_buffer->cursor());
updateScrolling(); updateScrolling();
return ret; return ret;
} }
bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
markToRedraw(); markToRedraw();
if (appl::textPluginManager::onReplace(*this, _pos, _data, _posEnd) == true) { if (m_pluginManager->onReplace(*this, _pos, _data, _posEnd) == true) {
// no call of the move cursor, because pluging might call theses function to copy and cut data... // no call of the move cursor, because pluging might call theses function to copy and cut data...
updateScrolling(); updateScrolling();
return true; return true;
} }
bool ret = m_buffer->replace(_data, _pos, _posEnd); bool ret = m_buffer->replace(_data, _pos, _posEnd);
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor()); m_pluginManager->onCursorMove(*this, m_buffer->cursor());
updateScrolling(); updateScrolling();
return ret; return ret;
} }
bool appl::TextViewer::replace(const std::string& _data) { bool appl::TextViewer::replace(const std::string& _data) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return false; return false;
} }
if (m_buffer->hasTextSelected() == false) { if (m_buffer->hasTextSelected() == false) {
@@ -829,7 +810,7 @@ bool appl::TextViewer::replace(const std::string& _data) {
} }
void appl::TextViewer::remove() { void appl::TextViewer::remove() {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return; return;
} }
if (m_buffer->hasTextSelected() == false) { if (m_buffer->hasTextSelected() == false) {
@@ -837,17 +818,17 @@ void appl::TextViewer::remove() {
return; return;
} }
markToRedraw(); markToRedraw();
if (appl::textPluginManager::onRemove(*this, m_buffer->selectStart(), m_buffer->selectStop()) == true) { if (m_pluginManager->onRemove(*this, m_buffer->selectStart(), m_buffer->selectStop()) == true) {
return; return;
} }
m_buffer->removeSelection(); m_buffer->removeSelection();
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor()); m_pluginManager->onCursorMove(*this, m_buffer->cursor());
} }
void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) { void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return; return;
} }
markToRedraw(); markToRedraw();
@@ -870,7 +851,7 @@ void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
} }
void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) { void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return; return;
} }
markToRedraw(); markToRedraw();
@@ -893,7 +874,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
} }
void appl::TextViewer::moveCursorUp(uint32_t _nbLine) { void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return; return;
} }
markToRedraw(); markToRedraw();
@@ -919,7 +900,7 @@ void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
} }
void appl::TextViewer::moveCursorDown(uint32_t _nbLine) { void appl::TextViewer::moveCursorDown(uint32_t _nbLine) {
if (m_buffer == NULL) { if (m_buffer == nullptr) {
return; return;
} }
markToRedraw(); markToRedraw();
@@ -999,14 +980,14 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
} }
void appl::TextViewer::setCurrentSelect() { void appl::TextViewer::setCurrentSelect() {
if (m_viewerManager != NULL) { if (m_viewerManager != nullptr) {
m_viewerManager->setViewerSelected(this, m_buffer); m_viewerManager->setViewerSelected(ememory::dynamicPointerCast<appl::TextViewer>(sharedFromThis()), m_buffer);
} }
} }
bool appl::TextViewer::isSelectedLast() { bool appl::TextViewer::isSelectedLast() {
if (m_viewerManager != NULL) { if (m_viewerManager != nullptr) {
return m_viewerManager->isLastSelected(this); return m_viewerManager->isLastSelected(ememory::dynamicPointerCast<appl::TextViewer>(sharedFromThis()));
} }
return false; return false;
} }

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_VIEWER_H__
#define __APPL_TEXT_VIEWER_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
@@ -22,9 +17,16 @@
#include <utility> #include <utility>
namespace appl { namespace appl {
class textPluginManager;
class TextViewer;
using TextViewerShared = ememory::SharedPtr<appl::TextViewer>;
using TextViewerWeak = ememory::WeakPtr<appl::TextViewer>;
class TextViewer : public ewol::widget::WidgetScrolled { class TextViewer : public ewol::widget::WidgetScrolled {
private: private:
appl::GlyphPainting* m_paintingProperties; //!< element painting property eproperty::Value<std::string> propertyFontName; //!< name of the font to display text.
eproperty::Value<int32_t> propertyFontSize; //!< Size of the font to display text.
ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties; //!< element painting property
int32_t m_colorBackground; int32_t m_colorBackground;
int32_t m_colorSpace; int32_t m_colorSpace;
int32_t m_colorTabulation; int32_t m_colorTabulation;
@@ -33,41 +35,42 @@ namespace appl {
int32_t m_colorSelection; int32_t m_colorSelection;
int32_t m_colorNormal; int32_t m_colorNormal;
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager ememory::SharedPtr<appl::textPluginManager> m_pluginManager; //!< Plugin manager interface
ememory::SharedPtr<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
protected:
TextViewer();
void init();
public: public:
TextViewer(const std::string& _fontName="", int32_t _fontSize=-1); DECLARE_FACTORY(TextViewer);
virtual ~TextViewer(); virtual ~TextViewer();
private: private:
appl::Buffer* m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer) ememory::SharedPtr<appl::Buffer> m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
public: public:
/** /**
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData) * @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
* @return pointer on buffer * @return pointer on buffer
*/ */
appl::Buffer* internalGetBuffer() { ememory::SharedPtr<appl::Buffer> internalGetBuffer() {
return m_buffer; return m_buffer;
} }
private: private:
ewol::compositing::Text m_displayText; //!< Text display properties. ewol::compositing::Text m_displayText; //!< Text display properties.
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested. ewol::compositing::Drawing m_displayDrawing; //!< Other display requested.
std::vector<std::pair<appl::Buffer*, vec2>> m_drawingRemenber; std::vector<std::pair<ememory::WeakPtr<appl::Buffer>, vec2>> m_drawingRemenber;
public: public:
void setFontSize(int32_t _size); virtual void onChangePropertyFontSize();
void setFontName(const std::string& _fontName); virtual void onChangePropertyFontName();
protected: // derived function protected: // derived function
virtual void onDraw(); virtual void onDraw();
public: // Derived function public: // Derived function
virtual bool calculateMinSize(); virtual bool calculateMinSize();
virtual void onRegenerateDisplay(); virtual void onRegenerateDisplay();
virtual void onReceiveMessage(const ewol::object::Message& _msg);
virtual void onObjectRemove(ewol::Object* _removeObject);
virtual bool onEventInput(const ewol::event::Input& _event); virtual bool onEventInput(const ewol::event::Input& _event);
virtual bool onEventEntry(const ewol::event::Entry& _event); virtual bool onEventEntry(const ewol::event::Entry& _event);
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID); virtual void onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID);
virtual void onGetFocus(); virtual void onGetFocus();
virtual void onLostFocus(); virtual void onLostFocus();
virtual void changeZoom(float _range);
private: private:
float m_lastOffsetDisplay; //!< Line number ofssed in the display float m_lastOffsetDisplay; //!< Line number ofssed in the display
private: private:
@@ -85,7 +88,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, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd);
bool replace(const std::string& _data); bool replace(const std::string& _data);
bool replace(const std::u32string& _data) { bool replace(const std::u32string& _data) {
return replace(std::to_string(_data)); return replace(etk::to_string(_data));
} }
/** /**
* @brief Remove selected data ... * @brief Remove selected data ...
@@ -95,7 +98,7 @@ namespace appl {
* @brief Remove selected data ... (No plugin call) * @brief Remove selected data ... (No plugin call)
*/ */
void removeDirect() { void removeDirect() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return; return;
} }
m_buffer->removeSelection(); m_buffer->removeSelection();
@@ -108,7 +111,7 @@ namespace appl {
* @return true of no error occured. * @return true of no error occured.
*/ */
bool copy(std::string& _data) { bool copy(std::string& _data) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
return m_buffer->copy(_data); return m_buffer->copy(_data);
@@ -120,7 +123,7 @@ namespace appl {
* @param[in] _posEnd End position to end replace the data. * @param[in] _posEnd End position to end replace the data.
*/ */
void copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { void copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return; return;
} }
m_buffer->copy(_data, _pos, _posEnd); m_buffer->copy(_data, _pos, _posEnd);
@@ -132,7 +135,7 @@ namespace appl {
* @return true if the write is done corectly * @return true if the write is done corectly
*/ */
bool writeDirect(const std::string& _data, const appl::Buffer::Iterator& _pos) { bool writeDirect(const std::string& _data, const appl::Buffer::Iterator& _pos) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
bool ret = m_buffer->write(_data, _pos); bool ret = m_buffer->write(_data, _pos);
@@ -147,7 +150,7 @@ namespace appl {
* @return true if the write is done corectly * @return true if the write is done corectly
*/ */
bool replaceDirect(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { bool replaceDirect(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
bool ret = m_buffer->replace(_data, _pos, _posEnd); bool ret = m_buffer->replace(_data, _pos, _posEnd);
@@ -208,14 +211,14 @@ namespace appl {
* @return true if a display buffer is present, false otherwise. * @return true if a display buffer is present, false otherwise.
*/ */
virtual bool hasBuffer() { virtual bool hasBuffer() {
return m_buffer != NULL; return m_buffer != nullptr;
} }
/** /**
* @brief Get the status of selection. * @brief Get the status of selection.
* @return true if we have a current selection, false otherwise. * @return true if we have a current selection, false otherwise.
*/ */
virtual bool hasTextSelected() { virtual bool hasTextSelected() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
return m_buffer->hasTextSelected(); return m_buffer->hasTextSelected();
@@ -224,7 +227,7 @@ namespace appl {
* @brief Remove Selection of the buffer. * @brief Remove Selection of the buffer.
*/ */
virtual void unSelect() { virtual void unSelect() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return; return;
} }
m_buffer->unSelect(); m_buffer->unSelect();
@@ -235,7 +238,7 @@ namespace appl {
* @param[in] _stop Stop position of the selection (the curor is set at this position) * @param[in] _stop Stop position of the selection (the curor is set at this position)
*/ */
virtual void select(const appl::Buffer::Iterator& _start, const appl::Buffer::Iterator& _stop) { virtual void select(const appl::Buffer::Iterator& _start, const appl::Buffer::Iterator& _stop) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return; return;
} }
moveCursor(_stop); moveCursor(_stop);
@@ -255,7 +258,7 @@ namespace appl {
appl::Buffer::Iterator& _resultStart, appl::Buffer::Iterator& _resultStart,
appl::Buffer::Iterator& _resultStop, appl::Buffer::Iterator& _resultStop,
bool _caseSensitive = true) { bool _caseSensitive = true) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
bool ret = m_buffer->search(_pos, _search, _resultStart, _caseSensitive); bool ret = m_buffer->search(_pos, _search, _resultStart, _caseSensitive);
@@ -278,7 +281,7 @@ namespace appl {
appl::Buffer::Iterator& _resultStart, appl::Buffer::Iterator& _resultStart,
appl::Buffer::Iterator& _resultStop, appl::Buffer::Iterator& _resultStop,
bool _caseSensitive = true) { bool _caseSensitive = true) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
bool ret = m_buffer->searchBack(_pos, _search, _resultStart, _caseSensitive); bool ret = m_buffer->searchBack(_pos, _search, _resultStart, _caseSensitive);
@@ -297,7 +300,7 @@ namespace appl {
bool getPosAround(const appl::Buffer::Iterator& _pos, bool getPosAround(const appl::Buffer::Iterator& _pos,
appl::Buffer::Iterator &_beginPos, appl::Buffer::Iterator &_beginPos,
appl::Buffer::Iterator &_endPos) { appl::Buffer::Iterator &_endPos) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return false; return false;
} }
return m_buffer->getPosAround(_pos, _beginPos, _endPos); return m_buffer->getPosAround(_pos, _beginPos, _endPos);
@@ -308,7 +311,7 @@ namespace appl {
* @return The Iterator * @return The Iterator
*/ */
appl::Buffer::Iterator position(int64_t _pos) { appl::Buffer::Iterator position(int64_t _pos) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->position(_pos); return m_buffer->position(_pos);
@@ -318,7 +321,7 @@ namespace appl {
* @return The iterator on the cursor position * @return The iterator on the cursor position
*/ */
appl::Buffer::Iterator cursor() { appl::Buffer::Iterator cursor() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->cursor(); return m_buffer->cursor();
@@ -328,7 +331,7 @@ namespace appl {
* @return The iterator on the begin position * @return The iterator on the begin position
*/ */
appl::Buffer::Iterator begin() { appl::Buffer::Iterator begin() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->begin(); return m_buffer->begin();
@@ -338,7 +341,7 @@ namespace appl {
* @return The iterator on the end position * @return The iterator on the end position
*/ */
appl::Buffer::Iterator end() { appl::Buffer::Iterator end() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->end(); return m_buffer->end();
@@ -348,7 +351,7 @@ namespace appl {
* @return The Iterator * @return The Iterator
*/ */
appl::Buffer::Iterator selectStart() { appl::Buffer::Iterator selectStart() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->selectStart(); return m_buffer->selectStart();
@@ -358,7 +361,7 @@ namespace appl {
* @return The Iterator * @return The Iterator
*/ */
appl::Buffer::Iterator selectStop() { appl::Buffer::Iterator selectStop() {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->selectStop(); return m_buffer->selectStop();
@@ -369,7 +372,7 @@ namespace appl {
* @return The position in the buffer of the start of the line. * @return The position in the buffer of the start of the line.
*/ */
appl::Buffer::Iterator getStartLine(const appl::Buffer::Iterator& _pos) { appl::Buffer::Iterator getStartLine(const appl::Buffer::Iterator& _pos) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->getStartLine(_pos); return m_buffer->getStartLine(_pos);
@@ -380,7 +383,7 @@ namespace appl {
* @return The position in the buffer of the end of the line. * @return The position in the buffer of the end of the line.
*/ */
appl::Buffer::Iterator getEndLine(const appl::Buffer::Iterator& _pos) { appl::Buffer::Iterator getEndLine(const appl::Buffer::Iterator& _pos) {
if (m_buffer==NULL) { if (m_buffer==nullptr) {
return appl::Buffer::Iterator(); return appl::Buffer::Iterator();
} }
return m_buffer->getEndLine(_pos); return m_buffer->getEndLine(_pos);
@@ -389,23 +392,31 @@ namespace appl {
* @brief Register of the arrival of a Multicast message * @brief Register of the arrival of a Multicast message
* @param[in] _messageId Event Id waiting for... * @param[in] _messageId Event Id waiting for...
*/ */
// TODO : Remove
void ext_registerMultiCast(const char* const _messageId) { void ext_registerMultiCast(const char* const _messageId) {
registerMultiCast(_messageId); //registerMultiCast(_messageId);
} }
/** /**
* @brief add a specific shortcut with his description * @brief add a specific shortcut with his description
* @param[in] _descriptiveString Description string of the shortcut * @param[in] _descriptiveString Description string of the shortcut
* @param[in] _generateEventId Event generic of the element * @param[in] _generateEventName Event generic of the element
* @param[in] _data Associate data wit the event
*/ */
virtual void ext_shortCutAdd(const char * _descriptiveString, virtual void ext_shortCutAdd(const std::string& _descriptiveString,
const char * _generateEventId, const std::string& _generateEventName) {
std::string _data="", shortCutAdd(_descriptiveString, _generateEventName);
bool _broadcast=false) {
shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
} }
/**
* @brief Remove a specific shortcut with his event name
* @param[in] _generateEventName Event of the element shortcut
*/
virtual void ext_shortCutRm(const std::string& _generateEventName) {
shortCutRemove(_generateEventName);
}
private: // callback fundtions
void onCallbackIsModify();
void onCallbackShortCut(const std::string& _value);
void onCallbackSelectChange();
void onCallbackselectNewFile(const std::string& _value);
}; };
}; }
#endif

View File

@@ -1,78 +1,40 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/Gui/ViewerManager.h> #include <appl/Gui/ViewerManager.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/object/Manager.h> #include <ewol/object/Manager.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#undef __class__ appl::ViewerManager::ViewerManager() {
#define __class__ "ViewerManager"
appl::ViewerManager::ViewerManager() :
ewol::Resource("???ViewerManager???"),
m_viewer(NULL) {
addObjectType("appl::ViewerManager"); addObjectType("appl::ViewerManager");
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
} }
appl::ViewerManager::~ViewerManager() { appl::ViewerManager::~ViewerManager() {
appl::BufferManager::release(m_bufferManager);
} }
void appl::ViewerManager::setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer) { ememory::SharedPtr<appl::TextViewer> appl::ViewerManager::getViewerSelected() {
if (m_viewer == _viewer) { return m_viewer.lock();
}
bool appl::ViewerManager::isLastSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer) {
return m_viewer.lock() == _viewer;
}
void appl::ViewerManager::setViewerSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer, const ememory::SharedPtr<appl::Buffer>& _buffer) {
if (m_viewer.lock() == _viewer) {
return; return;
} }
m_viewer = _viewer; m_viewer = _viewer;
if (m_bufferManager != NULL) { if (m_bufferManager != nullptr) {
m_bufferManager->setBufferSelected(_buffer); //m_bufferManager->setBufferSelected(_buffer);
} }
} }
void appl::ViewerManager::onReceiveMessage(const ewol::object::Message& _msg) {
APPL_DEBUG("receive message !!! " << _msg);
}
void appl::ViewerManager::onObjectRemove(ewol::Object* _removeObject) {
ewol::Resource:: onObjectRemove(_removeObject);
if (_removeObject == m_viewer) {
m_viewer = NULL;
return;
}
}
appl::ViewerManager* appl::ViewerManager::keep() {
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
appl::ViewerManager* object = static_cast<appl::ViewerManager*>(getManager().localKeep("???ViewerManager???"));
if (NULL != object) {
return object;
}
// this element create a new one every time ....
EWOL_INFO("CREATE : appl::ViewerManager: ???ViewerManager???");
object = new appl::ViewerManager();
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ???ViewerManager???");
return NULL;
}
getManager().localAdd(object);
return object;
}
void appl::ViewerManager::release(appl::ViewerManager*& _object) {
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
getManager().release(object2);
_object = NULL;
}

View File

@@ -1,68 +1,45 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __VIEWER_MANAGER_H__
#define __VIEWER_MANAGER_H__
#include <appl/Buffer.h> #include <appl/Buffer.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/resource/Resource.h> #include <gale/resource/Resource.h>
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
namespace appl { namespace appl {
class TextViewer; class TextViewer;
class ViewerManager : public ewol::Resource { class ViewerManager;
using ViewerManagerShared = ememory::SharedPtr<appl::ViewerManager>;
using ViewerManagerWeak = ememory::WeakPtr<appl::ViewerManager>;
class ViewerManager : public ewol::Object {
protected: protected:
ViewerManager(); ViewerManager();
~ViewerManager(); public:
DECLARE_SINGLE_FACTORY(ViewerManager, "???ViewerManager???");
virtual ~ViewerManager();
private: private:
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
appl::TextViewer* m_viewer; ememory::WeakPtr<appl::TextViewer> m_viewer;
public: public:
/** /**
* @brief Set the current buffer selected * @brief Set the current buffer selected
* @param[in] _viewer Pointer on the viewer selected * @param[in] _viewer Pointer on the viewer selected
*/ */
void setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer); void setViewerSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer, const ememory::SharedPtr<appl::Buffer>& _buffer);
/** /**
* @brief Get the current buffer selected * @brief Get the current buffer selected
* @return Pointer on the buffer selected * @return Pointer on the buffer selected
*/ */
appl::TextViewer* getViewerSelected() { ememory::SharedPtr<appl::TextViewer> getViewerSelected();
return m_viewer;
};
/** /**
* @breif Check if the element is the last request selection * @breif Check if the element is the last request selection
* @param[in] _viewer element selected. * @param[in] _viewer element selected.
* @return true if the element is selected * @return true if the element is selected
*/ */
bool isLastSelected(appl::TextViewer* _viewer) { bool isLastSelected(const ememory::SharedPtr<appl::TextViewer>& _viewer);
return m_viewer == _viewer;
};
public: // herited function
void onReceiveMessage(const ewol::object::Message& _msg);
void onObjectRemove(ewol::Object* _removeObject);
public: // resource manager
/**
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured.
*/
static appl::ViewerManager* keep();
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::ViewerManager*& _object);
}; };
}; }
#endif

View File

@@ -1,94 +1,77 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Gui/WorkerCloseAllFile.h> #include <appl/Gui/WorkerCloseAllFile.h>
#undef __class__ appl::WorkerCloseAllFile::WorkerCloseAllFile() {
#define __class__ "WorkerCloseAllFile"
static const char* s_closeDone = "close-done";
appl::WorkerCloseAllFile::WorkerCloseAllFile() :
m_worker(NULL),
m_bufferManager(NULL) {
addObjectType("appl::WorkerCloseAllFile"); addObjectType("appl::WorkerCloseAllFile");
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
}
if (m_bufferManager == NULL) {
void appl::WorkerCloseAllFile::init() {
ewol::object::Worker::init();
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... "); APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy(); destroy();
return; return;
} }
// List all current open file : // List all current open file :
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) { for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
appl::Buffer* tmpBuffer = m_bufferManager->get(iii); ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
if (tmpBuffer == NULL) { if (tmpBuffer == nullptr) {
continue; continue;
} }
if (tmpBuffer->isModify() == false) { if (tmpBuffer->isModify() == false) {
tmpBuffer->removeObject(); APPL_TODO("destroy object");
tmpBuffer->destroy();
continue; continue;
} }
m_bufferNameList.push_back(tmpBuffer->getFileName()); m_bufferNameList.push_back(tmpBuffer->getFileName());
} }
// checkif an element has something to do in the queue // checkif an element has something to do in the queue
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
autoDestroy(); destroy();
return; return;
} }
// create the worker : // create the worker :
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front()); m_worker = appl::WorkerCloseFile::create();
m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
m_worker->startAction(m_bufferNameList.front());
// remove first element : // remove first element :
m_bufferNameList.erase(m_bufferNameList.begin()); m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
autoDestroy(); destroy();
return; return;
} }
m_worker->registerOnEvent(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
} }
appl::WorkerCloseAllFile::~WorkerCloseAllFile() { appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
appl::BufferManager::release(m_bufferManager); APPL_ERROR("Remove Worker");
} }
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerCloseAllFile::onCallbackCloseDone() {
if (m_bufferManager == NULL) { if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
if (_msg.getMessage() == s_closeDone) { if (m_bufferNameList.size() == 0) {
if (m_bufferNameList.size() == 0) { destroy();
autoDestroy(); return;
return; }
} // create the worker :
// create the worker : m_worker = appl::WorkerCloseFile::create();
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front()); m_worker->signalCloseDone.connect(sharedFromThis(), &appl::WorkerCloseAllFile::onCallbackCloseDone);
// remove first element : m_worker->startAction(m_bufferNameList.front());
m_bufferNameList.erase(m_bufferNameList.begin()); // remove first element :
if (m_bufferNameList.size() == 0) { m_bufferNameList.erase(m_bufferNameList.begin());
autoDestroy(); if (m_bufferNameList.size() == 0) {
return; destroy();
} return;
m_worker->registerOnEvent(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
}
}
void appl::WorkerCloseAllFile::onObjectRemove(ewol::Object* _removeObject) {
if (_removeObject == m_worker) {
m_worker = NULL;
APPL_VERBOSE("AutoRemove After saving sub widget ...");
autoDestroy();
} else if (_removeObject == m_bufferManager) {
m_bufferManager = NULL;
autoDestroy();
} }
} }

View File

@@ -1,31 +1,26 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __WORKER_CLOSE_ALL_FILE_H__ #include <ewol/object/Worker.h>
#define __WORKER_CLOSE_ALL_FILE_H__
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <appl/Gui/WorkerCloseFile.h> #include <appl/Gui/WorkerCloseFile.h>
namespace appl { namespace appl {
class WorkerCloseAllFile : public ewol::Object { class WorkerCloseAllFile : public ewol::object::Worker {
public: protected:
WorkerCloseAllFile(); WorkerCloseAllFile();
void init();
public:
DECLARE_FACTORY(WorkerCloseAllFile);
virtual ~WorkerCloseAllFile(); virtual ~WorkerCloseAllFile();
private: private:
std::vector<std::string> m_bufferNameList; std::vector<std::string> m_bufferNameList;
appl::WorkerCloseFile* m_worker; //! pop-up element that is open... ememory::SharedPtr<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback function
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackCloseDone();
virtual void onObjectRemove(ewol::Object * _removeObject);
}; };
}; }
#endif

View File

@@ -1,154 +1,163 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Gui/WorkerCloseFile.h> #include <appl/Gui/WorkerCloseFile.h>
#include <ewol/widget/meta/StdPopUp.h> #include <ewol/widget/meta/StdPopUp.h>
#include <ewol/tools/message.h>
#undef __class__ appl::WorkerCloseFile::WorkerCloseFile() :
#define __class__ "WorkerCloseFile" signalCloseDone(this, "close-file-done", ""),
signalAbort(this, "close-file-abort", ""),
const char* appl::WorkerCloseFile::eventCloseDone = "close-file-done"; m_buffer(nullptr),
m_worker(nullptr),
static const char* s_saveAsValidate = "save-as-validate"; m_bufferManager(nullptr) {
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) {
addObjectType("appl::WorkerCloseFile"); addObjectType("appl::WorkerCloseFile");
addEventId(eventCloseDone);
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
}
if (m_bufferManager == NULL) {
void appl::WorkerCloseFile::init() {
ewol::object::Worker::init();
}
void appl::WorkerCloseFile::startAction(const std::string& _bufferName) {
m_bufferName = _bufferName;
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... "); APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy(); destroy();
return; return;
} }
if (m_bufferName == "") { if (m_bufferName == "") {
// need to find the curent file ... // need to find the curent file ...
appl::Buffer* tmpp = m_bufferManager->getBufferSelected(); ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) { if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ..."); APPL_ERROR("No selected buffer now ...");
autoDestroy(); destroy();
return; return;
} }
m_bufferName = tmpp->getFileName(); m_bufferName = tmpp->getFileName();
} }
if (m_bufferManager->exist(m_bufferName) == false) { if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to close an non-existant file :" << m_bufferName); APPL_ERROR("Try to close an non-existant file :" << m_bufferName);
autoDestroy(); destroy();
return; return;
} }
m_buffer = m_bufferManager->get(m_bufferName); m_buffer = m_bufferManager->get(m_bufferName);
if (m_buffer == NULL) { if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName); APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy(); destroy();
return; return;
} }
if (m_buffer->isModify() == false) { if (m_buffer->isModify() == false) {
generateEventId(eventCloseDone); signalCloseDone.emit();
m_buffer->removeObject(); m_buffer->destroy();
destroy();
return; return;
} }
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp(); ememory::SharedPtr<ewol::widget::StdPopUp> tmpPopUp = ewol::widget::StdPopUp::create();
if (tmpPopUp == NULL) { if (tmpPopUp == nullptr) {
APPL_ERROR("Can not create a simple pop-up"); APPL_ERROR("Can not create a simple pop-up");
destroy();
return; return;
} }
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>"); tmpPopUp->propertyTitle.set("<bold>_T{Close un-saved file:}</bold>");
tmpPopUp->setComment("The file named : <i>\"" + m_buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost..."); tmpPopUp->propertyComment.set("_T{The file named:} <i>'" + m_buffer->getFileName() + "'</i> _T{is curently modify.}<br/>_T{If you don't saves these modifications,}<br/>_T{they will be definitly lost...}");
ewol::Widget* bt = NULL; ememory::SharedPtr<ewol::widget::Button> bt = nullptr;
if (m_buffer->hasFileName() == true) { if (m_buffer->hasFileName() == true) {
bt = tmpPopUp->addButton("Save", true); bt = tmpPopUp->addButton("_T{Save}", true);
if (bt != NULL) { if (bt != nullptr) {
bt->registerOnEvent(this, "pressed", s_saveValidate); bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveValidate);
} }
} }
bt = tmpPopUp->addButton("Save As", true); bt = tmpPopUp->addButton("_T{Save As}", true);
if (bt != NULL) { if (bt != nullptr) {
bt->registerOnEvent(this, "pressed", s_saveAsValidate); bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackSaveAsValidate);
} }
bt = tmpPopUp->addButton("Close", true); bt = tmpPopUp->addButton("_T{Close}", true);
if (bt != NULL) { if (bt != nullptr) {
bt->registerOnEvent(this, "pressed", s_closeValidate); bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose);
} }
tmpPopUp->addButton("Cancel", true); bt = tmpPopUp->addButton("_T{Cancel}", true);
tmpPopUp->setRemoveOnExternClick(true); if (bt != nullptr) {
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows(); bt->signalPressed.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel);
if (tmpWindows == NULL) { }
tmpPopUp->propertyCloseOutEvent.set(true);
ememory::SharedPtr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows."); APPL_ERROR("Error to get the windows.");
autoDestroy(); destroy();
return; return;
} }
tmpWindows->popUpWidgetPush(tmpPopUp); tmpWindows->popUpWidgetPush(tmpPopUp);
} }
appl::WorkerCloseFile::~WorkerCloseFile() { appl::WorkerCloseFile::~WorkerCloseFile() {
appl::BufferManager::release(m_bufferManager); APPL_ERROR("Remove Worker");
} }
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerCloseFile::onCallbackCancel() {
if (m_bufferManager == NULL) { APPL_VERBOSE("Cancel signal ...");
signalAbort.emit();
destroy();
}
void appl::WorkerCloseFile::onCallbackSaveAsValidate() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
APPL_DEBUG("have message : " << _msg); m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferName);
if (_msg.getMessage() == s_saveAsValidate) { if (m_worker != nullptr) {
m_worker = new appl::WorkerSaveFile(m_bufferName); m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackClose);
if (m_worker != NULL) { m_worker->signalAbort.connect(sharedFromThis(), &appl::WorkerCloseFile::onCallbackCancel);
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
}
} else if (_msg.getMessage() == s_saveValidate) {
if (m_buffer == NULL) {
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
autoDestroy();
return;
}
if (m_buffer->storeFile() == false) {
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) {
return;
}
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + m_buffer->getFileName() + "</i>");
} else {
generateEventId(eventCloseDone);
}
} else if ( _msg.getMessage() == s_closeValidate
|| _msg.getMessage() == s_saveAsDone) {
if (m_buffer == NULL) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
autoDestroy();
return;
}
generateEventId(eventCloseDone);
m_buffer->removeObject();
} }
} }
void appl::WorkerCloseFile::onObjectRemove(ewol::Object* _removeObject) { void appl::WorkerCloseFile::onCallbackSaveValidate() {
if (_removeObject == m_worker) { if (m_bufferManager == nullptr) {
m_worker = NULL; // nothing to do in this case ==> can do nothing ...
APPL_VERBOSE("AutoRemove After closing sub widget ..."); signalAbort.emit();
autoDestroy(); destroy();
} else if (_removeObject == m_bufferManager) { return;
m_bufferManager = NULL;
autoDestroy();
} else if (_removeObject == m_buffer) {
m_buffer = NULL;
autoDestroy();
} }
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : oldName=" << m_bufferName);
signalAbort.emit();
destroy();
return;
}
if (m_buffer->storeFile() == false) {
ewol::tools::message::displayWarning("We can not save the file : <br/><i>" + m_buffer->getFileName() + "</i>");
signalAbort.emit();
} else {
m_buffer->destroy();
m_buffer.reset();
signalCloseDone.emit();
}
destroy();
}
void appl::WorkerCloseFile::onCallbackClose() {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ...
signalAbort.emit();
destroy();
return;
}
if (m_buffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
signalAbort.emit();
destroy();
return;
}
m_buffer->destroy();
m_buffer.reset();
signalCloseDone.emit();
destroy();
} }

View File

@@ -1,35 +1,41 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __WORKER_CLOSE_FILE_H__ #include <ewol/object/Worker.h>
#define __WORKER_CLOSE_FILE_H__
#include <ewol/widget/meta/FileChooser.h> #include <ewol/widget/meta/FileChooser.h>
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <appl/Gui/WorkerSaveFile.h> #include <appl/Gui/WorkerSaveFile.h>
namespace appl { namespace appl {
class WorkerCloseFile : public ewol::Object { class WorkerCloseFile : public ewol::object::Worker {
public:
static const char* eventCloseDone;
public: public:
esignal::Signal<> signalCloseDone;
esignal::Signal<> signalAbort;
protected:
// note : if == "" ==> current ... // note : if == "" ==> current ...
WorkerCloseFile(const std::string& _bufferName); WorkerCloseFile();
void init();
public:
DECLARE_FACTORY(WorkerCloseFile);
virtual ~WorkerCloseFile(); virtual ~WorkerCloseFile();
public:
/**
* @brief Action to do
*/
void startAction(const std::string& _bufferName);
private: private:
std::string m_bufferName; std::string m_bufferName;
appl::Buffer* m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer ememory::SharedPtr<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
appl::WorkerSaveFile* m_worker; //! sub-worker element... ememory::SharedPtr<appl::WorkerSaveFile> m_worker; //! sub-worker element...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback Functions
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackSaveAsValidate();
virtual void onObjectRemove(ewol::Object * _removeObject); void onCallbackSaveValidate();
void onCallbackClose();
void onCallbackCancel();
}; };
}; }
#endif

View File

@@ -1,97 +1,76 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Gui/WorkerSaveAllFile.h> #include <appl/Gui/WorkerSaveAllFile.h>
#undef __class__ appl::WorkerSaveAllFile::WorkerSaveAllFile() {
#define __class__ "WorkerSaveAllFile"
static const char* s_saveAsDone = "save-as-done";
appl::WorkerSaveAllFile::WorkerSaveAllFile() :
m_worker(NULL),
m_bufferManager(NULL) {
addObjectType("appl::WorkerSaveAllFile"); addObjectType("appl::WorkerSaveAllFile");
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
}
if (m_bufferManager == NULL) {
void appl::WorkerSaveAllFile::init() {
ewol::object::Worker::init();
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... "); APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy(); destroy();
return; return;
} }
// List all current open file : // List all current open file :
for (size_t iii=0; iii<m_bufferManager->size(); ++iii) { for (auto &it : *m_bufferManager) {
appl::Buffer* tmpBuffer = m_bufferManager->get(iii); if (it == nullptr) {
if (tmpBuffer == NULL) {
continue; continue;
} }
if (tmpBuffer->isModify() == false) { if (it->isModify() == false) {
continue; continue;
} }
if (tmpBuffer->hasFileName() == false) { if (it->hasFileName() == false) {
m_bufferNameList.push_back(tmpBuffer->getFileName()); m_bufferNameList.push_back(it->getFileName());
} else { } else {
tmpBuffer->storeFile(); it->storeFile();
} }
} }
// checkif an element has something to do in the queue // checkif an element has something to do in the queue
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
autoDestroy(); destroy();
return; return;
} }
// create the worker : // create the worker :
m_worker = new appl::WorkerSaveFile(m_bufferNameList.front()); m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferNameList.front());
// remove first element : // remove first element :
m_bufferNameList.erase(m_bufferNameList.begin()); m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) { if (m_bufferNameList.size() == 0) {
autoDestroy(); destroy();
return; return;
} }
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone); m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
} }
appl::WorkerSaveAllFile::~WorkerSaveAllFile() { appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
appl::BufferManager::release(m_bufferManager); APPL_ERROR("Remove Worker");
} }
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerSaveAllFile::onCallbackSaveAsDone() {
if (m_bufferManager == NULL) { if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
return; return;
} }
if (_msg.getMessage() == s_saveAsDone) { if (m_bufferNameList.size() == 0) {
if (m_bufferNameList.size() == 0) { destroy();
autoDestroy(); return;
return;
}
// create the worker :
m_worker = new appl::WorkerSaveFile(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(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();
} }
// create the worker :
m_worker = appl::WorkerSaveFile::create("buffer-name", m_bufferNameList.front());
// remove first element :
m_bufferNameList.erase(m_bufferNameList.begin());
if (m_bufferNameList.size() == 0) {
destroy();
return;
}
m_worker->signalSaveDone.connect(sharedFromThis(), &appl::WorkerSaveAllFile::onCallbackSaveAsDone);
} }

View File

@@ -1,30 +1,27 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __WORKER_SAVE_ALL_FILE_H__ #include <ewol/object/Worker.h>
#define __WORKER_SAVE_ALL_FILE_H__
#include <appl/BufferManager.h> #include <appl/BufferManager.h>
#include <appl/Gui/WorkerSaveFile.h> #include <appl/Gui/WorkerSaveFile.h>
namespace appl { namespace appl {
class WorkerSaveAllFile : public ewol::Object { class WorkerSaveAllFile : public ewol::object::Worker {
public: protected:
WorkerSaveAllFile(); WorkerSaveAllFile();
void init();
public:
DECLARE_FACTORY(WorkerSaveAllFile);
virtual ~WorkerSaveAllFile(); virtual ~WorkerSaveAllFile();
private: private:
std::vector<std::string> m_bufferNameList; std::vector<std::string> m_bufferNameList;
appl::WorkerSaveFile* m_worker; //! pop-up element that is open... ememory::SharedPtr<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: // derived function public: // callback function
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackSaveAsDone();
virtual void onObjectRemove(ewol::Object * _removeObject);
}; };
}; }
#endif

View File

@@ -1,130 +1,118 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/Gui/WorkerSaveFile.h> #include <appl/Gui/WorkerSaveFile.h>
#include <ewol/tools/message.h>
#undef __class__ appl::WorkerSaveFile::WorkerSaveFile() :
#define __class__ "WorkerSaveFile" signalSaveDone(this, "save-file-done", ""),
signalAbort(this, "save-file-abort", ""),
const char* appl::WorkerSaveFile::eventSaveDone = "save-file-done"; propertyBufferName(this, "buffer-name", "", ""),
propertyForceSave(this, "force-save", false, "request save in all case") {
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) {
addObjectType("appl::WorkerSaveFile"); addObjectType("appl::WorkerSaveFile");
addEventId(eventSaveDone);
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
}
if (m_bufferManager == NULL) {
void appl::WorkerSaveFile::init() {
ewol::object::Worker::init();
if (m_bufferManager == nullptr) {
APPL_ERROR("can not call unexistant buffer manager ... "); APPL_ERROR("can not call unexistant buffer manager ... ");
autoDestroy(); destroy();
return; return;
} }
if (m_bufferName == "") { if (*propertyBufferName == "") {
// need to find the curent file ... // need to find the curent file ...
appl::Buffer* tmpp = m_bufferManager->getBufferSelected(); ememory::SharedPtr<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
if (tmpp == NULL) { if (tmpp == nullptr) {
APPL_ERROR("No selected buffer now ..."); APPL_ERROR("No selected buffer now ...");
autoDestroy(); destroy();
return; return;
} }
m_bufferName = tmpp->getFileName(); propertyBufferName.setDirect(tmpp->getFileName());
} }
if (m_bufferManager->exist(m_bufferName) == false) { if (m_bufferManager->exist(*propertyBufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName); APPL_ERROR("Try to save an non-existant file :" << *propertyBufferName);
autoDestroy(); destroy();
return; return;
} }
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName); ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
if (tmpBuffer == NULL) { if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << m_bufferName); APPL_ERROR("Error to get the buffer : " << *propertyBufferName);
autoDestroy(); destroy();
return; return;
} }
if (_forceSaveAs == false) { if (*propertyForceSave == false) {
if (tmpBuffer->hasFileName() == true) { if (tmpBuffer->hasFileName() == true) {
tmpBuffer->storeFile(); tmpBuffer->storeFile();
generateEventId(eventSaveDone); signalSaveDone.emit();
autoDestroy(); destroy();
return; return;
} }
} }
m_chooser = new ewol::widget::FileChooser(); m_chooser = ewol::widget::FileChooser::create();
if (NULL == m_chooser) { if (m_chooser == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
autoDestroy(); destroy();
return; return;
} }
m_chooser->setTitle("Save files As..."); m_chooser->propertyLabelTitle.set("_T{Save files As...}");
m_chooser->setValidateLabel("Save"); m_chooser->propertyLabelValidate.set("_T{Save}");
etk::FSNode tmpName(m_bufferName); etk::FSNode tmpName(*propertyBufferName);
m_chooser->setFolder(tmpName.getNameFolder()); m_chooser->propertyPath.set(tmpName.getNameFolder());
m_chooser->setFileName(tmpName.getNameFile()); m_chooser->propertyFile.set(tmpName.getNameFile());
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows(); ememory::SharedPtr<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) { if (tmpWindows == nullptr) {
APPL_ERROR("Error to get the windows."); APPL_ERROR("Error to get the windows.");
autoDestroy(); destroy();
return; return;
} }
tmpWindows->popUpWidgetPush(m_chooser); tmpWindows->popUpWidgetPush(m_chooser);
m_chooser->registerOnEvent(this, ewol::widget::FileChooser::eventValidate, s_saveAsValidate); m_chooser->signalValidate.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackSaveAsValidate);
m_chooser->signalCancel.connect(sharedFromThis(), &appl::WorkerSaveFile::onCallbackCancel);
} }
appl::WorkerSaveFile::~WorkerSaveFile() { appl::WorkerSaveFile::~WorkerSaveFile() {
appl::BufferManager::release(m_bufferManager); APPL_ERROR("Remove Worker");
} }
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) { void appl::WorkerSaveFile::onCallbackCancel() {
if (m_bufferManager == NULL) { signalAbort.emit();
destroy();
}
void appl::WorkerSaveFile::onCallbackSaveAsValidate(const std::string& _value) {
if (m_bufferManager == nullptr) {
// nothing to do in this case ==> can do nothing ... // nothing to do in this case ==> can do nothing ...
destroy();
return; return;
} }
if (_msg.getMessage() == s_saveAsValidate) { if (_value == "") {
if (_msg.getData() == "") { APPL_ERROR(" might be an error of the File chooser system...");
APPL_ERROR(" might be an error of the File chooser system..."); destroy();
return; return;
}
if (m_bufferManager->exist(m_bufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
return;
}
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName);
if (tmpBuffer == NULL) {
APPL_ERROR("Error to get the buffer : " << m_bufferName);
return;
}
tmpBuffer->setFileName(_msg.getData());
if (tmpBuffer->storeFile() == false) {
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
if (tmpWindows == NULL) {
return;
}
tmpWindows->displayWarningMessage("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
} else {
generateEventId(eventSaveDone);
}
}
}
void appl::WorkerSaveFile::onObjectRemove(ewol::Object* _removeObject) {
if (_removeObject == m_chooser) {
m_chooser = NULL;
APPL_VERBOSE("AutoRemove After closing sub widget ...");
autoDestroy();
} else if (_removeObject == m_bufferManager) {
m_bufferManager = NULL;
autoDestroy();
} }
if (m_bufferManager->exist(*propertyBufferName) == false) {
APPL_ERROR("Try to save an non-existant file :" << *propertyBufferName);
destroy();
return;
}
ememory::SharedPtr<appl::Buffer> tmpBuffer = m_bufferManager->get(*propertyBufferName);
if (tmpBuffer == nullptr) {
APPL_ERROR("Error to get the buffer : " << *propertyBufferName);
destroy();
return;
}
tmpBuffer->setFileName(_value);
if (tmpBuffer->storeFile() == false) {
ewol::tools::message::displayWarning("We can not save the file : <br/><i>" + tmpBuffer->getFileName() + "</i>");
} else {
signalSaveDone.emit();
}
destroy();
} }

View File

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

View File

@@ -1,20 +1,14 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/Highlight.h> #include <appl/Highlight.h>
#include <exml/exml.h> #include <exml/exml.h>
#include <ewol/resource/Manager.h> #include <ewol/ewol.h>
#include <gale/resource/Manager.h>
#undef __class__
#define __class__ "Highlight"
// first pass // first pass
//#define HL_DEBUG APPL_INFO //#define HL_DEBUG APPL_INFO
@@ -24,102 +18,130 @@
//#define HL2_DEBUG APPL_INFO //#define HL2_DEBUG APPL_INFO
#define HL2_DEBUG APPL_VERBOSE #define HL2_DEBUG APPL_VERBOSE
void appl::Highlight::parseRules(exml::Element* _child, appl::Highlight::Highlight() {
std::vector<HighlightPattern*>& _mListPatern, addResourceType("appl::Highlight");
int32_t _level) {
// Create the patern ...
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
// parse under Element
myPattern->parseRules(_child, _level);
// add element in the list
_mListPatern.push_back(myPattern);
} }
appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) : void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _colorFile) {
ewol::Resource(_xmlFilename), gale::Resource::init(_xmlFilename);
m_typeName("") {
// keep color propertiy file : // keep color propertiy file :
m_paintingProperties = appl::GlyphPainting::keep(_colorFile); m_paintingProperties = appl::GlyphPainting::create(_colorFile);
exml::Document doc; exml::Document doc;
if (doc.load(_xmlFilename) == false) { if (doc.load(_xmlFilename) == false) {
APPL_ERROR(" can not load file XML : " << _xmlFilename); APPL_ERROR(" can not load file XML : " << _xmlFilename);
return; return;
} }
exml::Element* root = doc.getNamed("EdnLang"); exml::Element root = doc.nodes["EdnLang"];
if (NULL == root ) { if (root.exist() == false) {
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ..."); APPL_ERROR("(l ?) main node not find: 'EdnLang' ...");
return; return;
} }
m_typeName = root->getAttribute("lang"); m_typeName = root.attributes["lang"];
int32_t level1 = 0; int32_t level1 = 0;
int32_t level2 = 0; int32_t level2 = 0;
// parse all the elements : // parse all the elements :
for(int32_t iii = 0; iii < root->size(); ++iii) { for (const auto it : root.nodes) {
exml::Element* child = root->getElement(iii); const exml::Element child = it.toElement();
if (child == NULL) { if (child.exist() == false) {
// trash here all that is not element ... // trash here all that is not element ...
continue; continue;
} }
if (child->getValue() == "ext") { if (child.getValue() == "ext") {
std::string myData = child->getText(); std::string myData = child.getText();
if (myData.size()!=0) { if (myData.size()!=0) {
//HL_DEBUG("(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData); //HL_DEBUG("(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
m_listExtentions.push_back(myData); m_listExtentions.push_back(myData);
} }
} else if (child->getValue() == "pass1") { } else if (child.getValue() == "pass1") {
// get sub Nodes ... // get sub Nodes ...
for(int32_t jjj=0; jjj< child->size(); jjj++) { for (const auto it2 : child.nodes) {
exml::Element* passChild = child->getElement(jjj); const exml::Element passChild = it2.toElement();
if (passChild == NULL) { if (passChild.exist() == false) {
continue; continue;
} }
if (passChild->getValue() != "rule") { if (passChild.getValue() != "rule") {
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" ); APPL_ERROR("(l "<< passChild.getPos() << ") node not suported : '"<< passChild.getValue() << "' must be [rule]" );
continue; continue;
} }
parseRules(passChild, m_listHighlightPass1, level1++); // Create the patern in list
m_listHighlightPass1.push_back(HighlightPattern(m_paintingProperties, passChild, level1++));
} }
} else if (child->getValue() == "pass2") { } else if (child.getValue() == "pass2") {
// get sub Nodes ... // get sub Nodes ...
for(int32_t jjj=0; jjj< child->size(); jjj++) { for (const auto it2 : child.nodes) {
exml::Element* passChild = child->getElement(jjj); const exml::Element passChild = it2.toElement();
if (passChild == NULL) { if (passChild.exist() == false) {
continue; continue;
} }
if (passChild->getValue() != "rule") { if (passChild.getValue() != "rule") {
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" ); APPL_ERROR("(l "<< passChild.getPos() << ") node not suported : '"<< passChild.getValue() << "' must be [rule]" );
continue; continue;
} }
parseRules(passChild, m_listHighlightPass2, level2++); // Create the patern in list
m_listHighlightPass2.push_back(HighlightPattern(m_paintingProperties, passChild, level2++));
}
} else if (child.getValue() == "pass") {
std::string attributeName = child.attributes["name"];
if (attributeName == "") {
APPL_ERROR("Can not parse an element pass with no attribute name ... ligne=" << child.getPos());
continue;
}
m_listHighlightNamed.insert(std::pair<std::string, std::vector<HighlightPattern>>(attributeName, std::vector<HighlightPattern>()));
auto it3 = m_listHighlightNamed.find(attributeName);
int32_t level3=0;
// get sub Nodes ...
for (const auto it2 : child.nodes) {
const exml::Element passChild = it2.toElement();
if (passChild.exist() == false) {
continue;
}
if (passChild.getValue() != "rule") {
APPL_ERROR("(l "<< passChild.getPos() << ") node not suported : '"<< passChild.getValue() << "' must be [rule]" );
continue;
}
// add element in the list
it3->second.push_back(HighlightPattern(m_paintingProperties, passChild, level3++));
} }
} else { } else {
APPL_ERROR("(l "<< child->getPos() << ") node not suported : \""<< child->getValue() << "\" must be [ext,pass1,pass2]" ); APPL_ERROR("(l "<< child.getPos() << ") node not suported : '"<< child.getValue() << "' must be [ext,pass1,pass2]" );
} }
} }
} }
appl::Highlight::~Highlight() { appl::Highlight::~Highlight() {
// clean all Element
for (int32_t iii = 0; iii < m_listHighlightPass1.size(); ++iii) {
if (m_listHighlightPass1[iii] != NULL) {
delete(m_listHighlightPass1[iii]);
m_listHighlightPass1[iii] = NULL;
}
}
// clear the compleate list // clear the compleate list
m_listHighlightPass1.clear(); m_listHighlightPass1.clear();
// clear the compleate list // clear the compleate list
m_listHighlightPass2.clear();
// clear the compleate list
m_listExtentions.clear(); m_listExtentions.clear();
} }
bool appl::Highlight::hasExtention(const std::string& _ext) { bool appl::Highlight::isCompatible(const std::string& _name) {
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) { for (auto &it : m_listExtentions) {
APPL_VERBOSE(" check : " << m_listExtentions[iii] << "=?=" << _ext); APPL_DEBUG(" check : " << it << "=?=" << _name);
if ( m_listExtentions[iii] == "*." + _ext std::regex expression;
|| m_listExtentions[iii] == _ext) { try {
return true; expression.assign(it, std::regex_constants::optimize | std::regex_constants::ECMAScript);
} catch (std::regex_error e) {
APPL_ERROR("can not parse regex : '" << e.what() << "' for : " << it);
continue;
} }
std::smatch resultMatch;
std::regex_search(_name.begin(), _name.end(), resultMatch, expression, std::regex_constants::match_continuous);
if (resultMatch.size() <= 0) {
continue;
}
APPL_VERBOSE(" - begin=" << std::distance(_name.begin(), resultMatch[0].first) << " end=" << std::distance(_name.begin(), resultMatch[0].second));
if (resultMatch[0].first != _name.begin()) {
continue;
}
if (resultMatch[0].second != _name.end()) {
continue;
}
return true;
} }
return false; return false;
} }
@@ -135,8 +157,8 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
} }
APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" "); APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" ");
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) { for (auto &it : m_listExtentions) {
if (extention == m_listExtentions[iii] ) { if (extention == it ) {
return true; return true;
} }
} }
@@ -146,18 +168,25 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
void appl::Highlight::display() { void appl::Highlight::display() {
APPL_INFO("List of ALL Highlight : "); APPL_INFO("List of ALL Highlight : ");
for (int32_t iii=0; iii< m_listExtentions.size(); iii++) { for (auto &it : m_listExtentions) {
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] ); APPL_INFO(" Extention : " << it );
} }
// display all elements // display all elements
for (int32_t iii=0; iii< m_listHighlightPass1.size(); iii++) { for (auto &it : m_listHighlightPass1) {
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->getName() ); APPL_INFO(" Pass 1 : " << it.getName() );
//m_listHighlightPass1[iii]->display(); //it.display();
} }
// display all elements for (auto &it : m_listHighlightPass2) {
for (int32_t iii=0; iii< m_listHighlightPass2.size(); iii++) { APPL_INFO(" pass 2 : " << it.getName() );
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->getName() ); //it.display();
//m_listHighlightPass2[iii]->display(); }
for (auto &it : m_listHighlightNamed) {
APPL_INFO(" pass * : " << it.first << " : ");
for (auto &it2 : it.second) {
APPL_INFO(" " << it2.getName() );
//it.display();
}
//it.display();
} }
} }
@@ -168,7 +197,7 @@ void appl::Highlight::parse(int64_t _start,
int64_t _stop, int64_t _stop,
std::vector<appl::HighlightInfo> & _metaData, std::vector<appl::HighlightInfo> & _metaData,
int64_t _addingPos, int64_t _addingPos,
etk::Buffer & _buffer) { std::string& _buffer) {
if (0 > _addingPos) { if (0 > _addingPos) {
_addingPos = 0; _addingPos = 0;
} }
@@ -176,27 +205,37 @@ void appl::Highlight::parse(int64_t _start,
int64_t elementStart = _start; int64_t elementStart = _start;
int64_t elementStop = _stop; int64_t elementStop = _stop;
appl::HighlightInfo resultat; appl::HighlightInfo resultat;
int64_t startTime = ewol::getTime();
while (elementStart <= elementStop) { while (elementStart <= elementStop) {
HL_DEBUG("Parse element in the buffer pos=" << elementStart); //HL_DEBUG("Parse element in the buffer pos=" << elementStart);
int64_t currentTime = ewol::getTime();
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){ for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
enum resultFind ret = HLP_FIND_OK; bool ret = true;
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ")" ); /*
if (_buffer[elementStart] == '\n') {
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='\\n' " << m_listHighlightPass1[jjj].getPaternString());
} else {
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj].getPaternString());
}
*/
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer); ret = m_listHighlightPass1[jjj].find(elementStart, _buffer.size(), resultat, _buffer);
if (HLP_FIND_ERROR != ret) { if (ret == true) {
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); int64_t currentTimeEnd = ewol::getTime();
int64_t deltaTime = currentTimeEnd - currentTime;
HL_DEBUG("Find Pattern in the Buffer : time=" << (float)deltaTime/1000.0f << " ms (" << resultat.start << "," << resultat.stop << ") startPos=" << elementStart << " for=" << m_listHighlightPass1[jjj].getPaternString().first << " " << m_listHighlightPass1[jjj].getPaternString().second);
// remove element in the current List where the current Element have a end inside the next... // remove element in the current List where the current Element have a end inside the next...
int64_t kkk=_addingPos; int64_t kkk=_addingPos;
while(kkk < _metaData.size() ) { while(kkk < (int64_t)_metaData.size() ) {
if (_metaData[kkk].beginStart <= resultat.endStop) { if (_metaData[kkk].start <= resultat.stop) {
// remove element // remove element
HL_DEBUG("Erase element=" << kkk); HL_DEBUG("Erase element=" << kkk);
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1); _metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
// Increase the end of search // Increase the end of search
if (kkk < _metaData.size()) { if (kkk < (int64_t)_metaData.size()) {
// just befor the end of the next element // just before the end of the next element
elementStop = _metaData[kkk].beginStart-1; elementStop = _metaData[kkk].start-1;
} else { } else {
// end of the buffer // end of the buffer
elementStop = _buffer.size(); elementStop = _buffer.size();
@@ -208,9 +247,9 @@ void appl::Highlight::parse(int64_t _start,
} }
// add curent element in the list ... // add curent element in the list ...
_metaData.insert(_metaData.begin()+_addingPos, resultat); _metaData.insert(_metaData.begin()+_addingPos, resultat);
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop ); HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.start << " E=" << resultat.stop );
// update the current research starting element: (set position at the end of the current element // update the current research starting element: (set position at the end of the current element
elementStart = resultat.endStop-1; elementStart = resultat.stop-1;
// increment the position of insertion: // increment the position of insertion:
_addingPos++; _addingPos++;
// We find a pattern == > Stop search for the current element // We find a pattern == > Stop search for the current element
@@ -220,17 +259,25 @@ void appl::Highlight::parse(int64_t _start,
// Go to the next element (and search again ...). // Go to the next element (and search again ...).
elementStart++; elementStart++;
} }
int64_t stopTime = ewol::getTime();
int64_t deltaTimeGlobal = stopTime - startTime;
APPL_DEBUG("parse in time=" << (float)deltaTimeGlobal/1000.0f << " ms ");
} }
/** /**
* @brief second pass of the hightlight * @brief second pass of the hightlight
* * @param[in] _start Start searching data
* @param[in] _stop End searching data
* @param[out] _metaData Output list of all find patern
* @param[in] _buffer buffer where we need to search data
*/ */
void appl::Highlight::parse2(int64_t _start, void appl::Highlight::parse2(int64_t _start,
int64_t _stop, int64_t _stop,
std::vector<appl::HighlightInfo> &_metaData, std::vector<appl::HighlightInfo>& _metaData,
etk::Buffer &_buffer) { std::string& _buffer) {
HL2_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << HL2_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() <<
" == > position search: (" << _start << "," << _stop << ")" ); " == > position search: (" << _start << "," << _stop << ")" );
int64_t elementStart = _start; int64_t elementStart = _start;
@@ -238,20 +285,22 @@ void appl::Highlight::parse2(int64_t _start,
appl::HighlightInfo resultat; appl::HighlightInfo resultat;
while (elementStart < elementStop) { while (elementStart < elementStop) {
if (elementStart == 306) {
//elog::setLevel(elog::logLevelVerbose);
}
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" ); //HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
for (int64_t jjj=0; jjj<m_listHighlightPass2.size(); jjj++){ for (int64_t jjj=0; jjj<int64_t(m_listHighlightPass2.size()); jjj++){
enum resultFind ret = HLP_FIND_OK;
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" << HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
_start << "," << _buffer.size() << ")" ); elementStart << "," << elementStop << ") in='"
<< /*_buffer[elementStart]*/ std::string(_buffer.begin()+elementStart,_buffer.begin()+elementStop) << "' " << m_listHighlightPass2[jjj].getPaternString().first << " " << m_listHighlightPass1[jjj].getPaternString().second);
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer); bool ret = m_listHighlightPass2[jjj].find(elementStart, elementStop, resultat, _buffer);
if (HLP_FIND_ERROR != ret) { if (ret == true) {
HL2_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); // find an element:
// add curent element in the list ...
_metaData.push_back(resultat); _metaData.push_back(resultat);
elementStart = resultat.endStop-1; HL2_DEBUG("data='" << std::string(_buffer.begin()+elementStart,_buffer.begin()+resultat.stop) << "'");
// Exit current cycle elementStart = resultat.stop-1;
break; break;
} }
} }
@@ -260,29 +309,44 @@ void appl::Highlight::parse2(int64_t _start,
} }
} }
appl::Highlight* appl::Highlight::keep(const std::string& _filename) { /**
//EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\""); * @brief second pass of the hightlight pattern (have found something before)
appl::Highlight* object = static_cast<appl::Highlight*>(getManager().localKeep(_filename)); * @param[in] _upper upper pattern to find the data
if (NULL != object) { * @param[out] _metaData Output list of all find patern
return object; * @param[in] _buffer buffer where we need to search data
} */
EWOL_INFO("CREATE : appl::Highlight : file : \"" << _filename << "\""); void appl::Highlight::parseSubElement(const appl::HighlightInfo& _upper,
// this element create a new one every time .... std::vector<appl::HighlightInfo> &_metaData,
object = new appl::Highlight(_filename, "THEME:COLOR:textViewer.json"); std::string &_buffer) {
if (NULL == object) { if (_upper.patern->getSubPatternName().size() == 0) {
EWOL_ERROR("allocation error of a resource : ??Highlight??");
return NULL;
}
getManager().localAdd(object);
return object;
}
void appl::Highlight::release(appl::Highlight*& _object) {
if (NULL == _object) {
return; return;
} }
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object); HL2_DEBUG("Parse element 0 => " << m_listHighlightNamed.size() <<
getManager().release(object2); " == > position search: (" << _upper.start << "," << _upper.stop << ")" );
_object = NULL; int64_t elementStart = _upper.start;
int64_t elementStop = _upper.stop;
appl::HighlightInfo resultat;
// Find element in the list:
auto itHL = m_listHighlightNamed.find(_upper.patern->getSubPatternName());
if (itHL == m_listHighlightNamed.end()) {
APPL_ERROR("Patern does not exist : " << _upper.patern->getSubPatternName() << " note : Removing it ...");
_upper.patern->setSubPatternName("");
return;
}
while (elementStart < elementStop) {
//try to fond the HL in ALL of we have
for (auto &it : itHL->second){
HL2_DEBUG("Parse HL position search: (" << elementStart << "," << elementStop << ") in='" << _buffer[elementStart] << "' " << it.getPaternString().first << " " << it.getPaternString().second);
// Stop the search to the end (to get the end of the pattern)
bool ret = it.find(elementStart, elementStop, resultat, _buffer);
if (ret == true) {
_metaData.push_back(resultat);
elementStart = resultat.stop-1;
break;
}
}
// Go to the next element (and search again ...).
elementStart++;
}
} }

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__
namespace appl { namespace appl {
class Highlight; class Highlight;
@@ -16,80 +11,68 @@ namespace appl {
class HighlightInfo { class HighlightInfo {
public: public:
int32_t beginStart; int32_t start;
int32_t beginStop; int32_t stop;
int32_t endStart;
int32_t endStop;
bool notEnded; bool notEnded;
appl::HighlightPattern* patern; // pointer on class : appl::HighlightPattern* patern;
}; };
}; }
#include <ememory/memory.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <appl/HighlightPattern.h> #include <appl/HighlightPattern.h>
#include <appl/GlyphPainting.h> #include <appl/GlyphPainting.h>
#include <etk/Buffer.h>
#include <exml/exml.h> #include <exml/exml.h>
namespace appl { namespace appl {
class Highlight : public ewol::Resource { class Highlight : public gale::Resource {
private: private:
appl::GlyphPainting* m_paintingProperties; ememory::SharedPtr<appl::GlyphPainting> m_paintingProperties;
protected: public:
// Constructeur // Constructeur
Highlight(const std::string& _xmlFilename, const std::string& _colorFile); Highlight();
~Highlight(); void init(const std::string& _xmlFilename, const std::string& _colorFile = "THEME:COLOR:textViewer.json");
public:
DECLARE_RESOURCE_NAMED_FACTORY(Highlight);
virtual ~Highlight();
private: private:
std::string m_typeName; //!< descriptive string type like "C/C++" std::string m_typeName; //!< descriptive string type like "C/C++"
public: public:
/**
* @brief Get the Type of the Hightlight like c++/Bash/...
* @return descriptive string
*/
const std::string& getTypeName() { const std::string& getTypeName() {
return m_typeName; return m_typeName;
} }
public: public:
bool hasExtention(const std::string& _ext); bool isCompatible(const std::string& _name);
bool fileNameCompatible(const std::string& _fileName); bool fileNameCompatible(const std::string& _fileName);
void display(); void display();
void parse(int64_t _start, void parse(int64_t _start,
int64_t _stop, int64_t _stop,
std::vector<appl::HighlightInfo> &_metaData, std::vector<appl::HighlightInfo>& _metaData,
int64_t _addingPos, int64_t _addingPos,
etk::Buffer &_buffer); std::string& _buffer);
void parse2(int64_t _start, void parse2(int64_t _start,
int64_t _stop, int64_t _stop,
std::vector<appl::HighlightInfo> &_metaData, std::vector<appl::HighlightInfo>& _metaData,
etk::Buffer &_buffer); std::string& _buffer);
void parseSubElement(const appl::HighlightInfo& _upper,
std::vector<appl::HighlightInfo>& _metaData,
std::string &_buffer);
private: private:
void parseRules(exml::Element* _child,
std::vector<HighlightPattern*> &_mListPatern,
int32_t _level);
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer) std::vector<HighlightPattern> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) ) std::vector<HighlightPattern> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
public: std::map<std::string, std::vector<HighlightPattern>> m_listHighlightNamed; //!< list of all sub partern to parse...
/**
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured.
*/
static appl::Highlight* keep(const std::string& _filename);
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::Highlight*& _object);
public: // herited function : public: // herited function :
virtual void updateContext() { virtual bool updateContext() {
// no upfate to do ... // no upfate to do ...
return true;
}; };
}; };
}; }
#endif

View File

@@ -1,28 +1,25 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/global.h> #include <appl/global.h>
#include <appl/HighlightManager.h> #include <appl/HighlightManager.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/object/Manager.h> #include <ewol/object/Manager.h>
#undef __class__
#define __class__ "highlightManager"
static std::vector<appl::Highlight*>& s_list() { // TODO : Review this in a generic unique resource ...
static std::vector<appl::Highlight*> list;
static std::vector<ememory::SharedPtr<appl::Highlight>>& s_list() {
static std::vector<ememory::SharedPtr<appl::Highlight>> list;
return list; return list;
} }
void appl::highlightManager::init() { void appl::highlightManager::init() {
std::vector<appl::Highlight*>& hlList = s_list(); std::vector<ememory::SharedPtr<appl::Highlight>>& hlList = s_list();
if (hlList.size() != 0) { if (hlList.size() != 0) {
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ..."); APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
hlList.clear(); hlList.clear();
@@ -31,17 +28,24 @@ void appl::highlightManager::init() {
etk::FSNode myFile("DATA:languages/"); etk::FSNode myFile("DATA:languages/");
// get the subfolder list : // get the subfolder list :
std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false); std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false);
for (int32_t iii = 0; iii < list.size(); ++iii) { for (auto &it : list) {
if (list[iii] == NULL) { if (it == nullptr) {
continue; continue;
} }
if (list[iii]->getNodeType() != etk::FSN_FOLDER) { if (it->getNodeType() != etk::typeNode_folder) {
continue; continue;
} }
std::string filename = list[iii]->getName() + "/highlight.xml"; std::string filename = it->getName() + "/highlight.xml";
APPL_DEBUG("Load xml name : " << filename); APPL_DEBUG("Load xml name : " << filename);
appl::Highlight *myHightLine = appl::Highlight::keep(filename); ememory::SharedPtr<appl::Highlight> myHightLine = appl::Highlight::create(filename);
if (myHightLine != NULL) { if (myHightLine != nullptr) {
// Check if the language name already exist
for (auto &it2 : hlList) {
if ( it2 != nullptr
&& it2->getTypeName() == myHightLine->getTypeName() ) {
APPL_WARNING("LANGUAGE : replace pattern name: '" << myHightLine->getTypeName() << "' with file '" << filename << "' replace: " << it2->getName());
}
}
hlList.push_back(myHightLine); hlList.push_back(myHightLine);
} else { } else {
APPL_ERROR("Can not allocate HighLight"); APPL_ERROR("Can not allocate HighLight");
@@ -49,47 +53,40 @@ void appl::highlightManager::init() {
} }
// display : // display :
/* /*
for (int32_t iii = 0; iii < hlList.size(); ++iii) { for (auto &it : hlList) {
if (hlList[iii] == NULL) { if (it == nullptr) {
continue; continue;
} }
hlList[iii]->display(); it->display();
} }
*/ */
} }
void appl::highlightManager::unInit() { void appl::highlightManager::unInit() {
std::vector<Highlight*>& hlList = s_list(); std::vector<ememory::SharedPtr<Highlight>>& hlList = s_list();
if (hlList.size() == 0) { if (hlList.size() == 0) {
APPL_DEBUG("HighlightManager ==> no highlight"); APPL_DEBUG("HighlightManager ==> no highlight");
hlList.clear(); hlList.clear();
return; return;
} }
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
if (hlList[iii] == NULL) {
continue;
}
appl::Highlight::release(hlList[iii]);
hlList[iii] = NULL;
}
hlList.clear(); hlList.clear();
} }
std::string appl::highlightManager::getTypeExtention(const std::string& _extention) { std::string appl::highlightManager::getTypeFile(const std::string& _fileName) {
if (_extention.size() == 0) { if (_fileName.size() == 0) {
return ""; return "";
} }
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types"); APPL_DEBUG("Try to find type for extention : '" << _fileName << "' in " << s_list().size() << " types");
std::vector<Highlight*>& hlList = s_list(); std::vector<ememory::SharedPtr<Highlight>>& hlList = s_list();
for (int32_t iii = 0; iii < hlList.size(); ++iii) { for (auto &it : hlList) {
if (hlList[iii] == NULL) { if (it == nullptr) {
continue; continue;
} }
APPL_DEBUG(" check : " << hlList[iii]->getTypeName()); APPL_DEBUG(" check : " << it->getTypeName());
if (hlList[iii]->hasExtention(_extention) == true) { if (it->isCompatible(_fileName) == true) {
APPL_DEBUG("Find type for extention : " << _extention APPL_DEBUG("Find type for extention : " << _fileName
<< " type : " << hlList[iii]->getTypeName()); << " type : " << it->getTypeName());
return hlList[iii]->getTypeName(); return it->getTypeName();
} }
} }
return ""; return "";
@@ -99,13 +96,12 @@ std::string appl::highlightManager::getFileWithTypeType(const std::string& _type
if (_type.size() == 0) { if (_type.size() == 0) {
return ""; return "";
} }
std::vector<Highlight*>& hlList = s_list(); for (auto &it : s_list()) {
for (int32_t iii = 0; iii < hlList.size(); ++iii) { if (it == nullptr) {
if (hlList[iii] == NULL) {
continue; continue;
} }
if (hlList[iii]->getTypeName() == _type) { if (it->getTypeName() == _type) {
return hlList[iii]->getName(); return it->getName();
} }
} }
return ""; return "";

View File

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

View File

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

View File

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

View File

@@ -1,19 +1,12 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPlugin.h> #include <appl/TextPlugin.h>
#include <appl/TextPluginManager.h>
#include <appl/debug.h> #include <appl/debug.h>
#undef __class__
#define __class__ "TextViewerPlugin"
appl::TextViewerPlugin::TextViewerPlugin() : appl::TextViewerPlugin::TextViewerPlugin() :
m_isEnable(true), m_isEnable(true),
m_activateOnEventEntry(false), m_activateOnEventEntry(false),
@@ -21,9 +14,15 @@ appl::TextViewerPlugin::TextViewerPlugin() :
m_activateOnWrite(false), m_activateOnWrite(false),
m_activateOnReplace(false), m_activateOnReplace(false),
m_activateOnRemove(false), m_activateOnRemove(false),
m_activateOnReceiveMessage(false), m_activateOnReceiveShortCut(false),
m_activateOnCursorMove(false) { m_activateOnCursorMove(false) {
addObjectType("appl::TextViewerPlugin");
m_menuInterface = ememory::dynamicPointerCast<ewol::widget::Menu>(getObjectNamed("appl-menu-interface"));
if (m_menuInterface.expired() == true) {
APPL_ERROR("Can not acces to the Menu interface");
}
// get a reference on the plugin manager...
m_pluginManager = appl::textPluginManager::create();
} }
appl::TextViewerPlugin::~TextViewerPlugin() { appl::TextViewerPlugin::~TextViewerPlugin() {
@@ -31,7 +30,7 @@ appl::TextViewerPlugin::~TextViewerPlugin() {
return; return;
} }
m_isEnable = false; m_isEnable = false;
onPluginDisable(); onPluginGlobalDisable();
} }
void appl::TextViewerPlugin::setEnableStatus(bool _status) { void appl::TextViewerPlugin::setEnableStatus(bool _status) {
@@ -40,9 +39,9 @@ void appl::TextViewerPlugin::setEnableStatus(bool _status) {
} }
m_isEnable = _status; m_isEnable = _status;
if (m_isEnable == true) { if (m_isEnable == true) {
onPluginEnable(); onPluginGlobalEnable();
} else { } else {
onPluginDisable(); onPluginGlobalDisable();
} }
} }

View File

@@ -1,25 +1,31 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_H__
#define __APPL_TEXT_PLUGIN_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#include <ewol/compositing/Text.h> #include <ewol/compositing/Text.h>
#include <ewol/widget/Menu.h>
namespace appl { namespace appl {
class textPluginManager;
class TextViewerPlugin;
using TextViewerPluginShared = ememory::SharedPtr<TextViewerPlugin>;
using TextViewerPluginWeak = ememory::WeakPtr<TextViewerPlugin>;
class TextViewerPlugin : public ewol::Object { class TextViewerPlugin : public ewol::Object {
friend class appl::TextViewer; friend class appl::TextViewer;
public: protected:
ememory::WeakPtr<appl::textPluginManager> m_pluginManager;
protected:
TextViewerPlugin(); TextViewerPlugin();
public:
DECLARE_FACTORY(TextViewerPlugin);
virtual ~TextViewerPlugin(); virtual ~TextViewerPlugin();
protected:
ewol::widget::MenuWeak m_menuInterface;
private: private:
bool m_isEnable; //!< The plugin is enable or not (for all viewer). bool m_isEnable; //!< The plugin is enable or not (for all viewer).
public: public:
@@ -39,13 +45,13 @@ namespace appl {
/** /**
* @brief On plugin global enable. * @brief On plugin global enable.
*/ */
virtual void onPluginEnable() { virtual void onPluginGlobalEnable() {
// nothing to do here ... // nothing to do here ...
}; };
/** /**
* @brief On plugin global disable. * @brief On plugin global disable.
*/ */
virtual void onPluginDisable() { virtual void onPluginGlobalDisable() {
// nothing to do here ... // nothing to do here ...
}; };
/** /**
@@ -171,23 +177,22 @@ namespace appl {
return false; return false;
}; };
protected: protected:
bool m_activateOnReceiveMessage; //!< onReceiveMessage is availlable for this plugin. bool m_activateOnReceiveShortCut; //!< onReceiveShortCut is availlable for this plugin.
public: public:
/** /**
* @brief Get the availlability of a callback * @brief Get the availlability of a callback
* @return true if availlable * @return true if availlable
*/ */
bool isAvaillableOnReceiveMessage() { bool isAvaillableOnReceiveShortCut() {
return m_activateOnReceiveMessage; return m_activateOnReceiveShortCut;
} }
/** /**
* @brief Called when a message arrive. * @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
* @param[in] _msg Generic message. * @param[in] _shortCutName Generic message requested.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore
*/ */
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName) {
const ewol::object::Message& _msg) {
return false; return false;
} }
protected: protected:
@@ -211,7 +216,5 @@ namespace appl {
return false; return false;
} }
}; };
}; }
#endif

View File

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

View File

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

View File

@@ -1,59 +1,80 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginCopy.h> #include <appl/TextPluginCopy.h>
#include <ewol/context/clipBoard.h> #include <gale/context/clipBoard.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#undef __class__ appl::TextPluginCopy::TextPluginCopy() :
#define __class__ "TextPluginCopy" m_menuIdTitle(-1),
m_menuIdCopy(-1),
m_menuIdCut(-1),
appl::TextPluginCopy::TextPluginCopy() { m_menuIdPast(-1),
m_activateOnReceiveMessage = true; m_menuIdRemove(-1) {
m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginCopy");
} }
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event : // add event :
_textDrawer.ext_registerMultiCast(ednMsgGuiCopy); ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
_textDrawer.ext_registerMultiCast(ednMsgGuiPaste); if (menu != nullptr) {
_textDrawer.ext_registerMultiCast(ednMsgGuiCut); m_menuIdTitle = menu->addTitle("Edit");
_textDrawer.ext_shortCutAdd("ctrl+x", ednMsgGuiCut, "STD"); if (m_menuIdTitle != -1) {
_textDrawer.ext_shortCutAdd("ctrl+c", ednMsgGuiCopy, "STD"); m_menuIdCopy = menu->add(m_menuIdTitle, "Copy", "", "appl::TextPluginCopy::menu:copy");
_textDrawer.ext_shortCutAdd("ctrl+v", ednMsgGuiPaste, "STD"); m_menuIdCut = menu->add(m_menuIdTitle, "Cut", "", "appl::TextPluginCopy::menu:cut");
m_menuIdPast = menu->add(m_menuIdTitle, "Paste", "", "appl::TextPluginCopy::menu:past");
m_menuIdRemove = menu->add(m_menuIdTitle, "Remove", "", "appl::TextPluginCopy::menu:remove");
}
}
_textDrawer.ext_shortCutAdd("ctrl+x", "appl::TextPluginCopy::cut");
_textDrawer.ext_shortCutAdd("ctrl+c", "appl::TextPluginCopy::copy");
_textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
} }
void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... _textDrawer.ext_shortCutRm("appl::TextPluginCopy::cut");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::copy");
_textDrawer.ext_shortCutRm("appl::TextPluginCopy::Paste");
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRemove);
menu->remove(m_menuIdPast);
menu->remove(m_menuIdCut);
menu->remove(m_menuIdCopy);
menu->remove(m_menuIdTitle);
}
m_menuIdTitle = -1;
m_menuIdCopy = -1;
m_menuIdCut = -1;
m_menuIdPast = -1;
m_menuIdRemove = -1;
} }
bool appl::TextPluginCopy::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginCopy::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if ( _msg.getMessage() == ednMsgGuiCopy if ( _shortCutName == "appl::TextPluginCopy::copy"
|| _msg.getMessage() == ednMsgGuiCut) { || _shortCutName == "appl::TextPluginCopy::cut") {
if (_textDrawer.hasBuffer() == true) { if (_textDrawer.hasBuffer() == true) {
std::string value; std::string value;
_textDrawer.copy(value); _textDrawer.copy(value);
if (value.size() != 0) { if (value.size() != 0) {
ewol::context::clipBoard::set(ewol::context::clipBoard::clipboardStd, value); gale::context::clipBoard::set(gale::context::clipBoard::clipboardStd, value);
} }
} }
if (_msg.getMessage() == ednMsgGuiCut) { if (_shortCutName == "appl::TextPluginCopy::cut") {
_textDrawer.remove(); _textDrawer.remove();
} }
return true; return true;
} else if (_msg.getMessage() == ednMsgGuiPaste) { } else if (_shortCutName == "appl::TextPluginCopy::Paste") {
if (_textDrawer.hasBuffer() == true) { if (_textDrawer.hasBuffer() == true) {
ewol::context::clipBoard::request(ewol::context::clipBoard::clipboardStd); gale::context::clipBoard::request(gale::context::clipBoard::clipboardStd);
} }
return true; return true;
} }

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_COPY_H__
#define __APPL_TEXT_PLUGIN_COPY_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
@@ -17,17 +12,23 @@
namespace appl { namespace appl {
class TextPluginCopy : public appl::TextViewerPlugin { class TextPluginCopy : public appl::TextViewerPlugin {
public: private:
int32_t m_menuIdTitle;
int32_t m_menuIdCopy;
int32_t m_menuIdCut;
int32_t m_menuIdPast;
int32_t m_menuIdRemove;
protected:
TextPluginCopy(); TextPluginCopy();
~TextPluginCopy() { public:
DECLARE_FACTORY(TextPluginCopy);
virtual ~TextPluginCopy() {
// nothing to do ... // nothing to do ...
}; };
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
}; };
}; }
#endif

View File

@@ -1,63 +1,44 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginCtags.h> #include <appl/TextPluginCtags.h>
#include <ewol/context/clipBoard.h> #include <gale/context/clipBoard.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#include <ewol/widget/meta/FileChooser.h> #include <ewol/widget/meta/FileChooser.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/Gui/TagFileSelection.h> #include <appl/Gui/TagFileSelection.h>
#undef __class__
#define __class__ "TextPluginCtags"
appl::TextPluginCtags::TextPluginCtags() : appl::TextPluginCtags::TextPluginCtags() :
m_tagFilename(""),
m_tagFolderBase(""), m_tagFolderBase(""),
m_ctagFile(NULL) { m_tagFilename(""),
m_activateOnReceiveMessage = true; m_ctagFile(nullptr) {
m_activateOnReceiveShortCut = true;
// load buffer manager: // load buffer manager:
m_bufferManager = appl::BufferManager::keep(); m_bufferManager = appl::BufferManager::create();
} addObjectType("appl::TextPluginCtags");
appl::TextPluginCtags::~TextPluginCtags() {
appl::BufferManager::release(m_bufferManager);
} }
const char* eventJumpDestination = "event-plugin-ctags-jump-destination"; appl::TextPluginCtags::~TextPluginCtags() {
const char* eventJumpBack = "event-plugin-ctags-jump-back";
const char* eventOpenCtagsFile = "event-plugin-ctags-open"; }
const char* eventOpenCtagsOpenFileReturn = "event-plugin-ctags-open-file-return";
const char* eventOpenCtagsSelectReturn = "event-plugin-ctags-select-file-return";
void appl::TextPluginCtags::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginCtags::onPluginEnable(appl::TextViewer& _textDrawer) {
// Add local event of this object (no dependency with the viewer ...
/*
registerMultiCast(ednMsgGuiCtags);
registerMultiCast(ednMsgBufferId);
registerMultiCast(ednMsgCtagsLoadFile);
*/
// add event : // add event :
_textDrawer.ext_registerMultiCast(eventJumpDestination); _textDrawer.ext_shortCutAdd("ctrl+d", "appl::TextPluginCtags::JumpDestination");
_textDrawer.ext_registerMultiCast(eventJumpBack); _textDrawer.ext_shortCutAdd("ctrl+shift+d", "appl::TextPluginCtags::JumpBack");
_textDrawer.ext_registerMultiCast(eventOpenCtagsFile); _textDrawer.ext_shortCutAdd("ctrl+alt+d", "appl::TextPluginCtags::OpenCtagsFile");
_textDrawer.ext_shortCutAdd("ctrl+d", eventJumpDestination);
_textDrawer.ext_shortCutAdd("ctrl+shift+d", eventJumpBack);
_textDrawer.ext_shortCutAdd("ctrl+alt+d", eventOpenCtagsFile);
} }
void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginCtags::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... _textDrawer.ext_shortCutRm("appl::TextPluginCtags::JumpDestination");
_textDrawer.ext_shortCutRm("appl::TextPluginCtags::JumpBack");
_textDrawer.ext_shortCutRm("appl::TextPluginCtags::OpenCtagsFile");
} }
void appl::TextPluginCtags::jumpTo(const std::string& _name) { void appl::TextPluginCtags::jumpTo(const std::string& _name) {
if (m_ctagFile == NULL) { if (m_ctagFile == nullptr) {
APPL_WARNING("No ctags file open"); APPL_WARNING("No ctags file open");
return; return;
} }
@@ -78,8 +59,8 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) { if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
APPL_INFO("Multiple file destination ..."); APPL_INFO("Multiple file destination ...");
appl::TagFileSelection* tmpWidget = new appl::TagFileSelection(); ememory::SharedPtr<appl::TagFileSelection> tmpWidget = appl::TagFileSelection::create();
if (NULL == tmpWidget) { if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
@@ -91,7 +72,7 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID); tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess); } while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, applEventctagsSelection, eventOpenCtagsSelectReturn); tmpWidget->signalSelect.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn);
} }
} else { } else {
jumpFile(myfile.getName(), lineID - 1); jumpFile(myfile.getName(), lineID - 1);
@@ -101,19 +82,19 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _lineId) { void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _lineId) {
// save the current file in the history // save the current file in the history
// TODO : registerHistory(); // TODO : registerHistory();
if (m_bufferManager != NULL) { if (m_bufferManager != nullptr) {
m_bufferManager->open(_filename); m_bufferManager->open(_filename);
} }
sendMultiCast(appl::MsgSelectChange, _filename); //sendMultiCast(appl::MsgSelectGotoLineSelect, etk::to_string(_lineId));
sendMultiCast(appl::MsgSelectGotoLineSelect, std::to_string(_lineId)); APPL_TODO("request jup at line ...");
} }
void appl::TextPluginCtags::loadTagFile() { void appl::TextPluginCtags::loadTagFile() {
tagFileInfo info; tagFileInfo info;
// close previous tag file // close previous tag file
if (NULL != m_ctagFile) { if (nullptr != m_ctagFile) {
tagsClose(m_ctagFile); tagsClose(m_ctagFile);
m_ctagFile = NULL; m_ctagFile = nullptr;
} }
if (m_tagFilename == "") { if (m_tagFilename == "") {
return; return;
@@ -121,7 +102,7 @@ void appl::TextPluginCtags::loadTagFile() {
// load (open) the tag file : // load (open) the tag file :
APPL_INFO("try to open tag file : " << m_tagFilename); APPL_INFO("try to open tag file : " << m_tagFilename);
m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info); m_ctagFile = tagsOpen(m_tagFilename.c_str(), &info);
if (NULL != m_ctagFile) { if (nullptr != m_ctagFile) {
APPL_INFO("open exuberant Ctags file is OK ..."); APPL_INFO("open exuberant Ctags file is OK ...");
} else { } else {
APPL_INFO("Error to open ctags file ..."); APPL_INFO("Error to open ctags file ...");
@@ -138,7 +119,7 @@ void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
<< "\" at line="<< (int32_t)_entry->address.lineNumber); << "\" at line="<< (int32_t)_entry->address.lineNumber);
APPL_INFO("Extention field : "); APPL_INFO("Extention field : ");
if (_entry->kind != NULL && _entry->kind [0] != '\0') { if (_entry->kind != nullptr && _entry->kind [0] != '\0') {
APPL_INFO(" kind : " << _entry->kind); APPL_INFO(" kind : " << _entry->kind);
} }
if (_entry->fileScope) { if (_entry->fileScope) {
@@ -150,47 +131,48 @@ void appl::TextPluginCtags::printTag(const tagEntry *_entry) {
#endif #endif
} }
void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg) { void appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn(const std::string& _value) {
if (_msg.getMessage() == eventOpenCtagsOpenFileReturn) { // open the new one :
// open the new one : etk::FSNode tmpFilename = _value;
etk::FSNode tmpFilename = _msg.getData(); m_tagFilename = tmpFilename.getNameFile();
m_tagFilename = tmpFilename.getNameFile(); m_tagFolderBase = tmpFilename.getNameFolder();
m_tagFolderBase = tmpFilename.getNameFolder(); APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " "); loadTagFile();
loadTagFile();
} else if (_msg.getMessage() == eventOpenCtagsSelectReturn) {
// parse the input data
char tmp[4096];
int32_t lineID;
// TODO : Review this ...
sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp);
jumpFile(tmp, lineID - 1);
}
} }
bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { void appl::TextPluginCtags::onCallbackOpenCtagsSelectReturn(const std::string& _value) {
// parse the input data
char tmp[4096];
int32_t lineID;
// TODO : Review this ...
sscanf(_value.c_str(), "%d:%s", &lineID, tmp);
jumpFile(tmp, lineID - 1);
}
bool appl::TextPluginCtags::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == eventOpenCtagsFile) { if (_shortCutName == "appl::TextPluginCtags::OpenCtagsFile") {
APPL_INFO("Request opening ctag file"); APPL_INFO("Request opening ctag file");
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser(); ememory::SharedPtr<ewol::widget::FileChooser> tmpWidget = ewol::widget::FileChooser::create();
if (NULL == tmpWidget) { if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
return true; return true;
} }
tmpWidget->setTitle("Open Exuberant Ctags file"); tmpWidget->propertyLabelTitle.set("Open Exuberant Ctags file");
tmpWidget->setValidateLabel("Open"); tmpWidget->propertyLabelValidate.set("Open");
// try to get the current folder : // try to get the current folder :
std::string path = _textDrawer.getBufferPath(); std::string path = _textDrawer.getBufferPath();
APPL_ERROR("get path : '" << path << "'"); APPL_ERROR("get path : '" << path << "'");
if (path != "") { if (path != "") {
tmpWidget->setFolder(path); tmpWidget->propertyPath.set(path);
} }
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget); ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn); tmpWidget->signalValidate.connect(sharedFromThis(), &appl::TextPluginCtags::onCallbackOpenCtagsOpenFileReturn);
return true; return true;
} else if (_msg.getMessage() == eventJumpDestination) { } else if (_shortCutName == "appl::TextPluginCtags::JumpDestination") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }
@@ -208,7 +190,7 @@ bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer,
} }
jumpTo(textToSearch); jumpTo(textToSearch);
return true; return true;
} else if (_msg.getMessage() == eventJumpBack) { } else if (_shortCutName == "appl::TextPluginCtags::JumpBack") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_CTAGS_H__
#define __APPL_TEXT_PLUGIN_CTAGS_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
@@ -33,19 +28,20 @@ namespace appl {
void printTag(const tagEntry *_entry); void printTag(const tagEntry *_entry);
void jumpTo(const std::string& _name); void jumpTo(const std::string& _name);
void jumpFile(const std::string& _filename, int64_t _lineId); void jumpFile(const std::string& _filename, int64_t _lineId);
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager ememory::SharedPtr<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
public: protected:
TextPluginCtags(); TextPluginCtags();
~TextPluginCtags(); public:
DECLARE_FACTORY(TextPluginCtags);
virtual ~TextPluginCtags();
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg); const std::string& _shortCutName);
// internal message : // callback function:
virtual void onReceiveMessage(const ewol::object::Message& _msg); void onCallbackOpenCtagsOpenFileReturn(const std::string& _value);
void onCallbackOpenCtagsSelectReturn(const std::string& _value);
}; };
}; }
#endif

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_DATA_H__
#define __APPL_TEXT_PLUGIN_DATA_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
@@ -17,109 +12,111 @@
namespace appl { namespace appl {
template <typename TYPE> class TextViewerPluginData : public appl::TextViewerPlugin { template <typename TYPE> class TextViewerPluginData : public appl::TextViewerPlugin {
public: protected:
TextViewerPluginData() { TextViewerPluginData() {
// nothing to do ... // nothing to do ...
addObjectType("appl::TextViewerPluginData");
} }
public:
DECLARE_FACTORY(TextViewerPluginData);
virtual ~TextViewerPluginData() { virtual ~TextViewerPluginData() {
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) { for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
if (m_specificData[iii].second != NULL) { if (m_specificData[iii].second != nullptr) {
remove(*m_specificData[iii].second); remove(*m_specificData[iii].second);
delete(m_specificData[iii].second);
m_specificData[iii].second = NULL;
} }
} }
m_specificData.clear(); m_specificData.clear();
} }
private: private:
std::vector<std::pair<appl::Buffer* ,TYPE* >> m_specificData; std::vector<std::pair<ememory::WeakPtr<appl::Buffer> ,std::unique_ptr<TYPE>>> m_specificData;
protected: protected:
TYPE* getDataRef(appl::TextViewer& _textDrawer) { TYPE* getDataRef(appl::TextViewer& _textDrawer) {
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) { auto it = m_specificData.begin();
if (m_specificData[iii].first == _textDrawer.internalGetBuffer()) { while(it != m_specificData.end()) {
return m_specificData[iii].second; ememory::SharedPtr<appl::Buffer> buf = it->first.lock();
if (buf == nullptr) {
it = m_specificData.erase(it);
continue;
} }
if (buf == _textDrawer.internalGetBuffer()) {
return it->second.get();
}
++it;
} }
TYPE* data = new TYPE(); std::unique_ptr<TYPE> data(new TYPE());
if (data == NULL) { if (data == nullptr) {
return NULL; return nullptr;
} }
m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), data)); m_specificData.push_back(std::make_pair(_textDrawer.internalGetBuffer(), std::move(data)));
// create a new one ... // create a new one ...
return data; return data.get();
} }
protected: // Wrap all element with their internal data: (do not use theses function) protected: // Wrap all element with their internal data: (do not use theses function)
bool onReceiveMessage(appl::TextViewer& _textDrawer, bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
TYPE* data = getDataRef(_textDrawer); TYPE* data = getDataRef(_textDrawer);
if (data == NULL) { if (data == nullptr) {
return false; return false;
} }
return onReceiveMessage(_textDrawer, _msg, *data); return onDataReceiveShortCut(_textDrawer, _shortCutName, *data);
} }
bool onWrite(appl::TextViewer& _textDrawer, bool onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _data) { const std::string& _data) {
TYPE* data = getDataRef(_textDrawer); TYPE* data = getDataRef(_textDrawer);
if (data == NULL) { if (data == nullptr) {
return false; return false;
} }
return onWrite(_textDrawer, _pos, _data, *data); return onDataWrite(_textDrawer, _pos, _data, *data);
} }
bool onReplace(appl::TextViewer& _textDrawer, bool onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _data, const std::string& _data,
const appl::Buffer::Iterator& _posEnd) { const appl::Buffer::Iterator& _posEnd) {
TYPE* data = getDataRef(_textDrawer); TYPE* data = getDataRef(_textDrawer);
if (data == NULL) { if (data == nullptr) {
return false; return false;
} }
return onReplace(_textDrawer, _pos, _data, _posEnd, *data); return onDataReplace(_textDrawer, _pos, _data, _posEnd, *data);
} }
bool onRemove(appl::TextViewer& _textDrawer, bool onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd) { const appl::Buffer::Iterator& _posEnd) {
TYPE* data = getDataRef(_textDrawer); TYPE* data = getDataRef(_textDrawer);
if (data == NULL) { if (data == nullptr) {
return false; return false;
} }
return onRemove(_textDrawer, _pos, _posEnd, *data); return onDataRemove(_textDrawer, _pos, _posEnd, *data);
} }
public: public:
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const std::string& _shortCutName,
TYPE& _data) { TYPE& _data) {
return false; return false;
} }
virtual bool onWrite(appl::TextViewer& _textDrawer, virtual bool onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,
TYPE& _data) { TYPE& _data) {
return false; return false;
} }
virtual bool onReplace(appl::TextViewer& _textDrawer, virtual bool onDataReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,
const appl::Buffer::Iterator& _posEnd, const appl::Buffer::Iterator& _posEnd,
TYPE& _data) { TYPE& _data) {
return false; return false;
} }
virtual bool onRemove(appl::TextViewer& _textDrawer, virtual bool onDataRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd, const appl::Buffer::Iterator& _posEnd,
TYPE& _data) { TYPE& _data) {
return false; return false;
} }
virtual void remove(TYPE& _data) { virtual void remove(TYPE& _data) {
return; return;
}; };
public:
virtual void onObjectRemove(ewol::Object* _removeObject) {
// TODO : plop
};
}; };
}; }
#endif

View File

@@ -1,50 +1,63 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginHistory.h> #include <appl/TextPluginHistory.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#include <appl/TextPluginManager.h> #include <appl/TextPluginManager.h>
#undef __class__ appl::TextPluginHistory::TextPluginHistory() :
#define __class__ "TextPluginHistory" m_menuIdTitle(-1),
m_menuIdUndo(-1),
appl::TextPluginHistory::TextPluginHistory() { m_menuIdRedo(-1) {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
m_activateOnWrite = true; m_activateOnWrite = true;
m_activateOnReplace = true; m_activateOnReplace = true;
m_activateOnRemove = true; m_activateOnRemove = true;
addObjectType("appl::TextPluginHistory");
} }
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
m_menuIdUndo = menu->add(m_menuIdTitle, "Undo", "THEME:GUI:Undo.edf", "appl::TextPluginHistory::menu:undo");
m_menuIdRedo = menu->add(m_menuIdTitle, "Redo", "THEME:GUI:Redo.edf", "appl::TextPluginHistory::menu:redo");
}
}
// add event : // add event :
_textDrawer.ext_registerMultiCast(ednMsgGuiRedo); _textDrawer.ext_shortCutAdd("ctrl+z", "appl::TextPluginHistory::Undo");
_textDrawer.ext_registerMultiCast(ednMsgGuiUndo); _textDrawer.ext_shortCutAdd("ctrl+shift+z", "appl::TextPluginHistory::Redo");
_textDrawer.ext_shortCutAdd("ctrl+z", ednMsgGuiUndo);
_textDrawer.ext_shortCutAdd("ctrl+shift+z", ednMsgGuiRedo);
} }
void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... _textDrawer.ext_shortCutRm("appl::TextPluginHistory::Undo");
_textDrawer.ext_shortCutRm("appl::TextPluginHistory::Redo");
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdRedo);
menu->remove(m_menuIdUndo);
menu->remove(m_menuIdTitle);
}
m_menuIdTitle = -1;
m_menuIdUndo = -1;
m_menuIdRedo = -1;
} }
bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const std::string& _shortCutName,
appl::PluginHistoryData& _data) { appl::PluginHistoryData& _data) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == ednMsgGuiRedo) { if (_shortCutName == "appl::TextPluginHistory::Redo") {
if (_data.m_redo.size() == 0) { if (_data.m_redo.size() == 0) {
return true; return true;
} }
if (_data.m_redo[_data.m_redo.size()-1] == NULL) { if (_data.m_redo[_data.m_redo.size()-1] == nullptr) {
_data.m_redo.pop_back(); _data.m_redo.pop_back();
return true; return true;
} }
@@ -56,11 +69,11 @@ bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer,
_textDrawer.position(tmpElement->m_endPosRemoved) ); _textDrawer.position(tmpElement->m_endPosRemoved) );
return true; return true;
} else if (_msg.getMessage() == ednMsgGuiUndo) { } else if (_shortCutName == "appl::TextPluginHistory::Undo") {
if (_data.m_undo.size() == 0) { if (_data.m_undo.size() == 0) {
return true; return true;
} }
if (_data.m_undo[_data.m_undo.size()-1] == NULL) { if (_data.m_undo[_data.m_undo.size()-1] == nullptr) {
_data.m_undo.pop_back(); _data.m_undo.pop_back();
return true; return true;
} }
@@ -81,11 +94,11 @@ void appl::TextPluginHistory::clearRedo(appl::PluginHistoryData& _data) {
return; return;
} }
for (size_t iii=0; iii<_data.m_redo.size(); ++iii) { for (size_t iii=0; iii<_data.m_redo.size(); ++iii) {
if (_data.m_redo[iii] == NULL) { if (_data.m_redo[iii] == nullptr) {
continue; continue;
} }
delete(_data.m_redo[iii]); delete(_data.m_redo[iii]);
_data.m_redo[iii] = NULL; _data.m_redo[iii] = nullptr;
} }
_data.m_redo.clear(); _data.m_redo.clear();
} }
@@ -95,73 +108,79 @@ void appl::TextPluginHistory::clearUndo(appl::PluginHistoryData& _data) {
return; return;
} }
for (size_t iii=0; iii<_data.m_undo.size(); ++iii) { for (size_t iii=0; iii<_data.m_undo.size(); ++iii) {
if (_data.m_undo[iii] == NULL) { if (_data.m_undo[iii] == nullptr) {
continue; continue;
} }
delete(_data.m_undo[iii]); delete(_data.m_undo[iii]);
_data.m_undo[iii] = NULL; _data.m_undo[iii] = nullptr;
} }
_data.m_undo.clear(); _data.m_undo.clear();
} }
bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,
appl::PluginHistoryData& _data) { appl::PluginHistoryData& _data) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
appl::History *tmpElement = new appl::History(); appl::History *tmpElement = new appl::History();
if (tmpElement != NULL) { if (tmpElement != nullptr) {
tmpElement->m_addedText = _strData; tmpElement->m_addedText = _strData;
tmpElement->m_posAdded = (int64_t)_pos; tmpElement->m_posAdded = (int64_t)_pos;
tmpElement->m_endPosRemoved = (int64_t)_pos; tmpElement->m_endPosRemoved = (int64_t)_pos;
} }
_textDrawer.writeDirect(_strData, _pos); _textDrawer.writeDirect(_strData, _pos);
if (tmpElement != NULL) { if (tmpElement != nullptr) {
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor(); tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
clearRedo(_data); clearRedo(_data);
_data.m_undo.push_back(tmpElement); _data.m_undo.push_back(tmpElement);
} }
appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.cursor()); ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
return true; return true;
} }
bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onDataReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,
const appl::Buffer::Iterator& _posEnd, const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data) { appl::PluginHistoryData& _data) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
appl::History *tmpElement = new appl::History(); appl::History *tmpElement = new appl::History();
if (tmpElement != NULL) { if (tmpElement != nullptr) {
tmpElement->m_posAdded = (int64_t)_pos; tmpElement->m_posAdded = (int64_t)_pos;
tmpElement->m_addedText = _strData; tmpElement->m_addedText = _strData;
tmpElement->m_endPosRemoved = (int64_t)_posEnd; tmpElement->m_endPosRemoved = (int64_t)_posEnd;
_textDrawer.copy(tmpElement->m_removedText, _pos, _posEnd); _textDrawer.copy(tmpElement->m_removedText, _pos, _posEnd);
} }
_textDrawer.replaceDirect(_strData, _pos, _posEnd); _textDrawer.replaceDirect(_strData, _pos, _posEnd);
if (tmpElement != NULL) { if (tmpElement != nullptr) {
tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor(); tmpElement->m_endPosAdded = (int64_t)_textDrawer.cursor();
clearRedo(_data); clearRedo(_data);
_data.m_undo.push_back(tmpElement); _data.m_undo.push_back(tmpElement);
} }
appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.cursor()); ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
return true; return true;
} }
bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onDataRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd, const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data) { appl::PluginHistoryData& _data) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
appl::History *tmpElement = new appl::History(); appl::History *tmpElement = new appl::History();
if (tmpElement != NULL) { if (tmpElement != nullptr) {
tmpElement->m_addedText = ""; tmpElement->m_addedText = "";
tmpElement->m_posAdded = (int64_t)_pos; tmpElement->m_posAdded = (int64_t)_pos;
tmpElement->m_endPosAdded = tmpElement->m_posAdded; tmpElement->m_endPosAdded = tmpElement->m_posAdded;
@@ -171,14 +190,11 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
_data.m_undo.push_back(tmpElement); _data.m_undo.push_back(tmpElement);
} }
_textDrawer.removeDirect(); _textDrawer.removeDirect();
appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.cursor()); ememory::SharedPtr<appl::textPluginManager> mng = m_pluginManager.lock();
if (mng!=nullptr) {
mng->onCursorMove(_textDrawer, _textDrawer.cursor());
}
return true; return true;
} }
void appl::TextPluginHistory::onObjectRemove(ewol::Object* _removeObject) {
// TODO : Dependence with buffer removing ...
}

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_HISTORY_H__
#define __APPL_TEXT_PLUGIN_HISTORY_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
@@ -36,29 +31,35 @@ namespace appl {
std::vector<History*> m_redo; //!< History storing data std::vector<History*> m_redo; //!< History storing data
}; };
class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> { class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> {
public: private:
int32_t m_menuIdTitle;
int32_t m_menuIdUndo;
int32_t m_menuIdRedo;
protected:
TextPluginHistory(); TextPluginHistory();
public:
DECLARE_FACTORY(TextPluginHistory);
virtual ~TextPluginHistory() { }; virtual ~TextPluginHistory() { };
private: private:
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, virtual bool onDataReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg, const std::string& _shortCutName,
appl::PluginHistoryData& _data); appl::PluginHistoryData& _data);
virtual bool onWrite(appl::TextViewer& _textDrawer, virtual bool onDataWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,
appl::PluginHistoryData& _data); appl::PluginHistoryData& _data);
virtual bool onReplace(appl::TextViewer& _textDrawer, virtual bool onDataReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _strData, const std::string& _strData,
const appl::Buffer::Iterator& _posEnd, const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data); appl::PluginHistoryData& _data);
virtual bool onRemove(appl::TextViewer& _textDrawer, virtual bool onDataRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd, const appl::Buffer::Iterator& _posEnd,
appl::PluginHistoryData& _data); appl::PluginHistoryData& _data);
virtual void remove(appl::PluginHistoryData& _data) { virtual void remove(appl::PluginHistoryData& _data) {
clearRedo(_data); clearRedo(_data);
clearUndo(_data); clearUndo(_data);
@@ -66,10 +67,6 @@ namespace appl {
private: private:
void clearRedo(appl::PluginHistoryData& _data); void clearRedo(appl::PluginHistoryData& _data);
void clearUndo(appl::PluginHistoryData& _data); void clearUndo(appl::PluginHistoryData& _data);
public:
virtual void onObjectRemove(ewol::Object* _removeObject);
}; };
}; }
#endif

View File

@@ -1,11 +1,8 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginManager.h> #include <appl/TextPluginManager.h>
#include <appl/debug.h> #include <appl/debug.h>
#include <appl/TextPluginCopy.h> #include <appl/TextPluginCopy.h>
@@ -16,130 +13,83 @@
#include <appl/TextPluginSelectAll.h> #include <appl/TextPluginSelectAll.h>
#include <appl/TextPluginCtags.h> #include <appl/TextPluginCtags.h>
#undef __class__ appl::textPluginManager::textPluginManager() {
#define __class__ "textPluginManager"
static std::vector<appl::TextViewerPlugin *>& getList() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnEventEntry() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnEventInput() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnWrite() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnReplace() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnRemove() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnReceiveMessage() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
static std::vector<appl::TextViewerPlugin *>& getListOnCursorMove() {
static std::vector<appl::TextViewerPlugin *> s_list;
return s_list;
}
void appl::textPluginManager::init() {
} }
void appl::textPluginManager::init(const std::string& _name) {
void appl::textPluginManager::unInit() { gale::Resource::init(_name);
// remove all sub plugin class:
getListOnEventEntry().clear();
getListOnEventInput().clear();
getListOnWrite().clear();
getListOnReplace().clear();
getListOnRemove().clear();
getListOnReceiveMessage().clear();
getListOnCursorMove().clear();
// remove all plugin:
for (int32_t iii=0; iii<getList().size(); ++iii) {
if (getList()[iii] == NULL) {
continue;
}
delete(getList()[iii]);
getList()[iii] = NULL;
}
getList().clear();
} }
void appl::textPluginManager::addDefaultPlugin() { void appl::textPluginManager::addDefaultPlugin() {
appl::textPluginManager::addPlugin(new appl::TextPluginCopy()); appl::textPluginManager::addPlugin(appl::TextPluginCopy::create());
appl::textPluginManager::addPlugin(new appl::TextPluginMultiLineTab()); appl::textPluginManager::addPlugin(appl::TextPluginMultiLineTab::create());
appl::textPluginManager::addPlugin(new appl::TextPluginAutoIndent()); appl::textPluginManager::addPlugin(appl::TextPluginAutoIndent::create());
appl::textPluginManager::addPlugin(new appl::TextPluginHistory()); appl::textPluginManager::addPlugin(appl::TextPluginHistory::create());
appl::textPluginManager::addPlugin(new appl::TextPluginRmLine()); appl::textPluginManager::addPlugin(appl::TextPluginRmLine::create());
appl::textPluginManager::addPlugin(new appl::TextPluginSelectAll()); appl::textPluginManager::addPlugin(appl::TextPluginSelectAll::create());
appl::textPluginManager::addPlugin(new appl::TextPluginCtags()); appl::textPluginManager::addPlugin(appl::TextPluginCtags::create());
} }
void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) { void appl::textPluginManager::addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin) {
if (_plugin == NULL) { if (_plugin == nullptr) {
return; return;
} }
getList().push_back(_plugin); APPL_DEBUG("Add plugin : " << _plugin->getObjectType());
m_list.push_back(_plugin);
if (_plugin->isAvaillableOnEventEntry() == true) { if (_plugin->isAvaillableOnEventEntry() == true) {
getListOnEventEntry().push_back(_plugin); m_listOnEventEntry.push_back(_plugin);
} }
if (_plugin->isAvaillableOnEventInput() == true) { if (_plugin->isAvaillableOnEventInput() == true) {
getListOnEventInput().push_back(_plugin); m_listOnEventInput.push_back(_plugin);
} }
if (_plugin->isAvaillableOnWrite() == true) { if (_plugin->isAvaillableOnWrite() == true) {
getListOnWrite().push_back(_plugin); m_listOnWrite.push_back(_plugin);
} }
if (_plugin->isAvaillableOnReplace() == true) { if (_plugin->isAvaillableOnReplace() == true) {
getListOnReplace().push_back(_plugin); m_listOnReplace.push_back(_plugin);
} }
if (_plugin->isAvaillableOnRemove() == true) { if (_plugin->isAvaillableOnRemove() == true) {
getListOnRemove().push_back(_plugin); m_listOnRemove.push_back(_plugin);
} }
if (_plugin->isAvaillableOnReceiveMessage() == true) { if (_plugin->isAvaillableOnReceiveShortCut() == true) {
getListOnReceiveMessage().push_back(_plugin); m_listOnReceiveShortCutViewer.push_back(_plugin);
} }
if (_plugin->isAvaillableOnCursorMove() == true) { if (_plugin->isAvaillableOnCursorMove() == true) {
getListOnCursorMove().push_back(_plugin); m_listOnCursorMove.push_back(_plugin);
}
ememory::SharedPtr<appl::TextViewer> viewer = m_currentViewer.lock();
if (viewer != nullptr) {
_plugin->onPluginEnable(*viewer);
} }
} }
void appl::textPluginManager::connect(appl::TextViewer& _widget) { void appl::textPluginManager::connect(appl::TextViewer& _widget) {
for (int32_t iii=0; iii<getList().size(); ++iii) { m_currentViewer = ememory::dynamicPointerCast<appl::TextViewer>(_widget.sharedFromThis());
if (getList()[iii] == NULL) { for (auto &it : m_list) {
if (it == nullptr) {
continue; continue;
} }
getList()[iii]->onPluginEnable(_widget); it->onPluginEnable(_widget);
} }
} }
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) { void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
for (int32_t iii=0; iii<getList().size(); ++iii) { m_currentViewer.reset();
if (getList()[iii] == NULL) { for (auto &it : m_list) {
if (it == nullptr) {
continue; continue;
} }
getList()[iii]->onPluginDisable(_widget); it->onPluginDisable(_widget);
} }
} }
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event) { const ewol::event::Entry& _event) {
std::vector<appl::TextViewerPlugin *>& list = getListOnEventEntry(); for (auto &it : m_listOnEventEntry) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onEventEntry(_textDrawer, _event) == true ) { if (it->onEventEntry(_textDrawer, _event) == true ) {
return true; return true;
} }
} }
@@ -148,12 +98,11 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
const ewol::event::Input& _event) { const ewol::event::Input& _event) {
std::vector<appl::TextViewerPlugin *>& list = getListOnEventInput(); for (auto &it : m_listOnEventInput) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onEventInput(_textDrawer, _event) == true ) { if (it->onEventInput(_textDrawer, _event) == true ) {
return true; return true;
} }
} }
@@ -163,12 +112,11 @@ bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _data) { const std::string& _data) {
std::vector<appl::TextViewerPlugin *>& list = getListOnWrite(); for (auto &it : m_listOnWrite) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onWrite(_textDrawer, _pos, _data) == true ) { if (it->onWrite(_textDrawer, _pos, _data) == true ) {
return true; return true;
} }
} }
@@ -179,12 +127,11 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const std::string& _data, const std::string& _data,
const appl::Buffer::Iterator& _posEnd) { const appl::Buffer::Iterator& _posEnd) {
std::vector<appl::TextViewerPlugin *>& list = getListOnReplace(); for (auto &it : m_listOnReplace) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) { if (it->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
return true; return true;
} }
} }
@@ -194,26 +141,24 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _pos,
const appl::Buffer::Iterator& _posEnd) { const appl::Buffer::Iterator& _posEnd) {
std::vector<appl::TextViewerPlugin *>& list = getListOnRemove(); for (auto &it : m_listOnRemove) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onRemove(_textDrawer, _pos, _posEnd) == true ) { if (it->onRemove(_textDrawer, _pos, _posEnd) == true ) {
return true; return true;
} }
} }
return false; return false;
} }
bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
std::vector<appl::TextViewerPlugin *>& list = getListOnReceiveMessage(); for (auto &it : m_listOnReceiveShortCutViewer) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onReceiveMessage(_textDrawer, _msg) == true ) { if (it->onReceiveShortCut(_textDrawer, _shortCutName) == true ) {
return true; return true;
} }
} }
@@ -222,12 +167,11 @@ bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer, bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos) { const appl::Buffer::Iterator& _pos) {
std::vector<appl::TextViewerPlugin *>& list = getListOnCursorMove(); for (auto &it : m_listOnCursorMove) {
for (int32_t iii=0; iii<list.size(); ++iii) { if (it == nullptr) {
if (list[iii] == NULL) {
continue; continue;
} }
if (list[iii]->onCursorMove(_textDrawer, _pos) == true ) { if (it->onCursorMove(_textDrawer, _pos) == true ) {
return true; return true;
} }
} }

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_MANAGER_H__
#define __APPL_TEXT_PLUGIN_MANAGER_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
@@ -16,100 +11,106 @@
#include <appl/TextPlugin.h> #include <appl/TextPlugin.h>
namespace appl { namespace appl {
namespace textPluginManager { class textPluginManager : public gale::Resource {
/** private:
* @brief Init the plugin manager for writer. ememory::WeakPtr<appl::TextViewer> m_currentViewer;
*/ std::list<ememory::SharedPtr<appl::TextViewerPlugin>> m_list;
void init(); std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventEntry;
/** std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnEventInput;
* @brief UnInit the plugin manager for writer. std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnWrite;
*/ std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReplace;
void unInit(); std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnRemove;
/** std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnReceiveShortCutViewer;
* @brief Add default plugin list std::vector<ememory::SharedPtr<appl::TextViewerPlugin>> m_listOnCursorMove;
*/ protected:
void addDefaultPlugin(); textPluginManager();
/** void init(const std::string& _name);
* @brief Add a plugin. public:
* @param[in] _plugin Plugin pointer to add. DECLARE_RESOURCE_SINGLE_FACTORY(textPluginManager, "plugin-Manager");
*/ virtual ~textPluginManager() {};
void addPlugin(appl::TextViewerPlugin* _plugin); /**
/** * @brief Add default plugin list
* @brief connect a new widget to the plugin. */
* @param[in] _widget Reference on the widget caller. void addDefaultPlugin();
*/ /**
void connect(appl::TextViewer& _widget); * @brief Add a plugin.
/** * @param[in] _plugin Plugin pointer to add.
* @brief dis-connect a new widget to the plugin. */
* @param[in] _widget Reference on the widget caller. void addPlugin(ememory::SharedPtr<appl::TextViewerPlugin> _plugin);
*/ /**
void disconnect(appl::TextViewer& _widget); * @brief connect a new widget to the plugin.
/** * @param[in] _widget Reference on the widget caller.
* @brief On entry event call. */
* @param[in] _widget Reference on the widget caller. void connect(appl::TextViewer& _widget);
* @param[in] _event Generic event. /**
* @return true if the event might not propagate anymore. * @brief dis-connect a new widget to the plugin.
*/ * @param[in] _widget Reference on the widget caller.
bool onEventEntry(appl::TextViewer& _widget, */
const ewol::event::Entry& _event); void disconnect(appl::TextViewer& _widget);
/** /**
* @brief On Input event call. * @brief On entry event call.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
* @param[in] _event Generic event. * @param[in] _event Generic event.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore.
*/ */
bool onEventInput(appl::TextViewer& _textDrawer, bool onEventEntry(appl::TextViewer& _widget,
const ewol::event::Input& _event); const ewol::event::Entry& _event);
/** /**
* @brief Called when data is written in the buffer. * @brief On Input event call.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
* @param[in] _pos Position in the buffer where data might be witten. * @param[in] _event Generic event.
* @param[in] _data Input stream written. * @return true if the event might not propagate anymore
* @return true if the event might not propagate anymore */
*/ bool onEventInput(appl::TextViewer& _textDrawer,
bool onWrite(appl::TextViewer& _textDrawer, const ewol::event::Input& _event);
const appl::Buffer::Iterator& _pos, /**
const std::string& _data); * @brief Called when data is written in the buffer.
/** * @param[in] _widget Reference on the widget caller.
* @brief Called when data is written in the buffer, and some are removed. * @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _widget Reference on the widget caller. * @param[in] _data Input stream written.
* @param[in] _pos Position in the buffer where data might be witten. * @return true if the event might not propagate anymore
* @param[in] _data Input stream written. */
* @param[in] _posEnd end replace position. bool onWrite(appl::TextViewer& _textDrawer,
* @return true if the event might not propagate anymore const appl::Buffer::Iterator& _pos,
*/ const std::string& _data);
bool onReplace(appl::TextViewer& _textDrawer, /**
const appl::Buffer::Iterator& _pos, * @brief Called when data is written in the buffer, and some are removed.
const std::string& _data, * @param[in] _widget Reference on the widget caller.
const appl::Buffer::Iterator& _posEnd); * @param[in] _pos Position in the buffer where data might be witten.
/** * @param[in] _data Input stream written.
* @brief Called when data is removed. * @param[in] _posEnd end replace position.
* @param[in] _widget Reference on the widget caller. * @return true if the event might not propagate anymore
* @param[in] _pos Position in the buffer where data might be witten. */
* @param[in] _posEnd end replace position. bool onReplace(appl::TextViewer& _textDrawer,
* @return true if the event might not propagate anymore const appl::Buffer::Iterator& _pos,
*/ const std::string& _data,
bool onRemove(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _posEnd);
const appl::Buffer::Iterator& _pos, /**
const appl::Buffer::Iterator& _posEnd); * @brief Called when data is removed.
/** * @param[in] _widget Reference on the widget caller.
* @brief Called when a message arrive. * @param[in] _pos Position in the buffer where data might be witten.
* @param[in] _widget Reference on the widget caller. * @param[in] _posEnd end replace position.
* @param[in] _msg Generic message. * @return true if the event might not propagate anymore
* @return true if the event might not propagate anymore */
*/ bool onRemove(appl::TextViewer& _textDrawer,
bool onReceiveMessage(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos,
const ewol::object::Message& _msg); const appl::Buffer::Iterator& _posEnd);
/** /**
* @brief Called when Cursor move of position. * @brief Called when a message arrive.
* @param[in] _widget Reference on the widget caller. * @param[in] _widget Reference on the widget caller.
* @param[in] _pos New cursor position. * @param[in] _shortCutName shortcut properties.
* @return true if the event might not propagate anymore * @return true if the event might not propagate anymore
*/ */
bool onCursorMove(appl::TextViewer& _textDrawer, bool onReceiveShortCut(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos); const std::string& _shortCutName);
/**
* @brief Called when Cursor move of position.
* @param[in] _widget Reference on the widget caller.
* @param[in] _pos New cursor position.
* @return true if the event might not propagate anymore
*/
bool onCursorMove(appl::TextViewer& _textDrawer,
const appl::Buffer::Iterator& _pos);
}; };
}; }
#endif

View File

@@ -1,33 +1,27 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginMultiLineTab.h> #include <appl/TextPluginMultiLineTab.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginMultiLineTab"
appl::TextPluginMultiLineTab::TextPluginMultiLineTab() { appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
m_activateOnEventEntry = true; m_activateOnEventEntry = true;
addObjectType("appl::TextPluginMultiLineTab");
} }
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer, bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
const ewol::event::Entry& _event) { const ewol::event::Entry& _event) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_event.getType() != ewol::key::keyboardChar) { if (_event.getType() != gale::key::keyboard::character) {
return false; return false;
} }
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent); //APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (_event.getStatus() != ewol::key::statusDown) { if (_event.getStatus() != gale::key::status::down) {
return false; return false;
} }
char32_t localValue = _event.getChar(); char32_t localValue = _event.getChar();
@@ -47,22 +41,22 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
_textDrawer.copy(data, itStart, itStop); _textDrawer.copy(data, itStart, itStop);
// TODO : Change this ... // TODO : Change this ...
bool m_useTabs = true; bool m_useTabs = true;
int32_t m_tabDist = 4; size_t m_tabDist = 4;
if (true == _event.getSpecialKey().getShift() ) { if (true == _event.getSpecialKey().getShift() ) {
// un-indent // un-indent
data.insert(0, 1, u32char::Return); data.insert(0, 1, u32char::Return);
for (int32_t iii=1; iii<data.size(); ++iii) { for (size_t iii=1; iii<data.size(); ++iii) {
if (data[iii-1] != u32char::Return) { if ((char32_t)data[iii-1] != u32char::Return) {
continue; continue;
} }
if(data[iii] == u32char::Tabulation) { if((char32_t)data[iii] == u32char::Tabulation) {
data.erase(iii, 1); data.erase(iii, 1);
} else if(data[iii] == u32char::Space) { } else if((char32_t)data[iii] == u32char::Space) {
for (int32_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) { for (size_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
if(data[iii] == u32char::Space) { if((char32_t)data[iii] == u32char::Space) {
data.erase(iii, 1); data.erase(iii, 1);
} else if(data[iii] == u32char::Tabulation) { } else if((char32_t)data[iii] == u32char::Tabulation) {
data.erase(iii, 1); data.erase(iii, 1);
break; break;
} else { } else {
@@ -75,8 +69,8 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
} else { } else {
// indent // indent
data.insert(0, 1, u32char::Return); data.insert(0, 1, u32char::Return);
for (int32_t iii=1; iii<data.size(); iii++) { for (size_t iii=1; iii<data.size(); iii++) {
if (data[iii-1] != u32char::Return) { if ((char32_t)data[iii-1] != u32char::Return) {
continue; continue;
} }
if (true == _event.getSpecialKey().getCtrl() ) { if (true == _event.getSpecialKey().getCtrl() ) {
@@ -93,4 +87,4 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
_textDrawer.replace(data, itStart, itStop); _textDrawer.replace(data, itStart, itStop);
_textDrawer.select(itStart, itStart+data.size()); _textDrawer.select(itStart, itStart+data.size());
return true; return true;
} }

View File

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

View File

@@ -1,40 +1,32 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginRmLine.h> #include <appl/TextPluginRmLine.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#undef __class__
#define __class__ "TextPluginRmLine"
appl::TextPluginRmLine::TextPluginRmLine() { appl::TextPluginRmLine::TextPluginRmLine() {
m_activateOnReceiveMessage = true; m_activateOnReceiveShortCut = true;
addObjectType("appl::TextPluginRmLine");
} }
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
// add event : // add event :
_textDrawer.ext_registerMultiCast(ednMsgGuiRm); _textDrawer.ext_shortCutAdd("ctrl+w", "appl::TextPluginRmLine::Rm");
_textDrawer.ext_shortCutAdd("ctrl+w", ednMsgGuiRm);
} }
void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... _textDrawer.ext_shortCutRm("appl::TextPluginRmLine::Rm");
} }
bool appl::TextPluginRmLine::onReceiveMessage(appl::TextViewer& _textDrawer, bool appl::TextPluginRmLine::onReceiveShortCut(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == ednMsgGuiRm) { if (_shortCutName == "appl::TextPluginRmLine::Rm") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }

View File

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

View File

@@ -1,47 +1,67 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/TextPluginSelectAll.h> #include <appl/TextPluginSelectAll.h>
#include <ewol/context/clipBoard.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
#undef __class__ appl::TextPluginSelectAll::TextPluginSelectAll() :
#define __class__ "TextPluginSelectAll" m_menuIdTitle(-1),
m_menuIdSelectAll(-1),
m_menuIdSelectNone(-1) {
appl::TextPluginSelectAll::TextPluginSelectAll() { m_activateOnReceiveShortCut = true;
m_activateOnReceiveMessage = true; addObjectType("appl::TextPluginSelectAll");
} }
static const char* eventSelectAll = "plugin-select-all";
void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) { void appl::TextPluginSelectAll::onPluginEnable(appl::TextViewer& _textDrawer) {
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
m_menuIdSelectAll = menu->add(m_menuIdTitle, "Select All","", "appl::TextPluginSelectAll::menu:select-all");
m_menuIdSelectNone = menu->add(m_menuIdTitle, "Un-Select","", "appl::TextPluginSelectAll::menu:select-none");
}
}
// add event : // add event :
_textDrawer.ext_registerMultiCast(eventSelectAll); _textDrawer.ext_shortCutAdd("ctrl+a", "appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutAdd("ctrl+a", eventSelectAll); _textDrawer.ext_shortCutAdd("ctrl+shift+a", "appl::TextPluginSelectAll::None");
} }
void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) { void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
// TODO : unknow function ... _textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::All");
_textDrawer.ext_shortCutRm("appl::TextPluginSelectAll::None");
ememory::SharedPtr<ewol::widget::Menu> menu = m_menuInterface.lock();
if (menu != nullptr) {
menu->remove(m_menuIdSelectNone);
menu->remove(m_menuIdSelectAll);
menu->remove(m_menuIdTitle);
}
m_menuIdTitle = -1;
m_menuIdSelectAll = -1;
m_menuIdSelectNone = -1;
} }
bool appl::TextPluginSelectAll::onReceiveMessage(appl::TextViewer& _textDrawer,
const ewol::object::Message& _msg) { bool appl::TextPluginSelectAll::onReceiveShortCut(appl::TextViewer& _textDrawer,
const std::string& _shortCutName) {
if (isEnable() == false) { if (isEnable() == false) {
return false; return false;
} }
if (_msg.getMessage() == eventSelectAll) { if (_shortCutName == "appl::TextPluginSelectAll::All") {
if (_textDrawer.hasBuffer() == false) { if (_textDrawer.hasBuffer() == false) {
return false; return false;
} }
_textDrawer.select(_textDrawer.begin(), _textDrawer.end()); _textDrawer.select(_textDrawer.begin(), _textDrawer.end());
return true; return true;
} }
if (_shortCutName == "appl::TextPluginSelectAll::None") {
if (_textDrawer.hasBuffer() == false) {
return false;
}
_textDrawer.unSelect();
return true;
}
return false; return false;
} }

View File

@@ -1,14 +1,9 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_TEXT_PLUGIN_SELECT_ALL_H__
#define __APPL_TEXT_PLUGIN_SELECT_ALL_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <appl/Gui/TextViewer.h> #include <appl/Gui/TextViewer.h>
@@ -17,17 +12,20 @@
namespace appl { namespace appl {
class TextPluginSelectAll : public appl::TextViewerPlugin { class TextPluginSelectAll : public appl::TextViewerPlugin {
public: protected:
TextPluginSelectAll(); TextPluginSelectAll();
~TextPluginSelectAll() { int32_t m_menuIdTitle;
int32_t m_menuIdSelectAll;
int32_t m_menuIdSelectNone;
public:
DECLARE_FACTORY(TextPluginSelectAll);
virtual ~TextPluginSelectAll() {
// nothing to do ... // nothing to do ...
}; };
public: public:
virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginEnable(appl::TextViewer& _textDrawer);
virtual void onPluginDisable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer);
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg); virtual bool onReceiveShortCut(appl::TextViewer& _textDrawer, const std::string& _shortCutName);
}; };
}; }
#endif

View File

@@ -138,7 +138,7 @@ static int growString (vstring *s)
newLength = 2 * s->size; newLength = 2 * s->size;
newLine = (char*) realloc (s->buffer, newLength); newLine = (char*) realloc (s->buffer, newLength);
} }
if (newLine == NULL) if (newLine == nullptr)
perror ("string too large"); perror ("string too large");
else else
{ {
@@ -154,13 +154,13 @@ static void copyName (tagFile *const file)
{ {
size_t length; size_t length;
const char *end = strchr (file->line.buffer, '\t'); const char *end = strchr (file->line.buffer, '\t');
if (end == NULL) if (end == nullptr)
{ {
end = strchr (file->line.buffer, '\n'); end = strchr (file->line.buffer, '\n');
if (end == NULL) if (end == nullptr)
end = strchr (file->line.buffer, '\r'); end = strchr (file->line.buffer, '\r');
} }
if (end != NULL) if (end != nullptr)
length = end - file->line.buffer; length = end - file->line.buffer;
else else
length = strlen (file->line.buffer); length = strlen (file->line.buffer);
@@ -189,7 +189,7 @@ static int readTagLineRaw (tagFile *const file)
reReadLine = 0; reReadLine = 0;
*pLastChar = '\0'; *pLastChar = '\0';
line = fgets (file->line.buffer, (int) file->line.size, file->fp); line = fgets (file->line.buffer, (int) file->line.size, file->fp);
if (line == NULL) if (line == nullptr)
{ {
/* read error */ /* read error */
if (! feof (file->fp)) if (! feof (file->fp))
@@ -236,7 +236,7 @@ static tagResult growFields (tagFile *const file)
unsigned short newCount = (unsigned short) 2 * file->fields.max; unsigned short newCount = (unsigned short) 2 * file->fields.max;
tagExtensionField *newFields = (tagExtensionField*) tagExtensionField *newFields = (tagExtensionField*)
realloc (file->fields.list, newCount * sizeof (tagExtensionField)); realloc (file->fields.list, newCount * sizeof (tagExtensionField));
if (newFields == NULL) if (newFields == nullptr)
perror ("too many extension fields"); perror ("too many extension fields");
else else
{ {
@@ -251,7 +251,7 @@ static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
char *const string) char *const string)
{ {
char *p = string; char *p = string;
while (p != NULL && *p != '\0') while (p != nullptr && *p != '\0')
{ {
while (*p == TAB) while (*p == TAB)
*p++ = '\0'; *p++ = '\0';
@@ -260,10 +260,10 @@ static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
char *colon; char *colon;
char *field = p; char *field = p;
p = strchr (p, TAB); p = strchr (p, TAB);
if (p != NULL) if (p != nullptr)
*p++ = '\0'; *p++ = '\0';
colon = strchr (field, ':'); colon = strchr (field, ':');
if (colon == NULL) if (colon == nullptr)
entry->kind = field; entry->kind = field;
else else
{ {
@@ -295,19 +295,19 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
char *p = file->line.buffer; char *p = file->line.buffer;
char *tab = strchr (p, TAB); char *tab = strchr (p, TAB);
entry->fields.list = NULL; entry->fields.list = nullptr;
entry->fields.count = 0; entry->fields.count = 0;
entry->kind = NULL; entry->kind = nullptr;
entry->fileScope = 0; entry->fileScope = 0;
entry->name = p; entry->name = p;
if (tab != NULL) if (tab != nullptr)
{ {
*tab = '\0'; *tab = '\0';
p = tab + 1; p = tab + 1;
entry->file = p; entry->file = p;
tab = strchr (p, TAB); tab = strchr (p, TAB);
if (tab != NULL) if (tab != nullptr)
{ {
int fieldsPresent; int fieldsPresent;
*tab = '\0'; *tab = '\0';
@@ -321,8 +321,8 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
do do
{ {
p = strchr (p + 1, delimiter); p = strchr (p + 1, delimiter);
} while (p != NULL && *(p - 1) == '\\'); } while (p != nullptr && *(p - 1) == '\\');
if (p == NULL) if (p == nullptr)
{ {
/* invalid pattern */ /* invalid pattern */
} }
@@ -351,19 +351,19 @@ static void parseTagLine (tagFile *file, tagEntry *const entry)
entry->fields.list = file->fields.list; entry->fields.list = file->fields.list;
for (i = entry->fields.count ; i < file->fields.max ; ++i) for (i = entry->fields.count ; i < file->fields.max ; ++i)
{ {
file->fields.list [i].key = NULL; file->fields.list [i].key = nullptr;
file->fields.list [i].value = NULL; file->fields.list [i].value = nullptr;
} }
} }
static char *duplicate (const char *str) static char *duplicate (const char *str)
{ {
char *result = NULL; char *result = nullptr;
if (str != NULL) if (str != nullptr)
{ {
result = strdup (str); result = strdup (str);
if (result == NULL) if (result == nullptr)
perror (NULL); perror (nullptr);
} }
return result; return result;
} }
@@ -372,14 +372,14 @@ static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
{ {
fpos_t startOfLine; fpos_t startOfLine;
const size_t prefixLength = strlen (PseudoTagPrefix); const size_t prefixLength = strlen (PseudoTagPrefix);
if (info != NULL) if (info != nullptr)
{ {
info->file.format = 1; info->file.format = 1;
info->file.sort = TAG_UNSORTED; info->file.sort = TAG_UNSORTED;
info->program.author = NULL; info->program.author = nullptr;
info->program.name = NULL; info->program.name = nullptr;
info->program.url = NULL; info->program.url = nullptr;
info->program.version = NULL; info->program.version = nullptr;
} }
while (1) while (1)
{ {
@@ -407,7 +407,7 @@ static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
file->program.url = duplicate (value); file->program.url = duplicate (value);
else if (strcmp (key, "TAG_PROGRAM_VERSION") == 0) else if (strcmp (key, "TAG_PROGRAM_VERSION") == 0)
file->program.version = duplicate (value); file->program.version = duplicate (value);
if (info != NULL) if (info != nullptr)
{ {
info->file.format = file->format; info->file.format = file->format;
info->file.sort = file->sortMethod; info->file.sort = file->sortMethod;
@@ -440,7 +440,7 @@ static void gotoFirstLogicalTag (tagFile *const file)
static tagFile *initialize (const char *const filePath, tagFileInfo *const info) static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
{ {
tagFile *result = (tagFile*) calloc ((size_t) 1, sizeof (tagFile)); tagFile *result = (tagFile*) calloc ((size_t) 1, sizeof (tagFile));
if (result != NULL) if (result != nullptr)
{ {
growString (&result->line); growString (&result->line);
growString (&result->name); growString (&result->name);
@@ -448,10 +448,10 @@ static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
result->fields.list = (tagExtensionField*) calloc ( result->fields.list = (tagExtensionField*) calloc (
result->fields.max, sizeof (tagExtensionField)); result->fields.max, sizeof (tagExtensionField));
result->fp = fopen (filePath, "r"); result->fp = fopen (filePath, "r");
if (result->fp == NULL) if (result->fp == nullptr)
{ {
free (result); free (result);
result = NULL; result = nullptr;
info->status.error_number = errno; info->status.error_number = errno;
} }
else else
@@ -475,15 +475,15 @@ static void terminate (tagFile *const file)
free (file->name.buffer); free (file->name.buffer);
free (file->fields.list); free (file->fields.list);
if (file->program.author != NULL) if (file->program.author != nullptr)
free (file->program.author); free (file->program.author);
if (file->program.name != NULL) if (file->program.name != nullptr)
free (file->program.name); free (file->program.name);
if (file->program.url != NULL) if (file->program.url != nullptr)
free (file->program.url); free (file->program.url);
if (file->program.version != NULL) if (file->program.version != nullptr)
free (file->program.version); free (file->program.version);
if (file->search.name != NULL) if (file->search.name != nullptr)
free (file->search.name); free (file->search.name);
memset (file, 0, sizeof (tagFile)); memset (file, 0, sizeof (tagFile));
@@ -494,13 +494,13 @@ static void terminate (tagFile *const file)
static tagResult readNext (tagFile *const file, tagEntry *const entry) static tagResult readNext (tagFile *const file, tagEntry *const entry)
{ {
tagResult result; tagResult result;
if (file == NULL || ! file->initialized) if (file == nullptr || ! file->initialized)
result = TagFailure; result = TagFailure;
else if (! readTagLine (file)) else if (! readTagLine (file))
result = TagFailure; result = TagFailure;
else else
{ {
if (entry != NULL) if (entry != nullptr)
parseTagLine (file, entry); parseTagLine (file, entry);
result = TagSuccess; result = TagSuccess;
} }
@@ -510,13 +510,13 @@ static tagResult readNext (tagFile *const file, tagEntry *const entry)
static const char *readFieldValue ( static const char *readFieldValue (
const tagEntry *const entry, const char *const key) const tagEntry *const entry, const char *const key)
{ {
const char *result = NULL; const char *result = nullptr;
int i; int i;
if (strcmp (key, "kind") == 0) if (strcmp (key, "kind") == 0)
result = entry->kind; result = entry->kind;
else if (strcmp (key, "file") == 0) else if (strcmp (key, "file") == 0)
result = EmptyString; result = EmptyString;
else for (i = 0 ; i < entry->fields.count && result == NULL ; ++i) else for (i = 0 ; i < entry->fields.count && result == nullptr ; ++i)
if (strcmp (entry->fields.list [i].key, key) == 0) if (strcmp (entry->fields.list [i].key, key) == 0)
result = entry->fields.list [i].value; result = entry->fields.list [i].value;
return result; return result;
@@ -650,7 +650,7 @@ static tagResult find (tagFile *const file, tagEntry *const entry,
const char *const name, const int options) const char *const name, const int options)
{ {
tagResult result; tagResult result;
if (file->search.name != NULL) if (file->search.name != nullptr)
free (file->search.name); free (file->search.name);
file->search.name = duplicate (name); file->search.name = duplicate (name);
file->search.nameLength = strlen (name); file->search.nameLength = strlen (name);
@@ -680,7 +680,7 @@ static tagResult find (tagFile *const file, tagEntry *const entry,
else else
{ {
file->search.pos = file->pos; file->search.pos = file->pos;
if (entry != NULL) if (entry != nullptr)
parseTagLine (file, entry); parseTagLine (file, entry);
} }
return result; return result;
@@ -699,7 +699,7 @@ static tagResult findNext (tagFile *const file, tagEntry *const entry)
else else
{ {
result = findSequential (file); result = findSequential (file);
if (result == TagSuccess && entry != NULL) if (result == TagSuccess && entry != nullptr)
parseTagLine (file, entry); parseTagLine (file, entry);
} }
return result; return result;
@@ -717,7 +717,7 @@ extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info)
extern tagResult tagsSetSortType (tagFile *const file, const sortType type) extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
{ {
tagResult result = TagFailure; tagResult result = TagFailure;
if (file != NULL && file->initialized) if (file != nullptr && file->initialized)
{ {
file->sortMethod = type; file->sortMethod = type;
result = TagSuccess; result = TagSuccess;
@@ -728,7 +728,7 @@ extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry) extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
{ {
tagResult result = TagFailure; tagResult result = TagFailure;
if (file != NULL && file->initialized) if (file != nullptr && file->initialized)
{ {
gotoFirstLogicalTag (file); gotoFirstLogicalTag (file);
result = readNext (file, entry); result = readNext (file, entry);
@@ -739,15 +739,15 @@ extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
extern tagResult tagsNext (tagFile *const file, tagEntry *const entry) extern tagResult tagsNext (tagFile *const file, tagEntry *const entry)
{ {
tagResult result = TagFailure; tagResult result = TagFailure;
if (file != NULL && file->initialized) if (file != nullptr && file->initialized)
result = readNext (file, entry); result = readNext (file, entry);
return result; return result;
} }
extern const char *tagsField (const tagEntry *const entry, const char *const key) extern const char *tagsField (const tagEntry *const entry, const char *const key)
{ {
const char *result = NULL; const char *result = nullptr;
if (entry != NULL) if (entry != nullptr)
result = readFieldValue (entry, key); result = readFieldValue (entry, key);
return result; return result;
} }
@@ -756,7 +756,7 @@ extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
const char *const name, const int options) const char *const name, const int options)
{ {
tagResult result = TagFailure; tagResult result = TagFailure;
if (file != NULL && file->initialized) if (file != nullptr && file->initialized)
result = find (file, entry, name, options); result = find (file, entry, name, options);
return result; return result;
} }
@@ -764,7 +764,7 @@ extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry) extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
{ {
tagResult result = TagFailure; tagResult result = TagFailure;
if (file != NULL && file->initialized) if (file != nullptr && file->initialized)
result = findNext (file, entry); result = findNext (file, entry);
return result; return result;
} }
@@ -772,7 +772,7 @@ extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
extern tagResult tagsClose (tagFile *const file) extern tagResult tagsClose (tagFile *const file)
{ {
tagResult result = TagFailure; tagResult result = TagFailure;
if (file != NULL && file->initialized) if (file != nullptr && file->initialized)
{ {
terminate (file); terminate (file);
result = TagSuccess; result = TagSuccess;
@@ -804,7 +804,7 @@ static void printTag (const tagEntry *entry)
entry->name, entry->file, entry->address.pattern); entry->name, entry->file, entry->address.pattern);
if (extensionFields) if (extensionFields)
{ {
if (entry->kind != NULL && entry->kind [0] != '\0') if (entry->kind != nullptr && entry->kind [0] != '\0')
printf ("%s\tkind:%s", sep, entry->kind); printf ("%s\tkind:%s", sep, entry->kind);
if (entry->fileScope) if (entry->fileScope)
printf ("%s\tfile:", sep); printf ("%s\tfile:", sep);
@@ -825,7 +825,7 @@ static void findTag (const char *const name, const int options)
tagFileInfo info; tagFileInfo info;
tagEntry entry; tagEntry entry;
tagFile *const file = tagsOpen (TagFileName, &info); tagFile *const file = tagsOpen (TagFileName, &info);
if (file == NULL) if (file == nullptr)
{ {
fprintf (stderr, "%s: cannot open tag file: %s: %s\n", fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
ProgramName, strerror (info.status.error_number), name); ProgramName, strerror (info.status.error_number), name);
@@ -851,7 +851,7 @@ static void listTags ()
tagFileInfo info; tagFileInfo info;
tagEntry entry; tagEntry entry;
tagFile *const file = tagsOpen (TagFileName, &info); tagFile *const file = tagsOpen (TagFileName, &info);
if (file == NULL) if (file == nullptr)
{ {
fprintf (stderr, "%s: cannot open tag file: %s: %s\n", fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
ProgramName, strerror (info.status.error_number), TagFileName); ProgramName, strerror (info.status.error_number), TagFileName);
@@ -927,7 +927,7 @@ extern int main (int argc, char **argv)
++j; ++j;
if (arg [j] == '\0') if (arg [j] == '\0')
SortMethod = TAG_SORTED; SortMethod = TAG_SORTED;
else if (strchr ("012", arg[j]) != NULL) else if (strchr ("012", arg[j]) != nullptr)
SortMethod = (sortType) (arg[j] - '0'); SortMethod = (sortType) (arg[j] - '0');
else else
{ {

View File

@@ -114,7 +114,7 @@ typedef struct {
/* address for locating tag in source file */ /* address for locating tag in source file */
struct { struct {
/* pattern for locating source line /* pattern for locating source line
* (may be NULL if not present) */ * (may be nullptr if not present) */
const char *pattern; const char *pattern;
/* line number in source file of tag definition /* line number in source file of tag definition
@@ -122,7 +122,7 @@ typedef struct {
unsigned long lineNumber; unsigned long lineNumber;
} address; } address;
/* kind of tag (may by name, character, or NULL if not known) */ /* kind of tag (may by name, character, or nullptr if not known) */
const char *kind; const char *kind;
/* is tag of file-limited scope? */ /* is tag of file-limited scope? */

View File

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

View File

@@ -1,29 +1,16 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __APPL_DEBUG_H__ #include <elog/log.h>
#define __APPL_DEBUG_H__
#include <etk/log.h>
namespace appl { namespace appl {
int32_t getLogId(); int32_t getLogId();
}; };
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb" #define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_BASE(info,data) \
do { \
if (info <= etk::log::getLevel(appl::getLogId())) { \
std::stringbuf sb; \
std::ostream tmpStream(&sb); \
tmpStream << data; \
etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
} \
} while(0)
#define APPL_CRITICAL(data) APPL_BASE(1, data) #define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data) #define APPL_ERROR(data) APPL_BASE(2, data)
@@ -48,4 +35,3 @@ namespace appl {
} \ } \
} while (0) } while (0)
#endif

View File

@@ -1,108 +1,32 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <appl/global.h> #include <appl/global.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <ewol/resource/Manager.h> #include <gale/resource/Manager.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#undef __class__
#define __class__ "globals"
class myParamGlobal : public ewol::Object { class myParamGlobal : public ewol::Object {
public: public:
static const char * const configEOL; eproperty::Value<bool> m_displayEOL;
static const char * const configAutoIndent; eproperty::Value<bool> m_AutoIndent;
static const char * const configShowTabChar; eproperty::Value<bool> m_displayTabChar;
static const char * const configShowSpaceChar; eproperty::Value<bool> m_displaySpaceChar;
public:
bool m_displayEOL;
bool m_AutoIndent;
bool m_displayTabChar;
bool m_displaySpaceChar;
public : 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) m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
setName("edn_global_param"); propertyName.set("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());
return true;
}
if (_conf.getConfig() == configAutoIndent) {
m_AutoIndent = std::stob(_conf.getData());
return true;
}
if (_conf.getConfig() == configShowTabChar) {
m_displayTabChar = std::stob(_conf.getData());
return true;
}
if (_conf.getConfig() == configShowSpaceChar) {
m_displaySpaceChar = std::stob(_conf.getData());
return true;
}
return false;
}
bool onGetConfig(const char* _config, std::string& _result) const {
// Not set the EObject node parameter (name == > not change ...)
if (_config == configEOL) {
if (true == m_displayEOL) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configAutoIndent) {
if (true == m_AutoIndent) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configShowTabChar) {
if (true == m_displayTabChar) {
_result = "true";
} else {
_result = "false";
}
return true;
}
if (_config == configShowSpaceChar) {
if (true == m_displaySpaceChar) {
_result = "true";
} else {
_result = "false";
}
return true;
}
return false;
} }
}; };
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& l_obj() {
static myParamGlobal s_obj; static myParamGlobal s_obj;
@@ -124,7 +48,7 @@ bool globals::isSetDisplayEndOfLine() {
} }
void globals::setDisplayEndOfLine(bool newVal) { void globals::setDisplayEndOfLine(bool newVal) {
l_obj().m_displayEOL = newVal; l_obj().m_displayEOL.set(newVal);
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange); //ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
} }
@@ -134,7 +58,7 @@ bool globals::isSetDisplaySpaceChar() {
} }
void globals::setDisplaySpaceChar(bool _newVal) { void globals::setDisplaySpaceChar(bool _newVal) {
l_obj().m_displaySpaceChar = _newVal; l_obj().m_displaySpaceChar.set(_newVal);
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange); //ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
} }
// ----------------------------------------------------------- // -----------------------------------------------------------
@@ -143,7 +67,7 @@ bool globals::isSetDisplayTabChar() {
} }
void globals::setDisplayTabChar(bool _newVal) { void globals::setDisplayTabChar(bool _newVal) {
l_obj().m_displayTabChar = _newVal; l_obj().m_displayTabChar.set(_newVal);
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange); //ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
} }
@@ -153,7 +77,7 @@ bool globals::isSetAutoIndent() {
} }
void globals::setAutoIndent(bool _newVal) { void globals::setAutoIndent(bool _newVal) {
l_obj().m_AutoIndent = _newVal; l_obj().m_AutoIndent.set(_newVal);
} }
// ----------------------------------------------------------- // -----------------------------------------------------------
@@ -173,67 +97,73 @@ int32_t globals::getNbLineBorder() {
#include <ewol/widget/CheckBox.h> #include <ewol/widget/CheckBox.h>
#include <ewol/widget/Spacer.h> #include <ewol/widget/Spacer.h>
static const char * const l_changeIndentation = "edn-event-change-indentation";
static const char * const l_changeSpace = "edn-event-change-spaces";
static const char * const l_changeTabulation = "edn-event-change-tabulation";
static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
static const char * const l_changeRounded = "edn-event-change-rounded";
globals::ParameterGlobalsGui::ParameterGlobalsGui() : globals::ParameterGlobalsGui::ParameterGlobalsGui() {
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) { addObjectType("globals::ParameterGlobalsGui");
ewol::widget::CheckBox* myCheckbox = NULL; }
ewol::widget::Spacer* mySpacer = NULL;
void globals::ParameterGlobalsGui::init() {
ewol::widget::Sizer::init();
propertyMode.set(ewol::widget::Sizer::modeVert);
ememory::SharedPtr<ewol::widget::CheckBox> myCheckbox;
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
mySpacer = new ewol::widget::Spacer(); mySpacer = ewol::widget::Spacer::create();
if (NULL == mySpacer) { if (mySpacer == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
mySpacer->setExpand(bvec2(true,true)); mySpacer->propertyExpand.set(bvec2(true,true));
subWidgetAdd(mySpacer); subWidgetAdd(mySpacer);
} }
myCheckbox = new ewol::widget::CheckBox("Automatic Indentation"); myCheckbox = ewol::widget::CheckBox::create();
if (NULL == myCheckbox) { if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); //TODO : myCheckbox->propertyLabel.set("Automatic Indentation");
myCheckbox->setValue(isSetAutoIndent()); myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->registerOnEvent(this, "clicked", l_changeIndentation); myCheckbox->propertyValue.set(isSetAutoIndent());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = new ewol::widget::CheckBox("Display space char (' ')"); myCheckbox = ewol::widget::CheckBox::create();
if (NULL == myCheckbox) { if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); //TODO : myCheckbox->propertyLabel.set("Display space char (' ')");
myCheckbox->setValue(isSetDisplaySpaceChar()); myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->registerOnEvent(this, "clicked", l_changeSpace); myCheckbox->propertyValue.set(isSetDisplaySpaceChar());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = new ewol::widget::CheckBox("Display tabulation char ('\\t')"); myCheckbox = ewol::widget::CheckBox::create();
if (NULL == myCheckbox) { if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); //TODO : myCheckbox->propertyLabel.set("Display tabulation char ('\\t')");
myCheckbox->setValue(isSetDisplayTabChar());
myCheckbox->registerOnEvent(this, "clicked", l_changeTabulation); myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayTabChar());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = new ewol::widget::CheckBox("Display end of line ('\\n')"); myCheckbox = ewol::widget::CheckBox::create();
if (NULL == myCheckbox) { if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); //TODO : myCheckbox->propertyLabel.set("Display end of line ('\\n')");
myCheckbox->setValue(isSetDisplayEndOfLine()); myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->registerOnEvent(this, "clicked", l_changeEndOfLine); myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
myCheckbox = new ewol::widget::CheckBox("switch Rounded/default"); myCheckbox = ewol::widget::CheckBox::create();
if (NULL == myCheckbox) { if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error"); APPL_ERROR("Can not allocate widget == > display might be in error");
} else { } else {
myCheckbox->setExpand(bvec2(true,false)); //TODO : myCheckbox->propertyLabel.set("switch Rounded/default");
myCheckbox->setValue(isSetDisplayEndOfLine()); myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->registerOnEvent(this, "clicked", l_changeRounded); myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded);
subWidgetAdd(myCheckbox); subWidgetAdd(myCheckbox);
} }
} }
@@ -243,43 +173,28 @@ globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
} }
void globals::ParameterGlobalsGui::onReceiveMessage(const ewol::object::Message& _msg) { void globals::ParameterGlobalsGui::onCallbackEndOfLine(const bool& _value) {
ewol::widget::Sizer::onReceiveMessage(_msg); setDisplayEndOfLine(_value);
}
if (_msg.getMessage() == l_changeEndOfLine) {
if (_msg.getData() == "true") { void globals::ParameterGlobalsGui::onCallbackIndentation(const bool& _value) {
setDisplayEndOfLine(true); setAutoIndent(_value);
} else { }
setDisplayEndOfLine(false);
} void globals::ParameterGlobalsGui::onCallbackSpace(const bool& _value) {
} else if (_msg.getMessage() == l_changeIndentation) { setDisplaySpaceChar(_value);
if (_msg.getData() == "true") { }
setAutoIndent(true); void globals::ParameterGlobalsGui::onCallbackTabulation(const bool& _value) {
} else { setDisplayTabChar(_value);
setAutoIndent(false); }
} void globals::ParameterGlobalsGui::onCallbackRounded(const bool& _value) {
} else if (_msg.getMessage() == l_changeSpace) { if (_value == true) {
if (_msg.getData() == "true") { etk::theme::setName("GUI", "rounded");;
setDisplaySpaceChar(true); } else {
} else { etk::theme::setName("GUI", "default");;
setDisplaySpaceChar(false); }
} // Reload shaders and graphic system ...
} else if (_msg.getMessage() == l_changeTabulation) { ewol::getContext().getResourcesManager().reLoadResources();
if (_msg.getData() == "true") { ewol::getContext().forceRedrawAll();
setDisplayTabChar(true);
} else {
setDisplayTabChar(false);
}
} else if (_msg.getMessage() == l_changeRounded) {
if (_msg.getData() == "true") {
etk::theme::setName("GUI", "rounded");;
} else {
etk::theme::setName("GUI", "default");;
}
// Reload shaders and graphic system ...
ewol::getContext().getResourcesManager().reLoadResources();
ewol::getContext().forceRedrawAll();
}
} }

View File

@@ -1,20 +1,13 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#pragma once
#ifndef __TOOLS_GLOBALS_H__
#define __TOOLS_GLOBALS_H__
#include <appl/debug.h> #include <appl/debug.h>
#include <ewol/widget/Sizer.h> #include <ewol/widget/Sizer.h>
namespace globals {
namespace globals
{
void init(); void init();
void UnInit(); void UnInit();
int32_t getNbColoneBorder(); int32_t getNbColoneBorder();
@@ -37,15 +30,18 @@ namespace globals
bool OrderTheBufferList(); bool OrderTheBufferList();
class ParameterGlobalsGui : public ewol::widget::Sizer { class ParameterGlobalsGui : public ewol::widget::Sizer {
public : protected:
ParameterGlobalsGui(); ParameterGlobalsGui();
~ParameterGlobalsGui(); void init();
// herited function public:
virtual void onReceiveMessage(const ewol::object::Message& _msg); DECLARE_FACTORY(ParameterGlobalsGui);
virtual ~ParameterGlobalsGui();
void onCallbackEndOfLine(const bool& _value);
void onCallbackIndentation(const bool& _value);
void onCallbackSpace(const bool& _value);
void onCallbackTabulation(const bool& _value);
void onCallbackRounded(const bool& _value);
}; };
} }
#endif

View File

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

View File

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

View File

@@ -1,11 +1,8 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
*
* @copyright 2010, Edouard DUPIN, all right reserved * @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file) * @license GPL v3 (see license file)
*/ */
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
@@ -17,7 +14,7 @@
#include <etk/tool.h> #include <etk/tool.h>
#include <unistd.h> #include <unistd.h>
//#include <ewol/config.h> //#include <ewol/config.h>
#include <ewol/context/commandLine.h> #include <gale/context/commandLine.h>
//#include <ewol/UserConfig.h> //#include <ewol/UserConfig.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <appl/TextPluginManager.h> #include <appl/TextPluginManager.h>
@@ -28,122 +25,139 @@
#include <appl/ctags/readtags.h> #include <appl/ctags/readtags.h>
#include <appl/globalMsg.h> #include <appl/globalMsg.h>
class MainApplication : public ewol::context::Application {
private:
ememory::SharedPtr<appl::BufferManager> m_bufferManager;
ememory::SharedPtr<appl::textPluginManager> m_pluginManager;
public:
virtual void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h"
|| tmpppp == "--help") {
APPL_INFO(" -t c-flags-file-name" );
APPL_INFO(" -h/--help display this help" );
exit(0);
}
}
//etk::theme::setName("COLOR", "color/black/");
etk::theme::setName("COLOR", "color/white/");
// TODO : remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
_context.setTitle("edn");
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
#ifdef __TARGET_OS__Android
_context.getFontDefault().set("FreeSerif", 19);
#else
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
#endif
// set the application icon ...
_context.setIcon("DATA:icon.png");
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
}
void onStart(ewol::Context& _context) override {
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
// init internal global value
globals::init();
// init ALL Singleton :
//()CTagsManager::getInstance();
m_bufferManager = appl::BufferManager::create();
m_pluginManager = appl::textPluginManager::create();
appl::highlightManager::init();
// Request load of the user configuration ...
//ewol::userConfig::load();
char cCurrentPath[FILENAME_MAX];
// get the curent program folder
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
return;
}
cCurrentPath[FILENAME_MAX - 1] = '\0';
//APPL_INFO("The current working directory is " << cCurrentPath);
ememory::SharedPtr<MainWindows> basicWindows = MainWindows::create();
if (basicWindows == nullptr) {
APPL_ERROR("Can not allocate the basic windows");
_context.exit(-1);
return;
}
// create the specific windows
_context.setWindows(basicWindows);
// need to add default plugin, because they depend on the Menu widget wich might be named : "appl-menu-interface"
m_pluginManager->addDefaultPlugin();
// add files
APPL_INFO("show list of files : ");
bool ctagDetected = false;
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii);
if (tmpppp == "-t") {
ctagDetected = true;
} else if (true == ctagDetected) {
etk::FSNode file(tmpppp);
std::string name = file.getName();
APPL_INFO("Load ctag file : \"" << name << "\"" );
ctagDetected = false;
//_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
} else if ( tmpppp == "-h"
|| tmpppp == "--help") {
// nothing to do ...
} else {
etk::FSNode file(tmpppp);
if (file.getNodeType() == etk::typeNode_file) {
std::string name = file.getName();
APPL_INFO("need load file : \"" << name << "\"" );
m_bufferManager->open(name);
}
}
}
APPL_INFO("==> START ... " PROJECT_NAME " (END)");
return;
}
void onStop(ewol::Context& _context) override {
APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
appl::highlightManager::unInit();
//Kill all singleton
m_pluginManager.reset();
m_bufferManager.reset();
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
}
void onKillDemand(ewol::Context& _context) override {
APPL_INFO("==> User demand kill ... " PROJECT_NAME " (START)");
if (m_bufferManager == nullptr) {
_context.exit(0);
}
APPL_TODO("Implement the check of buffer not saved ...");
_context.exit(0);
APPL_INFO("==> User demand kill ... " PROJECT_NAME " (END)");
}
};
/** /**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...). * @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
* @param std IO * @param std IO
* @return std IO * @return std IO
*/ */
int main(int _argc, const char *_argv[]) { int main(int _argc, const char *_argv[]) {
// only one things to do: /*
return ewol::run(_argc, _argv); APPL_ERROR(" base signature = " << typeid(&MainApplication::init).name());
} APPL_ERROR(" base signature = " << typeid(std::string).name());
appl::BufferManager* bufferManager = NULL; APPL_CRITICAL(" END ");
*/
/** // second possibility
* @brief main application function initialisation return ewol::run(new MainApplication(), _argc, _argv);
*/
bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
_nbInitStep = 1;
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
etk::theme::setName("COLOR", "color/black/");
// TODO : remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
#ifdef __TARGET_OS__Android
_context.getFontDefault().set("FreeSerif", 19);
#else
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
#endif
// set the application icon ...
_context.setIcon("DATA:icon.png");
// init internal global value
globals::init();
// init ALL Singleton :
//()CTagsManager::getInstance();
bufferManager = appl::BufferManager::keep();
appl::highlightManager::init();
appl::textPluginManager::init();
appl::textPluginManager::addDefaultPlugin();
// Request load of the user configuration ...
//ewol::userConfig::load();
char cCurrentPath[FILENAME_MAX];
// get the curent program folder
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
return false;
}
cCurrentPath[FILENAME_MAX - 1] = '\0';
//APPL_INFO("The current working directory is " << cCurrentPath);
MainWindows* basicWindows = new MainWindows();
if (NULL == basicWindows) {
APPL_ERROR("Can not allocate the basic windows");
_context.stop();
return false;
}
// create the specific windows
_context.setWindows(basicWindows);
// add files
APPL_INFO("show list of files : ");
bool ctagDetected = false;
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii);
if (tmpppp == "-t") {
ctagDetected = true;
} else if (true == ctagDetected) {
etk::FSNode file(tmpppp);
std::string name = file.getName();
APPL_INFO("Load ctag file : \"" << name << "\"" );
ctagDetected = false;
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
} else {
etk::FSNode file(tmpppp);
std::string name = file.getName();
APPL_INFO("need load file : \"" << name << "\"" );
bufferManager->open(name);
}
}
APPL_INFO(" == > init " PROJECT_NAME " (END)");
return true;
} }
/**
* @brief main application function Un-Initialisation
*/
void APP_UnInit(ewol::Context& _context) {
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
ewol::widget::Windows* tmpWindows = _context.getWindows();
_context.setWindows(NULL);
if (NULL != tmpWindows) {
delete(tmpWindows);
tmpWindows = NULL;
}
appl::textPluginManager::unInit();
APPL_INFO("Stop Hightlight");
appl::highlightManager::unInit();
//Kill all singleton
if (bufferManager != NULL) {
APPL_INFO("Stop BufferManager");
appl::BufferManager::release(bufferManager);
bufferManager = NULL;
}
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
}

View File

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

View File

@@ -1 +1 @@
1.1.1 1.2-dev

1
sources/tagCode Normal file
View File

@@ -0,0 +1 @@
5

52
test/CMakeLists.txt Normal file
View File

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

0
test/Makefile Normal file
View File

0
test/asm.asm Normal file
View File

0
test/bash.bash Normal file
View File

0
test/boo.boo Normal file
View File

161
test/cpp.cpp Normal file
View File

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

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