Revision: 33949
          http://brlcad.svn.sourceforge.net/brlcad/?rev=33949&view=rev
Author:   bob1961
Date:     2009-03-05 22:35:13 +0000 (Thu, 05 Mar 2009)

Log Message:
-----------
This fixes bug 2278235 (i.e. Can't cut-n-paste under Windows).

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/mged/text.tcl

Modified: brlcad/trunk/src/tclscripts/mged/text.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/mged/text.tcl   2009-03-05 22:12:24 UTC (rev 
33948)
+++ brlcad/trunk/src/tclscripts/mged/text.tcl   2009-03-05 22:35:13 UTC (rev 
33949)
@@ -24,6 +24,25 @@
 
 bind Text <Control-Key-slash> {}
 
+proc tk_textPaste {w} {
+    global tcl_platform
+    if {![catch {::tk::GetSelection $w CLIPBOARD} sel]} {
+       set oldSeparator [$w cget -autoseparators]
+       if {$oldSeparator} {
+           $w configure -autoseparators 0
+           $w edit separator
+       }
+       #if {[tk windowingsystem] ne "x11"} {
+       #    catch { $w delete sel.first sel.last }
+       #}
+       $w insert insert $sel
+       if {$oldSeparator} {
+           $w edit separator
+           $w configure -autoseparators 1
+       }
+    }
+}
+
 proc distribute_text { w cmd str } {
     global mged_players
     global mged_default
@@ -1888,8 +1907,16 @@
     return [list $newCommand $matches]
 }
 
+proc do_windows_copy {_w} {
+    catch {
+       clipboard clear -displayof $_w;
+       clipboard append -displayof $_w [selection get -displayof $_w]
+    }
+}
+
 proc set_text_key_bindings { id } {
     global mged_gui
+    global tcl_platform
 
     set w .$id.t
     switch $mged_gui($id,edit_style) {
@@ -2000,12 +2027,16 @@
        break
     }
 
-    bind $w <Control-c> "\
+    if {$tcl_platform(platform) == "windows"} {
+       bind $w <Control-c> "do_windows_copy $w; break"
+    } else {
+       bind $w <Control-c> "\
        interrupt_cmd %W;\
        if {\$mged_gui($id,edit_style) == \"vi\"} {\
            vi_insert_mode %W\
        };\
        break"
+    }
 
     bind $w <Control-e> {
        end_of_line %W


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to