line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kephra::Dialog::Color;
|
2
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1074
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
289
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub choose_color {
|
8
|
0
|
|
|
0
|
0
|
|
my $ep = &Kephra::App::EditPanel::_ref;
|
9
|
0
|
|
0
|
|
|
|
my $color = $ep->GetSelectedText || '#ffffff';
|
10
|
|
|
|
|
|
|
|
11
|
0
|
0
|
0
|
|
|
|
$color = sprintf ("%02x%02x%02x", ($color =~ /(\d+).(\d+).(\d+)/))
|
12
|
|
|
|
|
|
|
if index $color, ',' or index $color, '.';
|
13
|
0
|
0
|
|
|
|
|
$color = sprintf "#%s", $color unless index( $color, '#' ) == 0;
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $color_obj = Wx::Colour->new( $color );
|
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $data = Wx::ColourData->new;
|
18
|
0
|
|
|
|
|
|
$data->SetColour( $color_obj );
|
19
|
0
|
|
|
|
|
|
$data->SetChooseFull( 1 );
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $dialog = Wx::ColourDialog->new( Kephra::App::Window::_ref(), $data );
|
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if( $dialog->ShowModal != &Wx::wxID_CANCEL ) {
|
24
|
0
|
|
|
|
|
|
my $data = $dialog->GetColourData;
|
25
|
0
|
|
|
|
|
|
my $ret_color = $data->GetColour;
|
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $html_color = $ret_color->GetAsString( &Wx::wxC2S_HTML_SYNTAX );
|
28
|
0
|
|
|
|
|
|
$html_color =~ s/^#//;
|
29
|
0
|
|
|
|
|
|
$ep->ReplaceSelection( $html_color );
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |