From c8bad41b7f4f4c1e93195f2423813b9319cef99f Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Thu, 7 Sep 2017 18:13:54 +0300 Subject: [PATCH] [fbreader] Added ZLTextArea::selectionIsEmpty() and clearSelection() --- .../fbreader/zlibrary/text/src/area/ZLTextArea.cpp | 11 ++++++++++- fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp index 3497367..6349891 100644 --- a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp +++ b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus - * Copyright (C) 2016 Slava Monich + * Copyright (C) 2016-2017 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,6 +69,15 @@ void ZLTextArea::clear() { myTextElementMap.clear(); myTreeNodeMap.clear(); + clearSelection(); +} + +bool ZLTextArea::selectionIsEmpty() const +{ + return mySelectionModel.isNull() || mySelectionModel->isEmpty(); +} + +void ZLTextArea::clearSelection() const { if (!mySelectionModel.isNull()) { mySelectionModel->clear(); } diff --git a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h index dd21b08..60aca29 100644 --- a/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h +++ b/fbreader/fbreader/zlibrary/text/src/area/ZLTextArea.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2010 Geometer Plus - * Copyright (C) 2016 Slava Monich + * Copyright (C) 2016-2017 Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -89,6 +89,8 @@ public: int paragraphIndexByCoordinates(int x, int y, bool absolute = true) const; ZLTextSelectionModel &selectionModel(); + bool selectionIsEmpty() const; + void clearSelection() const; void paint(ZLSize *size = 0);