summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/auto/Tk/Scale/Increment.al
blob: 76432eeaf406906e6f776074d7e8ae4e931b5374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# NOTE: Derived from ..\blib\lib\Tk\Scale.pm.
# Changes made here will be lost when autosplit is run again.
# See AutoSplit.pm.
package Tk::Scale;

#line 203 "..\blib\lib\Tk\Scale.pm (autosplit into ..\blib\lib\auto\Tk\Scale\Increment.al)"
# Increment --
# This procedure is invoked to increment the value of a scale and
# to set up auto-repeating of the action if that is desired. The
# way the value is incremented depends on the "dir" and "big"
# arguments.
#
# Arguments:
# w - The scale widget.
# dir - "up" means move value towards -from, "down" means
# move towards -to.
# big - Size of increments: "big" or "little".
# repeat - Whether and how to auto-repeat the action: "noRepeat"
# means don't auto-repeat, "initial" means this is the
# first action in an auto-repeat sequence, and "again"
# means this is the second repetition or later.
sub Increment
{
 my $w = shift;
 my $dir = shift;
 my $big = shift;
 my $repeat = shift;
 my $inc;
 if ($big eq 'big')
  {
   $inc = $w->cget('-bigincrement');
   if ($inc == 0)
    {
     $inc = abs(($w->cget('-to')-$w->cget('-from')))/10.0
    }
   if ($inc < $w->cget('-resolution'))
    {
     $inc = $w->cget('-resolution')
    }
  }
 else
  {
   $inc = $w->cget('-resolution')
  }
 if (($w->cget('-from') > $w->cget('-to')) ^ ($dir eq 'up'))
  {
   $inc = -$inc
  }
 $w->set($w->get()+$inc);
 if ($repeat eq 'again')
  {
   $w->RepeatId($w->after($w->cget('-repeatinterval'),'Increment',$w,$dir,$big,'again'));
  }
 elsif ($repeat eq 'initial')
  {
   $w->RepeatId($w->after($w->cget('-repeatdelay'),'Increment',$w,$dir,$big,'again'));
  }
}

# end of Tk::Scale::Increment
1;