lib/Kephra/App/Editor/SyntaxMode.pm

filter: Statementstmt 75.0% 6 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 81.8% 9 / 11 CC 1 SCAR 0.9
CC
1
Cov
75%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« lib/Kephra/App/Editor.pm ↑ Summary lib/Kephra/App/Editor/SyntaxMode/No.pm »
1 1 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Kephra::App::Editor::SyntaxMode;
5 0 ▶use Wx qw/ :everything /;
Subroutine BEGIN: called CC=1 SCAR=2.6
6 use Wx::STC;
7 #use Wx::Scintilla;
8  
9 sub apply {
10 my ($self) = @_;
11 set( $self, 'perl' );
12 set_colors( $self ); # after highlight
13 }
14  
15 sub set_colors {
16 my $self = shift;
17 $self->SetCaretPeriod( 600 );
18 $self->SetCaretForeground( create_color( 0, 0, 100) ); #140, 160, 255
19 $self->SetCaretLineBack( create_color(230, 230, 250) );
20 $self->SetCaretWidth( 2 );
21 $self->SetCaretLineVisible(1);
22  
23 $self->SetSelForeground( 1, create_color(243,243,243) );
24 $self->SetSelBackground( 1, create_color(0, 17, 119) );
25 $self->SetWhitespaceForeground( 1, create_color(160, 160, 143) );
26 $self->SetViewWhiteSpace(1);
27  
28 $self->StyleSetForeground(&Wx::wxSTC_STYLE_INDENTGUIDE, create_color(206,206,202)); # 37
29 $self->StyleSetForeground(&Wx::wxSTC_STYLE_LINENUMBER, create_color(93,93,97)); # 33
30 $self->StyleSetBackground(&Wx::wxSTC_STYLE_LINENUMBER, create_color(206,206,202));
31  
32 $self->SetEdgeColour( create_color(200,200,255) );
33 $self->SetEdgeColumn( 80 );
34 $self->SetEdgeMode( &Wx::wxSTC_EDGE_LINE );
35 }
36 sub create_color { Wx::Colour->new(@_) }
37  
38 sub set {
39 my ($self, $mode) = @_;
40 if ($mode eq 'perl'){
41 require Kephra::App::Editor::SyntaxMode::Perl;
42 Kephra::App::Editor::SyntaxMode::Perl::set($self);
43 } elsif ($mode eq 'python'){
44 require Kephra::App::Editor::SyntaxMode::Python;
45 Kephra::App::Editor::SyntaxMode::Python::set($self);
46 } elsif ($mode eq 'ruby'){
47 require Kephra::App::Editor::SyntaxMode::Ruby;
48 Kephra::App::Editor::SyntaxMode::Ruby::set($self);
49 } elsif ($mode eq 'rust'){
50 require Kephra::App::Editor::SyntaxMode::Rust;
51 Kephra::App::Editor::SyntaxMode::Rust::set($self);
52 } elsif ($mode eq 'cpp'){
53 require Kephra::App::Editor::SyntaxMode::CPP;
54 Kephra::App::Editor::SyntaxMode::CPP::set($self);
55 } elsif ($mode eq 'bash'){
56 require Kephra::App::Editor::SyntaxMode::Bash;
57 Kephra::App::Editor::SyntaxMode::Bash::set($self);
58 } elsif ($mode eq 'json'){
59 require Kephra::App::Editor::SyntaxMode::JSON;
60 Kephra::App::Editor::SyntaxMode::JSON::set($self);
61 } elsif ($mode eq 'markdown'){
62 require Kephra::App::Editor::SyntaxMode::Markdown;
63 Kephra::App::Editor::SyntaxMode::Markdown::set($self);
64 } elsif ($mode eq 'yaml'){
65 require Kephra::App::Editor::SyntaxMode::YAML;
66 Kephra::App::Editor::SyntaxMode::YAML::set($self);
67 } else {
68 require Kephra::App::Editor::SyntaxMode::No;
69 Kephra::App::Editor::SyntaxMode::No::set($self);
70 }
71 }
72  
73 1;
74  
« lib/Kephra/App/Editor.pm ↑ Summary lib/Kephra/App/Editor/SyntaxMode/No.pm »