diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/layout.hh | 5 | ||||
-rw-r--r-- | dw/selection.cc | 6 | ||||
-rw-r--r-- | dw/selection.hh | 23 |
3 files changed, 29 insertions, 5 deletions
diff --git a/dw/layout.hh b/dw/layout.hh index 36f433b5..1794179c 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -438,6 +438,11 @@ public: platform->copySelection(text, destination); } + inline void copyCurrentSelection(int destination) + { + selectionState.copy(destination); + } + inline ui::ResourceFactory *getResourceFactory () { return platform->getResourceFactory (); diff --git a/dw/selection.cc b/dw/selection.cc index 899fad69..78cd23ce 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -198,7 +198,7 @@ bool SelectionState::buttonRelease (Iterator *it, int charPos, int linkNo, // nothing selected resetSelection (); else { - copy (); + copy (0); selectionState = SELECTED; } } @@ -423,7 +423,7 @@ void SelectionState::highlight0 (bool fl, DeepIterator *from, int fromChar, } } -void SelectionState::copy() +void SelectionState::copy(int selection) { if (from && to) { Iterator *si; @@ -495,7 +495,7 @@ void SelectionState::copy() delete i; } - layout->copySelection(strbuf.getChars(), 0); + layout->copySelection(strbuf.getChars(), selection); } } diff --git a/dw/selection.hh b/dw/selection.hh index d9d5af72..11ac96e6 100644 --- a/dw/selection.hh +++ b/dw/selection.hh @@ -1,3 +1,23 @@ +/* + * Dillo Widget + * + * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org> + * Copyright 2025 Rodrigo Arias Mallo <rodarima@gmail.com> + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #ifndef __DW_SELECTION_H__ #define __DW_SELECTION_H__ @@ -214,8 +234,6 @@ private: void highlight0 (bool fl, DeepIterator *from, int fromChar, DeepIterator *to, int toChar, int dir); - void copy (); - public: enum EventType { BUTTON_PRESS, BUTTON_RELEASE, BUTTON_MOTION }; @@ -224,6 +242,7 @@ public: inline void setLayout (Layout *layout) { this->layout = layout; } void reset (); + void copy (int selection); bool buttonPress (Iterator *it, int charPos, int linkNo, EventButton *event); bool buttonRelease (Iterator *it, int charPos, int linkNo, |