Skip to content

Commit a300063

Browse files
author
csaba
committed
* Added scrollutil to tklib.
1 parent a94afe5 commit a300063

File tree

8 files changed

+280
-0
lines changed

8 files changed

+280
-0
lines changed

modules/scrollutil/CHANGES.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
What is new in Scrollutil 1.1?
2+
------------------------------
3+
4+
1. Added the scrollsync widget, designed for scrolling several widgets
5+
simultaneously (thanks to Paul Obermeier for his proposal and
6+
testing).
7+
8+
2. Added two demo scripts for the new scrollsync widget.
9+
10+
3. The scrollarea widget now supports the "-takefocus" standard option
11+
(thanks to Harald Oehlmann for his proposal).
12+
13+
4. The scrollarea "setwidget" subcommand now returns the path name of
14+
the previously embedded widget.
15+
16+
5. The mouse wheel event handling now restricts the search for the
17+
registered scrollable widget container that is an ascendant of the
18+
widget under the pointer to the widget containers within the same
19+
toplevel (thanks to Harald Oehlmann for his valuable feedback).
20+
21+
6. Several further improvements in the code, demo scripts, and
22+
documentation.
23+
24+
What was new in Scrollutil 1.0?
25+
-------------------------------
26+
27+
This is the first release. Thanks to Michael Niehren for discussions on
28+
mouse wheel event handling in scrollable widget containers, as well as
29+
to Paul Obermeier and Thomas Grausgruber for testing the scrollarea
30+
widget.

modules/scrollutil/COPYRIGHT.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Scrolling utilities package Scrollutil 1.1
2+
Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
3+
4+
This library is free software; you can use, modify, and redistribute it
5+
for any purpose, provided that existing copyright notices are retained
6+
in all copies and that this notice is included verbatim in any
7+
distributions.
8+
9+
This software is distributed WITHOUT ANY WARRANTY; without even the
10+
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

modules/scrollutil/ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2019-08-29 Csaba Nemethi <csaba.nemethi@t-online.de>
2+
3+
* Added scrollutil to tklib.

modules/scrollutil/README.txt

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
The Scrolling Utilities Package Scrollutil
2+
3+
by
4+
5+
Csaba Nemethi
6+
7+
csaba.nemethi@t-online.de
8+
9+
10+
What Is Scrollutil?
11+
-------------------
12+
13+
Scrollutil is a library package for Tcl/Tk versions 8.0 or higher,
14+
written in pure Tcl/Tk code. It contains:
15+
16+
- the implementation of the "scrollarea" and "scrollsync" mega-
17+
widgets, including a general utility module for mega-widgets;
18+
- commands for user-friendly mouse wheel event handling in scrollable
19+
widget containers like BWidget ScrollableFrame and
20+
iwidgets::scrolledframe. These commands require Tcl/Tk versions 8.4
21+
or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows;
22+
- demo scripts illustrating the use of the Scrollutil package in
23+
connection with various scrollable widgets and the above-mentioned
24+
scrollable widget containers;
25+
- a tutorial in HTML format;
26+
- reference pages in HTML format.
27+
28+
The reason for requiring at least Tk version 8.6b2 on Windows for the
29+
above-mentioned commands for mouse wheel event handling is that in
30+
earlier Tk versions on this platform the mouse wheel events were sent to
31+
the widget having the focus rather than to the one under the pointer.
32+
33+
How to Get It?
34+
--------------
35+
36+
Scrollutil is available for free download from the Web page
37+
38+
http://www.nemethi.de
39+
40+
The distribution file is "scrollutil1.1.tar.gz" for UNIX and
41+
"scrollutil1_1.zip" for Windows. These files contain the same
42+
information, except for the additional carriage return character
43+
preceding the linefeed at the end of each line in the text files for
44+
Windows.
45+
46+
Scrollutil is also included in tklib, which has the address
47+
48+
http://core.tcl.tk/tklib
49+
50+
How to Install It?
51+
------------------
52+
53+
Install the package as a subdirectory of one of the directories given
54+
by the "auto_path" variable. For example, you can install it as a
55+
directory at the same level as the Tcl and Tk script libraries. The
56+
locations of these library directories are given by the "tcl_library"
57+
and "tk_library" variables, respectively.
58+
59+
To install Scrollutil on UNIX, "cd" to the desired directory and unpack
60+
the distribution file "scrollutil1.1.tar.gz":
61+
62+
gunzip -c scrollutil1.1.tar.gz | tar -xf -
63+
64+
On most UNIX systems this can be replaced with
65+
66+
tar -zxf scrollutil1.1.tar.gz
67+
68+
Both commands will create a directory named "scrollutil1.1", with the
69+
subdirectories "demos", "doc", and "scripts".
70+
71+
On Windows, use WinZip or some other program capable of unpacking the
72+
distribution file "scrollutil1_1.zip" into the directory
73+
"scrollutil1.1", with the subdirectories "demos", "doc", and "scripts".
74+
75+
How to Use It?
76+
--------------
77+
78+
The Scrollutil distribution provides two packages, called Scrollutil and
79+
Scrollutil_tile. The main difference between the two is that
80+
Scrollutil_tile enables the tile-based, theme-specific appearance of
81+
scrollarea widgets; this package requires Tcl/Tk 8.4 or higher and tile
82+
0.6 or higher. It is not possible to use both packages in one and the
83+
same application, because both are implemented in the same "scrollutil"
84+
namespace and provide identical commands.
85+
86+
To be able to use the commands and variables implemented in the package
87+
Scrollutil, your scripts must contain one of the lines
88+
89+
package require scrollutil ?version?
90+
package require Scrollutil ?version?
91+
92+
Likewise, to be able to use the commands and variables implemented in
93+
the package Scrollutil_tile, your scripts must contain one of the lines
94+
95+
package require scrollutil_tile ?version?
96+
package require Scrollutil_tile ?version?
97+
98+
Since the packages Scrollutil and Scrollutil_tile are implemented in the
99+
"scrollutil" namespace, you must either import the procedures you need,
100+
or use qualified names like "scrollutil::scrollarea".
101+
102+
For a detailed description of the commands and variables provided by
103+
Scrollutil and of the examples contained in the "demos" directory, see
104+
the tutorial "scrollutil.html" and the reference pages, all located in
105+
the "doc" directory.

