Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
440f4c7093 | |||
a01d121036 | |||
09425067dc | |||
780234de13 | |||
c421bd5f90 | |||
3ec3fa00d9 | |||
9b21e5c769 | |||
2157099f0a | |||
d18b202e75 | |||
63834fe960 | |||
cab0e6009d | |||
08261def10 | |||
304ac2ba45 | |||
2d8c5d588d | |||
f1543f6199 | |||
7acd5127eb | |||
0c6151283b | |||
8854a5a34b | |||
958138ecbb | |||
44bc1dd277 | |||
0821335de6 | |||
8d0fc9023f | |||
4f0839221d | |||
17101a38b0 | |||
def986ab82 | |||
7ebc20e936 | |||
f807faf55a |
4
CMakeLists.txt
Normal file
4
CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
SUBDIRS(${CMAKE_CURRENT_SOURCE_DIR}/../ewol)
|
||||
SUBDIRS(sources)
|
34
README.md
34
README.md
@@ -46,8 +46,8 @@ download the software :
|
||||
http://developer.android.com/tools/sdk/ndk/index.html
|
||||
http://developer.android.com/sdk/index.html
|
||||
==> you need to download sub package of the NDK (refer to the NDK doccumentation) but only supported android version >4.0
|
||||
cd ../edn
|
||||
# generate .so
|
||||
cd ..
|
||||
# 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
|
||||
# to show the log :
|
||||
../ewol/build/lutin.py --target=Android edn-log
|
||||
@@ -55,8 +55,11 @@ download the software :
|
||||
|
||||
(Windows) Compile software & install
|
||||
|
||||
cd yourDevFolder/edn
|
||||
../ewol/build/lutin.py --color --target=Windows --mode=debug
|
||||
cd yourDevFolder
|
||||
../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
|
||||
@@ -65,8 +68,27 @@ download the software :
|
||||
- Xcode ==> for all developement packages
|
||||
- in Xcode : XCode->Setting->Download and install component: "Command Line Tools"
|
||||
|
||||
cd yourDevFolder/edn
|
||||
../ewol/build/lutin.py --color --mode=debug
|
||||
cd yourDevFolder
|
||||
../ewol/build/lutin.py --color --mode=debug edn
|
||||
|
||||
|
||||
(IOs) All needed and some useful packages
|
||||
|
||||
- Git access (client you want or : http://code.google.com/p/git-osx-installer/ ==>need a ctrl+click to remove the normal installation control)
|
||||
- Xcode ==> for all developement packages
|
||||
- in Xcode : XCode->Setting->Download and install component: "Command Line Tools"
|
||||
|
||||
for porting on IOs you need a developper account
|
||||
|
||||
cd yourDevFolder
|
||||
# compile and install on simulator (no developper account needed)
|
||||
../ewol/build/lutin.py --color --target=IOs --mode=debug --simulation edn-intall
|
||||
# launch IOs simulator in xcode, and your application will appear on the second page (32 bit mode only)
|
||||
|
||||
# compile and install on board
|
||||
../ewol/build/lutin.py --color --target=IOs --mode=debug edn-intall
|
||||
# compile and install on board and debug mode :
|
||||
../ewol/build/lutin.py --color --target=IOs --mode=debug edn-log
|
||||
|
||||
|
||||
On linux you can generate 3 board in one time
|
||||
|
@@ -1,68 +0,0 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux Kernel Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_LINEARMATH is not set
|
||||
# CONFIG_BUILD_BULLET is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_FREETYPE is not set
|
||||
# CONFIG_BUILD_LUA is not set
|
||||
# CONFIG_BUILD_OGG is not set
|
||||
# CONFIG_BUILD_PARSERSVG is not set
|
||||
# CONFIG_BUILD_LIBPNG is not set
|
||||
# CONFIG_BUILD_TINYXML is not set
|
||||
# CONFIG_BUILD_ZLIB is not set
|
||||
# CONFIG_BUILD_LIBZIP is not set
|
||||
# CONFIG_BUILD_EWOL is not set
|
||||
CONFIG_BUILD_EDN=y
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
||||
CONFIG___EWOL_INTEGRATED_FONT__=y
|
||||
|
||||
#
|
||||
# Android
|
||||
#
|
||||
CONFIG___EWOL_ANDROID_MINIMUM_SDK_VERSION__=9
|
||||
# CONFIG___EWOL_ANDROID_SHOW_TITLE__ is not set
|
||||
CONFIG___EWOL_ANDROID_ORIENTATION_AUTO__=y
|
||||
# CONFIG___EWOL_ANDROID_ORIENTATION_LANDSCAPE__ is not set
|
||||
# CONFIG___EWOL_ANDROID_ORIENTATION_PORTRAIT__ is not set
|
||||
|
||||
#
|
||||
# Permissions
|
||||
#
|
||||
CONFIG___ANDROID_PERMISSION__WRITE_EXTERNAL_STORAGE__=y
|
||||
# CONFIG___ANDROID_PERMISSION__CAMERA__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__INTERNET__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__MODIFY_AUDIO_SETTINGS__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__READ_CALENDAR__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__READ_CONTACTS__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__READ_FRAME_BUFFER__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__READ_PROFILE__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__RECORD_AUDIO__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__SET_ORIENTATION__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__VIBRATE__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__ACCESS_COARSE_LOCATION__ is not set
|
||||
# CONFIG___ANDROID_PERMISSION__ACCESS_FINE_LOCATION__ is not set
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux Kernel Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_LINEARMATH is not set
|
||||
# CONFIG_BUILD_BULLET is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_FREETYPE is not set
|
||||
# CONFIG_BUILD_LUA is not set
|
||||
# CONFIG_BUILD_OGG is not set
|
||||
# CONFIG_BUILD_PARSERSVG is not set
|
||||
# CONFIG_BUILD_LIBPNG is not set
|
||||
# CONFIG_BUILD_PORTAUDIO is not set
|
||||
# CONFIG_BUILD_TINYXML is not set
|
||||
# CONFIG_BUILD_ZLIB is not set
|
||||
# CONFIG_BUILD_LIBZIP is not set
|
||||
# CONFIG_BUILD_EWOL is not set
|
||||
CONFIG_BUILD_EDN=y
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
||||
# CONFIG___EWOL_INTEGRATED_FONT__ is not set
|
||||
|
||||
#
|
||||
# Linux
|
||||
#
|
||||
CONFIG___EWOL_LINUX_GUI_MODE_X11__=y
|
||||
# CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__ is not set
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
@@ -1,48 +0,0 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux Kernel Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_LINEARMATH is not set
|
||||
# CONFIG_BUILD_BULLET is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_FREETYPE is not set
|
||||
# CONFIG_BUILD_LUA is not set
|
||||
# CONFIG_BUILD_OGG is not set
|
||||
# CONFIG_BUILD_PARSERSVG is not set
|
||||
# CONFIG_BUILD_LIBPNG is not set
|
||||
# CONFIG_BUILD_TINYXML is not set
|
||||
# CONFIG_BUILD_ZLIB is not set
|
||||
# CONFIG_BUILD_LIBZIP is not set
|
||||
# CONFIG_BUILD_EWOL is not set
|
||||
CONFIG_BUILD_EDN=y
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
||||
CONFIG___EWOL_INTEGRATED_FONT__=y
|
||||
|
||||
#
|
||||
# Linux
|
||||
#
|
||||
CONFIG___EWOL_LINUX_GUI_MODE_X11__=y
|
||||
# CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__ is not set
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
@@ -1,43 +0,0 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux Kernel Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_LINEARMATH is not set
|
||||
# CONFIG_BUILD_BULLET is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_FREETYPE is not set
|
||||
# CONFIG_BUILD_GLEW is not set
|
||||
# CONFIG_BUILD_LUA is not set
|
||||
# CONFIG_BUILD_OGG is not set
|
||||
# CONFIG_BUILD_PARSERSVG is not set
|
||||
# CONFIG_BUILD_LIBPNG is not set
|
||||
# CONFIG_BUILD_TINYXML is not set
|
||||
# CONFIG_BUILD_ZLIB is not set
|
||||
# CONFIG_BUILD_LIBZIP is not set
|
||||
# CONFIG_BUILD_EWOL is not set
|
||||
CONFIG_BUILD_EDN=y
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Ewol Basic Title"
|
||||
CONFIG___EWOL_INTEGRATED_FONT__=y
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
@@ -12,15 +12,15 @@
|
||||
<button name="SEARCH:replace">
|
||||
<image src="THEME:GUI:Replace.edf" fill="true" size="7,7mm" distance-field="true"/>
|
||||
</button>
|
||||
<button name="SEARCH:case">
|
||||
<button name="SEARCH:case" toggle="true">
|
||||
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||
<image src="THEME:GUI:CaseSensitive.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||
</button>
|
||||
<button name="SEARCH:wrap">
|
||||
<button name="SEARCH:wrap" toggle="true">
|
||||
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||
<image src="THEME:GUI:WrapAround.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||
</button>
|
||||
<button name="SEARCH:up-down">
|
||||
<button name="SEARCH:up-down" toggle="true">
|
||||
<image src="THEME:GUI:Up.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||
<image src="THEME:GUI:Down.edf" fill="true" size="7,7mm" hover="Close search bar" distance-field="true"/>
|
||||
</button>
|
||||
|
0
data/lang/EN.json
Normal file
0
data/lang/EN.json
Normal file
0
data/lang/FR.json
Normal file
0
data/lang/FR.json
Normal file
58
data/languages/cmake/highlight.xml
Normal file
58
data/languages/cmake/highlight.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EdnLang version="0.1" lang="C/C++">
|
||||
<ext>CMakeLists.txt</ext>
|
||||
<ext>CMakeCache.txt</ext>
|
||||
<pass1>
|
||||
<rule name="my comment doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>##</start>
|
||||
<end>\n</end>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<start>#[ \t]TODO[ \t]*:</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<color>comment</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<start>"</start>
|
||||
<end>"</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
</rule>
|
||||
</pass1>
|
||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||
<rule name="my keyword">
|
||||
<color>keyword</color>
|
||||
<start>\@foreach|message|endforeach|if|else|endif|list|file|string\@</start>
|
||||
</rule>
|
||||
<rule name="my function keyword">
|
||||
<color>systemFunction</color>
|
||||
<start>\@set|include_directories|add_definitions|add_library|include_directories|target_link_libraries|project|include|check_include_file|enable_testing|option|cmake_minimum_required|add_definitions|check_include_file|configure_file|include_directories|add_custom_command|add_executable|add_test\@</start>
|
||||
</rule>
|
||||
<rule name="Variable">
|
||||
<color>inputFunction</color>
|
||||
<start>${</start>
|
||||
<end>}</end>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<start>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</start>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<start>\@[A-Z_][A-Z_0-9]{3,500}\@</start>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<start>\@(\w|_)+[ \t]*\(</start>
|
||||
</rule>
|
||||
|
||||
</pass2>
|
||||
</EdnLang>
|
110
sources/CMakeLists.txt
Normal file
110
sources/CMakeLists.txt
Normal file
@@ -0,0 +1,110 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# Declare the project
|
||||
project(edn)
|
||||
|
||||
##
|
||||
## Include C++ X11 dependency ... (check correct flags)
|
||||
##
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
else()
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
if(COMPILER_SUPPORTS_CXX0X)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
else()
|
||||
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# set output path:
|
||||
set(LIBRARY_OUTPUT_PATH lib/${CMAKE_BUILD_TYPE})
|
||||
|
||||
include_directories(.)
|
||||
|
||||
#Create src file list
|
||||
set(src_files
|
||||
appl/ctags/readtags.cpp
|
||||
appl/debug.cpp
|
||||
appl/global.cpp
|
||||
appl/globalMsg.cpp
|
||||
appl/init.cpp
|
||||
appl/Gui/BufferView.cpp
|
||||
appl/Gui/TextViewer.cpp
|
||||
appl/Gui/ViewerManager.cpp
|
||||
appl/Gui/MainWindows.cpp
|
||||
appl/Gui/Search.cpp
|
||||
appl/Gui/TagFileSelection.cpp
|
||||
appl/Gui/TagFileList.cpp
|
||||
appl/Gui/WorkerSaveFile.cpp
|
||||
appl/Gui/WorkerSaveAllFile.cpp
|
||||
appl/Gui/WorkerCloseFile.cpp
|
||||
appl/Gui/WorkerCloseAllFile.cpp
|
||||
appl/Buffer.cpp
|
||||
appl/BufferManager.cpp
|
||||
appl/TextPlugin.cpp
|
||||
appl/TextPluginCopy.cpp
|
||||
appl/TextPluginMultiLineTab.cpp
|
||||
appl/TextPluginAutoIndent.cpp
|
||||
appl/TextPluginHistory.cpp
|
||||
appl/TextPluginRmLine.cpp
|
||||
appl/TextPluginSelectAll.cpp
|
||||
appl/TextPluginCtags.cpp
|
||||
appl/TextPluginManager.cpp
|
||||
appl/GlyphDecoration.cpp
|
||||
appl/GlyphPainting.cpp
|
||||
appl/HighlightPattern.cpp
|
||||
appl/Highlight.cpp
|
||||
appl/HighlightManager.cpp
|
||||
)
|
||||
|
||||
add_definitions( -DDEBUG_LEVEL=3 )
|
||||
add_definitions( -DDEBUG=1 )
|
||||
add_definitions( -DPROJECT_NAME="edn" )
|
||||
if (APPLE)
|
||||
add_definitions( -D__TARGET_OS__MacOs )
|
||||
elseif (UNIX)
|
||||
add_definitions( -D__TARGET_OS__Linux )
|
||||
elseif (WIN32)
|
||||
add_definitions( -D__TARGET_OS__Windows )
|
||||
endif ()
|
||||
# read version :
|
||||
file (STRINGS "tag" BUILD_VERSION)
|
||||
add_definitions( -DAPPL_VERSION="${BUILD_VERSION}" )
|
||||
|
||||
#Create a static Lib:
|
||||
add_executable(edn ${src_files} )
|
||||
|
||||
include_directories(${zlib_SOURCE_DIR}/contrib/)
|
||||
include_directories(${linearmath_SOURCE_DIR}/bullet/src/)
|
||||
include_directories(${etk_SOURCE_DIR})
|
||||
include_directories(${freetype_SOURCE_DIR})
|
||||
include_directories(${exml_SOURCE_DIR})
|
||||
include_directories(${ejson_SOURCE_DIR})
|
||||
include_directories(${egami_SOURCE_DIR})
|
||||
include_directories(${edtaa3_SOURCE_DIR})
|
||||
include_directories(${date_SOURCE_DIR})
|
||||
include_directories(${agg_SOURCE_DIR})
|
||||
include_directories(${ewol_SOURCE_DIR})
|
||||
|
||||
|
||||
#target_link_libraries(edn ewol)
|
||||
target_link_libraries(edn ewol linearmath zlib etk freetype exml ejson egami edtaa3 date esvg png)
|
||||
|
||||
if (APPLE)
|
||||
target_link_libraries(edn
|
||||
"-framework Cocoa"
|
||||
"-framework OpenGL"
|
||||
"-framework QuartzCore"
|
||||
"-framework AppKit"
|
||||
)
|
||||
elseif (UNIX)
|
||||
target_link_libraries(edn -lGL -lX11 -lpthread)
|
||||
elseif (WIN32)
|
||||
|
||||
endif ()
|
||||
|
||||
|
@@ -13,13 +13,15 @@
|
||||
#include <ewol/context/clipBoard.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++ (void) {
|
||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ () {
|
||||
m_value = u32char::Null;
|
||||
if (m_current < 0) {
|
||||
m_current = 0;
|
||||
@@ -41,7 +43,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ (void) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- () {
|
||||
m_value = u32char::Null;
|
||||
if (m_data != NULL) {
|
||||
if (m_current > 0) {
|
||||
@@ -62,7 +64,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
char32_t appl::Buffer::Iterator::operator* (void) {
|
||||
char32_t appl::Buffer::Iterator::operator* () {
|
||||
if (m_value != u32char::Null) {
|
||||
return m_value;
|
||||
}
|
||||
@@ -92,32 +94,32 @@ appl::Buffer::Iterator appl::Buffer::position(int64_t _pos) {
|
||||
return appl::Buffer::Iterator(this, _pos);
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator appl::Buffer::begin(void) {
|
||||
appl::Buffer::Iterator appl::Buffer::begin() {
|
||||
return position(0);
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator appl::Buffer::end(void) {
|
||||
appl::Buffer::Iterator appl::Buffer::end() {
|
||||
// TODO : chek the validity of the char ...
|
||||
return position( m_data.size() );
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator appl::Buffer::cursor(void) {
|
||||
appl::Buffer::Iterator appl::Buffer::cursor() {
|
||||
if (m_cursorPos<= 0) {
|
||||
return begin();
|
||||
}
|
||||
return position( m_cursorPos );
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator appl::Buffer::selectStart(void) {
|
||||
appl::Buffer::Iterator appl::Buffer::selectStart() {
|
||||
return position( getStartSelectionPos() );
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator appl::Buffer::selectStop(void) {
|
||||
appl::Buffer::Iterator appl::Buffer::selectStop() {
|
||||
return position( getStopSelectionPos() );
|
||||
}
|
||||
|
||||
|
||||
appl::Buffer::Buffer(void) :
|
||||
appl::Buffer::Buffer() :
|
||||
m_hasFileName(false),
|
||||
m_fileName(""),
|
||||
m_isModify(false),
|
||||
@@ -136,15 +138,16 @@ appl::Buffer::Buffer(void) :
|
||||
addEventId(eventChangeName);
|
||||
}
|
||||
|
||||
appl::Buffer::~Buffer(void) {
|
||||
if (m_highlight == NULL) {
|
||||
appl::Highlight::release(m_highlight);
|
||||
}
|
||||
appl::Buffer::~Buffer() {
|
||||
|
||||
}
|
||||
|
||||
bool appl::Buffer::loadFile(const std::string& _name) {
|
||||
APPL_DEBUG("Load file : '" << _name << "'");
|
||||
m_fileName = _name;
|
||||
APPL_DEBUG("Convert filename :'" << _name << "'");
|
||||
etk::FSNode file(_name);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("Load file : '" << name << "'");
|
||||
m_fileName = name;
|
||||
m_hasFileName = true;
|
||||
m_isModify = true;
|
||||
m_cursorPos = 0;
|
||||
@@ -160,16 +163,19 @@ bool appl::Buffer::loadFile(const std::string& _name) {
|
||||
}
|
||||
|
||||
void appl::Buffer::setFileName(const std::string& _name) {
|
||||
if (m_fileName == _name) {
|
||||
APPL_DEBUG("Convert filename :'" << _name << "'");
|
||||
etk::FSNode file(_name);
|
||||
std::string name = file.getName();
|
||||
if (m_fileName == name) {
|
||||
return;
|
||||
}
|
||||
m_fileName = _name;
|
||||
m_fileName = name;
|
||||
m_hasFileName = true;
|
||||
generateEventId(eventChangeName);
|
||||
setModification(true);
|
||||
}
|
||||
|
||||
bool appl::Buffer::storeFile(void) {
|
||||
bool appl::Buffer::storeFile() {
|
||||
if (m_data.dumpIn(m_fileName) == true) {
|
||||
APPL_INFO("saving file : " << m_fileName);
|
||||
setModification(false);
|
||||
@@ -191,7 +197,7 @@ void appl::Buffer::setModification(bool _status) {
|
||||
}
|
||||
|
||||
// TODO : Naming error
|
||||
void appl::Buffer::countNumberofLine(void) {
|
||||
void appl::Buffer::countNumberofLine() {
|
||||
m_nbLines = 1;
|
||||
for (Iterator it = begin();
|
||||
(bool)it == true;
|
||||
@@ -293,7 +299,7 @@ bool appl::Buffer::search(const appl::Buffer::Iterator& _pos,
|
||||
for (Iterator it = _pos;
|
||||
(bool)it == true;
|
||||
++it) {
|
||||
if (tolower(*it) == firstElement) {
|
||||
if ((char32_t)tolower(*it) == firstElement) {
|
||||
// find the first char ==> check next...
|
||||
bool find = true;
|
||||
Iterator tmp = it;
|
||||
@@ -365,7 +371,7 @@ bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos,
|
||||
(bool)it == true;
|
||||
--it) {
|
||||
//APPL_DEBUG("compare : " << *it << " ?= " << _search);
|
||||
if (tolower(*it) == lastElement) {
|
||||
if ((char32_t)tolower(*it) == lastElement) {
|
||||
// find the last char ==> check previous...
|
||||
bool find = true;
|
||||
_result = it;
|
||||
@@ -511,7 +517,7 @@ void appl::Buffer::setSelectionPos(const appl::Buffer::Iterator& _pos) {
|
||||
generateEventId(eventSelectChange);
|
||||
}
|
||||
|
||||
void appl::Buffer::unSelect(void) {
|
||||
void appl::Buffer::unSelect() {
|
||||
m_cursorSelectPos = -1;
|
||||
generateEventId(eventSelectChange);
|
||||
}
|
||||
@@ -619,8 +625,6 @@ bool appl::Buffer::copy(std::string& _data) {
|
||||
|
||||
void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
|
||||
_data.clear();
|
||||
int64_t startPos = getStartSelectionPos();
|
||||
int64_t endPos = getStopSelectionPos();
|
||||
for (Iterator it = _pos;
|
||||
it != _posEnd &&
|
||||
(bool)it == true;
|
||||
@@ -634,7 +638,7 @@ bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator&
|
||||
if (position < 0){
|
||||
position = 0;
|
||||
}
|
||||
APPL_ERROR("writye at pos: " << (int64_t)_pos << " ==> " << position);
|
||||
APPL_VERBOSE("write at pos: " << (int64_t)_pos << " ==> " << position << " data : " << _data);
|
||||
m_data.insert(position, (int8_t*)(_data.c_str()), _data.size());
|
||||
if (m_cursorPos < 0) {
|
||||
m_cursorPos = 0;
|
||||
@@ -661,7 +665,7 @@ bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterato
|
||||
return true;
|
||||
}
|
||||
|
||||
void appl::Buffer::removeSelection(void) {
|
||||
void appl::Buffer::removeSelection() {
|
||||
if (hasTextSelected() == false) {
|
||||
return;
|
||||
}
|
||||
@@ -675,7 +679,7 @@ void appl::Buffer::removeSelection(void) {
|
||||
setModification(true);
|
||||
}
|
||||
|
||||
void appl::Buffer::tryFindHighlightType(void) {
|
||||
void appl::Buffer::tryFindHighlightType() {
|
||||
etk::FSNode file(m_fileName);
|
||||
std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention());
|
||||
if (type.size() == 0) {
|
||||
@@ -688,9 +692,7 @@ void appl::Buffer::tryFindHighlightType(void) {
|
||||
void appl::Buffer::setHighlightType(const std::string& _type) {
|
||||
m_highlightType = "";
|
||||
cleanHighLight();
|
||||
if (m_highlight == NULL) {
|
||||
appl::Highlight::release(m_highlight);
|
||||
}
|
||||
m_highlight.reset();
|
||||
std::string resourceName = appl::highlightManager::getFileWithTypeType(_type);
|
||||
if (resourceName == "") {
|
||||
return;
|
||||
@@ -757,12 +759,12 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
} else {
|
||||
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);
|
||||
m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted;
|
||||
m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted;
|
||||
m_HLDataPass1[iii].endStart += _nbAdded - _nbDeleted;
|
||||
m_HLDataPass1[iii].endStop += _nbAdded - _nbDeleted;
|
||||
it->beginStart += _nbAdded - _nbDeleted;
|
||||
it->beginStop += _nbAdded - _nbDeleted;
|
||||
it->endStart += _nbAdded - _nbDeleted;
|
||||
it->endStop += _nbAdded - _nbDeleted;
|
||||
}
|
||||
//Regenerate Element inside range
|
||||
if ( startId == -1
|
||||
@@ -825,7 +827,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
||||
------------ ------------- ----------
|
||||
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) {
|
||||
break;
|
||||
}
|
||||
@@ -846,7 +848,7 @@ void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
|
||||
} else {
|
||||
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) {
|
||||
_stopId = iii;
|
||||
break;
|
||||
@@ -862,7 +864,7 @@ void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _a
|
||||
m_highlight->parse(_pos, _endPos, m_HLDataPass1, _addingPos, m_data);
|
||||
}
|
||||
|
||||
void appl::Buffer::cleanHighLight(void) {
|
||||
void appl::Buffer::cleanHighLight() {
|
||||
// remove all element in the list...
|
||||
m_HLDataPass1.clear();
|
||||
}
|
||||
@@ -870,7 +872,7 @@ void appl::Buffer::cleanHighLight(void) {
|
||||
|
||||
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
|
||||
int32_t start = etk_max(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;
|
||||
if ( m_HLDataPass1[iii].beginStart <= _pos
|
||||
&& m_HLDataPass1[iii].endStop > _pos) {
|
||||
@@ -974,7 +976,7 @@ appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData
|
||||
return getElementColorAtPosition(_pos, _MData.posHLPass1);
|
||||
}
|
||||
|
||||
uint32_t appl::Buffer::getCursorLinesId(void) {
|
||||
uint32_t appl::Buffer::getCursorLinesId() {
|
||||
if (m_data.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -987,4 +989,4 @@ uint32_t appl::Buffer::getCursorLinesId(void) {
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ namespace appl {
|
||||
/**
|
||||
* @brief Basic itarator constructor with no link.
|
||||
*/
|
||||
Iterator(void):
|
||||
Iterator():
|
||||
m_current(0),
|
||||
m_data(NULL),
|
||||
m_value(u32char::Null) {
|
||||
@@ -68,7 +68,7 @@ namespace appl {
|
||||
/**
|
||||
* @brief Basic destructor
|
||||
*/
|
||||
~Iterator(void) {
|
||||
virtual ~Iterator() {
|
||||
m_current = 0;
|
||||
m_data = NULL;
|
||||
m_value = u32char::Null;
|
||||
@@ -77,7 +77,7 @@ namespace appl {
|
||||
* @brief basic boolean cast
|
||||
* @return true if the element is present in buffer
|
||||
*/
|
||||
operator bool (void) const {
|
||||
operator bool () const {
|
||||
if (m_data == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace appl {
|
||||
* @brief basic boolean cast
|
||||
* @return true if the element is present in buffer
|
||||
*/
|
||||
operator int64_t (void) const {
|
||||
operator int64_t () const {
|
||||
if (m_data == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@@ -109,12 +109,12 @@ namespace appl {
|
||||
* @brief Incremental operator
|
||||
* @return Reference on the current iterator incremented
|
||||
*/
|
||||
Iterator& operator++ (void);
|
||||
Iterator& operator++ ();
|
||||
/**
|
||||
* @brief Decremental operator
|
||||
* @return Reference on the current iterator decremented
|
||||
*/
|
||||
Iterator& operator-- (void);
|
||||
Iterator& operator-- ();
|
||||
/**
|
||||
* @brief Incremental operator
|
||||
* @return Reference on a new iterator and increment the other one
|
||||
@@ -211,12 +211,12 @@ namespace appl {
|
||||
* @brief Get the value on the current element
|
||||
* @return The request element value
|
||||
*/
|
||||
char32_t operator* (void);
|
||||
char32_t operator* ();
|
||||
/**
|
||||
* @brief Get the position in the buffer
|
||||
* @return The requested position.
|
||||
*/
|
||||
int64_t getPos(void) const {
|
||||
int64_t getPos() const {
|
||||
if (m_data == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ namespace appl {
|
||||
};
|
||||
Iterator operator+ (const size_t _val) const {
|
||||
Iterator tmpp(*this);
|
||||
for (int64_t iii=0; iii<_val; ++iii) {
|
||||
for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
|
||||
++tmpp;
|
||||
}
|
||||
return tmpp;
|
||||
@@ -273,7 +273,7 @@ namespace appl {
|
||||
};
|
||||
Iterator operator- (const size_t _val) const {
|
||||
Iterator tmpp(*this);
|
||||
for (int64_t iii=0; iii<_val; ++iii) {
|
||||
for (int64_t iii=0; iii<(int64_t)_val; ++iii) {
|
||||
--tmpp;
|
||||
}
|
||||
return tmpp;
|
||||
@@ -293,8 +293,8 @@ namespace appl {
|
||||
static const char* const eventSelectChange;
|
||||
static const char* const eventChangeName;
|
||||
public:
|
||||
Buffer(void);
|
||||
~Buffer(void);
|
||||
Buffer();
|
||||
virtual ~Buffer();
|
||||
private:
|
||||
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)
|
||||
@@ -302,14 +302,14 @@ namespace appl {
|
||||
/**
|
||||
* @brief get the curent filename of the Buffer
|
||||
*/
|
||||
const std::string& getFileName(void) {
|
||||
const std::string& getFileName() {
|
||||
return m_fileName;
|
||||
}
|
||||
/**
|
||||
* @brief Check if the buffer has a real filename.
|
||||
* @return the status of the existance of a name.
|
||||
*/
|
||||
bool hasFileName(void) {
|
||||
bool hasFileName() {
|
||||
return m_hasFileName;
|
||||
}
|
||||
/**
|
||||
@@ -327,7 +327,7 @@ namespace appl {
|
||||
* @brief save the file in the specify path.
|
||||
* @return true is saving well done
|
||||
*/
|
||||
bool storeFile(void);
|
||||
bool storeFile();
|
||||
protected:
|
||||
bool m_isModify; //!< true if the file is modify
|
||||
public:
|
||||
@@ -335,7 +335,7 @@ namespace appl {
|
||||
* @breif get the status of file modification.
|
||||
* @return true if file is modify.
|
||||
*/
|
||||
bool isModify(void) {
|
||||
bool isModify() {
|
||||
return m_isModify;
|
||||
}
|
||||
/**
|
||||
@@ -346,7 +346,7 @@ namespace appl {
|
||||
protected:
|
||||
etk::Buffer m_data; //!< copy of the file buffer
|
||||
public:
|
||||
etk::Buffer& getData(void) {
|
||||
etk::Buffer& getData() {
|
||||
return m_data;
|
||||
};
|
||||
protected:
|
||||
@@ -364,30 +364,30 @@ namespace appl {
|
||||
/**
|
||||
* @brief Remove Selection of the buffer.
|
||||
*/
|
||||
void unSelect(void);
|
||||
void unSelect();
|
||||
/**
|
||||
* @brief Remove the selection of the buffer. (do nothing if no secection)
|
||||
*/
|
||||
void removeSelection(void);
|
||||
void removeSelection();
|
||||
/**
|
||||
* @brief Get the status of selection.
|
||||
* @return true if we have a curent selection, false otherwise.
|
||||
*/
|
||||
bool hasTextSelected(void) {
|
||||
bool hasTextSelected() {
|
||||
return m_cursorSelectPos >= 0;
|
||||
}
|
||||
/**
|
||||
* @brief Get the Start position of the selection.
|
||||
* @return position of the start selection.
|
||||
*/
|
||||
int64_t getStartSelectionPos(void) {
|
||||
int64_t getStartSelectionPos() {
|
||||
return etk_min(m_cursorPos, m_cursorSelectPos);
|
||||
}
|
||||
/**
|
||||
* @brief Get the Stop position of the selection.
|
||||
* @return position of the stop selection.
|
||||
*/
|
||||
int64_t getStopSelectionPos(void) {
|
||||
int64_t getStopSelectionPos() {
|
||||
return etk_max(m_cursorPos, m_cursorSelectPos);
|
||||
}
|
||||
protected:
|
||||
@@ -404,7 +404,7 @@ namespace appl {
|
||||
* @brief Get the favorite distance from the left screen (For up and down moving).
|
||||
* @return The distance in pixels.
|
||||
*/
|
||||
float getFavoriteUpDownPos(void) {
|
||||
float getFavoriteUpDownPos() {
|
||||
return m_cursorPreferredCol;
|
||||
}
|
||||
protected:
|
||||
@@ -421,7 +421,7 @@ namespace appl {
|
||||
* @brief Get the selection mode (if true, the move event creata a selection)
|
||||
* @return The selecting mode.
|
||||
*/
|
||||
bool getSelectMode(void) {
|
||||
bool getSelectMode() {
|
||||
return m_selectMode;
|
||||
}
|
||||
public:
|
||||
@@ -544,27 +544,27 @@ namespace appl {
|
||||
* @brief Get an Iterator on the start position.
|
||||
* @return The Iterator
|
||||
*/
|
||||
Iterator begin(void);
|
||||
Iterator begin();
|
||||
/**
|
||||
* @brief Get an Iterator on the end position.
|
||||
* @return The Iterator
|
||||
*/
|
||||
Iterator end(void);
|
||||
Iterator end();
|
||||
/**
|
||||
* @brief Get an Iterator on the cursor position.
|
||||
* @return The Iterator
|
||||
*/
|
||||
Iterator cursor(void);
|
||||
Iterator cursor();
|
||||
/**
|
||||
* @brief Get an Iterator on the start selection.
|
||||
* @return The Iterator
|
||||
*/
|
||||
Iterator selectStart(void);
|
||||
Iterator selectStart();
|
||||
/**
|
||||
* @brief Get an Iterator on the stop selection.
|
||||
* @return The Iterator
|
||||
*/
|
||||
Iterator selectStop(void);
|
||||
Iterator selectStop();
|
||||
protected:
|
||||
int32_t m_nbLines; //!< number of line in the buffer
|
||||
public:
|
||||
@@ -572,29 +572,29 @@ namespace appl {
|
||||
* @brief Get the number of line in the buffer.
|
||||
* @return number of line in the Buffer.
|
||||
*/
|
||||
int32_t getNumberOfLines(void) {
|
||||
int32_t getNumberOfLines() {
|
||||
return m_nbLines;
|
||||
}
|
||||
/**
|
||||
* @brief Get the cursor line numberin the buffer.
|
||||
* @return the line id in the Buffer.
|
||||
*/
|
||||
uint32_t getCursorLinesId(void);
|
||||
uint32_t getCursorLinesId();
|
||||
protected:
|
||||
/**
|
||||
* @brief Count the number of line in the buffer
|
||||
*/
|
||||
void countNumberofLine(void);
|
||||
void countNumberofLine();
|
||||
protected:
|
||||
std::string m_highlightType; //!< Name of the highlight type
|
||||
|
||||
appl::Highlight* m_highlight; //!< internal link with the Highlight system
|
||||
ewol::object::Shared<appl::Highlight> m_highlight; //!< internal link with the Highlight system
|
||||
std::vector<appl::HighlightInfo> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
||||
public:
|
||||
/**
|
||||
* @brief Find the Highligh capability
|
||||
*/
|
||||
void tryFindHighlightType(void);
|
||||
void tryFindHighlightType();
|
||||
/**
|
||||
* @brief Set type of highlight
|
||||
* @param[in] _type type of the highlight
|
||||
@@ -604,7 +604,7 @@ namespace appl {
|
||||
* @brief Get type of highlight
|
||||
* @return Type of the highlight
|
||||
*/
|
||||
const std::string& setHighlightType(void) {
|
||||
const std::string& setHighlightType() {
|
||||
return m_highlightType;
|
||||
};
|
||||
|
||||
@@ -615,7 +615,7 @@ namespace appl {
|
||||
int64_t& _stopId,
|
||||
bool _backPreviousNotEnded);
|
||||
void generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos=0);
|
||||
void cleanHighLight(void);
|
||||
void cleanHighLight();
|
||||
appl::HighlightInfo* getElementColorAtPosition(int64_t _pos, int64_t &_starPos);
|
||||
void hightlightGenerateLines(appl::DisplayHLData& _MData, const appl::Buffer::Iterator& _HLStart, int64_t _nbLines);
|
||||
appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos);
|
||||
|
@@ -6,10 +6,11 @@
|
||||
* @license GPL v3 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <appl/debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <appl/BufferManager.h>
|
||||
#include <etk/types.h>
|
||||
#include <ewol/object/Object.h>
|
||||
#include <ewol/object/Manager.h>
|
||||
#include <ewol/resource/Manager.h>
|
||||
@@ -17,30 +18,19 @@
|
||||
#undef __class__
|
||||
#define __class__ "BufferManager"
|
||||
|
||||
appl::BufferManager::BufferManager(void) :
|
||||
appl::BufferManager::BufferManager() :
|
||||
ewol::Resource("???BufferManager???"),
|
||||
m_bufferSelected(NULL) {
|
||||
addObjectType("appl::BufferManager");
|
||||
}
|
||||
|
||||
appl::BufferManager::~BufferManager(void) {
|
||||
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();
|
||||
}
|
||||
appl::BufferManager::~BufferManager() {
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
|
||||
appl::Buffer* appl::BufferManager::createNewBuffer(void) {
|
||||
appl::Buffer* tmp = new appl::Buffer();
|
||||
ewol::object::Shared<appl::Buffer> appl::BufferManager::createNewBuffer() {
|
||||
ewol::object::Shared<appl::Buffer> tmp = ewol::object::makeShared(new appl::Buffer());
|
||||
if (tmp == NULL) {
|
||||
APPL_ERROR("Can not allocate the Buffer (empty).");
|
||||
return NULL;
|
||||
@@ -50,21 +40,23 @@ appl::Buffer* appl::BufferManager::createNewBuffer(void) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
|
||||
for (int32_t iii = 0; iii < m_list.size(); ++iii) {
|
||||
if (m_list[iii] == NULL) {
|
||||
ewol::object::Shared<appl::Buffer> appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) {
|
||||
APPL_INFO("get(" << _fileName << "," << _createIfNeeded << ")");
|
||||
for (auto &it : m_list) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (m_list[iii]->getFileName() == _fileName) {
|
||||
return m_list[iii];
|
||||
if (it->getFileName() == _fileName) {
|
||||
return it;
|
||||
}
|
||||
}
|
||||
if (_createIfNeeded == true) {
|
||||
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) {
|
||||
APPL_INFO("try open a folder : " << _fileName);
|
||||
APPL_WARNING("try open a folder : " << _fileName);
|
||||
APPL_CRITICAL("plop");
|
||||
return NULL;
|
||||
}
|
||||
appl::Buffer* tmp = new appl::Buffer();
|
||||
ewol::object::Shared<appl::Buffer> tmp = ewol::object::makeShared(new appl::Buffer());
|
||||
if (tmp == NULL) {
|
||||
APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
|
||||
return NULL;
|
||||
@@ -75,31 +67,42 @@ appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _creat
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void appl::BufferManager::setBufferSelected(appl::Buffer* _bufferSelected) {
|
||||
void appl::BufferManager::setBufferSelected(ewol::object::Shared<appl::Buffer> _bufferSelected) {
|
||||
m_bufferSelected = _bufferSelected;
|
||||
sendMultiCast(appl::MsgSelectChange, "");
|
||||
}
|
||||
|
||||
void appl::BufferManager::onObjectRemove(ewol::Object * _removeObject) {
|
||||
if (m_bufferSelected == _removeObject) {
|
||||
void appl::BufferManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::Resource::onObjectRemove(_object);
|
||||
if (m_bufferSelected == _object) {
|
||||
setBufferSelected(NULL);
|
||||
}
|
||||
for (int32_t iii = 0; iii < m_list.size(); ++iii) {
|
||||
if (m_list[iii] != _removeObject) {
|
||||
for (auto it(m_list.begin()); it!=m_list.end(); ++it) {
|
||||
if (*it != _object) {
|
||||
continue;
|
||||
}
|
||||
m_list[iii] = NULL;
|
||||
m_list.erase(m_list.begin()+iii);
|
||||
return;
|
||||
m_list.erase(it);
|
||||
it = m_list.begin();
|
||||
}
|
||||
}
|
||||
|
||||
ewol::object::Shared<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) {
|
||||
for (int32_t iii = 0; iii < m_list.size(); ++iii) {
|
||||
if (m_list[iii] == NULL) {
|
||||
for (auto &it : m_list) {
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (m_list[iii]->getFileName() == _fileName) {
|
||||
if (it->getFileName() == _fileName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -120,15 +123,14 @@ void appl::BufferManager::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_DEBUG("receive message !!! " << _msg);
|
||||
}
|
||||
|
||||
appl::BufferManager* appl::BufferManager::keep(void) {
|
||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
||||
appl::BufferManager* object = static_cast<appl::BufferManager*>(getManager().localKeep("???BufferManager???"));
|
||||
ewol::object::Shared<appl::BufferManager> appl::BufferManager::keep() {
|
||||
ewol::object::Shared<appl::BufferManager> object = ewol::dynamic_pointer_cast<appl::BufferManager>(getManager().localKeep("???BufferManager???"));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
// this element create a new one every time ....
|
||||
EWOL_INFO("CREATE : appl::BufferManager: ???BufferManager???");
|
||||
object = new appl::BufferManager();
|
||||
object = ewol::object::makeShared(new appl::BufferManager());
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ???BufferManager???");
|
||||
return NULL;
|
||||
@@ -137,11 +139,3 @@ appl::BufferManager* appl::BufferManager::keep(void) {
|
||||
return object;
|
||||
}
|
||||
|
||||
void appl::BufferManager::release(appl::BufferManager*& _object) {
|
||||
if (NULL == _object) {
|
||||
return;
|
||||
}
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
||||
getManager().release(object2);
|
||||
_object = NULL;
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#ifndef __BUFFER_MANAGER_H__
|
||||
#define __BUFFER_MANAGER_H__
|
||||
|
||||
#include <list>
|
||||
#include <appl/Buffer.h>
|
||||
#include <appl/globalMsg.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
@@ -17,10 +18,11 @@
|
||||
namespace appl {
|
||||
class BufferManager : public ewol::Resource {
|
||||
protected:
|
||||
BufferManager(void);
|
||||
~BufferManager(void);
|
||||
BufferManager();
|
||||
public:
|
||||
virtual ~BufferManager();
|
||||
private:
|
||||
std::vector<appl::Buffer*> m_list; // list of all buffer curently open
|
||||
std::list<ewol::object::Owner<appl::Buffer>> m_list; // list of all buffer curently open
|
||||
public:
|
||||
/**
|
||||
* @brief Get a specific buffer with his name (can create a new buffer).
|
||||
@@ -28,7 +30,7 @@ namespace appl {
|
||||
* @param[in] _createIfNeeded Create the buffer if not existed.
|
||||
* @return a pointer on the buffer
|
||||
*/
|
||||
appl::Buffer* get(const std::string& _fileName, bool _createIfNeeded=false);
|
||||
ewol::object::Shared<appl::Buffer> get(const std::string& _fileName, bool _createIfNeeded=false);
|
||||
/**
|
||||
* @brief Load a specific file, event if it not existed:
|
||||
* @param[in] _fileName Name of the file to open or create.
|
||||
@@ -44,7 +46,7 @@ namespace appl {
|
||||
* @brief Get count of all buffer availlable.
|
||||
* @return Number of buffer
|
||||
*/
|
||||
int32_t size(void) const {
|
||||
int32_t size() const {
|
||||
return m_list.size();
|
||||
}
|
||||
/**
|
||||
@@ -52,32 +54,30 @@ namespace appl {
|
||||
* @param[in] _id Number of buffer
|
||||
* @return pointer on the buffer
|
||||
*/
|
||||
appl::Buffer* get(int32_t _id) {
|
||||
return m_list[_id];
|
||||
}
|
||||
ewol::object::Shared<appl::Buffer> get(int32_t _id);
|
||||
/**
|
||||
* @brief Create a new buffer empty.
|
||||
* @return Created buffer or NULL.
|
||||
*/
|
||||
appl::Buffer* createNewBuffer(void);
|
||||
ewol::object::Shared<appl::Buffer> createNewBuffer();
|
||||
private:
|
||||
appl::Buffer* m_bufferSelected;
|
||||
ewol::object::Shared<appl::Buffer> m_bufferSelected;
|
||||
public:
|
||||
/**
|
||||
* @brief Set the current buffer selected
|
||||
* @param[in] _bufferSelected Pointer on the buffer selected
|
||||
*/
|
||||
void setBufferSelected(appl::Buffer* _bufferSelected);
|
||||
void setBufferSelected(ewol::object::Shared<appl::Buffer> _bufferSelected);
|
||||
/**
|
||||
* @brief Get the current buffer selected
|
||||
* @return Pointer on the buffer selected
|
||||
*/
|
||||
appl::Buffer* getBufferSelected(void) {
|
||||
ewol::object::Shared<appl::Buffer> getBufferSelected() {
|
||||
return m_bufferSelected;
|
||||
};
|
||||
public: // herited function
|
||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
void onObjectRemove(ewol::Object * _removeObject);
|
||||
void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
public: // resource manager
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
@@ -85,12 +85,7 @@ namespace appl {
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or NULL if an error occured.
|
||||
*/
|
||||
static appl::BufferManager* keep(void);
|
||||
/**
|
||||
* @brief release the keeped resources
|
||||
* @param[in,out] reference on the object pointer
|
||||
*/
|
||||
static void release(appl::BufferManager*& _object);
|
||||
static ewol::object::Shared<appl::BufferManager> keep();
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -44,7 +44,7 @@ void appl::GlyphDecoration::setBold(bool _enable)
|
||||
}
|
||||
}
|
||||
|
||||
etk::CCout& appl::operator <<(etk::CCout& _os, const appl::GlyphDecoration& _obj)
|
||||
std::ostream& appl::operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj)
|
||||
{
|
||||
_os << "{fg=" << _obj.getForeground();
|
||||
_os << ",bg=" << _obj.getBackground();
|
||||
|
@@ -17,7 +17,7 @@ namespace appl {
|
||||
public:
|
||||
// Constructeur
|
||||
GlyphDecoration(const std::string& _newColorName = "no_name");
|
||||
~GlyphDecoration(void) {
|
||||
virtual ~GlyphDecoration() {
|
||||
// nothing to do ...
|
||||
};
|
||||
private:
|
||||
@@ -34,7 +34,7 @@ namespace appl {
|
||||
* @brief Get the color name.
|
||||
* @return The name of the color.
|
||||
*/
|
||||
const std::string& getName(void) const {
|
||||
const std::string& getName() const {
|
||||
return m_colorName;
|
||||
};
|
||||
private:
|
||||
@@ -51,14 +51,14 @@ namespace appl {
|
||||
* @brief Get the foreground color.
|
||||
* @return The color.
|
||||
*/
|
||||
const etk::Color<>& getForeground(void) const {
|
||||
const etk::Color<>& getForeground() const {
|
||||
return m_colorFG;
|
||||
};
|
||||
/**
|
||||
* @brief Get the foreground color status.
|
||||
* @return true if the color is visible.
|
||||
*/
|
||||
bool haveFg(void) const {
|
||||
bool haveFg() const {
|
||||
return m_colorFG.a() != 0;
|
||||
};
|
||||
private:
|
||||
@@ -75,14 +75,14 @@ namespace appl {
|
||||
* @brief Get the background color.
|
||||
* @return The color.
|
||||
*/
|
||||
const etk::Color<>& getBackground(void) const {
|
||||
const etk::Color<>& getBackground() const {
|
||||
return m_colorBG;
|
||||
};
|
||||
/**
|
||||
* @brief Get the background color status.
|
||||
* @return true if the color is visible.
|
||||
*/
|
||||
bool haveBackground(void) const {
|
||||
bool haveBackground() const {
|
||||
return m_colorBG.a()!=0;
|
||||
};
|
||||
private:
|
||||
@@ -97,7 +97,7 @@ namespace appl {
|
||||
* @brief Get the italic status.
|
||||
* @return true if the glyph might be display in italic.
|
||||
*/
|
||||
bool getItalic(void) const {
|
||||
bool getItalic() const {
|
||||
return m_italic;
|
||||
};
|
||||
private:
|
||||
@@ -112,11 +112,11 @@ namespace appl {
|
||||
* @brief Get the bold status.
|
||||
* @return true if the glyph might be display in bold.
|
||||
*/
|
||||
bool getBold(void) const {
|
||||
bool getBold() const {
|
||||
return m_bold;
|
||||
};
|
||||
};
|
||||
etk::CCout& operator <<(etk::CCout& _os, const appl::GlyphDecoration& _obj);
|
||||
std::ostream& operator <<(std::ostream& _os, const appl::GlyphDecoration& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -25,11 +25,11 @@ appl::GlyphPainting::GlyphPainting(const std::string& _filename) :
|
||||
reload();
|
||||
}
|
||||
|
||||
appl::GlyphPainting::~GlyphPainting(void) {
|
||||
appl::GlyphPainting::~GlyphPainting() {
|
||||
|
||||
}
|
||||
|
||||
void appl::GlyphPainting::reload(void) {
|
||||
void appl::GlyphPainting::reload() {
|
||||
ejson::Document doc;
|
||||
if (false == doc.load(m_name)) {
|
||||
APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName());
|
||||
@@ -47,7 +47,7 @@ void appl::GlyphPainting::reload(void) {
|
||||
APPL_ERROR("Can not get basic array : 'ednColor'");
|
||||
return;
|
||||
}
|
||||
for (int32_t iii = 0; iii < baseArray->size(); ++iii) {
|
||||
for (size_t iii = 0; iii < baseArray->size(); ++iii) {
|
||||
ejson::Object* tmpObj = baseArray->getObject(iii);
|
||||
if (tmpObj == NULL) {
|
||||
APPL_DEBUG(" can not get object in 'ednColor' id=" << iii);
|
||||
@@ -60,7 +60,7 @@ void appl::GlyphPainting::reload(void) {
|
||||
bool bold = tmpObj->getBooleanValue("bold", false);
|
||||
APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'");
|
||||
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) {
|
||||
continue;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void appl::GlyphPainting::reload(void) {
|
||||
|
||||
|
||||
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) {
|
||||
return iii;
|
||||
}
|
||||
@@ -95,15 +95,15 @@ int32_t appl::GlyphPainting::request(const std::string& _name) {
|
||||
return m_list.size()-1;
|
||||
}
|
||||
|
||||
appl::GlyphPainting* appl::GlyphPainting::keep(const std::string& _filename) {
|
||||
ewol::object::Shared<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));
|
||||
ewol::object::Shared<appl::GlyphPainting> object = ewol::dynamic_pointer_cast<appl::GlyphPainting>(getManager().localKeep(_filename));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
// this element create a new one every time ....
|
||||
EWOL_INFO("CREATE : appl::GlyphPainting : file : \"" << _filename << "\"");
|
||||
object = new appl::GlyphPainting(_filename);
|
||||
object = ewol::object::makeShared(new appl::GlyphPainting(_filename));
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ??GlyphPainting??");
|
||||
return NULL;
|
||||
@@ -111,13 +111,3 @@ appl::GlyphPainting* appl::GlyphPainting::keep(const std::string& _filename) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -20,12 +20,13 @@ namespace appl {
|
||||
std::vector<appl::GlyphDecoration> m_list;
|
||||
protected:
|
||||
GlyphPainting(const std::string& _filename);
|
||||
virtual ~GlyphPainting(void);
|
||||
public:
|
||||
virtual ~GlyphPainting();
|
||||
public:
|
||||
/**
|
||||
* @brief Load or reload data from config
|
||||
*/
|
||||
void reload(void);
|
||||
void reload();
|
||||
/**
|
||||
* @brief Register a decoration with his name and get the ref id.
|
||||
* @param[in] _name Name of the deco.
|
||||
@@ -55,12 +56,7 @@ namespace appl {
|
||||
* @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);
|
||||
static ewol::object::Shared<appl::GlyphPainting> keep(const std::string& _filename);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -20,12 +20,12 @@
|
||||
static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
|
||||
std::vector<appl::dataBufferStruct *> tmpList = _list;
|
||||
_list.clear();
|
||||
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
||||
for(size_t iii=0; iii<tmpList.size(); iii++) {
|
||||
if (NULL == tmpList[iii]) {
|
||||
continue;
|
||||
}
|
||||
int32_t findPos = 0;
|
||||
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
|
||||
size_t findPos = 0;
|
||||
for(size_t jjj=0; jjj<_list.size(); jjj++) {
|
||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||
if (_list[jjj] == NULL) {
|
||||
continue;
|
||||
@@ -39,7 +39,7 @@ static void SortElementList(std::vector<appl::dataBufferStruct*>& _list) {
|
||||
}
|
||||
}
|
||||
|
||||
BufferView::BufferView(void) :
|
||||
BufferView::BufferView() :
|
||||
m_openOrderMode(false) {
|
||||
addObjectType("appl::BufferView");
|
||||
setCanHaveFocus(true);
|
||||
@@ -63,21 +63,16 @@ BufferView::BufferView(void) :
|
||||
m_colorTextModify = m_paintingProperties->request("textModify");
|
||||
}
|
||||
|
||||
BufferView::~BufferView(void) {
|
||||
BufferView::~BufferView() {
|
||||
removeAllElement();
|
||||
}
|
||||
|
||||
void BufferView::removeAllElement(void) {
|
||||
for(int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (NULL!=m_list[iii]) {
|
||||
delete(m_list[iii]);
|
||||
m_list[iii] = NULL;
|
||||
}
|
||||
void BufferView::removeAllElement() {
|
||||
for(auto &it : m_list) {
|
||||
delete(it);
|
||||
it = NULL;
|
||||
}
|
||||
m_list.clear();
|
||||
if (m_bufferManager != NULL) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
}
|
||||
}
|
||||
|
||||
void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition) {
|
||||
@@ -110,7 +105,7 @@ void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _sel
|
||||
void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
ewol::widget::List::onReceiveMessage(_msg);
|
||||
if (_msg.getMessage() == appl::MsgSelectNewFile) {
|
||||
appl::Buffer* buffer = m_bufferManager->get(_msg.getData());
|
||||
ewol::object::Shared<appl::Buffer> buffer = m_bufferManager->get(_msg.getData());
|
||||
if (buffer == NULL) {
|
||||
APPL_ERROR("event on element nor exist : " << _msg.getData());
|
||||
return;
|
||||
@@ -143,7 +138,7 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
appl::dataBufferStruct* tmp = m_list[iii];
|
||||
m_list[iii] = NULL;
|
||||
m_list.erase(m_list.begin() + iii);
|
||||
insertAlphabetic(tmp, (iii == m_selectedID));
|
||||
insertAlphabetic(tmp, ((int64_t)iii == m_selectedID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -162,12 +157,12 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_DEBUG("message : " << _msg);
|
||||
if (_msg.getMessage() == appl::MsgSelectChange) {
|
||||
m_selectedID = -1;
|
||||
appl::Buffer* tmpBuffer = NULL;
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer;
|
||||
if (m_bufferManager != NULL) {
|
||||
tmpBuffer = m_bufferManager->getBufferSelected();
|
||||
}
|
||||
if (tmpBuffer != NULL) {
|
||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
for (size_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (m_list[iii] == NULL) {
|
||||
continue;
|
||||
}
|
||||
@@ -185,8 +180,8 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
// 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++) {
|
||||
size_t nbBufferOpen = 0; // BufferManager::size();
|
||||
for (size_t iii=0; iii<nbBufferOpen; iii++) {
|
||||
/*
|
||||
if (BufferManager::exist(iii)) {
|
||||
BufferText* tmpBuffer = BufferManager::get(iii);
|
||||
@@ -212,36 +207,39 @@ void BufferView::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
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();
|
||||
for (auto &it : m_list) {
|
||||
if (it != nullptr) {
|
||||
//it->m_isModify = BufferManager::get(it->m_bufferID)->isModify();
|
||||
}
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
void BufferView::onObjectRemove(ewol::Object* _removeObject) {
|
||||
ewol::widget::List::onObjectRemove(_removeObject);
|
||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (m_list[iii] == NULL) {
|
||||
continue;
|
||||
void BufferView::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::widget::List::onObjectRemove(_object);
|
||||
auto it(m_list.begin());
|
||||
while (it != m_list.end()) {
|
||||
if ( *it != nullptr
|
||||
&& (*it)->m_buffer == _object) {
|
||||
m_list.erase(it);
|
||||
markToRedraw();
|
||||
it = m_list.begin();
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
if (m_list[iii]->m_buffer != _removeObject) {
|
||||
continue;
|
||||
}
|
||||
m_list.erase(m_list.begin()+iii);
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
if (m_bufferManager == _object) {
|
||||
m_bufferManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
etk::Color<> BufferView::getBasicBG(void) {
|
||||
etk::Color<> BufferView::getBasicBG() {
|
||||
return (*m_paintingProperties)[m_colorBackground1].getForeground();
|
||||
}
|
||||
|
||||
uint32_t BufferView::getNuberOfColomn(void) {
|
||||
uint32_t BufferView::getNuberOfColomn() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -250,14 +248,14 @@ bool BufferView::getTitle(int32_t _colomn, std::string &_myTitle, etk::Color<> &
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t BufferView::getNuberOfRaw(void) {
|
||||
uint32_t BufferView::getNuberOfRaw() {
|
||||
return m_list.size();
|
||||
}
|
||||
|
||||
bool BufferView::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]) {
|
||||
&& _raw<(int64_t)m_list.size()
|
||||
&& m_list[_raw] != nullptr) {
|
||||
_myTextToWrite = m_list[_raw]->m_bufferName.getNameFile();
|
||||
|
||||
if ( m_list[_raw]->m_buffer != NULL
|
||||
@@ -286,7 +284,7 @@ bool BufferView::onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent
|
||||
if (1 == _IdInput && _typeEvent == ewol::key::statusSingle) {
|
||||
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
if( _raw >= 0
|
||||
&& _raw<m_list.size()
|
||||
&& _raw<(int64_t)m_list.size()
|
||||
&& NULL != m_list[_raw]) {
|
||||
if (m_list[_raw]->m_buffer != NULL) {
|
||||
sendMultiCast(appl::MsgSelectNewFile, m_list[_raw]->m_buffer->getFileName());
|
||||
|
@@ -15,28 +15,25 @@
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/Windows.h>
|
||||
|
||||
namespace appl
|
||||
{
|
||||
class dataBufferStruct
|
||||
{
|
||||
namespace appl {
|
||||
class dataBufferStruct {
|
||||
public:
|
||||
etk::FSNode m_bufferName;
|
||||
appl::Buffer* m_buffer;
|
||||
dataBufferStruct(const std::string& _bufferName, appl::Buffer* _buffer) :
|
||||
ewol::object::Shared<appl::Buffer> m_buffer;
|
||||
dataBufferStruct(const std::string& _bufferName, const ewol::object::Shared<appl::Buffer>& _buffer) :
|
||||
m_bufferName(_bufferName),
|
||||
m_buffer(_buffer) {
|
||||
|
||||
};
|
||||
~dataBufferStruct(void) { };
|
||||
virtual ~dataBufferStruct() { };
|
||||
};
|
||||
};
|
||||
|
||||
class BufferView : public ewol::widget::List
|
||||
{
|
||||
class BufferView : public ewol::widget::List {
|
||||
private:
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
private:
|
||||
appl::GlyphPainting* m_paintingProperties; //!< element painting property
|
||||
ewol::object::Shared<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||
int32_t m_colorBackground1;
|
||||
int32_t m_colorBackground2;
|
||||
int32_t m_colorBackgroundSelect;
|
||||
@@ -53,21 +50,21 @@ class BufferView : public ewol::widget::List
|
||||
void insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _selectNewPosition = false);
|
||||
public:
|
||||
// Constructeur
|
||||
BufferView(void);
|
||||
~BufferView(void);
|
||||
BufferView();
|
||||
virtual ~BufferView();
|
||||
// Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object* _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
private:
|
||||
bool m_openOrderMode; //!< true if the order is the opening order mode, otherwise, Alphabetic order
|
||||
protected:
|
||||
// function call to display the list :
|
||||
virtual etk::Color<> getBasicBG(void);
|
||||
void removeAllElement(void);
|
||||
virtual etk::Color<> getBasicBG();
|
||||
void removeAllElement();
|
||||
// Derived function
|
||||
virtual uint32_t getNuberOfColomn(void);
|
||||
virtual uint32_t getNuberOfColomn();
|
||||
virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
virtual uint32_t getNuberOfRaw(void);
|
||||
virtual uint32_t getNuberOfRaw();
|
||||
virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
virtual bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||
};
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#include <appl/Gui/WorkerCloseAllFile.h>
|
||||
|
||||
namespace appl {
|
||||
std::string getVersion(void) {
|
||||
std::string getVersion() {
|
||||
#define FIRST_YEAR (2010)
|
||||
std::string tmpOutput = std::to_string(date::getYear()-FIRST_YEAR);
|
||||
tmpOutput += ".";
|
||||
@@ -59,11 +59,11 @@ namespace appl {
|
||||
|
||||
class ParameterAboutGui : public ewol::widget::Sizer {
|
||||
public :
|
||||
ParameterAboutGui(void) :
|
||||
ParameterAboutGui() :
|
||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
|
||||
ewol::widget::Spacer* mySpacer = NULL;
|
||||
ewol::object::Shared<ewol::widget::Spacer> mySpacer = NULL;
|
||||
|
||||
mySpacer = new ewol::widget::Spacer();
|
||||
mySpacer = ewol::object::makeShared(new ewol::widget::Spacer());
|
||||
if (NULL == mySpacer) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
@@ -93,7 +93,7 @@ class ParameterAboutGui : public ewol::widget::Sizer {
|
||||
tmpLabel += " libPng, ogg-tremor, portaudio, libZip<br/>";
|
||||
tmpLabel += " tinyXml, freetype, agg2.4, etk<br/>";
|
||||
tmpLabel += "</left>";
|
||||
ewol::widget::Label* myLabel = new ewol::widget::Label(tmpLabel);
|
||||
ewol::object::Shared<ewol::widget::Label> myLabel = ewol::object::makeShared(new ewol::widget::Label(tmpLabel));
|
||||
if (NULL == myLabel) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
@@ -102,7 +102,7 @@ class ParameterAboutGui : public ewol::widget::Sizer {
|
||||
}
|
||||
};
|
||||
|
||||
~ParameterAboutGui(void) {
|
||||
~ParameterAboutGui() {
|
||||
|
||||
};
|
||||
};
|
||||
@@ -119,39 +119,42 @@ const char* l_smoothMax = "tmpEvent_maxChange";
|
||||
#undef __class__
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
MainWindows::MainWindows(void) {
|
||||
MainWindows::MainWindows() {
|
||||
addObjectType("appl::MainWindows");
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
ewol::widget::Sizer * mySizerVert = NULL;
|
||||
ewol::widget::Sizer * mySizerVert2 = NULL;
|
||||
ewol::widget::Sizer * mySizerHori = NULL;
|
||||
//ewol::Button * myButton = NULL;
|
||||
appl::TextViewer * myTextView = NULL;
|
||||
BufferView * myBufferView = NULL;
|
||||
ewol::widget::Menu * myMenu = NULL;
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerVert = NULL;
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerVert2 = NULL;
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerHori = NULL;
|
||||
ewol::object::Shared<appl::TextViewer> myTextView = NULL;
|
||||
ewol::object::Shared<BufferView> myBufferView = NULL;
|
||||
ewol::object::Shared<ewol::widget::Menu> myMenu = NULL;
|
||||
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
|
||||
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert);
|
||||
mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
mySizerVert->setName("plop 1111111");
|
||||
setSubWidget(mySizerVert);
|
||||
|
||||
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
|
||||
mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
|
||||
mySizerHori->setName("plop 222222222");
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
myBufferView = new BufferView();
|
||||
myBufferView = ewol::object::makeShared(new BufferView());
|
||||
myBufferView->setName("plop 3333333");
|
||||
myBufferView->setExpand(bvec2(false,true));
|
||||
myBufferView->setFill(bvec2(true,true));
|
||||
mySizerHori->subWidgetAdd(myBufferView);
|
||||
|
||||
mySizerVert2 = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert);
|
||||
mySizerVert2 = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
mySizerHori->subWidgetAdd(mySizerVert2);
|
||||
|
||||
mySizerVert2->setName("plop 4444444");
|
||||
// main buffer Area :
|
||||
#if defined(__TARGET_OS__Android)
|
||||
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16);
|
||||
myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 16));
|
||||
#else
|
||||
myTextView = new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11);
|
||||
myTextView = ewol::object::makeShared(new appl::TextViewer("FreeMono;DejaVuSansMono;FreeSerif", 11));
|
||||
#endif
|
||||
myTextView->setName("appl-text-viewer");
|
||||
myTextView->setExpand(bvec2(true,true));
|
||||
myTextView->setFill(bvec2(true,true));
|
||||
mySizerVert2->subWidgetAdd(myTextView);
|
||||
@@ -162,90 +165,63 @@ MainWindows::MainWindows(void) {
|
||||
mySizerVert2->subWidgetAdd(myTextView);
|
||||
*/
|
||||
// search area :
|
||||
Search * mySearch = new Search();
|
||||
ewol::object::Shared<appl::widget::Search> mySearch = ewol::object::makeShared(new appl::widget::Search());
|
||||
mySizerVert2->subWidgetAdd(mySearch);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
{
|
||||
ewol::widget::Sizer * mySizerHori2 = new widget::Sizer(ewol::widget::Sizer::modeHori);
|
||||
mySizerVert2->subWidgetAdd(mySizerHori2);
|
||||
|
||||
ewol::widget::CheckBox* tmpCheck = new widget::CheckBox("smooth");
|
||||
mySizerHori2->subWidgetAdd(tmpCheck);
|
||||
tmpCheck->registerOnEvent(this, "clicked", l_smoothChick);
|
||||
|
||||
ewol::widget::Slider* tmpSlider = new widget::Slider();
|
||||
mySizerHori2->subWidgetAdd(tmpSlider);
|
||||
tmpSlider->registerOnEvent(this, "change", l_smoothMin);
|
||||
tmpSlider->setExpand(bvec2(true,false));
|
||||
tmpSlider->setMin(0);
|
||||
tmpSlider->setMax(1000);
|
||||
tmpSlider->setValue(0450);
|
||||
tmpSliderMin = tmpSlider;
|
||||
|
||||
tmpSlider = new ewol::widget::Slider();
|
||||
mySizerHori2->subWidgetAdd(tmpSlider);
|
||||
tmpSlider->registerOnEvent(this, "change", l_smoothMax);
|
||||
tmpSlider->setExpand(bvec2(true,false));
|
||||
tmpSlider->setMin(0);
|
||||
tmpSlider->setMax(1000);
|
||||
tmpSlider->setValue(0550);
|
||||
tmpSliderMax = tmpSlider;
|
||||
}
|
||||
#endif
|
||||
|
||||
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
|
||||
mySizerHori = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeHori));
|
||||
mySizerHori->setName("plop 555555");
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
|
||||
myMenu = new ewol::widget::Menu();
|
||||
myMenu = ewol::object::makeShared(new ewol::widget::Menu());
|
||||
mySizerHori->subWidgetAdd(myMenu);
|
||||
int32_t idMenuFile = myMenu->addTitle("File");
|
||||
(void)myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", ednMsgGuiOpen);
|
||||
(void)myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", ednMsgGuiClose, "current");
|
||||
(void)myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
|
||||
(void)myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", ednMsgGuiSave, "current");
|
||||
(void)myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
|
||||
(void)myMenu->addSpacer();
|
||||
//(void)myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit);
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", ednMsgProperties);
|
||||
myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
|
||||
myMenu->addSpacer();
|
||||
myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.edf", ednMsgGuiOpen);
|
||||
myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.edf", ednMsgGuiClose, "current");
|
||||
myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
|
||||
myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.edf", ednMsgGuiSave, "current");
|
||||
myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
|
||||
myMenu->addSpacer();
|
||||
//myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit);
|
||||
myMenu->addSpacer();
|
||||
myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.edf", ednMsgProperties);
|
||||
int32_t idMenuEdit = myMenu->addTitle("Edit");
|
||||
(void)myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", ednMsgGuiUndo);
|
||||
(void)myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", ednMsgGuiRedo);
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
|
||||
(void)myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
|
||||
(void)myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
|
||||
(void)myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
|
||||
(void)myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
|
||||
(void)myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
|
||||
myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", ednMsgGuiUndo);
|
||||
myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", ednMsgGuiRedo);
|
||||
myMenu->addSpacer();
|
||||
myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
|
||||
myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
|
||||
myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
|
||||
myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
|
||||
myMenu->addSpacer();
|
||||
myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
|
||||
myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
|
||||
myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
|
||||
int32_t idMenuSearch = myMenu->addTitle("Search");
|
||||
(void)myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", ednMsgGuiSearch);
|
||||
(void)myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", ednMsgGuiReplace);
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
|
||||
(void)myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
|
||||
(void)myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
|
||||
(void)myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
|
||||
myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.edf", ednMsgGuiSearch);
|
||||
myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.edf", ednMsgGuiReplace);
|
||||
myMenu->addSpacer();
|
||||
myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
|
||||
myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
|
||||
myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
|
||||
myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
|
||||
/* ==> must be in the pluggin list control ...
|
||||
int32_t idMenuCTags = myMenu->addTitle("C-tags");
|
||||
(void)myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
|
||||
(void)myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
|
||||
(void)myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
|
||||
(void)myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
|
||||
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");
|
||||
(void)myMenu->add(idMenugDisplay, "Color Black", "", appl::MsgNameGuiChangeColor, "color/black/");
|
||||
(void)myMenu->add(idMenugDisplay, "Color White", "", appl::MsgNameGuiChangeColor, "color/white/");
|
||||
(void)myMenu->add(idMenugDisplay, "Shape square", "", l_MsgNameGuiChangeShape, "shape/square/");
|
||||
(void)myMenu->add(idMenugDisplay, "Shape round", "", l_MsgNameGuiChangeShape, "shape/round/");
|
||||
(void)myMenu->addSpacer();
|
||||
(void)myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
|
||||
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 = ewol::object::makeShared(new ewol::widget::Label("FileName"));
|
||||
m_widgetLabelFileName->setExpand(bvec2(true,false));
|
||||
m_widgetLabelFileName->setFill(bvec2(true,false));;
|
||||
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
|
||||
@@ -291,8 +267,8 @@ MainWindows::MainWindows(void) {
|
||||
}
|
||||
|
||||
|
||||
MainWindows::~MainWindows(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
MainWindows::~MainWindows() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -318,7 +294,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
return;
|
||||
}
|
||||
// Get a ref on the buffer selected (if null, no buffer was selected ...)
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->getBufferSelected();
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->getBufferSelected();
|
||||
if (tmpBuffer != NULL) {
|
||||
etk::FSNode tmpFile = tmpBuffer->getFileName();
|
||||
tmpWidget->setFolder(tmpFile.getNameFolder());
|
||||
@@ -328,20 +304,51 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
tmpWidget->registerOnEvent(this, "validate", ednEventPopUpFileSelected);
|
||||
} else if (_msg.getMessage() == ednMsgProperties) {
|
||||
// Request the parameter GUI
|
||||
ewol::widget::Parameter* tmpWidget = new ewol::widget::Parameter();
|
||||
ewol::object::Shared<ewol::widget::Parameter> tmpWidget = ewol::object::makeShared(new ewol::widget::Parameter());
|
||||
if (NULL == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
#ifdef SDGSDFGSDFGSDFGSDFGSTERGDHFGHFDS
|
||||
std::string menuDescription = "<title>Properties</title>\n";
|
||||
menuDescription += "<group>\n";
|
||||
menuDescription += " <title>Editor</title>\n";
|
||||
menuDescription += " <menu>\n";
|
||||
menuDescription += " <title>Editor Interface</title>\n";
|
||||
menuDescription += " <short-title>Editor</short-title>\n";
|
||||
menuDescription += " <widget>appl-text-viewer</widget>\n";
|
||||
menuDescription += " </menu>\n";
|
||||
menuDescription += "</group>\n";
|
||||
menuDescription += "<group>\n";
|
||||
menuDescription += " <title>Gui</title>\n";
|
||||
menuDescription += " <menu>\n";
|
||||
menuDescription += " <title>Font selection</title>\n";
|
||||
menuDescription += " <short-title>Font</short-title>\n";
|
||||
menuDescription += " <widget></widget>\n";
|
||||
menuDescription += " </menu>\n";
|
||||
menuDescription += " <menu>\n";
|
||||
menuDescription += " <title>Color selection</title>\n";
|
||||
menuDescription += " <short-title>Color</short-title>\n";
|
||||
menuDescription += " <widget></widget>\n";
|
||||
menuDescription += " </menu>\n";
|
||||
menuDescription += " <menu>\n";
|
||||
menuDescription += " <title>Theme selection</title>\n";
|
||||
menuDescription += " <short-title>Theme</short-title>\n";
|
||||
menuDescription += " <widget></widget>\n";
|
||||
menuDescription += " </menu>\n";
|
||||
menuDescription += "</group>\n";
|
||||
|
||||
tmpWidget->setMenu(menuDescription);
|
||||
#endif
|
||||
tmpWidget->setTitle("Properties");
|
||||
popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->menuAddGroup("Editor");
|
||||
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
|
||||
ewol::object::Shared<ewol::Widget> tmpSubWidget = ewol::object::makeShared(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();
|
||||
tmpSubWidget = ewol::object::makeShared(new ParameterAboutGui());
|
||||
tmpWidget->menuAdd("About", "", tmpSubWidget);
|
||||
}
|
||||
} else if (_msg.getMessage() == appl::MsgNameGuiChangeColor) {
|
||||
@@ -368,7 +375,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
|| _msg.getMessage() == appl::Buffer::eventIsSave
|
||||
|| _msg.getMessage() == appl::Buffer::eventChangeName) {
|
||||
// select a new Buffer ==> change title:
|
||||
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
|
||||
ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == NULL) {
|
||||
setTitle("Edn");
|
||||
if (m_widgetLabelFileName != NULL) {
|
||||
@@ -380,44 +387,45 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
tmpp->registerOnEvent(this, appl::Buffer::eventIsSave);
|
||||
tmpp->registerOnEvent(this, appl::Buffer::eventChangeName);
|
||||
}
|
||||
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + tmpp->getFileName());
|
||||
std::string nameFileSystem = etk::FSNode(tmpp->getFileName()).getFileSystemName();
|
||||
setTitle(std::string("Edn : ") + (tmpp->isModify()==true?" *":"") + nameFileSystem);
|
||||
if (m_widgetLabelFileName != NULL) {
|
||||
m_widgetLabelFileName->setLabel(tmpp->getFileName() + (tmpp->isModify()==true?" *":""));
|
||||
m_widgetLabelFileName->setLabel(nameFileSystem + (tmpp->isModify()==true?" *":""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (_msg.getMessage() == ednMsgGuiNew) {
|
||||
(void)m_bufferManager->createNewBuffer();
|
||||
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") {
|
||||
appl::WorkerSaveFile* tmpWorker = new appl::WorkerSaveFile("", false);
|
||||
new appl::WorkerSaveFile("", false);
|
||||
return;
|
||||
} else if (std::tolower(_msg.getData()) == "all") {
|
||||
appl::WorkerSaveAllFile* tmpWorker = new appl::WorkerSaveAllFile();
|
||||
new appl::WorkerSaveAllFile();
|
||||
return;
|
||||
} else {
|
||||
APPL_ERROR("UNKNOW request : " << _msg);
|
||||
}
|
||||
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
|
||||
appl::WorkerSaveFile* tmpWorker = new appl::WorkerSaveFile("", true);
|
||||
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") {
|
||||
appl::WorkerCloseFile* tmpWorker = new appl::WorkerCloseFile("");
|
||||
new appl::WorkerCloseFile("");
|
||||
} else {
|
||||
appl::WorkerCloseAllFile* tmpWorker = new appl::WorkerCloseAllFile();
|
||||
new appl::WorkerCloseAllFile();
|
||||
}
|
||||
} else if (_msg.getMessage() == mainWindowsRequestSaveFile) { // return after a choice of close...
|
||||
if (m_bufferManager->exist(_msg.getData()) == false) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||
return;
|
||||
}
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == NULL) {
|
||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||
return;
|
||||
@@ -436,7 +444,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||
return;
|
||||
}
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == NULL) {
|
||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||
return;
|
||||
@@ -447,7 +455,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << _msg.getData());
|
||||
return;
|
||||
}
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(_msg.getData());
|
||||
if (tmpBuffer == NULL) {
|
||||
APPL_ERROR("Error to get the buffer : " << _msg.getData());
|
||||
return;
|
||||
@@ -458,7 +466,7 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
return;
|
||||
}
|
||||
|
||||
void MainWindows::saveAsPopUp(appl::Buffer* _buffer) {
|
||||
void MainWindows::saveAsPopUp(const ewol::object::Shared<appl::Buffer>& _buffer) {
|
||||
if (_buffer == NULL) {
|
||||
APPL_ERROR("Call With NULL input...");
|
||||
return;
|
||||
@@ -466,19 +474,19 @@ void MainWindows::saveAsPopUp(appl::Buffer* _buffer) {
|
||||
appl::WorkerSaveFile* tmpObject = new appl::WorkerSaveFile(_buffer->getFileName());
|
||||
}
|
||||
|
||||
void MainWindows::closeNotSavedFile(appl::Buffer* _buffer) {
|
||||
void MainWindows::closeNotSavedFile(const ewol::object::Shared<appl::Buffer>& _buffer) {
|
||||
if (_buffer == NULL) {
|
||||
APPL_ERROR("Call With NULL input...");
|
||||
return;
|
||||
}
|
||||
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp();
|
||||
ewol::object::Shared<ewol::widget::StdPopUp> tmpPopUp = ewol::object::makeShared(new ewol::widget::StdPopUp());
|
||||
if (tmpPopUp == NULL) {
|
||||
APPL_ERROR("Can not create a simple pop-up");
|
||||
return;
|
||||
}
|
||||
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
|
||||
tmpPopUp->setComment("The file named : <i>\"" + _buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
|
||||
ewol::Widget* bt = NULL;
|
||||
ewol::object::Shared<ewol::Widget> bt = NULL;
|
||||
if (_buffer->hasFileName() == true) {
|
||||
bt = tmpPopUp->addButton("Save", true);
|
||||
if (bt != NULL) {
|
||||
@@ -502,7 +510,7 @@ void MainWindows::closeNotSavedFile(appl::Buffer* _buffer) {
|
||||
popUpWidgetPush(tmpPopUp);
|
||||
}
|
||||
|
||||
void MainWindows::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void MainWindows::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::widget::Windows::onObjectRemove(_removeObject);
|
||||
if (m_widgetLabelFileName == _removeObject) {
|
||||
m_widgetLabelFileName = NULL;
|
||||
|
@@ -19,27 +19,26 @@
|
||||
|
||||
class MainWindows : public ewol::widget::Windows {
|
||||
private:
|
||||
int32_t m_currentSavingAsIdBuffer;
|
||||
ewol::widget::Label* m_widgetLabelFileName;
|
||||
ewol::object::Shared<ewol::widget::Label> m_widgetLabelFileName;
|
||||
public:
|
||||
// Constructeur
|
||||
MainWindows(void);
|
||||
~MainWindows(void);
|
||||
MainWindows();
|
||||
virtual ~MainWindows();
|
||||
private:
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
/**
|
||||
* @brief Display a pop-up to the select the name of the file.
|
||||
* @param[in] _buffer Buffer that might be saved with a new name.
|
||||
*/
|
||||
void saveAsPopUp(appl::Buffer* _buffer);
|
||||
void saveAsPopUp(const ewol::object::Shared<appl::Buffer>& _buffer);
|
||||
/**
|
||||
* @brief Display a pop-up to the user to confirm wat he want to do when he close a file not saved.
|
||||
* @param[in] _buffer Buffer that might be close.
|
||||
*/
|
||||
void closeNotSavedFile(appl::Buffer* _buffer);
|
||||
void closeNotSavedFile(const ewol::object::Shared<appl::Buffer>& _buffer);
|
||||
public: // Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -28,7 +28,7 @@ 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(void) :
|
||||
appl::widget::Search::Search() :
|
||||
ewol::widget::Composer(ewol::widget::Composer::file, "DATA:GUI-Search.xml"),
|
||||
m_viewerManager(NULL),
|
||||
m_forward(true),
|
||||
@@ -36,8 +36,8 @@ Search::Search(void) :
|
||||
m_wrap(true),
|
||||
m_searchEntry(NULL),
|
||||
m_replaceEntry(NULL) {
|
||||
addObjectType("appl::Search");
|
||||
// load buffer manager:
|
||||
addObjectType("appl::widget::Search");
|
||||
// load buffer manager:onObjectRemove
|
||||
m_viewerManager = appl::ViewerManager::keep();
|
||||
// link event
|
||||
registerOnEventNameWidget(this, "SEARCH:close", "pressed", l_eventHideBt);
|
||||
@@ -55,24 +55,24 @@ Search::Search(void) :
|
||||
setConfigNamed("SEARCH:wrap", "value", std::to_string(m_wrap));
|
||||
setConfigNamed("SEARCH:up-down", "value", std::to_string(m_forward));
|
||||
// get widget
|
||||
m_searchEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:search-entry"));
|
||||
m_replaceEntry = dynamic_cast<ewol::widget::Entry*>(getWidgetNamed("SEARCH:replace-entry"));
|
||||
m_searchEntry = ewol::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:search-entry"));
|
||||
m_replaceEntry = ewol::dynamic_pointer_cast<ewol::widget::Entry>(getWidgetNamed("SEARCH:replace-entry"));
|
||||
// Display and hide event:
|
||||
registerMultiCast(ednMsgGuiSearch);
|
||||
// basicly hiden ...
|
||||
hide();
|
||||
}
|
||||
|
||||
Search::~Search(void) {
|
||||
appl::ViewerManager::release(m_viewerManager);
|
||||
appl::widget::Search::~Search() {
|
||||
|
||||
}
|
||||
|
||||
void Search::find(void) {
|
||||
void appl::widget::Search::find() {
|
||||
if (m_viewerManager == NULL) {
|
||||
APPL_WARNING("No viewer manager selected!!!");
|
||||
return;
|
||||
}
|
||||
appl::TextViewer* viewer = m_viewerManager->getViewerSelected();
|
||||
ewol::object::Shared<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||
if (viewer == NULL) {
|
||||
APPL_INFO("No viewer selected!!!");
|
||||
return;
|
||||
@@ -103,12 +103,12 @@ void Search::find(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void Search::replace(void) {
|
||||
void appl::widget::Search::replace() {
|
||||
if (m_viewerManager == NULL) {
|
||||
APPL_WARNING("No viewer manager selected!!!");
|
||||
return;
|
||||
}
|
||||
appl::TextViewer* viewer = m_viewerManager->getViewerSelected();
|
||||
ewol::object::Shared<appl::TextViewer> viewer = m_viewerManager->getViewerSelected();
|
||||
if (viewer == NULL) {
|
||||
APPL_INFO("No viewer selected!!!");
|
||||
return;
|
||||
@@ -121,7 +121,7 @@ void Search::replace(void) {
|
||||
}
|
||||
|
||||
|
||||
void Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
void appl::widget::Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
ewol::widget::Composer::onReceiveMessage(_msg);
|
||||
APPL_INFO("Search receive message : " << _msg);
|
||||
if ( _msg.getMessage() == l_eventSearchEntry) {
|
||||
@@ -162,16 +162,16 @@ void Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void Search::onObjectRemove(ewol::Object * _removeObject) {
|
||||
ewol::widget::Composer::onObjectRemove(_removeObject);
|
||||
if (_removeObject == m_searchEntry) {
|
||||
m_searchEntry = NULL;
|
||||
void appl::widget::Search::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
ewol::widget::Composer::onObjectRemove(_object);
|
||||
if (_object == m_searchEntry) {
|
||||
m_searchEntry.reset();
|
||||
}
|
||||
if (_removeObject == m_replaceEntry) {
|
||||
m_replaceEntry = NULL;
|
||||
if (_object == m_replaceEntry) {
|
||||
m_replaceEntry.reset();
|
||||
}
|
||||
if (_removeObject == m_viewerManager) {
|
||||
m_viewerManager = NULL;
|
||||
if (_object == m_viewerManager) {
|
||||
m_viewerManager.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -14,35 +14,37 @@
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <appl/Buffer.h>
|
||||
#include <appl/Gui/ViewerManager.h>
|
||||
|
||||
class Search : public ewol::widget::Composer {
|
||||
private:
|
||||
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager
|
||||
bool m_forward;
|
||||
bool m_caseSensitive;
|
||||
bool m_wrap;
|
||||
ewol::widget::Entry* m_searchEntry;
|
||||
ewol::widget::Entry* m_replaceEntry;
|
||||
std::u32string m_searchData;
|
||||
std::u32string m_replaceData;
|
||||
public:
|
||||
// Constructeur
|
||||
Search(void);
|
||||
~Search(void);
|
||||
private:
|
||||
/**
|
||||
* @brief Find the next element that corespond at the search
|
||||
*/
|
||||
void find(void);
|
||||
/**
|
||||
* @brief Replace the current selected text.
|
||||
*/
|
||||
void replace(void);
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
namespace appl {
|
||||
namespace widget {
|
||||
class Search : public ewol::widget::Composer {
|
||||
private:
|
||||
ewol::object::Shared<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||
bool m_forward;
|
||||
bool m_caseSensitive;
|
||||
bool m_wrap;
|
||||
ewol::object::Shared<ewol::widget::Entry> m_searchEntry;
|
||||
ewol::object::Shared<ewol::widget::Entry> m_replaceEntry;
|
||||
std::u32string m_searchData;
|
||||
std::u32string m_replaceData;
|
||||
public:
|
||||
// Constructeur
|
||||
Search();
|
||||
virtual ~Search();
|
||||
private:
|
||||
/**
|
||||
* @brief Find the next element that corespond at the search
|
||||
*/
|
||||
void find();
|
||||
/**
|
||||
* @brief Replace the current selected text.
|
||||
*/
|
||||
void replace();
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -16,29 +16,35 @@ extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-
|
||||
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
|
||||
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||
|
||||
appl::TagFileList::TagFileList(void) {
|
||||
appl::TagFileList::TagFileList() {
|
||||
addObjectType("appl::TagFileList");
|
||||
m_selectedLine = -1;
|
||||
addEventId(applEventCtagsListSelect);
|
||||
addEventId(applEventCtagsListValidate);
|
||||
setMouseLimit(1);
|
||||
}
|
||||
|
||||
|
||||
appl::TagFileList::~TagFileList(void) {
|
||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||
if (NULL != m_list[iii]) {
|
||||
delete(m_list[iii]);
|
||||
m_list[iii] = NULL;
|
||||
}
|
||||
// Load color properties: (use file list to be generic ...)
|
||||
m_colorProperty = ewol::resource::ColorFile::keep("THEME:COLOR:ListFileSystem.json");
|
||||
if (m_colorProperty != NULL) {
|
||||
m_colorIdText = m_colorProperty->request("text");
|
||||
m_colorIdBackground1 = m_colorProperty->request("background1");
|
||||
m_colorIdBackground2 = m_colorProperty->request("background2");
|
||||
m_colorIdBackgroundSelected = m_colorProperty->request("selected");
|
||||
}
|
||||
}
|
||||
|
||||
etk::Color<> appl::TagFileList::getBasicBG(void) {
|
||||
|
||||
appl::TagFileList::~TagFileList() {
|
||||
for (auto &it : m_list) {
|
||||
delete(it);
|
||||
it = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
etk::Color<> appl::TagFileList::getBasicBG() {
|
||||
return 0x00000010;
|
||||
}
|
||||
|
||||
uint32_t appl::TagFileList::getNuberOfColomn(void) {
|
||||
uint32_t appl::TagFileList::getNuberOfColomn() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -47,12 +53,12 @@ bool appl::TagFileList::getTitle(int32_t _colomn, std::string& _myTitle, etk::Co
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t appl::TagFileList::getNuberOfRaw(void) {
|
||||
uint32_t appl::TagFileList::getNuberOfRaw() {
|
||||
return m_list.size();
|
||||
}
|
||||
|
||||
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() && NULL != m_list[_raw]) {
|
||||
if (0 == _colomn) {
|
||||
_myTextToWrite = std::to_string(m_list[_raw]->fileLine);
|
||||
} else {
|
||||
@@ -61,26 +67,14 @@ bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _
|
||||
} else {
|
||||
_myTextToWrite = "ERROR";
|
||||
}
|
||||
_fg = etk::color::black;
|
||||
_fg = m_colorProperty->get(m_colorIdText);
|
||||
if (_raw % 2) {
|
||||
if (_colomn%2 == 0) {
|
||||
_bg = 0xFFFFFF00;
|
||||
} else {
|
||||
_bg = 0xFFFFFF10;
|
||||
}
|
||||
_bg = m_colorProperty->get(m_colorIdBackground1);
|
||||
} else {
|
||||
if (_colomn%2 == 0) {
|
||||
_bg = 0xBFBFBFFF;
|
||||
} else {
|
||||
_bg = 0xCFCFCFFF;
|
||||
}
|
||||
_bg = m_colorProperty->get(m_colorIdBackground2);
|
||||
}
|
||||
if (m_selectedLine == _raw) {
|
||||
if (_colomn%2 == 0) {
|
||||
_bg = 0x8F8FFFFF;
|
||||
} else {
|
||||
_bg = 0x7F7FFFFF;
|
||||
}
|
||||
_bg = m_colorProperty->get(m_colorIdBackgroundSelected);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -91,7 +85,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
||||
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||
if (_IdInput == 1) {
|
||||
int32_t previousRaw = m_selectedLine;
|
||||
if (_raw > m_list.size() ) {
|
||||
if (_raw > (int64_t)m_list.size() ) {
|
||||
m_selectedLine = -1;
|
||||
} else {
|
||||
m_selectedLine = _raw;
|
||||
@@ -101,7 +95,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::key::status _ty
|
||||
event = applEventCtagsListSelect;
|
||||
}
|
||||
if( m_selectedLine >= 0
|
||||
&& m_selectedLine < m_list.size()
|
||||
&& m_selectedLine < (int64_t)m_list.size()
|
||||
&& NULL != m_list[m_selectedLine] ) {
|
||||
generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||
} else {
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/resource/ColorFile.h>
|
||||
|
||||
|
||||
extern const char * const applEventCtagsListSelect;
|
||||
@@ -27,7 +28,7 @@ namespace appl {
|
||||
fileLine(_line) {
|
||||
|
||||
};
|
||||
~TagListElement(void) {
|
||||
virtual ~TagListElement() {
|
||||
|
||||
};
|
||||
};
|
||||
@@ -35,14 +36,20 @@ namespace appl {
|
||||
private:
|
||||
int32_t m_selectedLine;
|
||||
std::vector<appl::TagListElement*> m_list;
|
||||
protected:
|
||||
ewol::object::Shared<ewol::resource::ColorFile> m_colorProperty; //!< theme color property.
|
||||
int32_t m_colorIdText; //!< Color of the text.
|
||||
int32_t m_colorIdBackground1; //!< Color of the Background.
|
||||
int32_t m_colorIdBackground2; //!< Color of the Background 2.
|
||||
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
||||
public:
|
||||
TagFileList(void);
|
||||
~TagFileList(void);
|
||||
TagFileList();
|
||||
virtual ~TagFileList();
|
||||
// display API :
|
||||
virtual etk::Color<> getBasicBG(void);
|
||||
uint32_t getNuberOfColomn(void);
|
||||
virtual etk::Color<> getBasicBG();
|
||||
uint32_t getNuberOfColomn();
|
||||
bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
uint32_t getNuberOfRaw(void);
|
||||
uint32_t getNuberOfRaw();
|
||||
bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||
bool onItemEvent(int32_t _IdInput, enum ewol::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||
public:
|
||||
|
@@ -30,18 +30,14 @@ extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
||||
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||
|
||||
|
||||
appl::TagFileSelection::TagFileSelection(void) {
|
||||
appl::TagFileSelection::TagFileSelection() {
|
||||
addObjectType("appl::TagFileSelection");
|
||||
addEventId(applEventctagsSelection);
|
||||
addEventId(applEventctagsCancel);
|
||||
|
||||
ewol::widget::Label* myWidgetTitle = NULL;
|
||||
ewol::widget::Button* myWidgetValidate = NULL;
|
||||
ewol::widget::Button* myWidgetCancel = NULL;
|
||||
ewol::object::Shared<ewol::widget::Label> myWidgetTitle;
|
||||
|
||||
ewol::widget::Sizer * mySizerVert = NULL;
|
||||
ewol::widget::Sizer * mySizerHori = NULL;
|
||||
ewol::widget::Spacer * mySpacer = NULL;
|
||||
ewol::object::Shared<ewol::widget::Sizer> mySizerVert;
|
||||
#if defined(__TARGET_OS__Android)
|
||||
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
|
||||
#elif defined(__TARGET_OS__Windows)
|
||||
@@ -50,7 +46,7 @@ appl::TagFileSelection::TagFileSelection(void) {
|
||||
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
|
||||
#endif
|
||||
|
||||
mySizerVert = new ewol::widget::Sizer(ewol::widget::Sizer::modeVert);
|
||||
mySizerVert = ewol::object::makeShared(new ewol::widget::Sizer(ewol::widget::Sizer::modeVert));
|
||||
if (NULL == mySizerVert) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
@@ -58,7 +54,7 @@ appl::TagFileSelection::TagFileSelection(void) {
|
||||
mySizerVert->setExpand(bvec2(true,true));
|
||||
// set it in the pop-up-system :
|
||||
setSubWidget(mySizerVert);
|
||||
ewol::widget::Composer* compose = new ewol::widget::Composer(ewol::widget::Composer::String,
|
||||
ewol::object::Shared<ewol::widget::Composer> compose = ewol::object::makeShared(new ewol::widget::Composer(ewol::widget::Composer::String,
|
||||
"<sizer mode=\"hori\" expand=\"true,false\" lock=\"false,true\">\n"
|
||||
" <spacer expand=\"true,false\"/>\n"
|
||||
" <button name=\"PLUGIN-CTAGS-jump\" expand=\"false\" fill=\"true\">"
|
||||
@@ -73,14 +69,14 @@ appl::TagFileSelection::TagFileSelection(void) {
|
||||
" <label>Cancel</label>\n"
|
||||
" </sizer>\n"
|
||||
" </button>\n"
|
||||
"</sizer>\n");
|
||||
"</sizer>\n"));
|
||||
compose->setExpand(bvec2(true,false));
|
||||
compose->setFill(bvec2(true,true));
|
||||
mySizerVert->subWidgetAdd(compose);
|
||||
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-jump", "pressed", applEventctagsSelection);
|
||||
compose->registerOnEventNameWidget(this, "PLUGIN-CTAGS-cancel", "pressed", applEventctagsCancel);
|
||||
|
||||
m_listTag = new appl::TagFileList();
|
||||
m_listTag = ewol::object::makeShared(new appl::TagFileList());
|
||||
if (NULL == m_listTag) {
|
||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
@@ -102,7 +98,7 @@ appl::TagFileSelection::TagFileSelection(void) {
|
||||
}
|
||||
|
||||
|
||||
appl::TagFileSelection::~TagFileSelection(void) {
|
||||
appl::TagFileSelection::~TagFileSelection() {
|
||||
|
||||
}
|
||||
|
||||
@@ -143,7 +139,7 @@ void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TagFileSelection::onObjectRemove(ewol::Object * _removeObject) {
|
||||
void appl::TagFileSelection::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
// First step call parrent :
|
||||
ewol::widget::PopUp::onObjectRemove(_removeObject);
|
||||
// second step find if in all the elements ...
|
||||
|
@@ -19,11 +19,11 @@ extern const char * const applEventctagsCancel;
|
||||
namespace appl {
|
||||
class TagFileSelection : public ewol::widget::PopUp {
|
||||
private:
|
||||
appl::TagFileList* m_listTag;
|
||||
ewol::object::Shared<appl::TagFileList> m_listTag;
|
||||
std::string m_eventNamed;
|
||||
public:
|
||||
TagFileSelection(void);
|
||||
virtual ~TagFileSelection(void);
|
||||
TagFileSelection();
|
||||
virtual ~TagFileSelection();
|
||||
/**
|
||||
* @brief add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
@@ -32,7 +32,7 @@ namespace appl {
|
||||
void addCtagsNewItem(std::string file, int32_t line);
|
||||
public: // herited function
|
||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
void onObjectRemove(ewol::Object * _removeObject);
|
||||
void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -29,7 +29,6 @@
|
||||
APPL_DEBUG(comment << (float)((float)processTimeLocal / 1000.0) << "ms");
|
||||
|
||||
appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
||||
m_buffer(NULL),
|
||||
m_displayText(_fontName, _fontSize),
|
||||
m_insertMode(false) {
|
||||
addObjectType("appl::TextViewer");
|
||||
@@ -41,6 +40,7 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
||||
registerMultiCast(appl::MsgSelectNewFile);
|
||||
registerMultiCast(appl::MsgSelectGotoLineSelect);
|
||||
setLimitScrolling(0.2);
|
||||
setSingleFinger(false);
|
||||
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
@@ -62,11 +62,20 @@ appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) :
|
||||
setCurrentSelect();
|
||||
}
|
||||
|
||||
appl::TextViewer::~TextViewer(void) {
|
||||
appl::TextViewer::~TextViewer() {
|
||||
appl::textPluginManager::disconnect(*this);
|
||||
appl::GlyphPainting::release(m_paintingProperties);
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::ViewerManager::release(m_viewerManager);
|
||||
}
|
||||
|
||||
std::string appl::TextViewer::getBufferPath() {
|
||||
if (m_buffer == NULL) {
|
||||
return "";
|
||||
}
|
||||
std::string filename = m_buffer->getFileName();
|
||||
size_t pos = filename.rfind('/');
|
||||
if (pos == std::string::npos) {
|
||||
return "";
|
||||
}
|
||||
return std::string(filename, 0, pos);
|
||||
}
|
||||
|
||||
void appl::TextViewer::changeZoom(float _range) {
|
||||
@@ -74,19 +83,19 @@ void appl::TextViewer::changeZoom(float _range) {
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
bool appl::TextViewer::calculateMinSize(void) {
|
||||
bool appl::TextViewer::calculateMinSize() {
|
||||
m_minSize.setValue(50,50);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void appl::TextViewer::onDraw(void) {
|
||||
void appl::TextViewer::onDraw() {
|
||||
m_displayDrawing.draw();
|
||||
m_displayText.draw();
|
||||
WidgetScrolled::onDraw();
|
||||
}
|
||||
|
||||
void appl::TextViewer::onRegenerateDisplay(void) {
|
||||
void appl::TextViewer::onRegenerateDisplay() {
|
||||
if (false == needRedraw()) {
|
||||
return;
|
||||
}
|
||||
@@ -129,14 +138,11 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
||||
vec3 tmpCursorPosition(0, 0, -1);
|
||||
float tmpCursorLenght = -1.0;
|
||||
// real display ...
|
||||
etk::Buffer& buf = m_buffer->getData();
|
||||
m_displayText.setColor(etk::Color<>(0, 0, 0, 256));
|
||||
float countNbLine = 1;
|
||||
int32_t countColomn = 0;
|
||||
// the siplay string :
|
||||
std::u32string stringToDisplay;
|
||||
int64_t bufferElementSize = 0;
|
||||
bool isSelect = false;
|
||||
appl::Buffer::Iterator selectPosStart = m_buffer->begin();
|
||||
appl::Buffer::Iterator selectPosStop = m_buffer->begin();
|
||||
if (m_buffer->hasTextSelected() == true) {
|
||||
@@ -352,7 +358,8 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
||||
m_buffer->setSelectMode(false);
|
||||
// normal adding char ...
|
||||
char output[5];
|
||||
int32_t nbElement = u32char::convertUtf8(localValue, output);
|
||||
output[0] = '0';
|
||||
u32char::convertUtf8(localValue, output);
|
||||
if ( m_buffer->hasTextSelected() == false
|
||||
&& _event.getSpecialKey().getInsert() == true) {
|
||||
appl::Buffer::Iterator pos = m_buffer->cursor();
|
||||
@@ -368,7 +375,6 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
||||
}
|
||||
// move events ...
|
||||
if (_event.getStatus() == ewol::key::statusDown) {
|
||||
bool needUpdatePosition = true;
|
||||
// selection when shift is set:
|
||||
m_buffer->setSelectMode(_event.getSpecialKey().getShift());
|
||||
// check selection event ...
|
||||
@@ -418,7 +424,8 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
||||
}
|
||||
|
||||
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
||||
if (_event.getId() != 0) {
|
||||
if ( _event.getId() != 0
|
||||
&& _event.getStatus() == ewol::key::statusDown) {
|
||||
keepFocus();
|
||||
}
|
||||
//tic();
|
||||
@@ -426,15 +433,17 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
||||
return false;
|
||||
}
|
||||
// First call the scrolling widget :
|
||||
if (WidgetScrolled::onEventInput(_event) == true) {
|
||||
if (ewol::widget::WidgetScrolled::onEventInput(_event) == true) {
|
||||
markToRedraw();
|
||||
return true;
|
||||
}
|
||||
APPL_VERBOSE("event : " << _event);
|
||||
// Second call plugin
|
||||
if (appl::textPluginManager::onEventInput(*this, _event) == true) {
|
||||
markToRedraw();
|
||||
return true;
|
||||
}
|
||||
APPL_VERBOSE("event2 : " << _event);
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
// offset for the lineNumber:
|
||||
relativePos -= vec2(m_lastOffsetDisplay, 0);
|
||||
@@ -537,7 +546,7 @@ bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) {
|
||||
}
|
||||
|
||||
|
||||
void appl::TextViewer::mouseEventDouble(void) {
|
||||
void appl::TextViewer::mouseEventDouble() {
|
||||
//m_selectMode = false;
|
||||
appl::Buffer::Iterator beginPos, endPos;
|
||||
if (true == m_buffer->getPosAround(m_buffer->cursor(), beginPos, endPos)) {
|
||||
@@ -546,7 +555,7 @@ void appl::TextViewer::mouseEventDouble(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TextViewer::mouseEventTriple(void) {
|
||||
void appl::TextViewer::mouseEventTriple() {
|
||||
//m_selectMode = false;
|
||||
moveCursor(m_buffer->getEndLine(m_buffer->cursor()));
|
||||
m_buffer->setSelectionPos(m_buffer->getStartLine(m_buffer->cursor()));
|
||||
@@ -615,7 +624,7 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
ewol::widget::WidgetScrolled::onReceiveMessage(_msg);
|
||||
APPL_VERBOSE("receive msg: " << _msg);
|
||||
// First call plugin
|
||||
if (appl::textPluginManager::onReceiveMessage(*this, _msg) == true) {
|
||||
if (appl::textPluginManager::onReceiveMessageViewer(*this, _msg) == true) {
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
@@ -690,7 +699,7 @@ void appl::TextViewer::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TextViewer::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::TextViewer::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::widget::WidgetScrolled::onObjectRemove(_removeObject);
|
||||
if (m_buffer == _removeObject) {
|
||||
m_buffer = NULL;
|
||||
@@ -698,14 +707,14 @@ void appl::TextViewer::onObjectRemove(ewol::Object* _removeObject) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TextViewer::onGetFocus(void) {
|
||||
void appl::TextViewer::onGetFocus() {
|
||||
showKeyboard();
|
||||
APPL_INFO("Focus - In");
|
||||
setCurrentSelect();
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
void appl::TextViewer::onLostFocus(void) {
|
||||
void appl::TextViewer::onLostFocus() {
|
||||
hideKeyboard();
|
||||
APPL_INFO("Focus - out");
|
||||
markToRedraw();
|
||||
@@ -721,7 +730,7 @@ void appl::TextViewer::setFontName(const std::string& _fontName) {
|
||||
}
|
||||
|
||||
// TODO : Update process time ==> a little expensive (2->4ms) in end of file
|
||||
void appl::TextViewer::updateScrolling(void) {
|
||||
void appl::TextViewer::updateScrolling() {
|
||||
if (m_buffer == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -816,7 +825,7 @@ bool appl::TextViewer::replace(const std::string& _data) {
|
||||
return replace(_data, m_buffer->selectStart(), m_buffer->selectStop());
|
||||
}
|
||||
|
||||
void appl::TextViewer::remove(void) {
|
||||
void appl::TextViewer::remove() {
|
||||
if (m_buffer == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -986,13 +995,13 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
|
||||
return ret;
|
||||
}
|
||||
|
||||
void appl::TextViewer::setCurrentSelect(void) {
|
||||
void appl::TextViewer::setCurrentSelect() {
|
||||
if (m_viewerManager != NULL) {
|
||||
m_viewerManager->setViewerSelected(this, m_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
bool appl::TextViewer::isSelectedLast(void) {
|
||||
bool appl::TextViewer::isSelectedLast() {
|
||||
if (m_viewerManager != NULL) {
|
||||
return m_viewerManager->isLastSelected(this);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
namespace appl {
|
||||
class TextViewer : public ewol::widget::WidgetScrolled {
|
||||
private:
|
||||
appl::GlyphPainting* m_paintingProperties; //!< element painting property
|
||||
ewol::object::Shared<appl::GlyphPainting> m_paintingProperties; //!< element painting property
|
||||
int32_t m_colorBackground;
|
||||
int32_t m_colorSpace;
|
||||
int32_t m_colorTabulation;
|
||||
@@ -33,40 +33,40 @@ namespace appl {
|
||||
int32_t m_colorSelection;
|
||||
int32_t m_colorNormal;
|
||||
private:
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
appl::ViewerManager* m_viewerManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::ViewerManager> m_viewerManager; //!< handle on the buffer manager
|
||||
public:
|
||||
TextViewer(const std::string& _fontName="", int32_t _fontSize=-1);
|
||||
virtual ~TextViewer(void);
|
||||
virtual ~TextViewer();
|
||||
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)
|
||||
ewol::object::Shared<appl::Buffer> m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
|
||||
public:
|
||||
/**
|
||||
* @brief Get the buffer property (only for the class : template <typename TYPE> class TextViewerPluginData)
|
||||
* @return pointer on buffer
|
||||
*/
|
||||
appl::Buffer* internalGetBuffer(void) {
|
||||
ewol::object::Shared<appl::Buffer> internalGetBuffer() {
|
||||
return m_buffer;
|
||||
}
|
||||
private:
|
||||
ewol::compositing::Text m_displayText; //!< Text display properties.
|
||||
ewol::compositing::Drawing m_displayDrawing; //!< Other diaplay requested.
|
||||
std::vector<std::pair<appl::Buffer*, vec2>> m_drawingRemenber;
|
||||
std::vector<std::pair<ewol::object::Shared<appl::Buffer>, vec2>> m_drawingRemenber;
|
||||
public:
|
||||
void setFontSize(int32_t _size);
|
||||
void setFontName(const std::string& _fontName);
|
||||
protected: // derived function
|
||||
virtual void onDraw(void);
|
||||
virtual void onDraw();
|
||||
public: // Derived function
|
||||
virtual bool calculateMinSize(void);
|
||||
virtual void onRegenerateDisplay(void);
|
||||
virtual bool calculateMinSize();
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object* _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
virtual bool onEventEntry(const ewol::event::Entry& _event);
|
||||
virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID);
|
||||
virtual void onGetFocus(void);
|
||||
virtual void onLostFocus(void);
|
||||
virtual void onGetFocus();
|
||||
virtual void onLostFocus();
|
||||
virtual void changeZoom(float _range);
|
||||
private:
|
||||
float m_lastOffsetDisplay; //!< Line number ofssed in the display
|
||||
@@ -77,7 +77,7 @@ namespace appl {
|
||||
* @brief Update the scrolling position from the cursor position,
|
||||
* it might be be all time in the display screen.
|
||||
*/
|
||||
void updateScrolling(void);
|
||||
void updateScrolling();
|
||||
// TODO : Doc : write data on buffer
|
||||
bool moveCursor(const appl::Buffer::Iterator& _pos);
|
||||
bool write(const std::string& _data);
|
||||
@@ -90,11 +90,11 @@ namespace appl {
|
||||
/**
|
||||
* @brief Remove selected data ...
|
||||
*/
|
||||
void remove(void);
|
||||
void remove();
|
||||
/**
|
||||
* @brief Remove selected data ... (No plugin call)
|
||||
*/
|
||||
void removeDirect(void) {
|
||||
void removeDirect() {
|
||||
if (m_buffer==NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -156,8 +156,8 @@ namespace appl {
|
||||
}
|
||||
|
||||
appl::Buffer::Iterator getMousePosition(const vec2& _relativePos);
|
||||
void mouseEventDouble(void);
|
||||
void mouseEventTriple(void);
|
||||
void mouseEventDouble();
|
||||
void mouseEventTriple();
|
||||
private:
|
||||
enum moveMode {
|
||||
moveLetter,
|
||||
@@ -191,25 +191,30 @@ namespace appl {
|
||||
/**
|
||||
* @brief Set the current buffer selected
|
||||
*/
|
||||
void setCurrentSelect(void);
|
||||
void setCurrentSelect();
|
||||
/**
|
||||
* @brief Check if the current buffer is last selected
|
||||
* @return true if selected last
|
||||
*/
|
||||
bool isSelectedLast(void);
|
||||
bool isSelectedLast();
|
||||
public:
|
||||
/**
|
||||
* @brief get the path of the current buffer
|
||||
* @return Path of the buffer (remove the ended name)
|
||||
*/
|
||||
virtual std::string getBufferPath();
|
||||
/**
|
||||
* @brief Check if the buffer is availlable
|
||||
* @return true if a display buffer is present, false otherwise.
|
||||
*/
|
||||
virtual bool hasBuffer(void) {
|
||||
virtual bool hasBuffer() {
|
||||
return m_buffer != NULL;
|
||||
}
|
||||
/**
|
||||
* @brief Get the status of selection.
|
||||
* @return true if we have a current selection, false otherwise.
|
||||
*/
|
||||
virtual bool hasTextSelected(void) {
|
||||
virtual bool hasTextSelected() {
|
||||
if (m_buffer==NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -218,7 +223,7 @@ namespace appl {
|
||||
/**
|
||||
* @brief Remove Selection of the buffer.
|
||||
*/
|
||||
virtual void unSelect(void) {
|
||||
virtual void unSelect() {
|
||||
if (m_buffer==NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -312,7 +317,7 @@ namespace appl {
|
||||
* @brief Get the cursor position.
|
||||
* @return The iterator on the cursor position
|
||||
*/
|
||||
appl::Buffer::Iterator cursor(void) {
|
||||
appl::Buffer::Iterator cursor() {
|
||||
if (m_buffer==NULL) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
@@ -322,7 +327,7 @@ namespace appl {
|
||||
* @brief Get the begin position.
|
||||
* @return The iterator on the begin position
|
||||
*/
|
||||
appl::Buffer::Iterator begin(void) {
|
||||
appl::Buffer::Iterator begin() {
|
||||
if (m_buffer==NULL) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
@@ -332,7 +337,7 @@ namespace appl {
|
||||
* @brief Get the end position.
|
||||
* @return The iterator on the end position
|
||||
*/
|
||||
appl::Buffer::Iterator end(void) {
|
||||
appl::Buffer::Iterator end() {
|
||||
if (m_buffer==NULL) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
@@ -342,7 +347,7 @@ namespace appl {
|
||||
* @brief Get an Iterator on the start selection.
|
||||
* @return The Iterator
|
||||
*/
|
||||
appl::Buffer::Iterator selectStart(void) {
|
||||
appl::Buffer::Iterator selectStart() {
|
||||
if (m_buffer==NULL) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
@@ -352,7 +357,7 @@ namespace appl {
|
||||
* @brief Get an Iterator on the stop selection.
|
||||
* @return The Iterator
|
||||
*/
|
||||
appl::Buffer::Iterator selectStop(void) {
|
||||
appl::Buffer::Iterator selectStop() {
|
||||
if (m_buffer==NULL) {
|
||||
return appl::Buffer::Iterator();
|
||||
}
|
||||
@@ -394,9 +399,9 @@ namespace appl {
|
||||
* @param[in] _data Associate data wit the event
|
||||
*/
|
||||
virtual void ext_shortCutAdd(const char * _descriptiveString,
|
||||
const char * _generateEventId,
|
||||
std::string _data="",
|
||||
bool _broadcast=false) {
|
||||
const char * _generateEventId,
|
||||
std::string _data="",
|
||||
bool _broadcast=false) {
|
||||
shortCutAdd(_descriptiveString, _generateEventId, _data, _broadcast);
|
||||
}
|
||||
};
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#undef __class__
|
||||
#define __class__ "ViewerManager"
|
||||
|
||||
appl::ViewerManager::ViewerManager(void) :
|
||||
appl::ViewerManager::ViewerManager() :
|
||||
ewol::Resource("???ViewerManager???"),
|
||||
m_viewer(NULL) {
|
||||
addObjectType("appl::ViewerManager");
|
||||
@@ -25,11 +25,15 @@ appl::ViewerManager::ViewerManager(void) :
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
}
|
||||
|
||||
appl::ViewerManager::~ViewerManager(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::ViewerManager::~ViewerManager() {
|
||||
|
||||
}
|
||||
|
||||
void appl::ViewerManager::setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer) {
|
||||
bool appl::ViewerManager::isLastSelected(const ewol::object::Shared<appl::TextViewer>& _viewer) {
|
||||
return m_viewer == _viewer;
|
||||
}
|
||||
|
||||
void appl::ViewerManager::setViewerSelected(const ewol::object::Shared<appl::TextViewer>& _viewer, const ewol::object::Shared<appl::Buffer>& _buffer) {
|
||||
if (m_viewer == _viewer) {
|
||||
return;
|
||||
}
|
||||
@@ -43,23 +47,23 @@ void appl::ViewerManager::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_DEBUG("receive message !!! " << _msg);
|
||||
}
|
||||
|
||||
void appl::ViewerManager::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::ViewerManager::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
ewol::Resource:: onObjectRemove(_removeObject);
|
||||
if (_removeObject == m_viewer) {
|
||||
m_viewer = NULL;
|
||||
m_viewer.reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
appl::ViewerManager* appl::ViewerManager::keep(void) {
|
||||
ewol::object::Shared<appl::ViewerManager> appl::ViewerManager::keep() {
|
||||
//EWOL_INFO("KEEP : appl::GlyphPainting : file : \"" << _filename << "\"");
|
||||
appl::ViewerManager* object = static_cast<appl::ViewerManager*>(getManager().localKeep("???ViewerManager???"));
|
||||
ewol::object::Shared<appl::ViewerManager> object = ewol::dynamic_pointer_cast<appl::ViewerManager>(getManager().localKeep("???ViewerManager???"));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
// this element create a new one every time ....
|
||||
EWOL_INFO("CREATE : appl::ViewerManager: ???ViewerManager???");
|
||||
object = new appl::ViewerManager();
|
||||
object = ewol::object::makeShared(new appl::ViewerManager());
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ???ViewerManager???");
|
||||
return NULL;
|
||||
@@ -67,12 +71,3 @@ appl::ViewerManager* appl::ViewerManager::keep(void) {
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
void appl::ViewerManager::release(appl::ViewerManager*& _object) {
|
||||
if (NULL == _object) {
|
||||
return;
|
||||
}
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
||||
getManager().release(object2);
|
||||
_object = NULL;
|
||||
}
|
||||
|
@@ -19,22 +19,23 @@ namespace appl {
|
||||
class TextViewer;
|
||||
class ViewerManager : public ewol::Resource {
|
||||
protected:
|
||||
ViewerManager(void);
|
||||
~ViewerManager(void);
|
||||
ViewerManager();
|
||||
public:
|
||||
virtual ~ViewerManager();
|
||||
private:
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
appl::TextViewer* m_viewer;
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::TextViewer> m_viewer;
|
||||
public:
|
||||
/**
|
||||
* @brief Set the current buffer selected
|
||||
* @param[in] _viewer Pointer on the viewer selected
|
||||
*/
|
||||
void setViewerSelected(appl::TextViewer* _viewer, appl::Buffer* _buffer);
|
||||
void setViewerSelected(const ewol::object::Shared<appl::TextViewer>& _viewer, const ewol::object::Shared<appl::Buffer>& _buffer);
|
||||
/**
|
||||
* @brief Get the current buffer selected
|
||||
* @return Pointer on the buffer selected
|
||||
*/
|
||||
appl::TextViewer* getViewerSelected(void) {
|
||||
ewol::object::Shared<appl::TextViewer> getViewerSelected() {
|
||||
return m_viewer;
|
||||
};
|
||||
/**
|
||||
@@ -42,12 +43,10 @@ namespace appl {
|
||||
* @param[in] _viewer element selected.
|
||||
* @return true if the element is selected
|
||||
*/
|
||||
bool isLastSelected(appl::TextViewer* _viewer) {
|
||||
return m_viewer == _viewer;
|
||||
};
|
||||
bool isLastSelected(const ewol::object::Shared<appl::TextViewer>& _viewer);
|
||||
public: // herited function
|
||||
void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
void onObjectRemove(ewol::Object* _removeObject);
|
||||
void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
public: // resource manager
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
@@ -55,12 +54,7 @@ namespace appl {
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or NULL if an error occured.
|
||||
*/
|
||||
static appl::ViewerManager* keep(void);
|
||||
/**
|
||||
* @brief release the keeped resources
|
||||
* @param[in,out] reference on the object pointer
|
||||
*/
|
||||
static void release(appl::ViewerManager*& _object);
|
||||
static ewol::object::Shared<appl::ViewerManager> keep();
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
static const char* s_closeDone = "close-done";
|
||||
|
||||
appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
||||
appl::WorkerCloseAllFile::WorkerCloseAllFile() :
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
addObjectType("appl::WorkerCloseAllFile");
|
||||
@@ -29,7 +29,7 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
||||
}
|
||||
// List all current open file :
|
||||
for (int64_t iii=m_bufferManager->size()-1; iii>=0; --iii) {
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(iii);
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||
if (tmpBuffer == NULL) {
|
||||
continue;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front());
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerCloseFile(m_bufferNameList.front()));
|
||||
// remove first element :
|
||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||
if (m_bufferNameList.size() == 0) {
|
||||
@@ -55,8 +55,8 @@ appl::WorkerCloseAllFile::WorkerCloseAllFile(void) :
|
||||
m_worker->registerOnEvent(this, appl::WorkerCloseFile::eventCloseDone, s_closeDone);
|
||||
}
|
||||
|
||||
appl::WorkerCloseAllFile::~WorkerCloseAllFile(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::WorkerCloseAllFile::~WorkerCloseAllFile() {
|
||||
|
||||
}
|
||||
|
||||
void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
@@ -70,7 +70,7 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = new appl::WorkerCloseFile(m_bufferNameList.front());
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerCloseFile(m_bufferNameList.front()));
|
||||
// remove first element :
|
||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||
if (m_bufferNameList.size() == 0) {
|
||||
@@ -81,7 +81,7 @@ void appl::WorkerCloseAllFile::onReceiveMessage(const ewol::object::Message& _ms
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerCloseAllFile::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::WorkerCloseAllFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_worker) {
|
||||
m_worker = NULL;
|
||||
APPL_VERBOSE("AutoRemove After saving sub widget ...");
|
||||
|
@@ -15,15 +15,15 @@
|
||||
namespace appl {
|
||||
class WorkerCloseAllFile : public ewol::Object {
|
||||
public:
|
||||
WorkerCloseAllFile(void);
|
||||
virtual ~WorkerCloseAllFile(void);
|
||||
WorkerCloseAllFile();
|
||||
virtual ~WorkerCloseAllFile();
|
||||
private:
|
||||
std::vector<std::string> m_bufferNameList;
|
||||
appl::WorkerCloseFile* m_worker; //! pop-up element that is open...
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::WorkerCloseFile> m_worker; //! pop-up element that is open...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -38,7 +38,7 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
}
|
||||
if (m_bufferName == "") {
|
||||
// need to find the curent file ...
|
||||
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
|
||||
ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == NULL) {
|
||||
APPL_ERROR("No selected buffer now ...");
|
||||
autoDestroy();
|
||||
@@ -63,14 +63,14 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
return;
|
||||
}
|
||||
|
||||
ewol::widget::StdPopUp* tmpPopUp = new ewol::widget::StdPopUp();
|
||||
ewol::object::Shared<ewol::widget::StdPopUp> tmpPopUp = ewol::object::makeShared(new ewol::widget::StdPopUp());
|
||||
if (tmpPopUp == NULL) {
|
||||
APPL_ERROR("Can not create a simple pop-up");
|
||||
return;
|
||||
}
|
||||
tmpPopUp->setTitle("<bold>Close un-saved file:</bold>");
|
||||
tmpPopUp->setComment("The file named : <i>\"" + m_buffer->getFileName() + "\"</i> is curently modify. <br/>If you don't saves these modifications,<br/>they will be definitly lost...");
|
||||
ewol::Widget* bt = NULL;
|
||||
ewol::object::Shared<ewol::Widget> bt = NULL;
|
||||
if (m_buffer->hasFileName() == true) {
|
||||
bt = tmpPopUp->addButton("Save", true);
|
||||
if (bt != NULL) {
|
||||
@@ -87,7 +87,7 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
}
|
||||
tmpPopUp->addButton("Cancel", true);
|
||||
tmpPopUp->setRemoveOnExternClick(true);
|
||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
APPL_ERROR("Error to get the windows.");
|
||||
autoDestroy();
|
||||
@@ -96,8 +96,8 @@ appl::WorkerCloseFile::WorkerCloseFile(const std::string& _bufferName) :
|
||||
tmpWindows->popUpWidgetPush(tmpPopUp);
|
||||
}
|
||||
|
||||
appl::WorkerCloseFile::~WorkerCloseFile(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::WorkerCloseFile::~WorkerCloseFile() {
|
||||
|
||||
}
|
||||
|
||||
void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
@@ -107,7 +107,7 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
}
|
||||
APPL_DEBUG("have message : " << _msg);
|
||||
if (_msg.getMessage() == s_saveAsValidate) {
|
||||
m_worker = new appl::WorkerSaveFile(m_bufferName);
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerSaveFile(m_bufferName));
|
||||
if (m_worker != NULL) {
|
||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
return;
|
||||
}
|
||||
if (m_buffer->storeFile() == false) {
|
||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ void appl::WorkerCloseFile::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerCloseFile::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::WorkerCloseFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_worker) {
|
||||
m_worker = NULL;
|
||||
APPL_VERBOSE("AutoRemove After closing sub widget ...");
|
||||
|
@@ -20,15 +20,15 @@ namespace appl {
|
||||
public:
|
||||
// note : if == "" ==> current ...
|
||||
WorkerCloseFile(const std::string& _bufferName);
|
||||
virtual ~WorkerCloseFile(void);
|
||||
virtual ~WorkerCloseFile();
|
||||
private:
|
||||
std::string m_bufferName;
|
||||
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...
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::Buffer> m_buffer; //!< reference on the buffer (when rename, we have no more reference on the buffer
|
||||
ewol::object::Shared<appl::WorkerSaveFile> m_worker; //! sub-worker element...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
static const char* s_saveAsDone = "save-as-done";
|
||||
|
||||
appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
||||
appl::WorkerSaveAllFile::WorkerSaveAllFile() :
|
||||
m_worker(NULL),
|
||||
m_bufferManager(NULL) {
|
||||
addObjectType("appl::WorkerSaveAllFile");
|
||||
@@ -28,8 +28,8 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
||||
return;
|
||||
}
|
||||
// List all current open file :
|
||||
for (size_t iii=0; iii<m_bufferManager->size(); ++iii) {
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(iii);
|
||||
for (int32_t iii=0; iii<m_bufferManager->size(); ++iii) {
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(iii);
|
||||
if (tmpBuffer == NULL) {
|
||||
continue;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
||||
return;
|
||||
}
|
||||
// create the worker :
|
||||
m_worker = new appl::WorkerSaveFile(m_bufferNameList.front());
|
||||
m_worker = ewol::object::makeShared(new appl::WorkerSaveFile(m_bufferNameList.front()));
|
||||
// remove first element :
|
||||
m_bufferNameList.erase(m_bufferNameList.begin());
|
||||
if (m_bufferNameList.size() == 0) {
|
||||
@@ -58,8 +58,8 @@ appl::WorkerSaveAllFile::WorkerSaveAllFile(void) :
|
||||
m_worker->registerOnEvent(this, appl::WorkerSaveFile::eventSaveDone, s_saveAsDone);
|
||||
}
|
||||
|
||||
appl::WorkerSaveAllFile::~WorkerSaveAllFile(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::WorkerSaveAllFile::~WorkerSaveAllFile() {
|
||||
|
||||
}
|
||||
|
||||
void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
@@ -84,7 +84,7 @@ void appl::WorkerSaveAllFile::onReceiveMessage(const ewol::object::Message& _msg
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerSaveAllFile::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::WorkerSaveAllFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_worker) {
|
||||
m_worker = NULL;
|
||||
APPL_VERBOSE("AutoRemove After saving sub widget ...");
|
||||
|
@@ -15,15 +15,15 @@
|
||||
namespace appl {
|
||||
class WorkerSaveAllFile : public ewol::Object {
|
||||
public:
|
||||
WorkerSaveAllFile(void);
|
||||
virtual ~WorkerSaveAllFile(void);
|
||||
WorkerSaveAllFile();
|
||||
virtual ~WorkerSaveAllFile();
|
||||
private:
|
||||
std::vector<std::string> m_bufferNameList;
|
||||
appl::WorkerSaveFile* m_worker; //! pop-up element that is open...
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::WorkerSaveFile> m_worker; //! pop-up element that is open...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -33,7 +33,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
}
|
||||
if (m_bufferName == "") {
|
||||
// need to find the curent file ...
|
||||
appl::Buffer* tmpp = m_bufferManager->getBufferSelected();
|
||||
ewol::object::Shared<appl::Buffer> tmpp = m_bufferManager->getBufferSelected();
|
||||
if (tmpp == NULL) {
|
||||
APPL_ERROR("No selected buffer now ...");
|
||||
autoDestroy();
|
||||
@@ -46,7 +46,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
autoDestroy();
|
||||
return;
|
||||
}
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||
ewol::object::Shared<appl::Buffer> tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||
if (tmpBuffer == NULL) {
|
||||
APPL_ERROR("Error to get the buffer : " << m_bufferName);
|
||||
autoDestroy();
|
||||
@@ -60,7 +60,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_chooser = new ewol::widget::FileChooser();
|
||||
m_chooser = ewol::object::makeShared(new ewol::widget::FileChooser());
|
||||
if (NULL == m_chooser) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
autoDestroy();
|
||||
@@ -71,7 +71,7 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
etk::FSNode tmpName(m_bufferName);
|
||||
m_chooser->setFolder(tmpName.getNameFolder());
|
||||
m_chooser->setFileName(tmpName.getNameFile());
|
||||
ewol::widget::Windows* tmpWindows = ewol::getContext().getWindows();
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
APPL_ERROR("Error to get the windows.");
|
||||
autoDestroy();
|
||||
@@ -81,8 +81,8 @@ appl::WorkerSaveFile::WorkerSaveFile(const std::string& _bufferName, bool _force
|
||||
m_chooser->registerOnEvent(this, ewol::widget::FileChooser::eventValidate, s_saveAsValidate);
|
||||
}
|
||||
|
||||
appl::WorkerSaveFile::~WorkerSaveFile(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::WorkerSaveFile::~WorkerSaveFile() {
|
||||
|
||||
}
|
||||
|
||||
void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
@@ -99,14 +99,14 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
APPL_ERROR("Try to save an non-existant file :" << m_bufferName);
|
||||
return;
|
||||
}
|
||||
appl::Buffer* tmpBuffer = m_bufferManager->get(m_bufferName);
|
||||
ewol::object::Shared<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();
|
||||
ewol::object::Shared<ewol::widget::Windows> tmpWindows = ewol::getContext().getWindows();
|
||||
if (tmpWindows == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void appl::WorkerSaveFile::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::WorkerSaveFile::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::WorkerSaveFile::onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject) {
|
||||
if (_removeObject == m_chooser) {
|
||||
m_chooser = NULL;
|
||||
APPL_VERBOSE("AutoRemove After closing sub widget ...");
|
||||
|
@@ -18,14 +18,14 @@ namespace appl {
|
||||
static const char* eventSaveDone;
|
||||
public:
|
||||
WorkerSaveFile(const std::string& _bufferName, bool _forceSaveAs=true);
|
||||
virtual ~WorkerSaveFile(void);
|
||||
virtual ~WorkerSaveFile();
|
||||
private:
|
||||
std::string m_bufferName;
|
||||
ewol::widget::FileChooser* m_chooser; //! pop-up element that is open...
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<ewol::widget::FileChooser> m_chooser; //! pop-up element that is open...
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public: // derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -25,19 +25,20 @@
|
||||
#define HL2_DEBUG APPL_VERBOSE
|
||||
|
||||
void appl::Highlight::parseRules(exml::Element* _child,
|
||||
std::vector<HighlightPattern*>& _mListPatern,
|
||||
std::vector<std::unique_ptr<HighlightPattern>>& _mListPatern,
|
||||
int32_t _level) {
|
||||
// Create the patern ...
|
||||
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
|
||||
// parse under Element
|
||||
myPattern->parseRules(_child, _level);
|
||||
// add element in the list
|
||||
_mListPatern.push_back(myPattern);
|
||||
_mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
|
||||
}
|
||||
|
||||
appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) :
|
||||
ewol::Resource(_xmlFilename),
|
||||
m_typeName("") {
|
||||
addObjectType("appl::Highlight");
|
||||
// keep color propertiy file :
|
||||
m_paintingProperties = appl::GlyphPainting::keep(_colorFile);
|
||||
|
||||
@@ -55,7 +56,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
int32_t level1 = 0;
|
||||
int32_t level2 = 0;
|
||||
// parse all the elements :
|
||||
for(int32_t iii = 0; iii < root->size(); ++iii) {
|
||||
for(size_t iii = 0; iii < root->size(); ++iii) {
|
||||
exml::Element* child = root->getElement(iii);
|
||||
if (child == NULL) {
|
||||
// trash here all that is not element ...
|
||||
@@ -69,7 +70,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
}
|
||||
} else if (child->getValue() == "pass1") {
|
||||
// get sub Nodes ...
|
||||
for(int32_t jjj=0; jjj< child->size(); jjj++) {
|
||||
for(size_t jjj=0; jjj< child->size(); jjj++) {
|
||||
exml::Element* passChild = child->getElement(jjj);
|
||||
if (passChild == NULL) {
|
||||
continue;
|
||||
@@ -82,7 +83,7 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
}
|
||||
} else if (child->getValue() == "pass2") {
|
||||
// get sub Nodes ...
|
||||
for(int32_t jjj=0; jjj< child->size(); jjj++) {
|
||||
for(size_t jjj=0; jjj< child->size(); jjj++) {
|
||||
exml::Element* passChild = child->getElement(jjj);
|
||||
if (passChild == NULL) {
|
||||
continue;
|
||||
@@ -99,26 +100,20 @@ appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _
|
||||
}
|
||||
}
|
||||
|
||||
appl::Highlight::~Highlight(void) {
|
||||
int32_t i;
|
||||
// clean all Element
|
||||
for (int32_t iii = 0; iii < m_listHighlightPass1.size(); ++iii) {
|
||||
if (m_listHighlightPass1[iii] != NULL) {
|
||||
delete(m_listHighlightPass1[iii]);
|
||||
m_listHighlightPass1[iii] = NULL;
|
||||
}
|
||||
}
|
||||
appl::Highlight::~Highlight() {
|
||||
// clear the compleate list
|
||||
m_listHighlightPass1.clear();
|
||||
// clear the compleate list
|
||||
m_listHighlightPass2.clear();
|
||||
// clear the compleate list
|
||||
m_listExtentions.clear();
|
||||
}
|
||||
|
||||
bool appl::Highlight::hasExtention(const std::string& _ext) {
|
||||
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
|
||||
APPL_VERBOSE(" check : " << m_listExtentions[iii] << "=?=" << _ext);
|
||||
if ( m_listExtentions[iii] == "*." + _ext
|
||||
|| m_listExtentions[iii] == _ext) {
|
||||
for (auto &it : m_listExtentions) {
|
||||
APPL_VERBOSE(" check : " << it << "=?=" << _ext);
|
||||
if ( it == "*." + _ext
|
||||
|| it == _ext) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -136,8 +131,8 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
|
||||
}
|
||||
APPL_DEBUG(" try to find : in \"" << file << "\" extention:\"" << extention << "\" ");
|
||||
|
||||
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
|
||||
if (extention == m_listExtentions[iii] ) {
|
||||
for (auto &it : m_listExtentions) {
|
||||
if (extention == it ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -145,19 +140,19 @@ bool appl::Highlight::fileNameCompatible(const std::string& _fileName) {
|
||||
}
|
||||
|
||||
|
||||
void appl::Highlight::display(void) {
|
||||
void appl::Highlight::display() {
|
||||
APPL_INFO("List of ALL Highlight : ");
|
||||
for (int32_t iii=0; iii< m_listExtentions.size(); iii++) {
|
||||
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] );
|
||||
for (auto &it : m_listExtentions) {
|
||||
APPL_INFO(" Extention : " << it );
|
||||
}
|
||||
// display all elements
|
||||
for (int32_t iii=0; iii< m_listHighlightPass1.size(); iii++) {
|
||||
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->getName() );
|
||||
for (auto &it : m_listHighlightPass1) {
|
||||
APPL_INFO(" Pass 1 : " << it->getName() );
|
||||
//m_listHighlightPass1[iii]->display();
|
||||
}
|
||||
// display all elements
|
||||
for (int32_t iii=0; iii< m_listHighlightPass2.size(); iii++) {
|
||||
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->getName() );
|
||||
for (auto &it : m_listHighlightPass2) {
|
||||
APPL_INFO(" pass 2 : " << it->getName() );
|
||||
//m_listHighlightPass2[iii]->display();
|
||||
}
|
||||
}
|
||||
@@ -180,7 +175,7 @@ void appl::Highlight::parse(int64_t _start,
|
||||
while (elementStart <= elementStop) {
|
||||
HL_DEBUG("Parse element in the buffer pos=" << elementStart);
|
||||
//try to fond the HL in ALL of we have
|
||||
for (int64_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){
|
||||
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
|
||||
enum resultFind ret = HLP_FIND_OK;
|
||||
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ")" );
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
@@ -189,13 +184,13 @@ void appl::Highlight::parse(int64_t _start,
|
||||
HL_DEBUG("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
||||
// remove element in the current List where the current Element have a end inside the next...
|
||||
int64_t kkk=_addingPos;
|
||||
while(kkk < _metaData.size() ) {
|
||||
while(kkk < (int64_t)_metaData.size() ) {
|
||||
if (_metaData[kkk].beginStart <= resultat.endStop) {
|
||||
// remove element
|
||||
HL_DEBUG("Erase element=" << kkk);
|
||||
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
|
||||
// Increase the end of search
|
||||
if (kkk < _metaData.size()) {
|
||||
if (kkk < (int64_t)_metaData.size()) {
|
||||
// just befor the end of the next element
|
||||
elementStop = _metaData[kkk].beginStart-1;
|
||||
} else {
|
||||
@@ -241,7 +236,7 @@ void appl::Highlight::parse2(int64_t _start,
|
||||
while (elementStart < elementStop) {
|
||||
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
|
||||
//try to fond the HL in ALL of we have
|
||||
for (int64_t jjj=0; jjj<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: (" <<
|
||||
_start << "," << _buffer.size() << ")" );
|
||||
@@ -261,29 +256,20 @@ void appl::Highlight::parse2(int64_t _start,
|
||||
}
|
||||
}
|
||||
|
||||
appl::Highlight* appl::Highlight::keep(const std::string& _filename) {
|
||||
ewol::object::Shared<appl::Highlight> appl::Highlight::keep(const std::string& _filename) {
|
||||
//EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\"");
|
||||
appl::Highlight* object = static_cast<appl::Highlight*>(getManager().localKeep(_filename));
|
||||
ewol::object::Shared<appl::Highlight> object = ewol::dynamic_pointer_cast<appl::Highlight>(getManager().localKeep(_filename));
|
||||
if (NULL != object) {
|
||||
return object;
|
||||
}
|
||||
EWOL_INFO("CREATE : appl::Highlight : file : \"" << _filename << "\"");
|
||||
// this element create a new one every time ....
|
||||
object = new appl::Highlight(_filename, "THEME:COLOR:textViewer.json");
|
||||
object = ewol::object::makeShared(new appl::Highlight(_filename, "THEME:COLOR:textViewer.json"));
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : ??Highlight??");
|
||||
return NULL;
|
||||
}
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
|
||||
}
|
||||
|
||||
void appl::Highlight::release(appl::Highlight*& _object) {
|
||||
if (NULL == _object) {
|
||||
return;
|
||||
}
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
|
||||
getManager().release(object2);
|
||||
_object = NULL;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ namespace appl {
|
||||
};
|
||||
};
|
||||
|
||||
#include <memory>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <appl/HighlightPattern.h>
|
||||
#include <appl/GlyphPainting.h>
|
||||
@@ -34,21 +35,22 @@ namespace appl {
|
||||
namespace appl {
|
||||
class Highlight : public ewol::Resource {
|
||||
private:
|
||||
appl::GlyphPainting* m_paintingProperties;
|
||||
ewol::object::Shared<appl::GlyphPainting> m_paintingProperties;
|
||||
protected:
|
||||
// Constructeur
|
||||
Highlight(const std::string& _xmlFilename, const std::string& _colorFile);
|
||||
~Highlight(void);
|
||||
public:
|
||||
virtual ~Highlight();
|
||||
private:
|
||||
std::string m_typeName; //!< descriptive string type like "C/C++"
|
||||
public:
|
||||
const std::string& getTypeName(void) {
|
||||
const std::string& getTypeName() {
|
||||
return m_typeName;
|
||||
}
|
||||
public:
|
||||
bool hasExtention(const std::string& _ext);
|
||||
bool fileNameCompatible(const std::string& _fileName);
|
||||
void display(void);
|
||||
void display();
|
||||
void parse(int64_t _start,
|
||||
int64_t _stop,
|
||||
std::vector<appl::HighlightInfo> &_metaData,
|
||||
@@ -60,12 +62,12 @@ namespace appl {
|
||||
etk::Buffer &_buffer);
|
||||
private:
|
||||
void parseRules(exml::Element* _child,
|
||||
std::vector<HighlightPattern*> &_mListPatern,
|
||||
std::vector<std::unique_ptr<HighlightPattern>> &_mListPatern,
|
||||
int32_t _level);
|
||||
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
|
||||
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
|
||||
std::vector<std::unique_ptr<HighlightPattern>> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
|
||||
std::vector<std::unique_ptr<HighlightPattern>> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
|
||||
public:
|
||||
/**
|
||||
* @brief keep the resource pointer.
|
||||
@@ -73,14 +75,9 @@ namespace appl {
|
||||
* @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);
|
||||
static ewol::object::Shared<appl::Highlight> keep(const std::string& _filename);
|
||||
public: // herited function :
|
||||
virtual void updateContext(void) {
|
||||
virtual void updateContext() {
|
||||
// no upfate to do ...
|
||||
};
|
||||
};
|
||||
|
@@ -15,14 +15,16 @@
|
||||
#undef __class__
|
||||
#define __class__ "highlightManager"
|
||||
|
||||
static std::vector<appl::Highlight*>& s_list(void) {
|
||||
static std::vector<appl::Highlight*> list;
|
||||
// TODO : Review this in a generic unique resource ...
|
||||
|
||||
static std::vector<ewol::object::Shared<appl::Highlight>>& s_list() {
|
||||
static std::vector<ewol::object::Shared<appl::Highlight>> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
void appl::highlightManager::init(void) {
|
||||
std::vector<appl::Highlight*>& hlList = s_list();
|
||||
void appl::highlightManager::init() {
|
||||
std::vector<ewol::object::Shared<appl::Highlight>>& hlList = s_list();
|
||||
if (hlList.size() != 0) {
|
||||
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
||||
hlList.clear();
|
||||
@@ -31,16 +33,16 @@ void appl::highlightManager::init(void) {
|
||||
etk::FSNode myFile("DATA:languages/");
|
||||
// get the subfolder list :
|
||||
std::vector<etk::FSNode *> list = myFile.folderGetSubList(false, true, false,false);
|
||||
for (int32_t iii = 0; iii < list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : list) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->getNodeType() != etk::FSN_FOLDER) {
|
||||
if (it->getNodeType() != etk::FSN_FOLDER) {
|
||||
continue;
|
||||
}
|
||||
std::string filename = list[iii]->getName() + "/highlight.xml";
|
||||
std::string filename = it->getName() + "/highlight.xml";
|
||||
APPL_DEBUG("Load xml name : " << filename);
|
||||
appl::Highlight *myHightLine = appl::Highlight::keep(filename);
|
||||
ewol::object::Shared<appl::Highlight> myHightLine = appl::Highlight::keep(filename);
|
||||
if (myHightLine != NULL) {
|
||||
hlList.push_back(myHightLine);
|
||||
} else {
|
||||
@@ -49,29 +51,22 @@ void appl::highlightManager::init(void) {
|
||||
}
|
||||
// display :
|
||||
/*
|
||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
||||
if (hlList[iii] == NULL) {
|
||||
for (auto &it : hlList) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
hlList[iii]->display();
|
||||
it->display();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void appl::highlightManager::unInit(void) {
|
||||
std::vector<Highlight*>& hlList = s_list();
|
||||
void appl::highlightManager::unInit() {
|
||||
std::vector<ewol::object::Shared<Highlight>>& hlList = s_list();
|
||||
if (hlList.size() == 0) {
|
||||
APPL_DEBUG("HighlightManager ==> no highlight");
|
||||
hlList.clear();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -80,16 +75,16 @@ std::string appl::highlightManager::getTypeExtention(const std::string& _extenti
|
||||
return "";
|
||||
}
|
||||
APPL_DEBUG("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types");
|
||||
std::vector<Highlight*>& hlList = s_list();
|
||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
||||
if (hlList[iii] == NULL) {
|
||||
std::vector<ewol::object::Shared<Highlight>>& hlList = s_list();
|
||||
for (auto &it : hlList) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
APPL_DEBUG(" check : " << hlList[iii]->getTypeName());
|
||||
if (hlList[iii]->hasExtention(_extention) == true) {
|
||||
APPL_DEBUG(" check : " << it->getTypeName());
|
||||
if (it->hasExtention(_extention) == true) {
|
||||
APPL_DEBUG("Find type for extention : " << _extention
|
||||
<< " type : " << hlList[iii]->getTypeName());
|
||||
return hlList[iii]->getTypeName();
|
||||
<< " type : " << it->getTypeName());
|
||||
return it->getTypeName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
@@ -99,19 +94,18 @@ std::string appl::highlightManager::getFileWithTypeType(const std::string& _type
|
||||
if (_type.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
std::vector<Highlight*>& hlList = s_list();
|
||||
for (int32_t iii = 0; iii < hlList.size(); ++iii) {
|
||||
if (hlList[iii] == NULL) {
|
||||
for (auto &it : s_list()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (hlList[iii]->getTypeName() == _type) {
|
||||
return hlList[iii]->getName();
|
||||
if (it->getTypeName() == _type) {
|
||||
return it->getName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<std::string> appl::highlightManager::getTypeList(void) {
|
||||
std::vector<std::string> appl::highlightManager::getTypeList() {
|
||||
std::vector<std::string> ret;
|
||||
return ret;
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@ namespace appl {
|
||||
/**
|
||||
* @brief Init the Highlight manager
|
||||
*/
|
||||
void init(void);
|
||||
void init();
|
||||
/**
|
||||
* @brief Un-Init the Highlight manager
|
||||
*/
|
||||
void unInit(void);
|
||||
void unInit();
|
||||
/**
|
||||
* @brief Un-Init the Highlight manager
|
||||
* @param[in] extention of the file
|
||||
@@ -41,7 +41,7 @@ namespace appl {
|
||||
* @brief Get the list of extention type
|
||||
* @return the requested list.
|
||||
*/
|
||||
std::vector<std::string> getTypeList(void);
|
||||
std::vector<std::string> getTypeList();
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -13,27 +13,20 @@
|
||||
#undef __class__
|
||||
#define __class__ "HighlightPattern"
|
||||
|
||||
appl::HighlightPattern::HighlightPattern(appl::GlyphPainting*& _glyphPainting) :
|
||||
appl::HighlightPattern::HighlightPattern(const ewol::object::Shared<appl::GlyphPainting>& _glyphPainting) :
|
||||
m_glyphPainting(_glyphPainting),
|
||||
m_paternName(""),
|
||||
m_regExpStart(NULL),
|
||||
m_regExpStop(NULL),
|
||||
m_regExpStart(nullptr),
|
||||
m_regExpStop(nullptr),
|
||||
m_colorName(""),
|
||||
m_escapeChar(u32char::Null),
|
||||
m_multiline(false),
|
||||
m_level(0) {
|
||||
m_regExpStart = new etk::RegExp<etk::Buffer>();
|
||||
m_regExpStart = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
|
||||
}
|
||||
|
||||
appl::HighlightPattern::~HighlightPattern(void) {
|
||||
if (m_regExpStart != NULL) {
|
||||
delete(m_regExpStart);
|
||||
m_regExpStart = NULL;
|
||||
}
|
||||
if (m_regExpStop != NULL) {
|
||||
delete(m_regExpStop);
|
||||
m_regExpStop = NULL;
|
||||
}
|
||||
appl::HighlightPattern::~HighlightPattern() {
|
||||
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
|
||||
@@ -44,12 +37,9 @@ void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
|
||||
if (m_regExpStop != NULL) {
|
||||
delete(m_regExpStop);
|
||||
m_regExpStop = NULL;
|
||||
}
|
||||
m_regExpStop.reset();
|
||||
if (_regExp.size() != 0) {
|
||||
m_regExpStop = new etk::RegExp<etk::Buffer>();
|
||||
m_regExpStop = std::unique_ptr<etk::RegExp<etk::Buffer>>(new etk::RegExp<etk::Buffer>());
|
||||
if (m_regExpStop != NULL) {
|
||||
m_regExpStop->compile(_regExp);
|
||||
} else {
|
||||
@@ -68,7 +58,7 @@ void appl::HighlightPattern::setColorGlyph(std::string& _colorName) {
|
||||
APPL_VERBOSE("Resuest color name '" << m_colorName << "' => id=" << m_colorId);
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::display(void) {
|
||||
void appl::HighlightPattern::display() {
|
||||
APPL_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
|
||||
APPL_INFO(" == > colorName \"" << m_colorName << "\"");
|
||||
APPL_INFO(" == > regExpStart \"" << m_regExpStart->getRegExp() << "\"");
|
||||
|
@@ -29,26 +29,26 @@ enum resultFind {
|
||||
namespace appl {
|
||||
class HighlightPattern {
|
||||
private:
|
||||
appl::GlyphPainting*& m_glyphPainting;
|
||||
ewol::object::Shared<appl::GlyphPainting> m_glyphPainting;
|
||||
public:
|
||||
// Constructeur
|
||||
HighlightPattern(appl::GlyphPainting*& _glyphPainting);
|
||||
~HighlightPattern(void);
|
||||
HighlightPattern(const ewol::object::Shared<appl::GlyphPainting>& _glyphPainting);
|
||||
virtual ~HighlightPattern();
|
||||
private:
|
||||
std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||
public:
|
||||
void setName(std::string& _name) {
|
||||
m_paternName = _name;
|
||||
};
|
||||
std::string getName(void) {
|
||||
std::string getName() {
|
||||
return m_paternName;
|
||||
};
|
||||
private:
|
||||
etk::RegExp<etk::Buffer>* m_regExpStart; //!< Start of Regular expression
|
||||
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExpStart; //!< Start of Regular expression
|
||||
public:
|
||||
void setPaternStart(std::string& _regExp);
|
||||
private:
|
||||
etk::RegExp<etk::Buffer>* m_regExpStop; //!< Stop of Regular Expression
|
||||
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExpStop; //!< Stop of Regular Expression
|
||||
public:
|
||||
void setPaternStop(std::string& _regExp);
|
||||
private:
|
||||
@@ -56,7 +56,7 @@ namespace appl {
|
||||
int32_t m_colorId; //!< Id of the the glyph painting
|
||||
public:
|
||||
void setColorGlyph(std::string& _colorName);
|
||||
const appl::GlyphDecoration& getColorGlyph(void) {
|
||||
const appl::GlyphDecoration& getColorGlyph() {
|
||||
return (*m_glyphPainting)[m_colorId];
|
||||
};
|
||||
private:
|
||||
@@ -75,13 +75,13 @@ namespace appl {
|
||||
void setLevel(int32_t _newLevel) {
|
||||
m_level = _newLevel;
|
||||
};
|
||||
int32_t getLevel(void) {
|
||||
int32_t getLevel() {
|
||||
return m_level;
|
||||
};
|
||||
private:
|
||||
|
||||
public:
|
||||
void display(void);
|
||||
void display();
|
||||
/**
|
||||
* @brief find Element only in the specify start characters and find the end with the range done
|
||||
* @param[in] _start First character to search data (if recognise it start here)
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#define __class__ "TextViewerPlugin"
|
||||
|
||||
|
||||
appl::TextViewerPlugin::TextViewerPlugin(void) :
|
||||
appl::TextViewerPlugin::TextViewerPlugin() :
|
||||
m_isEnable(true),
|
||||
m_activateOnEventEntry(false),
|
||||
m_activateOnEventInput(false),
|
||||
@@ -23,10 +23,10 @@ appl::TextViewerPlugin::TextViewerPlugin(void) :
|
||||
m_activateOnRemove(false),
|
||||
m_activateOnReceiveMessage(false),
|
||||
m_activateOnCursorMove(false) {
|
||||
|
||||
addObjectType("appl::TextViewerPlugin");
|
||||
}
|
||||
|
||||
appl::TextViewerPlugin::~TextViewerPlugin(void) {
|
||||
appl::TextViewerPlugin::~TextViewerPlugin() {
|
||||
if (m_isEnable == false) {
|
||||
return;
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@ namespace appl {
|
||||
class TextViewerPlugin : public ewol::Object {
|
||||
friend class appl::TextViewer;
|
||||
public:
|
||||
TextViewerPlugin(void);
|
||||
virtual ~TextViewerPlugin(void);
|
||||
TextViewerPlugin();
|
||||
virtual ~TextViewerPlugin();
|
||||
private:
|
||||
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
||||
public:
|
||||
@@ -32,20 +32,20 @@ namespace appl {
|
||||
* @brief Get the activity status.
|
||||
* @return true if the plugin is active, false otherwise.
|
||||
*/
|
||||
bool isEnable(void) {
|
||||
bool isEnable() {
|
||||
return m_isEnable;
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* @brief On plugin global enable.
|
||||
*/
|
||||
virtual void onPluginEnable(void) {
|
||||
virtual void onPluginEnable() {
|
||||
// nothing to do here ...
|
||||
};
|
||||
/**
|
||||
* @brief On plugin global disable.
|
||||
*/
|
||||
virtual void onPluginDisable(void) {
|
||||
virtual void onPluginDisable() {
|
||||
// nothing to do here ...
|
||||
};
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnEventEntry(void) {
|
||||
bool isAvaillableOnEventEntry() {
|
||||
return m_activateOnEventEntry;
|
||||
}
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnEventInput(void) {
|
||||
bool isAvaillableOnEventInput() {
|
||||
return m_activateOnEventInput;
|
||||
}
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnWrite(void) {
|
||||
bool isAvaillableOnWrite() {
|
||||
return m_activateOnWrite;
|
||||
}
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnReplace(void) {
|
||||
bool isAvaillableOnReplace() {
|
||||
return m_activateOnReplace;
|
||||
}
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnRemove(void) {
|
||||
bool isAvaillableOnRemove() {
|
||||
return m_activateOnRemove;
|
||||
}
|
||||
/**
|
||||
@@ -177,7 +177,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnReceiveMessage(void) {
|
||||
bool isAvaillableOnReceiveMessage() {
|
||||
return m_activateOnReceiveMessage;
|
||||
}
|
||||
/**
|
||||
@@ -186,8 +186,8 @@ namespace appl {
|
||||
* @param[in] _msg Generic message.
|
||||
* @return true if the event might not propagate anymore
|
||||
*/
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
@@ -197,7 +197,7 @@ namespace appl {
|
||||
* @brief Get the availlability of a callback
|
||||
* @return true if availlable
|
||||
*/
|
||||
bool isAvaillableOnCursorMove(void) {
|
||||
bool isAvaillableOnCursorMove() {
|
||||
return m_activateOnCursorMove;
|
||||
}
|
||||
/**
|
||||
|
@@ -15,8 +15,9 @@
|
||||
#define __class__ "TextPluginAutoIndent"
|
||||
|
||||
|
||||
appl::TextPluginAutoIndent::TextPluginAutoIndent(void) {
|
||||
appl::TextPluginAutoIndent::TextPluginAutoIndent() {
|
||||
m_activateOnEventEntry = true;
|
||||
addObjectType("appl::TextPluginAutoIndent");
|
||||
}
|
||||
|
||||
bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
|
@@ -18,8 +18,8 @@
|
||||
namespace appl {
|
||||
class TextPluginAutoIndent : public appl::TextViewerPlugin {
|
||||
public:
|
||||
TextPluginAutoIndent(void);
|
||||
~TextPluginAutoIndent(void) {
|
||||
TextPluginAutoIndent();
|
||||
virtual ~TextPluginAutoIndent() {
|
||||
// nothing to do ...
|
||||
};
|
||||
public:
|
||||
|
@@ -15,8 +15,9 @@
|
||||
#define __class__ "TextPluginCopy"
|
||||
|
||||
|
||||
appl::TextPluginCopy::TextPluginCopy(void) {
|
||||
appl::TextPluginCopy::TextPluginCopy() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
addObjectType("appl::TextPluginCopy");
|
||||
}
|
||||
|
||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
@@ -33,8 +34,8 @@ void appl::TextPluginCopy::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginCopy::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginCopy::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -18,14 +18,14 @@
|
||||
namespace appl {
|
||||
class TextPluginCopy : public appl::TextViewerPlugin {
|
||||
public:
|
||||
TextPluginCopy(void);
|
||||
~TextPluginCopy(void) {
|
||||
TextPluginCopy();
|
||||
virtual ~TextPluginCopy() {
|
||||
// nothing to do ...
|
||||
};
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -18,16 +18,17 @@
|
||||
#define __class__ "TextPluginCtags"
|
||||
|
||||
|
||||
appl::TextPluginCtags::TextPluginCtags(void) :
|
||||
m_tagFilename(""),
|
||||
appl::TextPluginCtags::TextPluginCtags() :
|
||||
m_tagFolderBase(""),
|
||||
m_tagFilename(""),
|
||||
m_ctagFile(NULL) {
|
||||
m_activateOnReceiveMessage = true;
|
||||
// load buffer manager:
|
||||
m_bufferManager = appl::BufferManager::keep();
|
||||
addObjectType("appl::TextPluginCtags");
|
||||
}
|
||||
appl::TextPluginCtags::~TextPluginCtags(void) {
|
||||
appl::BufferManager::release(m_bufferManager);
|
||||
appl::TextPluginCtags::~TextPluginCtags() {
|
||||
|
||||
}
|
||||
|
||||
const char* eventJumpDestination = "event-plugin-ctags-jump-destination";
|
||||
@@ -78,17 +79,17 @@ void appl::TextPluginCtags::jumpTo(const std::string& _name) {
|
||||
|
||||
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
|
||||
APPL_INFO("Multiple file destination ...");
|
||||
appl::TagFileSelection* tmpWidget = new appl::TagFileSelection();
|
||||
ewol::object::Shared<appl::TagFileSelection> tmpWidget = ewol::object::makeShared(new appl::TagFileSelection());
|
||||
if (NULL == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
tmpWidget->addCtagsNewItem(myfile.getName(), lineID);
|
||||
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
|
||||
do {
|
||||
tmpFile = m_tagFolderBase + "/" + entry.file;
|
||||
myfile = tmpFile;
|
||||
lineID = entry.address.lineNumber;
|
||||
printTag(&entry);
|
||||
tmpWidget->addCtagsNewItem(myfile.getName(), lineID);
|
||||
tmpWidget->addCtagsNewItem(myfile.getFileSystemName(), lineID);
|
||||
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
|
||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->registerOnEvent(this, applEventctagsSelection, eventOpenCtagsSelectReturn);
|
||||
@@ -108,7 +109,7 @@ void appl::TextPluginCtags::jumpFile(const std::string& _filename, int64_t _line
|
||||
sendMultiCast(appl::MsgSelectGotoLineSelect, std::to_string(_lineId));
|
||||
}
|
||||
|
||||
void appl::TextPluginCtags::loadTagFile(void) {
|
||||
void appl::TextPluginCtags::loadTagFile() {
|
||||
tagFileInfo info;
|
||||
// close previous tag file
|
||||
if (NULL != m_ctagFile) {
|
||||
@@ -156,7 +157,7 @@ void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
etk::FSNode tmpFilename = _msg.getData();
|
||||
m_tagFilename = tmpFilename.getNameFile();
|
||||
m_tagFolderBase = tmpFilename.getNameFolder();
|
||||
APPL_DEBUG("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
|
||||
APPL_INFO("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
|
||||
loadTagFile();
|
||||
} else if (_msg.getMessage() == eventOpenCtagsSelectReturn) {
|
||||
// parse the input data
|
||||
@@ -167,22 +168,28 @@ void appl::TextPluginCtags::onReceiveMessage(const ewol::object::Message& _msg)
|
||||
jumpFile(tmp, lineID - 1);
|
||||
}
|
||||
}
|
||||
bool appl::TextPluginCtags::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginCtags::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
if (_msg.getMessage() == eventOpenCtagsFile) {
|
||||
APPL_INFO("Request opening ctag file");
|
||||
ewol::widget::FileChooser* tmpWidget = new ewol::widget::FileChooser();
|
||||
ewol::object::Shared<ewol::widget::FileChooser> tmpWidget = ewol::object::makeShared(new ewol::widget::FileChooser());
|
||||
if (NULL == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||
} else {
|
||||
tmpWidget->setTitle("Open Exuberant Ctags file");
|
||||
tmpWidget->setValidateLabel("Open");
|
||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn);
|
||||
return true;
|
||||
}
|
||||
tmpWidget->setTitle("Open Exuberant Ctags file");
|
||||
tmpWidget->setValidateLabel("Open");
|
||||
// try to get the current folder :
|
||||
std::string path = _textDrawer.getBufferPath();
|
||||
APPL_ERROR("get path : '" << path << "'");
|
||||
if (path != "") {
|
||||
tmpWidget->setFolder(path);
|
||||
}
|
||||
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
|
||||
tmpWidget->registerOnEvent(this, "validate", eventOpenCtagsOpenFileReturn);
|
||||
return true;
|
||||
} else if (_msg.getMessage() == eventJumpDestination) {
|
||||
if (_textDrawer.hasBuffer() == false) {
|
||||
|
@@ -16,6 +16,9 @@
|
||||
#include <appl/TextPlugin.h>
|
||||
#include <appl/ctags/readtags.h>
|
||||
|
||||
// create ctags file : "ctags-exuberant --fields=n -R"
|
||||
// --fields=n add the line number needed for this software version ..
|
||||
|
||||
namespace appl {
|
||||
class TextPluginCtags : public appl::TextViewerPlugin {
|
||||
private:
|
||||
@@ -26,19 +29,19 @@ namespace appl {
|
||||
std::string m_tagFolderBase;
|
||||
std::string m_tagFilename;
|
||||
tagFile* m_ctagFile;
|
||||
void loadTagFile(void);
|
||||
void loadTagFile();
|
||||
void printTag(const tagEntry *_entry);
|
||||
void jumpTo(const std::string& _name);
|
||||
void jumpFile(const std::string& _filename, int64_t _lineId);
|
||||
appl::BufferManager* m_bufferManager; //!< handle on the buffer manager
|
||||
ewol::object::Shared<appl::BufferManager> m_bufferManager; //!< handle on the buffer manager
|
||||
public:
|
||||
TextPluginCtags(void);
|
||||
~TextPluginCtags(void);
|
||||
TextPluginCtags();
|
||||
virtual ~TextPluginCtags();
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg);
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg);
|
||||
// internal message :
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
};
|
||||
|
@@ -18,10 +18,11 @@
|
||||
namespace appl {
|
||||
template <typename TYPE> class TextViewerPluginData : public appl::TextViewerPlugin {
|
||||
public:
|
||||
TextViewerPluginData(void) {
|
||||
TextViewerPluginData() {
|
||||
// nothing to do ...
|
||||
addObjectType("appl::TextViewerPluginData");
|
||||
}
|
||||
virtual ~TextViewerPluginData(void) {
|
||||
virtual ~TextViewerPluginData() {
|
||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||
if (m_specificData[iii].second != NULL) {
|
||||
remove(*m_specificData[iii].second);
|
||||
@@ -32,7 +33,7 @@ namespace appl {
|
||||
m_specificData.clear();
|
||||
}
|
||||
private:
|
||||
std::vector<std::pair<appl::Buffer* ,TYPE* >> m_specificData;
|
||||
std::vector<std::pair<ewol::object::Shared<appl::Buffer> ,TYPE* >> m_specificData;
|
||||
protected:
|
||||
TYPE* getDataRef(appl::TextViewer& _textDrawer) {
|
||||
for (size_t iii = 0; iii < m_specificData.size() ; ++iii) {
|
||||
@@ -49,13 +50,13 @@ namespace appl {
|
||||
return data;
|
||||
}
|
||||
protected: // Wrap all element with their internal data: (do not use theses function)
|
||||
bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
TYPE* data = getDataRef(_textDrawer);
|
||||
if (data == NULL) {
|
||||
return false;
|
||||
}
|
||||
return onReceiveMessage(_textDrawer, _msg, *data);
|
||||
return onReceiveMessageViewer(_textDrawer, _msg, *data);
|
||||
}
|
||||
bool onWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
@@ -87,9 +88,9 @@ namespace appl {
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
TYPE& _data) {
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
TYPE& _data) {
|
||||
return false;
|
||||
}
|
||||
virtual bool onWrite(appl::TextViewer& _textDrawer,
|
||||
@@ -115,8 +116,14 @@ namespace appl {
|
||||
return;
|
||||
};
|
||||
public:
|
||||
virtual void onObjectRemove(ewol::Object* _removeObject) {
|
||||
// TODO : plop
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
appl::TextViewerPlugin::onObjectRemove(_object);
|
||||
for (auto it(m_specificData.begin()); it != m_specificData.end(); ++it) {
|
||||
if (it->first == _object) {
|
||||
m_specificData.erase(it);
|
||||
it = m_specificData.begin();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -15,11 +15,12 @@
|
||||
#undef __class__
|
||||
#define __class__ "TextPluginHistory"
|
||||
|
||||
appl::TextPluginHistory::TextPluginHistory(void) {
|
||||
appl::TextPluginHistory::TextPluginHistory() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
m_activateOnWrite = true;
|
||||
m_activateOnReplace = true;
|
||||
m_activateOnRemove = true;
|
||||
addObjectType("appl::TextPluginHistory");
|
||||
}
|
||||
|
||||
void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
@@ -34,9 +35,9 @@ void appl::TextPluginHistory::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
appl::PluginHistoryData& _data) {
|
||||
bool appl::TextPluginHistory::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
appl::PluginHistoryData& _data) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
@@ -176,7 +177,8 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer,
|
||||
}
|
||||
|
||||
|
||||
void appl::TextPluginHistory::onObjectRemove(ewol::Object* _removeObject) {
|
||||
void appl::TextPluginHistory::onObjectRemove(const ewol::object::Shared<ewol::Object>& _object) {
|
||||
appl::TextViewerPluginData<appl::PluginHistoryData>::onObjectRemove(_object);
|
||||
// TODO : Dependence with buffer removing ...
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
namespace appl {
|
||||
class History {
|
||||
public:
|
||||
History(void) :
|
||||
History() :
|
||||
m_posAdded(0),
|
||||
m_endPosAdded(0),
|
||||
m_endPosRemoved(0) {
|
||||
@@ -37,15 +37,15 @@ namespace appl {
|
||||
};
|
||||
class TextPluginHistory : public appl::TextViewerPluginData<appl::PluginHistoryData> {
|
||||
public:
|
||||
TextPluginHistory(void);
|
||||
virtual ~TextPluginHistory(void) { };
|
||||
TextPluginHistory();
|
||||
virtual ~TextPluginHistory() { };
|
||||
private:
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
appl::PluginHistoryData& _data);
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg,
|
||||
appl::PluginHistoryData& _data);
|
||||
virtual bool onWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _strData,
|
||||
@@ -67,7 +67,7 @@ namespace appl {
|
||||
void clearRedo(appl::PluginHistoryData& _data);
|
||||
void clearUndo(appl::PluginHistoryData& _data);
|
||||
public:
|
||||
virtual void onObjectRemove(ewol::Object* _removeObject);
|
||||
virtual void onObjectRemove(const ewol::object::Shared<ewol::Object>& _object);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -19,74 +19,66 @@
|
||||
#undef __class__
|
||||
#define __class__ "textPluginManager"
|
||||
|
||||
static std::vector<appl::TextViewerPlugin *>& getList(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::list<ewol::object::Owner<appl::TextViewerPlugin>>& getList() {
|
||||
static std::list<ewol::object::Owner<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnEventEntry(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventEntry() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnEventInput(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnEventInput() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnWrite(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnWrite() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnReplace(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnReplace() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnRemove(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnRemove() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnReceiveMessage(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListonReceiveMessageViewer() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
static std::vector<appl::TextViewerPlugin *>& getListOnCursorMove(void) {
|
||||
static std::vector<appl::TextViewerPlugin *> s_list;
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>>& getListOnCursorMove() {
|
||||
static std::vector<ewol::object::Shared<appl::TextViewerPlugin>> s_list;
|
||||
return s_list;
|
||||
}
|
||||
|
||||
void appl::textPluginManager::init(void) {
|
||||
void appl::textPluginManager::init() {
|
||||
|
||||
}
|
||||
|
||||
void appl::textPluginManager::unInit(void) {
|
||||
void appl::textPluginManager::unInit() {
|
||||
// remove all sub plugin class:
|
||||
getListOnEventEntry().clear();
|
||||
getListOnEventInput().clear();
|
||||
getListOnWrite().clear();
|
||||
getListOnReplace().clear();
|
||||
getListOnRemove().clear();
|
||||
getListOnReceiveMessage().clear();
|
||||
getListonReceiveMessageViewer().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::addPlugin(new appl::TextPluginCopy());
|
||||
appl::textPluginManager::addPlugin(new appl::TextPluginMultiLineTab());
|
||||
appl::textPluginManager::addPlugin(new appl::TextPluginAutoIndent());
|
||||
appl::textPluginManager::addPlugin(new appl::TextPluginHistory());
|
||||
appl::textPluginManager::addPlugin(new appl::TextPluginRmLine());
|
||||
appl::textPluginManager::addPlugin(new appl::TextPluginSelectAll());
|
||||
appl::textPluginManager::addPlugin(new appl::TextPluginCtags());
|
||||
void appl::textPluginManager::addDefaultPlugin() {
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginCopy()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginMultiLineTab()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginAutoIndent()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginHistory()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginRmLine()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginSelectAll()));
|
||||
appl::textPluginManager::addPlugin(ewol::object::makeShared(new appl::TextPluginCtags()));
|
||||
}
|
||||
|
||||
void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
||||
void appl::textPluginManager::addPlugin(const ewol::object::Shared<appl::TextViewerPlugin>& _plugin) {
|
||||
if (_plugin == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -107,7 +99,7 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
||||
getListOnRemove().push_back(_plugin);
|
||||
}
|
||||
if (_plugin->isAvaillableOnReceiveMessage() == true) {
|
||||
getListOnReceiveMessage().push_back(_plugin);
|
||||
getListonReceiveMessageViewer().push_back(_plugin);
|
||||
}
|
||||
if (_plugin->isAvaillableOnCursorMove() == true) {
|
||||
getListOnCursorMove().push_back(_plugin);
|
||||
@@ -115,31 +107,30 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) {
|
||||
}
|
||||
|
||||
void appl::textPluginManager::connect(appl::TextViewer& _widget) {
|
||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
||||
if (getList()[iii] == NULL) {
|
||||
for (auto &it : getList()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
getList()[iii]->onPluginEnable(_widget);
|
||||
it->onPluginEnable(_widget);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::textPluginManager::disconnect(appl::TextViewer& _widget) {
|
||||
for (int32_t iii=0; iii<getList().size(); ++iii) {
|
||||
if (getList()[iii] == NULL) {
|
||||
for (auto &it : getList()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
getList()[iii]->onPluginDisable(_widget);
|
||||
it->onPluginDisable(_widget);
|
||||
}
|
||||
}
|
||||
|
||||
bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Entry& _event) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnEventEntry();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnEventEntry()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onEventEntry(_textDrawer, _event) == true ) {
|
||||
if (it->onEventEntry(_textDrawer, _event) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -148,12 +139,11 @@ bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
|
||||
bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
||||
const ewol::event::Input& _event) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnEventInput();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnEventInput()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onEventInput(_textDrawer, _event) == true ) {
|
||||
if (it->onEventInput(_textDrawer, _event) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -163,12 +153,11 @@ bool appl::textPluginManager::onEventInput(appl::TextViewer& _textDrawer,
|
||||
bool appl::textPluginManager::onWrite(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _data) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnWrite();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnWrite()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onWrite(_textDrawer, _pos, _data) == true ) {
|
||||
if (it->onWrite(_textDrawer, _pos, _data) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -179,12 +168,11 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const std::string& _data,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnReplace();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnReplace()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
||||
if (it->onReplace(_textDrawer, _pos, _data, _posEnd) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -194,26 +182,24 @@ bool appl::textPluginManager::onReplace(appl::TextViewer& _textDrawer,
|
||||
bool appl::textPluginManager::onRemove(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos,
|
||||
const appl::Buffer::Iterator& _posEnd) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnRemove();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnRemove()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
||||
if (it->onRemove(_textDrawer, _pos, _posEnd) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnReceiveMessage();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
bool appl::textPluginManager::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
for (auto &it : getListonReceiveMessageViewer()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onReceiveMessage(_textDrawer, _msg) == true ) {
|
||||
if (it->onReceiveMessageViewer(_textDrawer, _msg) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -222,12 +208,11 @@ bool appl::textPluginManager::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
|
||||
bool appl::textPluginManager::onCursorMove(appl::TextViewer& _textDrawer,
|
||||
const appl::Buffer::Iterator& _pos) {
|
||||
std::vector<appl::TextViewerPlugin *>& list = getListOnCursorMove();
|
||||
for (int32_t iii=0; iii<list.size(); ++iii) {
|
||||
if (list[iii] == NULL) {
|
||||
for (auto &it : getListOnCursorMove()) {
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (list[iii]->onCursorMove(_textDrawer, _pos) == true ) {
|
||||
if (it->onCursorMove(_textDrawer, _pos) == true ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -20,20 +20,20 @@ namespace appl {
|
||||
/**
|
||||
* @brief Init the plugin manager for writer.
|
||||
*/
|
||||
void init(void);
|
||||
void init();
|
||||
/**
|
||||
* @brief UnInit the plugin manager for writer.
|
||||
*/
|
||||
void unInit(void);
|
||||
void unInit();
|
||||
/**
|
||||
* @brief Add default plugin list
|
||||
*/
|
||||
void addDefaultPlugin(void);
|
||||
void addDefaultPlugin();
|
||||
/**
|
||||
* @brief Add a plugin.
|
||||
* @param[in] _plugin Plugin pointer to add.
|
||||
*/
|
||||
void addPlugin(appl::TextViewerPlugin* _plugin);
|
||||
void addPlugin(const ewol::object::Shared<appl::TextViewerPlugin>& _plugin);
|
||||
/**
|
||||
* @brief connect a new widget to the plugin.
|
||||
* @param[in] _widget Reference on the widget caller.
|
||||
@@ -98,8 +98,8 @@ namespace appl {
|
||||
* @param[in] _msg Generic message.
|
||||
* @return true if the event might not propagate anymore
|
||||
*/
|
||||
bool onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg);
|
||||
bool onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg);
|
||||
/**
|
||||
* @brief Called when Cursor move of position.
|
||||
* @param[in] _widget Reference on the widget caller.
|
||||
|
@@ -14,8 +14,9 @@
|
||||
#undef __class__
|
||||
#define __class__ "TextPluginMultiLineTab"
|
||||
|
||||
appl::TextPluginMultiLineTab::TextPluginMultiLineTab(void) {
|
||||
appl::TextPluginMultiLineTab::TextPluginMultiLineTab() {
|
||||
m_activateOnEventEntry = true;
|
||||
addObjectType("appl::TextPluginMultiLineTab");
|
||||
}
|
||||
|
||||
bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
@@ -47,22 +48,22 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
_textDrawer.copy(data, itStart, itStop);
|
||||
// TODO : Change this ...
|
||||
bool m_useTabs = true;
|
||||
int32_t m_tabDist = 4;
|
||||
size_t m_tabDist = 4;
|
||||
|
||||
if (true == _event.getSpecialKey().getShift() ) {
|
||||
// un-indent
|
||||
data.insert(0, 1, u32char::Return);
|
||||
for (int32_t iii=1; iii<data.size(); ++iii) {
|
||||
if (data[iii-1] != u32char::Return) {
|
||||
for (size_t iii=1; iii<data.size(); ++iii) {
|
||||
if ((char32_t)data[iii-1] != u32char::Return) {
|
||||
continue;
|
||||
}
|
||||
if(data[iii] == u32char::Tabulation) {
|
||||
if((char32_t)data[iii] == u32char::Tabulation) {
|
||||
data.erase(iii, 1);
|
||||
} else if(data[iii] == u32char::Space) {
|
||||
for (int32_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
|
||||
if(data[iii] == u32char::Space) {
|
||||
} else if((char32_t)data[iii] == u32char::Space) {
|
||||
for (size_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
|
||||
if((char32_t)data[iii] == u32char::Space) {
|
||||
data.erase(iii, 1);
|
||||
} else if(data[iii] == u32char::Tabulation) {
|
||||
} else if((char32_t)data[iii] == u32char::Tabulation) {
|
||||
data.erase(iii, 1);
|
||||
break;
|
||||
} else {
|
||||
@@ -75,8 +76,8 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
||||
} else {
|
||||
// indent
|
||||
data.insert(0, 1, u32char::Return);
|
||||
for (int32_t iii=1; iii<data.size(); iii++) {
|
||||
if (data[iii-1] != u32char::Return) {
|
||||
for (size_t iii=1; iii<data.size(); iii++) {
|
||||
if ((char32_t)data[iii-1] != u32char::Return) {
|
||||
continue;
|
||||
}
|
||||
if (true == _event.getSpecialKey().getCtrl() ) {
|
||||
|
@@ -18,8 +18,8 @@
|
||||
namespace appl {
|
||||
class TextPluginMultiLineTab : public appl::TextViewerPlugin {
|
||||
public:
|
||||
TextPluginMultiLineTab(void);
|
||||
~TextPluginMultiLineTab(void) {
|
||||
TextPluginMultiLineTab();
|
||||
virtual ~TextPluginMultiLineTab() {
|
||||
// nothing to do ...
|
||||
};
|
||||
public:
|
||||
|
@@ -15,8 +15,9 @@
|
||||
#define __class__ "TextPluginRmLine"
|
||||
|
||||
|
||||
appl::TextPluginRmLine::TextPluginRmLine(void) {
|
||||
appl::TextPluginRmLine::TextPluginRmLine() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
addObjectType("appl::TextPluginRmLine");
|
||||
}
|
||||
|
||||
void appl::TextPluginRmLine::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
@@ -29,8 +30,8 @@ void appl::TextPluginRmLine::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginRmLine::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginRmLine::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -18,14 +18,14 @@
|
||||
namespace appl {
|
||||
class TextPluginRmLine : public appl::TextViewerPlugin {
|
||||
public:
|
||||
TextPluginRmLine(void);
|
||||
~TextPluginRmLine(void) {
|
||||
TextPluginRmLine();
|
||||
virtual ~TextPluginRmLine() {
|
||||
// nothing to do ...
|
||||
};
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -15,8 +15,9 @@
|
||||
#define __class__ "TextPluginSelectAll"
|
||||
|
||||
|
||||
appl::TextPluginSelectAll::TextPluginSelectAll(void) {
|
||||
appl::TextPluginSelectAll::TextPluginSelectAll() {
|
||||
m_activateOnReceiveMessage = true;
|
||||
addObjectType("appl::TextPluginSelectAll");
|
||||
}
|
||||
|
||||
static const char* eventSelectAll = "plugin-select-all";
|
||||
@@ -31,8 +32,8 @@ void appl::TextPluginSelectAll::onPluginDisable(appl::TextViewer& _textDrawer) {
|
||||
// TODO : unknow function ...
|
||||
}
|
||||
|
||||
bool appl::TextPluginSelectAll::onReceiveMessage(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
bool appl::TextPluginSelectAll::onReceiveMessageViewer(appl::TextViewer& _textDrawer,
|
||||
const ewol::object::Message& _msg) {
|
||||
if (isEnable() == false) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -18,14 +18,14 @@
|
||||
namespace appl {
|
||||
class TextPluginSelectAll : public appl::TextViewerPlugin {
|
||||
public:
|
||||
TextPluginSelectAll(void);
|
||||
~TextPluginSelectAll(void) {
|
||||
TextPluginSelectAll();
|
||||
virtual ~TextPluginSelectAll() {
|
||||
// nothing to do ...
|
||||
};
|
||||
public:
|
||||
virtual void onPluginEnable(appl::TextViewer& _textDrawer);
|
||||
virtual void onPluginDisable(appl::TextViewer& _textDrawer);
|
||||
virtual bool onReceiveMessage(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||
virtual bool onReceiveMessageViewer(appl::TextViewer& _textDrawer, const ewol::object::Message& _msg);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -846,7 +846,7 @@ static void findTag (const char *const name, const int options)
|
||||
}
|
||||
}
|
||||
|
||||
static void listTags (void)
|
||||
static void listTags ()
|
||||
{
|
||||
tagFileInfo info;
|
||||
tagEntry entry;
|
||||
|
@@ -8,4 +8,8 @@
|
||||
|
||||
#include <appl/debug.h>
|
||||
|
||||
const char * applLog = "edn ";
|
||||
int32_t appl::getLogId() {
|
||||
static int32_t g_val = etk::log::registerInstance("edn");
|
||||
return g_val;
|
||||
}
|
||||
|
||||
|
@@ -9,19 +9,43 @@
|
||||
#ifndef __APPL_DEBUG_H__
|
||||
#define __APPL_DEBUG_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/debugGeneric.h>
|
||||
#include <etk/log.h>
|
||||
|
||||
extern const char * applLog;
|
||||
namespace appl {
|
||||
int32_t getLogId();
|
||||
};
|
||||
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||
#define APPL_BASE(info,data) \
|
||||
do { \
|
||||
if (info <= etk::log::getLevel(appl::getLogId())) { \
|
||||
std::stringbuf sb; \
|
||||
std::ostream tmpStream(&sb); \
|
||||
tmpStream << data; \
|
||||
etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define APPL_CRITICAL(data) ETK_CRITICAL(applLog, data)
|
||||
#define APPL_WARNING(data) ETK_WARNING(applLog, data)
|
||||
#define APPL_ERROR(data) ETK_ERROR(applLog, data)
|
||||
#define APPL_INFO(data) ETK_INFO(applLog, data)
|
||||
#define APPL_DEBUG(data) ETK_DEBUG(applLog, data)
|
||||
#define APPL_VERBOSE(data) ETK_VERBOSE(applLog, data)
|
||||
#define APPL_ASSERT(cond, data) ETK_ASSERT(applLog, cond, data)
|
||||
#define APPL_CHECK_INOUT(cond) ETK_CHECK_INOUT(applLog, cond)
|
||||
#define APPL_TODO(cond) ETK_TODO(applLog, cond)
|
||||
#define APPL_CRITICAL(data) APPL_BASE(1, data)
|
||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||
#define APPL_WARNING(data) APPL_BASE(3, data)
|
||||
#ifdef DEBUG
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#define APPL_DEBUG(data) APPL_BASE(5, data)
|
||||
#define APPL_VERBOSE(data) APPL_BASE(6, data)
|
||||
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
|
||||
#else
|
||||
#define APPL_INFO(data) do { } while(false)
|
||||
#define APPL_DEBUG(data) do { } while(false)
|
||||
#define APPL_VERBOSE(data) do { } while(false)
|
||||
#define APPL_TODO(data) do { } while(false)
|
||||
#endif
|
||||
|
||||
#define APPL_ASSERT(cond,data) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
APPL_CRITICAL(data); \
|
||||
assert(!#cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
@@ -28,7 +28,7 @@ class myParamGlobal : public ewol::Object {
|
||||
bool m_displayTabChar;
|
||||
bool m_displaySpaceChar;
|
||||
public :
|
||||
myParamGlobal(void) {
|
||||
myParamGlobal() {
|
||||
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
|
||||
setName("edn_global_param");
|
||||
m_displayEOL=false;
|
||||
@@ -104,22 +104,22 @@ const char * const myParamGlobal::configAutoIndent = "auto-indent";
|
||||
const char * const myParamGlobal::configShowTabChar = "display-tab";
|
||||
const char * const myParamGlobal::configShowSpaceChar = "display-space";
|
||||
|
||||
static myParamGlobal& l_obj(void) {
|
||||
static myParamGlobal& l_obj() {
|
||||
static myParamGlobal s_obj;
|
||||
return s_obj;
|
||||
}
|
||||
|
||||
void globals::init(void) {
|
||||
void globals::init() {
|
||||
//ewol::userConfig::addUserConfig(&l_obj());
|
||||
}
|
||||
|
||||
void globals::UnInit(void) {
|
||||
void globals::UnInit() {
|
||||
// nothing to do ...
|
||||
//ewol::userConfig::RmUserConfig(&l_obj());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
bool globals::isSetDisplayEndOfLine(void) {
|
||||
bool globals::isSetDisplayEndOfLine() {
|
||||
return l_obj().m_displayEOL;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void globals::setDisplayEndOfLine(bool newVal) {
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
bool globals::isSetDisplaySpaceChar(void) {
|
||||
bool globals::isSetDisplaySpaceChar() {
|
||||
return l_obj().m_displaySpaceChar;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ void globals::setDisplaySpaceChar(bool _newVal) {
|
||||
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
bool globals::isSetDisplayTabChar(void) {
|
||||
bool globals::isSetDisplayTabChar() {
|
||||
return l_obj().m_displayTabChar;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ void globals::setDisplayTabChar(bool _newVal) {
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
bool globals::isSetAutoIndent(void) {
|
||||
bool globals::isSetAutoIndent() {
|
||||
return l_obj().m_AutoIndent;
|
||||
}
|
||||
|
||||
@@ -157,16 +157,16 @@ void globals::setAutoIndent(bool _newVal) {
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
bool globals::OrderTheBufferList(void) {
|
||||
bool globals::OrderTheBufferList() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
int32_t globals::getNbColoneBorder(void) {
|
||||
int32_t globals::getNbColoneBorder() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
int32_t globals::getNbLineBorder(void) {
|
||||
int32_t globals::getNbLineBorder() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ 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(void) :
|
||||
globals::ParameterGlobalsGui::ParameterGlobalsGui() :
|
||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert) {
|
||||
ewol::widget::CheckBox* myCheckbox = NULL;
|
||||
ewol::widget::Spacer* mySpacer = NULL;
|
||||
@@ -238,7 +238,7 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui(void) :
|
||||
}
|
||||
}
|
||||
|
||||
globals::ParameterGlobalsGui::~ParameterGlobalsGui(void) {
|
||||
globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -15,31 +15,31 @@
|
||||
|
||||
namespace globals
|
||||
{
|
||||
void init(void);
|
||||
void UnInit(void);
|
||||
int32_t getNbColoneBorder(void);
|
||||
int32_t getNbLineBorder(void);
|
||||
void init();
|
||||
void UnInit();
|
||||
int32_t getNbColoneBorder();
|
||||
int32_t getNbLineBorder();
|
||||
|
||||
bool isSetDisplayEndOfLine(void);
|
||||
bool isSetDisplayEndOfLine();
|
||||
void setDisplayEndOfLine(bool _newVal);
|
||||
|
||||
bool isSetDisplaySpaceChar(void);
|
||||
bool isSetDisplaySpaceChar();
|
||||
void setDisplaySpaceChar(bool _newVal);
|
||||
|
||||
bool isSetDisplayTabChar(void);
|
||||
bool isSetDisplayTabChar();
|
||||
void setDisplayTabChar(bool _newVal);
|
||||
|
||||
bool isSetAutoIndent(void);
|
||||
bool isSetAutoIndent();
|
||||
void setAutoIndent(bool _newVal);
|
||||
|
||||
void init2(void);
|
||||
void init2();
|
||||
|
||||
bool OrderTheBufferList(void);
|
||||
bool OrderTheBufferList();
|
||||
|
||||
class ParameterGlobalsGui : public ewol::widget::Sizer {
|
||||
public :
|
||||
ParameterGlobalsGui(void);
|
||||
~ParameterGlobalsGui(void);
|
||||
ParameterGlobalsGui();
|
||||
virtual ~ParameterGlobalsGui();
|
||||
// herited function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
};
|
||||
|
@@ -37,12 +37,13 @@ int main(int _argc, const char *_argv[]) {
|
||||
// only one things to do:
|
||||
return ewol::run(_argc, _argv);
|
||||
}
|
||||
appl::BufferManager* bufferManager = NULL;
|
||||
ewol::object::Shared<appl::BufferManager> bufferManager = NULL;
|
||||
|
||||
/**
|
||||
* @brief main application function initialisation
|
||||
*/
|
||||
bool APP_Init(ewol::Context& _context) {
|
||||
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/");
|
||||
@@ -65,7 +66,7 @@ bool APP_Init(ewol::Context& _context) {
|
||||
globals::init();
|
||||
|
||||
// init ALL Singleton :
|
||||
//(void)CTagsManager::getInstance();
|
||||
//()CTagsManager::getInstance();
|
||||
bufferManager = appl::BufferManager::keep();
|
||||
|
||||
appl::highlightManager::init();
|
||||
@@ -83,9 +84,9 @@ bool APP_Init(ewol::Context& _context) {
|
||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||
//APPL_INFO("The current working directory is " << cCurrentPath);
|
||||
|
||||
MainWindows* basicWindows = new MainWindows();
|
||||
ewol::object::Shared<MainWindows> basicWindows = ewol::object::makeShared(new MainWindows());
|
||||
|
||||
if (NULL == basicWindows) {
|
||||
if (basicWindows == nullptr) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
_context.stop();
|
||||
return false;
|
||||
@@ -102,12 +103,16 @@ bool APP_Init(ewol::Context& _context) {
|
||||
if (tmpppp == "-t") {
|
||||
ctagDetected = true;
|
||||
} else if (true == ctagDetected) {
|
||||
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("Load ctag file : \"" << name << "\"" );
|
||||
ctagDetected = false;
|
||||
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, tmpppp);
|
||||
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
|
||||
} else {
|
||||
APPL_INFO("need load file : \"" << tmpppp << "\"" );
|
||||
bufferManager->open(tmpppp);
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("need load file : \"" << name << "\"" );
|
||||
bufferManager->open(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,24 +126,11 @@ bool APP_Init(ewol::Context& _context) {
|
||||
*/
|
||||
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;
|
||||
}
|
||||
bufferManager.reset();
|
||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@ def create(target):
|
||||
# module name is 'edn' and type binary.
|
||||
myModule = module.Module(__file__, 'edn', 'PACKAGE')
|
||||
|
||||
myModule.add_extra_compile_flags()
|
||||
# add the file to compile:
|
||||
myModule.add_src_file([
|
||||
'appl/ctags/readtags.cpp'])
|
||||
@@ -74,6 +75,7 @@ def create(target):
|
||||
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/')
|
||||
|
@@ -1 +1 @@
|
||||
1.1.1
|
||||
1.2.0
|
Reference in New Issue
Block a user