Changeset 35


Ignore:
Timestamp:
Aug 10, 2005 9:42:18 PM (19 years ago)
Author:
mmc
Message:

Fixed "Copy/Paste? with Desktop" so it is ignored under Windows.
This was causing the program to die immediately upon startup
in Microsoft desktops. Also, fixed the initialization of the
cutbuffer, so "Copy/Paste? with Desktop" works right away, even
if you initiate from the desktop and pull into the application.

Fixed the <<Paste>> bindings for entry/text widgets so that
paste will overwrite any selected text.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/mainwin.tcl

    r17 r35  
    2222    -*-helvetica-bold-o-normal-*-*-140-* widgetDefault
    2323
     24#
     25# Tk text widget doesn't honor Ctrl-V by default.  Get rid
     26# of the default binding so that Ctrl-V works for <<Paste>>
     27# as expected.
     28#
     29bind Text <Control-KeyPress-v> {}
     30
     31#
     32# Fix the built-in <<Paste>> bindings to work properly even
     33# for the X11 windowing system.  By default, Tk won't replace
     34# selected text in X11.  What kind of stupid nonsense is that?
     35#
     36bind Entry <<Paste>> {
     37    catch {
     38        # always replace existing selection
     39        catch { %W delete sel.first sel.last }
     40
     41        %W insert insert [::tk::GetSelection %W CLIPBOARD]
     42        tk::EntrySeeInsert %W
     43    }
     44}
     45proc ::tk_textPaste w {
     46    global tcl_platform
     47    if {![catch {::tk::GetSelection $w CLIPBOARD} sel]} {
     48        if {[catch {$w cget -autoseparators} oldSeparator]} {
     49            # in case we're using an older version of Tk
     50            set oldSeparator 0
     51        }
     52        if { $oldSeparator } {
     53            $w configure -autoseparators 0
     54            $w edit separator
     55        }
     56
     57        # always replace existing selection
     58        catch { $w delete sel.first sel.last }
     59        $w insert insert $sel
     60
     61        if { $oldSeparator } {
     62            $w edit separator
     63            $w configure -autoseparators 1
     64        }
     65    }
     66}
     67
     68# ======================================================================
    2469itcl::class Rappture::MainWin {
    2570    inherit itk::Toplevel
     
    102147    set _sync(cutbuffer) ""
    103148    set _sync(selection) ""
    104     syncCutBuffer ifneeded
     149
     150    global tcl_platform
     151    if {$tcl_platform(platform) == "unix"} {
     152        # this sync stuff only works for X windows
     153        blt::cutbuffer set ""
     154        syncCutBuffer ifneeded
     155    }
    105156}
    106157
  • trunk/gui/scripts/textentry.tcl

    r22 r35  
    2222    -*-helvetica-medium-r-normal-*-*-100-* widgetDefault
    2323
    24 #
    25 # Tk text widget doesn't honor Ctrl-V by default.  Get rid
    26 # of the default binding so that Ctrl-V works for <<Paste>>
    27 # as expected.
    28 #
    29 bind Text <Control-KeyPress-v> {}
    3024
    3125itcl::class Rappture::TextEntry {
Note: See TracChangeset for help on using the changeset viewer.