source: trunk/gui/scripts/diffview.tcl @ 3177

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File size: 3.6 KB
Line 
1# ----------------------------------------------------------------------
2#  WIDGET: diffview - view differences between two strings
3#
4#  These are the class bindings for the Diffview widget.  The widget
5#  itself is implemented in C code, but this file customizes the
6#  behavior of the widget by adding default bindings.  It is loaded
7#  when the widget initializes itself.
8# ======================================================================
9#  AUTHOR:  Michael McLennan, Purdue University
10#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
11#
12#  See the file "license.terms" for information on usage and
13#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14# ======================================================================
15namespace eval Rappture { # forward declaration }
16
17# ----------------------------------------------------------------------
18# Code for "usual" itk options
19# ----------------------------------------------------------------------
20if {[catch {package require Itk}] == 0} {
21    itk::usual Diffview {
22        keep -background -foreground -cursor
23        keep -addedbackground -addedforeground
24        keep -deletedbackground -deletedforeground -overstrike
25        keep -changedbackground -changedforeground
26        keep -highlightcolor -highlightthickness
27        rename -highlightbackground -background background Background
28    }
29}
30
31
32# ----------------------------------------------------------------------
33# Key navigation
34# ----------------------------------------------------------------------
35bind Diffview <Key-Up> {
36    %W yview scroll -1 units
37}
38bind Diffview <Control-Key-Up> {
39    %W yview scroll -1 pages
40}
41bind Diffview <Key-Prior> {
42    %W yview scroll -1 pages
43}
44
45bind Diffview <Key-Down> {
46    %W yview scroll 1 units
47}
48bind Diffview <Control-Key-Down> {
49    %W yview scroll 1 pages
50}
51bind Diffview <Key-Next> {
52    %W yview scroll 1 pages
53}
54
55bind Diffview <Key-Left> {
56    %W xview scroll -1 units
57}
58bind Diffview <Control-Key-Left> {
59    %W xview scroll -1 pages
60}
61
62bind Diffview <Key-Right> {
63    %W xview scroll 1 units
64}
65bind Diffview <Control-Key-Right> {
66    %W xview scroll 1 pages
67}
68
69# ----------------------------------------------------------------------
70# Click/drag for fast scanning
71# ----------------------------------------------------------------------
72bind Diffview <ButtonPress-2> {
73    %W scan mark %x %y
74}
75bind Diffview <B2-Motion> {
76    %W scan dragto %x %y
77}
78
79# ----------------------------------------------------------------------
80# MouseWheel bindings
81# ----------------------------------------------------------------------
82switch -- [tk windowingsystem] {
83    classic - aqua {
84        bind Diffview <MouseWheel> {
85            %W yview scroll [expr {-(%D)}] units
86        }
87        bind Diffview <Option-MouseWheel> {
88            %W yview scroll [expr {-10*(%D)}] units
89        }
90        bind Diffview <Shift-MouseWheel> {
91            %W xview scroll [expr {-(%D)}] units
92        }
93        bind Diffview <Shift-Option-MouseWheel> {
94            %W xview scroll [expr {-10*(%D)}] units
95        }
96    }
97    x11 {
98        # support for mousewheels on Linux comes from buttons 4/5
99        bind Diffview <4> {
100            if {!$tk_strictMotif} {
101                %W yview scroll -5 units
102            }
103        }
104        bind Diffview <5> {
105            if {!$tk_strictMotif} {
106                %W yview scroll 5 units
107            }
108        }
109
110        # in case anyone generates a <MouseWheel> event
111        bind Diffview <MouseWheel> {
112            %W yview scroll [expr {-(%D/120)*4}] units
113        }
114    }
115    default {
116        bind Diffview <MouseWheel> {
117            %W yview scroll [expr {-(%D/120)*4}] units
118        }
119    }
120}
Note: See TracBrowser for help on using the repository browser.