modules/scrollutil/pkgIndex.tcl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#==============================================================================
2+
# Scrollutil and Scrollutil_tile package index file.
3+
#
4+
# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
#==============================================================================
6+
7+
#
8+
# Regular packages:
9+
#
10+
package ifneeded scrollutil 1.1 \
11+
[list source [file join $dir scrollutil.tcl]]
12+
package ifneeded scrollutil_tile 1.1 \
13+
[list source [file join $dir scrollutil_tile.tcl]]
14+
15+
#
16+
# Aliases:
17+
#
18+
package ifneeded Scrollutil 1.1 \
19+
[list package require -exact scrollutil 1.1]
20+
package ifneeded Scrollutil_tile 1.1 \
21+
[list package require -exact scrollutil_tile 1.1]
22+
23+
#
24+
# Code common to all packages:
25+
#
26+
package ifneeded scrollutil::common 1.1 \
27+
[list source [file join $dir scrollutilCommon.tcl]]

modules/scrollutil/scrollutil.tcl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#==============================================================================
2+
# Main Scrollutil package module.
3+
#
4+
# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
#==============================================================================
6+
7+
package require -exact scrollutil::common 1.1
8+
9+
package provide scrollutil $::scrollutil::version
10+
package provide Scrollutil $::scrollutil::version
11+
12+
::scrollutil::useTile 0
13+
::scrollutil::sa::createBindings
14+
::scrollutil::ss::createBindings
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#==============================================================================
2+
# Main Scrollutil and Scrollutil_tile package module.
3+
#
4+
# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
#==============================================================================
6+
7+
package require Tk 8
8+
9+
namespace eval ::scrollutil {
10+
#
11+
# Public variables:
12+
#
13+
variable version 1.1
14+
variable library
15+
if {$::tcl_version >= 8.4} {
16+
set library [file dirname [file normalize [info script]]]
17+
} else {
18+
set library [file dirname [info script]] ;# no "file normalize" yet
19+
}
20+
21+
#
22+
# Creates a new scrollarea/scrollsync widget:
23+
#
24+
namespace export scrollarea scrollsync
25+
26+
#
27+
# Public procedures for mouse wheel event
28+
# handling in scrollable widget containers:
29+
#
30+
namespace export createWheelEventBindings enableScrollingByWheel \
31+
adaptWheelEventHandling setFocusCheckWindow \
32+
focusCheckWindow
33+
}
34+
35+
package provide scrollutil::common $::scrollutil::version
36+
37+
#
38+
# The following procedure, invoked in "scrollutil.tcl" and
39+
# "scrollutil_tile.tcl", sets the variable ::scrollutil::usingTile to the given
40+
# value and sets a trace on this variable.
41+
#
42+
proc ::scrollutil::useTile {bool} {
43+
variable usingTile $bool
44+
trace variable usingTile wu [list ::scrollutil::restoreUsingTile $bool]
45+
}
46+
47+
#
48+
# The following trace procedure is executed whenever the variable
49+
# ::scrollutil::usingTile is written or unset. It restores the variable to its
50+
# original value, given by the first argument.
51+
#
52+
proc ::scrollutil::restoreUsingTile {origVal varName index op} {
53+
variable usingTile $origVal
54+
switch $op {
55+
w {
56+
return -code error "it is not allowed to use both Scrollutil and\
57+
Scrollutil_tile in the same application"
58+
}
59+
u {
60+
trace variable usingTile wu \
61+
[list ::scrollutil::restoreUsingTile $origVal]
62+
}
63+
}
64+
}
65+
66+
interp alias {} ::tk::frame {} ::frame
67+
interp alias {} ::tk::scrollbar {} ::scrollbar
68+
69+
#
70+
# Everything else needed is lazily loaded on demand, via the dispatcher
71+
# set up in the subdirectory "scripts" (see the file "tclIndex").
72+
#
73+
lappend auto_path [file join $::scrollutil::library scripts]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#==============================================================================
2+
# Main Scrollutil_tile package module.
3+
#
4+
# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de)
5+
#==============================================================================
6+
7+
package require Tk 8.4
8+
if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} {
9+
package require tile 0.6
10+
}
11+
package require -exact scrollutil::common 1.1
12+
13+
package provide scrollutil_tile $::scrollutil::version
14+
package provide Scrollutil_tile $::scrollutil::version
15+
16+
::scrollutil::useTile 1
17+
::scrollutil::sa::createBindings
18+
::scrollutil::ss::createBindings

0 commit comments

Comments
 (0)