line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kephra::App::MainToolBar;
|
2
|
|
|
|
|
|
|
our $VERSION = '0.09';
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1250
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
413
|
|
6
|
|
|
|
|
|
|
|
7
|
0
|
|
|
0
|
|
|
sub _ref { Kephra::ToolBar::_ref( _name(), $_[0]) }
|
8
|
0
|
|
|
0
|
|
|
sub _name { 'main' }
|
9
|
0
|
|
|
0
|
|
|
sub _ID { _name().'_toolbar' }
|
10
|
0
|
|
|
0
|
|
|
sub _config { Kephra::API::settings()->{app}{toolbar} }
|
11
|
0
|
|
|
0
|
|
|
sub _win { Kephra::App::Window::_ref() }
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub create {
|
14
|
0
|
|
|
0
|
0
|
|
return until get_visibility();
|
15
|
0
|
|
|
|
|
|
my $frame = Kephra::App::Window::_ref();
|
16
|
0
|
|
|
|
|
|
my $bar = $frame->GetToolBar;
|
17
|
|
|
|
|
|
|
# destroy old toolbar if there any
|
18
|
0
|
0
|
|
|
|
|
destroy() if $bar;
|
19
|
0
|
|
|
|
|
|
_ref( $frame->CreateToolBar );
|
20
|
0
|
|
|
|
|
|
my $bar_def = Kephra::Config::File::load_from_node_data( _config() );
|
21
|
0
|
0
|
|
|
|
|
unless ($bar_def) {
|
22
|
0
|
|
|
|
|
|
$bar_def = Kephra::Config::Tree::get_subtree
|
23
|
|
|
|
|
|
|
( Kephra::Config::Default::toolbars(), _ID() );
|
24
|
|
|
|
|
|
|
}
|
25
|
0
|
|
|
|
|
|
$bar = Kephra::ToolBar::create( _name(), $bar_def );
|
26
|
|
|
|
|
|
|
}
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
0
|
|
sub destroy { Kephra::ToolBar::destroy ( _name() ) }
|
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
0
|
|
sub get_visibility { _config()->{visible} }
|
31
|
0
|
|
|
0
|
0
|
|
sub switch_visibility { _config()->{visible} ^= 1; show(); }
|
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub show {
|
33
|
0
|
0
|
|
0
|
0
|
|
if ( get_visibility() ){
|
34
|
0
|
|
|
|
|
|
create();
|
35
|
0
|
|
|
|
|
|
_win()->SetToolBar( _ref() );
|
36
|
|
|
|
|
|
|
} else {
|
37
|
0
|
|
|
|
|
|
destroy( );
|
38
|
0
|
|
|
|
|
|
_win()->SetToolBar(undef);
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1;
|