lib/TUI/Views/View.pm

filter: Statementstmt 16.6% 139 / 835 Branchbran 0.6% 2 / 304 Conditioncond 0.0% 0 / 84 MC/DCmcdc 0.0% 0 / 51 Subroutinesub 24.4% 31 / 127 Podpod 92.8% 78 / 84 totaltotal 16.8% 250 / 1485 CC 182 SCAR 41.6
CC
182
Cov
12%
dragView
380.0
setState
182.0
__ANON__
182.0
CRAP 64.0
« lib/TUI/Menus/StatusLine.pm ↑ Summary lib/TUI/Gadgets/PuzzleView.pm »
1 package TUI::Views::View;
2 # ABSTRACT: Base class for all visual components
3
4 133 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 133 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 133 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 133 our $VERSION = '2.000003';
9 133 $VERSION =~ tr/_//d;
10 133 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 133 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 133 our @EXPORT = qw(
14 TView
15 new_TView
16 );
17
18 133 ▶use Devel::StrictMode;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 133 ▶use List::Util qw( min max );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 133 ▶use Scalar::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
21 weaken
22 reftype
23 133 );
24 133 ▶use Storable qw( freeze thaw );
Subroutine BEGIN: called CC=1 SCAR=0.0
25 133 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 133 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
27 Maybe
28 :is
29 :types
30 133 );
31
32 133 ▶use TUI::Const qw( INT_MAX );
Subroutine BEGIN: called CC=1 SCAR=0.0
33 133 ▶use TUI::Objects::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 133 ▶use TUI::Objects::Point;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 133 ▶use TUI::Objects::Rect;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 133 ▶use TUI::Objects::Stream;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 133 ▶use TUI::Objects::Streamable;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 133 ▶use TUI::Drivers::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
39 :evXXXX
40 :kbXXXX
41 133 );
42 133 ▶use TUI::Drivers::AttrPair;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 133 ▶use TUI::Drivers::ColorAttr;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 133 ▶use TUI::Drivers::Event;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 133 ▶use TUI::Drivers::ScreenCell;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 133 ▶use TUI::Views::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
47 maxViewWidth
48 :phaseType
49 :selectMode
50 :cmXXXX
51 :dmXXXX
52 :gfXXXX
53 :hcXXXX
54 :ofXXXX
55 :sfXXXX
56 133 );
57 133 ▶use TUI::Views::CommandSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 133 ▶use TUI::Views::DrawBuffer;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 133 ▶use TUI::Views::Palette;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 133 ▶use TUI::Views::Util qw( message );
Subroutine BEGIN: called CC=1 SCAR=0.0
61
62 133 require TUI::Views::View::Cursor;
63 133 require TUI::Views::View::Exposed;
64 133 require TUI::Views::View::Write;
65
66 sub TView() { __PACKAGE__ }
67 sub name() { 'TView' }
68 0 ▶sub new_TView { __PACKAGE__->from(@_) }
Subroutine new_TView: not called CC=1 SCAR=6.9
Pod documented
69
70 133 extends TObject;
71 133 with: *DOES = TStreamable->can('DOES');
72
73 # declare global variables
74 133 our $shadowSize = TPoint->new( x => 2, y => 1 );
75 133 our $shadowAttr = 0x08;
76 133 our $showMarkers = false;
77 133 our $specialChars = [ "\xAF", "\xAE", "\x1A", "\x1B", ' ', ' ' ];
78 133 our $errorAttr = 0xcf;
79 133 our $commandSetChanged = false;
80 133 our $curCommandSet = do { # initCommands
81 133 my $temp = TCommandSet->new();
82 133 ▶ for ( my $i = 0 ; $i < 256 ; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 256) 34048 133 34181
83 34048 $temp->enableCmd( $i );
84 }
85 133 $temp->disableCmd( cmZoom );
86 133 $temp->disableCmd( cmClose );
87 133 $temp->disableCmd( cmResize );
88 133 $temp->disableCmd( cmNext );
89 133 $temp->disableCmd( cmPrev );
90 133 $temp;
91 };
92
93 # import global variables
94 133 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
95 $TheTopView
96 133 );
97 {
98 133 *TheTopView = \$TUI::Views::Group::TheTopView;
99 }
100
101 # public attributes
102 133 has next => ( is => 'bare' );
103 0 ▶has size => ( is => 'rw', default => sub { TPoint->new } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
104 133 has options => ( is => 'rw', default => 0 );
105 133 has eventMask => ( is => 'rw', default => evMouseDown | evKeyDown | evCommand );
106 133 has state => ( is => 'rw', default => sfVisible );
107 0 ▶has origin => ( is => 'rw', default => sub { TPoint->new } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
108 0 ▶has cursor => ( is => 'rw', default => sub { TPoint->new } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
109 133 has growMode => ( is => 'rw', default => 0 );
110 133 has dragMode => ( is => 'rw', default => dmLimitLoY );
111 133 has helpCtx => ( is => 'rw', default => hcNoContext );
112 133 has owner => ( is => 'bare' ); # weak_ref => 1
113
114 # predeclare private methods
115 my (
116 133 $moveGrow,
117 $change,
118 $writeView,
119 );
120
121 # macro for coercing a value into a TColorAttr object
122 0 ▶my $coerceAttr = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
123 0 ▶ return ref $_[0] ? $_[0] : TColorAttr->new( bios => $_[0] );
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
124 133 };
125
126 # macro for locking a value (making it readonly)
127 0 ▶my $lock_value = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
128 0 ▶ Internals::SvREADONLY( $_[0] => 1 )
Branch: 1 branch
BranchTrueFalseTotal
if exists &Internals::SvREADONLY 0 0 0
129 if exists &Internals::SvREADONLY;
130 133 };
131
132 # macro for unlocking a value (making it writable)
133 0 ▶my $unlock_value = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
134 0 ▶ Internals::SvREADONLY( $_[0] => 0 )
Branch: 1 branch
BranchTrueFalseTotal
if exists &Internals::SvREADONLY 0 0 0
135 if exists &Internals::SvREADONLY;
136 133 };
137
138 0 ▶sub BUILDARGS { # \%args (%args)
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
139 0 state $sig = signature(
140 method => 1,
141 named => [
142 bounds => Object,
143 ],
144 caller_level => +1,
145 );
146 0 my ( $class, $args ) = $sig->( @_ );
147 0 return { %$args };
148 }
149
150 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=6 SCAR=37.4
Pod documented
151 0 my ( $self, $args ) = @_;
152 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
153 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
154 0 ▶ assert ( is_HashRef $args );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_HashRef($args) 0 0 0
155 0 ▶ weaken( $self->{owner} ) if $self->{owner};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"owner"} 0 0 0
156 0 ▶ weaken( $self->{next} ) if $self->{next};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"next"} 0 0 0
157 0 &$lock_value( $self->{owner} ) if STRICT;
158 0 &$lock_value( $self->{next} ) if STRICT;
159 0 $self->setBounds( $args->{bounds} );
160 0 return;
161 } #/ sub BUILD
162
163 0 ▶sub from { # $obj ($bounds)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
164 0 state $sig = signature(
165 method => 1,
166 pos => [Object],
167 );
168 0 my ( $class, $bounds ) = $sig->( @_ );
169 0 return $class->new( bounds => $bounds );
170 }
171
172 0 ▶sub DEMOLISH { # void ($in_global_destruction)
Subroutine DEMOLISH: not called CC=3 SCAR=24.8
Pod documented
173 0 my ( $self, $in_global_destruction ) = @_;
174 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
175 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
176 0 &$unlock_value( $self->{owner} ) if STRICT;
177 0 &$unlock_value( $self->{next} ) if STRICT;
178 0 return;
179 }
180
181 0 ▶sub sizeLimits { # void ($min, $max)
Subroutine sizeLimits: not called CC=3 SCAR=24.8
Pod documented
182 0 state $sig = signature(
183 method => Object,
184 pos => [HashLike, HashLike],
185 );
186 0 my ( $self, $min, $max ) = $sig->( @_ );
187 0 $min->{x} = $min->{y} = 0;
188 0 ▶ if ( !( $self->{growMode} & gfFixed ) && $self->{owner} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{'growMode'} & 32 and $self->{'owner'}) { } 0 0 0
Condition0%0/3
not $self->{"growMode"} & 32 and $self->{"owner"}
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->{"growMode"} & 32 and $self->{"owner"}
not $self->{"growMode"} & 32 $self->{"owner"}
Truth table0%0/3
not(A) and B
A= not $self->{"growMode"} & 32B= $self->{"owner"}
ABresult
0X0
100
111
189 0 $max->{x} = $self->{owner}{size}{x};
190 0 $max->{y} = $self->{owner}{size}{y};
191 }
192 else {
193 0 $max->{x} = $max->{y} = INT_MAX;
194 }
195 0 return;
196 } #/ sub sizeLimits
197
198 0 ▶sub getBounds { # $rect ()
Subroutine getBounds: not called CC=1 SCAR=6.9
Pod documented
199 0 state $sig = signature(
200 method => Object,
201 pos => [],
202 );
203 0 my ( $self ) = $sig->( @_ );
204 return TRect->new(
205 a => $self->{origin},
206 b => $self->{origin} + $self->{size},
207 0 );
208 }
209
210 0 ▶sub getExtent { # $rect ()
Subroutine getExtent: not called CC=1 SCAR=6.9
Pod documented
211 0 state $sig = signature(
212 method => Object,
213 pos => [],
214 );
215 0 my ( $self ) = $sig->( @_ );
216 return TRect->new(
217 ax => 0,
218 ay => 0,
219 bx => $self->{size}{x},
220 by => $self->{size}{y},
221 0 );
222 }
223
224 0 ▶sub getClipRect { # $rect ()
Subroutine getClipRect: not called CC=2 SCAR=17.9
Pod documented
225 0 state $sig = signature(
226 method => Object,
227 pos => [],
228 );
229 0 my ( $self ) = $sig->( @_ );
230 0 my $clip = $self->getBounds();
231 0 ▶ if ( $self->{owner} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"owner"}) 0 0 0
232 0 $clip->intersect( $self->{owner}{clip} );
233 }
234 0 $clip->move( -$self->{origin}{x}, -$self->{origin}{y} );
235 0 return $clip;
236 }
237
238 0 ▶sub mouseInView { # $bool ($mouse)
Subroutine mouseInView: not called CC=1 SCAR=6.9
Pod documented
239 0 state $sig = signature(
240 method => Object,
241 pos => [Object],
242 );
243 0 my ( $self, $mouse ) = $sig->( @_ );
244 0 $mouse = $self->makeLocal( $mouse->clone() );
245 0 my $r = $self->getExtent();
246 0 return $r->contains( $mouse );
247 }
248
249 0 ▶sub containsMouse { # $bool ($event)
Subroutine containsMouse: not called CC=3 SCAR=24.8
Pod documented
250 0 state $sig = signature(
251 method => Object,
252 pos => [Object],
253 );
254 0 my ( $self, $event ) = $sig->( @_ );
255 return ( $self->{state} & sfVisible )
256 && $event->{mouse}
257 0 ▶ && $self->mouseInView( $event->{mouse}{where} );
Condition0%0/6
$self->{'state'} & 1 && $event->{'mouse'} && $self->mouseInView($event->{'mouse'}{'where'})
!ll&&!rl&&r
000
$self->{"state"} & 1 and $event->{"mouse"}
!ll&&!rl&&r
000
MC/DC0%0/3
$self->{'state'} & 1 && $event->{'mouse'} && $self->mouseInView($event->{'mouse'}{'where'})
$self->{"state"} & 1 $event->{"mouse"} $self->mouseInView($event->{'mouse'}{'where'})
Truth table0%0/4
A and B && C
A= $self->{"state"} & 1B= $event->{"mouse"}C= $self->mouseInView($event->{'mouse'}{'where'})
ABCresult
0XX0
10X0
1100
1111
258 }
259
260 # Define the range function
261 0 ▶my $range = sub { # $ ($val, $min, $max)
Subroutine __ANON__: not called CC=8 SCAR=42.8
262 0 my ( $val, $min, $max ) = @_;
263 0 ▶ assert ( @_ == 3 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 3 0 0 0
264 0 ▶ assert ( is_Int $val );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($val) 0 0 0
265 0 ▶ assert ( is_Int $min );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($min) 0 0 0
266 0 ▶ assert ( is_Int $max );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($max) 0 0 0
267 0 ▶ $min = $max
Branch: 1 branch
BranchTrueFalseTotal
if $min > $max 0 0 0
268 if $min > $max;
269 0 ▶ if ( $val < $min ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($val < $min) { } 0 0 0
elsif ($val > $max) { } 0 0 0
270 0 return $min;
271 } elsif ( $val > $max ) {
272 0 return $max;
273 } else {
274 0 return $val;
275 }
276 133 };
277
278 0 ▶sub locate { # void ($bounds)
Subroutine locate: not called CC=5 SCAR=34.0
Pod documented
279 0 state $sig = signature(
280 method => Object,
281 pos => [Object],
282 );
283 0 my ( $self, $bounds ) = $sig->( @_ );
284 0 my ( $min, $max ) = ( TPoint->new(), TPoint->new() );
285 0 $self->sizeLimits( $min, $max );
286 $bounds->{b}{x} = $bounds->{a}{x} +
287 0 &$range( $bounds->{b}{x} - $bounds->{a}{x}, $min->{x}, $max->{x} );
288 $bounds->{b}{y} = $bounds->{a}{y} +
289 0 &$range( $bounds->{b}{y} - $bounds->{a}{y}, $min->{y}, $max->{y} );
290 0 my $r = $self->getBounds();
291 0 ▶ if ( $bounds != $r ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bounds != $r) 0 0 0
292 0 $self->changeBounds( $bounds );
293 0 ▶ if ( $self->{owner} && ( $self->{state} & sfVisible ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"owner"} and $self->{"state"} & 1) 0 0 0
Condition0%0/3
$self->{"owner"} and $self->{"state"} & 1
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"owner"} and $self->{"state"} & 1
$self->{"owner"} $self->{"state"} & 1
Truth table0%0/3
A and B
A= $self->{"owner"}B= $self->{"state"} & 1
ABresult
0X0
100
111
294 0 ▶ if ( $self->{state} & sfShadow ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} & 8) 0 0 0
295 0 $r->Union( $bounds );
296 0 $r->{b} += $shadowSize;
297 }
298 0 $self->drawUnderRect( $r, undef );
299 }
300 } #/ if ( $bounds != $r )
301 0 return;
302 } #/ sub locate
303
304 0 ▶sub dragView { # void ($event, $mode, $limits, $minSize, $maxSize)
Subroutine dragView: not called CC=19 SCAR=59.4
Pod documented
305 0 state $sig = signature(
306 method => Object,
307 pos => [Object, PositiveOrZeroInt, Object, Object, Object],
308 );
309 0 my ( $self, $event, $mode, $limits, $minSize, $maxSize ) = $sig->( @_ );
310 0 my $saveBounds;
311
312 0 my ( $p, $s );
313 0 $self->setState( sfDragging, true );
314
315 0 ▶ if ( $event->{what} == evMouseDown ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{'what'} == 1) { } 0 0 0
316 0 ▶ if ( $mode & dmDragMove ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode & 1) { } 0 0 0
317 0 $p = $self->{origin} - $event->{mouse}{where};
318 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$self->mouseEvent($event, 4) and do { do { $event->{"mouse"}{"where"} += $p; $self->$moveGrow($event->{"mouse"}{"where"}, $self->{"size"}, $limits, $minSize, $maxSize, $mode) } } 0 0 0
319 0 $event->{mouse}{where} += $p;
320 $self->$moveGrow(
321 0 $event->{mouse}{where}, $self->{size}, $limits, $minSize,
322 $maxSize, $mode
323 );
324 } while ( $self->mouseEvent( $event, evMouseMove ) );
325 } #/ if ( $mode & dmDragMove)
326 else {
327 0 $p = $self->{size} - $event->{mouse}{where};
328 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$self->mouseEvent($event, 4) and do { do { $event->{"mouse"}{"where"} += $p; $self->$moveGrow($self->{"origin"}, $event->{"mouse"}{"where"}, $limits, $minSize, $maxSize, $mode) } } 0 0 0
329 0 $event->{mouse}{where} += $p;
330 $self->$moveGrow(
331 0 $self->{origin}, $event->{mouse}{where}, $limits, $minSize,
332 $maxSize, $mode
333 );
334 } while ( $self->mouseEvent( $event, evMouseMove ) );
335 } #/ else [ if ( $mode & dmDragMove)]
336 } #/ if ( $event->{what} ==...)
337 else {
338 0 state $goLeft = TPoint->new( x => -1, y => 0 );
339 0 state $goRight = TPoint->new( x => 1, y => 0 );
340 0 state $goUp = TPoint->new( x => 0, y => -1 );
341 0 state $goDown = TPoint->new( x => 0, y => 1 );
342 0 state $goCtrlLeft = TPoint->new( x => -8, y => 0 );
343 0 state $goCtrlRight = TPoint->new( x => 8, y => 0 );
344
345 0 $saveBounds = $self->getBounds();
346 do {
347 0 $p = $self->{origin}->clone();
348 0 $s = $self->{size}->clone();
349 0 $self->keyEvent( $event );
350 0 SWITCH: for ( $event->{keyDown}{keyCode} & 0xff00 ) {
351 0 ▶ $_ == kbLeft and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 19200 and do { $self->$change($mode, $goLeft, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last } 0 0 0
352 $self->$change( $mode, $goLeft, $p, $s,
353 0 $event->{keyDown}{controlKeyState} );
354 0 last;
355 };
356 0 ▶ $_ == kbRight and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 19712 and do { $self->$change($mode, $goRight, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last } 0 0 0
357 $self->$change( $mode, $goRight, $p, $s,
358 0 $event->{keyDown}{controlKeyState} );
359 0 last;
360 };
361 0 ▶ $_ == kbUp and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 18432 and do { $self->$change($mode, $goUp, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last } 0 0 0
362 $self->$change( $mode, $goUp, $p, $s,
363 0 $event->{keyDown}{controlKeyState} );
364 0 last;
365 };
366 0 ▶ $_ == kbDown and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 20480 and do { $self->$change($mode, $goDown, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last } 0 0 0
367 $self->$change( $mode, $goDown, $p, $s,
368 0 $event->{keyDown}{controlKeyState} );
369 0 last;
370 };
371 0 ▶ $_ == kbCtrlLeft and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 29440 and do { $self->$change($mode, $goCtrlLeft, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last } 0 0 0
372 $self->$change(
373 $mode, $goCtrlLeft, $p, $s,
374 $event->{keyDown}{controlKeyState}
375 0 );
376 0 last;
377 };
378 0 ▶ $_ == kbCtrlRight and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 29696 and do { $self->$change($mode, $goCtrlRight, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last } 0 0 0
379 $self->$change(
380 $mode, $goCtrlRight, $p, $s,
381 $event->{keyDown}{controlKeyState}
382 0 );
383 0 last;
384 };
385 0 ▶ $_ == kbHome and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 18176 and do { $p->{"x"} = $limits->{"a"}{"x"}; last } 0 0 0
386 0 $p->{x} = $limits->{a}{x};
387 0 last;
388 };
389 0 ▶ $_ == kbEnd and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 20224 and do { $p->{"x"} = $limits->{"b"}{"x"} - $s->{"x"}; last } 0 0 0
390 0 $p->{x} = $limits->{b}{x} - $s->{x};
391 0 last;
392 };
393 0 ▶ $_ == kbPgUp and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 18688 and do { $p->{"y"} = $limits->{"a"}{"y"}; last } 0 0 0
394 0 $p->{y} = $limits->{a}{y};
395 0 last;
396 };
397 0 ▶ $_ == kbPgDn and do {
Branch: 1 branch
BranchTrueFalseTotal
$_ == 20736 and do { $p->{"y"} = $limits->{"b"}{"y"} - $s->{"y"}; last } 0 0 0
398 0 $p->{y} = $limits->{b}{y} - $s->{y};
399 0 last;
400 };
401 }
402 0 $self->$moveGrow( $p, $s, $limits, $minSize, $maxSize, $mode );
403 } while ( $event->{keyDown}{keyCode} != kbEsc
404 0 ▶ && $event->{keyDown}{keyCode} != kbEnter
Branch: 1 branch
BranchTrueFalseTotal
$event->{"keyDown"}{"keyCode"} != 283 and $event->{"keyDown"}{"keyCode"} != 7181 and do { do { $p = $self->{"origin"}->clone; $s = $self->{"size"}->clone; $self->keyEvent($event); SWITCH: foreach $_ ($event->{"keyDown"}{"keyCode"} & 65280) { $_ == 19200 and do { $self->$change($mode, $goLeft, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last }; $_ == 19712 and do { $self->$change($mode, $goRight, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last }; $_ == 18432 and do { $self->$change($mode, $goUp, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last }; $_ == 20480 and do { $self->$change($mode, $goDown, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last }; $_ == 29440 and do { $self->$change($mode, $goCtrlLeft, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last }; $_ == 29696 and do { $self->$change($mode, $goCtrlRight, $p, $s, $event->{"keyDown"}{"controlKeyState"}); last }; $_ == 18176 and do { $p->{"x"} = $limits->{"a"}{"x"}; last }; $_ == 20224 and do { $p->{"x"} = $limits->{"b"}{"x"} - $s->{"x"}; last }; $_ == 18688 and do { $p->{"y"} = $limits->{"a"}{"y"}; last }; $_ == 20736 and do { $p->{"y"} = $limits->{"b"}{"y"} - $s->{"y"}; last }; } ; $self->$moveGrow($p, $s, $limits, $minSize, $maxSize, $mode) } } 0 0 0
Condition0%0/3
$event->{"keyDown"}{"keyCode"} != 283 and $event->{"keyDown"}{"keyCode"} != 7181
!ll&&!rl&&r
000
MC/DC0%0/2
$event->{"keyDown"}{"keyCode"} != 283 and $event->{"keyDown"}{"keyCode"} != 7181
$event->{"keyDown"}{"keyCode"} != 283 $event->{"keyDown"}{"keyCode"} != 7181
Truth table0%0/3
A and B
A= $event->{"keyDown"}{"keyCode"} != 283B= $event->{"keyDown"}{"keyCode"} != 7181
ABresult
0X0
100
111
405 );
406 0 ▶ if ( $event->{keyDown}{keyCode} == kbEsc ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"keyDown"}{"keyCode"} == 283) 0 0 0
407 0 $self->locate( $saveBounds );
408 }
409 } #/ else [ if ( $event->{what} ==...)]
410 0 $self->setState( sfDragging, false );
411 } #/ sub dragView
412
413 0 ▶sub calcBounds { # void ($bounds, $delta);
Subroutine calcBounds: not called CC=6 SCAR=37.4
Pod documented
414 0 state $sig = signature(
415 method => Object,
416 pos => [Object, Object],
417 );
418 0 my ( $self, $bounds, $delta ) = $sig->( @_ );
419
420 0 my ( $s, $d );
421
422 0 ▶ my $grow = sub { # ($i)
Subroutine __ANON__: not called CC=2 SCAR=17.9
423 0 ▶ if ( $self->{growMode} & gfGrowRel ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'growMode'} & 16) { } 0 0 0
424 0 $_[0] = int( ( $_[0] * $s + ( ( $s - $d ) >> 1 ) ) / ( $s - $d ) );
425 }
426 else {
427 0 $_[0] += $d;
428 }
429 0 };
430
431 0 %$bounds = %{ $self->getBounds() };
432 0
433 0 ▶ assert ( $self->{owner} );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"owner"} 0 0 0
434 0 $s = $self->{owner}{size}{x};
435 0 $d = $delta->{x};
436
437 0 ▶ if ( $self->{growMode} & gfGrowLoX ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"growMode"} & 1) 0 0 0
438 0 &$grow( $bounds->{a}{x} );
439 }
440
441 0 ▶ if ( $self->{growMode} & gfGrowHiX ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"growMode"} & 4) 0 0 0
442 0 &$grow( $bounds->{b}{x} );
443 }
444
445 0 $s = $self->{owner}{size}{y};
446 0 $d = $delta->{y};
447
448 0 ▶ if ( $self->{growMode} & gfGrowLoY ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"growMode"} & 2) 0 0 0
449 0 &$grow( $bounds->{a}{y} );
450 }
451
452 0 ▶ if ( $self->{growMode} & gfGrowHiY ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"growMode"} & 8) 0 0 0
453 0 &$grow( $bounds->{b}{y} );
454 }
455
456 0 my ( $minLim, $maxLim ) = ( TPoint->new(), TPoint->new() );
457 0 $self->sizeLimits( $minLim, $maxLim );
458 $bounds->{b}{x} = $bounds->{a}{x} +
459 0 &$range( $bounds->{b}{x} - $bounds->{a}{x}, $minLim->{x}, $maxLim->{x} );
460 $bounds->{b}{y} = $bounds->{a}{y} +
461 0 &$range( $bounds->{b}{y} - $bounds->{a}{y}, $minLim->{y}, $maxLim->{y} );
462 0 return;
463 } #/ sub calcBounds
464
465 0 ▶sub changeBounds { # void ($bounds)
Subroutine changeBounds: not called CC=1 SCAR=6.9
Pod documented
466 0 state $sig = signature(
467 method => Object,
468 pos => [Object],
469 );
470 0 my ( $self, $bounds ) = $sig->( @_ );
471 0 $self->setBounds( $bounds );
472 0 $self->drawView();
473 0 return;
474 }
475
476 0 ▶sub growTo { # void ($x, $y)
Subroutine growTo: not called CC=1 SCAR=6.9
Pod documented
477 0 state $sig = signature(
478 method => Object,
479 pos => [Int, Int],
480 );
481 0 my ( $self, $x, $y ) = $sig->( @_ );
482 my $r = TRect->new(
483 ax => $self->{origin}{x},
484 ay => $self->{origin}{y},
485 bx => $self->{origin}{x} + $x,
486 0 by => $self->{origin}{y} + $y,
487 );
488 0 $self->locate( $r );
489 0 return;
490 } #/ sub growTo
491
492 0 ▶sub moveTo { # void ($x, $y)
Subroutine moveTo: not called CC=1 SCAR=6.9
Pod documented
493 0 state $sig = signature(
494 method => Object,
495 pos => [Int, Int],
496 );
497 0 my ( $self, $x, $y ) = $sig->( @_ );
498 my $r = TRect->new(
499 ax => $x,
500 ay => $y,
501 bx => $x + $self->{size}{x},
502 by => $y + $self->{size}{y},
503 0 );
504 0 $self->locate( $r );
505 0 return;
506 } #/ sub moveTo
507
508 0 ▶sub setBounds { # void ($bounds)
Subroutine setBounds: not called CC=1 SCAR=6.9
Pod documented
509 0 state $sig = signature(
510 method => Object,
511 pos => [Object],
512 );
513 0 my ( $self, $bounds ) = $sig->( @_ );
514 0 $self->{origin} = $bounds->{a}->clone;
515 0 $self->{size} = $bounds->{b} - $bounds->{a};
516 0 return;
517 }
518
519 0 ▶sub getHelpCtx { # $int ()
Subroutine getHelpCtx: not called CC=2 SCAR=17.9
Pod documented
520 0 state $sig = signature(
521 method => Object,
522 pos => [],
523 );
524 0 my ( $self ) = $sig->( @_ );
525 0 ▶ if ( $self->{state} & sfDragging ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} & 128) 0 0 0
526 0 return hcDragging;
527 }
528 0 return $self->{helpCtx};
529 }
530
531 0 ▶sub valid { # $bool ($command)
Subroutine valid: not called CC=1 SCAR=6.9
Pod documented
532 0 state $sig = signature(
533 method => Object,
534 pos => [PositiveOrZeroInt],
535 );
536 0 $sig->( @_ );
537 0 return true;
538 }
539
540 0 ▶sub hide { # void ()
Subroutine hide: not called CC=2 SCAR=17.9
Pod documented
541 0 state $sig = signature(
542 method => Object,
543 pos => [],
544 );
545 0 my ( $self ) = $sig->( @_ );
546 0 ▶ if ( $self->{state} & sfVisible ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} & 1) 0 0 0
547 0 $self->setState( sfVisible, false );
548 }
549 0 return;
550 }
551
552 0 ▶sub show { # void ()
Subroutine show: not called CC=2 SCAR=17.9
Pod documented
553 0 state $sig = signature(
554 method => Object,
555 pos => [],
556 );
557 0 my ( $self ) = $sig->( @_ );
558 0 ▶ if ( ( $self->{state} & sfVisible ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($self->{"state"} & 1) == 0) 0 0 0
559 0 $self->setState( sfVisible, true );
560 }
561 0 return;
562 }
563
564 0 ▶sub draw { # void ()
Subroutine draw: not called CC=1 SCAR=6.9
Pod documented
565 0 state $sig = signature(
566 method => Object,
567 pos => [],
568 );
569 0 my ( $self ) = $sig->( @_ );
570 0 my $b = TDrawBuffer->new();
571
572 0 $b->moveChar( 0, ' ', $self->getColor( 1 ), $self->{size}{x} );
573 0 $self->writeLine( 0, 0, $self->{size}{x}, $self->{size}{y}, $b );
574 0 return;
575 }
576
577 0 ▶sub drawView { # void ()
Subroutine drawView: not called CC=2 SCAR=17.9
Pod documented
578 0 state $sig = signature(
579 method => Object,
580 pos => [],
581 );
582 0 my ( $self ) = $sig->( @_ );
583 0 ▶ if ( $self->exposed() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->exposed) 0 0 0
584 0 $self->draw();
585 0 $self->drawCursor();
586 }
587 0 return;
588 }
589
590 0 ▶sub exposed { # $bool ()
Subroutine exposed: not called CC=1 SCAR=6.9
Pod documented
591 0 state $sig = signature(
592 method => Object,
593 pos => [],
594 );
595 0 my ( $self ) = $sig->( @_ );
596 0 return TUI::Views::View::Exposed::L0( $self );
597 }
598
599 0 ▶sub focus { # $bool ()
Subroutine focus: not called CC=7 SCAR=40.3
Pod documented
600 0 state $sig = signature(
601 method => Object,
602 pos => [],
603 );
604 0 my ( $self ) = $sig->( @_ );
605 0 my $result = true;
606
607 0 ▶ if ( !( $self->{state} & ( sfSelected | sfModal ) ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"state"} & 544) 0 0 0
608 0 ▶ if ( $self->{owner} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"owner"}) 0 0 0
609 0 $result = $self->{owner}->focus();
610 0 ▶ if ( $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result) 0 0 0
611 0 ▶ if ( !$self->{owner}{current} ||
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{'owner'}{'current'} or (not $self->{'owner'}{'current'}{'options'} & 1024 or $self->{'owner'}{'current'}->valid(51))) { } 0 0 0
Condition0%0/6
not $self->{"owner"}{"current"} or (not $self->{"owner"}{"current"}{"options"} & 1024 or $self->{"owner"}{"current"}->valid(51))
l!l&&r!l&&!r
000
not $self->{"owner"}{"current"}{"options"} & 1024 or $self->{"owner"}{"current"}->valid(51)
l!l&&r!l&&!r
000
MC/DC0%0/3
not $self->{"owner"}{"current"} or (not $self->{"owner"}{"current"}{"options"} & 1024 or $self->{"owner"}{"current"}->valid(51))
not $self->{"owner"}{"current"} not $self->{"owner"}{"current"}{"options"} & 1024 $self->{"owner"}{"current"}->valid(51)
Truth table0%0/4
not(A) or not(B) or C
A= not $self->{"owner"}{"current"}B= not $self->{"owner"}{"current"}{"options"} & 1024C= $self->{"owner"}{"current"}->valid(51)
ABCresult
1XX1
01X1
0011
0000
612 ( !( $self->{owner}{current}{options} & ofValidate ) ||
613 $self->{owner}{current}->valid( cmReleasedFocus ) )
614 ) {
615 0 $self->select();
616 }
617 else {
618 0 return false;
619 }
620 } #/ if ( $result )
621 } #/ if ( $self->{owner} )
622 } #/ if ( !( $self->{state}...))
623 0 return $result;
624 } #/ sub focus
625
626 0 ▶sub hideCursor { # void ()
Subroutine hideCursor: not called CC=1 SCAR=6.9
Pod documented
627 0 state $sig = signature(
628 method => Object,
629 pos => [],
630 );
631 0 my ( $self ) = $sig->( @_ );
632 0 $self->setState( sfCursorVis, false );
633 0 return;
634 }
635
636 0 ▶sub drawHide { # void ($lastView|undef)
Subroutine drawHide: not called CC=1 SCAR=6.9
Pod documented
637 0 state $sig = signature(
638 method => Object,
639 pos => [Maybe[Object]],
640 );
641 0 my ( $self, $lastView ) = $sig->( @_ );
642 0 $self->drawCursor();
643 0 $self->drawUnderView( ($self->{state} & sfShadow) != 0, $lastView );
644 0 return;
645 }
646
647 0 ▶sub drawShow { # void ($lastView|undef)
Subroutine drawShow: not called CC=2 SCAR=17.9
Pod documented
648 0 state $sig = signature(
649 method => Object,
650 pos => [Maybe[Object]],
651 );
652 0 my ( $self, $lastView ) = $sig->( @_ );
653 0 $self->drawView();
654 0 ▶ if ( $self->{state} & sfShadow ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} & 8) 0 0 0
655 0 $self->drawUnderView( true, $lastView );
656 }
657 0 return;
658 }
659
660 0 ▶sub drawUnderRect { # void ($r, $lastView|undef)
Subroutine drawUnderRect: not called CC=2 SCAR=17.9
Pod documented
661 0 state $sig = signature(
662 method => Object,
663 pos => [Object, Maybe[Object]],
664 );
665 0 my ( $self, $r, $lastView ) = $sig->( @_ );
666 0 ▶ assert ( is_Object $self->{owner} );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self->{"owner"}) 0 0 0
667 0 $self->{owner}{clip}->intersect( $r );
668 0 $self->{owner}->drawSubViews( $self->nextView(), $lastView );
669 0 $self->{owner}{clip} = $self->{owner}->getExtent();
670 0 return;
671 }
672
673 0 ▶sub drawUnderView { # void ($doShadow, $lastView|undef)
Subroutine drawUnderView: not called CC=2 SCAR=17.9
Pod documented
674 0 state $sig = signature(
675 method => Object,
676 pos => [Bool, Maybe[Object]],
677 );
678 0 my ( $self, $doShadow, $lastView ) = $sig->( @_ );
679 0 my $r = $self->getBounds();
680 0 ▶ if ( $doShadow ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($doShadow) 0 0 0
681 0 $r->{b} += $shadowSize;
682 }
683 0 $self->drawUnderRect( $r, $lastView );
684 0 return;
685 }
686
687 0 ▶sub dataSize { # $size ()
Subroutine dataSize: not called CC=1 SCAR=6.9
Pod documented
688 0 state $sig = signature(
689 method => Object,
690 pos => [],
691 );
692 0 $sig->( @_ );
693 0 return 0;
694 }
695
696 0 ▶sub getData { # void (\@rec)
Subroutine getData: not called CC=1 SCAR=6.9
Pod documented
697 0 state $sig = signature(
698 method => Object,
699 pos => [ArrayLike],
700 );
701 0 $sig->( @_ );
702 0 return;
703 }
704
705 0 ▶sub setData { # void ($rec)
Subroutine setData: not called CC=1 SCAR=6.9
Pod documented
706 0 state $sig = signature(
707 method => Object,
708 pos => [ArrayLike],
709 );
710 0 $sig->( @_ );
711 0 return;
712 }
713
714 0 ▶sub awaken { # void ()
Subroutine awaken: not called CC=1 SCAR=6.9
Pod documented
715 0 state $sig = signature(
716 method => Object,
717 pos => [],
718 );
719 0 $sig->( @_ );
720 0 return;
721 }
722
723 0 ▶sub blockCursor { # void ()
Subroutine blockCursor: not called CC=1 SCAR=6.9
Pod documented
724 0 state $sig = signature(
725 method => Object,
726 pos => [],
727 );
728 0 my ( $self ) = $sig->( @_ );
729 0 $self->setState( sfCursorIns, true );
730 0 return;
731 }
732
733 0 ▶sub normalCursor { # void ()
Subroutine normalCursor: not called CC=1 SCAR=6.9
Pod documented
734 0 state $sig = signature(
735 method => Object,
736 pos => [],
737 );
738 0 my ( $self ) = $sig->( @_ );
739 0 $self->setState( sfCursorIns, false );
740 0 return;
741 }
742
743 0 ▶sub resetCursor { # void ()
Subroutine resetCursor: not called CC=1 SCAR=6.9
Pod documented
744 0 state $sig = signature(
745 method => Object,
746 pos => [],
747 );
748 0 my ( $self ) = $sig->( @_ );
749 0 TUI::Views::View::Cursor::resetCursor( $self );
750 0 return;
751 }
752
753 0 ▶sub setCursor { # void ($x, $y)
Subroutine setCursor: not called CC=1 SCAR=6.9
Pod documented
754 0 state $sig = signature(
755 method => Object,
756 pos => [Int, Int],
757 );
758 0 my ( $self, $x, $y ) = $sig->( @_ );
759 0 $self->{cursor}{x} = $x;
760 0 $self->{cursor}{y} = $y;
761 0 $self->drawCursor();
762 0 return;
763 }
764
765 0 ▶sub showCursor { # void ()
Subroutine showCursor: not called CC=1 SCAR=6.9
Pod documented
766 0 state $sig = signature(
767 method => Object,
768 pos => [],
769 );
770 0 my ( $self ) = $sig->( @_ );
771 0 $self->setState( sfCursorVis, true );
772 0 return;
773 }
774
775 0 ▶sub drawCursor { # void ()
Subroutine drawCursor: not called CC=2 SCAR=17.9
Pod documented
776 0 state $sig = signature(
777 method => Object,
778 pos => [],
779 );
780 0 my ( $self ) = $sig->( @_ );
781 0 ▶ if ( $self->{state} & sfFocused ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} & 64) 0 0 0
782 0 $self->resetCursor();
783 }
784 0 return;
785 }
786
787 0 ▶sub clearEvent { # void ($event)
Subroutine clearEvent: not called CC=1 SCAR=6.9
Pod documented
788 0 state $sig = signature(
789 method => Object,
790 pos => [Object],
791 );
792 0 my ( $self, $event ) = $sig->( @_ );
793 0 $event->{what} = evNothing;
794 0 $event->{message} = MessageEvent->new( infoPtr => $self );
795 0 return;
796 }
797
798 0 ▶sub eventAvail { # $bool ()
Subroutine eventAvail: not called CC=2 SCAR=17.9
Pod documented
799 0 state $sig = signature(
800 method => Object,
801 pos => [],
802 );
803 0 my ( $self ) = $sig->( @_ );
804 0 my $event = TEvent->new();
805 0 $self->getEvent( $event );
806 0 ▶ if ( $event->{what} != evNothing ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} != 0) 0 0 0
807 0 $self->putEvent( $event );
808 }
809 0 return $event->{what} != evNothing;
810 }
811
812 0 ▶sub getEvent { # void ($event)
Subroutine getEvent: not called CC=2 SCAR=17.9
Pod documented
813 0 state $sig = signature(
814 method => Object,
815 pos => [Object],
816 );
817 0 my ( $self, $event ) = $sig->( @_ );
818 $self->{owner}->getEvent( $event )
819 0 ▶ if $self->{owner};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"owner"} 0 0 0
820 0 return;
821 }
822
823 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=6 SCAR=37.4
Pod documented
824 0 state $sig = signature(
825 method => Object,
826 pos => [Object],
827 );
828 0 my ( $self, $event ) = $sig->( @_ );
829 0 ▶ if ( $event->{what} == evMouseDown ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 1) 0 0 0
830 0 ▶ if ( !( $self->{state} & ( sfSelected | sfDisabled ) )
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{"state"} & 288 and $self->{"options"} & 1) 0 0 0
Condition0%0/3
not $self->{"state"} & 288 and $self->{"options"} & 1
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->{"state"} & 288 and $self->{"options"} & 1
not $self->{"state"} & 288 $self->{"options"} & 1
Truth table0%0/3
not(A) and B
A= not $self->{"state"} & 288B= $self->{"options"} & 1
ABresult
0X0
100
111
831 && ( $self->{options} & ofSelectable )
832 ) {
833 0 ▶ if ( !$self->focus() || !( $self->{options} & ofFirstClick ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->focus and $self->{"options"} & 4) 0 0 0
Condition0%0/3
$self->focus and $self->{"options"} & 4
!ll&&!rl&&r
000
MC/DC0%0/2
$self->focus and $self->{"options"} & 4
$self->focus $self->{"options"} & 4
Truth table0%0/3
A and B
A= $self->focusB= $self->{"options"} & 4
ABresult
0X0
100
111
834 0 $self->clearEvent( $event );
835 }
836 }
837 }
838 0 return;
839 } #/ sub handleEvent
840
841 0 ▶sub putEvent { # void ($event)
Subroutine putEvent: not called CC=2 SCAR=17.9
Pod documented
842 0 state $sig = signature(
843 method => Object,
844 pos => [Object],
845 );
846 0 my ( $self, $event ) = $sig->( @_ );
847 $self->{owner}->putEvent( $event )
848 0 ▶ if $self->{owner};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"owner"} 0 0 0
849 0 return;
850 }
851
852 0 ▶sub commandEnabled { # $bool ($command)
Subroutine commandEnabled: not called CC=2 SCAR=17.9
Pod documented
853 0 state $sig = signature(
854 method => 1,
855 pos => [PositiveOrZeroInt],
856 );
857 0 my ( $class, $command ) = $sig->( @_ );
858 0 ▶ return ( $command > 255 ) || $curCommandSet->has( $command );
Condition0%0/3
$command > 255 || $TUI::Views::View::curCommandSet->has($command)
l!l&&r!l&&!r
000
MC/DC0%0/2
$command > 255 || $TUI::Views::View::curCommandSet->has($command)
$command > 255 $TUI::Views::View::curCommandSet->has($command)
Truth table0%0/3
A || B
A= $command > 255B= $TUI::Views::View::curCommandSet->has($command)
ABresult
1X1
011
000
859 }
860
861 0 ▶sub disableCommands { # void ($commands)
Subroutine disableCommands: not called CC=2 SCAR=17.9
Pod documented
862 0 state $sig = signature(
863 method => 1,
864 pos => [Object],
865 );
866 0 my ( $class, $commands ) = $sig->( @_ );
867 0 ▶ $commandSetChanged ||= !( $curCommandSet & $commands )->isEmpty();
Condition0%0/3
$TUI::Views::View::commandSetChanged ||= !($TUI::Views::View::curCommandSet & $commands)->isEmpty
l!l&&r!l&&!r
000
MC/DC0%0/2
$TUI::Views::View::commandSetChanged ||= !($TUI::Views::View::curCommandSet & $commands)->isEmpty
$TUI::Views::View::commandSetChanged !($TUI::Views::View::curCommandSet & $commands)->isEmpty
Truth table0%0/3
A ||= not(B)
A= $TUI::Views::View::commandSetChangedB= !($TUI::Views::View::curCommandSet & $commands)->isEmpty
ABresult
1X1
011
000
868 0 $curCommandSet->disableCmd( $commands );
869 0 return;
870 }
871
872 0 ▶sub enableCommands { # void ($commands)
Subroutine enableCommands: not called CC=3 SCAR=24.8
Pod documented
873 0 state $sig = signature(
874 method => 1,
875 pos => [Object],
876 );
877 0 my ( $class, $commands ) = $sig->( @_ );
878 0 ▶ $commandSetChanged ||= ( $curCommandSet & $commands ) != $commands;
Condition0%0/3
$TUI::Views::View::commandSetChanged ||= ($TUI::Views::View::curCommandSet & $commands) != $commands
l!l&&r!l&&!r
000
MC/DC0%0/2
$TUI::Views::View::commandSetChanged ||= ($TUI::Views::View::curCommandSet & $commands) != $commands
$TUI::Views::View::commandSetChanged ($TUI::Views::View::curCommandSet & $commands) != $commands
Truth table0%0/3
A ||= B
A= $TUI::Views::View::commandSetChangedB= ($TUI::Views::View::curCommandSet & $commands) != $commands
ABresult
1X1
011
000
879 0 $curCommandSet += $commands;
880 0 ▶ assert ( is_Object $curCommandSet );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($TUI::Views::View::curCommandSet) 0 0 0
881 0 return;
882 }
883
884 0 ▶sub disableCommand { # void ($command)
Subroutine disableCommand: not called CC=2 SCAR=17.9
Pod documented
885 0 state $sig = signature(
886 method => 1,
887 pos => [PositiveOrZeroInt],
888 );
889 0 my ( $class, $command ) = $sig->( @_ );
890 0 ▶ $commandSetChanged ||= $curCommandSet->has( $command );
Condition0%0/3
$TUI::Views::View::commandSetChanged ||= $TUI::Views::View::curCommandSet->has($command)
l!l&&r!l&&!r
000
MC/DC0%0/2
$TUI::Views::View::commandSetChanged ||= $TUI::Views::View::curCommandSet->has($command)
$TUI::Views::View::commandSetChanged $TUI::Views::View::curCommandSet->has($command)
Truth table0%0/3
A ||= B
A= $TUI::Views::View::commandSetChangedB= $TUI::Views::View::curCommandSet->has($command)
ABresult
1X1
011
000
891 0 $curCommandSet->disableCmd( $command );
892 0 return;
893 }
894
895 0 ▶sub enableCommand { # void ($command)
Subroutine enableCommand: not called CC=2 SCAR=17.9
Pod documented
896 0 state $sig = signature(
897 method => 1,
898 pos => [PositiveOrZeroInt],
899 );
900 0 my ( $class, $command ) = $sig->( @_ );
901 0 ▶ $commandSetChanged ||= !$curCommandSet->has( $command );
Condition0%0/3
$TUI::Views::View::commandSetChanged ||= !$TUI::Views::View::curCommandSet->has($command)
l!l&&r!l&&!r
000
MC/DC0%0/2
$TUI::Views::View::commandSetChanged ||= !$TUI::Views::View::curCommandSet->has($command)
$TUI::Views::View::commandSetChanged !$TUI::Views::View::curCommandSet->has($command)
Truth table0%0/3
A ||= not(B)
A= $TUI::Views::View::commandSetChangedB= !$TUI::Views::View::curCommandSet->has($command)
ABresult
1X1
011
000
902 0 $curCommandSet += $command;
903 0 return;
904 }
905
906 0 ▶sub getCommands { # void ($commands)
Subroutine getCommands: not called CC=1 SCAR=6.9
Pod documented
907 0 state $sig = signature(
908 method => 1,
909 pos => [Object],
910 );
911 0 my ( $class, $commands ) = $sig->( @_ );
912 0 @$commands = @$curCommandSet;
913 0 return;
914 }
915
916 0 ▶sub setCommands { # void ($commands)
Subroutine setCommands: not called CC=2 SCAR=17.9
Pod documented
917 0 state $sig = signature(
918 method => 1,
919 pos => [Object],
920 );
921 0 my ( $class, $commands ) = $sig->( @_ );
922 0 ▶ $commandSetChanged ||= $curCommandSet != $commands;
Condition0%0/3
$TUI::Views::View::commandSetChanged ||= $TUI::Views::View::curCommandSet != $commands
l!l&&r!l&&!r
000
MC/DC0%0/2
$TUI::Views::View::commandSetChanged ||= $TUI::Views::View::curCommandSet != $commands
$TUI::Views::View::commandSetChanged $TUI::Views::View::curCommandSet != $commands
Truth table0%0/3
A ||= B
A= $TUI::Views::View::commandSetChangedB= $TUI::Views::View::curCommandSet != $commands
ABresult
1X1
011
000
923 0 @$curCommandSet = @$commands;
924 0 return;
925 }
926
927 0 ▶sub setCmdState { # void ($commands, $enable)
Subroutine setCmdState: not called CC=2 SCAR=17.9
Pod documented
928 0 state $sig = signature(
929 method => 1,
930 pos => [Object, Bool],
931 );
932 0 my ( $class, $commands, $enable ) = $sig->( @_ );
933 0 ▶ $enable
Branch: 1 branch
BranchTrueFalseTotal
$enable ? : 0 0 0
934 ? $class->enableCommands( $commands )
935 : $class->disableCommands( $commands );
936 0 return;
937 }
938
939 0 ▶sub endModal { # void ($command)
Subroutine endModal: not called CC=2 SCAR=17.9
Pod documented
940 0 state $sig = signature(
941 method => Object,
942 pos => [PositiveOrZeroInt],
943 );
944 0 my ( $self, $command ) = $sig->( @_ );
945 0 ▶ if ( $self->TopView() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->TopView) 0 0 0
946 0 $self->TopView()->endModal( $command );
947 }
948 0 return;
949 }
950
951 0 ▶sub execute { # $cmd ()
Subroutine execute: not called CC=1 SCAR=6.9
Pod documented
952 0 state $sig = signature(
953 method => Object,
954 pos => [],
955 );
956 0 $sig->( @_ );
957 0 return cmCancel;
958 }
959
960 0 ▶sub getColor { # $pair ($color)
Subroutine getColor: not called CC=4 SCAR=30.0
Pod documented
961 0 state $sig = signature(
962 method => Object,
963 pos => [PositiveOrZeroInt],
964 );
965 0 my ( $self, $color ) = $sig->( @_ );
966
967 # Get the high and low color values from the color integer
968 0 my $hi = ( $color >> 8 ) & 0xff;
969 0 my $lo = $color & 0xff;
970
971 # Map the color values to the actual colors in the palette
972 0 ▶ $hi = $self->mapColor( $hi ) if $hi;
Branch: 1 branch
BranchTrueFalseTotal
if $hi 0 0 0
973 0 $lo = $self->mapColor( $lo );
974
975 # no objects, just return the color value as an integer
976 0 ▶ return ( $hi << 8 ) | $lo
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hi and ref $lo 0 0 0
Condition0%0/3
ref $hi and ref $lo
!ll&&!rl&&r
000
MC/DC0%0/2
ref $hi and ref $lo
ref $hi ref $lo
Truth table0%0/3
A and B
A= ref $hiB= ref $lo
ABresult
0X0
100
111
977 unless ref $hi && ref $lo;
978
979 # objects, return a TAttrPair object with the high and low colors
980 0 return TAttrPair->new(
981 hi => $hi->$coerceAttr(),
982 lo => $lo->$coerceAttr(),
983 );
984 }
985
986 0 ▶sub getPalette { # $palette ()
Subroutine getPalette: not called CC=1 SCAR=6.9
Pod documented
987 0 state $sig = signature(
988 method => Object,
989 pos => [],
990 );
991 0 my ( $self ) = $sig->( @_ );
992 0 state $palette = TPalette->new( data => "\0", size => 0 );
993 0 return $palette->clone();
994 }
995
996 0 ▶sub mapColor { # $attr ($index)
Subroutine mapColor: not called CC=6 SCAR=37.4
Pod documented
997 0 state $sig = signature(
998 method => Object,
999 pos => [PositiveOrZeroInt],
1000 );
1001 0 my ( $self, $index ) = $sig->( @_ );
1002
1003 0 my $p = $self->getPalette();
1004 0 my $color;
1005 0 ▶ if ( $p->[0] != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p->[0] != 0) { } 0 0 0
1006 0 ▶ if ( 0 < $index && $index <= $p->[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 < $index and $index <= $p->[0]) { } 0 0 0
Condition0%0/3
0 < $index and $index <= $p->[0]
!ll&&!rl&&r
000
MC/DC0%0/2
0 < $index and $index <= $p->[0]
0 < $index $index <= $p->[0]
Truth table0%0/3
A and B
A= 0 < $indexB= $index <= $p->[0]
ABresult
0X0
100
111
1007 0 $color = STRICT ? $p->at( $index ) : $p->[$index];
1008 }
1009 else {
1010 0 return $errorAttr;
1011 }
1012 }
1013 else {
1014 0 $color = $index;
1015 }
1016 0 ▶ return $errorAttr
Branch: 1 branch
BranchTrueFalseTotal
if $color == 0 0 0 0
1017 if $color == 0;
1018 return $self->{owner}->mapColor( $color )
1019 0 ▶ if $self->{owner};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"owner"} 0 0 0
1020 0 return $color;
1021 } #/ sub mapColor
1022
1023 0 ▶sub getState { # $bool ($aState)
Subroutine getState: not called CC=1 SCAR=6.9
Pod documented
1024 0 state $sig = signature(
1025 method => Object,
1026 pos => [PositiveOrZeroInt],
1027 );
1028 0 my ( $self, $aState ) = $sig->( @_ );
1029 0 return ( $self->{state} & $aState ) == $aState;
1030 }
1031
1032 0 ▶sub select :method { # void ()
Subroutine select: not called CC=4 SCAR=30.0
Pod documented
1033 0 state $sig = signature(
1034 method => Object,
1035 pos => [],
1036 );
1037 0 my ( $self ) = $sig->( @_ );
1038 return
1039 0 ▶ unless $self->{options} & ofSelectable;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"options"} & 1 0 0 0
1040 0 ▶ if ( $self->{options} & ofTopSelect ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'options'} & 2) { } 0 0 0
elsif ($self->{'owner'}) { } 0 0 0
1041 0 $self->makeFirst();
1042 }
1043 elsif ( $self->{owner} ) {
1044 0 $self->{owner}->setCurrent( $self, normalSelect );
1045 }
1046 0 return;
1047 } #/ sub select
1048
1049 0 ▶sub setState { # void ($aState, $enable)
Subroutine setState: not called CC=13 SCAR=52.0
Pod documented
1050 0 state $sig = signature(
1051 method => Object,
1052 pos => [PositiveOrZeroInt, Bool],
1053 );
1054 0 my ( $self, $aState, $enable ) = $sig->( @_ );
1055
1056 0 ▶ if ( $enable ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($enable) { } 0 0 0
1057 0 $self->{state} |= $aState;
1058 }
1059 else {
1060 0 $self->{state} &= ~$aState;
1061 }
1062
1063 return
1064 0 ▶ unless $self->{owner};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"owner"} 0 0 0
1065
1066 0 SWITCH: for ( $aState ) {
1067 0 ▶ sfVisible == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
1 == $_ and do { if ($self->{"owner"}{"state"} & 2048) { $self->setState(2048, $enable); } ; if ($enable) { $self->drawShow(undef); } else { $self->drawHide(undef); } ; if ($self->{"options"} & 1) { $self->{"owner"}->resetCurrent; } ; last } 0 0 0
1068 0 ▶ if ( $self->{owner}{state} & sfExposed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"owner"}{"state"} & 2048) 0 0 0
1069 0 $self->setState( sfExposed, $enable );
1070 }
1071 0 ▶ if ( $enable ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($enable) { } 0 0 0
1072 0 $self->drawShow( undef );
1073 }
1074 else {
1075 0 $self->drawHide( undef );
1076 }
1077 0 ▶ if ( $self->{options} & ofSelectable ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"options"} & 1) 0 0 0
1078 0 $self->{owner}->resetCurrent();
1079 }
1080 0 last;
1081 };
1082 sfCursorVis == $_ ||
1083 0 ▶ sfCursorIns == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
2 == $_ || 4 == $_ and do { $self->drawCursor; last } 0 0 0
Condition0%0/3
2 == $_ or 4 == $_
l!l&&r!l&&!r
000
MC/DC0%0/2
2 == $_ or 4 == $_
2 == $_ 4 == $_
Truth table0%0/3
A or B
A= 2 == $_B= 4 == $_
ABresult
1X1
011
000
1084 0 $self->drawCursor();
1085 0 last;
1086 };
1087 0 ▶ sfShadow == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
8 == $_ and 0 0 0
1088 0 $self->drawUnderView( true, undef );
1089 0 last;
1090 };
1091 0 ▶ sfFocused == $_ and do {
Branch: 1 branch
BranchTrueFalseTotal
64 == $_ and do { $self->resetCursor; message($self->{"owner"}, 512, $enable ? 50 : 51, $self); last } 0 0 0
1092 0 $self->resetCursor();
1093 message(
1094 $self->{owner},
1095 0 ▶ evBroadcast,
Branch: 1 branch
BranchTrueFalseTotal
$enable ? : 0 0 0
1096 $enable ? cmReceivedFocus : cmReleasedFocus,
1097 $self
1098 );
1099 0 last;
1100 };
1101 } #/ SWITCH: for ( $aState )
1102 0 return;
1103 } #/ sub setState
1104
1105 0 ▶sub keyEvent { # void ($event)
Subroutine keyEvent: not called CC=2 SCAR=17.9
Pod documented
1106 0 state $sig = signature(
1107 method => Object,
1108 pos => [Object],
1109 );
1110 0 my ( $self, $event ) = $sig->( @_ );
1111 do {
1112 0 $self->getEvent( $event );
1113 0 ▶ } while ( $event->{what} != evKeyDown );
Branch: 1 branch
BranchTrueFalseTotal
$event->{"what"} != 16 and do { do { $self->getEvent($event) } } 0 0 0
1114 0 return;
1115 }
1116
1117 0 ▶sub mouseEvent { # bool ($event, $mask)
Subroutine mouseEvent: not called CC=2 SCAR=17.9
Pod documented
1118 0 state $sig = signature(
1119 method => Object,
1120 pos => [Object, PositiveOrZeroInt],
1121 );
1122 0 my ( $self, $event, $mask ) = $sig->( @_ );
1123 do {
1124 0 $self->getEvent( $event );
1125 0 ▶ } while ( !( $event->{what} & ( $mask | evMouseUp ) ) );
Branch: 1 branch
BranchTrueFalseTotal
$event->{"what"} & ($mask | 2) or do { do { $self->getEvent($event) } } 0 0 0
1126
1127 0 return $event->{what} != evMouseUp;
1128 }
1129
1130 0 ▶sub makeGlobal { # $point ($source)
Subroutine makeGlobal: not called CC=2 SCAR=17.9
Pod documented
1131 0 state $sig = signature(
1132 method => Object,
1133 pos => [Object],
1134 );
1135 0 my ( $self, $source ) = $sig->( @_ );
1136 0 my $temp = $source + $self->{origin};
1137 0 my $cur = $self;
1138 0 ▶ while ( $cur->{owner} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cur->{"owner"}) 0 0 0
1139 0 $cur = $cur->{owner};
1140 0 $temp += $cur->{origin};
1141 }
1142 0 return $temp;
1143 } #/ sub makeGlobal
1144
1145 0 ▶sub makeLocal { # $point ($source)
Subroutine makeLocal: not called CC=2 SCAR=17.9
Pod documented
1146 0 state $sig = signature(
1147 method => Object,
1148 pos => [Object],
1149 );
1150 0 my ( $self, $source ) = $sig->( @_ );
1151 0 my $temp = $source - $self->{origin};
1152 0 my $cur = $self;
1153 0 ▶ while ( $cur->{owner} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cur->{"owner"}) 0 0 0
1154 0 $cur = $cur->{owner};
1155 0 $temp -= $cur->{origin};
1156 }
1157 0 return $temp;
1158 } #/ sub makeLocal
1159
1160 0 ▶sub nextView { # $view|undef ()
Subroutine nextView: not called CC=3 SCAR=18.7
Pod documented
1161 0 state $sig = signature(
1162 method => Object,
1163 pos => [],
1164 );
1165 0 my ( $self ) = $sig->( @_ );
1166 133 ▶ no warnings qw( uninitialized numeric );
Subroutine BEGIN: called CC=1 SCAR=0.0
1167 return !$self->{owner} || $self == $self->{owner}{last}
1168 ? undef
1169 0 ▶ : $self->{next};
Branch: 1 branch
BranchTrueFalseTotal
!$self->{'owner'} || $self == $self->{'owner'}{'last'} ? : 0 0 0
Condition0%0/3
not $self->{"owner"} or $self == $self->{"owner"}{"last"}
l!l&&r!l&&!r
000
MC/DC0%0/2
not $self->{"owner"} or $self == $self->{"owner"}{"last"}
not $self->{"owner"} $self == $self->{"owner"}{"last"}
Truth table0%0/3
not(A) or B
A= not $self->{"owner"}B= $self == $self->{"owner"}{"last"}
ABresult
1X1
011
000
1170 }
1171
1172 0 ▶sub prevView { # $view|undef ()
Subroutine prevView: not called CC=3 SCAR=18.7
Pod documented
1173 0 state $sig = signature(
1174 method => Object,
1175 pos => [],
1176 );
1177 0 my ( $self ) = $sig->( @_ );
1178 133 ▶ no warnings qw( uninitialized numeric );
Subroutine BEGIN: called CC=1 SCAR=0.0
1179 return !$self->{owner} || $self == $self->{owner}->first()
1180 0 ▶ ? undef
Branch: 1 branch
BranchTrueFalseTotal
!$self->{'owner'} || $self == $self->{'owner'}->first ? : 0 0 0
Condition0%0/3
not $self->{"owner"} or $self == $self->{"owner"}->first
l!l&&r!l&&!r
000
MC/DC0%0/2
not $self->{"owner"} or $self == $self->{"owner"}->first
not $self->{"owner"} $self == $self->{"owner"}->first
Truth table0%0/3
not(A) or B
A= not $self->{"owner"}B= $self == $self->{"owner"}->first
ABresult
1X1
011
000
1181 : $self->prev();
1182 }
1183
1184 0 ▶sub prev { # $view|undef ()
Subroutine prev: not called CC=3 SCAR=20.0
Pod documented
1185 0 state $sig = signature(
1186 method => Object,
1187 pos => [],
1188 );
1189 0 my ( $self ) = $sig->( @_ );
1190 133 ▶ no warnings qw( uninitialized numeric );
Subroutine BEGIN: called CC=1 SCAR=0.0
1191 0 my $res = $self;
1192 0 ▶ while ( $res->{next} != $self ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->{"next"} != $self) 0 0 0
1193 0 ▶ return undef unless $res->{next};
Branch: 1 branch
BranchTrueFalseTotal
unless $res->{"next"} 0 0 0
1194 0 $res = $res->{next};
1195 }
1196 0 return $res;
1197 }
1198
1199 0 ▶sub next { # $view|undef (|$view|undef)
Subroutine next: not called CC=2 SCAR=17.9
Pod documented
1200 0 state $sig = signature(
1201 method => Object,
1202 pos => [
1203 Maybe[Object], { optional => 1 },
1204 ],
1205 );
1206 0 my ( $self, $view ) = $sig->( @_ );
1207 0 ▶ goto SET if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 0 0
1208 GET: {
1209 0 return $self->{next};
1210 }
1211 SET: {
1212 0 &$unlock_value( $self->{next} ) if STRICT;
1213 0 $self->{next} = $view;
1214 0 &$lock_value( $self->{next} ) if STRICT;
1215 0 return;
1216 }
1217 } #/ sub next
1218
1219 0 ▶sub makeFirst { # $void ()
Subroutine makeFirst: not called CC=2 SCAR=17.9
Pod documented
1220 0 state $sig = signature(
1221 method => Object,
1222 pos => [],
1223 );
1224 0 my ( $self ) = $sig->( @_ );
1225 $self->putInFrontOf( $self->{owner}->first() )
1226 0 ▶ if $self->{owner};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"owner"} 0 0 0
1227 0 return;
1228 }
1229
1230 0 ▶sub putInFrontOf { # void ($target|undef)
Subroutine putInFrontOf: not called CC=13 SCAR=50.4
Pod documented
1231 0 state $sig = signature(
1232 method => Object,
1233 pos => [Maybe[Object]],
1234 );
1235 0 my ( $self, $target ) = $sig->( @_ );
1236 133 ▶ no warnings qw( uninitialized numeric );
Subroutine BEGIN: called CC=1 SCAR=0.0
1237
1238 0 ▶ if ( $self->{owner}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"owner"} and $target != $self and $target != $self->nextView and !$target || $target->{"owner"} == $self->{"owner"}) 0 0 0
Condition0%0/12
$self->{"owner"} and $target != $self and $target != $self->nextView and !$target || $target->{"owner"} == $self->{"owner"}
!ll&&!rl&&r
000
$self->{"owner"} and $target != $self and $target != $self->nextView
!ll&&!rl&&r
000
$self->{"owner"} and $target != $self
!ll&&!rl&&r
000
not $target or $target->{"owner"} == $self->{"owner"}
l!l&&r!l&&!r
000
MC/DC0%0/5
$self->{"owner"} and $target != $self and $target != $self->nextView and !$target || $target->{"owner"} == $self->{"owner"}
$self->{"owner"} $target != $self $target != $self->nextView not $target $target->{"owner"} == $self->{"owner"}
Truth table0%0/6
A and B and C and not(D) or E
A= $self->{"owner"}B= $target != $selfC= $target != $self->nextViewD= not $targetE= $target->{"owner"} == $self->{"owner"}
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
1239 && $target != $self
1240 && $target != $self->nextView()
1241 && ( !$target || $target->{owner} == $self->{owner} ) )
1242 {
1243 0 ▶ if ( !( $self->{state} & sfVisible ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{'state'} & 1) { } 0 0 0
1244 0 $self->{owner}->removeView( $self );
1245 0 $self->{owner}->insertView( $self, $target );
1246 }
1247 else {
1248 0 my $lastView = $self->nextView();
1249 0 my $p = $target;
1250 0 ▶ while ( $p && $p != $self ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p and $p != $self) 0 0 0
Condition0%0/3
$p and $p != $self
!ll&&!rl&&r
000
MC/DC0%0/2
$p and $p != $self
$p $p != $self
Truth table0%0/3
A and B
A= $pB= $p != $self
ABresult
0X0
100
111
1251 0 $p = $p->nextView();
1252 }
1253 0 ▶ $lastView = $target
Branch: 1 branch
BranchTrueFalseTotal
unless $p 0 0 0
1254 if !$p;
1255 0 $self->{state} &= ~sfVisible;
1256 0 ▶ $self->drawHide( $lastView )
Branch: 1 branch
BranchTrueFalseTotal
if $lastView == $target 0 0 0
1257 if $lastView == $target;
1258 0 $self->{owner}->removeView( $self );
1259 0 $self->{owner}->insertView( $self, $target );
1260 0 $self->{state} |= sfVisible;
1261 0 ▶ $self->drawShow( $lastView )
Branch: 1 branch
BranchTrueFalseTotal
if $lastView != $target 0 0 0
1262 if $lastView != $target;
1263 $self->{owner}->resetCurrent()
1264 0 ▶ if $self->{options} & ofSelectable;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"options"} & 1 0 0 0
1265 } #/ else [ if ( !( $self->{state}...))]
1266 } #/ if ( $self->{owner} &&...)
1267 0 return;
1268 } #/ sub putInFrontOf
1269
1270 0 ▶sub TopView { # $view ()
Subroutine TopView: not called CC=4 SCAR=30.0
Pod documented
1271 0 state $sig = signature(
1272 method => Object,
1273 pos => [],
1274 );
1275 0 my ( $self ) = $sig->( @_ );
1276 0 ▶ return $TheTopView
Branch: 1 branch
BranchTrueFalseTotal
if $TUI::Views::View::TheTopView 0 0 0
1277 if $TheTopView;
1278
1279 0 my $p = $self;
1280 0 ▶ while ( $p && !( $p->{state} & sfModal ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p and not $p->{"state"} & 512) 0 0 0
Condition0%0/3
$p and not $p->{"state"} & 512
!ll&&!rl&&r
000
MC/DC0%0/2
$p and not $p->{"state"} & 512
$p not $p->{"state"} & 512
Truth table0%0/3
A and not(B)
A= $pB= not $p->{"state"} & 512
ABresult
0X0
100
111
1281 0 $p = $p->{owner};
1282 }
1283 0 return $p;
1284 } #/ sub TopView
1285
1286 0 ▶sub writeBuf { # void ($x, $y, $w, $h, $b)
Subroutine writeBuf: not called CC=3 SCAR=24.8
Pod documented
1287 0 state $sig = signature(
1288 method => Object,
1289 pos => [Int, Int, Int, Int, ArrayLike],
1290 );
1291 0 my ( $self, $x, $y, $w, $h, $b ) = $sig->( @_ );
1292 0 ▶ while ( $h-- > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($h-- > 0) 0 0 0
1293 0 $self->$writeView( $x, $y++, $w, $b );
1294 0 ▶ alias: $b = sub { \@_ }->( @$b[ $w .. $#$b ] ) if $h;
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $h 0 0 0
1295 }
1296 0 return;
1297 }
1298
1299 0 ▶sub writeChar { # void ($x, $y, $c, $color, $count)
Subroutine writeChar: not called CC=2 SCAR=17.9
Pod documented
1300 0 state $sig = signature(
1301 method => Object,
1302 pos => [Int, Int, Str, PositiveOrZeroInt, Int],
1303 );
1304 0 my ( $self, $x, $y, $c, $color, $count ) = $sig->( @_ );
1305 0 ▶ if ( $count > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count > 0) 0 0 0
1306 0 my $attr = $self->mapColor( $color )->$coerceAttr();
1307 0 my $cell = TScreenCell->new( ch => $c, attr => $attr );
1308 my $buf = [
1309 0 map { $cell->clone() } 1 .. $count
1310 ];
1311 0 $self->$writeView( $x, $y, $count, $buf );
1312 }
1313 0 return;
1314 }
1315
1316 0 ▶sub writeLine { # void ($x, $y, $w, $h, $b)
Subroutine writeLine: not called CC=2 SCAR=17.9
Pod documented
1317 0 state $sig = signature(
1318 method => Object,
1319 pos => [Int, Int, Int, Int, ArrayLike],
1320 );
1321 0 my ( $self, $x, $y, $w, $h, $b ) = $sig->( @_ );
1322 0 ▶ while ( $h-- > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($h-- > 0) 0 0 0
1323 0 $self->$writeView( $x, $y++, $w, $b );
1324 }
1325 0 return;
1326 }
1327
1328 0 ▶sub writeStr { # void ($x, $y, $str, $color)
Subroutine writeStr: not called CC=3 SCAR=24.8
Pod documented
1329 0 state $sig = signature(
1330 method => Object,
1331 pos => [Int, Int, Str, PositiveOrZeroInt],
1332 );
1333 0 my ( $self, $x, $y, $str, $color ) = $sig->( @_ );
1334 0 ▶ if ( defined $str ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $str) 0 0 0
1335 0 my $length = length( $str );
1336 0 ▶ if ( $length > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length > 0) 0 0 0
1337 0 my $attr = $self->mapColor( $color )->$coerceAttr();
1338 my $buf = [
1339 0 map { TScreenCell->new( ch => $_, attr => $attr ) } split //, $str
1340 ];
1341 0 $self->$writeView( $x, $y, $length, $buf );
1342 }
1343 }
1344 0 return;
1345 } #/ sub writeStr
1346
1347 0 ▶sub owner { # $group|undef (|$group|undef)
Subroutine owner: not called CC=3 SCAR=24.8
Pod documented
1348 0 state $sig = signature(
1349 method => Object,
1350 pos => [
1351 Maybe[Object], { optional => 1 },
1352 ],
1353 );
1354 0 my ( $self, $group ) = $sig->( @_ );
1355 0 ▶ goto SET if @_ > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 0 0
1356 GET: {
1357 0 return $self->{owner};
1358 }
1359 SET: {
1360 0 &$unlock_value( $self->{owner} ) if STRICT;
1361 weaken $self->{owner}
1362 0 ▶ if $self->{owner} = $group;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"owner"} = $group 0 0 0
1363 0 &$lock_value( $self->{owner} ) if STRICT;
1364 }
1365 0 return;
1366 }
1367
1368 0 ▶sub shutDown { # void ()
Subroutine shutDown: not called CC=2 SCAR=17.9
Pod documented
1369 0 state $sig = signature(
1370 method => Object,
1371 pos => [],
1372 );
1373 0 my ( $self ) = $sig->( @_ );
1374 0 $self->hide();
1375 0 ▶ if ( $self->{owner} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"owner"}) 0 0 0
1376 0 $self->{owner}->remove( $self );
1377 }
1378 0 $self->SUPER::shutDown();
1379 0 return;
1380 }
1381
1382 0 ▶$moveGrow = sub {
Subroutine __ANON__: not called CC=13 SCAR=52.0
1383 0 my ( $self, $p, $s, $limits, $minSize, $maxSize, $mode ) = @_;
1384 0 ▶ assert ( @_ == 7 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 7 0 0 0
1385 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
1386 0 ▶ assert ( is_Object $p );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($p) 0 0 0
1387 0 ▶ assert ( is_Object $s );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($s) 0 0 0
1388 0 ▶ assert ( is_HashLike $limits );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_HashLike($limits) 0 0 0
1389 0 ▶ assert ( is_HashLike $minSize );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_HashLike($minSize) 0 0 0
1390 0 ▶ assert ( is_HashLike $maxSize );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_HashLike($maxSize) 0 0 0
1391 0 ▶ assert ( is_PositiveOrZeroInt $mode );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_PositiveOrZeroInt($mode) 0 0 0
1392
1393 0 $p = $p->clone();
1394 0 $s = $s->clone();
1395
1396 0 $s->{x} = min( max( $s->{x}, $minSize->{x} ), $maxSize->{x} );
1397 0 $s->{y} = min( max( $s->{y}, $minSize->{y} ), $maxSize->{y} );
1398 $p->{x} = min(
1399 max( $p->{x}, $limits->{a}{x} - $s->{x} + 1 ),
1400 0 $limits->{b}{x} - 1
1401 );
1402 $p->{y} = min(
1403 max( $p->{y}, $limits->{a}{y} - $s->{y} + 1 ),
1404 0 $limits->{b}{y} - 1
1405 );
1406
1407 0 ▶ if ( $mode & dmLimitLoX ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode & 16) 0 0 0
1408 0 $p->{x} = max( $p->{x}, $limits->{a}{x} );
1409 }
1410 0 ▶ if ( $mode & dmLimitLoY ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode & 32) 0 0 0
1411 0 $p->{y} = max( $p->{y}, $limits->{a}{y} );
1412 }
1413 0 ▶ if ( $mode & dmLimitHiX ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode & 64) 0 0 0
1414 0 $p->{x} = min( $p->{x}, $limits->{b}{x} - $s->{x} );
1415 }
1416 0 ▶ if ( $mode & dmLimitHiY ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mode & 128) 0 0 0
1417 0 $p->{y} = min( $p->{y}, $limits->{b}{y} - $s->{y} );
1418 }
1419
1420 my $r = TRect->new(
1421 ax => $p->{x},
1422 ay => $p->{y},
1423 bx => $p->{x} + $s->{x},
1424 by => $p->{y} + $s->{y},
1425 0 );
1426 0 $self->locate( $r );
1427 0 return;
1428 133 }; #/ $moveGrow = sub
1429
1430 0 ▶$change = sub { # void ($mode, $delta, $p, $s, $ctrlState)
Subroutine __ANON__: not called CC=12 SCAR=50.5
1431 0 my ( $self, $mode, $delta, $p, $s, $ctrlState ) = @_;
1432 0 ▶ assert ( @_ == 6 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 6 0 0 0
1433 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
1434 0 ▶ assert ( is_PositiveOrZeroInt $mode );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_PositiveOrZeroInt($mode) 0 0 0
1435 0 ▶ assert ( is_Object $delta );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($delta) 0 0 0
1436 0 ▶ assert ( is_Object $p );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($p) 0 0 0
1437 0 ▶ assert ( is_Object $s );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($s) 0 0 0
1438 0 ▶ assert ( is_PositiveOrZeroInt $ctrlState );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_PositiveOrZeroInt($ctrlState) 0 0 0
1439 0 ▶ if ( ( $mode & dmDragMove ) && !( $ctrlState & !kbShift ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($mode & 1 and not $ctrlState & !1) { } 0 0 0
elsif ($mode & 2 and $ctrlState & 3) { } 0 0 0
Condition0%0/3
$mode & 1 and
!ll&&!rl&&r
000
MC/DC0%0/2
$mode & 1 and
$mode & 1
Truth table0%0/3
A and not(B)
A= $mode & 1B=
ABresult
0X0
100
111
1440 0 $p += $delta;
1441 }
1442 ▶ elsif ( ( $mode & dmDragGrow ) && ( $ctrlState & kbShift ) ) {
Condition0%0/3
$mode & 2 and $ctrlState & 3
!ll&&!rl&&r
000
MC/DC0%0/2
$mode & 2 and $ctrlState & 3
$mode & 2 $ctrlState & 3
Truth table0%0/3
A and B
A= $mode & 2B= $ctrlState & 3
ABresult
0X0
100
111
1443 0 $s += $delta;
1444 }
1445 0 return;
1446 133 };
1447
1448 0 ▶$writeView = sub { # void ($x, $y, $count, $b)
Subroutine __ANON__: not called CC=7 SCAR=40.3
1449 0 my ( $self, $x, $y, $count, $b ) = @_;
1450 0 ▶ assert ( @_ == 5 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 5 0 0 0
1451 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
1452 0 ▶ assert ( is_Int $x );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($x) 0 0 0
1453 0 ▶ assert ( is_Int $y );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($y) 0 0 0
1454 0 ▶ assert ( is_Int $count );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Int($count) 0 0 0
1455 0 ▶ assert ( is_ArrayLike $b );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_ArrayLike($b) 0 0 0
1456 0 TUI::Views::View::Write::L0( $self, $x, $y, $count, $b );
1457 0 return;
1458 133 };
1459
1460 0 ▶sub STORABLE_freeze { # @list ($cloning)
Subroutine STORABLE_freeze: not called CC=4 SCAR=30.0
Pod undocumented
1461 0 my ( $self, $cloning ) = @_;
1462 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
1463 0 ▶ assert ( is_Bool $cloning );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Bool($cloning) 0 0 0
1464 0 ▶ assert ( not $cloning );
Branch: 1 branch
BranchTrueFalseTotal
if $cloning 0 0 0
1465
1466 0 my $stream = TStream->new();
1467 0 $self->write( $stream );
1468 0 return freeze $stream;
1469 }
1470
1471 0 ▶sub STORABLE_attach { # $obj ($cloning, $serialized)
Subroutine STORABLE_attach: not called CC=5 SCAR=34.0
Pod undocumented
1472 0 my ( $class, $cloning, $serialized ) = @_;
1473 0 ▶ assert ( is_Str $class );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Str($class) 0 0 0
1474 0 ▶ assert ( is_Bool $cloning );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Bool($cloning) 0 0 0
1475 0 ▶ assert ( is_Str $serialized );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Str($serialized) 0 0 0
1476 0 ▶ assert ( not $cloning );
Branch: 1 branch
BranchTrueFalseTotal
if $cloning 0 0 0
1477
1478 0 my $self = $class->build();
1479 0 my $stream = thaw $serialized;
1480 0 return $self->read( $stream );
1481 }
1482
1483 0 ▶sub build { # $obj ()
Subroutine build: not called CC=4 SCAR=30.0
Pod undocumented
1484 0 my ( $class ) = @_;
1485 0 ▶ assert ( @_ == 1 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 1 0 0 0
1486 0 ▶ assert ( is_Str $class );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Str($class) 0 0 0
1487 0 ▶ assert ( Storable::is_retrieving );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_retrieving() 0 0 0
1488 0 return $class->new(
1489 bounds => TRect->new(),
1490 );
1491 }
1492
1493 0 ▶sub write :method { # void ($os)
Subroutine write: not called CC=2 SCAR=17.9
Pod undocumented
1494 0 state $sig = signature(
1495 method => Object,
1496 pos => [Object],
1497 );
1498 0 my ( $self, $os ) = $sig->( @_ );
1499 0 ▶ assert ( Storable::is_storing );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_storing() 0 0 0
1500
1501 my $saveState =
1502 0 $self->{state} & ~( sfActive | sfSelected | sfFocused | sfExposed );
1503
1504 $os->put(
1505 $self->{origin}, $self->{size}, $self->{cursor},
1506 $self->{growMode}, $self->{dragMode}, $self->{helpCtx},
1507 $saveState, $self->{options}, $self->{eventMask},
1508 0 );
1509
1510 0 return;
1511 }
1512
1513 0 ▶sub read :method { # $self ($is)
Subroutine read: not called CC=2 SCAR=17.9
Pod undocumented
1514 0 state $sig = signature(
1515 method => Object,
1516 pos => [Object],
1517 );
1518 0 my ( $self, $is ) = $sig->( @_ );
1519 0 ▶ assert ( Storable::is_retrieving );
Branch: 1 branch
BranchTrueFalseTotal
unless &Storable::is_retrieving() 0 0 0
1520
1521 0 $self->{origin} = $is->get();
1522 0 $self->{size} = $is->get();
1523 0 $self->{cursor} = $is->get();
1524 0 $self->{growMode} = $is->get();
1525 0 $self->{dragMode} = $is->get();
1526 0 $self->{helpCtx} = $is->get();
1527 0 $self->{state} = $is->get();
1528 0 $self->{options} = $is->get();
1529 0 $self->{eventMask} = $is->get();
1530 0 $self->owner( undef );
1531 0 $self->next( undef );
1532
1533 0 return $self;
1534 }
1535
1536 133 1
1537
1538 __END__
« lib/TUI/Menus/StatusLine.pm ↑ Summary lib/TUI/Gadgets/PuzzleView.pm »