lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6580] Restrict multiline text-paste handler to input seq


From: gchicares
Subject: [lmi-commits] [6580] Restrict multiline text-paste handler to input seq entries (VZ)
Date: Wed, 11 May 2016 22:38:20 +0000 (UTC)

Revision: 6580
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6580
Author:   chicares
Date:     2016-05-11 22:38:20 +0000 (Wed, 11 May 2016)
Log Message:
-----------
Restrict multiline text-paste handler to input seq entries (VZ)

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/skeleton.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2016-05-11 20:03:37 UTC (rev 6579)
+++ lmi/trunk/ChangeLog 2016-05-11 22:38:20 UTC (rev 6580)
@@ -39052,3 +39052,38 @@
   illustrator.cpp
 Exempt some riders from group-quote consistency test.
 
+20160511T1648Z <address@hidden> [451]
+
+  wx_test_validate_output.cpp
+Fix a typographical error in a comment.
+
+20160511T1650Z <address@hidden> [451]
+
+  path_utility.hpp
+Define operator<<() for fs::path in the right namespace (VZ).
+
+20160511T1700Z <address@hidden> [451]
+
+  interest_rates.cpp
+Initialize variables explicitly to avoid warnings (VZ).
+
+20160511T1713Z <address@hidden> [451]
+
+  ihs_crc_comp.cpp
+Restore std::cout precision after changing it (VZ).
+
+20160511T2002Z <address@hidden> [451]
+
+  wx_test_validate_output.cpp
+Fix defect introduced 20160511T1648Z: extra space (reported by VZ).
+
+20160511T2003Z <address@hidden> [451]
+
+  icon_monger.cpp
+Avoid spurious warnings when loading standard wx icons (VZ).
+
+20160511T2238Z <address@hidden> [451]
+
+  skeleton.cpp
+Restrict multiline text-paste handler to input seq entries (VZ).
+

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2016-05-11 20:03:37 UTC (rev 6579)
+++ lmi/trunk/skeleton.cpp      2016-05-11 22:38:20 UTC (rev 6580)
@@ -911,12 +911,22 @@
 
 } // Unnamed namespace.
 
-/// Paste "\n"- or "\r\n"-delimited clipboard contents into a control,
-/// replacing nonterminal delimiters with semicolons to form an input
-/// sequence. The motivation is to permit pasting spreadsheet columns.
+/// Handle 'Text Paste' events for all windows.
 ///
-/// At least for now, this transformation is performed iff the paste
-/// target is a wxTextCtrl.
+/// The behavior depends upon the event-object type.
+///
+/// Type InputSequenceEntry: Paste "\n"-, "\r\n"-, or "\t"-delimited
+/// clipboard contents into the associated text control, replacing
+/// nonterminal delimiters with semicolons to form an input sequence,
+/// and removing any terminal delimiters. The motivation is to permit
+/// pasting spreadsheet columns.
+///
+/// Type wxTextCtrl: Paste literal clipboard contents. Text delimited
+/// with "\n" or "\r\n" is shown on distinct lines in a multiline text
+/// control with all delimiters removed; in single-line text controls,
+/// all delimiters are replaced by RETURN_SYMBOL.
+///
+/// All other types: ignore the paste event.
 
 void Skeleton::UponPaste(wxClipboardTextEvent& event)
 {
@@ -928,6 +938,11 @@
         return;
         }
 
+    if(!dynamic_cast<InputSequenceEntry*>(t->GetParent()))
+        {
+        return;
+        }
+
     std::string const s(ClipboardEx::GetText());
     if(s.empty())
         {
@@ -1092,26 +1107,27 @@
 
 void Skeleton::UponTestPasting(wxCommandEvent&)
 {
-    wxTextCtrl* t = new wxTextCtrl(frame_, wxID_ANY, "Testing...");
-    LMI_ASSERT(t);
+    InputSequenceEntry* z = new InputSequenceEntry(frame_, wxID_ANY, 
"Testing...");
+    LMI_ASSERT(z);
+    wxTextCtrl& t = z->text_ctrl();
 
     ClipboardEx::SetText("1\r\n2\r\n3\r\n");
-    t->SetSelection(-1L, -1L);
-    t->Paste();
-    if("1;2;3" != t->GetValue())
+    t.SetSelection(-1L, -1L);
+    t.Paste();
+    if("1;2;3" != t.GetValue())
         {
-        warning() << "'1;2;3' != '" << t->GetValue() << "'" << LMI_FLUSH;
+        warning() << "'1;2;3' != '" << t.GetValue() << "'" << LMI_FLUSH;
         }
 
     ClipboardEx::SetText("X\tY\tZ\t");
-    t->SetSelection(-1L, -1L);
-    t->Paste();
-    if("X;Y;Z" != t->GetValue())
+    t.SetSelection(-1L, -1L);
+    t.Paste();
+    if("X;Y;Z" != t.GetValue())
         {
-        warning() << "'X;Y;Z' != '" << t->GetValue() << "'" << LMI_FLUSH;
+        warning() << "'X;Y;Z' != '" << t.GetValue() << "'" << LMI_FLUSH;
         }
 
-    t->Destroy();
+    z->Destroy();
     status() << "Pasting test finished." << std::flush;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]