lib/TUI/Views/View.pm

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