lib/TUI/App/Program.pm

filter: Statementstmt 39.7% 128 / 322 Branchbran 1.3% 1 / 72 Conditioncond 0.0% 0 / 33 MC/DCmcdc 0.0% 0 / 21 Subroutinesub 53.3% 32 / 60 Podpod 95.8% 23 / 24 totaltotal 34.5% 184 / 532 CC 50 SCAR 33.7
CC
50
Cov
30%
BUILD
90.0
getEvent
89.1
handleEvent
72.0
CRAP 29.0
« lib/TUI/StdDlg/Dir.pm ↑ Summary lib/TUI/Drivers/ColorAttr.pm »
1 package TUI::App::Program;
2 # ABSTRACT: Central program object handling events, menus and desktop
3
4 37 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 37 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 37 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 37 our $VERSION = '2.000002';
9 37 $VERSION =~ tr/_//d;
10 37 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 37 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 37 our @EXPORT = qw(
14 TProgram
15 new_TProgram
16 );
17 37 our @EXPORT_OK = qw(
18 $application
19 $deskTop
20 );
21
22 37 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23 37 ▶use List::Util qw( min );
Subroutine BEGIN: called CC=1 SCAR=0.0
24 37 ▶use Scalar::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
25 weaken
26 isweak
27 37 );
28 37 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 37 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
30 Maybe
31 :is
32 :types
33 37 );
34
35 37 ▶use TUI::App::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
36 :apXXXX
37 :cpXXXX
38 37 );
39 37 ▶use TUI::App::DeskTop;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 37 ▶use TUI::App::ProgInit;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 37 ▶use TUI::Drivers::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
42 :evXXXX
43 :kbXXXX
44 :smXXXX
45 37 );
46 37 ▶use TUI::Drivers::Event;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 37 ▶use TUI::Drivers::EventQueue;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 37 ▶use TUI::Drivers::Screen;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 37 ▶use TUI::Drivers::Util qw( getAltChar );
Subroutine BEGIN: called CC=1 SCAR=0.0
50 37 ▶use TUI::Menus::MenuBar;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 37 ▶use TUI::Menus::StatusDef;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 37 ▶use TUI::Menus::StatusItem;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 37 ▶use TUI::Menus::StatusLine;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 37 ▶use TUI::Memory qw( lowMemory );
Subroutine BEGIN: called CC=1 SCAR=0.0
55 37 ▶use TUI::Objects::Point;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 37 ▶use TUI::Objects::Rect;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 37 ▶use TUI::Views::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
58 :cmXXXX
59 :sfXXXX
60 maxViewWidth
61 37 );
62 37 ▶use TUI::Views::Palette;
Subroutine BEGIN: called CC=1 SCAR=0.0
63 37 ▶use TUI::Views::Group;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 37 ▶use TUI::Views::Util qw( message );
Subroutine BEGIN: called CC=1 SCAR=0.0
65 37 ▶use TUI::Views::View;
Subroutine BEGIN: called CC=1 SCAR=0.0
66
67 sub TProgram() { __PACKAGE__ }
68 0 ▶sub new_TProgram { __PACKAGE__->from(@_) }
Subroutine new_TProgram: not called CC=1 SCAR=6.9
Pod documented
69
70 37 extends ( TGroup, TProgInit );
71
72 # Moo does not inherit attributes from secondary extends() classes.
73 # Redeclare attribute provided by TProgInit.
74 37 ▶if ( TUI::toolkit::is_Moo ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&TUI::toolkit::is_Moo()) 0 37 37
75 0 ▶ has createStatusLine => ( is => 'bare', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
76 0 ▶ has createMenuBar => ( is => 'bare', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
77 0 ▶ has createDeskTop => ( is => 'bare', default => sub { die 'required' } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
78 }
79
80 # declare global variables
81 37 our $exitText = "~Alt-X~ Exit";
82 37 our $application;
83 37 our $statusLine;
84 37 our $menuBar;
85 37 our $deskTop;
86 37 our $appPalette = 0;
87 37 our $pending = TEvent->new();
88
89 # import global variables
90 37 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
91 $mouse
92 $screenBuffer
93 $screenHeight
94 $screenMode
95 $screenWidth
96 $commandSetChanged
97 $showMarkers
98 $shadowSize
99 37 );
100 {
101 37 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
102 37 *mouse = \${ TEventQueue . '::mouse' };
103 37 *screenBuffer = \${ TScreen . '::screenBuffer' };
104 37 *screenHeight = \${ TScreen . '::screenHeight' };
105 37 *screenMode = \${ TScreen . '::screenMode' };
106 37 *screenWidth = \${ TScreen . '::screenWidth' };
107 37 *commandSetChanged = \${ TView . '::commandSetChanged' };
108 37 *showMarkers = \${ TView . '::showMarkers' };
109 37 *shadowSize = \${ TView . '::shadowSize' };
110 }
111
112 0 ▶sub BUILDARGS { # \%args ()
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
113 0 state $sig = signature(
114 method => 1,
115 named => [],
116 caller_level => +1,
117 );
118 0 my ( $class ) = $sig->( @_ );
119 0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
120 0 my $args1 = TGroup->BUILDARGS(
121 bounds => TRect->new(
122 ax => 0,
123 ay => 0,
124 bx => min( $screenWidth, maxViewWidth ),
125 by => $screenHeight,
126 )
127 );
128 0 my $args2 = TProgInit->BUILDARGS(
129 cStatusLine => $class->can( 'initStatusLine' ),
130 cMenuBar => $class->can( 'initMenuBar' ),
131 cDeskTop => $class->can( 'initDeskTop' ),
132 );
133 0 return { %$args1, %$args2 };
134 }
135
136 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=9 SCAR=45.0
Pod documented
137 0 my ( $self, $args ) = @_;
138 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
139 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
140 0 $application = $self;
141 0 $self->initScreen();
142 0 $self->{state} = sfVisible | sfSelected | sfFocused | sfModal | sfExposed;
143 0 $self->{options} = 0;
144 0 $self->{buffer} = $screenBuffer;
145
146 0 ▶ if ( $self->{createDeskTop}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"createDeskTop"} and $TUI::App::Program::deskTop = $self->createDeskTop($self->getExtent)) 0 0 0
Condition0%0/3
$self->{"createDeskTop"} and $TUI::App::Program::deskTop = $self->createDeskTop($self->getExtent)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"createDeskTop"} and $TUI::App::Program::deskTop = $self->createDeskTop($self->getExtent)
$self->{"createDeskTop"} $TUI::App::Program::deskTop = $self->createDeskTop($self->getExtent)
Truth table0%0/3
A and B
A= $self->{"createDeskTop"}B= $TUI::App::Program::deskTop = $self->createDeskTop($self->getExtent)
ABresult
0X0
100
111
147 && ( $deskTop = $self->createDeskTop( $self->getExtent() ) )
148 ) {
149 0 $self->insert( $deskTop );
150 }
151 0 ▶ if ( $self->{createStatusLine}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"createStatusLine"} and $TUI::App::Program::statusLine = $self->createStatusLine($self->getExtent)) 0 0 0
Condition0%0/3
$self->{"createStatusLine"} and $TUI::App::Program::statusLine = $self->createStatusLine($self->getExtent)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"createStatusLine"} and $TUI::App::Program::statusLine = $self->createStatusLine($self->getExtent)
$self->{"createStatusLine"} $TUI::App::Program::statusLine = $self->createStatusLine($self->getExtent)
Truth table0%0/3
A and B
A= $self->{"createStatusLine"}B= $TUI::App::Program::statusLine = $self->createStatusLine($self->getExtent)
ABresult
0X0
100
111
152 && ( $statusLine = $self->createStatusLine( $self->getExtent() ) )
153 ) {
154 0 $self->insert( $statusLine );
155 }
156 0 ▶ if ( $self->{createMenuBar}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"createMenuBar"} and $TUI::App::Program::menuBar = $self->createMenuBar($self->getExtent)) 0 0 0
Condition0%0/3
$self->{"createMenuBar"} and $TUI::App::Program::menuBar = $self->createMenuBar($self->getExtent)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"createMenuBar"} and $TUI::App::Program::menuBar = $self->createMenuBar($self->getExtent)
$self->{"createMenuBar"} $TUI::App::Program::menuBar = $self->createMenuBar($self->getExtent)
Truth table0%0/3
A and B
A= $self->{"createMenuBar"}B= $TUI::App::Program::menuBar = $self->createMenuBar($self->getExtent)
ABresult
0X0
100
111
157 && ( $menuBar = $self->createMenuBar( $self->getExtent() ) )
158 ) {
159 0 $self->insert( $menuBar );
160 }
161 0 return;
162 }
163
164 0 ▶sub from { # $obj ()
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
165 0 state $sig = signature(
166 method => 1,
167 pos => [],
168 );
169 0 my ( $class ) = $sig->( @_ );
170 0 return $class->new();
171 }
172
173 0 ▶sub DEMOLISH { # void ($in_global_destruction)
Subroutine DEMOLISH: not called CC=3 SCAR=24.8
Pod documented
174 0 my ( $self, $in_global_destruction ) = @_;
175 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
176 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
177 0 $application = undef;
178 0 return;
179 }
180
181 0 ▶sub canMoveFocus { # $bool ()
Subroutine canMoveFocus: not called CC=1 SCAR=6.9
Pod documented
182 0 state $sig = signature(
183 method => Object,
184 pos => [],
185 );
186 0 my ( $self ) = $sig->( @_ );
187 0 return $deskTop->valid( cmReleasedFocus );
188 }
189
190 0 ▶sub executeDialog { # $int ($pD, \@data|undef)
Subroutine executeDialog: not called CC=6 SCAR=37.4
Pod documented
191 0 state $sig = signature(
192 method => Object,
193 pos => [
194 Object,
195 Maybe[ArrayLike], { optional => 1 },
196 ],
197 );
198 0 my ( $self, $pD, $data ) = $sig->( @_ );
199 0 alias: for $pD ( $_[1] ) {
200 0 my $c = cmCancel;
201
202 0 ▶ if ( $self->validView( $pD ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->validView($pD)) 0 0 0
203 0 ▶ $pD->setData( $data )
Branch: 1 branch
BranchTrueFalseTotal
if $data 0 0 0
204 if $data;
205 0 $c = $deskTop->execView( $pD );
206 0 ▶ $pD->getData( $data )
Branch: 1 branch
BranchTrueFalseTotal
if $c != 11 and $data 0 0 0
Condition0%0/3
$c != 11 and $data
!ll&&!rl&&r
000
MC/DC0%0/2
$c != 11 and $data
$c != 11 $data
Truth table0%0/3
A and B
A= $c != 11B= $data
ABresult
0X0
100
111
207 if ( $c != cmCancel && $data );
208 0 $self->destroy( $pD );
209 }
210
211 0 return $c;
212 } #/ alias
213 } #/ sub executeDialog
214
215 0 ▶my $hasMouse = sub { # $bool ($p, $s)
Subroutine __ANON__: not called CC=5 SCAR=34.0
216 0 my ( $p, $s ) = @_;
217 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
218 0 ▶ assert ( is_Object $p );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($p) 0 0 0
219 0 ▶ assert ( is_Object $s );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($s) 0 0 0
220 0 ▶ return ( $p->{state} & sfVisible ) && $p->mouseInView( $s->{mouse}{where} );
Condition0%0/3
$p->{'state'} & 1 && $p->mouseInView($s->{'mouse'}{'where'})
!ll&&!rl&&r
000
MC/DC0%0/2
$p->{'state'} & 1 && $p->mouseInView($s->{'mouse'}{'where'})
$p->{'state'} & 1 $p->mouseInView($s->{'mouse'}{'where'})
Truth table0%0/3
A && B
A= $p->{'state'} & 1B= $p->mouseInView($s->{'mouse'}{'where'})
ABresult
0X0
100
111
221 37 };
222
223 0 ▶sub getEvent { # void ($event)
Subroutine getEvent: not called CC=10 SCAR=44.9
Pod documented
224 0 state $sig = signature(
225 method => Object,
226 pos => [Object],
227 );
228 0 my ( $self, $event ) = $sig->( @_ );
229 0 ▶ if ( $pending->{what} != evNothing ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::App::Program::pending->{'what'} != 0) { } 0 0 0
230 0 $event->assign( $pending );
231 0 $pending->{what} = evNothing;
232 }
233 else {
234 0 $event->getMouseEvent();
235 0 ▶ if ( $event->{what} == evNothing ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 0) 0 0 0
236 0 $event->getKeyEvent();
237 $self->idle()
238 0 ▶ if $event->{what} == evNothing;
Branch: 1 branch
BranchTrueFalseTotal
if $event->{"what"} == 0 0 0 0
239 }
240 }
241
242 0 ▶ if ( $statusLine ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::App::Program::statusLine) 0 0 0
243 37 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
244 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} & 16 or $event->{"what"} & 1 and $self->firstThat($hasMouse, $event) == $TUI::App::Program::statusLine) 0 0 0
Condition0%0/6
$event->{"what"} & 16 or $event->{"what"} & 1 and $self->firstThat($hasMouse, $event) == $TUI::App::Program::statusLine
l!l&&r!l&&!r
000
$event->{"what"} & 1 and $self->firstThat($hasMouse, $event) == $TUI::App::Program::statusLine
!ll&&!rl&&r
000
MC/DC0%0/3
$event->{"what"} & 16 or $event->{"what"} & 1 and $self->firstThat($hasMouse, $event) == $TUI::App::Program::statusLine
$event->{"what"} & 16 $event->{"what"} & 1 $self->firstThat($hasMouse, $event) == $TUI::App::Program::statusLine
Truth table0%0/4
A or B and C
A= $event->{"what"} & 16B= $event->{"what"} & 1C= $self->firstThat($hasMouse, $event) == $TUI::App::Program::statusLine
ABCresult
1XX1
0111
00X0
0100
245 ( $event->{what} & evKeyDown )
246 || ( ( $event->{what} & evMouseDown )
247 && $self->firstThat( $hasMouse, $event ) == $statusLine )
248 ) {
249 0 $statusLine->handleEvent( $event );
250 }
251 } #/ if ( $self->{statusLine...})
252 0 ▶ if( $event->{what} == evCommand
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 256 and $event->{"message"}{"command"} == 57) 0 0 0
Condition0%0/3
$event->{"what"} == 256 and $event->{"message"}{"command"} == 57
!ll&&!rl&&r
000
MC/DC0%0/2
$event->{"what"} == 256 and $event->{"message"}{"command"} == 57
$event->{"what"} == 256 $event->{"message"}{"command"} == 57
Truth table0%0/3
A and B
A= $event->{"what"} == 256B= $event->{"message"}{"command"} == 57
ABresult
0X0
100
111
253 && $event->{message}{command} == cmScreenChanged
254 ) {
255 0 $self->setScreenMode( smUpdate );
256 0 $self->clearEvent( $event );
257 }
258 0 return;
259 } #/ sub getEvent
260
261 0 ▶sub getPalette { # $palette ()
Subroutine getPalette: not called CC=1 SCAR=6.9
Pod documented
262 0 state $sig = signature(
263 method => Object,
264 pos => [],
265 );
266 0 my ( $self ) = $sig->( @_ );
267 0 state $color = TPalette->new(
268 data => cpAppColor,
269 size => length( cpAppColor )
270 );
271 0 state $blackwhite = TPalette->new(
272 data => cpAppBlackWhite,
273 size => length( cpAppBlackWhite )
274 );
275 0 state $monochrome = TPalette->new(
276 data => cpAppMonochrome,
277 size => length( cpAppMonochrome )
278 );
279 0 state $palettes = [ $color, $blackwhite, $monochrome ];
280 0 return $palettes->[$appPalette]->clone();
281 } #/ sub getPalette
282
283 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=8 SCAR=42.8
Pod documented
284 0 state $sig = signature(
285 method => Object,
286 pos => [Object],
287 );
288 0 my ( $self, $event ) = $sig->( @_ );
289 0 ▶ if ( $event->{what} == evKeyDown ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 16) 0 0 0
290 0 my $c = getAltChar( $event->{keyDown}{keyCode} );
291 0 ▶ if ( $c ge '1' && $c le '9' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c ge 1 and $c le 9) 0 0 0
Condition0%0/3
$c ge 1 and $c le 9
!ll&&!rl&&r
000
MC/DC0%0/2
$c ge 1 and $c le 9
$c ge 1 $c le 9
Truth table0%0/3
A and B
A= $c ge 1B= $c le 9
ABresult
0X0
100
111
292 0 ▶ if ( $self->canMoveFocus() ) { # <--- Check valid first.
Branch: 1 branch
BranchTrueFalseTotal
if ($self->canMoveFocus) { } 0 0 0
293 0 ▶ if ( message( $deskTop, evBroadcast, cmSelectWindowNum,
Branch: 1 branch
BranchTrueFalseTotal
if (message($TUI::App::Program::deskTop, 512, 55, chr ord($c) - 48)) 0 0 0
294 chr( ord( $c ) - ord( '0' ) ) )
295 ) {
296 0 $self->clearEvent( $event );
297 }
298 } #/ if ( $self->canMoveFocus...)
299 else {
300 0 $self->clearEvent( $event );
301 }
302 } #/ if ( $c ge '1' && $c le...)
303 } #/ if ( $event->{what} eq...)
304
305 0 $self->SUPER::handleEvent( $event );
306 0 ▶ if ( $event->{what} == evCommand && $event->{message}{command} == cmQuit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 256 and $event->{"message"}{"command"} == 1) 0 0 0
Condition0%0/3
$event->{"what"} == 256 and $event->{"message"}{"command"} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$event->{"what"} == 256 and $event->{"message"}{"command"} == 1
$event->{"what"} == 256 $event->{"message"}{"command"} == 1
Truth table0%0/3
A and B
A= $event->{"what"} == 256B= $event->{"message"}{"command"} == 1
ABresult
0X0
100
111
307 0 $self->endModal( cmQuit );
308 0 $self->clearEvent( $event );
309 }
310 0 return;
311 } #/ sub handleEvent
312
313 0 ▶sub idle { # void ()
Subroutine idle: not called CC=3 SCAR=24.8
Pod documented
314 0 state $sig = signature(
315 method => Object,
316 pos => [],
317 );
318 0 my ( $self ) = $sig->( @_ );
319 0 ▶ $statusLine->update()
Branch: 1 branch
BranchTrueFalseTotal
if $TUI::App::Program::statusLine 0 0 0
320 if $statusLine;
321
322 0 ▶ if ( $commandSetChanged ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::App::Program::commandSetChanged) 0 0 0
323 0 message( $self, evBroadcast, cmCommandSetChanged, 0 );
324 0 $commandSetChanged = false;
325 }
326 0 return;
327 }
328
329 0 ▶sub initScreen { # void ()
Subroutine initScreen: not called CC=4 SCAR=30.0
Pod documented
330 0 state $sig = signature(
331 method => Object,
332 pos => [],
333 );
334 0 my ( $self ) = $sig->( @_ );
335 0 ▶ if ( ( $screenMode & 0x00FF ) != smMono ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($TUI::App::Program::screenMode & 255) != 7) { } 0 0 0
336 0 ▶ if ( $screenMode & smFont8x8 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($TUI::App::Program::screenMode & 256) { } 0 0 0
337 0 $shadowSize->{x} = 1;
338 }
339 else {
340 0 $shadowSize->{x} = 2;
341 }
342 0 $shadowSize->{y} = 1;
343 0 $showMarkers = false;
344 0 ▶ if ( ( $screenMode & 0x00FF ) == smBW80 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (($TUI::App::Program::screenMode & 255) == 2) { } 0 0 0
345 0 $appPalette = apBlackWhite;
346 }
347 else {
348 0 $appPalette = apColor;
349 }
350 } #/ if ( ( $screenMode & 0x00FF...))
351 else {
352 0 $shadowSize->{x} = 0;
353 0 $shadowSize->{y} = 0;
354 0 $showMarkers = true;
355 0 $appPalette = apMonochrome;
356 }
357 0 return;
358 } #/ sub initScreen
359
360 0 ▶sub outOfMemory { # void ()
Subroutine outOfMemory: not called CC=1 SCAR=6.9
Pod documented
361 0 state $sig = signature(
362 method => Object,
363 pos => [],
364 );
365 0 my ( $self ) = $sig->( @_ );
366 # Handle out of memory
367 0 return;
368 }
369
370 0 ▶sub putEvent { # void ($event)
Subroutine putEvent: not called CC=1 SCAR=6.9
Pod documented
371 0 state $sig = signature(
372 method => Object,
373 pos => [Object],
374 );
375 0 my ( $self, $event ) = $sig->( @_ );
376 0 $pending = $event->clone();
377 0 return;
378 }
379
380 0 ▶sub run { # void ()
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
381 0 state $sig = signature(
382 method => Object,
383 pos => [],
384 );
385 0 my ( $self ) = $sig->( @_ );
386 0 $self->execute();
387 0 return;
388 }
389
390 0 ▶sub insertWindow { # $window|undef ($pWin)
Subroutine insertWindow: not called CC=4 SCAR=30.0
Pod documented
391 0 state $sig = signature(
392 method => Object,
393 pos => [Object],
394 );
395 0 my ( $self, $pWin ) = $sig->( @_ );
396 0 alias: for $pWin ( $_[1] ) {
397 0 ▶ if ( $self->validView( $pWin ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->validView($pWin)) 0 0 0
398 0 ▶ if ( $self->canMoveFocus() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->canMoveFocus) { } 0 0 0
399 0 $deskTop->insert( $pWin );
400 0 return $pWin;
401 }
402 else {
403 0 $self->destroy( $pWin );
404 }
405 }
406 0 return undef;
407 } #/ alias
408 } #/ sub insertWindow
409
410 0 ▶sub setScreenMode { # void ($mode)
Subroutine setScreenMode: not called CC=1 SCAR=6.9
Pod documented
411 0 state $sig = signature(
412 method => Object,
413 pos => [PositiveOrZeroInt],
414 );
415 0 my ( $self, $mode ) = $sig->( @_ );
416 0 my $r;
417
418 0 $mouse->hide();
419 0 TScreen->setVideoMode( $mode );
420 0 $self->initScreen();
421 0 $self->{buffer} = $screenBuffer;
422 0 $r = TRect->new( ax => 0, ay => 0, bx => $screenWidth, by => $screenHeight );
423 0 $self->changeBounds( $r );
424 0 $self->setState( sfExposed, 0 );
425 0 $self->setState( sfExposed, 1 );
426 0 $self->redraw();
427 0 $mouse->show();
428 0 return;
429 } #/ sub setScreenMode
430
431 0 ▶sub shutDown { # void ()
Subroutine shutDown: not called CC=3 SCAR=24.8
Pod documented
432 0 state $sig = signature(
433 method => Object,
434 pos => [],
435 );
436 0 my ( $self ) = $sig->( @_ );
437 0 ▶ weaken $application
Branch: 1 branch
BranchTrueFalseTotal
if $TUI::App::Program::application and not builtin::is_weak($TUI::App::Program::application) 0 0 0
Condition0%0/3
$TUI::App::Program::application and not builtin::is_weak($TUI::App::Program::application)
!ll&&!rl&&r
000
MC/DC0%0/2
$TUI::App::Program::application and not builtin::is_weak($TUI::App::Program::application)
$TUI::App::Program::application not builtin::is_weak($TUI::App::Program::application)
Truth table0%0/3
A and not(B)
A= $TUI::App::Program::applicationB= not builtin::is_weak($TUI::App::Program::application)
ABresult
0X0
100
111
438 if $application
439 && !isweak $application;
440 0 $statusLine = undef;
441 0 $menuBar = undef;
442 0 $deskTop = undef;
443 0 $self->SUPER::shutDown();
444 # TVMemMgr->clearSafetyPool();
445 0 return;
446 } #/ sub shutDown
447
448 0 ▶sub suspend { # void ()
Subroutine suspend: not called CC=1 SCAR=6.9
Pod documented
449 0 state $sig = signature(
450 method => Object,
451 pos => [],
452 );
453 0 my ( $self ) = $sig->( @_ );
454 0 return;
455 }
456
457 0 ▶sub resume { # void ()
Subroutine resume: not called CC=1 SCAR=6.9
Pod documented
458 0 state $sig = signature(
459 method => Object,
460 pos => [],
461 );
462 0 my ( $self ) = $sig->( @_ );
463 0 return;
464 }
465
466 0 ▶sub initStatusLine { # $statusLine ($r)
Subroutine initStatusLine: not called CC=1 SCAR=6.9
Pod documented
467 0 state $sig = signature(
468 method => 1,
469 pos => [Object],
470 );
471 0 my ( $class, $r ) = $sig->( @_ );
472 0 $r->{a}{y} = $r->{b}{y} - 1;
473 0 return TStatusLine->from( $r,
474 TStatusDef->from( 0, 0xFFFF ) +
475 TStatusItem->from( $exitText, kbAltX, cmQuit ) +
476 TStatusItem->from( '', kbF10, cmMenu ) +
477 TStatusItem->from( '', kbAltF3, cmClose ) +
478 TStatusItem->from( '', kbF5, cmZoom ) +
479 TStatusItem->from( '', kbCtrlF5, cmResize )
480 );
481 } #/ sub initStatusLine
482
483 0 ▶sub initMenuBar { # $menuBar ($r)
Subroutine initMenuBar: not called CC=1 SCAR=6.9
Pod documented
484 0 state $sig = signature(
485 method => 1,
486 pos => [Object],
487 );
488 0 my ( $class, $r ) = $sig->( @_ );
489 0 $r->{b}{y} = $r->{a}{y} + 1;
490 0 return TMenuBar->new( bounds => $r, menu => undef );
491 }
492
493 0 ▶sub initDeskTop { # $deskTop ($r)
Subroutine initDeskTop: not called CC=1 SCAR=6.9
Pod documented
494 0 state $sig = signature(
495 method => 1,
496 pos => [Object],
497 );
498 0 my ( $class, $r ) = $sig->( @_ );
499 0 $r->{a}{y}++;
500 0 $r->{b}{y}--;
501 0 return TDeskTop->new( bounds => $r );
502 }
503
504 0 ▶sub validView { # $view|undef ($view|undef)
Subroutine validView: not called CC=5 SCAR=34.0
Pod documented
505 0 state $sig = signature(
506 method => Object,
507 pos => [Maybe[Object]],
508 );
509 0 my ( $self, $p ) = $sig->( @_ );
510 0 alias: for $p ( $_[1] ) {
511 0 ▶ return undef unless $p;
Branch: 1 branch
BranchTrueFalseTotal
unless $p 0 0 0
512 0 ▶ if ( lowMemory() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&lowMemory()) 0 0 0
513 0 $self->destroy( $p );
514 0 $self->outOfMemory();
515 0 return undef;
516 }
517 0 ▶ unless ( $p->valid( cmValid ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($p->valid(0)) 0 0 0
518 0 $self->destroy( $p );
519 0 return undef;
520 }
521 0 return $p;
522 } #/ alias: for my $p
523 } #/ sub validView
524
525 37 1
526
527 __END__
« lib/TUI/StdDlg/Dir.pm ↑ Summary lib/TUI/Drivers/ColorAttr.pm »