| 1 | package TUI::Help::HelpViewer; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: scrollable help topic viewer | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | our $VERSION = '2.000003'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||
| 14 | THelpViewer | ||||||||||||||||||||||||||||||||||||||||||
| 15 | new_THelpViewer | ||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 5 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 5 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | Maybe | ||||||||||||||||||||||||||||||||||||||||||
| 25 | :is | ||||||||||||||||||||||||||||||||||||||||||
| 26 | :types | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ); | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use TUI::Drivers::Const qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | evCommand | ||||||||||||||||||||||||||||||||||||||||||
| 31 | evKeyDown | ||||||||||||||||||||||||||||||||||||||||||
| 32 | evMouseDown | ||||||||||||||||||||||||||||||||||||||||||
| 33 | kbEnter | ||||||||||||||||||||||||||||||||||||||||||
| 34 | kbEsc | ||||||||||||||||||||||||||||||||||||||||||
| 35 | kbShiftTab | ||||||||||||||||||||||||||||||||||||||||||
| 36 | kbTab | ||||||||||||||||||||||||||||||||||||||||||
| 37 | meDoubleClick | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | ); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | ▶ | use TUI::Help::Const qw( cHelpViewer ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 | ▶ | use TUI::Help::HelpFile; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | ▶ | use TUI::Objects::Point; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 5 | ▶ | use TUI::Objects::Rect; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 5 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | cmClose | ||||||||||||||||||||||||||||||||||||||||||
| 45 | gfGrowHiX | ||||||||||||||||||||||||||||||||||||||||||
| 46 | gfGrowHiY | ||||||||||||||||||||||||||||||||||||||||||
| 47 | sfModal | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 5 | ); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 5 | ▶ | use TUI::Views::DrawBuffer; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 5 | ▶ | use TUI::Views::Palette; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | ▶ | use TUI::Views::Scroller; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | sub THelpViewer() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | sub name() { 'THelpViewer' } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub new_THelpViewer { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_THelpViewer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 5 | extends TScroller; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | # public attributes | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | has hFile => ( is => 'rw', default => sub { die 'required' } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 5 | has topic => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | 5 | has selected => ( is => 'rw', default => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 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 | hFile => Object, { alias => 'aHelpFile' }, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | context => PositiveOrZeroInt, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 74 | caller_level => +1, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my ( $class, $args1 ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||||||||||||||||||||||||||||||
| 78 | my $args2 = $class->SUPER::BUILDARGS( | ||||||||||||||||||||||||||||||||||||||||||
| 79 | bounds => $args1->{bounds}, | ||||||||||||||||||||||||||||||||||||||||||
| 80 | hScrollBar => $args1->{hScrollBar}, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | vScrollBar => $args1->{vScrollBar}, | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return { %$args1, %$args2 }; | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | assert ( is_HashRef $args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $self->{growMode} = gfGrowHiX | gfGrowHiY; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $self->{topic} = $self->{hFile}->getTopic( $args->{context} ); | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $self->{topic}->setWidth( $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $self->setLimit( 78, $self->{topic}->numLines() ); | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub from { # $viewer ($bounds, $aHScrollBar|undef, $aVScrollBar|undef, $aHelpFile, $context) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 100 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 101 | pos => [Object, Maybe[Object], Maybe[Object], Object, PositiveOrZeroInt], | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my ( $class, @args ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return $class->new( bounds => $args[0], hScrollBar => $args[1], | |||||||||||||||||||||||||||||||||||||||||
| 105 | vScrollBar => $args[2], hFile => $args[3], context => $args[4] ); | ||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub DEMOLISH { # void ($in_global_destruction) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEMOLISH: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my ( $self, $in_global_destruction ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | assert ( is_Bool $in_global_destruction ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | undef $self->{topic}; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | undef $self->{hFile}; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub changeBounds { # void ($bounds) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changeBounds: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 120 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||
| 122 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my ( $self, $bounds ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $self->SUPER::changeBounds( $bounds ); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $self->{topic}->setWidth( $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $self->setLimit( $self->{limit}{x}, $self->{topic}->numLines() ); | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub draw { # void () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
draw: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 132 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||
| 134 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $topic = $self->{topic}; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $normal = $self->getColor( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $keyword = $self->getColor( 2 ); | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $selKeyword = $self->getColor( 3 ); | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $keyCount = 0; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $keyPoint = TPoint->new(); | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $keyLength = 0; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $keyRef = 0; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $topic->setWidth( $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ( $topic->getNumCrossRefs() > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | do { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $topic->getCrossRef( $keyCount, $keyPoint, \$keyLength, \$keyRef ); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ++$keyCount; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } while ( $keyCount < $topic->getNumCrossRefs() | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | && $keyPoint->{y} <= $self->{delta}{y} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$keyCount < $topic->getNumCrossRefs and $keyPoint->{"y"} <= $self->{"delta"}{"y"}
MC/DC0%0/2
$keyCount < $topic->getNumCrossRefs and $keyPoint->{"y"} <= $self->{"delta"}{"y"}
$keyCount < $topic->getNumCrossRefs
$keyPoint->{"y"} <= $self->{"delta"}{"y"}
Truth table0%0/3
A and B
A= $keyCount < $topic->getNumCrossRefsB= $keyPoint->{"y"} <= $self->{"delta"}{"y"}
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | for my $i ( 1 .. $self->{size}{y} ) { | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $b = TDrawBuffer->new(); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $b->moveChar( 0, ' ', $normal, $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $buffer = ''; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $line = $topic->getLine( $i + $self->{delta}{y}, \$buffer, 256 ); | |||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ( length( $line ) > $self->{delta}{x} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | $b->moveStr( 0, | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | substr( $line, $self->{delta}{x}, $self->{size}{x} ), $normal ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $b->moveStr( 0, '', $normal ); | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | while ( $i + $self->{delta}{y} == $keyPoint->{y} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $l = $keyLength; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if ( $keyPoint->{x} < $self->{delta}{x} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $l -= $self->{delta}{x} - $keyPoint->{x}; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $keyPoint->{x} = $self->{delta}{x}; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | my $c = $keyCount == $self->{selected} ? $selKeyword : $keyword; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | for my $j ( 0 .. $l - 1 ) { | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $b->putAttribute( $keyPoint->{x} - $self->{delta}{x} + $j, $c ); | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if ( $keyCount < $topic->getNumCrossRefs() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $topic->getCrossRef( $keyCount, $keyPoint, \$keyLength, \$keyRef ); | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $keyCount++; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $keyPoint->{y} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $self->writeLine( 0, $i - 1, $self->{size}{x}, 1, $b ); | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | sub getPalette { # $palette () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPalette: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 192 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | state $palette = TPalette->new( | |||||||||||||||||||||||||||||||||||||||||
| 197 | data => cHelpViewer, | ||||||||||||||||||||||||||||||||||||||||||
| 198 | size => length( cHelpViewer ), | ||||||||||||||||||||||||||||||||||||||||||
| 199 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return $palette->clone(); | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub handleEvent { # void ($event) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handleEvent: not called CC=23 SCAR=63.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 205 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 206 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||
| 207 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my ( $self, $event ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $keyPoint = TPoint->new(); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $keyLength = 0; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $keyRef = 0; | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $self->SUPER::handleEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | SWITCH: for ( $event->{what} ) { | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | evKeyDown == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | SWITCH: for ( $event->{keyDown}{keyCode} ) { | |||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | kbTab == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ++$self->{selected}; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | if ( $self->{selected} > $self->{topic}->getNumCrossRefs() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->{selected} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if ( $self->{topic}->getNumCrossRefs() != 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $self->makeSelectVisible( $self->{selected} - 1, $keyPoint, | |||||||||||||||||||||||||||||||||||||||||
| 224 | \$keyLength, \$keyRef ); | ||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 227 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | kbShiftTab == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | --$self->{selected}; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if ( $self->{selected} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $self->{selected} = $self->{topic}->getNumCrossRefs(); | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | if ( $self->{topic}->getNumCrossRefs() != 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->makeSelectVisible( $self->{selected} - 1, $keyPoint, | |||||||||||||||||||||||||||||||||||||||||
| 235 | \$keyLength, \$keyRef ); | ||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 238 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | kbEnter == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ( $self->{selected} <= $self->{topic}->getNumCrossRefs() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $self->{topic}->getCrossRef( $self->{selected} - 1, $keyPoint, | |||||||||||||||||||||||||||||||||||||||||
| 242 | \$keyLength, \$keyRef ); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->switchToTopic( $keyRef ); | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 246 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | kbEsc == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $event->{what} = evCommand; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $event->{message}{command} = cmClose; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $self->putEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 252 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 253 | DEFAULT: { | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | } #/ SWITCH: for ( $event->{keyDown}{keyCode} ) | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $self->clearEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 260 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | evMouseDown == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $mouse = $self->makeLocal( $event->{mouse}{where} ); | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $mouse->{x} += $self->{delta}{x}; | |||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $mouse->{y} += $self->{delta}{y}; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $keyCount = 0; | |||||||||||||||||||||||||||||||||||||||||
| 267 | do { | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ++$keyCount; | |||||||||||||||||||||||||||||||||||||||||
| 269 | return | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | if $keyCount > $self->{topic}->getNumCrossRefs(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->{topic}->getCrossRef( $keyCount - 1, $keyPoint, | |||||||||||||||||||||||||||||||||||||||||
| 272 | \$keyLength, \$keyRef ); | ||||||||||||||||||||||||||||||||||||||||||
| 273 | } while ( !( $keyPoint->{y} == $mouse->{y} + 1 | ||||||||||||||||||||||||||||||||||||||||||
| 274 | && $mouse->{x} >= $keyPoint->{x} | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | && $mouse->{x} < $keyPoint->{x} + $keyLength ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$keyPoint->{"y"} == $mouse->{"y"} + 1 and $mouse->{"x"} >= $keyPoint->{"x"} and $mouse->{"x"} < $keyPoint->{"x"} + $keyLength
$keyPoint->{"y"} == $mouse->{"y"} + 1 and $mouse->{"x"} >= $keyPoint->{"x"}
MC/DC0%0/3
$keyPoint->{"y"} == $mouse->{"y"} + 1 and $mouse->{"x"} >= $keyPoint->{"x"} and $mouse->{"x"} < $keyPoint->{"x"} + $keyLength
$keyPoint->{"y"} == $mouse->{"y"} + 1
$mouse->{"x"} >= $keyPoint->{"x"}
$mouse->{"x"} < $keyPoint->{"x"} + $keyLength
Truth table0%0/4
A and B and C
A= $keyPoint->{"y"} == $mouse->{"y"} + 1B= $mouse->{"x"} >= $keyPoint->{"x"}C= $mouse->{"x"} < $keyPoint->{"x"} + $keyLength
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $self->{selected} = $keyCount; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if ( $event->{mouse}{eventFlags} & meDoubleClick ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $self->switchToTopic( $keyRef ); | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->clearEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 283 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | evCommand == $_ and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if ( $event->{message}{command} == cmClose | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$event->{"message"}{"command"} == 4 and $self->{"owner"} and ($self->{"owner"}{"state"} & 512) != 0
$event->{"message"}{"command"} == 4 and $self->{"owner"}
MC/DC0%0/3
$event->{"message"}{"command"} == 4 and $self->{"owner"} and ($self->{"owner"}{"state"} & 512) != 0
$event->{"message"}{"command"} == 4
$self->{"owner"}
($self->{"owner"}{"state"} & 512) != 0
Truth table0%0/4
A and B and C
A= $event->{"message"}{"command"} == 4B= $self->{"owner"}C= ($self->{"owner"}{"state"} & 512) != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | && $self->{owner} | ||||||||||||||||||||||||||||||||||||||||||
| 288 | && ( $self->{owner}{state} & sfModal ) != 0 | ||||||||||||||||||||||||||||||||||||||||||
| 289 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $self->endModal( cmClose ); | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $self->clearEvent( $event ); | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 294 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 295 | } #/ SWITCH: for ( $event->{what} ) | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | sub makeSelectVisible { # void ($selected, $keyPoint, \$keyLength, \$keyRef) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeSelectVisible: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 301 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 302 | pos => [ | ||||||||||||||||||||||||||||||||||||||||||
| 303 | Int, | ||||||||||||||||||||||||||||||||||||||||||
| 304 | Object, | ||||||||||||||||||||||||||||||||||||||||||
| 305 | ScalarRef[PositiveOrZeroInt], | ||||||||||||||||||||||||||||||||||||||||||
| 306 | ScalarRef[Int], | ||||||||||||||||||||||||||||||||||||||||||
| 307 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 308 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my ( $self, $selected, $keyPoint, $keyLength, $keyRef ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $self->{topic}->getCrossRef( $selected, $keyPoint, $keyLength, $keyRef ); | |||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $d = TPoint->new(); | |||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $d->{x} = $self->{delta}{x}; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $d->{y} = $self->{delta}{y}; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ( $keyPoint->{x} < $d->{x} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $d->{x} = $keyPoint->{x}; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | if ( $keyPoint->{x} > $d->{x} + $self->{size}{x} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $d->{x} = $keyPoint->{x} - $self->{size}{x}; | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | if ( $keyPoint->{y} <= $d->{y} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $d->{y} = $keyPoint->{y} - 1; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | if ( $keyPoint->{y} > $d->{y} + $self->{size}{y} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $d->{y} = $keyPoint->{y} - $self->{size}{y}; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $self->scrollTo( $d->{x}, $d->{y} ); | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | sub switchToTopic { # void ($keyRef) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
switchToTopic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 334 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 335 | pos => [Int], | ||||||||||||||||||||||||||||||||||||||||||
| 336 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my ( $self, $keyRef ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $self->{topic} = $self->{hFile}->getTopic( $keyRef ); | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $self->{topic}->setWidth( $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $self->scrollTo( 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $self->setLimit( $self->{limit}{x}, $self->{topic}->numLines() ); | |||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $self->{selected} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | sub build { # $obj () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my ( $class ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | assert ( is_Str $class ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | assert ( Storable::is_retrieving ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | open my $devnull, '<', File::Spec->devnull | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | or Carp::croak( "Cannot open devnull: $!" ); | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return $class->new( | |||||||||||||||||||||||||||||||||||||||||
| 355 | bounds => TRect->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 356 | hScrollBar => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 357 | vScrollBar => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 358 | hFile => THelpFile->new( stream => $devnull ), | ||||||||||||||||||||||||||||||||||||||||||
| 359 | context => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 360 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 5 | 1 | |||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | __END__ | ||||||||||||||||||||||||||||||||||||||||||