| 1 | package TUI::Views::Frame::Line; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: TFrame frameLine member function. | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 34 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 34 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 34 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 34 | our $VERSION = '2.000002'; | |||||||||||||||||||||||||||
| 9 | 34 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||
| 10 | 34 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 34 | ▶ | use PerlX::Assert::PP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 34 | ▶ | use List::Util qw( min max ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 34 | ▶ | use TUI::toolkit::Types qw( :is ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 34 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | cpFrame | ||||||||||||||||||||||||||||
| 18 | ofFramed | ||||||||||||||||||||||||||||
| 19 | sfVisible | ||||||||||||||||||||||||||||
| 20 | 34 | ); | |||||||||||||||||||||||||||
| 21 | 34 | require TUI::Views::Frame; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 34 | ▶ | use vars qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | $initFrame | ||||||||||||||||||||||||||||
| 25 | $frameChars | ||||||||||||||||||||||||||||
| 26 | 34 | ); | |||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 34 | *initFrame = \$TUI::Views::Frame::initFrame; | |||||||||||||||||||||||||||
| 29 | 34 | *frameChars = \$TUI::Views::Frame::frameChars; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub TUI::Views::Frame::frameLine { | ||||||||||||||||||||||||||
|
Subroutine
frameLine: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | my ( $self, $frameBuf, $y, $n, $color ) = @_; | |||||||||||||||||||||||||||
| 34 | 0 | assert ( @_ == 5 ); | |||||||||||||||||||||||||||
| 35 | 0 | assert ( is_Object $self ); | |||||||||||||||||||||||||||
| 36 | 0 | assert ( is_ArrayLike $frameBuf ); | |||||||||||||||||||||||||||
| 37 | 0 | assert ( is_Int $y ); | |||||||||||||||||||||||||||
| 38 | 0 | assert ( is_Int $n ); | |||||||||||||||||||||||||||
| 39 | 0 | assert ( is_PositiveOrZeroInt $color ); | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | my @FrameMask = ( ord substr( $initFrame, $n + 1, 1 ) ) x $self->{size}{x}; | |||||||||||||||||||||||||||
| 42 | 0 | $FrameMask[0] = ord substr( $initFrame, $n, 1 ); | |||||||||||||||||||||||||||
| 43 | 0 | $FrameMask[$self->{size}{x} - 1] = ord substr( $initFrame, $n + 2, 1 ); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | my $v = $self->{owner}{last}{next}; | |||||||||||||||||||||||||||
| 46 | 0 | ▶ | for ( ; $v != $self ; $v = $v->{next} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ( ( $v->{options} & ofFramed ) && ( $v->{state} & sfVisible ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$v->{"options"} & 8 and $v->{"state"} & 1
MC/DC0%0/2
$v->{"options"} & 8 and $v->{"state"} & 1
$v->{"options"} & 8
$v->{"state"} & 1
Truth table0%0/3
A and B
A= $v->{"options"} & 8B= $v->{"state"} & 1
| |||||||||||||||||||||||||||||
| 48 | 0 | my $mask = 0; | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ( $y < $v->{origin}{y} ) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if ( $y == $v->{origin}{y} - 1 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | $mask = 0x0A06; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | elsif ( $y < $v->{origin}{y} + $v->{size}{y} ) { | ||||||||||||||||||||||||||||
| 55 | 0 | $mask = 0x0005; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | elsif ( $y == $v->{origin}{y} + $v->{size}{y} ) { | ||||||||||||||||||||||||||||
| 58 | 0 | $mask = 0x0A03; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( $mask ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | 0 | my $start = max( $v->{origin}{x}, 1 ); | |||||||||||||||||||||||||||
| 63 | 0 | my $end = min( $v->{origin}{x} + $v->{size}{x}, $self->{size}{x} - 1 ); | |||||||||||||||||||||||||||
| 64 | 0 | ▶ | if ( $start < $end ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 0 | my $maskLow = $mask & 0x00FF; | |||||||||||||||||||||||||||
| 66 | 0 | my $maskHigh = ( $mask & 0xFF00 ) >> 8; | |||||||||||||||||||||||||||
| 67 | 0 | $FrameMask[$start - 1] |= $maskLow; | |||||||||||||||||||||||||||
| 68 | 0 | $FrameMask[$end] |= $maskLow ^ $maskHigh; | |||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ( $maskLow ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | for my $x ($start .. $end - 1) { | |||||||||||||||||||||||||||
| 71 | 0 | $FrameMask[$x] |= $maskHigh; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | } #/ if ( $start < $end ) | ||||||||||||||||||||||||||||
| 75 | } #/ if ( $mask ) | ||||||||||||||||||||||||||||
| 76 | } #/ if ( ( $v->{options} &...)) | ||||||||||||||||||||||||||||
| 77 | } #/ for ( ; $v != $self ; $v...) | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | for my $x ( 0 .. $self->{size}{x} -1 ) { | |||||||||||||||||||||||||||
| 80 | 0 | $frameBuf->putChar( $x, substr( $frameChars, $FrameMask[$x], 1 ) ); | |||||||||||||||||||||||||||
| 81 | 0 | $frameBuf->putAttribute( $x, $color ); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | } #/ sub TUI::Views::Frame::frameLine | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 34 | 1 | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | __END__ | ||||||||||||||||||||||||||||