diff --git a/assets/lang_c.xml b/assets/lang_c.xml index 4507b44..233e40f 100644 --- a/assets/lang_c.xml +++ b/assets/lang_c.xml @@ -2,6 +2,7 @@ *.c *.cpp + *.cc *.h *.hpp diff --git a/jni/Android.mk b/jni/Android.mk index 1ab573d..1a2f4e6 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -5,7 +5,15 @@ include $(CLEAR_VARS) # load the common sources file of the platform include $(LOCAL_PATH)/file.mk +# name of the librairy LOCAL_MODULE := ednpackage + +# 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) +$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG)) + +# name of the dependency LOCAL_STATIC_LIBRARIES := ewol etk tinyxml libzip libpng libfreetype libparsersvg libagg LOCAL_C_INCLUDES := $(LOCAL_PATH) $(addprefix $(LOCAL_PATH)/, $(sort $(dir $(FILE_LIST)))) diff --git a/jni/Linux.mk b/jni/Linux.mk index 1f53e3f..ea68759 100644 --- a/jni/Linux.mk +++ b/jni/Linux.mk @@ -8,7 +8,6 @@ include $(LOCAL_PATH)/file.mk # name of the librairy LOCAL_MODULE := ednn - # 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) diff --git a/jni/edn/Buffer/BufferText.cpp b/jni/edn/Buffer/BufferText.cpp index 83221f2..d8fab86 100644 --- a/jni/edn/Buffer/BufferText.cpp +++ b/jni/edn/Buffer/BufferText.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #undef __class__ @@ -1180,14 +1180,15 @@ void BufferText::Replace(etk::UString &data) */ void BufferText::Copy(int8_t clipboardID) { - etk::VectorType mVect; + //etk::VectorType mVect; + etk::UString mVect; // get the curent selected data if (true == m_EdnBuf.SelectHasSelection(SELECTION_PRIMARY) ) { - //m_EdnBuf.GetSelectionText(SELECTION_PRIMARY, mVect); + m_EdnBuf.GetSelectionText(SELECTION_PRIMARY, mVect); EDN_TODO("Remove for now ..."); } // copy data in the click board : - //ClipBoard::Set(clipboardID, mVect); + ewol::clipBoard::Set(clipboardID, mVect); EDN_TODO("Remove for now ..."); } @@ -1230,12 +1231,12 @@ void BufferText::Cut(int8_t clipboardID) */ void BufferText::Paste(int8_t clipboardID) { - etk::VectorType mVect; - + //etk::VectorType mVect; + etk::UString mVect; EDN_TODO("Remove for now ..."); /* - // copy data from the click board : - ClipBoard::Get(clipboardID, mVect); + // copy data from the click board : + ewol::clipBoard::Get(clipboardID, mVect); int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd; bool SelectionIsRect; diff --git a/jni/edn/Gui/CodeView.cpp b/jni/edn/Gui/CodeView.cpp index ba0f70a..3944f3e 100644 --- a/jni/edn/Gui/CodeView.cpp +++ b/jni/edn/Gui/CodeView.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -68,6 +68,9 @@ CodeView::CodeView(void) m_textColorBg.alpha = 0.25; SetCanHaveFocus(true); RegisterMultiCast(ednMsgBufferId); + RegisterMultiCast(ednMsgGuiCopy); + RegisterMultiCast(ednMsgGuiPaste); + RegisterMultiCast(ednMsgGuiCut); } CodeView::~CodeView(void) @@ -222,7 +225,7 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, MarkToReedraw(); } else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) { m_buttunOneSelected = false; - BufferManager::Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON); + BufferManager::Get(m_bufferID)->Copy(ewol::clipBoard::CLIPBOARD_SELECTION); MarkToReedraw(); } else #endif @@ -259,7 +262,7 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, } 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(COPY_MIDDLE_BUTTON); + BufferManager::Get(m_bufferID)->Paste(ewol::clipBoard::CLIPBOARD_SELECTION); MarkToReedraw(); ewol::widgetManager::FocusKeep(this); } @@ -289,59 +292,13 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event EDN_INFO("Select a new Buffer ... " << bufferID); m_bufferID = bufferID; // TODO : need to update the state of the file and the filenames ... + } else if (eventId == ednMsgGuiCopy) { + BufferManager::Get(m_bufferID)->Copy(ewol::clipBoard::CLIPBOARD_STD); + } 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); } - // old - /* - else if( ednMsgCodeViewCurrentChangeBufferId == generateEventId) { - int32_t bufferID = 0; - sscanf(data, "%d", &bufferID); - EDN_INFO("Select a new Buffer ... " << bufferID); - m_bufferID = bufferID; - BufferManager::Get(m_bufferID)->ForceReDraw(true); - // request the display of the curent Editor - ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferChangeCurrent, (char*)data); - - } - */ - /* - else if (ednMsgCodeViewCurrentSave == generateEventId) { - - } else if (ednMsgCodeViewCurrentSaveAs == generateEventId) { - - } else if (ednMsgCodeViewCurrentSelectAll == generateEventId) { - - } else if (ednMsgCodeViewCurrentRemoveLine == generateEventId) { - - } else if (ednMsgCodeViewCurrentUnSelect == generateEventId) { - - } else if (ednMsgCodeViewCurrentCopy == generateEventId) { - - } else if (ednMsgCodeViewCurrentCut == generateEventId) { - - } else if (ednMsgCodeViewCurrentPaste == generateEventId) { - - } else if (ednMsgCodeViewCurrentFindPrevious == generateEventId) { - - } else if (ednMsgCodeViewCurrentFindNext == generateEventId) { - - } else if (ednMsgCodeViewCurrentFindOldNext == generateEventId) { - - } else if (ednMsgCodeViewCurrentReplace == generateEventId) { - - } else if (ednMsgCodeViewCurrentReplaceAll == generateEventId) { - - } else if (ednMsgCodeViewCurrentClose == generateEventId) { - - } else if (ednMsgCodeViewCurrentUndo == generateEventId) { - - } else if (ednMsgCodeViewCurrentRedo == generateEventId) { - - } else if (ednMsgCodeViewCurrentGotoLine == generateEventId) { - - } else if (ednMsgCodeViewCurrentSetCharset == generateEventId) { - - } - */ else { } @@ -371,24 +328,6 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event case EDN_MSG__CURRENT_UN_SELECT: BufferManager::Get(m_bufferID)->SelectNone(); break; - case EDN_MSG__CURRENT_COPY: - if (dataID == -1) { - dataID = COPY_STD; - } - BufferManager::Get(m_bufferID)->Copy(dataID); - break; - case EDN_MSG__CURRENT_CUT: - if (dataID == -1) { - dataID = COPY_STD; - } - BufferManager::Get(m_bufferID)->Cut(dataID); - break; - case EDN_MSG__CURRENT_PASTE: - if (dataID == -1) { - dataID = COPY_STD; - } - BufferManager::Get(m_bufferID)->Paste(dataID); - break; case EDN_MSG__CURRENT_FIND_PREVIOUS: { etk::UString myDataString; diff --git a/jni/edn/tools/EdnBuf/EdnBuf.cpp b/jni/edn/tools/EdnBuf/EdnBuf.cpp index 6622dfb..6ea361a 100644 --- a/jni/edn/tools/EdnBuf/EdnBuf.cpp +++ b/jni/edn/tools/EdnBuf/EdnBuf.cpp @@ -164,6 +164,18 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::VectorType &outpu //EDN_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() ); } +void EdnBuf::GetRange(int32_t start, int32_t end, etk::Ustring &output) +{ + // Remove all data ... + output = ""; + // import data : + etk::VectorType &localOutput; + m_data.Get(start, end-start, localOutput); + // transcript in UNICODE ... + // TODO : ldkjqlsdjfqslkjd + //EDN_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() ); +} + /** * @brief Get an element at the selected position @@ -220,6 +232,17 @@ void EdnBuf::Replace(int32_t start, int32_t end, etk::VectorType &insert // update internal elements eventModification(start, insertText.Size(), deletedText); } +void EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText) +{ + etk::VectorType deletedText; + GetRange(start, end, deletedText); + etk::VectorType tmpInsertText; + insertText + // TODO : Unicode to utf8 ... + m_data.Replace(start, end-start, tmpInsertText); + // update internal elements + eventModification(start, tmpInsertText.Size(), deletedText); +} /** diff --git a/jni/edn/tools/EdnBuf/EdnBuf.h b/jni/edn/tools/EdnBuf/EdnBuf.h index 8d178d0..c1f8d5b 100644 --- a/jni/edn/tools/EdnBuf/EdnBuf.h +++ b/jni/edn/tools/EdnBuf/EdnBuf.h @@ -85,12 +85,14 @@ class EdnBuf { void GetAll( etk::VectorType &text); void SetAll( etk::VectorType &text); void GetRange( int32_t start, int32_t end, etk::VectorType &output); + void GetRange( int32_t start, int32_t end, etk::UString &output); bool DumpIn( FILE *myFile); bool DumpFrom( FILE *myFile); // replace with operator [] ... int8_t operator[] (int32_t); void Insert( int32_t pos, etk::VectorType &insertText); - void Replace( int32_t start, int32_t end, etk::VectorType &insertText); + void Insert( int32_t pos, etk::UString &insertText); + void Replace( int32_t start, int32_t end, etk::UString &insertText); void Remove( int32_t start, int32_t end); int32_t Indent( selectionType_te select); int32_t UnIndent( selectionType_te select); @@ -132,8 +134,10 @@ class EdnBuf { void RectSelect( selectionType_te select, int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd); bool GetSelectionPos( selectionType_te select, int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd); void GetSelectionText( selectionType_te select, etk::VectorType &text); + void GetSelectionText( selectionType_te select, etk::UString &text); void RemoveSelected( selectionType_te select); void ReplaceSelected( selectionType_te select, etk::VectorType &text); + void ReplaceSelected( selectionType_te select, etk::UString &text); private: // current selection of the buffer selection m_selectionList[SELECTION_SIZE]; //!< Selection area of the buffer diff --git a/jni/edn/tools/EdnBuf/EdnBuf_Selection.cpp b/jni/edn/tools/EdnBuf/EdnBuf_Selection.cpp index f4051ca..e583a42 100644 --- a/jni/edn/tools/EdnBuf/EdnBuf_Selection.cpp +++ b/jni/edn/tools/EdnBuf/EdnBuf_Selection.cpp @@ -158,6 +158,28 @@ void EdnBuf::GetSelectionText(selectionType_te select, etk::VectorType & GetRange(start, end, text); } } +void EdnBuf::GetSelectionText(selectionType_te select, etk::UString &text) +{ + int32_t start, end, rectStart, rectEnd; + bool isRect; + // remove output data + text = ""; + + bool isSelected = GetSelectionPos(select, start, end, isRect, rectStart, rectEnd); + + // No data selected ... + if (false == isSelected) { + return; + } + + // Rectangular selection + if (true == isRect) { + //GetTextInRect(start, end, rectStart, rectEnd, text); + // TODO : ... + } else { + GetRange(start, end, text); + } +} /** @@ -218,6 +240,26 @@ void EdnBuf::ReplaceSelected(selectionType_te select, etk::VectorType &t // Clean selection m_selectionList[select].selected = false; } +void EdnBuf::ReplaceSelected(selectionType_te select, etk::UString &text) +{ + int32_t start, end, rectStart, rectEnd; + bool isRect; + bool isSelected = GetSelectionPos(select, start, end, isRect, rectStart, rectEnd); + + // No data selected ... + if (false == isSelected) { + return; + } + // Rectangular selection + if (true == isRect) { + //ReplaceRect(start, end, rectStart, rectEnd, text); + // TODO : ... + } else { + Replace(start, end, text); + } + // Clean selection + m_selectionList[select].selected = false; +}