From 5f55e1cd63883c8d48a0e212e8910f6dfd536a50 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Thu, 7 Mar 2002 19:22:58 +0000 Subject: Back-ported cut & paste code from fltk2.0. This code splits the cut & paste into two buffers. The "SELECTION" is used for the currently highlighted text and for middle-mouse paste and (if possible) for handling drag & drop. The "CLIPBOARD" is for Ctrl+C and Ctrl+V style cut & paste. This matches how Motif, GTK, and KDE 3.0 work. But many older X applications (including KDE 2) can only see SELECTION, this results in cut & paste incompatability that is familiar to X users. However this now moves fltk over to the majority camp. On all systems this eliminates the annoying inability to select a region and replace it with Ctrl+V. On Mac and Win32 the SELECTION is local to the application, so middle-mouse paste only works between fields in the application. There may be tricks (special clipboard data types? use drag & drop?) to make it communicate, but unless there are standards it would be fltk-only. The file Fl_cutpaste.cxx has been deleted, so update the IDE files! The Win32 and Mac versions have NOT BEEN TESTED! I tried to be careful editing them but they may need some work. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1989 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Input.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Fl_Input.cxx') diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index e5a57f3ef..c1655f68c 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.15.2.6 2002/02/24 17:52:17 matthiaswm Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.15.2.7 2002/03/07 19:22:56 spitzak Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -150,7 +150,7 @@ int Fl_Input::handle_key() { case ctrl('B'): return shift_position(position()-1) + NORMAL_INPUT_MOVE; case ctrl('C'): // copy - return copy(); + return copy(1); case ctrl('D'): case ctrl('?'): if (mark() != position()) return cut(); @@ -191,11 +191,11 @@ int Fl_Input::handle_key() { return cut(0, size()); case ctrl('V'): case ctrl('Y'): - Fl::paste(*this); + Fl::paste(*this, 1); return 1; case ctrl('X'): case ctrl('W'): - copy(); + copy(1); return cut(); case ctrl('Z'): case ctrl('_'): @@ -284,7 +284,7 @@ int Fl_Input::handle(int event) { dnd_save_position = position(); dnd_save_mark = mark(); // drag the data: - copy(); Fl::dnd(); + copy(0); Fl::dnd(); return 1; } #endif @@ -293,10 +293,10 @@ int Fl_Input::handle(int event) { case FL_RELEASE: if (Fl::event_button() == 2) { Fl::event_is_click(0); // stop double click from picking a word - Fl::paste(*this); + Fl::paste(*this, 0); } else if (!Fl::event_is_click()) { // copy drag-selected text to the clipboard. - copy(); + copy(0); } return 1; @@ -354,5 +354,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.6 2002/02/24 17:52:17 matthiaswm Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.7 2002/03/07 19:22:56 spitzak Exp $". // -- cgit v1.2.3