Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
450fc0532d | |||
841f23a2db | |||
858fd3a428 | |||
4514239076 | |||
8fdeb39b5a | |||
eac1f8f594 | |||
0ba1c33525 | |||
e88bfb0f0b | |||
2031631b77 | |||
708e8794a0 | |||
64edc96eb0 | |||
79d95a8554 | |||
377662c3a0 | |||
8afe7a16f8 | |||
2266ba7040 | |||
2e96e5bfb1 | |||
667fe86dc7 | |||
e383600df6 | |||
33a36fa0f7 | |||
7aa4f9ae4d | |||
ecced51f81 | |||
6e2df2dc77 | |||
fc129e2745 | |||
5696539e2d | |||
dbcde77a61 | |||
e5e2ccc56f | |||
dab060c4fe | |||
3bdc96097c | |||
6ed410d936 | |||
9587e21498 | |||
244b83ed16 | |||
27db00a6f6 | |||
d4f313a54d | |||
29a5f34a3a | |||
4a916418d7 | |||
f51ea408fa | |||
cd3968dd20 | |||
76cd7bef21 | |||
e27720372b | |||
6f10243046 | |||
ae9c0f8eeb | |||
699564e17f |
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.heeroyui.ednpackage"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<application android:label="Edn"
|
||||
android:icon="@drawable/ic_luncher_edn">
|
||||
<!--android:hasCode="false"-->
|
||||
<!-- classpath-->
|
||||
<activity android:name=".edn"
|
||||
android:label="Edn Text-Editor"
|
||||
android:icon="@drawable/ic_luncher_edn"
|
||||
android:configChanges="orientation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="4" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
</manifest>
|
@@ -1,2 +0,0 @@
|
||||
APP_BUILD_SCRIPT=$PROJECT/Sources/Android.mk
|
||||
|
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="edn" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<loadproperties srcFile="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
<target name="-pre-build">
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
/* This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
@@ -1,10 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked in Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=/home/heero/dev/perso/android/sdk
|
@@ -1,40 +0,0 @@
|
||||
-optimizationpasses 5
|
||||
-dontusemixedcaseclassnames
|
||||
-dontskipnonpubliclibraryclasses
|
||||
-dontpreverify
|
||||
-verbose
|
||||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||
-keep public class * extends android.preference.Preference
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
-keepclassmembers class * extends android.app.Activity {
|
||||
public void *(android.view.View);
|
||||
}
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-15
|
64
Makefile
64
Makefile
@@ -1,15 +1,59 @@
|
||||
#############################################################################"
|
||||
# main makefile for a basic application
|
||||
# this is minimal application main makefile
|
||||
#############################################################################"
|
||||
|
||||
###############################################################################
|
||||
### Some Preject properties : ###
|
||||
###############################################################################
|
||||
|
||||
# group name or constructor ... (no dot, no MAJ no Numerical char)
|
||||
PROJECT_VENDOR=heeroyui
|
||||
# Binary name ... (no dot, no MAJ no Numerical char)
|
||||
# Project name ==> generate the application name [a-z] <== make attention at the case this generate error on Android compilation
|
||||
PROJECT_NAME=edn
|
||||
|
||||
USER_PACKAGES=$(shell pwd)/Sources/
|
||||
#Can be manny things, but limit whith no space no special char and no Maj ... [a-z]
|
||||
# com : Commercial
|
||||
# net : Network??
|
||||
# org : Organisation
|
||||
# gov : Governement
|
||||
# mil : Military
|
||||
# edu : Education
|
||||
# pri : Private
|
||||
# museum : ...
|
||||
PROJECT_COMPAGNY_TYPE=org
|
||||
|
||||
# include basic makefile for EWOL
|
||||
# Compagny name of the project [a-zA-Z0-9 \-]
|
||||
PROJECT_COMPAGNY_NAME=Edouard DUPIN
|
||||
|
||||
# List of mainainer that might be contact in problem case : "Mr NAME Surname<mail@host.com>" "second ..."
|
||||
PROJECT_MAINTAINER="Mr DUPIN Edouard <yui.heero@gmail.com>"
|
||||
|
||||
# the icon of the project is all time needed ... if it is not present the ewol icon might be set (must be a .png file) (and no space in the fileName and filePath)
|
||||
PROJECT_ICON=$(shell pwd)/data/icon.png
|
||||
|
||||
# project section : (must be separate by coma
|
||||
# refer to : http://packages.debian.org/sid/
|
||||
# admin cli-mono comm database debian-installer
|
||||
# debug doc editors electronics devel embedded
|
||||
# fonts games gnome gnu-r gnustep graphics
|
||||
# hamradio haskell httpd interpreters java
|
||||
# kde kernel libdevel libs lisp localization
|
||||
# mail math misc net news ocaml oldlibs otherosfs
|
||||
# perl php python ruby science shells sound tex
|
||||
# text utils vcs video virtual web x11 xfce zope ...
|
||||
PROJECT_SECTION=Development,Editors
|
||||
|
||||
# project prority
|
||||
# required : Packages which are necessary for the proper functioning of the system (usually, this means that dpkg functionality depends on these packages). Removing a required package may cause your system to become totally broken and you may not even be able to use dpkg to put things back, so only do so if you know what you are doing. Systems with only the required packages are probably unusable, but they do have enough functionality to allow the sysadmin to boot and install more software.
|
||||
# important : Important programs, including those which one would expect to find on any Unix-like system. If the expectation is that an experienced Unix person who found it missing would say "What on earth is going on, where is foo?", it must be an important package.[6] Other packages without which the system will not run well or be usable must also have priority important. This does not include Emacs, the X Window System, TeX or any other large applications. The important packages are just a bare minimum of commonly-expected and necessary tools.
|
||||
# standard : These packages provide a reasonably small but not too limited character-mode system. This is what will be installed by default if the user doesn't select anything else. It doesn't include many large applications.
|
||||
# optional : (In a sense everything that isn't required is optional, but that's not what is meant here.) This is all the software that you might reasonably want to install if you didn't know what it was and don't have specialized requirements. This is a much larger system and includes the X Window System, a full TeX distribution, and many applications. Note that optional packages should not conflict with each other.
|
||||
# extra : This contains all packages that conflict with others with required, important, standard or optional priorities, or are only likely to be useful if you already know what they are or have specialized requirements (such as packages containing only detached debugging symbols).
|
||||
PROJECT_PRIORITY=optional
|
||||
|
||||
# description of the current project inside quote and no \n
|
||||
PROJECT_DESCRIPTION="Text editor for sources code with ctags management"
|
||||
|
||||
# Add package needed :
|
||||
# current user packages
|
||||
USER_PACKAGES =$(shell pwd)/Sources/
|
||||
# Add ewol packages
|
||||
USER_PACKAGES+=$(shell realpath $(shell pwd)/../ewol/Sources/)
|
||||
|
||||
# include basic makefile for ewol generic toolchain
|
||||
include $(shell pwd)/../ewol/Build/Makefile.mk
|
||||
|
||||
|
@@ -25,6 +25,7 @@ download the software :
|
||||
make DEBUG=1
|
||||
or
|
||||
make CLANG=1 DEBUG=1
|
||||
cp -r ../ewol/share/* share/
|
||||
./out_LINUX/debug/obj/usr/bin/edn -l6 yourFile.txt
|
||||
Note : -l6 corespond at the LOG level to display
|
||||
|
||||
|
@@ -5,8 +5,14 @@ include $(CLEAR_VARS)
|
||||
# load the common sources file of the platform
|
||||
include $(LOCAL_PATH)/file.mk
|
||||
|
||||
LOCAL_CONFIG_FILES := Config.in
|
||||
|
||||
# name of the librairy
|
||||
LOCAL_MODULE := ednpackage
|
||||
ifeq ($(CONFIG___EWOL_APPL_NAME__),$(empty))
|
||||
LOCAL_MODULE := edn
|
||||
else
|
||||
LOCAL_MODULE := $(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))
|
||||
endif
|
||||
|
||||
# get the tag of the current project :
|
||||
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
|
||||
@@ -14,12 +20,11 @@ LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=
|
||||
$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG))
|
||||
|
||||
# name of the dependency
|
||||
LOCAL_STATIC_LIBRARIES := ewol
|
||||
LOCAL_LIBRARIES := ewol freetype libpng parsersvg tinyxml lua etk libzip
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(addprefix $(LOCAL_PATH)/, $(sort $(dir $(FILE_LIST))))
|
||||
|
||||
LOCAL_SRC_FILES := ewolAndroidAbstraction.cpp \
|
||||
$(FILE_LIST)
|
||||
LOCAL_SRC_FILES := $(FILE_LIST)
|
||||
|
||||
LOCAL_LDLIBS := -llog -landroid
|
||||
|
||||
@@ -37,7 +42,3 @@ endif
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
|
||||
|
||||
|
||||
$(call import-module,ewol/Sources)
|
||||
|
23
Sources/Config.in
Normal file
23
Sources/Config.in
Normal file
@@ -0,0 +1,23 @@
|
||||
menu "General"
|
||||
if __VIDEO__OPENGL_ES_2
|
||||
choice
|
||||
prompt "Buffer text configuration"
|
||||
default APPL_BUFFER_FONT_NORMAL
|
||||
help
|
||||
Buffer display mode :
|
||||
0 : Basic Sprite font mode.
|
||||
==> Old standard mode fast but need to reaload distint font for every size
|
||||
1 : Distance Field.
|
||||
==> New theoric mode for the display of the font ==> really slow but insteresting ...
|
||||
config APPL_BUFFER_FONT_NORMAL
|
||||
bool "0: Basic Sprite font mode"
|
||||
config APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
bool "1: Distance Field"
|
||||
endchoice
|
||||
endif
|
||||
if __VIDEO__OPENGL_ES_1
|
||||
config APPL_BUFFER_FONT_NORMAL
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
endmenu
|
@@ -5,9 +5,14 @@ include $(CLEAR_VARS)
|
||||
# load the common sources file of the platform
|
||||
include $(LOCAL_PATH)/file.mk
|
||||
|
||||
# name of the librairy
|
||||
LOCAL_MODULE := edn
|
||||
LOCAL_CONFIG_FILES := Config.in
|
||||
|
||||
# name of the librairy
|
||||
ifeq ($(CONFIG___EWOL_APPL_NAME__),$(empty))
|
||||
LOCAL_MODULE := edn
|
||||
else
|
||||
LOCAL_MODULE := $(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))
|
||||
endif
|
||||
# get the tag of the current project :
|
||||
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
|
||||
LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=0)
|
||||
@@ -32,9 +37,6 @@ LOCAL_CFLAGS := -DMODE_RELEASE \
|
||||
-DAPPL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG_SHORT)-$(BUILD_DIRECTORY_MODE)\""
|
||||
endif
|
||||
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
|
||||
|
||||
|
||||
$(call import-module,ewol/Sources)
|
||||
|
@@ -5,8 +5,14 @@ include $(CLEAR_VARS)
|
||||
# load the common sources file of the platform
|
||||
include $(LOCAL_PATH)/file.mk
|
||||
|
||||
LOCAL_CONFIG_FILES := Config.in
|
||||
|
||||
# name of the librairy
|
||||
ifeq ($(CONFIG___EWOL_APPL_NAME__),$(empty))
|
||||
LOCAL_MODULE := edn
|
||||
else
|
||||
LOCAL_MODULE := $(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__))
|
||||
endif
|
||||
|
||||
# get the tag of the current project :
|
||||
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
|
||||
@@ -33,8 +39,3 @@ LOCAL_CFLAGS := -DMODE_RELEASE \
|
||||
endif
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
NDK_MODULE_PATH := $(LOCAL_PATH)/../../
|
||||
|
||||
|
||||
$(call import-module,ewol/Sources)
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include <appl/global.h>
|
||||
#include <Buffer.h>
|
||||
#include <BufferManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "Buffer"
|
||||
@@ -48,8 +48,10 @@ Buffer::Buffer()
|
||||
m_haveName = false;
|
||||
etk::UString mString = "Untitle - ";
|
||||
mString += fileBasicID++;
|
||||
EWOL_DEBUG("Create buffer try name : \"" << mString << "\"");
|
||||
SetFileName(mString);
|
||||
m_haveName = false;
|
||||
EWOL_DEBUG("Create buffer with name : " << m_fileName );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,10 +62,12 @@ Buffer::Buffer()
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
Buffer::Buffer(etk::File &newName)
|
||||
Buffer::Buffer(etk::FSNode &newName)
|
||||
{
|
||||
m_fileModify = false;
|
||||
EWOL_DEBUG("Create buffer try name : \"" << newName << "\"");
|
||||
SetFileName(newName);
|
||||
EWOL_DEBUG("Create buffer with name : " << m_fileName );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +80,7 @@ Buffer::Buffer(etk::File &newName)
|
||||
*/
|
||||
Buffer::~Buffer(void)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief
|
||||
@@ -117,19 +121,19 @@ bool Buffer::NeedToUpdateDisplayPosition(void)
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
Vector2D<float> Buffer::GetBorderSize(void)
|
||||
etk::Vector2D<float> Buffer::GetBorderSize(void)
|
||||
{
|
||||
Vector2D<float> tmpVal;
|
||||
etk::Vector2D<float> tmpVal;
|
||||
tmpVal.x = 30;
|
||||
tmpVal.y = 30;
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
|
||||
Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested)
|
||||
etk::Vector2D<float> Buffer::GetPosition(int32_t fontId,bool& centerRequested)
|
||||
{
|
||||
centerRequested = false;
|
||||
Vector2D<float> tmpVal;
|
||||
etk::Vector2D<float> tmpVal;
|
||||
tmpVal.x = 0;
|
||||
tmpVal.y = 0;
|
||||
return tmpVal;
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#define __BUFFER_H__
|
||||
|
||||
#include <etk/UString.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <etk/unicode.h>
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
@@ -41,19 +41,24 @@ typedef struct{
|
||||
uint32_t diplayableLine; //!< NB Line that can be displayed
|
||||
}infoStatBuffer_ts;
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
#define TEXT_DISPLAY_TYPE OObject2DTextShader
|
||||
#else
|
||||
#define TEXT_DISPLAY_TYPE OObject2DTextColored
|
||||
#endif
|
||||
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer(void);
|
||||
Buffer(etk::File &newName);
|
||||
Buffer(etk::FSNode &newName);
|
||||
virtual ~Buffer(void);
|
||||
|
||||
etk::File GetFileName(void)
|
||||
etk::FSNode GetFileName(void)
|
||||
{
|
||||
return m_fileName;
|
||||
};
|
||||
|
||||
void SetFileName(etk::File &newName)
|
||||
void SetFileName(etk::FSNode &newName)
|
||||
{
|
||||
m_fileName = newName;
|
||||
m_haveName = true;
|
||||
@@ -62,7 +67,7 @@ class Buffer {
|
||||
|
||||
void SetFileName(etk::UString &newName)
|
||||
{
|
||||
m_fileName.SetCompleateName(newName, etk::FILE_TYPE_DIRECT);
|
||||
m_fileName.SetName(newName);
|
||||
m_haveName = true;
|
||||
NameChange();
|
||||
};
|
||||
@@ -80,19 +85,24 @@ class Buffer {
|
||||
public:
|
||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate) {};
|
||||
virtual void SetLineDisplay(uint32_t lineNumber) {};
|
||||
|
||||
virtual int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
ewol::OObject2DTextColored& OOTextBold,
|
||||
ewol::OObject2DTextColored& OOTextItalic,
|
||||
ewol::OObject2DTextColored& OOTextBoldItalic,
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
|
||||
#else
|
||||
virtual int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
#endif
|
||||
{
|
||||
return ERR_NONE;
|
||||
}
|
||||
virtual void AddChar(uniChar_t unicodeData) {};
|
||||
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent) {};
|
||||
virtual void MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height) {};
|
||||
virtual void MouseEvent(int32_t fontId, int32_t width, int32_t height) {};
|
||||
virtual void MouseSelectFromCursorTo(etk::Vector2D<float> pos) {};
|
||||
virtual void MouseEvent(etk::Vector2D<float> pos) {};
|
||||
virtual void MouseEventDouble(void) {};
|
||||
virtual void MouseEventTriple(void) {};
|
||||
virtual void RemoveLine(void) {};
|
||||
@@ -103,9 +113,9 @@ class Buffer {
|
||||
virtual void SetCharset(unicode::charset_te newCharset) {};
|
||||
|
||||
//virtual void SelectAll(void);
|
||||
virtual void Copy(int8_t clipboardID) {};
|
||||
virtual void Cut(int8_t clipboardID) {};
|
||||
virtual void Paste(int8_t clipboardID) {};
|
||||
virtual void Copy(ewol::clipBoard::clipboardListe_te clipboardID) {};
|
||||
virtual void Cut(ewol::clipBoard::clipboardListe_te clipboardID) {};
|
||||
virtual void Paste(ewol::clipBoard::clipboardListe_te clipboardID) {};
|
||||
virtual void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp) {};
|
||||
virtual void Replace(etk::UString &data) {};
|
||||
virtual int32_t FindLine(etk::UString &data) { return 0; };
|
||||
@@ -117,19 +127,19 @@ class Buffer {
|
||||
// moving with cursor change position:
|
||||
private:
|
||||
bool m_updatePositionRequested; //!< if a position xhange in the windows ...
|
||||
Vector2D<float> m_maximumSize; //!< current maxSize of the buffer
|
||||
etk::Vector2D<float> m_maximumSize; //!< current maxSize of the buffer
|
||||
protected:
|
||||
void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; };
|
||||
void SetMaximumSize(Vector2D<float> maxSize) { m_maximumSize = maxSize; };
|
||||
void SetMaximumSize(etk::Vector2D<float> maxSize) { m_maximumSize = maxSize; };
|
||||
public:
|
||||
bool NeedToUpdateDisplayPosition(void);
|
||||
virtual Vector2D<float> GetBorderSize(void); // this is to requested the minimum size for the buffer that is not consider as visible ...
|
||||
virtual Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
|
||||
Vector2D<float> GetMaxSize(void) { return m_maximumSize; };
|
||||
virtual etk::Vector2D<float> GetBorderSize(void); // this is to requested the minimum size for the buffer that is not consider as visible ...
|
||||
virtual etk::Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
|
||||
etk::Vector2D<float> GetMaxSize(void) { return m_maximumSize; };
|
||||
protected:
|
||||
bool m_fileModify; //!<
|
||||
// naming
|
||||
etk::File m_fileName; //!< filename of the curent buffer
|
||||
etk::FSNode m_fileName; //!< filename of the curent buffer
|
||||
bool m_haveName; //!< to know if the file have a name or NOT
|
||||
};
|
||||
|
||||
|
@@ -67,34 +67,57 @@ BufferEmpty::~BufferEmpty(void)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
int32_t BufferEmpty::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
ewol::OObject2DTextColored& OOTextBold,
|
||||
ewol::OObject2DTextColored& OOTextItalic,
|
||||
ewol::OObject2DTextColored& OOTextBoldItalic,
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
#else
|
||||
int32_t BufferEmpty::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||
#endif
|
||||
{
|
||||
// Get color :
|
||||
Colorize *myColor = NULL;
|
||||
|
||||
int32_t fontId = OOTextNormal.GetFontID();
|
||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t letterHeight = OOText.GetHeight();
|
||||
#else
|
||||
int32_t letterHeight = OOTextNormal.GetHeight();
|
||||
#endif
|
||||
|
||||
Vector2D<float> textPos;
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = 20;
|
||||
textPos.y = sizeY - 20 - letterHeight;
|
||||
etk::UString tmpDisplay ;
|
||||
|
||||
myColor = ColorizeManager::Get("normal");
|
||||
OOTextBold.SetColor(myColor->GetFG());
|
||||
etk::UString tmpDisplay = "edn - Editeur De N'ours";
|
||||
OOTextBold.Text(textPos, tmpDisplay);
|
||||
tmpDisplay = "edn - Editeur De N'ours";
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.SetBold(true);
|
||||
OOText.SetItalic(false);
|
||||
OOText.Text(textPos, tmpDisplay);
|
||||
#else
|
||||
OOTextBold.SetColor(myColor->GetFG());
|
||||
OOTextBold.Text(textPos, tmpDisplay);
|
||||
#endif
|
||||
|
||||
myColor = ColorizeManager::Get("commentDoxygen");
|
||||
OOTextNormal.SetColor(myColor->GetFG());
|
||||
textPos.y = (int32_t)(textPos.y - letterHeight*1.30);
|
||||
tmpDisplay = "No Buffer Availlable to display";
|
||||
OOTextNormal.Text(textPos, tmpDisplay);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.SetBold(false);
|
||||
OOText.SetItalic(false);
|
||||
OOText.SetColor(myColor->GetFG());
|
||||
OOText.Text(textPos, tmpDisplay);
|
||||
#else
|
||||
OOTextNormal.SetColor(myColor->GetFG());
|
||||
OOTextNormal.Text(textPos, tmpDisplay);
|
||||
#endif
|
||||
|
||||
OOColored.SetColor(etk::color::white);
|
||||
OOColored.SetColor(draw::color::white);
|
||||
OOColored.Rectangle( 0, 0, sizeX, sizeY);
|
||||
|
||||
return ERR_NONE;
|
||||
|
@@ -32,11 +32,17 @@ class BufferEmpty : public Buffer {
|
||||
public:
|
||||
BufferEmpty(void);
|
||||
virtual ~BufferEmpty(void);
|
||||
int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
ewol::OObject2DTextColored& OOTextBold,
|
||||
ewol::OObject2DTextColored& OOTextItalic,
|
||||
ewol::OObject2DTextColored& OOTextBoldItalic,
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||
#else
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
@@ -27,8 +27,8 @@
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <BufferManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/EObjectManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/eObject/EObjectManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "classBufferManager"
|
||||
@@ -63,15 +63,15 @@ class classBufferManager: public ewol::EObject
|
||||
// create a buffer with no element
|
||||
int32_t Create(void);
|
||||
// open curent filename
|
||||
int32_t Open(etk::File &myFile);
|
||||
int32_t Open(etk::FSNode &myFile);
|
||||
bool Remove(int32_t BufferID);
|
||||
public:
|
||||
int32_t GetSelected(void) { return m_idSelected;};
|
||||
//void SetSelected(int32_t id) {m_idSelected = id;};
|
||||
Buffer * Get(int32_t BufferID);
|
||||
bool Exist(int32_t BufferID);
|
||||
bool Exist(etk::File &myFile);
|
||||
int32_t GetId(etk::File &myFile);
|
||||
bool Exist(etk::FSNode &myFile);
|
||||
int32_t GetId(etk::FSNode &myFile);
|
||||
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||
uint32_t Size(void);
|
||||
uint32_t SizeOpen(void);
|
||||
@@ -165,7 +165,8 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
|
||||
}
|
||||
} else if (eventId == ednMsgOpenFile) {
|
||||
if (data != "" ) {
|
||||
etk::File myFile(data, etk::FILE_TYPE_DIRECT);
|
||||
etk::FSNode myFile(data);
|
||||
APPL_DEBUG("request open file = \"" <<data << "\" ?= \"" << myFile << "\"");
|
||||
int32_t newOne = Open(myFile);
|
||||
if (-1 != newOne) {
|
||||
m_idSelected = newOne;
|
||||
@@ -342,7 +343,7 @@ int32_t classBufferManager::Create(void)
|
||||
* @todo : check if this file is not curently open and return the old ID
|
||||
*
|
||||
*/
|
||||
int32_t classBufferManager::Open(etk::File &myFile)
|
||||
int32_t classBufferManager::Open(etk::FSNode &myFile)
|
||||
{
|
||||
if (false == Exist(myFile)) {
|
||||
// allocate a new Buffer
|
||||
@@ -395,7 +396,7 @@ bool classBufferManager::Exist(int32_t BufferID)
|
||||
}
|
||||
|
||||
|
||||
bool classBufferManager::Exist(etk::File &myFile )
|
||||
bool classBufferManager::Exist(etk::FSNode &myFile )
|
||||
{
|
||||
if (-1 == GetId(myFile)) {
|
||||
return false;
|
||||
@@ -404,7 +405,7 @@ bool classBufferManager::Exist(etk::File &myFile )
|
||||
}
|
||||
|
||||
|
||||
int32_t classBufferManager::GetId(etk::File &myFile)
|
||||
int32_t classBufferManager::GetId(etk::FSNode &myFile)
|
||||
{
|
||||
int32_t iii;
|
||||
// check if the Buffer existed
|
||||
@@ -512,7 +513,7 @@ static classBufferManager * localManager = NULL;
|
||||
|
||||
void BufferManager::Init(void)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
if (NULL != localManager) {
|
||||
EWOL_ERROR("classBufferManager ==> already exist, just unlink the previous ...");
|
||||
localManager = NULL;
|
||||
}
|
||||
@@ -560,7 +561,7 @@ bool BufferManager::Exist(int32_t BufferID)
|
||||
return localManager->Exist(BufferID);
|
||||
}
|
||||
|
||||
bool BufferManager::Exist(etk::File &myFile)
|
||||
bool BufferManager::Exist(etk::FSNode &myFile)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
|
||||
@@ -569,7 +570,7 @@ bool BufferManager::Exist(etk::File &myFile)
|
||||
return localManager->Exist(myFile);
|
||||
}
|
||||
|
||||
int32_t BufferManager::GetId(etk::File &myFile)
|
||||
int32_t BufferManager::GetId(etk::FSNode &myFile)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <BufferText.h>
|
||||
#include <BufferEmpty.h>
|
||||
#include <appl/globalMsg.h>
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
namespace BufferManager
|
||||
{
|
||||
@@ -39,8 +39,8 @@ namespace BufferManager
|
||||
int32_t GetSelected(void);
|
||||
Buffer * Get(int32_t BufferID);
|
||||
bool Exist(int32_t BufferID);
|
||||
bool Exist(etk::File &myFile);
|
||||
int32_t GetId(etk::File &myFile);
|
||||
bool Exist(etk::FSNode &myFile);
|
||||
int32_t GetId(etk::FSNode &myFile);
|
||||
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||
uint32_t Size(void);
|
||||
uint32_t SizeOpen(void);
|
||||
|
@@ -30,10 +30,10 @@
|
||||
#include <etk/unicode.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/OObject.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/Font.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/font/Font.h>
|
||||
#include <ewol/ClipBoard.h>
|
||||
|
||||
|
||||
@@ -117,20 +117,21 @@ BufferText::BufferText()
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
BufferText::BufferText(etk::File &fileName) : Buffer(fileName)
|
||||
BufferText::BufferText(etk::FSNode &fileName) : Buffer(fileName)
|
||||
{
|
||||
BasicInit();
|
||||
NameChange();
|
||||
APPL_INFO("Add Data from file(" << GetFileName() << ")");
|
||||
FILE * myFile = NULL;
|
||||
// try to open the file. if not existed, new file
|
||||
|
||||
myFile = fopen(fileName.GetCompleateName().c_str(), "r");
|
||||
if (NULL != myFile) {
|
||||
m_EdnBuf.DumpFrom(myFile);
|
||||
// close the input file
|
||||
fclose(myFile);
|
||||
SetModify(false);
|
||||
etk::FSNode myFile(fileName);
|
||||
if (true == myFile.Exist()) {
|
||||
if (false == myFile.FileOpenRead()) {
|
||||
APPL_WARNING("File can not be open in read mode : " << myFile);
|
||||
SetModify(true);
|
||||
} else {
|
||||
m_EdnBuf.DumpFrom(myFile);
|
||||
myFile.FileClose();
|
||||
SetModify(false);
|
||||
}
|
||||
} else {
|
||||
// fichier inexistant... creation d'un nouveaux
|
||||
APPL_WARNING("No File ==> created a new one(" << GetFileName() << ")");
|
||||
@@ -151,14 +152,13 @@ BufferText::BufferText(etk::File &fileName) : Buffer(fileName)
|
||||
void BufferText::Save(void)
|
||||
{
|
||||
APPL_INFO("Save File : \"" << GetFileName() << "\"" );
|
||||
FILE * myFile = NULL;
|
||||
myFile = fopen(GetFileName().GetCompleateName().c_str(), "w");
|
||||
if (NULL != myFile) {
|
||||
m_EdnBuf.DumpIn(myFile);
|
||||
fclose(myFile);
|
||||
SetModify(false);
|
||||
} else {
|
||||
etk::FSNode myFile(GetFileName());
|
||||
if (false == myFile.FileOpenWrite()) {
|
||||
APPL_ERROR("Can not open in writing the specify file");
|
||||
} else {
|
||||
m_EdnBuf.DumpIn(myFile);
|
||||
myFile.FileClose();
|
||||
SetModify(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
|
||||
|
||||
#define SEPARATION_SIZE_LINE_NUMBER (3)
|
||||
|
||||
void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY)
|
||||
void BufferText::DrawLineNumber(ewol::TEXT_DISPLAY_TYPE* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY)
|
||||
{
|
||||
char tmpLineNumber[50];
|
||||
sprintf(tmpLineNumber, "%*d", nbColomn, lineNumber);
|
||||
@@ -214,7 +214,7 @@ void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObjec
|
||||
OOColored->Rectangle( 0, positionY, sizeX+0.5*SEPARATION_SIZE_LINE_NUMBER, sizeY);
|
||||
OOText->SetColor(ColorizeManager::Get(COLOR_CODE_LINE_NUMBER));
|
||||
|
||||
Vector2D<float> textPos;
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = 1;
|
||||
textPos.y = positionY;
|
||||
etk::UString tmppp = tmpLineNumber;
|
||||
@@ -225,7 +225,7 @@ void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObjec
|
||||
#define CURSOR_THICKNESS (1.2)
|
||||
void BufferText::DrawCursor(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip)
|
||||
{
|
||||
etk::Color & tmpppppp = ColorizeManager::Get(COLOR_CODE_CURSOR);
|
||||
draw::Color & tmpppppp = ColorizeManager::Get(COLOR_CODE_CURSOR);
|
||||
OOColored->SetColor(tmpppppp);
|
||||
if (true == ewol::IsSetInsert()) {
|
||||
OOColored->Rectangle( x, y, letterWidth, letterHeight);
|
||||
@@ -277,29 +277,39 @@ int32_t BufferText::GetNumberOfLine(void)
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
ewol::OObject2DTextColored& OOTextBold,
|
||||
ewol::OObject2DTextColored& OOTextItalic,
|
||||
ewol::OObject2DTextColored& OOTextBoldItalic,
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY)
|
||||
#else
|
||||
int32_t BufferText::Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY)
|
||||
#endif
|
||||
{
|
||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||
bool selIsRect;
|
||||
int32_t selHave;
|
||||
|
||||
int32_t fontId = OOTextNormal.GetFontID();
|
||||
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t letterWidth = OOText.GetSize("A").x;
|
||||
int32_t letterHeight = OOText.GetHeight();
|
||||
#else
|
||||
int32_t letterWidth = OOTextNormal.GetSize("A").x;
|
||||
int32_t letterHeight = OOTextNormal.GetHeight();
|
||||
#endif
|
||||
int32_t displayStartLineId = offsetY / letterHeight - 1;
|
||||
displayStartLineId = etk_max(0, displayStartLineId);
|
||||
uint32_t y = - offsetY + displayStartLineId*letterHeight;
|
||||
int32_t y = - offsetY + displayStartLineId*letterHeight;
|
||||
|
||||
// update the display position with the scroll ofset :
|
||||
int32_t displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId);
|
||||
Vector2D<float> maxSize;
|
||||
etk::Vector2D<float> maxSize;
|
||||
maxSize.x = 0.0;
|
||||
maxSize.y = m_EdnBuf.NumberOfLines() * letterHeight;
|
||||
int32_t nbColoneForLineNumber = GetLineNumberNumberOfElement();
|
||||
@@ -317,11 +327,12 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
// Get color :
|
||||
Colorize * myColor = ColorizeManager::Get("normal");
|
||||
Colorize * myColorSel = ColorizeManager::Get("SelectedText");
|
||||
etk::Color & myColorSpace = ColorizeManager::Get(COLOR_CODE_SPACE);
|
||||
etk::Color & myColorTab = ColorizeManager::Get(COLOR_CODE_TAB);
|
||||
draw::Color & myColorSpace = ColorizeManager::Get(COLOR_CODE_SPACE);
|
||||
draw::Color & myColorTab = ColorizeManager::Get(COLOR_CODE_TAB);
|
||||
Colorize * selectColor = NULL;
|
||||
ewol::OObject2DTextColored* OOTextSelected = NULL;
|
||||
|
||||
#ifndef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
ewol::TEXT_DISPLAY_TYPE* OOTextSelected = NULL;
|
||||
#endif
|
||||
int mylen = m_EdnBuf.Size();
|
||||
int32_t x_base=nbColoneForLineNumber*letterWidth;
|
||||
int32_t idX = 0;
|
||||
@@ -350,9 +361,14 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
y = sizeY - y;
|
||||
y -= letterHeight;
|
||||
|
||||
OOTextNormal.clippingDisable();
|
||||
OOColored.clippingDisable();
|
||||
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.clippingDisable();
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
#else
|
||||
OOTextNormal.clippingDisable();
|
||||
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
#endif
|
||||
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||
|
||||
clipping_ts drawClipping;
|
||||
@@ -367,20 +383,45 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
drawClippingTextArea.w = sizeX - drawClipping.x;
|
||||
drawClippingTextArea.h = sizeY;
|
||||
|
||||
OOTextNormal.clippingSet(drawClippingTextArea);
|
||||
OOTextBold.clippingSet(drawClippingTextArea);
|
||||
OOTextItalic.clippingSet(drawClippingTextArea);
|
||||
OOTextBoldItalic.clippingSet(drawClippingTextArea);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.clippingSet(drawClippingTextArea);
|
||||
#else
|
||||
OOTextNormal.clippingSet(drawClippingTextArea);
|
||||
OOTextBold.clippingSet(drawClippingTextArea);
|
||||
OOTextItalic.clippingSet(drawClippingTextArea);
|
||||
OOTextBoldItalic.clippingSet(drawClippingTextArea);
|
||||
#endif
|
||||
OOColored.clippingSet(drawClippingTextArea);
|
||||
|
||||
// Clear the line intexation :
|
||||
m_elmentList.Clear();
|
||||
// every char element is register to find the diplay pos when mouse event arrive
|
||||
CharElement tmpElementProperty;
|
||||
tmpElementProperty.m_yOffset = y;
|
||||
tmpElementProperty.m_xOffset = 0;
|
||||
tmpElementProperty.m_ySize = 10;
|
||||
tmpElementProperty.m_bufferPos = displayStartBufferPos;
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
|
||||
float lineMaxSize = 0.0;
|
||||
for (iii=displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
||||
//APPL_DEBUG("diplay element=" << iii);
|
||||
for (iii=displayStartBufferPos; iii<mylen && displayLines >=0 && y >= -2*letterHeight; iii = new_i) {
|
||||
//APPL_DEBUG("display pos =" << y);
|
||||
int displaywidth;
|
||||
uint32_t currentChar = '\0';
|
||||
new_i = iii;
|
||||
// update the element buffer pos:
|
||||
tmpElementProperty.m_bufferPos = new_i;
|
||||
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
||||
int32_t drawSize = 0;
|
||||
|
||||
// update display position :
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = pixelX-offsetX;
|
||||
textPos.y = y;
|
||||
// update X pos
|
||||
tmpElementProperty.m_xOffset = textPos.x;
|
||||
tmpElementProperty.m_yOffset = textPos.y;
|
||||
|
||||
//APPL_INFO("diplay element=" << new_i);
|
||||
if (currentChar!='\n') {
|
||||
selectColor = myColor;
|
||||
@@ -414,26 +455,36 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
haveBg = selectColor->HaveBg();
|
||||
}
|
||||
}
|
||||
Vector2D<float> textPos;
|
||||
textPos.x = pixelX-offsetX;
|
||||
textPos.y = y;
|
||||
if (true == selectColor->GetItalic() ) {
|
||||
if (true == selectColor->GetBold() ) {
|
||||
OOTextSelected = &OOTextBoldItalic;
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
tmpElementProperty.m_ySize = OOText.GetHeight();
|
||||
OOText.SetColor(selectColor->GetFG());
|
||||
OOText.SetBold(selectColor->GetBold());
|
||||
OOText.SetItalic(selectColor->GetItalic());
|
||||
myStringToDisplay = displayChar;
|
||||
drawSize = OOText.Text(textPos, myStringToDisplay);
|
||||
#else
|
||||
if (true == selectColor->GetItalic() ) {
|
||||
if (true == selectColor->GetBold() ) {
|
||||
OOTextSelected = &OOTextBoldItalic;
|
||||
} else {
|
||||
OOTextSelected = &OOTextItalic;
|
||||
}
|
||||
} else {
|
||||
OOTextSelected = &OOTextItalic;
|
||||
if (true == selectColor->GetBold() ) {
|
||||
OOTextSelected = &OOTextBold;
|
||||
} else {
|
||||
OOTextSelected = &OOTextNormal;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (true == selectColor->GetBold() ) {
|
||||
OOTextSelected = &OOTextBold;
|
||||
} else {
|
||||
OOTextSelected = &OOTextNormal;
|
||||
}
|
||||
}
|
||||
OOTextSelected->SetColor(selectColor->GetFG());
|
||||
// TODO : Remove this unreallistic leak of time
|
||||
myStringToDisplay = displayChar;
|
||||
drawSize = OOTextSelected->Text(textPos, myStringToDisplay);
|
||||
tmpElementProperty.m_ySize = OOTextSelected->GetHeight();
|
||||
//tmpElementProperty.m_yOffset += tmpElementProperty.m_ySize;
|
||||
OOTextSelected->SetColor(selectColor->GetFG());
|
||||
// TODO : Remove this unreallistic leak of time
|
||||
myStringToDisplay = displayChar;
|
||||
drawSize = OOTextSelected->Text(textPos, myStringToDisplay);
|
||||
#endif
|
||||
//APPL_DEBUG("add element : " << tmpElementProperty.m_yOffset << "," << tmpElementProperty.m_xOffset);
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
|
||||
if (true == haveBg ) {
|
||||
OOColored.Rectangle(textPos.x, y, drawSize, letterHeight);
|
||||
@@ -454,15 +505,27 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
idX =0;
|
||||
pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||
y -= letterHeight;
|
||||
//APPL_DEBUG("display pos =" << y);
|
||||
displayLines++;
|
||||
currentLineID++;
|
||||
OOTextNormal.clippingDisable();
|
||||
OOColored.clippingDisable();
|
||||
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOTextNormal.clippingEnable();
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
OOText.clippingDisable();
|
||||
OOText.SetBold(false);
|
||||
OOText.SetItalic(false);
|
||||
DrawLineNumber(&OOText, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOText.clippingEnable();
|
||||
#else
|
||||
OOTextNormal.clippingDisable();
|
||||
DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
|
||||
OOTextNormal.clippingEnable();
|
||||
#endif
|
||||
OOColored.clippingEnable();
|
||||
// add elements :
|
||||
m_elmentList.PushBack(tmpElementProperty);
|
||||
}
|
||||
}
|
||||
//APPL_DEBUG("end at pos buf =" << iii << " / " << m_EdnBuf.Size());
|
||||
// special case : the cursor is at the end of the buffer...
|
||||
if (m_cursorPos == iii) {
|
||||
DrawCursor(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth, drawClippingTextArea);
|
||||
@@ -477,59 +540,45 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
|
||||
|
||||
|
||||
int32_t BufferText::GetMousePosition(int32_t fontId, int32_t width, int32_t height)
|
||||
int32_t BufferText::GetMousePosition(etk::Vector2D<float> pos)
|
||||
{
|
||||
int32_t letterWidth = ewol::GetWidth(fontId, "9");
|
||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||
|
||||
int32_t lineOffset = height / letterHeight;
|
||||
|
||||
//******************************* get the X position : *******************************************
|
||||
|
||||
int32_t iii, new_i;
|
||||
|
||||
int mylen = m_EdnBuf.Size();
|
||||
int32_t x_base=GetLineNumberNumberOfElement()*letterWidth + SEPARATION_SIZE_LINE_NUMBER;
|
||||
width -= x_base;
|
||||
if (width < 0) {
|
||||
width = 0;
|
||||
}
|
||||
int32_t idX = 0;
|
||||
|
||||
uniChar_t displayChar[MAX_EXP_CHAR_LEN];
|
||||
memset(displayChar, 0, sizeof(uniChar_t)*MAX_EXP_CHAR_LEN);
|
||||
|
||||
int32_t pixelX = 0;
|
||||
int32_t startLinePosition = m_EdnBuf.CountForwardNLines(0, lineOffset);
|
||||
if (width <= 0) {
|
||||
APPL_DEBUG(" Element : Befor the start of the line ... ==> END");
|
||||
return startLinePosition;
|
||||
}
|
||||
APPL_VERBOSE("Get id element : x=" << width << "px y=" << height << "px");
|
||||
APPL_VERBOSE(" line offset = " << lineOffset);
|
||||
for (iii=startLinePosition; iii<mylen; iii = new_i) {
|
||||
int displaywidth;
|
||||
uint32_t currentChar = '\0';
|
||||
new_i = iii;
|
||||
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
||||
if (currentChar!='\n') {
|
||||
int32_t drawSize = ewol::GetWidth(fontId, displayChar);
|
||||
APPL_VERBOSE(" Element : " << currentChar << "=\"" << (char)currentChar << "\" display offset=" << pixelX << "px width=" << drawSize << "px");
|
||||
pixelX += drawSize;
|
||||
if (width <= pixelX) {
|
||||
APPL_VERBOSE(" Find IT ==> END");
|
||||
// find position ...
|
||||
break;
|
||||
bool inLineDone=false;
|
||||
//APPL_DEBUG("try to find in : " << width << "," << height);
|
||||
for(int32_t iii=0; iii<m_elmentList.Size()-1; iii++) {
|
||||
//APPL_DEBUG("check element : " << m_elmentList[iii].m_yOffset << "<= " << pos.y << " <" << (m_elmentList[iii].m_yOffset + m_elmentList[iii].m_ySize));
|
||||
if(false == inLineDone) {
|
||||
if( pos.y>=m_elmentList[iii].m_yOffset
|
||||
&& pos.y<m_elmentList[iii].m_yOffset + m_elmentList[iii].m_ySize ) {
|
||||
// we find the line (int theory) ==> note : Some problem can appear here when the size are not the same ...
|
||||
// this is to prevent multiple size font ...
|
||||
inLineDone = true;
|
||||
//APPL_DEBUG(" ==> " << m_elmentList[iii+1].m_xOffset << "> " << pos.x << " >=" << m_elmentList[iii].m_xOffset);
|
||||
}
|
||||
}
|
||||
// we detected the line
|
||||
if(true == inLineDone) {
|
||||
if( pos.x>=m_elmentList[iii].m_xOffset
|
||||
&& pos.x<m_elmentList[iii+1].m_xOffset ) {
|
||||
// we get the position ...
|
||||
return m_elmentList[iii].m_bufferPos;
|
||||
} else if (m_elmentList[iii].m_xOffset>=m_elmentList[iii+1].m_xOffset) {
|
||||
// prevent "end of line" cursor pos ...
|
||||
return m_elmentList[iii].m_bufferPos;
|
||||
}
|
||||
} else {
|
||||
APPL_VERBOSE(" Element : \"\\n\" display width=---px ==> end of line ==> END");
|
||||
// end of line ... exit cycle
|
||||
break;
|
||||
}
|
||||
idX += displaywidth;
|
||||
}
|
||||
APPL_VERBOSE("BufferText::GetMousePosition(" << width << "," << height << "); ==> " << iii );
|
||||
return iii;
|
||||
if (m_elmentList.Size()>0) {
|
||||
if(pos.y<m_elmentList[m_elmentList.Size()/2].m_yOffset) {
|
||||
//APPL_DEBUG("Error to get position (return Last)");
|
||||
return m_elmentList[m_elmentList.Size()-1].m_bufferPos;
|
||||
} else {
|
||||
//APPL_DEBUG("Error to get position (return begin)");
|
||||
return m_elmentList[0].m_bufferPos;
|
||||
}
|
||||
} else {
|
||||
APPL_CRITICAL("Error to get position (very bad)");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -542,13 +591,13 @@ int32_t BufferText::GetMousePosition(int32_t fontId, int32_t width, int32_t heig
|
||||
*
|
||||
*/
|
||||
// TODO : Simplify selection ....
|
||||
void BufferText::MouseEvent(int32_t fontId, int32_t width, int32_t height)
|
||||
void BufferText::MouseEvent(etk::Vector2D<float> pos)
|
||||
{
|
||||
if (true == ewol::IsSetShift() ) {
|
||||
MouseSelectFromCursorTo(fontId, width, height);
|
||||
MouseSelectFromCursorTo(pos);
|
||||
} else {
|
||||
// Get the caracter mouse position
|
||||
int32_t newPos = GetMousePosition(fontId, width, height);
|
||||
int32_t newPos = GetMousePosition(pos);
|
||||
// move the cursor
|
||||
SetInsertPosition(newPos);
|
||||
|
||||
@@ -572,11 +621,10 @@ void BufferText::MouseEvent(int32_t fontId, int32_t width, int32_t height)
|
||||
* @todo : Set the move up and DOWN...
|
||||
*
|
||||
*/
|
||||
// TODO : Simplify selection ....
|
||||
void BufferText::MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height)
|
||||
void BufferText::MouseSelectFromCursorTo(etk::Vector2D<float> pos)
|
||||
{
|
||||
// Get the caracter mouse position
|
||||
int32_t newPos = GetMousePosition(fontId, width, height);
|
||||
int32_t newPos = GetMousePosition(pos);
|
||||
|
||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||
bool selIsRect;
|
||||
@@ -852,11 +900,11 @@ void BufferText::cursorMove(ewol::eventKbMoveType_te moveTypeEvent)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
|
||||
etk::Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
|
||||
{
|
||||
centerRequested = m_centerRequested;
|
||||
m_centerRequested = false;
|
||||
Vector2D<float> outputPosition;
|
||||
etk::Vector2D<float> outputPosition;
|
||||
|
||||
// Display position (Y mode):
|
||||
APPL_INFO("change the position : " << m_cursorPos);
|
||||
@@ -870,8 +918,13 @@ Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
|
||||
|
||||
// get font porperties :
|
||||
// TODO : change this :
|
||||
// TODO : Set it back ...
|
||||
/*
|
||||
float letterWidth = ewol::GetWidth(fontId, "A");
|
||||
float letterHeight = ewol::GetHeight(fontId);
|
||||
*/
|
||||
float letterWidth = 10;
|
||||
float letterHeight = 15;
|
||||
outputPosition.x *= letterWidth;
|
||||
outputPosition.y *= letterHeight;
|
||||
return outputPosition;
|
||||
@@ -879,7 +932,7 @@ Vector2D<float> BufferText::GetPosition(int32_t fontId, bool& centerRequested)
|
||||
/* if we request a center :
|
||||
} else {
|
||||
// center the line at the middle of the screen :
|
||||
Vector2D<float> outputPosition;
|
||||
etk::Vector2D<float> outputPosition;
|
||||
//APPL_DEBUG(" -------------------------------------------------");
|
||||
outputPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||
//APPL_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << outputPosition.y);
|
||||
@@ -1155,7 +1208,7 @@ void BufferText::Replace(etk::UString &data)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void BufferText::Copy(int8_t clipboardID)
|
||||
void BufferText::Copy(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
{
|
||||
etk::UString mVect;
|
||||
// get the curent selected data
|
||||
@@ -1175,7 +1228,7 @@ void BufferText::Copy(int8_t clipboardID)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void BufferText::Cut(int8_t clipboardID)
|
||||
void BufferText::Cut(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
{
|
||||
|
||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||
@@ -1203,11 +1256,11 @@ void BufferText::Cut(int8_t clipboardID)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void BufferText::Paste(int8_t clipboardID)
|
||||
void BufferText::Paste(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
{
|
||||
etk::UString mVect;
|
||||
// copy data from the click board :
|
||||
ewol::clipBoard::Get(clipboardID, mVect);
|
||||
mVect = ewol::clipBoard::Get(clipboardID);
|
||||
|
||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||
bool SelectionIsRect;
|
||||
|
@@ -36,33 +36,48 @@ typedef enum {
|
||||
CURSOR_DISPLAY_MODE_NOT_FOCUS,
|
||||
} cursorDisplayMode_te;
|
||||
|
||||
class CharElement
|
||||
{
|
||||
public:
|
||||
int16_t m_yOffset;
|
||||
int16_t m_xOffset;
|
||||
int16_t m_ySize;
|
||||
int32_t m_bufferPos;
|
||||
};
|
||||
|
||||
class BufferText : public Buffer {
|
||||
public:
|
||||
BufferText(void);
|
||||
BufferText(etk::File &fileName);
|
||||
BufferText(etk::FSNode &fileName);
|
||||
virtual ~BufferText(void);
|
||||
void Save(void);
|
||||
|
||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||
void SetLineDisplay(uint32_t lineNumber);
|
||||
|
||||
int32_t Display(ewol::OObject2DTextColored& OOTextNormal,
|
||||
ewol::OObject2DTextColored& OOTextBold,
|
||||
ewol::OObject2DTextColored& OOTextItalic,
|
||||
ewol::OObject2DTextColored& OOTextBoldItalic,
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOText,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY);
|
||||
#else
|
||||
int32_t Display(ewol::TEXT_DISPLAY_TYPE& OOTextNormal,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBold,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextItalic,
|
||||
ewol::TEXT_DISPLAY_TYPE& OOTextBoldItalic,
|
||||
ewol::OObject2DColored& OOColored,
|
||||
int32_t offsetX, int32_t offsetY,
|
||||
int32_t sizeX, int32_t sizeY);
|
||||
#endif
|
||||
void AddChar(uniChar_t unicodeData);
|
||||
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
||||
void MouseSelectFromCursorTo(int32_t fontId, int32_t width, int32_t height);
|
||||
void MouseEvent(int32_t fontId, int32_t width, int32_t height);
|
||||
void MouseSelectFromCursorTo(etk::Vector2D<float> pos);
|
||||
void MouseEvent(etk::Vector2D<float> pos);
|
||||
void MouseEventDouble(void);
|
||||
void MouseEventTriple(void);
|
||||
|
||||
void Copy(int8_t clipboardID);
|
||||
void Cut(int8_t clipboardID);
|
||||
void Paste(int8_t clipboardID);
|
||||
void Copy(ewol::clipBoard::clipboardListe_te clipboardID);
|
||||
void Cut(ewol::clipBoard::clipboardListe_te clipboardID);
|
||||
void Paste(ewol::clipBoard::clipboardListe_te clipboardID);
|
||||
|
||||
void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
|
||||
void Replace(etk::UString &data);
|
||||
@@ -84,27 +99,28 @@ class BufferText : public Buffer {
|
||||
int32_t GetLineNumberNumberOfElement(void);
|
||||
|
||||
// Direct buffer IO
|
||||
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
|
||||
Vector2D<float> m_displaySize; //!< number of char displayable in the screan
|
||||
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
|
||||
etk::Vector2D<float> m_displaySize; //!< number of char displayable in the screan
|
||||
// Cursor :
|
||||
int32_t m_cursorPos; //!< position in the buffer of the cursor
|
||||
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
|
||||
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
|
||||
int32_t m_cursorPos; //!< position in the buffer of the cursor
|
||||
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
|
||||
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
|
||||
etk::Vector<CharElement> m_elmentList; //!< Elemnt position for every char displayed
|
||||
|
||||
// internal function
|
||||
void BasicInit(void);
|
||||
private:
|
||||
bool m_centerRequested;
|
||||
public:
|
||||
virtual Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
|
||||
virtual etk::Vector2D<float> GetPosition(int32_t fontId, bool& centerRequested);
|
||||
private:
|
||||
bool TextDMoveUp(int32_t offset);
|
||||
bool TextDMoveDown(int32_t offset);
|
||||
void SetInsertPosition(int32_t newPosition, bool insertChar = false);
|
||||
|
||||
int32_t GetMousePosition(int32_t fontId, int32_t width, int32_t height);
|
||||
int32_t GetMousePosition(etk::Vector2D<float> pos);
|
||||
|
||||
void DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
|
||||
void DrawLineNumber(ewol::TEXT_DISPLAY_TYPE* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
|
||||
void DrawCursor(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth, clipping_ts &clip);
|
||||
|
||||
};
|
||||
|
@@ -89,10 +89,10 @@ EdnBuf::~EdnBuf(void)
|
||||
* @return true if OK / false if an error occured
|
||||
*
|
||||
*/
|
||||
bool EdnBuf::DumpIn(FILE *myFile)
|
||||
bool EdnBuf::DumpIn(etk::FSNode &file)
|
||||
{
|
||||
// write Data
|
||||
return m_data.DumpIn(myFile);
|
||||
return m_data.DumpIn(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ bool EdnBuf::DumpIn(FILE *myFile)
|
||||
* @return true if OK / false if an error occured
|
||||
*
|
||||
*/
|
||||
bool EdnBuf::DumpFrom(FILE *myFile)
|
||||
bool EdnBuf::DumpFrom(etk::FSNode &file)
|
||||
{
|
||||
if (true == m_data.DumpFrom(myFile) ) {
|
||||
if (true == m_data.DumpFrom(file) ) {
|
||||
// set no selection
|
||||
UpdateSelection(0, 0, m_data.Size() );
|
||||
// generate HighLight
|
||||
|
@@ -78,8 +78,8 @@ class EdnBuf {
|
||||
void SetAll( etk::Vector<int8_t> &text);
|
||||
void GetRange( int32_t start, int32_t end, etk::Vector<int8_t> &output);
|
||||
void GetRange( int32_t start, int32_t end, etk::UString &output);
|
||||
bool DumpIn( FILE *myFile);
|
||||
bool DumpFrom( FILE *myFile);
|
||||
bool DumpIn( etk::FSNode &file);
|
||||
bool DumpFrom( etk::FSNode &file);
|
||||
// replace with operator [] ...
|
||||
int8_t operator[] (int32_t);
|
||||
int32_t Insert( int32_t pos, etk::Vector<int8_t> &insertText);
|
||||
|
@@ -59,7 +59,7 @@ int32_t EdnBuf::Undo(void)
|
||||
if (0 == nbInserted) {
|
||||
// just add data at position ...
|
||||
if (0 == nbDeleted) {
|
||||
APPL_ERROR("EdnBuf::Undo nothing to do in UNDO");
|
||||
APPL_DEBUG("EdnBuf::Undo nothing to do in UNDO");
|
||||
} else {
|
||||
Insert(pos, deletedText);
|
||||
posDest = pos + nbDeleted;
|
||||
@@ -89,7 +89,7 @@ int32_t EdnBuf::Redo(void)
|
||||
int32_t posDest = -1;
|
||||
if (0 == nbElement) {
|
||||
// nothing to do ...
|
||||
APPL_ERROR("EdnBuf::Redo No more History");
|
||||
APPL_DEBUG("EdnBuf::Redo No more History");
|
||||
return -1;
|
||||
}
|
||||
nbElement--;
|
||||
|
@@ -114,12 +114,12 @@ static int32_t getFileSize(FILE *myFile)
|
||||
* @return true if OK / false if an error occured
|
||||
*
|
||||
*/
|
||||
bool EdnVectorBuf::DumpIn(FILE *myFile)
|
||||
bool EdnVectorBuf::DumpIn(etk::FSNode &file)
|
||||
{
|
||||
bool ret = true;
|
||||
// write Data
|
||||
(void)fwrite(m_data, sizeof(int8_t), m_gapStart, myFile);
|
||||
(void)fwrite(&m_data[m_gapEnd], sizeof(int8_t), m_allocated - m_gapEnd, myFile);
|
||||
(void)file.FileWrite(m_data, sizeof(int8_t), m_gapStart);
|
||||
(void)file.FileWrite(&m_data[m_gapEnd], sizeof(int8_t), m_allocated - m_gapEnd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -132,19 +132,19 @@ bool EdnVectorBuf::DumpIn(FILE *myFile)
|
||||
* @return true if OK / false if an error occured
|
||||
*
|
||||
*/
|
||||
bool EdnVectorBuf::DumpFrom(FILE *myFile)
|
||||
bool EdnVectorBuf::DumpFrom(etk::FSNode &file)
|
||||
{
|
||||
bool ret = true;
|
||||
int32_t length = getFileSize(myFile);
|
||||
uint32_t length = file.FileSize();
|
||||
// error case ...
|
||||
if (length < 0) {
|
||||
length = 0;
|
||||
if (length > 2000000000) {
|
||||
return false;
|
||||
}
|
||||
// allocate the current buffer :
|
||||
ChangeAllocation(length + GAP_SIZE_MIN);
|
||||
|
||||
// insert Data
|
||||
int32_t nbReadData = fread(&m_data[GAP_SIZE_MIN], sizeof(int8_t), length, myFile);
|
||||
int32_t nbReadData = file.FileRead(&m_data[GAP_SIZE_MIN], sizeof(int8_t), length);
|
||||
APPL_INFO("load data : filesize=" << length << ", readData=" << nbReadData);
|
||||
// check ERROR
|
||||
if (nbReadData != length) {
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#define __EDN_VECTOR_BUF_H__
|
||||
|
||||
#include <etk/Vector.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "EdnVectorBuf"
|
||||
@@ -265,8 +266,8 @@ class EdnVectorBuf
|
||||
EdnVectorBuf(const EdnVectorBuf & Evb);
|
||||
~EdnVectorBuf();
|
||||
|
||||
bool DumpIn( FILE *myFile);
|
||||
bool DumpFrom( FILE *myFile);
|
||||
bool DumpIn( etk::FSNode &file);
|
||||
bool DumpFrom( etk::FSNode &file);
|
||||
|
||||
EdnVectorBuf & operator=( const EdnVectorBuf & Evb);
|
||||
int8_t operator[] (int32_t pos);
|
||||
|
@@ -35,8 +35,8 @@
|
||||
Colorize::Colorize( etk::UString &newColorName)
|
||||
{
|
||||
|
||||
m_colorFG = etk::color::black;
|
||||
m_colorBG = etk::color::black;
|
||||
m_colorFG = draw::color::black;
|
||||
m_colorBG = draw::color::black;
|
||||
|
||||
italic = false;
|
||||
bold = false;
|
||||
@@ -50,8 +50,8 @@ Colorize::Colorize(void)
|
||||
{
|
||||
ColorName = "no_name";
|
||||
|
||||
m_colorFG = etk::color::black;
|
||||
m_colorBG = etk::color::black;
|
||||
m_colorFG = draw::color::black;
|
||||
m_colorBG = draw::color::black;
|
||||
|
||||
italic = false;
|
||||
bold = false;
|
||||
|
@@ -40,8 +40,8 @@ class Colorize {
|
||||
void SetFgColor(const char *myColor);
|
||||
void SetBgColor(const char *myColor);
|
||||
|
||||
etk::Color & GetFG(void) { return m_colorFG; };
|
||||
etk::Color & GetBG(void) { return m_colorBG; };
|
||||
draw::Color & GetFG(void) { return m_colorFG; };
|
||||
draw::Color & GetBG(void) { return m_colorBG; };
|
||||
|
||||
bool HaveBg(void);
|
||||
|
||||
@@ -54,8 +54,8 @@ class Colorize {
|
||||
|
||||
private:
|
||||
etk::UString ColorName; //!< curent color Name
|
||||
etk::Color m_colorFG;
|
||||
etk::Color m_colorBG;
|
||||
draw::Color m_colorFG;
|
||||
draw::Color m_colorBG;
|
||||
|
||||
bool italic;
|
||||
bool bold;
|
||||
|
@@ -26,8 +26,9 @@
|
||||
#include <appl/global.h>
|
||||
#include <ColorizeManager.h>
|
||||
#include <tinyXML/tinyxml.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/EObjectManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/eObject/EObjectManager.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
|
||||
#define PFX "ColorizeManager "
|
||||
|
||||
@@ -61,7 +62,7 @@ class classColorManager: public ewol::EObject
|
||||
void LoadFile(const char * xmlFilename);
|
||||
Colorize * Get(const char *colorName);
|
||||
Colorize * Get(etk::UString &colorName);
|
||||
etk::Color& Get(basicColor_te myColor);
|
||||
draw::Color& Get(basicColor_te myColor);
|
||||
bool Exist(etk::UString &colorName);
|
||||
bool Exist(const char *colorName);
|
||||
void DisplayListOfColor(void);
|
||||
@@ -70,7 +71,7 @@ class classColorManager: public ewol::EObject
|
||||
etk::UString m_fileColor;
|
||||
etk::Vector<Colorize*> listMyColor; //!< List of ALL Color
|
||||
Colorize * errorColor;
|
||||
etk::Color basicColors[COLOR_NUMBER_MAX];
|
||||
draw::Color basicColors[COLOR_NUMBER_MAX];
|
||||
};
|
||||
|
||||
|
||||
@@ -143,17 +144,17 @@ void classColorManager::LoadFile(const char * xmlFilename)
|
||||
// allocate the document in the stack
|
||||
TiXmlDocument XmlDocument;
|
||||
// open the curent File
|
||||
etk::File fileName(xmlFilename, etk::FILE_TYPE_DATA);
|
||||
etk::FSNode fileName(etk::UString("DATA:") + xmlFilename);
|
||||
if (false == fileName.Exist()) {
|
||||
APPL_ERROR("File Does not exist : " << fileName);
|
||||
return;
|
||||
}
|
||||
int32_t fileSize = fileName.Size();
|
||||
int32_t fileSize = fileName.FileSize();
|
||||
if (0==fileSize) {
|
||||
APPL_ERROR("This file is empty : " << fileName);
|
||||
return;
|
||||
}
|
||||
if (false == fileName.fOpenRead()) {
|
||||
if (false == fileName.FileOpenRead()) {
|
||||
APPL_ERROR("Can not open the file : " << fileName);
|
||||
return;
|
||||
}
|
||||
@@ -165,9 +166,9 @@ void classColorManager::LoadFile(const char * xmlFilename)
|
||||
}
|
||||
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
||||
// load data from the file :
|
||||
fileName.fRead(fileBuffer, 1, fileSize);
|
||||
fileName.FileRead(fileBuffer, 1, fileSize);
|
||||
// close the file:
|
||||
fileName.fClose();
|
||||
fileName.FileClose();
|
||||
// load the XML from the memory
|
||||
XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
|
||||
|
||||
@@ -316,7 +317,7 @@ Colorize *classColorManager::Get(etk::UString &colorName)
|
||||
return Get(colorName.c_str());
|
||||
}
|
||||
|
||||
etk::Color & classColorManager::Get(basicColor_te myColor)
|
||||
draw::Color & classColorManager::Get(basicColor_te myColor)
|
||||
{
|
||||
if (myColor < COLOR_NUMBER_MAX) {
|
||||
return basicColors[myColor];
|
||||
@@ -363,7 +364,7 @@ static classColorManager * localManager = NULL;
|
||||
|
||||
void ColorizeManager::Init(void)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
if (NULL != localManager) {
|
||||
EWOL_ERROR("ColorizeManager ==> already exist, just unlink the previous ...");
|
||||
localManager = NULL;
|
||||
}
|
||||
@@ -417,9 +418,9 @@ Colorize* ColorizeManager::Get(etk::UString &colorName)
|
||||
return localManager->Get(colorName);
|
||||
}
|
||||
|
||||
etk::Color errorColor;
|
||||
draw::Color errorColor;
|
||||
|
||||
etk::Color& ColorizeManager::Get(basicColor_te myColor)
|
||||
draw::Color& ColorizeManager::Get(basicColor_te myColor)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
return errorColor;
|
||||
|
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <Colorize.h>
|
||||
#include <appl/globalMsg.h>
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
typedef enum {
|
||||
// BASIC color for codeViewer
|
||||
@@ -57,7 +57,7 @@ namespace ColorizeManager
|
||||
void LoadFile(const char * xmlFilename);
|
||||
Colorize * Get(const char *colorName);
|
||||
Colorize * Get(etk::UString &colorName);
|
||||
etk::Color& Get(basicColor_te myColor);
|
||||
draw::Color& Get(basicColor_te myColor);
|
||||
bool Exist(etk::UString &colorName);
|
||||
bool Exist(const char *colorName);
|
||||
void DisplayListOfColor(void);
|
||||
|
@@ -29,12 +29,36 @@
|
||||
#include <BufferManager.h>
|
||||
#include <ColorizeManager.h>
|
||||
#include <MainWindows.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "BufferView"
|
||||
|
||||
|
||||
|
||||
static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
|
||||
{
|
||||
etk::Vector<appl::dataBufferStruct *> tmpList = list;
|
||||
list.Clear();
|
||||
for(int32_t iii=0; iii<tmpList.Size(); iii++) {
|
||||
if (NULL != tmpList[iii]) {
|
||||
int32_t findPos = 0;
|
||||
for(int32_t jjj=0; jjj<list.Size(); jjj++) {
|
||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||
if (list[jjj]!=NULL) {
|
||||
if (tmpList[iii]->m_bufferName.GetNameFile() > list[jjj]->m_bufferName.GetNameFile()) {
|
||||
findPos = jjj+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG("position="<<findPos);
|
||||
list.Insert(findPos, tmpList[iii]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BufferView::BufferView(void)
|
||||
{
|
||||
SetCanHaveFocus(true);
|
||||
@@ -47,9 +71,19 @@ BufferView::BufferView(void)
|
||||
|
||||
BufferView::~BufferView(void)
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
m_list.Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
@@ -62,17 +96,42 @@ void BufferView::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
|
||||
{
|
||||
ewol::List::OnReceiveMessage(CallerObject, eventId, data);
|
||||
if (eventId == ednMsgBufferListChange) {
|
||||
// clean The list
|
||||
RemoveAllElement();
|
||||
// Get all the buffer name and properties:
|
||||
int32_t nbBufferOpen = BufferManager::Size();
|
||||
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
|
||||
if (BufferManager::Exist(iii)) {
|
||||
bool isModify = BufferManager::Get(iii)->IsModify();
|
||||
etk::FSNode name = BufferManager::Get(iii)->GetFileName();
|
||||
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
|
||||
if (NULL != tmpElement) {
|
||||
m_list.PushBack(tmpElement);
|
||||
} else {
|
||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true == globals::OrderTheBufferList() ) {
|
||||
SortElementList(m_list);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}else if (eventId == ednMsgBufferId) {
|
||||
m_selectedIdRequested = BufferManager::GetSelected();
|
||||
MarkToRedraw();
|
||||
}else if (eventId == ednMsgBufferState) {
|
||||
// Update list of modify section ...
|
||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
||||
if (NULL!=m_list[iii]) {
|
||||
m_list[iii]->m_isModify = BufferManager::Get(m_list[iii]->m_bufferID)->IsModify();
|
||||
}
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
etk::Color BufferView::GetBasicBG(void)
|
||||
draw::Color BufferView::GetBasicBG(void)
|
||||
{
|
||||
return ColorizeManager::Get(COLOR_LIST_BG_1);
|
||||
}
|
||||
@@ -82,7 +141,7 @@ uint32_t BufferView::GetNuberOfColomn(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg)
|
||||
bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg)
|
||||
{
|
||||
myTitle = "Buffers : ";
|
||||
return true;
|
||||
@@ -90,12 +149,11 @@ bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg,
|
||||
|
||||
uint32_t BufferView::GetNuberOfRaw(void)
|
||||
{
|
||||
return BufferManager::SizeOpen();
|
||||
return m_list.Size();
|
||||
}
|
||||
|
||||
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg)
|
||||
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg)
|
||||
{
|
||||
etk::File name;
|
||||
bool isModify;
|
||||
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||
basicColor_te selectBG = COLOR_LIST_BG_1;
|
||||
@@ -103,28 +161,12 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
|
||||
if (m_selectedIdRequested != -1) {
|
||||
m_selectedID = -1;
|
||||
}
|
||||
// transforme the ID in the real value ...
|
||||
int32_t realID = BufferManager::WitchBuffer(raw+1);
|
||||
if (BufferManager::Exist(realID)) {
|
||||
isModify = BufferManager::Get(realID)->IsModify();
|
||||
name = BufferManager::Get(realID)->GetFileName();
|
||||
if( raw>=0
|
||||
&& raw<m_list.Size()
|
||||
&& NULL != m_list[raw]) {
|
||||
myTextToWrite = m_list[raw]->m_bufferName.GetNameFile();
|
||||
|
||||
#if 0
|
||||
char *tmpModify = (char*)" ";
|
||||
if (true == isModify) {
|
||||
tmpModify = (char*)"M";
|
||||
}
|
||||
myTextToWrite = "[";
|
||||
myTextToWrite += realID;
|
||||
myTextToWrite += "](";
|
||||
myTextToWrite += tmpModify;
|
||||
myTextToWrite += ") ";
|
||||
#else
|
||||
myTextToWrite = "";
|
||||
#endif
|
||||
myTextToWrite += name.GetShortFilename();
|
||||
|
||||
if (true == isModify) {
|
||||
if (true == m_list[raw]->m_isModify) {
|
||||
selectFG = COLOR_LIST_TEXT_MODIFY;
|
||||
} else {
|
||||
selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||
@@ -135,7 +177,7 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
|
||||
selectBG = COLOR_LIST_BG_2;
|
||||
}
|
||||
// the buffer change of selection ...
|
||||
if (m_selectedIdRequested == realID) {
|
||||
if (m_selectedIdRequested == m_list[raw]->m_bufferID) {
|
||||
m_selectedID = raw;
|
||||
// stop searching
|
||||
m_selectedIdRequested = -1;
|
||||
@@ -155,10 +197,11 @@ bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
||||
{
|
||||
if (1 == IdInput && typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
||||
APPL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||
int32_t selectBuf = BufferManager::WitchBuffer(raw+1);
|
||||
if ( 0 <= selectBuf) {
|
||||
if( raw>=0
|
||||
&& raw<m_list.Size()
|
||||
&& NULL != m_list[raw]) {
|
||||
m_selectedID = raw;
|
||||
SendMultiCast(ednMsgBufferId, selectBuf);
|
||||
SendMultiCast(ednMsgBufferId, m_list[raw]->m_bufferID);
|
||||
}
|
||||
}
|
||||
MarkToRedraw();
|
||||
|
@@ -31,8 +31,31 @@
|
||||
#include <appl/globalMsg.h>
|
||||
#include <ewol/widget/List.h>
|
||||
|
||||
namespace appl
|
||||
{
|
||||
class dataBufferStruct
|
||||
{
|
||||
public:
|
||||
etk::FSNode m_bufferName;
|
||||
uint32_t m_bufferID;
|
||||
bool m_isModify;
|
||||
dataBufferStruct(etk::FSNode& bufferName, int32_t bufferID, bool isModify) :
|
||||
m_bufferName(bufferName),
|
||||
m_bufferID(bufferID),
|
||||
m_isModify(isModify)
|
||||
{
|
||||
|
||||
};
|
||||
~dataBufferStruct(void) { };
|
||||
};
|
||||
};
|
||||
|
||||
class BufferView : public ewol::List
|
||||
{
|
||||
private:
|
||||
int32_t m_selectedIdRequested;
|
||||
int32_t m_selectedID;
|
||||
etk::Vector<appl::dataBufferStruct*> m_list;
|
||||
public:
|
||||
// Constructeur
|
||||
BufferView(void);
|
||||
@@ -54,15 +77,13 @@ class BufferView : public ewol::List
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
protected:
|
||||
// function call to display the list :
|
||||
virtual etk::Color GetBasicBG(void);
|
||||
virtual draw::Color GetBasicBG(void);
|
||||
virtual uint32_t GetNuberOfColomn(void);
|
||||
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg);
|
||||
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
|
||||
virtual uint32_t GetNuberOfRaw(void);
|
||||
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg);
|
||||
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
|
||||
virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
|
||||
private:
|
||||
int32_t m_selectedIdRequested;
|
||||
int32_t m_selectedID;
|
||||
void RemoveAllElement(void);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -34,32 +34,26 @@
|
||||
#include <ewol/ClipBoard.h>
|
||||
#include <SearchData.h>
|
||||
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "CodeView"
|
||||
|
||||
|
||||
CodeView::CodeView(void)
|
||||
void CodeView::Init(void)
|
||||
{
|
||||
m_label = "CodeView is disable ...";
|
||||
m_fontNormal = -1;
|
||||
m_fontBold = -1;
|
||||
m_fontItalic = -1;
|
||||
m_fontBoldItalic = -1;
|
||||
m_fontSize = 15;
|
||||
|
||||
m_bufferID = -1;
|
||||
m_buttunOneSelected = false;
|
||||
|
||||
m_lineNumberList.Clear();
|
||||
|
||||
m_textColorFg = etk::color::black;
|
||||
m_textColorFg = draw::color::black;
|
||||
|
||||
m_textColorBg = etk::color::black;
|
||||
m_textColorBg.alpha = 0x40;
|
||||
m_textColorBg = draw::color::black;
|
||||
m_textColorBg.a = 0x40;
|
||||
SetCanHaveFocus(true);
|
||||
RegisterMultiCast(ednMsgBufferId);
|
||||
RegisterMultiCast(ednMsgGuiCopy);
|
||||
@@ -72,7 +66,29 @@ CodeView::CodeView(void)
|
||||
RegisterMultiCast(ednMsgGuiChangeCharset);
|
||||
RegisterMultiCast(ednMsgGuiFind);
|
||||
RegisterMultiCast(ednMsgGuiReplace);
|
||||
RegisterMultiCast(ednMsgGuiGotoLine);
|
||||
SetLimitScrolling(0.2);
|
||||
|
||||
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
|
||||
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
|
||||
ShortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
|
||||
ShortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
|
||||
ShortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
|
||||
ShortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
|
||||
ShortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
||||
}
|
||||
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
CodeView::CodeView(etk::UString fontName, int32_t fontSize) :
|
||||
m_OObjectText(fontName, fontSize)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
#endif
|
||||
|
||||
CodeView::CodeView(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
CodeView::~CodeView(void)
|
||||
@@ -88,7 +104,7 @@ CodeView::~CodeView(void)
|
||||
*/
|
||||
void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
|
||||
{
|
||||
Vector2D<float> tmpCoord;
|
||||
etk::Vector2D<float> tmpCoord;
|
||||
tmpCoord.x = 0;
|
||||
tmpCoord.y = 0;
|
||||
if (m_lineNumberList.Size()<=bufferID) {
|
||||
@@ -111,7 +127,11 @@ bool CodeView::CalculateMinSize(void)
|
||||
void CodeView::CalculateMaxSize(void)
|
||||
{
|
||||
m_maxSize.x = 2048;
|
||||
int32_t letterHeight = ewol::GetHeight(m_fontNormal);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
int32_t letterHeight = m_OObjectText.GetHeight();
|
||||
#else
|
||||
int32_t letterHeight = m_OObjectTextNormal.GetHeight();
|
||||
#endif
|
||||
m_maxSize.y = BufferManager::Get(m_bufferID)->GetNumberOfLine() * letterHeight;
|
||||
}
|
||||
|
||||
@@ -119,10 +139,14 @@ void CodeView::CalculateMaxSize(void)
|
||||
void CodeView::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
m_OObjectsColored.Draw();
|
||||
m_OObjectTextNormal.Draw();
|
||||
m_OObjectTextBold.Draw();
|
||||
m_OObjectTextItalic.Draw();
|
||||
m_OObjectTextBoldItalic.Draw();
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
m_OObjectText.Draw();
|
||||
#else
|
||||
m_OObjectTextNormal.Draw();
|
||||
m_OObjectTextBold.Draw();
|
||||
m_OObjectTextItalic.Draw();
|
||||
m_OObjectTextBoldItalic.Draw();
|
||||
#endif
|
||||
WidgetScrooled::OnDraw(displayProp);
|
||||
}
|
||||
|
||||
@@ -134,33 +158,38 @@ void CodeView::OnRegenerateDisplay(void)
|
||||
// For the scrooling windows
|
||||
CalculateMaxSize();
|
||||
|
||||
// clean internal elements ...
|
||||
m_OObjectTextNormal.SetFontID(m_fontNormal);
|
||||
m_OObjectTextBold.SetFontID(m_fontBold);
|
||||
m_OObjectTextItalic.SetFontID(m_fontItalic);
|
||||
m_OObjectTextBoldItalic.SetFontID(m_fontBoldItalic);
|
||||
|
||||
m_OObjectTextNormal.Clear();
|
||||
m_OObjectTextBold.Clear();
|
||||
m_OObjectTextItalic.Clear();
|
||||
m_OObjectTextBoldItalic.Clear();
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
m_OObjectText.Clear();
|
||||
#else
|
||||
m_OObjectTextNormal.Clear();
|
||||
m_OObjectTextBold.Clear();
|
||||
m_OObjectTextItalic.Clear();
|
||||
m_OObjectTextBoldItalic.Clear();
|
||||
#endif
|
||||
m_OObjectsColored.Clear();
|
||||
|
||||
|
||||
if(true == BufferManager::Get(m_bufferID)->NeedToUpdateDisplayPosition() ) {
|
||||
Vector2D<float> borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
|
||||
etk::Vector2D<float> borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
|
||||
bool centerRequested = false;
|
||||
Vector2D<float> currentPosition = BufferManager::Get(m_bufferID)->GetPosition(m_OObjectTextNormal.GetFontID(), centerRequested);
|
||||
// TODO : set it back ...
|
||||
etk::Vector2D<float> currentPosition = BufferManager::Get(m_bufferID)->GetPosition(999/*m_OObjectTextNormal.GetFontID()*/, centerRequested);
|
||||
SetScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
|
||||
} // else : nothing to do ...
|
||||
|
||||
// generate the objects :
|
||||
BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal,
|
||||
m_OObjectTextBold,
|
||||
m_OObjectTextItalic,
|
||||
m_OObjectTextBoldItalic,
|
||||
m_OObjectsColored,
|
||||
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
BufferManager::Get(m_bufferID)->Display(m_OObjectText,
|
||||
m_OObjectsColored,
|
||||
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
#else
|
||||
BufferManager::Get(m_bufferID)->Display(m_OObjectTextNormal,
|
||||
m_OObjectTextBold,
|
||||
m_OObjectTextItalic,
|
||||
m_OObjectTextBoldItalic,
|
||||
m_OObjectsColored,
|
||||
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||
#endif
|
||||
// set the current size of the windows
|
||||
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
|
||||
|
||||
@@ -193,6 +222,17 @@ bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveTy
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Event on a past event ==> this event is asynchronous due to all system does not support direct getting datas
|
||||
* @note : need to have focus ...
|
||||
* @param[in] mode Mode of data requested
|
||||
* @return ---
|
||||
*/
|
||||
void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
{
|
||||
BufferManager::Get(m_bufferID)->Paste(clipboardID);
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
@@ -203,11 +243,15 @@ bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveTy
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
Vector2D<float> relativePos = RelativePosition(pos);
|
||||
etk::Vector2D<float> relativePos = RelativePosition(pos);
|
||||
// corection for the openGl abstraction
|
||||
relativePos.y = m_size.y - relativePos.y;
|
||||
//relativePos.y = m_size.y - relativePos.y;
|
||||
|
||||
etk::Vector2D<float> limitedPos = relativePos;
|
||||
limitedPos.x = etk_avg(1, limitedPos.x, m_size.x-1);
|
||||
limitedPos.y = etk_avg(1, limitedPos.y, m_size.y-1);
|
||||
|
||||
if (m_bufferID < 0) {
|
||||
return false;
|
||||
@@ -222,7 +266,8 @@ bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::even
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_buttunOneSelected = true;
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(m_fontNormal, relativePos.x+m_originScrooled.x, relativePos.y+m_originScrooled.y);
|
||||
// TODO : Set something good
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(limitedPos);
|
||||
MarkToRedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_buttunOneSelected = false;
|
||||
@@ -233,7 +278,7 @@ bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::even
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
#ifdef __MODE__Touch
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(m_fontNormal, relativePos.x+m_originScrooled.x, relativePos.y+m_originScrooled.y);
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(limitedPos);
|
||||
MarkToRedraw();
|
||||
#else
|
||||
// nothing to do ...
|
||||
@@ -256,15 +301,16 @@ bool CodeView::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::even
|
||||
yyy = 0;
|
||||
}
|
||||
//APPL_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
|
||||
BufferManager::Get(m_bufferID)->MouseSelectFromCursorTo(m_fontNormal, xxx+m_originScrooled.x, yyy+m_originScrooled.y);
|
||||
// TODO : Set something good
|
||||
BufferManager::Get(m_bufferID)->MouseSelectFromCursorTo(limitedPos);
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
} else if (2 == IdInput) {
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(m_fontNormal, relativePos.x+m_originScrooled.x, relativePos.y+m_originScrooled.y);
|
||||
BufferManager::Get(m_bufferID)->Paste(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||
MarkToRedraw();
|
||||
// TODO : Set something good
|
||||
BufferManager::Get(m_bufferID)->MouseEvent(limitedPos);
|
||||
ewol::clipBoard::Request(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
}
|
||||
}
|
||||
@@ -308,7 +354,7 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
} else if (eventId == ednMsgGuiCut) {
|
||||
BufferManager::Get(m_bufferID)->Cut(ewol::clipBoard::CLIPBOARD_STD);
|
||||
} else if (eventId == ednMsgGuiPaste) {
|
||||
BufferManager::Get(m_bufferID)->Paste(ewol::clipBoard::CLIPBOARD_STD);
|
||||
ewol::clipBoard::Request(ewol::clipBoard::CLIPBOARD_STD);
|
||||
} else if (eventId == ednMsgGuiUndo) {
|
||||
BufferManager::Get(m_bufferID)->Undo();
|
||||
} else if (eventId == ednMsgGuiRedo) {
|
||||
@@ -360,21 +406,12 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
} else if (data == "All") {
|
||||
|
||||
}
|
||||
} else if (eventId == ednMsgGuiGotoLine) {
|
||||
int32_t lineID = 0;
|
||||
sscanf(data.c_str(), "%d", &lineID);
|
||||
APPL_INFO("Goto line : " << lineID);
|
||||
BufferManager::Get(m_bufferID)->JumpAtLine(lineID);
|
||||
}
|
||||
/*
|
||||
switch (id)
|
||||
{
|
||||
case APPL_MSG__CURRENT_GOTO_LINE:
|
||||
if (dataID<0) {
|
||||
dataID = 0;
|
||||
}
|
||||
BufferManager::Get(m_bufferID)->JumpAtLine(dataID);
|
||||
break;
|
||||
case APPL_MSG__CURRENT_SET_CHARSET:
|
||||
BufferManager::Get(m_bufferID)->SetCharset((unicode::charset_te)dataID);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// Force redraw of the widget
|
||||
MarkToRedraw();
|
||||
}
|
||||
@@ -385,7 +422,7 @@ void CodeView::OnGetFocus(void)
|
||||
/*
|
||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_bufferID);
|
||||
*/
|
||||
ewol::KeyboardShow(ewol::KEYBOARD_MODE_CODE);
|
||||
ewol::KeyboardShow();
|
||||
APPL_INFO("Focus - In");
|
||||
}
|
||||
|
||||
@@ -398,38 +435,41 @@ void CodeView::OnLostFocus(void)
|
||||
|
||||
void CodeView::SetFontSize(int32_t size)
|
||||
{
|
||||
m_fontSize = size;
|
||||
SetScrollingSize(m_fontSize*3.0*1.46); // 1.46 is a magic nmber ...
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
m_OObjectText.SetSize(size);
|
||||
#else
|
||||
m_OObjectTextNormal.SetSize(size);
|
||||
m_OObjectTextBold.SetSize(size);
|
||||
m_OObjectTextItalic.SetSize(size);
|
||||
m_OObjectTextBoldItalic.SetSize(size);
|
||||
#endif
|
||||
SetScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameNormal(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
m_fontNormal = fontID;
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
void CodeView::SetFontName(etk::UString fontName)
|
||||
{
|
||||
m_OObjectText.SetFont(fontName);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void CodeView::SetFontNameNormal(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextNormal.SetFont(fontName);
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBold(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextBold.SetFont(fontName);
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameItalic(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextItalic.SetFont(fontName);
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
|
||||
{
|
||||
m_OObjectTextBoldItalic.SetFont(fontName);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CodeView::SetFontNameBold(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
m_fontBold = fontID;
|
||||
}
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameItalic(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
m_fontItalic = fontID;
|
||||
}
|
||||
}
|
||||
|
||||
void CodeView::SetFontNameBoldItalic(etk::UString fontName)
|
||||
{
|
||||
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||
if (fontID >= 0) {
|
||||
m_fontBoldItalic = fontID;
|
||||
}
|
||||
}
|
||||
|
@@ -33,11 +33,16 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/widget/WidgetScrolled.h>
|
||||
#include <ewol/ResourceManager.h>
|
||||
|
||||
class CodeView :public ewol::WidgetScrooled
|
||||
{
|
||||
public:
|
||||
CodeView(void);
|
||||
void Init(void);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
CodeView(etk::UString fontName, int32_t fontSize);
|
||||
#endif
|
||||
CodeView(void);
|
||||
virtual ~CodeView(void);
|
||||
/**
|
||||
* @brief Get the current Object type of the EObject
|
||||
@@ -48,18 +53,22 @@ class CodeView :public ewol::WidgetScrooled
|
||||
const char * const GetObjectType(void) { return "ApplCodeView"; };
|
||||
virtual bool CalculateMinSize(void);
|
||||
private:
|
||||
etk::UString m_label;
|
||||
etk::Color m_textColorFg; //!< Text color
|
||||
etk::Color m_textColorBg; //!< Background color
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
etk::Vector<Vector2D<float> > m_lineNumberList;
|
||||
void UpdateNumberOfLineReference(int32_t bufferID);
|
||||
etk::UString m_label;
|
||||
draw::Color m_textColorFg; //!< Text color
|
||||
draw::Color m_textColorBg; //!< Background color
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
etk::Vector<etk::Vector2D<float> > m_lineNumberList;
|
||||
void UpdateNumberOfLineReference(int32_t bufferID);
|
||||
// drawing elements :
|
||||
ewol::OObject2DTextColored m_OObjectTextNormal;
|
||||
ewol::OObject2DTextColored m_OObjectTextBold;
|
||||
ewol::OObject2DTextColored m_OObjectTextItalic;
|
||||
ewol::OObject2DTextColored m_OObjectTextBoldItalic;
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectText;
|
||||
#else
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextNormal;
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBold;
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextItalic;
|
||||
ewol::TEXT_DISPLAY_TYPE m_OObjectTextBoldItalic;
|
||||
#endif
|
||||
ewol::OObject2DColored m_OObjectsColored;
|
||||
|
||||
public:
|
||||
@@ -82,24 +91,29 @@ class CodeView :public ewol::WidgetScrooled
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
|
||||
/**
|
||||
* @brief Event on a past event ==> this event is asynchronous due to all system does not support direct getting datas
|
||||
* @note : need to have focus ...
|
||||
* @param[in] mode Mode of data requested
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
|
||||
|
||||
virtual void OnGetFocus(void);
|
||||
virtual void OnLostFocus(void);
|
||||
private:
|
||||
int32_t m_fontSize;
|
||||
int32_t m_fontNormal;
|
||||
int32_t m_fontBold;
|
||||
int32_t m_fontItalic;
|
||||
int32_t m_fontBoldItalic;
|
||||
public:
|
||||
void SetFontSize(int32_t size);
|
||||
void SetFontNameNormal(etk::UString fontName);
|
||||
void SetFontNameBold(etk::UString fontName);
|
||||
void SetFontNameItalic(etk::UString fontName);
|
||||
void SetFontNameBoldItalic(etk::UString fontName);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
void SetFontName(etk::UString fontName);
|
||||
#else
|
||||
void SetFontNameNormal(etk::UString fontName);
|
||||
void SetFontNameBold(etk::UString fontName);
|
||||
void SetFontNameItalic(etk::UString fontName);
|
||||
void SetFontNameBoldItalic(etk::UString fontName);
|
||||
#endif
|
||||
private:
|
||||
void CalculateMaxSize(void);
|
||||
protected:
|
||||
|
@@ -40,11 +40,13 @@
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widgetMeta/FileChooser.h>
|
||||
#include <ewol/widgetMeta/Parameter.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/ResourceManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
|
||||
|
||||
|
||||
@@ -82,7 +84,7 @@ class ParameterAboutGui : public ewol::SizerVert
|
||||
AddElement(" Website : https://github.com/HeeroYui/ewol");
|
||||
AddElement(" Licence : BSD like");
|
||||
AddElement(" Copyright 2010 Edouard DUPIN, all right reserved");
|
||||
AddElement(" Supported OS : Linux, Android" );
|
||||
AddElement(" Supported OS : Linux, Windows, Android" );
|
||||
AddElement(etk::UString(" OpenGl librairy : v") + ewol::GetVersion() );
|
||||
AddElement("Ewol", true);
|
||||
AddElement("");
|
||||
@@ -112,6 +114,16 @@ class ParameterAboutGui : public ewol::SizerVert
|
||||
};
|
||||
|
||||
|
||||
const char * l_smoothChick = "tmpEvent_smooth";
|
||||
const char * l_smoothMin = "tmpEvent_minChange";
|
||||
const char * l_smoothMax = "tmpEvent_maxChange";
|
||||
|
||||
|
||||
extern float DF_SoftEdge_min;
|
||||
extern float DF_SoftEdge_max;
|
||||
extern int32_t DF_SoftEdge;
|
||||
ewol::Slider* tmpSliderMin = NULL;
|
||||
ewol::Slider* tmpSliderMax = NULL;
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "MainWindows"
|
||||
@@ -143,21 +155,55 @@ MainWindows::MainWindows(void)
|
||||
mySizerHori->SubWidgetAdd(mySizerVert2);
|
||||
|
||||
// main buffer Area :
|
||||
myCodeView = new CodeView();
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
myCodeView = new CodeView("Font/freefont/FreeMono.ttf", 24);
|
||||
#else
|
||||
myCodeView = new CodeView();
|
||||
#endif
|
||||
myCodeView->SetExpendX(true);
|
||||
myCodeView->SetExpendY(true);
|
||||
myCodeView->SetFillX(true);
|
||||
myCodeView->SetFillY(true);
|
||||
myCodeView->SetFontSize(11);
|
||||
myCodeView->SetFontNameNormal( "freefont/FreeMono.ttf");
|
||||
myCodeView->SetFontNameBold( "freefont/FreeMonoBold.ttf");
|
||||
myCodeView->SetFontNameItalic( "freefont/FreeMonoOblique.ttf");
|
||||
myCodeView->SetFontNameBoldItalic("freefont/FreeMonoBoldOblique.ttf");
|
||||
#ifndef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
myCodeView->SetFontSize(11);
|
||||
myCodeView->SetFontNameNormal( "Font/freefont/FreeMono.ttf");
|
||||
myCodeView->SetFontNameBold( "Font/freefont/FreeMonoBold.ttf");
|
||||
myCodeView->SetFontNameItalic( "Font/freefont/FreeMonoOblique.ttf");
|
||||
myCodeView->SetFontNameBoldItalic("Font/freefont/FreeMonoBoldOblique.ttf");
|
||||
#endif
|
||||
mySizerVert2->SubWidgetAdd(myCodeView);
|
||||
|
||||
// search area :
|
||||
Search * mySearch = new Search();
|
||||
mySizerVert2->SubWidgetAdd(mySearch);
|
||||
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
|
||||
{
|
||||
ewol::SizerHori * mySizerHori2 = new ewol::SizerHori();
|
||||
mySizerVert2->SubWidgetAdd(mySizerHori2);
|
||||
|
||||
ewol::CheckBox* tmpCheck = new ewol::CheckBox("smooth");
|
||||
mySizerHori2->SubWidgetAdd(tmpCheck);
|
||||
tmpCheck->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_smoothChick);
|
||||
|
||||
ewol::Slider* tmpSlider = new ewol::Slider();
|
||||
mySizerHori2->SubWidgetAdd(tmpSlider);
|
||||
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMin);
|
||||
tmpSlider->SetExpendX(true);
|
||||
tmpSlider->SetMin(0);
|
||||
tmpSlider->SetMax(1000);
|
||||
tmpSlider->SetValue(0450);
|
||||
tmpSliderMin = tmpSlider;
|
||||
|
||||
tmpSlider = new ewol::Slider();
|
||||
mySizerHori2->SubWidgetAdd(tmpSlider);
|
||||
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMax);
|
||||
tmpSlider->SetExpendX(true);
|
||||
tmpSlider->SetMin(0);
|
||||
tmpSlider->SetMax(1000);
|
||||
tmpSlider->SetValue(0550);
|
||||
tmpSliderMax = tmpSlider;
|
||||
}
|
||||
#endif
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
@@ -208,6 +254,8 @@ MainWindows::MainWindows(void)
|
||||
(void)myMenu->AddSpacer();
|
||||
(void)myMenu->Add(idMenugDisplay, "Color Black", "", ednMsgGuiChangeColor, "Black");
|
||||
(void)myMenu->Add(idMenugDisplay, "Color White", "", ednMsgGuiChangeColor, "White");
|
||||
(void)myMenu->AddSpacer();
|
||||
(void)myMenu->Add(idMenugDisplay, "Reload OpenGl Shader", "", ednMsgGuiReloadShader);
|
||||
|
||||
m_widgetLabelFileName = new ewol::Label("FileName");
|
||||
m_widgetLabelFileName->SetExpendX(true);
|
||||
@@ -221,6 +269,7 @@ MainWindows::MainWindows(void)
|
||||
// to update the title ...
|
||||
RegisterMultiCast(ednMsgBufferState);
|
||||
RegisterMultiCast(ednMsgBufferId);
|
||||
RegisterMultiCast(ednMsgGuiReloadShader);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,27 +293,24 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
{
|
||||
ewol::Windows::OnReceiveMessage(CallerObject, eventId, data);
|
||||
|
||||
//APPL_INFO("Receive Event from the main windows ... : widgetid=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
// Open file Section ...
|
||||
if (eventId == ednMsgGuiOpen) {
|
||||
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
|
||||
tmpWidget->SetTitle("Open Files ...");
|
||||
tmpWidget->SetValidateLabel("Open");
|
||||
Buffer * myBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
if (NULL!=myBuffer) {
|
||||
etk::File tmpFile = myBuffer->GetFileName();
|
||||
tmpWidget->SetFolder(tmpFile.GetFolder());
|
||||
} else {
|
||||
// nothing to do : just open the basic folder
|
||||
if (BufferManager::GetSelected()!=-1) {
|
||||
Buffer * myBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
if (NULL!=myBuffer) {
|
||||
etk::FSNode tmpFile = myBuffer->GetFileName();
|
||||
tmpWidget->SetFolder(tmpFile.GetNameFolder());
|
||||
}
|
||||
}
|
||||
//tmpWidget->SetFolder("/");
|
||||
PopUpWidgetPush(tmpWidget);
|
||||
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
|
||||
} else if (eventId == ednEventPopUpFileSelected) {
|
||||
// get the filename :
|
||||
etk::UString tmpData = data;
|
||||
APPL_DEBUG("Request opening the file : " << tmpData);
|
||||
SendMultiCast(ednMsgOpenFile, tmpData);
|
||||
APPL_DEBUG("Request opening the file : " << data);
|
||||
SendMultiCast(ednMsgOpenFile, data);
|
||||
} else if (eventId == ednMsgGuiSaveAs) {
|
||||
if (data == "") {
|
||||
APPL_ERROR("Null data for Save As file ... ");
|
||||
@@ -289,9 +335,9 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
etk::UString folder = "/home/";
|
||||
etk::UString fileName = "";
|
||||
if (true == myBuffer->HaveName()) {
|
||||
etk::File tmpName = myBuffer->GetFileName();
|
||||
folder = tmpName.GetFolder();
|
||||
fileName = tmpName.GetShortFilename();
|
||||
etk::FSNode tmpName = myBuffer->GetFileName();
|
||||
folder = tmpName.GetNameFolder();
|
||||
fileName = tmpName.GetNameFile();
|
||||
}
|
||||
tmpWidget->SetFolder(folder);
|
||||
tmpWidget->SetFileName(fileName);
|
||||
@@ -312,9 +358,9 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
// the buffer change we need to update the widget string
|
||||
Buffer* tmpBuffer = BufferManager::Get(BufferManager::GetSelected());
|
||||
if (NULL != tmpBuffer) {
|
||||
etk::File compleateName = tmpBuffer->GetFileName();
|
||||
etk::FSNode compleateName = tmpBuffer->GetFileName();
|
||||
bool isModify = tmpBuffer->IsModify();
|
||||
etk::UString directName = compleateName.GetCompleateName();
|
||||
etk::UString directName = compleateName.GetName();
|
||||
if (true == isModify) {
|
||||
directName += " *";
|
||||
}
|
||||
@@ -350,9 +396,33 @@ void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev
|
||||
tmpSubWidget = new ParameterAboutGui();
|
||||
tmpWidget->MenuAdd("About", "", tmpSubWidget);
|
||||
}
|
||||
} else if (eventId == l_smoothChick) {
|
||||
if (data == "true") {
|
||||
DF_SoftEdge = 1;
|
||||
} else {
|
||||
DF_SoftEdge = 0;
|
||||
}
|
||||
} else if (eventId == l_smoothMin) {
|
||||
int32_t newVal = 0;
|
||||
sscanf(data.c_str(), "%d", &newVal);
|
||||
DF_SoftEdge_min = (float)newVal / 1000.0;
|
||||
if (DF_SoftEdge_min>DF_SoftEdge_max) {
|
||||
DF_SoftEdge_max = DF_SoftEdge_min;
|
||||
tmpSliderMax->SetValue(DF_SoftEdge_max*1000.0);
|
||||
}
|
||||
} else if (eventId == l_smoothMax) {
|
||||
int32_t newVal = 0;
|
||||
sscanf(data.c_str(), "%d", &newVal);
|
||||
DF_SoftEdge_max = (float)newVal / 1000.0;
|
||||
if (DF_SoftEdge_min>DF_SoftEdge_max) {
|
||||
DF_SoftEdge_min = DF_SoftEdge_max;
|
||||
tmpSliderMin->SetValue(DF_SoftEdge_min*1000.0);
|
||||
}
|
||||
} else if (eventId == ednMsgGuiReloadShader) {
|
||||
ewol::resource::ReLoadResources();
|
||||
ewol::ForceRedrawAll();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
155
Sources/appl/Gui/TagFileList.cpp
Normal file
155
Sources/appl/Gui/TagFileList.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileList.cpp
|
||||
* @brief Editeur De N'ours : Tags list display to jump (sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <appl/Gui/TagFileList.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TagFileList"
|
||||
|
||||
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
|
||||
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
|
||||
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||
|
||||
|
||||
appl::TagFileList::TagFileList(void)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
draw::Color appl::TagFileList::GetBasicBG(void) {
|
||||
draw::Color bg(0x00000010);
|
||||
return bg;
|
||||
}
|
||||
|
||||
uint32_t appl::TagFileList::GetNuberOfColomn(void) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool appl::TagFileList::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) {
|
||||
myTitle = "title";
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t appl::TagFileList::GetNuberOfRaw(void) {
|
||||
return m_list.Size();
|
||||
}
|
||||
|
||||
bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) {
|
||||
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
|
||||
if (0==colomn) {
|
||||
myTextToWrite = etk::UString(m_list[raw]->fileLine);
|
||||
} else {
|
||||
myTextToWrite = m_list[raw]->filename;
|
||||
}
|
||||
} else {
|
||||
myTextToWrite = "ERROR";
|
||||
}
|
||||
fg = draw::color::black;
|
||||
if (raw % 2) {
|
||||
if (colomn%2==0) {
|
||||
bg = 0xFFFFFF00;
|
||||
} else {
|
||||
bg = 0xFFFFFF10;
|
||||
}
|
||||
} else {
|
||||
if (colomn%2==0) {
|
||||
bg = 0xBFBFBFFF;
|
||||
} else {
|
||||
bg = 0xCFCFCFFF;
|
||||
}
|
||||
}
|
||||
if (m_selectedLine == raw) {
|
||||
if (colomn%2==0) {
|
||||
bg = 0x8F8FFFFF;
|
||||
} else {
|
||||
bg = 0x7F7FFFFF;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
|
||||
{
|
||||
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
||||
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||
if (1 == IdInput) {
|
||||
int32_t previousRaw = m_selectedLine;
|
||||
if (raw > m_list.Size() ) {
|
||||
m_selectedLine = -1;
|
||||
} else {
|
||||
m_selectedLine = raw;
|
||||
}
|
||||
const char * event = applEventCtagsListValidate;
|
||||
if (previousRaw != m_selectedLine) {
|
||||
event = applEventCtagsListSelect;
|
||||
}
|
||||
if( m_selectedLine >=0
|
||||
&& m_selectedLine < m_list.Size()
|
||||
&& NULL != m_list[m_selectedLine] ) {
|
||||
GenerateEventId(event, etk::UString(m_list[raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
|
||||
} else {
|
||||
GenerateEventId(applEventCtagsListUnSelect);
|
||||
}
|
||||
// need to regenerate the display of the list :
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
* @param[in] jump line id
|
||||
* @return ---
|
||||
*/
|
||||
void appl::TagFileList::Add(etk::UString& file, int32_t line)
|
||||
{
|
||||
appl::TagListElement *tmpFile = new appl::TagListElement(file, line);
|
||||
if (NULL != tmpFile) {
|
||||
m_list.PushBack(tmpFile);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
|
84
Sources/appl/Gui/TagFileList.h
Normal file
84
Sources/appl/Gui/TagFileList.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileList.h
|
||||
* @brief Editeur De N'ours : Tags list display to jump (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __APPL_CTAGS_LIST_H__
|
||||
#define __APPL_CTAGS_LIST_H__
|
||||
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/List.h>
|
||||
|
||||
|
||||
extern const char * const applEventCtagsListSelect;
|
||||
extern const char * const applEventCtagsListValidate;
|
||||
extern const char * const applEventCtagsListUnSelect;
|
||||
|
||||
namespace appl {
|
||||
class TagListElement {
|
||||
public:
|
||||
etk::UString filename;
|
||||
int32_t fileLine;
|
||||
TagListElement(etk::UString& file, int32_t line) : filename(file), fileLine(line) {};
|
||||
~TagListElement(void) {};
|
||||
};
|
||||
class TagFileList : public ewol::List
|
||||
{
|
||||
private:
|
||||
int32_t m_selectedLine;
|
||||
etk::Vector<appl::TagListElement*> m_list;
|
||||
public:
|
||||
TagFileList(void);
|
||||
~TagFileList(void);
|
||||
// display API :
|
||||
virtual draw::Color GetBasicBG(void);
|
||||
uint32_t GetNuberOfColomn(void);
|
||||
bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
|
||||
uint32_t GetNuberOfRaw(void);
|
||||
bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
|
||||
bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
|
||||
/**
|
||||
* @brief Get the current Object type of the EObject
|
||||
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||
* @param[in] objectType type description
|
||||
* @return true if the object is compatible, otherwise false
|
||||
*/
|
||||
const char * const GetObjectType(void) { return "TagFileList"; };
|
||||
public:
|
||||
/**
|
||||
* @brief Add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
* @param[in] jump line id
|
||||
* @return ---
|
||||
*/
|
||||
void Add(etk::UString& file, int32_t line);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
229
Sources/appl/Gui/TagFileSelection.cpp
Normal file
229
Sources/appl/Gui/TagFileSelection.cpp
Normal file
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileSelection.cpp
|
||||
* @brief Editeur De N'ours : Tags list selection to jump (sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widget/meta/FileChooser.cpp
|
||||
* @brief ewol File chooser meta widget system (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 29/12/2011
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <appl/Gui/TagFileSelection.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Image.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <etk/Vector.h>
|
||||
#include <etk/tool.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TagFileSelection"
|
||||
|
||||
|
||||
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
||||
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||
|
||||
|
||||
appl::TagFileSelection::TagFileSelection(void)
|
||||
{
|
||||
AddEventId(applEventctagsSelection);
|
||||
AddEventId(applEventctagsCancel);
|
||||
|
||||
ewol::Label* myWidgetTitle = NULL;
|
||||
ewol::Button* myWidgetValidate = NULL;
|
||||
ewol::Button* myWidgetCancel = NULL;
|
||||
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Spacer * mySpacer = NULL;
|
||||
#if defined(__TARGET_OS__Android)
|
||||
SetDisplayRatio(0.90);
|
||||
#elif defined(__TARGET_OS__Windows)
|
||||
SetDisplayRatio(0.80);
|
||||
#else
|
||||
SetDisplayRatio(0.80);
|
||||
#endif
|
||||
|
||||
mySizerVert = new ewol::SizerVert();
|
||||
if (NULL == mySizerVert) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySizerVert->LockExpendContamination(true);
|
||||
// set it in the pop-up-system :
|
||||
SubWidgetSet(mySizerVert);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
mySpacer = new ewol::Spacer();
|
||||
if (NULL == mySpacer) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySpacer->SetExpendX(true);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
myWidgetValidate = new ewol::Button("Jump");
|
||||
if (NULL == myWidgetValidate) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
myWidgetValidate->SetImage("icon/Load.svg");
|
||||
myWidgetValidate->RegisterOnEvent(this, ewolEventButtonPressed, applEventctagsSelection);
|
||||
mySizerHori->SubWidgetAdd(myWidgetValidate);
|
||||
}
|
||||
myWidgetCancel = new ewol::Button("Cancel");
|
||||
if (NULL == myWidgetCancel) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
myWidgetCancel->SetImage("icon/Remove.svg");
|
||||
myWidgetCancel->RegisterOnEvent(this, ewolEventButtonPressed, applEventctagsCancel);
|
||||
mySizerHori->SubWidgetAdd(myWidgetCancel);
|
||||
}
|
||||
}
|
||||
m_listTag = new appl::TagFileList();
|
||||
if (NULL == m_listTag) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
m_listTag->RegisterOnEvent(this, applEventCtagsListValidate);
|
||||
m_listTag->RegisterOnEvent(this, applEventCtagsListSelect);
|
||||
m_listTag->RegisterOnEvent(this, applEventCtagsListUnSelect);
|
||||
m_listTag->SetExpendX(true);
|
||||
m_listTag->SetExpendY(true);
|
||||
m_listTag->SetFillX(true);
|
||||
m_listTag->SetFillY(true);
|
||||
mySizerVert->SubWidgetAdd(m_listTag);
|
||||
}
|
||||
|
||||
myWidgetTitle = new ewol::Label("Ctags Jump Selection ...");
|
||||
if (NULL == myWidgetTitle) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
mySizerVert->SubWidgetAdd(myWidgetTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
appl::TagFileSelection::~TagFileSelection(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
void appl::TagFileSelection::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
EWOL_INFO("ctags LIST ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (eventId == applEventctagsSelection) {
|
||||
if (m_eventNamed!="") {
|
||||
GenerateEventId(applEventctagsSelection, m_eventNamed);
|
||||
//==> Auto remove ...
|
||||
AutoDestroy();
|
||||
}
|
||||
} else if (eventId == applEventCtagsListSelect) {
|
||||
m_eventNamed = data;
|
||||
|
||||
} else if (eventId == applEventCtagsListUnSelect) {
|
||||
m_eventNamed = "";
|
||||
} else if (eventId == applEventCtagsListValidate) {
|
||||
GenerateEventId(applEventctagsSelection, data);
|
||||
//==> Auto remove ...
|
||||
AutoDestroy();
|
||||
} else if (eventId == applEventctagsCancel) {
|
||||
GenerateEventId(applEventctagsCancel, "");
|
||||
//==> Auto remove ...
|
||||
AutoDestroy();
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
* @param[in] jump line id
|
||||
* @return ---
|
||||
*/
|
||||
void appl::TagFileSelection::AddCtagsNewItem(etk::UString file, int32_t line)
|
||||
{
|
||||
if (NULL != m_listTag) {
|
||||
m_listTag->Add(file, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void appl::TagFileSelection::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::PopUp::OnObjectRemove(m_listTag);
|
||||
// second step find if in all the elements ...
|
||||
if(removeObject == m_listTag) {
|
||||
m_listTag = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
81
Sources/appl/Gui/TagFileSelection.h
Normal file
81
Sources/appl/Gui/TagFileSelection.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file TagFileSelection.h
|
||||
* @brief Editeur De N'ours : Tags list selection to jump (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/10/2012
|
||||
* @par Project
|
||||
* Edn
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2010 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can not earn money with this Software (if the source extract from Edn
|
||||
* represent less than 50% of original Sources)
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __APPL_CTAGS_SELECTION_H__
|
||||
#define __APPL_CTAGS_SELECTION_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <appl/Gui/TagFileList.h>
|
||||
|
||||
extern const char * const applEventctagsSelection;
|
||||
extern const char * const applEventctagsCancel;
|
||||
|
||||
namespace appl {
|
||||
class TagFileSelection : public ewol::PopUp
|
||||
{
|
||||
private:
|
||||
appl::TagFileList* m_listTag;
|
||||
etk::UString m_eventNamed;
|
||||
public:
|
||||
TagFileSelection(void);
|
||||
virtual ~TagFileSelection(void);
|
||||
/**
|
||||
* @brief Get the current Object type of the EObject
|
||||
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||
* @param[in] objectType type description
|
||||
* @return true if the object is compatible, otherwise false
|
||||
*/
|
||||
const char * const GetObjectType(void) { return "EwolFileChooser"; };
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void OnObjectRemove(ewol::EObject * removeObject);
|
||||
/**
|
||||
* @brief Add a Ctags item on the curent list
|
||||
* @param[in] file Compleate file name
|
||||
* @param[in] jump line id
|
||||
* @return ---
|
||||
*/
|
||||
void AddCtagsNewItem(etk::UString file, int32_t line);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -49,17 +49,17 @@ Highlight::Highlight(etk::UString &xmlFilename)
|
||||
{
|
||||
TiXmlDocument XmlDocument;
|
||||
|
||||
etk::File fileName(xmlFilename, etk::FILE_TYPE_DATA);
|
||||
etk::FSNode fileName(etk::UString("DATA:") + xmlFilename);
|
||||
if (false == fileName.Exist()) {
|
||||
APPL_ERROR("File Does not exist : " << fileName);
|
||||
return;
|
||||
}
|
||||
int32_t fileSize = fileName.Size();
|
||||
int32_t fileSize = fileName.FileSize();
|
||||
if (0==fileSize) {
|
||||
APPL_ERROR("This file is empty : " << fileName);
|
||||
return;
|
||||
}
|
||||
if (false == fileName.fOpenRead()) {
|
||||
if (false == fileName.FileOpenRead()) {
|
||||
APPL_ERROR("Can not open the file : " << fileName);
|
||||
return;
|
||||
}
|
||||
@@ -71,9 +71,9 @@ Highlight::Highlight(etk::UString &xmlFilename)
|
||||
}
|
||||
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
||||
// load data from the file :
|
||||
fileName.fRead(fileBuffer, 1, fileSize);
|
||||
fileName.FileRead(fileBuffer, 1, fileSize);
|
||||
// close the file:
|
||||
fileName.fClose();
|
||||
fileName.FileClose();
|
||||
// load the XML from the memory
|
||||
bool loadError = XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
|
||||
if (false == loadError) {
|
||||
@@ -191,15 +191,15 @@ bool Highlight::HasExtention(etk::UString &ext)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Highlight::FileNameCompatible(etk::File &fileName)
|
||||
bool Highlight::FileNameCompatible(etk::FSNode &fileName)
|
||||
{
|
||||
int32_t i;
|
||||
etk::UString extention;
|
||||
if (true == fileName.HasExtention() ) {
|
||||
if (true == fileName.FileHasExtention() ) {
|
||||
extention = "*.";
|
||||
extention += fileName.GetExtention();
|
||||
extention += fileName.FileGetExtention();
|
||||
} else {
|
||||
extention = fileName.GetShortFilename();
|
||||
extention = fileName.GetNameFile();
|
||||
}
|
||||
APPL_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
|
||||
|
||||
|
@@ -42,7 +42,7 @@ extern "C" {
|
||||
} colorInformation_ts;
|
||||
}
|
||||
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <HighlightPattern.h>
|
||||
#include <Colorize.h>
|
||||
#include <EdnVectorBuf.h>
|
||||
@@ -54,7 +54,7 @@ class Highlight {
|
||||
Highlight(etk::UString &xmlFilename);
|
||||
~Highlight(void);
|
||||
bool HasExtention(etk::UString &ext);
|
||||
bool FileNameCompatible(etk::File &fileName);
|
||||
bool FileNameCompatible(etk::FSNode &fileName);
|
||||
void Display(void);
|
||||
void ReloadColor(void);
|
||||
void Parse(int32_t start,
|
||||
|
@@ -26,8 +26,8 @@
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <HighlightManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/EObjectManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/eObject/EObjectManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "HighlightManager"
|
||||
@@ -89,7 +89,7 @@ class localClassHighlightManager: public ewol::EObject
|
||||
*/
|
||||
}
|
||||
|
||||
Highlight* Get(etk::File &fileName)
|
||||
Highlight* Get(etk::FSNode &fileName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listHighlight.Size(); i++) {
|
||||
@@ -100,7 +100,7 @@ class localClassHighlightManager: public ewol::EObject
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Exist(etk::File &fileName)
|
||||
bool Exist(etk::FSNode &fileName)
|
||||
{
|
||||
if (NULL != Get(fileName) ) {
|
||||
return true;
|
||||
@@ -155,6 +155,10 @@ class localClassHighlightManager: public ewol::EObject
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_glsl.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
//myHightline->Display();
|
||||
}
|
||||
|
||||
@@ -168,7 +172,7 @@ static localClassHighlightManager * localManager = NULL;
|
||||
|
||||
void HighlightManager::Init(void)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
if (NULL != localManager) {
|
||||
APPL_ERROR("HighlightManager ==> already exist, just unlink the previous ...");
|
||||
localManager = NULL;
|
||||
}
|
||||
@@ -197,7 +201,7 @@ void HighlightManager::loadLanguages(void)
|
||||
localManager->loadLanguages();
|
||||
}
|
||||
|
||||
Highlight* HighlightManager::Get(etk::File &fileName)
|
||||
Highlight* HighlightManager::Get(etk::FSNode &fileName)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
return NULL;
|
||||
@@ -205,7 +209,7 @@ Highlight* HighlightManager::Get(etk::File &fileName)
|
||||
return localManager->Get(fileName);
|
||||
}
|
||||
|
||||
bool HighlightManager::Exist(etk::File &fileName)
|
||||
bool HighlightManager::Exist(etk::FSNode &fileName)
|
||||
{
|
||||
if (NULL == localManager) {
|
||||
return false;
|
||||
|
@@ -30,14 +30,14 @@
|
||||
#include <etk/UString.h>
|
||||
#include <appl/globalMsg.h>
|
||||
#include <Highlight.h>
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
namespace HighlightManager{
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
void loadLanguages(void);
|
||||
Highlight* Get(etk::File &fileName);
|
||||
bool Exist(etk::File &fileName);
|
||||
Highlight* Get(etk::FSNode &fileName);
|
||||
bool Exist(etk::FSNode &fileName);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -27,13 +27,80 @@
|
||||
#include <appl/global.h>
|
||||
#include <CTagsManager.h>
|
||||
#include <BufferManager.h>
|
||||
#include <ewol/EObject.h>
|
||||
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <appl/Gui/TagFileSelection.h>
|
||||
|
||||
// TODO : The line ID is no more stored in the file system (FSNode) ...
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "CTagsManager"
|
||||
#if 0
|
||||
|
||||
class CTagsManager: public ewol::EObject
|
||||
{
|
||||
public:
|
||||
// Constructeur
|
||||
CTagsManager(void);
|
||||
~CTagsManager(void);
|
||||
|
||||
/**
|
||||
* @brief Get the current Object type of the EObject
|
||||
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||
* @param[in] objectType type description
|
||||
* @return true if the object is compatible, otherwise false
|
||||
*/
|
||||
const char * const GetObjectType(void)
|
||||
{
|
||||
return "CTagsManager";
|
||||
};
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
|
||||
int32_t m_currentSelectedID;
|
||||
void LoadTagFile(void);
|
||||
int32_t MultipleJump(void);
|
||||
void JumpTo(void);
|
||||
void PrintTag(const tagEntry *entry);
|
||||
etk::UString GetFolder(etk::UString &inputString);
|
||||
etk::UString m_tagFolderBase;
|
||||
etk::UString m_tagFilename;
|
||||
tagFile * m_ctagFile;
|
||||
// history system
|
||||
int32_t m_historyPos;
|
||||
etk::Vector<etk::FSNode*> m_historyList;
|
||||
void RegisterHistory(void);
|
||||
};
|
||||
|
||||
static CTagsManager* s_elementPointer = NULL;
|
||||
void cTagsManager::Init(void)
|
||||
{
|
||||
if (NULL != s_elementPointer) {
|
||||
s_elementPointer = NULL;
|
||||
EWOL_WARNING("Ctags manager already instanciate ... ==> restart IT (can have memory leek ...)");
|
||||
}
|
||||
s_elementPointer = new CTagsManager();
|
||||
if (NULL == s_elementPointer) {
|
||||
EWOL_ERROR("Ctags manager error to instanciate ...");
|
||||
}
|
||||
}
|
||||
void cTagsManager::UnInit(void)
|
||||
{
|
||||
if (NULL != s_elementPointer) {
|
||||
delete(s_elementPointer);
|
||||
s_elementPointer = NULL;
|
||||
} else {
|
||||
EWOL_ERROR("Ctags manager not instanciate ... ==> can not remove it ...");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
@@ -48,7 +115,10 @@ CTagsManager::CTagsManager(void)
|
||||
m_tagFolderBase = "";
|
||||
m_ctagFile = NULL;
|
||||
m_historyPos = 0;
|
||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiCtags);
|
||||
RegisterMultiCast(ednMsgGuiCtags);
|
||||
RegisterMultiCast(ednMsgBufferId);
|
||||
RegisterMultiCast(ednMsgCtagsLoadFile);
|
||||
EWOL_INFO("Ctags manager (INIT)");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,97 +131,76 @@ CTagsManager::CTagsManager(void)
|
||||
*/
|
||||
CTagsManager::~CTagsManager(void)
|
||||
{
|
||||
/*
|
||||
EWOL_INFO("Ctags manager (Un-INIT)");
|
||||
if(0 != m_historyList.Size()) {
|
||||
for (int32_t iii=0; iii< m_historyList.Size(); iii++) {
|
||||
delete(m_historyList[iii]);
|
||||
}
|
||||
m_historyList.Clear();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
etk::UString CTagsManager::GetFolder(etk::UString &inputString)
|
||||
{
|
||||
/*
|
||||
char tmpVal[4096];
|
||||
strncpy(tmpVal, inputString.c_str(), 4096);
|
||||
tmpVal[4096-1] = '\0';
|
||||
char *ptr = strrchr(tmpVal, '/');
|
||||
if (NULL == ptr) {
|
||||
ptr = strrchr(tmpVal, '\\');
|
||||
}
|
||||
etk::UString out = "./";
|
||||
if (NULL != ptr) {
|
||||
*ptr = '\0';
|
||||
out = tmpVal;
|
||||
out+= '/';
|
||||
}
|
||||
return out;
|
||||
*/
|
||||
etk::UString out = "./";
|
||||
return out;
|
||||
}
|
||||
const char * ednEventPopUpCtagsLoadFile = "edn-event-load-ctags";
|
||||
|
||||
bool CTagsManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, float x, float y)
|
||||
void CTagsManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
/*
|
||||
switch (id)
|
||||
{
|
||||
case APPL_MSG__BUFFER_CHANGE_CURRENT:
|
||||
m_currentSelectedID = dataID;
|
||||
break;
|
||||
case APPL_MSG__OPEN_CTAGS:
|
||||
//EWOL_INFO("ctags manager event ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (eventId == ednMsgBufferId) {
|
||||
//m_currentSelectedID = dataID;
|
||||
} else if( eventId == ednEventPopUpCtagsLoadFile
|
||||
|| eventId == ednMsgCtagsLoadFile) {
|
||||
// open the new one :
|
||||
etk::FSNode tmpFilename = data;
|
||||
m_tagFilename = tmpFilename.GetNameFile();
|
||||
m_tagFolderBase = tmpFilename.GetNameFolder();
|
||||
APPL_DEBUG("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
|
||||
LoadTagFile();
|
||||
} else if (eventId == ednMsgGuiCtags) {
|
||||
if (data == "Load") {
|
||||
APPL_INFO("Request opening ctag file");
|
||||
{
|
||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( "Open Exuberant Ctags File", NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||
NULL); // end button/response list
|
||||
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
// open the new one :
|
||||
m_tagFilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
|
||||
m_tagFolderBase = GetFolder(m_tagFilename);
|
||||
LoadTagFile();
|
||||
}
|
||||
gtk_widget_destroy(dialog);
|
||||
ewol::FileChooser* tmpWidget = new ewol::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");
|
||||
PopUpWidgetPush(tmpWidget);
|
||||
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpCtagsLoadFile);
|
||||
}
|
||||
break;
|
||||
case APPL_MSG__RELOAD_CTAGS:
|
||||
} else if (data == "ReLoad") {
|
||||
APPL_INFO("Request re-load ctag file");
|
||||
LoadTagFile();
|
||||
break;
|
||||
case APPL_MSG__JUMP_TO_CURRENT_SELECTION:
|
||||
} else if (data == "Jump") {
|
||||
JumpTo();
|
||||
break;
|
||||
case APPL_MSG__JUMP_BACK:
|
||||
} else if (data == "Back") {
|
||||
if (m_historyList.Size() > 0) {
|
||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
||||
int32_t id = m_historyList.Size()-1;
|
||||
if (false == myBufferManager->Exist(*m_historyList[id]) ) {
|
||||
// need to open the file :
|
||||
int32_t openID = myBufferManager->Open(*m_historyList[id]);
|
||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
|
||||
} else {
|
||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(*m_historyList[id]));
|
||||
}
|
||||
SendMessage(APPL_MSG__CURRENT_GOTO_LINE, m_historyList[id]->GetLineNumber());
|
||||
SendMultiCast(ednMsgOpenFile, m_historyList[id]->GetName() );
|
||||
SendMultiCast(ednMsgGuiGotoLine, 0);// TODO : m_historyList[id]->GetLineNumber());
|
||||
// Remove element ....
|
||||
delete(m_historyList[id]);
|
||||
m_historyList[id]=NULL;
|
||||
m_historyList.PopBack();
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if (eventId == applEventctagsSelection) {
|
||||
// save the current file in the history
|
||||
RegisterHistory();
|
||||
// parse the input data
|
||||
char tmp[4096];
|
||||
int32_t lineID;
|
||||
sscanf(data.c_str(), "%d:%s", &lineID, tmp);
|
||||
// generate envents
|
||||
SendMultiCast(ednMsgOpenFile, tmp);
|
||||
SendMultiCast(ednMsgGuiGotoLine, lineID - 1);
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CTagsManager::LoadTagFile(void)
|
||||
{
|
||||
/*
|
||||
tagFileInfo info;
|
||||
|
||||
// close previous tag file
|
||||
@@ -170,234 +219,84 @@ void CTagsManager::LoadTagFile(void)
|
||||
} else {
|
||||
APPL_INFO("Error to open ctags file ...");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CTagsManager::AddToHistory(int32_t bufferID)
|
||||
{
|
||||
/*
|
||||
// check tho history position : remove if needed
|
||||
if (m_historyPos < edn_max(m_historyList.Size()-1, 0) ) {
|
||||
for(int32_t iii= m_historyPos; iii < m_historyList.Size(); iii++) {
|
||||
delete(m_historyList[iii]);
|
||||
}
|
||||
m_historyList.EraseLen(m_historyPos, m_historyList.Size() - m_historyPos);
|
||||
}
|
||||
// add the current element
|
||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
||||
etk::File currentFilename = myBufferManager->Get(bufferID)->GetFileName();
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
enum
|
||||
{
|
||||
CTAGS_COL_FILE = 0,
|
||||
CTAGS_COL_LINE_NUMBER,
|
||||
CTAGS_NUM_COLS
|
||||
};
|
||||
void CTagsManager::cb_row(GtkTreeView *p_treeview,
|
||||
GtkTreePath * p_path,
|
||||
GtkTreeViewColumn * p_column,
|
||||
gpointer data)
|
||||
{
|
||||
APPL_DEBUG("event");
|
||||
CTagsManager * self = static_cast<CTagsManager*>(data);
|
||||
|
||||
gchar * p_file=NULL;
|
||||
gint lineNumber;
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
||||
if (gtk_tree_model_get_iter( GTK_TREE_MODEL(self->m_listStore), &iter, p_path))
|
||||
{
|
||||
gtk_tree_model_get( GTK_TREE_MODEL(self->m_listStore),
|
||||
&iter,
|
||||
CTAGS_COL_FILE, &p_file,
|
||||
CTAGS_COL_LINE_NUMBER, &lineNumber,
|
||||
-1 );
|
||||
APPL_DEBUG("find : " << p_file << ":" << lineNumber);
|
||||
for (int32_t iii = 0; iii < self->m_currentList.Size() ; iii++) {
|
||||
if( self->m_currentList[iii].lineID == lineNumber
|
||||
&& strcmp(self->m_currentList[iii].filename, p_file)==0)
|
||||
{
|
||||
g_object_unref( GTK_TREE_MODEL(self->m_listStore));
|
||||
// Remove dialogue
|
||||
gtk_widget_destroy(self->m_Dialog);
|
||||
// Jump ...
|
||||
self->JumpAtID(iii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
GtkWidget * CTagsManager::CreateViewAndModel(void)
|
||||
{
|
||||
|
||||
GtkCellRenderer * renderer;
|
||||
GtkWidget * view;
|
||||
view = gtk_tree_view_new();
|
||||
|
||||
// Column 1
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
|
||||
-1,
|
||||
"File",
|
||||
renderer,
|
||||
"text", CTAGS_COL_FILE,
|
||||
NULL);
|
||||
|
||||
// Column 2
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
|
||||
-1,
|
||||
"lineNumber",
|
||||
renderer,
|
||||
"text", CTAGS_COL_LINE_NUMBER,
|
||||
NULL);
|
||||
|
||||
// Set data in the list :
|
||||
GtkTreeIter iter;
|
||||
m_listStore = gtk_list_store_new(CTAGS_NUM_COLS, G_TYPE_STRING, G_TYPE_UINT);
|
||||
// Append a row and fill in some data
|
||||
for (int32_t iii=0; iii<m_currentList.Size() ; iii++) {
|
||||
gtk_list_store_append(m_listStore, &iter);
|
||||
gtk_list_store_set(m_listStore, &iter,
|
||||
CTAGS_COL_FILE, m_currentList[iii].filename,
|
||||
CTAGS_COL_LINE_NUMBER, m_currentList[iii].lineID,
|
||||
-1);
|
||||
}
|
||||
|
||||
gtk_tree_view_set_model( GTK_TREE_VIEW(view), GTK_TREE_MODEL(m_listStore) );
|
||||
g_signal_connect( G_OBJECT(view), "row-activated", G_CALLBACK(cb_row), this );
|
||||
//g_object_unref(GTK_TREE_MODEL(m_listStore));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int32_t CTagsManager::MultipleJump(void)
|
||||
{
|
||||
/*
|
||||
// dlg to confirm the quit event :
|
||||
m_Dialog = gtk_dialog_new_with_buttons("C-Tags jump...",
|
||||
NULL,
|
||||
GTK_DIALOG_MODAL,
|
||||
//"Jump", GTK_RESPONSE_YES,
|
||||
GTK_STOCK_QUIT, GTK_RESPONSE_NO,
|
||||
NULL);
|
||||
// Set over main windows
|
||||
//gtk_window_set_transient_for(GTK_WINDOW(myDialog), GTK_WINDOW(m_mainWindow->GetWidget()));
|
||||
// add writting area
|
||||
GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(m_Dialog));
|
||||
GtkWidget *listView = CreateViewAndModel();
|
||||
gtk_box_pack_start(GTK_BOX(myContentArea), listView, TRUE, TRUE, 0);
|
||||
// Display it
|
||||
gtk_widget_show_all(myContentArea);
|
||||
int32_t result = gtk_dialog_run(GTK_DIALOG(m_Dialog));
|
||||
// Get data from the gtk entry
|
||||
if (result == GTK_RESPONSE_NO) {
|
||||
g_object_unref(GTK_TREE_MODEL(m_listStore));
|
||||
// Remove dialogue
|
||||
gtk_widget_destroy(m_Dialog);
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CTagsManager::JumpAtID(int32_t selectID)
|
||||
void CTagsManager::RegisterHistory(void)
|
||||
{
|
||||
/*
|
||||
BufferManager *myBufferManager = BufferManager::getInstance();
|
||||
etk::File myFile = m_currentList[selectID].filename;
|
||||
APPL_INFO("save curent filename and position : ");
|
||||
int32_t currentSelected = myBufferManager->GetSelected();
|
||||
Buffer* tmpBuf = myBufferManager->Get(currentSelected);
|
||||
int32_t currentSelected = BufferManager::GetSelected();
|
||||
Buffer* tmpBuf = BufferManager::Get(currentSelected);
|
||||
if (NULL != tmpBuf) {
|
||||
etk::File * bufferFilename = new etk::File();
|
||||
etk::FSNode * bufferFilename = new etk::FSNode();
|
||||
*bufferFilename = tmpBuf->GetFileName();
|
||||
bufferFilename->SetLineNumber(tmpBuf->GetCurrentLine());
|
||||
// TODO : bufferFilename->SetLineNumber(tmpBuf->GetCurrentLine());
|
||||
m_historyList.PushBack(bufferFilename);
|
||||
}
|
||||
APPL_INFO(" OPEN the TAG file Destination : " << myFile );
|
||||
if (false == myBufferManager->Exist(myFile) ) {
|
||||
// need to open the file :
|
||||
int32_t openID = myBufferManager->Open(myFile);
|
||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, openID);
|
||||
} else {
|
||||
SendMessage(APPL_MSG__CURRENT_CHANGE_BUFFER_ID, myBufferManager->GetId(myFile));
|
||||
}
|
||||
SendMessage(APPL_MSG__CURRENT_GOTO_LINE, m_currentList[selectID].lineID - 1);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void CTagsManager::JumpTo(void)
|
||||
{
|
||||
/*
|
||||
m_currentList.Clear();
|
||||
if (NULL != m_ctagFile) {
|
||||
etk::Vector<int8_t> data;
|
||||
// get the middle button of the clipboard ==> represent the current selection ...
|
||||
ClipBoard::Get(COPY_MIDDLE_BUTTON, data);
|
||||
etk::UString data = ewol::clipBoard::Get(ewol::clipBoard::CLIPBOARD_SELECTION);
|
||||
APPL_DEBUG("clipboard data : \"" << data << "\"");
|
||||
if (data.Size() == 0) {
|
||||
APPL_INFO("No current S\E9lection");
|
||||
APPL_INFO("No current selection");
|
||||
}
|
||||
tagEntry entry;
|
||||
data.PushBack('\0');
|
||||
APPL_INFO("try to find the tag : " << (const char *)&data[0]);
|
||||
if (tagsFind (m_ctagFile, &entry, (const char *)&data[0], 0) == TagSuccess) {
|
||||
APPL_INFO("try to find the tag : " << data);
|
||||
if (tagsFind (m_ctagFile, &entry, data.c_str(), 0) == TagSuccess) {
|
||||
tagEntry entrySave = entry;
|
||||
int32_t numberOfTags = 0;
|
||||
|
||||
// For all tags : Save in an internal Structure :
|
||||
do {
|
||||
etk::UString destinationFilename = m_tagFolderBase;
|
||||
destinationFilename += entry.file;
|
||||
etk::File myfile = destinationFilename;
|
||||
TagListFind_ts myStruct;
|
||||
strncpy(myStruct.filename, myfile.GetCompleateName().c_str(), MAX_FILE_NAME);
|
||||
myStruct.filename[MAX_FILE_NAME-1] = '\0';
|
||||
strncpy(myStruct.RegExp, entry.address.pattern, MAX_REG_EXP_SEARCH);
|
||||
myStruct.RegExp[MAX_REG_EXP_SEARCH-1] = '\0';
|
||||
myStruct.lineID = entry.address.lineNumber;
|
||||
// at at the corect position
|
||||
m_currentList.PushBack(myStruct);
|
||||
PrintTag(&entry, true);
|
||||
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
|
||||
etk::UString tmpFile(m_tagFolderBase + "/" + entry.file);
|
||||
etk::FSNode myfile(tmpFile);
|
||||
int32_t lineID = entry.address.lineNumber;
|
||||
PrintTag(&entry);
|
||||
|
||||
|
||||
if (1==m_currentList.Size() ) {
|
||||
JumpAtID(0);
|
||||
|
||||
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
|
||||
APPL_INFO("Multiple file destination ...");
|
||||
appl::TagFileSelection* tmpWidget = new appl::TagFileSelection();
|
||||
if (NULL == tmpWidget) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->AddCtagsNewItem(myfile.GetName(), lineID);
|
||||
do {
|
||||
tmpFile = m_tagFolderBase + "/" + entry.file;
|
||||
myfile = tmpFile;
|
||||
lineID = entry.address.lineNumber;
|
||||
PrintTag(&entry);
|
||||
tmpWidget->AddCtagsNewItem(myfile.GetName(), lineID);
|
||||
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
|
||||
PopUpWidgetPush(tmpWidget);
|
||||
tmpWidget->RegisterOnEvent(this, applEventctagsSelection);
|
||||
}
|
||||
} else {
|
||||
// Open a choice windows...
|
||||
int32_t SelectID = MultipleJump();
|
||||
RegisterHistory();
|
||||
APPL_INFO(" OPEN the TAG file Destination : " << tmpFile );
|
||||
SendMultiCast(ednMsgOpenFile, myfile.GetName());
|
||||
SendMultiCast(ednMsgGuiGotoLine, lineID - 1);
|
||||
}
|
||||
} else {
|
||||
APPL_INFO("no tag find ...");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
/*
|
||||
void CTagsManager::PrintTag (const tagEntry *entry, bool small)
|
||||
|
||||
|
||||
void CTagsManager::PrintTag(const tagEntry *entry)
|
||||
{
|
||||
if (small==true) {
|
||||
#if 1
|
||||
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
||||
<< "\" at line="<< entry->address.lineNumber);
|
||||
} else {
|
||||
<< "\" at line="<< (int32_t)entry->address.lineNumber);
|
||||
#else
|
||||
int i;
|
||||
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
||||
<< "\" pattern=\"" <<entry->address.pattern
|
||||
<< "\" at line="<<entry->address.lineNumber);
|
||||
<< "\" pattern=\"" << entry->address.pattern
|
||||
<< "\" at line="<< (int32_t)entry->address.lineNumber);
|
||||
|
||||
APPL_INFO("Extention field : ");
|
||||
if (entry->kind != NULL && entry->kind [0] != '\0') {
|
||||
@@ -409,9 +308,6 @@ void CTagsManager::PrintTag (const tagEntry *entry, bool small)
|
||||
for (i = 0 ; i < entry->fields.count ; ++i) {
|
||||
APPL_INFO(" " << entry->fields.list[i].key << ":" << entry->fields.list[i].value );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -27,46 +27,17 @@
|
||||
#define __C_TAGS_MANAGER_H__
|
||||
|
||||
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include "appl/globalMsg.h"
|
||||
#include "readtags.h"
|
||||
|
||||
#define MAX_REG_EXP_SEARCH (1024)
|
||||
|
||||
typedef struct{
|
||||
char filename[MAX_FILE_NAME];
|
||||
char RegExp[MAX_REG_EXP_SEARCH];
|
||||
int32_t lineID;
|
||||
} TagListFind_ts;
|
||||
|
||||
/*
|
||||
class CTagsManager: public etk::Singleton<CTagsManager>, public ewol::Widget
|
||||
namespace cTagsManager
|
||||
{
|
||||
friend class etk::Singleton<CTagsManager>;
|
||||
// specific for sigleton system...
|
||||
private:
|
||||
// Constructeur
|
||||
CTagsManager(void);
|
||||
~CTagsManager(void);
|
||||
|
||||
public:
|
||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, float x, float y);
|
||||
private:
|
||||
int32_t m_currentSelectedID;
|
||||
void LoadTagFile(void);
|
||||
int32_t MultipleJump(void);
|
||||
void JumpTo(void);
|
||||
void PrintTag(const tagEntry *entry, bool small);
|
||||
etk::UString GetFolder(etk::UString &inputString);
|
||||
etk::UString m_tagFolderBase;
|
||||
etk::UString m_tagFilename;
|
||||
tagFile * m_ctagFile;
|
||||
// history system
|
||||
void AddToHistory(int32_t bufferID);
|
||||
int32_t m_historyPos;
|
||||
etk::Vector<etk::File*> m_historyList;
|
||||
etk::Vector<TagListFind_ts> m_currentList;
|
||||
void JumpAtID(int32_t selectID);
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -26,7 +26,9 @@
|
||||
#include <appl/global.h>
|
||||
#include <ColorizeManager.h>
|
||||
#include <appl/globalMsg.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/ResourceManager.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "globals"
|
||||
@@ -101,6 +103,12 @@ void globals::SetAutoIndent(bool newVal)
|
||||
// -----------------------------------------------------------
|
||||
|
||||
|
||||
bool globals::OrderTheBufferList(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
|
||||
int32_t globals::getNbColoneBorder(void)
|
||||
@@ -120,6 +128,7 @@ static const char * const l_changeIndentation = "edn-event-change-indentation";
|
||||
static const char * const l_changeSpace = "edn-event-change-spaces";
|
||||
static const char * const l_changeTabulation = "edn-event-change-tabulation";
|
||||
static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
|
||||
static const char * const l_changeRounded = "edn-event-change-rounded";
|
||||
|
||||
globals::ParameterGlobalsGui::ParameterGlobalsGui(void)
|
||||
{
|
||||
@@ -170,6 +179,15 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui(void)
|
||||
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeEndOfLine);
|
||||
SubWidgetAdd(myCheckbox);
|
||||
}
|
||||
myCheckbox = new ewol::CheckBox("switch Rounded/default");
|
||||
if (NULL == myCheckbox) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
myCheckbox->SetExpendX(true);
|
||||
myCheckbox->SetValue(IsSetDisplayEndOfLine());
|
||||
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeRounded);
|
||||
SubWidgetAdd(myCheckbox);
|
||||
}
|
||||
}
|
||||
|
||||
globals::ParameterGlobalsGui::~ParameterGlobalsGui(void)
|
||||
@@ -213,6 +231,15 @@ void globals::ParameterGlobalsGui::OnReceiveMessage(ewol::EObject * CallerObject
|
||||
} else {
|
||||
SetDisplayTabChar(false);
|
||||
}
|
||||
} else if (eventId == l_changeRounded) {
|
||||
if (data == "true") {
|
||||
etk::theme::SetName("GUI", "rounded");;
|
||||
} else {
|
||||
etk::theme::SetName("GUI", "default");;
|
||||
}
|
||||
// Reload shaders and graphic system ...
|
||||
ewol::resource::ReLoadResources();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -51,6 +51,7 @@ namespace globals
|
||||
|
||||
void init2(void);
|
||||
|
||||
bool OrderTheBufferList(void);
|
||||
|
||||
class ParameterGlobalsGui : public ewol::SizerVert
|
||||
{
|
||||
|
@@ -55,7 +55,9 @@ extern const char* const ednMsgGuiShowSpaces = "edn-Msg-Gui-ShowSpaces";
|
||||
extern const char* const ednMsgGuiShowEndOfLine = "edn-Msg-Gui-ShowEndOfLine";
|
||||
|
||||
extern const char* const ednMsgGuiCtags = "edn-Msg-Gui-CTags";
|
||||
extern const char* const ednMsgCtagsLoadFile = "edn-Msg-CTags-direct-load";
|
||||
|
||||
extern const char* const ednMsgGuiReloadShader = "edn-Msg-Gui-ReloadOpenGlShader";
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -55,7 +55,9 @@
|
||||
extern const char* const ednMsgGuiShowEndOfLine; // data : "enable" "disable"
|
||||
|
||||
extern const char* const ednMsgGuiCtags; // data : "Load" "ReLoad" "Jump" "Back"
|
||||
extern const char* const ednMsgCtagsLoadFile; // data : "filename of the ctags file"
|
||||
|
||||
extern const char* const ednMsgGuiReloadShader; // data : ""
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -23,14 +23,15 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/global.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <etk/tool.h>
|
||||
#include <Gui/MainWindows.h>
|
||||
#include <BufferManager.h>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <readtags.h>
|
||||
#include <CTagsManager.h>
|
||||
#include <globalMsg.h>
|
||||
#include <ewol/font/FontManager.h>
|
||||
|
||||
MainWindows * basicWindows = NULL;
|
||||
|
||||
@@ -63,17 +65,16 @@ void APP_Init(void)
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
|
||||
#endif
|
||||
#endif
|
||||
ewol::ChangeSize(800, 600);
|
||||
ewol::ChangeSize(etk::Vector2D<int32_t>(800, 600));
|
||||
etk::InitDefaultFolder(PROJECT_NAME);
|
||||
|
||||
ewol::SetFontFolder("Font");
|
||||
|
||||
ewol::font::SetDefaultFont("Font/freefont/FreeSerif.ttf");
|
||||
//ewol::font::SetDefaultFont("Font/ACharmingFont.ttf");
|
||||
#ifdef __TARGET_OS__Android
|
||||
ewol::SetDefaultFont("freefont/FreeSerif.ttf", 19);
|
||||
ewol::font::SetDefaultSize(19);
|
||||
#else
|
||||
ewol::SetDefaultFont("freefont/FreeSerif.ttf", 14);
|
||||
ewol::font::SetDefaultSize(14);
|
||||
#endif
|
||||
|
||||
// init internal global value
|
||||
globals::init();
|
||||
|
||||
@@ -90,6 +91,7 @@ void APP_Init(void)
|
||||
|
||||
HighlightManager::Init();
|
||||
HighlightManager::loadLanguages();
|
||||
cTagsManager::Init();
|
||||
|
||||
char cCurrentPath[FILENAME_MAX];
|
||||
// get the curent program folder
|
||||
@@ -123,35 +125,38 @@ void APP_Init(void)
|
||||
ewol::shortCut::Add("ctrl+z", ednMsgGuiUndo, "");
|
||||
ewol::shortCut::Add("ctrl+shift+z", ednMsgGuiRedo, "");
|
||||
|
||||
ewol::shortCut::Add("ctrl+w", ednMsgGuiRm, "Line");
|
||||
ewol::shortCut::Add("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
|
||||
ewol::shortCut::Add("ctrl+x", ednMsgGuiCut, "STD");
|
||||
ewol::shortCut::Add("ctrl+c", ednMsgGuiCopy, "STD");
|
||||
ewol::shortCut::Add("ctrl+v", ednMsgGuiPaste, "STD");
|
||||
ewol::shortCut::Add("ctrl+a", ednMsgGuiSelect, "ALL");
|
||||
ewol::shortCut::Add("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
||||
|
||||
ewol::shortCut::Add("ctrl+l", ednMsgGuiGotoLine, "???");
|
||||
|
||||
ewol::shortCut::Add("ctrl+f", ednMsgGuiSearch, "");
|
||||
ewol::shortCut::Add("F12", ednMsgGuiReloadShader, "");
|
||||
|
||||
ewol::shortCut::Add("ctrl+d", ednMsgGuiCtags, "Jump");
|
||||
|
||||
|
||||
// add files
|
||||
APPL_INFO("show list of files : ");
|
||||
|
||||
for( int32_t iii=0 ; iii<ewol::CmdLineNb(); iii++) {
|
||||
APPL_INFO("need load file : \"" << ewol::CmdLineGet(iii) << "\"" );
|
||||
etk::UString tmpppp = ewol::CmdLineGet(iii);
|
||||
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgOpenFile, tmpppp);
|
||||
bool ctagDetected = false;
|
||||
for( int32_t iii=0 ; iii<ewol::CmdLine::Nb(); iii++) {
|
||||
etk::UString tmpppp = ewol::CmdLine::Get(iii);
|
||||
if (tmpppp == "-t") {
|
||||
ctagDetected = true;
|
||||
} else if (true == ctagDetected) {
|
||||
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
|
||||
ctagDetected = false;
|
||||
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgCtagsLoadFile, tmpppp);
|
||||
} else {
|
||||
APPL_INFO("need load file : \"" << tmpppp << "\"" );
|
||||
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgOpenFile, tmpppp);
|
||||
}
|
||||
}
|
||||
|
||||
APPL_INFO("==> Init Edn (END)");
|
||||
}
|
||||
|
||||
|
||||
etk::File APP_Icon(void)
|
||||
etk::FSNode APP_Icon(void)
|
||||
{
|
||||
etk::File bitmapFile("iconEdn.bmp", etk::FILE_TYPE_DATA);
|
||||
etk::FSNode bitmapFile("DATA:iconEdn.bmp");
|
||||
return bitmapFile;
|
||||
}
|
||||
|
||||
@@ -164,6 +169,8 @@ void APP_UnInit(void)
|
||||
// Remove windows :
|
||||
ewol::DisplayWindows(NULL);
|
||||
|
||||
cTagsManager::UnInit();
|
||||
|
||||
APPL_INFO("Stop Hightlight");
|
||||
HighlightManager::UnInit();
|
||||
//Kill all singleton
|
||||
|
@@ -18,7 +18,9 @@ FILE_LIST+= appl/Gui/BufferView.cpp \
|
||||
appl/Gui/CodeView.cpp \
|
||||
appl/Gui/MainWindows.cpp \
|
||||
appl/Gui/Search.cpp \
|
||||
appl/Gui/SearchData.cpp
|
||||
appl/Gui/SearchData.cpp \
|
||||
appl/Gui/TagFileSelection.cpp \
|
||||
appl/Gui/TagFileList.cpp
|
||||
|
||||
# All needed for the buffer management :
|
||||
FILE_LIST+= appl/Buffer/EdnVectorBuf.cpp \
|
||||
@@ -44,3 +46,13 @@ FILE_LIST+= appl/Highlight/HighlightPattern.cpp \
|
||||
# Main entry file :
|
||||
FILE_LIST+= appl/init.cpp
|
||||
|
||||
|
||||
|
||||
LOCAL_COPY_FILES := \
|
||||
../share/Font/freefont/FreeSerif.ttf:Font/freefont/FreeSerif.ttf
|
||||
|
||||
LOCAL_COPY_FOLDERS := \
|
||||
../share/*.xml: \
|
||||
../share/icon/*.svg:icon \
|
||||
../share/Font/freefont/FreeMon*.ttf:Font/freefont
|
||||
|
||||
|
@@ -10,12 +10,10 @@ dans la liste des truc important a refaire
|
||||
* 0.3.6 ...
|
||||
|
||||
* 0.2.X :
|
||||
- gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre)
|
||||
- gui : Demander la cr<63>ation de nouveaux fichier quand il n'existe pas (a l'ouverture en ligne de commande)
|
||||
- sys : Mise en place des colorisation de base pour le
|
||||
* java script
|
||||
* SQL
|
||||
- sys : replace TAB with space when Tab is pressed
|
||||
- sys : Catch F[1-12] ==> for user personal event
|
||||
- BUG : Correction du bug des entr<74> bizard tel que les chapot et les guillemets
|
||||
- BUG : de s<>lection quand la ligne est pleine et la premi<6D>re ligne s<>ctionn<6E>e. ==> regarder apr<70>s avoir fait le display ligne par ligne...
|
||||
|
64
config/Android.config
Normal file
64
config/Android.config
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version:
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
CONFIG_BUILD_EDN=y
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_EWOL 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
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
||||
|
||||
|
||||
#
|
||||
# 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
|
||||
# CONFIG___VIDEO__OPENGL_ES_1 is not set
|
||||
|
||||
|
||||
CONFIG___VIDEO__OPENGL_ES_2=y
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
42
config/Linux.config
Normal file
42
config/Linux.config
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version:
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
CONFIG_BUILD_EDN=y
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_EWOL 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
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
# CONFIG___VIDEO__OPENGL_ES_1 is not set
|
||||
CONFIG___VIDEO__OPENGL_ES_2=y
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
42
config/Windows.config
Normal file
42
config/Windows.config
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version:
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
CONFIG_BUILD_EDN=y
|
||||
# CONFIG_BUILD_AGG is not set
|
||||
# CONFIG_BUILD_ETK is not set
|
||||
# CONFIG_BUILD_EWOL 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
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
CONFIG_APPL_BUFFER_FONT_NORMAL=y
|
||||
# CONFIG_APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
# CONFIG___VIDEO__OPENGL_ES_1 is not set
|
||||
CONFIG___VIDEO__OPENGL_ES_2=y
|
||||
CONFIG___EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
edn-debug.jks
Normal file
BIN
edn-debug.jks
Normal file
Binary file not shown.
@@ -2,9 +2,8 @@
|
||||
|
||||
#really simple to install
|
||||
echo "- copy binary /usr/bin/edn"
|
||||
sudo cp -vf out/Linux/release/obj/edn/edn /usr/bin/edn
|
||||
sudo chmod 777 /usr/bin/edn
|
||||
sudo cp -vf out/Linux/release/staging/edn/usr/bin/edn /usr/bin/edn
|
||||
sudo mkdir -p /usr/share/edn
|
||||
echo "- Remove the folder /usr/share/edn/*"
|
||||
sudo rm -rf /usr/share/edn/*
|
||||
sudo cp -rfv share/* /usr/share/edn/
|
||||
sudo cp -rfv out/Linux/release/staging/edn/usr/share/* /usr/share/
|
||||
|
67
os-Linux/README
Normal file
67
os-Linux/README
Normal file
@@ -0,0 +1,67 @@
|
||||
Edn
|
||||
====
|
||||
|
||||
`Edn` (Editeur De N'ours) is a FREE software.
|
||||
|
||||
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
|
||||
|
||||
Instructions
|
||||
============
|
||||
|
||||
download the software :
|
||||
|
||||
mkdir yourDevFolder
|
||||
cd yourDevFolder
|
||||
git clone git://github.com/HeeroYui/ewol.git
|
||||
cd ewol
|
||||
git submodule init
|
||||
git submodule update
|
||||
cd ..
|
||||
git clone git://github.com/HeeroYui/edn.git
|
||||
cd edn
|
||||
|
||||
(debug) Compile software & Run debug version:
|
||||
|
||||
make DEBUG=1
|
||||
or
|
||||
make CLANG=1 DEBUG=1
|
||||
./out_LINUX/debug/obj/usr/bin/edn -l6 yourFile.txt
|
||||
Note : -l6 corespond at the LOG level to display
|
||||
|
||||
(release) Compile software & install & run:
|
||||
|
||||
make
|
||||
./install.sh
|
||||
edn exemple.txt
|
||||
|
||||
(Android) Compile software & install
|
||||
|
||||
cd yourDevFolder
|
||||
mkdir andoid
|
||||
cd android
|
||||
download here in "sdk" and "ndk" the coresponding SDK and NDK of Android:
|
||||
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
|
||||
make PLATFORM=Android
|
||||
make PLATFORM=Android install
|
||||
|
||||
License (like GPL)
|
||||
==================
|
||||
|
||||
You can:
|
||||
- Redistribute the sources code and binaries.
|
||||
- Modify the Sources code.
|
||||
- Use a part of the sources (less than 50%) in an other software, just write somewhere "Edn is great" visible by the user (on your product or on your website with a link to my page).
|
||||
- Redistribute the modification only if you want.
|
||||
- Send me the bug-fix (it could be great).
|
||||
- Pay me a beer or some other things.
|
||||
- Print the source code on WC paper ...
|
||||
You can NOT:
|
||||
- Earn money with this Software (But I can).
|
||||
- Add malware in the Sources.
|
||||
- Do something bad with the sources.
|
||||
- Use it to travel in the space with a toaster.
|
||||
|
||||
I reserve the right to change this licence. If it change the version of the copy you have keep its own license
|
@@ -1,18 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="64"
|
||||
width="64"
|
||||
version="1.1"
|
||||
id="svg3965"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="Search.svg">
|
||||
<svg height="64"
|
||||
width="64" >
|
||||
<metadata
|
||||
id="metadata3975">
|
||||
<rdf:RDF>
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -9,5 +9,5 @@
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<path d="m36.594,31.471,9.9047,12.555,9.3732-12.561-9.4514,0.0011z" fill="#333"/>
|
||||
<path style="baseline-shift:baseline;block-progression:tb;color:#000000;direction:ltr;text-indent:0;text-align:start;enable-background:accumulate;text-transform:none;" fill="#353535" d="m31.724,51.573c-6.6423,0-11.845-9.0656-11.845-20.048s5.203-20.048,11.845-20.048c7.389,0,12.257,7.595,11.625,20.494,3.1648,0.01798,3.0508-0.01346,7.1142-0.17954,0.674-20.911-8.501-28.985-18.739-28.985-9.0867,0-18.935,12.636-18.935,28.584s9.849,29.002,18.935,28.855"/>
|
||||
<path fill="#353535" d="m31.724,51.573c-6.6423,0-11.845-9.0656-11.845-20.048s5.203-20.048,11.845-20.048c7.389,0,12.257,7.595,11.625,20.494,3.1648,0.01798,3.0508-0.01346,7.1142-0.17954,0.674-20.911-8.501-28.985-18.739-28.985-9.0867,0-18.935,12.636-18.935,28.584s9.849,29.002,18.935,28.855"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 980 B After Width: | Height: | Size: 818 B |
82
share/lang_glsl.xml
Normal file
82
share/lang_glsl.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EdnLang version="0.1" lang="glsl">
|
||||
<ext>*.glsl</ext>
|
||||
<ext>*.vert</ext>
|
||||
<ext>*.frag</ext>
|
||||
<ext>*.prog</ext>
|
||||
<pass1>
|
||||
<rule name="my comment multiline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<start>/\*\*</start>
|
||||
<end>\*/</end>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<color>comment</color>
|
||||
<start>/\*</start>
|
||||
<end>\*/</end>
|
||||
</rule>
|
||||
<rule name="my if 0">
|
||||
<color>preprocesseur</color>
|
||||
<start>#[ \t]*if 0</start>
|
||||
<end>#endif|#else</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
</rule>
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<start>#</start>
|
||||
<end>\n</end>
|
||||
<EscapeChar>\</EscapeChar>
|
||||
</rule>
|
||||
<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>
|
||||
</pass1>
|
||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||
<rule name="my keyword">
|
||||
<color>keyword</color>
|
||||
<start>\@return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof\@</start>
|
||||
</rule>
|
||||
<rule name="my type">
|
||||
<color>type</color>
|
||||
<start>\@bool|float|int|(vec|mat|ivect|bvect)[2-4]\@</start>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<start>\@varying|uniform|attribute\@</start>
|
||||
</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="my boolean">
|
||||
<color>boolean</color>
|
||||
<start>\@true|false\@</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>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<start>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</start>
|
||||
</rule>
|
||||
</pass2>
|
||||
</EdnLang>
|
Reference in New Issue
Block a user