| 1 | package TUI::Views::Scroller; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Base class for scrollable views | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 25 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 25 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 25 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 25 | our $VERSION = '2.000003'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 25 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 25 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 25 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 25 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | TScroller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | new_TScroller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 25 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 25 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 25 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | Maybe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | :is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | :types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 25 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 25 | ▶ | use TUI::Drivers::Const qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | evBroadcast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 25 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 25 | ▶ | use TUI::Objects::Point; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 25 | ▶ | use TUI::Objects::Rect; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 25 | ▶ | use TUI::Objects::Stream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 25 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | cmScrollBarChanged | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | cpScroller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ofSelectable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | sfActive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sfDragging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | sfSelected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 25 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 25 | ▶ | use TUI::Views::Palette; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 25 | ▶ | use TUI::Views::View; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | sub TScroller() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | sub name() { 'TScroller' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub new_TScroller { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_TScroller: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 25 | extends TView; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # public attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | has delta => ( is => 'rw', default => sub { TPoint->new } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # protected attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 25 | has drawLock => ( is => 'ro', default => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 25 | has drawFlag => ( is => 'ro', default => false ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | has hScrollBar => ( is => 'ro', default => sub { die 'required' } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | has vScrollBar => ( is => 'ro', default => sub { die 'required' } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | has limit => ( is => 'ro', default => sub { TPoint->new } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # predeclare private methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 25 | $showSBar, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | named => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | bounds => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | hScrollBar => Maybe[Object], { alias => 'aHScrollBar' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | vScrollBar => Maybe[Object], { alias => 'aVScrollBar' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | caller_level => +1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my ( $class, $args ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | return { %$args }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $self->{delta}{x} = $self->{delta}{y} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->{limit}{x} = $self->{limit}{y} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $self->{options} |= ofSelectable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->{eventMask} |= evBroadcast; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub from { # $obj ($bounds, $aHScrollBar|undef, $aVScrollBar|undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | pos => [Object, Maybe[Object], Maybe[Object]], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my ( $class, @args ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return $class->new( bounds => $args[0], hScrollBar => $args[1], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | vScrollBar => $args[2] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub changeBounds { # void ($bounds) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changeBounds: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my ( $self, $bounds ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $self->setBounds( $bounds ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $self->{drawLock}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $self->setLimit( $self->{limit}{x}, $self->{limit}{y} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $self->{drawLock}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $self->{drawFlag} = false; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub getPalette { # $palette () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPalette: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | state $palette = TPalette->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | data => cpScroller, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | size => length( cpScroller ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return $palette->clone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub handleEvent { # void ($event) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handleEvent: not called CC=5 SCAR=30.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 25 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my ( $self, $event ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $self->SUPER::handleEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ( $event->{what} == evBroadcast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$event->{"what"} == 512 and $event->{"message"}{"command"} == 53 and $event->{"message"}{"infoPtr"} == $self->{"hScrollBar"} || $event->{"message"}{"infoPtr"} == $self->{"vScrollBar"}
$event->{"what"} == 512 and $event->{"message"}{"command"} == 53
$event->{"message"}{"infoPtr"} == $self->{"hScrollBar"} or $event->{"message"}{"infoPtr"} == $self->{"vScrollBar"}
MC/DC0%0/4
$event->{"what"} == 512 and $event->{"message"}{"command"} == 53 and $event->{"message"}{"infoPtr"} == $self->{"hScrollBar"} || $event->{"message"}{"infoPtr"} == $self->{"vScrollBar"}
$event->{"what"} == 512
$event->{"message"}{"command"} == 53
$event->{"message"}{"infoPtr"} == $self->{"hScrollBar"}
$event->{"message"}{"infoPtr"} == $self->{"vScrollBar"}
Truth table0%0/5
A and B and C or D
A= $event->{"what"} == 512B= $event->{"message"}{"command"} == 53C= $event->{"message"}{"infoPtr"} == $self->{"hScrollBar"}D= $event->{"message"}{"infoPtr"} == $self->{"vScrollBar"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | && $event->{message}{command} == cmScrollBarChanged | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | && ( $event->{message}{infoPtr} == $self->{hScrollBar} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | || $event->{message}{infoPtr} == $self->{vScrollBar} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | $self->scrollDraw(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } #/ sub handleEvent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub scrollDraw { # void () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scrollDraw: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $d = TPoint->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if ( $self->{hScrollBar} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $d->{x} = $self->{hScrollBar}{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $d->{x} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ( $self->{vScrollBar} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $d->{y} = $self->{vScrollBar}{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $d->{y} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ( $d->{x} != $self->{delta}{x} || $d->{y} != $self->{delta}{y} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$d->{"x"} != $self->{"delta"}{"x"} or $d->{"y"} != $self->{"delta"}{"y"}
MC/DC0%0/2
$d->{"x"} != $self->{"delta"}{"x"} or $d->{"y"} != $self->{"delta"}{"y"}
$d->{"x"} != $self->{"delta"}{"x"}
$d->{"y"} != $self->{"delta"}{"y"}
Truth table0%0/3
A or B
A= $d->{"x"} != $self->{"delta"}{"x"}B= $d->{"y"} != $self->{"delta"}{"y"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $self->setCursor( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | $self->{cursor}{x} + $self->{delta}{x} - $d->{x}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | $self->{cursor}{y} + $self->{delta}{y} - $d->{y} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->{delta} = $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ( $self->{drawLock} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $self->{drawFlag} = true; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } #/ if ( $d->{x} != $self->...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | sub scrollTo { # void ($x, $y) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scrollTo: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | pos => [Int, Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my ( $self, $x, $y ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->{drawLock}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $self->{hScrollBar}->setValue( $x ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if $self->{hScrollBar}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | $self->{vScrollBar}->setValue( $y ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if $self->{vScrollBar}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->{drawLock}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $self->checkDraw(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | sub setLimit { # void ($x, $y) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setLimit: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | pos => [Int, Int], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my ( $self, $x, $y ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $self->{limit}{x} = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $self->{limit}{y} = $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $self->{drawLock}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | $self->{hScrollBar}->setParams( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | $self->{hScrollBar}{value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | $x - $self->{size}{x}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | $self->{size}{x} - 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | $self->{hScrollBar}{arStep} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | ) if $self->{hScrollBar}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | $self->{vScrollBar}->setParams( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $self->{vScrollBar}{value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | $y - $self->{size}{y}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | $self->{size}{y} - 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | $self->{vScrollBar}{arStep} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | ) if $self->{vScrollBar}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->{drawLock}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $self->checkDraw(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub setState { # void ($aState, $enable) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setState: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | pos => [PositiveOrZeroInt, Bool], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my ( $self, $aState, $enable ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $self->SUPER::setState( $aState, $enable ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $self->drawView() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | if $aState & ( sfActive | sfDragging ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } #/ sub setState | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub checkDraw { # void () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkDraw: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | if ( $self->{drawLock} == 0 && $self->{drawFlag} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"drawLock"} == 0 and $self->{"drawFlag"}
MC/DC0%0/2
$self->{"drawLock"} == 0 and $self->{"drawFlag"}
$self->{"drawLock"} == 0
$self->{"drawFlag"}
Truth table0%0/3
A and B
A= $self->{"drawLock"} == 0B= $self->{"drawFlag"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $self->{drawFlag} = false; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } #/ sub checkDraw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | sub shutDown { # void () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shutDown: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $self->{hScrollBar} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $self->{vScrollBar} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $self->SUPER::shutDown(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | $showSBar = sub { # void ($sBar|undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my ( $self, $sBar ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | assert ( !defined $sBar or is_Object $sBar ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $sBar or &is_Object($sBar)
MC/DC0%0/2
not defined $sBar or &is_Object($sBar)
not defined $sBar
&is_Object($sBar)
Truth table0%0/3
not(A) or B
A= not defined $sBarB= &is_Object($sBar)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if ( $sBar ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | ( $self->getState( sfActive | sfSelected ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ? $sBar->show() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | : $sBar->hide(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 25 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub read :method { # $self ($is) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | my ( $self, $is ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->SUPER::read( $is ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $self->{hScrollBar} = $is->get(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $self->{vScrollBar} = $is->get(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $self->{delta} = $is->get(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $self->{limit} = $is->get(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | $self->{drawLock} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $self->{drawFlag} = false; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub write :method { # void ($os) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my ( $self, $os ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | $self->SUPER::write( $os ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | $os->put( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | $self->{hScrollBar}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $self->{vScrollBar}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | $self->{delta}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | $self->{limit}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | sub build { # $obj () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my ( $class ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | assert ( is_Str $class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | assert ( Storable::is_retrieving ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | return $class->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | bounds => TRect->new(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | aHScrollBar => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | aVScrollBar => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 25 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||