File Coverage

lib/Devel/ebug/Wx/Command/Views.pm
Criterion Covered Total %
statement 9 27 33.3
branch 0 4 0.0
condition n/a
subroutine 3 6 50.0
pod 0 1 0.0
total 12 38 31.5


line stmt bran cond sub pod time code
1             package Devel::ebug::Wx::Command::Views;
2              
3 1     1   1338 use strict;
  1         3  
  1         34  
4 1     1   4 use Devel::ebug::Wx::Plugin qw(:plugin);
  1         2  
  1         379  
5              
6             sub commands : Command {
7 0     0 0   my( $class, $wxebug ) = @_;
8 0           my @commands;
9              
10 0           my $viewmanager = $wxebug->view_manager_service;
11 0           foreach my $view ( $viewmanager->views ) {
12 0           my $tag = $view->tag;
13             my $cmd = sub {
14 0     0     my( $wx ) = @_;
15              
16             # show if present, recreate if not present
17 0 0         if( $viewmanager->has_view( $tag ) ) {
18 0 0         if( $viewmanager->is_shown( $tag ) ) {
19 0           $viewmanager->hide_view( $tag );
20             } else {
21 0           $viewmanager->show_view( $tag );
22             }
23             } else {
24 0           my $instance = $view->new( $wx, $wx );
25 0           $viewmanager->create_pane_and_update
26             ( $instance, { name => $instance->tag, # for multiviews
27             float => 1,
28             caption => $instance->description,
29             } );
30             }
31 0           };
32             my $update_ui = sub {
33 0     0     my( $wx, $event ) = @_;
34              
35 0           $event->Check( $viewmanager->is_shown( $tag ) );
36 0           };
37 0           push @commands, 'show_' . $tag,
38             { sub => $cmd,
39             menu => 'view',
40             update_menu => $update_ui,
41             checkable => 1,
42             label => sprintf( "Show %s", $view->description ),
43             priority => 200,
44             };
45             }
46              
47 0           return @commands;
48 1     1   7 }
  1         3  
  1         11  
49              
50             1;