| 1 | package TUI::Views::ScrollBar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Class defining a scroll bar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 43 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 43 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 43 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 43 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 43 | our $VERSION = '2.000002'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 43 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 43 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 43 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 43 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | TScrollBar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | new_TScrollBar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 43 | ▶ | use Encode qw( encode ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 43 | ▶ | use List::Util qw( min max ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 43 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 43 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | is_Object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | :types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 43 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 43 | ▶ | use TUI::Drivers::Const qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | :evXXXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | :kbXXXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 43 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 43 | ▶ | use TUI::Drivers::Util qw( ctrlToArrow ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 43 | ▶ | use TUI::Views::DrawBuffer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 43 | ▶ | use TUI::Objects::Point; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 43 | ▶ | use TUI::Objects::Rect; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 43 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | :cmXXXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | cpScrollBar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | :gfXXXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | :sbXXXX | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sfVisible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 43 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 43 | ▶ | use TUI::Views::Palette; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 43 | ▶ | use TUI::Views::View; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 43 | ▶ | use TUI::Views::Util qw( message ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | sub TScrollBar() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | sub name() { 'TScrollBar' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub new_TScrollBar { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_TScrollBar: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 43 | extends TView; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # declare global variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 43 | our $vChars = "\x1E\x1F\xB1\xFE\xB2"; # cp437: "▲▼░■▒" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 43 | our $hChars = "\x11\x10\xB1\xFE\xB2"; # cp437: "◄►░■▒" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # our $hChars = encode( cp437 => "◄►░■▒" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # our $vChars = encode( cp437 => "▲▼░■▒" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # public attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 43 | has value => ( is => 'rw', default => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 43 | has chars => ( is => 'rw', default => "\0" x 5 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 43 | has minVal => ( is => 'rw', default => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 43 | has maxVal => ( is => 'rw', default => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 43 | has pgStep => ( is => 'rw', default => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 43 | has arStep => ( is => 'rw', default => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # predeclare private methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 43 | $getPartCode, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ( $self->{size}{x} == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->{growMode} = gfGrowLoX | gfGrowHiX | gfGrowHiY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $self->{chars} = $vChars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $self->{growMode} = gfGrowLoY | gfGrowHiX | gfGrowHiY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $self->{chars} = $hChars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub draw { # void () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
draw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $self->drawPos( $self->getPos() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub getPalette { # $palette () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPalette: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | state $palette = TPalette->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | data => cpScrollBar, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | size => length( cpScrollBar ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return $palette->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 43 | my $mouse = TPoint->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 43 | my ( $p, $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 43 | my $extent = TRect->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub handleEvent { # void ($event) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handleEvent: not called CC=30 SCAR=68.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my ( $self, $event ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $Tracking; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my ( $i, $clickPart ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $self->SUPER::handleEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | SWITCH: for ( $event->{what} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | $_ == evMouseDown and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # Clicked() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | message( $self->owner, evBroadcast, cmScrollBarClicked, $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $mouse = $self->makeLocal( $event->{mouse}{where} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $extent = $self->getExtent(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $extent->grow( 1, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $p = $self->getPos(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $s = $self->getSize() - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $clickPart = $self->$getPartCode(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ( $clickPart != sbIndicator ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $mouse = $self->makeLocal( $event->{mouse}{where} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ( $self->$getPartCode() == $clickPart ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $self->setValue( $self->{value} + $self->scrollStep( $clickPart ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } while ( $self->mouseEvent( $event, evMouseAuto ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $mouse = $self->makeLocal( $event->{mouse}{where} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $Tracking = $extent->contains( $mouse ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ( $Tracking ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | $i = $self->{size}{x} == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ? $mouse->{y} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | : $mouse->{x}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $i = max( $i, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $i = min( $i, $s - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $i = $self->getPos(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if ( $i != $p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $self->drawPos( $i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $p = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } while ( $self->mouseEvent( $event, evMouseMove ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ( $Tracking && $s > 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Tracking and $s > 2
MC/DC0%0/2
$Tracking and $s > 2
$Tracking
$s > 2
Truth table0%0/3
A and B
A= $TrackingB= $s > 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $s -= 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | $self->setValue( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | int( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ( $p - 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | * ( $self->{maxVal} - $self->{minVal} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | + ( $s >> 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ) / $s + $self->{minVal} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } #/ else [ if ( $clickPart != sbIndicator)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $self->clearEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $_ == evKeyDown and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if ( $self->{state} & sfVisible ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $clickPart = sbIndicator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if ( $self->{size}{y} == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | SWITCH: for ( ctrlToArrow( $event->{keyDown}{keyCode} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | $_ == kbLeft and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $clickPart = sbLeftArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | $_ == kbRight and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $clickPart = sbRightArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $_ == kbCtrlLeft and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $clickPart = sbPageLeft; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | $_ == kbCtrlRight and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $clickPart = sbPageRight; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $_ == kbHome and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $i = $self->{minVal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $_ == kbEnd and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $i = $self->{maxVal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | DEFAULT: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | SWITCH: for ( ctrlToArrow( $event->{keyDown}{keyCode} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | $_ == kbUp and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $clickPart = sbUpArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $_ == kbDown and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $clickPart = sbDownArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $_ == kbPgUp and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $clickPart = sbPageUp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $_ == kbPgDn and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $clickPart = sbPageDown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $_ == kbCtrlPgUp and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $i = $self->{minVal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | $_ == kbCtrlPgDn and do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $i = $self->{maxVal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | DEFAULT: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # Clicked | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | message( $self->owner, evBroadcast, cmScrollBarClicked, $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | $i = $self->{value} + $self->scrollStep( $clickPart ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | if $clickPart != sbIndicator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $self->setValue( $i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $self->clearEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } #/ if ( ( $self->{state} ...)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | }; #/ do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } #/ SWITCH: for ( $event->{what} ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } #/ sub handleEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub scrollDraw { # void () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scrollDraw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | message( $self->owner, evBroadcast, cmScrollBarChanged, $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub scrollStep { # $steps ($part) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scrollStep: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | pos => [Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | my ( $self, $part ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | my $step = ( $part & 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | ? $self->{pgStep} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | : $self->{arStep}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | return ( $part & 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ? $step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | : -$step; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub setParams { # void ($aValue, $aMin, $aMax, $aPgStep, $aArStep) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setParams: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | pos => [Int, Int, Int, Int, Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my ( $self, $aValue, $aMin, $aMax, $aPgStep, $aArStep ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $aMax = max( $aMax, $aMin ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $aValue = max( $aValue, $aMin ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $aValue = min( $aValue, $aMax ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $sValue = $self->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ( $sValue != $aValue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$sValue != $aValue or $self->{"minVal"} != $aMin or $self->{"maxVal"} != $aMax
$sValue != $aValue or $self->{"minVal"} != $aMin
MC/DC0%0/3
$sValue != $aValue or $self->{"minVal"} != $aMin or $self->{"maxVal"} != $aMax
$sValue != $aValue
$self->{"minVal"} != $aMin
$self->{"maxVal"} != $aMax
Truth table0%0/4
A or B or C
A= $sValue != $aValueB= $self->{"minVal"} != $aMinC= $self->{"maxVal"} != $aMax
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | || $self->{minVal} != $aMin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | || $self->{maxVal} != $aMax | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $self->{value} = $aValue; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $self->{minVal} = $aMin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $self->{maxVal} = $aMax; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | $self->scrollDraw() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | if $sValue != $aValue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } #/ if ( $sValue != $aValue...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $self->{pgStep} = $aPgStep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $self->{arStep} = $aArStep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } #/ sub setParams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub setRange { # void ($aMin, $aMax) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setRange: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | pos => [Int, Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my ( $self, $aMin, $aMax ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | $self->setParams( $self->{value}, $aMin, $aMax, $self->{pgStep}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{arStep} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | sub setStep { # void ($aPgStep, $aArStep) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setStep: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | pos => [Int, Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my ( $self, $aPgStep, $aArStep ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $self->setParams( $self->{value}, $self->{minVal}, $self->{maxVal}, $aPgStep, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | $aArStep ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub setValue { # void ($aValue) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setValue: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | pos => [Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my ( $self, $aValue ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | $self->setParams( $aValue, $self->{minVal}, $self->{maxVal}, $self->{pgStep}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $self->{arStep} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | sub drawPos { # void ($pos) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drawPos: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | pos => [Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my ( $self, $pos ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $b = TDrawBuffer->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $s = $self->getSize() - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $b->moveChar( 0, substr($self->{chars}, 0, 1), $self->getColor( 2 ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if ( $self->{maxVal} == $self->{minVal} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $b->moveChar( 1, substr($self->{chars}, 4, 1), $self->getColor( 1 ), $s-1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $b->moveChar( 1, substr($self->{chars}, 2, 1), $self->getColor( 1 ), $s-1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $b->moveChar( $pos, substr($self->{chars}, 3, 1), $self->getColor( 3 ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $b->moveChar( $s, substr( $self->{chars}, 1, 1), $self->getColor( 2 ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $self->writeBuf( 0, 0, $self->{size}{x}, $self->{size}{y}, $b ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } #/ sub drawPos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | sub getPos { # $pos () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPos: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $r = $self->{maxVal} - $self->{minVal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | return 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | if $r == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | return int( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | ( $self->{value} - $self->{minVal} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | * ( $self->getSize() - 3 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | + ( $r >> 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | ) / $r + 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } #/ sub getPos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | sub getSize { # $size () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSize: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | return $self->{size}{x} == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | ? $self->{size}{y} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | : $self->{size}{x}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | $getPartCode = sub { # $int () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my $part = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if ( $extent->contains( $mouse ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | my $mark = $self->{size}{x} == 1 ? $mouse->{y} : $mouse->{x}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # Check for vertical or horizontal size of 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if ( ( $self->{size}{x} == 1 && $self->{size}{y} == 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$self->{"size"}{"x"} == 1 and $self->{"size"}{"y"} == 2 or $self->{"size"}{"x"} == 2 and $self->{"size"}{"y"} == 1
$self->{"size"}{"x"} == 1 and $self->{"size"}{"y"} == 2
$self->{"size"}{"x"} == 2 and $self->{"size"}{"y"} == 1
MC/DC0%0/4
$self->{"size"}{"x"} == 1 and $self->{"size"}{"y"} == 2 or $self->{"size"}{"x"} == 2 and $self->{"size"}{"y"} == 1
$self->{"size"}{"x"} == 1
$self->{"size"}{"y"} == 2
$self->{"size"}{"x"} == 2
$self->{"size"}{"y"} == 1
Truth table0%0/7
A and B or C and D
A= $self->{"size"}{"x"} == 1B= $self->{"size"}{"y"} == 2C= $self->{"size"}{"x"} == 2D= $self->{"size"}{"y"} == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | || ( $self->{size}{x} == 2 && $self->{size}{y} == 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # Set 'part' to left or right arrow only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | if ( $mark < 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $part = sbLeftArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | elsif ( $mark == $p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $part = sbRightArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | if ( $mark == $p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $part = sbIndicator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | if ( $mark < 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $part = sbLeftArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | elsif ( $mark < $p ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $part = sbPageLeft; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | elsif ( $mark < $s ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $part = sbPageRight; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $part = sbRightArrow; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | $part += 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | if $self->{size}{x} == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } #/ else [ if ( $mark == $self->{...})] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } #/ else [ if ( ( $self->{size}->...))] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } #/ if ( $extent->...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | return $part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 43 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 43 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||