line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kephra::Dialog::Config;
|
2
|
|
|
|
|
|
|
our $VERSION = '0.18';
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1109
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1768
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $dialog;
|
8
|
0
|
0
|
|
0
|
|
|
sub _ref { $dialog = ref $_[0] eq 'Wx::Dialog' ? $_[0] : $dialog }
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub main {
|
11
|
0
|
0
|
0
|
0
|
0
|
|
if ( !$Kephra::temp{dialog}{config}{active}
|
12
|
|
|
|
|
|
|
or $Kephra::temp{dialog}{config}{active} == 0 ) {
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# init search and replace dialog
|
15
|
0
|
|
|
|
|
|
$Kephra::temp{dialog}{config}{active} = 1;
|
16
|
0
|
|
|
|
|
|
my $frame = Kephra::App::Window::_ref();
|
17
|
0
|
|
|
|
|
|
my $config = Kephra::API::settings()->{dialog}{config};
|
18
|
0
|
|
|
|
|
|
my $l18n = Kephra::Config::Localisation::strings();
|
19
|
0
|
|
|
|
|
|
my $d_l10n = $l18n->{dialog}{config};
|
20
|
0
|
|
|
|
|
|
my $g_l10n = $l18n->{dialog}{general};
|
21
|
0
|
|
|
|
|
|
my $m_l10n = $l18n->{app}{menu};
|
22
|
0
|
|
|
|
|
|
my $cl_l10n = $l18n->{commandlist}{label};
|
23
|
0
|
|
|
|
|
|
my $d_style= &Wx::wxNO_FULL_REPAINT_ON_RESIZE | &Wx::wxSYSTEM_MENU |
|
24
|
|
|
|
|
|
|
&Wx::wxCAPTION | &Wx::wxMINIMIZE_BOX | &Wx::wxCLOSE_BOX;
|
25
|
|
|
|
|
|
|
#$d_style |= &Wx::wxSTAY_ON_TOP if Kephra::API::settings()->{app}{window}{stay_on_top};
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# my $staticbox = Wx::StaticBox->new( $panel, -1, 'Wx::StaticBox' );
|
29
|
|
|
|
|
|
|
# my $button = Wx::Button->new( $panel, -1, 'Button 3' );
|
30
|
|
|
|
|
|
|
# my $nsz = Wx::StaticBoxSizer->new( $staticbox, &Wx::wxVERTICAL);
|
31
|
|
|
|
|
|
|
# $panel->SetSizer($nsz);
|
32
|
|
|
|
|
|
|
# $nsz->Add( $button, 0, &Wx::wxGROW|&Wx::wxTOP, 5 );
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# making window & main design
|
35
|
0
|
|
|
|
|
|
my $d = Wx::Dialog->new( $frame, -1, ' '.$d_l10n->{title},
|
36
|
|
|
|
|
|
|
[ $config->{position_x}, $config->{position_y} ], [ 470, 560 ],
|
37
|
|
|
|
|
|
|
$d_style);
|
38
|
0
|
|
|
|
|
|
my $icon_bmp = Kephra::CommandList::get_cmd_property
|
39
|
|
|
|
|
|
|
('view-dialog-config', 'icon');
|
40
|
0
|
|
|
|
|
|
my $icon = Wx::Icon->new;
|
41
|
0
|
0
|
|
|
|
|
$icon->CopyFromBitmap($icon_bmp) if ref $icon_bmp eq 'Wx::Bitmap';
|
42
|
0
|
|
|
|
|
|
$d->SetIcon($icon);
|
43
|
0
|
|
|
|
|
|
_ref($d);
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# main panel
|
46
|
|
|
|
|
|
|
#my $mainpanel = Wx::Panel->new( $d, -1, [-1,-1], [-1,-1] );
|
47
|
|
|
|
|
|
|
# tree of categories
|
48
|
0
|
|
|
|
|
|
my $cfg_tree = Wx::Treebook->new( $d, -1, [-1,-1], [-1,-1], &Wx::wxBK_LEFT);
|
49
|
0
|
|
|
|
|
|
my ($panel);
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# general settings
|
52
|
0
|
|
|
|
|
|
my $pg = $panel->{general} = Wx::Panel->new( $cfg_tree );
|
53
|
0
|
|
|
|
|
|
$pg->{save} = Wx::StaticText->new( $pg, -1, 'Speichern');
|
54
|
0
|
|
|
|
|
|
$pg->{sizer} = Wx::BoxSizer->new(&Wx::wxVERTICAL);
|
55
|
0
|
|
|
|
|
|
$pg->{sizer}->Add( $pg->{save} , 0, &Wx::wxLEFT, 5 );
|
56
|
0
|
|
|
|
|
|
$pg->SetSizer( $pg->{sizer} );
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$cfg_tree->AddPage( $panel->{general}, 'General', 1);
|
59
|
0
|
|
|
|
|
|
$panel->{Interface} = $cfg_tree->AddPage( undef, 'Interface', 1);
|
60
|
0
|
|
|
|
|
|
$panel->{file} = $cfg_tree->AddPage( undef, 'File', 1);
|
61
|
0
|
|
|
|
|
|
$cfg_tree->AddSubPage( undef, 'Defaults', 1);
|
62
|
0
|
|
|
|
|
|
$cfg_tree->AddSubPage( undef, 'Save', 1);
|
63
|
0
|
|
|
|
|
|
$cfg_tree->AddSubPage( undef, 'Endings', 1);
|
64
|
0
|
|
|
|
|
|
$cfg_tree->AddSubPage( undef, 'Session', 1);
|
65
|
0
|
|
|
|
|
|
$cfg_tree->AddPage( undef, 'Editpanel', 1);
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# button line
|
68
|
0
|
|
|
|
|
|
$d->{apply_button} = Wx::Button->new ( $d, -1, $g_l10n->{apply} );
|
69
|
0
|
|
|
|
|
|
$d->{cancel_button} = Wx::Button->new( $d, -1, $g_l10n->{cancel});
|
70
|
0
|
|
|
0
|
|
|
Wx::Event::EVT_BUTTON( $d, $d->{apply_button}, sub {shift->Close} );
|
|
0
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
|
|
Wx::Event::EVT_BUTTON( $d, $d->{cancel_button},sub {shift->Close} );
|
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $button_sizer = Wx::BoxSizer->new(&Wx::wxHORIZONTAL);
|
73
|
0
|
|
|
|
|
|
$button_sizer->Add( $d->{apply_button}, 0, &Wx::wxRIGHT, 14 );
|
74
|
0
|
|
|
|
|
|
$button_sizer->Add( $d->{cancel_button}, 0, &Wx::wxRIGHT, 22 );
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# assembling lines
|
78
|
0
|
|
|
|
|
|
my $d_sizer = Wx::BoxSizer->new(&Wx::wxVERTICAL);
|
79
|
0
|
|
|
|
|
|
$d_sizer->Add( $cfg_tree, 1, &Wx::wxEXPAND|&Wx::wxALL, 14);
|
80
|
0
|
|
|
|
|
|
$d_sizer->Add( $button_sizer, 0, &Wx::wxBOTTOM|&Wx::wxALIGN_RIGHT, 12);
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# release
|
83
|
0
|
|
|
|
|
|
$d->SetSizer($d_sizer);
|
84
|
0
|
|
|
|
|
|
$d->SetAutoLayout(1);
|
85
|
0
|
|
|
|
|
|
$d->Show(1);
|
86
|
0
|
|
|
|
|
|
Wx::Window::SetFocus( $d->{cancel_button} );
|
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
Wx::Event::EVT_CLOSE( $d, \&quit_config_dialog );
|
89
|
|
|
|
|
|
|
} else {
|
90
|
0
|
|
|
|
|
|
my $d = _ref();
|
91
|
0
|
|
|
|
|
|
$d->Iconize(0);
|
92
|
0
|
|
|
|
|
|
$d->Raise;
|
93
|
|
|
|
|
|
|
}
|
94
|
|
|
|
|
|
|
}
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# helper sub td { Wx::TreeItemData->new( $_[0] ) }
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub quit_config_dialog {
|
99
|
0
|
|
|
0
|
0
|
|
my ( $win, $event ) = @_;
|
100
|
0
|
|
|
|
|
|
my $cfg = Kephra::API::settings()->{dialog}{config};
|
101
|
0
|
0
|
|
|
|
|
if ( $cfg->{save_position} == 1 ) {
|
102
|
0
|
|
|
|
|
|
( $cfg->{position_x}, $cfg->{position_y} ) = $win->GetPositionXY;
|
103
|
|
|
|
|
|
|
}
|
104
|
0
|
|
|
|
|
|
$Kephra::temp{dialog}{config}{active} = 0;
|
105
|
0
|
|
|
|
|
|
$win->Destroy;
|
106
|
|
|
|
|
|
|
}
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1;
|