#include <dali-toolkit/internal/text/controller/text-controller-event-handler.h>
// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
#include <dali/devel-api/adaptor-framework/key-devel.h>
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <dali-toolkit/internal/text/controller/text-controller-impl.h>
#include <dali-toolkit/internal/text/controller/text-controller-placeholder-handler.h>
#include <dali-toolkit/internal/text/controller/text-controller-text-updater.h>
+#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
namespace
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
#endif
-const std::string KEY_C_NAME = "c";
-const std::string KEY_V_NAME = "v";
-const std::string KEY_X_NAME = "x";
-const std::string KEY_A_NAME = "a";
-const std::string KEY_INSERT_NAME = "Insert";
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false);
+
+const char* KEY_C_NAME = "c";
+const char* KEY_V_NAME = "v";
+const char* KEY_X_NAME = "x";
+const char* KEY_A_NAME = "a";
+const char* KEY_INSERT_NAME = "Insert";
} // namespace
return false;
}
+ if(controller.mImpl->mEventData->mState == EventData::INACTIVE)
+ {
+ // Cursor position will be updated
+ controller.mImpl->ChangeState(EventData::EDITING);
+ }
+
controller.mImpl->mEventData->mCheckScrollAmount = true;
Event event(Event::CURSOR_KEY_EVENT);
event.p1.mInt = keyCode;
bool consumed = false;
if(keyName == KEY_C_NAME || keyName == KEY_INSERT_NAME || logicalKey == KEY_C_NAME || logicalKey == KEY_INSERT_NAME)
{
- // Ctrl-C or Ctrl+Insert to copy the selected text
- controller.TextPopupButtonTouched(Toolkit::TextSelectionPopup::COPY);
+ if(!keyEvent.IsRepeat())
+ {
+ // Ctrl-C or Ctrl+Insert to copy the selected text
+ controller.TextPopupButtonTouched(Toolkit::TextSelectionPopup::COPY);
+ }
consumed = true;
}
else if(keyName == KEY_V_NAME || logicalKey == KEY_V_NAME)
return;
}
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_MODIFY_EVENTS");
+
for(Vector<ModifyEvent>::ConstIterator it = events.Begin(),
endIt = events.End();
it != endIt;
case InputMethodContext::SELECTION_SET:
{
uint32_t start = static_cast<uint32_t>(inputMethodContextEvent.startIndex);
- uint32_t end = static_cast<uint32_t>(inputMethodContextEvent.endIndex);
+ uint32_t end = static_cast<uint32_t>(inputMethodContextEvent.endIndex);
if(start == end)
{
controller.SetPrimaryCursorPosition(start, true);
std::string text;
CharacterIndex cursorPosition = 0u;
- Length numberOfWhiteSpaces = 0u;
if(retrieveCursor)
{
- numberOfWhiteSpaces = controller.mImpl->GetNumberOfWhiteSpaces(0u);
-
cursorPosition = controller.mImpl->GetLogicalCursorPosition();
-
- if(cursorPosition < numberOfWhiteSpaces)
- {
- cursorPosition = 0u;
- }
- else
- {
- cursorPosition -= numberOfWhiteSpaces;
- }
}
if(retrieveText)
if(!controller.mImpl->IsShowingPlaceholderText())
{
// Retrieves the normal text string.
- controller.mImpl->GetText(numberOfWhiteSpaces, text);
+ controller.mImpl->GetText(0u, text);
}
else
{
return callbackData;
}
-void Controller::EventHandler::PasteClipboardItemEvent(Controller& controller)
+void Controller::EventHandler::PasteClipboardItemEvent(Controller& controller, const std::string& text)
{
- // Retrieve the clipboard contents first
- ClipboardEventNotifier notifier(ClipboardEventNotifier::Get());
- std::string stringToPaste(notifier.GetContent());
-
// Commit the current pre-edit text; the contents of the clipboard should be appended
controller.mImpl->ResetInputMethodContext();
controller.mImpl->SetClipboardHideEnable(false);
// Paste
- TextUpdater::PasteText(controller, stringToPaste);
+ TextUpdater::PasteText(controller, text);
controller.mImpl->SetClipboardHideEnable(true);
}