App-Music-ChordPro

 view release on metacpan or  search on metacpan

lib/ChordPro/Chords/Parser.pm  view on Meta::CPAN

1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
    $info->{name} = $info->{name_canon} = $info->canonical;
    $info->{system} = $p->{system};
    bless $info => $p->{target};
#    ::dump($info);
#warn("_<_XCODE = $xcode, CHORD = ", $info->canonical);
    return $info;
}
 
sub chord_display ( $self ) {
 
    $self->SUPER::chord_display
      ( $::config->{"chord-formats"}->{common}
        // $::config->{settings}->{"chord-format"}
        // "%{name}" );
}
 
################ Chord objects: Nashville ################
 
 
our @ISA = 'ChordPro::Chord::Base';

lib/ChordPro/Chords/Parser.pm  view on Meta::CPAN

1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
sub canonical ( $self ) {
    my $res = $self->{root_canon} . $self->{qual} . $self->{ext};
    if ( $self->{bass} && $self->{bass} ne "" ) {
        $res .= "/" . lc($self->{bass});
    }
    return $res;
}
 
sub chord_display ( $self ) {
 
    $self->SUPER::chord_display
      ( $::config->{"chord-formats"}->{nashville}
        // "%{name}" );
}
 
################ Chord objects: Roman ################
 
 
our @ISA = 'ChordPro::Chord::Base';

lib/ChordPro/Chords/Parser.pm  view on Meta::CPAN

1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
sub canonical ( $self ) {
    my $res = $self->{root_canon} . $self->{qual} . $self->{ext};
    if ( $self->{bass} && $self->{bass} ne "" ) {
        $res .= "/" . lc($self->{bass});
    }
    return $res;
}
 
sub chord_display ( $self ) {
 
    $self->SUPER::chord_display
      ( $::config->{"chord-formats"}->{roman}
        // "%{name}" );
}
 
################ Chord objects: Annotations ################
 
 

lib/ChordPro/Output/HTML.pm  view on Meta::CPAN

348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
 
 
# Eliminate warning when HTML backend is loaded together with Text backend.
no warnings 'redefine';
 
sub new {
    my ( $pkg, @data ) = @_;
    my $self = $pkg->SUPER::new;
    $self->{_currentfont} = { family => 'default',
                              style => 'normal',
                              weight => 'normal' };
    $self->{_currentcolor} = 'black';
    $self->{_currentsize} = 12;
    $self;
}
 
sub render {
    my ( $self ) = @_;

lib/ChordPro/Output/Markdown.pm  view on Meta::CPAN

352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# package Text::Layout::Text;
 
# use parent 'Text::Layout';
 
# # Eliminate warning when HTML backend is loaded together with Text backend.
# no warnings 'redefine';
 
# sub new {
#     my ( $pkg, @data ) = @_;
#     my $self = $pkg->SUPER::new;
#     $self;
# }
 
# sub render {
#     my ( $self ) = @_;
#     my $res = "";
#     foreach my $fragment ( @{ $self->{_content} } ) {
#       next unless length($fragment->{text});
#       $res .= $fragment->{text};
#     }

lib/ChordPro/Output/PDF.pm  view on Meta::CPAN

3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
                    require ChordPro::Output::PDF::KeyboardDiagram;
                    $p = ChordPro::Output::PDF::KeyboardDiagram->new( ps => $ps );
                }
                else {
                    require ChordPro::Output::PDF::StringDiagram;
                    $p = ChordPro::Output::PDF::StringDiagram->new( ps => $ps );
                }
                $xo = $p->diagram_xo($info);
            }
        }
        $xo // $self->SUPER::getimage($fragment) // alert( $fragment->{size} );
    };
}
 
sub alert ($size) {
    my $scale = $size/20;
    my $xo = $ps->{pr}->{pdf}->xo_form;
    $xo->bbox( 0, -18*$scale, 20*$scale, 0 );
    $xo->matrix( $scale, 0, 0, -$scale, 0, 0 );
    $xo->line_width(2)->line_join(1);
    $xo->stroke_color("red");

lib/ChordPro/Output/Text.pm  view on Meta::CPAN

281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
 
use ChordPro::Utils qw( fq );
 
# Eliminate warning when HTML backend is loaded together with Text backend.
no warnings 'redefine';
 
sub new {
    my ( $pkg, @data ) = @_;
    my $self = $pkg->SUPER::new;
    $self;
}
 
sub render {
    my ( $self ) = @_;
    my $res = "";
    foreach my $fragment ( @{ $self->{_content} } ) {
        next unless length($fragment->{text});
        $res .= fq($fragment->{text});
    }

lib/ChordPro/Wx/Editor.pm  view on Meta::CPAN

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
use parent https://metacpan.org/pod/qw( -norequire Wx::TextCtrl )">qw( -norequire Wx::TextCtrl );
 
use Wx ':everything';
use ChordPro::Utils qw( is_macos );
 
sub new( $class, $parent, $id=undef ) {
 
    my $self = $class->SUPER::new( $parent, wxID_ANY, "",
                                   wxDefaultPosition, wxDefaultSize,
                                   wxHSCROLL|wxTE_MULTILINE );
 
    return $self;
}
 
sub refresh( $self, $prefs = undef ) {
    my $ctrl = $self;
    $prefs //= \%preferences;

lib/ChordPro/Wx/Editor.pm  view on Meta::CPAN

299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
sub SetColour( $self, $colour ) {
    $self->SetStyle( 0, $self->GetLastPosition,
                     Wx::TextAttr->new( Wx::Colour->new($colour) ) );
}
 
sub EmptyUndoBuffer($self) {
}
 
sub OSXDisableAllSmartSubstitutions( $self ) {
    return unless is_macos;
    $self->SUPER::OSXDisableAllSmartSubstitutions;
}
 
################
 
1;

lib/ChordPro/Wx/EditorPanel_wxg.pm  view on Meta::CPAN

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$id     = -1                 unless defined $id;
$pos    = wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize      unless defined $size;
$name   = ""                 unless defined $name;
 
# begin wxGlade: ChordPro::Wx::EditorPanel_wxg::new
$style = wxTAB_TRAVERSAL
    unless defined $style;
 
$self = $self->SUPER::new( $parent, $id, $pos, $size, $style, $name );
 
$self->{sz_outer} = Wx::BoxSizer->new(wxVERTICAL);
 
$self->{sz_toolbar} = Wx::BoxSizer->new(wxHORIZONTAL);
$self->{sz_outer}->Add($self->{sz_toolbar}, 0, wxBOTTOM|wxEXPAND, 3);
 
$self->{l_status} = Wx::StaticText->new($self, wxID_ANY, _T("ChordPro"));
$self->{l_status}->SetForegroundColour(Wx::Colour->new(0, 104, 217));
$self->{l_status}->SetFont(Wx::Font->new(20, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, 0, ""));
$self->{sz_toolbar}->Add($self->{l_status}, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);

lib/ChordPro/Wx/FileDirPickerCtrl.pm  view on Meta::CPAN

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
field $picker;
field $picker_event;
 
my @args;
 
sub BUILDARGS {
    my $class = shift;
 
    my ( $parent, $id, $path, $message, $wildcard, $new ) = @args = @_;
 
    # Args for SUPER::new.
    ( $parent, $id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
}
 
BUILD {
    my ( $parent, $id, $path, $message, $wildcard, $new ) = @args;
 
    if ( $wildcard eq "" && !$new ) {
        $picker = Wx::DirDialog->new( $self, $message,
                                      $path,
                                      wxDD_DIR_MUST_EXIST

lib/ChordPro/Wx/Main_wxg.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$title  = ""                 unless defined $title;
$pos    = wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize      unless defined $size;
$name   = ""                 unless defined $name;
 
# begin wxGlade: ChordPro::Wx::Main_wxg::new
$style = wxDEFAULT_FRAME_STYLE
    unless defined $style;
 
$self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self->SetTitle(_T("ChordPro"));
 
$self->{sz_outer} = Wx::BoxSizer->new(wxVERTICAL);
 
$self->{sz_main} = Wx::BoxSizer->new(wxVERTICAL);
$self->{sz_outer}->Add($self->{sz_main}, 1, wxALL|wxEXPAND, 5);
 
$self->{p_initial} = Wx::Panel->new($self, wxID_ANY);
$self->{sz_main}->Add($self->{p_initial}, 1, wxEXPAND, 0);

lib/ChordPro/Wx/NewSongDialog.pm  view on Meta::CPAN

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use Wx qw[:everything];
use Wx::Locale gettext => '_T';
use ChordPro::Utils qw(demarkup);
use Encode qw(encode_utf8);
 
no warnings 'redefine';         # TODO
method new :common ( $parent, $id, $title ) {
    my $self = $class->SUPER::new($parent, $id, $title);
    $self->refresh;
    $self;
}
use warnings 'redefine';        # TODO
 
method refresh() {
    for ( qw(title subtitle artist key) ) {
        $self->{"t_$_"}->Clear;
    }
    my $sel = 8;

lib/ChordPro/Wx/NewSongDialog_wxg.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$id     = -1                 unless defined $id;
$title  = ""                 unless defined $title;
$pos    = wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize      unless defined $size;
$name   = ""                 unless defined $name;
 
# begin wxGlade: ChordPro::Wx::NewSongDialog_wxg::new
$style = wxDEFAULT_DIALOG_STYLE
    unless defined $style;
 
$self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self->SetTitle("Create New Song");
 
$self->{sizer_1} = Wx::BoxSizer->new(wxVERTICAL);
 
my $label_3 = Wx::StaticText->new($self, wxID_ANY, "New Song", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
$label_3->SetMinSize(Wx::Size->new(-1, 35));
$label_3->SetForegroundColour(Wx::Colour->new(0, 104, 217));
$label_3->SetFont(Wx::Font->new(18, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, 0, ""));
$self->{sizer_1}->Add($label_3, 0, wxALL|wxEXPAND, 5);

lib/ChordPro/Wx/RenderDialog.pm  view on Meta::CPAN

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    "german"       => "C, ... A, Ais/B, H",
    "latin"        => "Do, Re, Mi, Fa, Sol, ...",
    "scandinavian" => "C, ... A, A#/Bb, H",
    "solfege"      => "Do, Re, Mi, Fa, So, ...",
    "solfège"     => "Do, Re, Mi, Fa, So, ...",
    "nashville"    => "1, 2, 3, ...",
    "roman"        => "I, II, III, ...",
  };
 
sub new {
    my $self = shift->SUPER::new(@_);
 
    if ( @{$state{tasks}} ) {
        $self->{l_customtasks}->Show(1);
        my $index = 0;
        for my $task ( @{$state{tasks}} ) {
            my $id = Wx::NewId();
            $self->{sz_customtasks}->Add
              ( $self->{"cb_customtask_$index"} = Wx::CheckBox->new
                ($self, $id, $task->[0] ),
                0, 0, 0 );

lib/ChordPro/Wx/RenderDialog_wxg.pm  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$title  = ""                 unless defined $title;
$pos    = wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize      unless defined $size;
$name   = ""                 unless defined $name;
 
# begin wxGlade: ChordPro::Wx::RenderDialog_wxg::new
$style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
    unless defined $style;
 
$self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self->SetTitle(_T("Preview Tasks"));
 
$self->{sz_prefs_outer} = Wx::BoxSizer->new(wxVERTICAL);
 
my $label_3 = Wx::StaticText->new($self, wxID_ANY, _T("Preview Tasks"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
$label_3->SetForegroundColour(Wx::Colour->new(0, 104, 217));
$label_3->SetFont(Wx::Font->new(18, wxDEFAULT, wxNORMAL, wxNORMAL, 0, ""));
$self->{sz_prefs_outer}->Add($label_3, 0, wxALL|wxEXPAND, 5);
 
$self->{sz_prefs_inner} = Wx::BoxSizer->new(wxVERTICAL);

lib/ChordPro/Wx/SettingsDialog_wxg.pm  view on Meta::CPAN

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$id     = -1                 unless defined $id;
$title  = ""                 unless defined $title;
$pos    = wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize      unless defined $size;
$name   = ""                 unless defined $name;
 
# begin wxGlade: ChordPro::Wx::SettingsDialog_wxg::new
$style = wxDEFAULT_DIALOG_STYLE
    unless defined $style;
 
$self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self->SetTitle(_T("Settings"));
 
$self->{sz_main} = Wx::BoxSizer->new(wxVERTICAL);
 
$self->{sz_prefs_outer} = Wx::BoxSizer->new(wxVERTICAL);
$self->{sz_main}->Add($self->{sz_prefs_outer}, 1, wxEXPAND, 0);
 
$self->{nb_preferences} = Wx::Notebook->new($self, wxID_ANY);
$self->{sz_prefs_outer}->Add($self->{nb_preferences}, 1, wxEXPAND|wxLEFT|wxRIGHT, 5);

lib/ChordPro/Wx/SongbookExportPanel_wxg.pm  view on Meta::CPAN

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
sub new {
    my( $self, $parent, $id, $pos, $size, $style, $name ) = @_;
    $parent = undef              unless defined $parent;
    $id     = -1                 unless defined $id;
    $pos    = wxDefaultPosition  unless defined $pos;
    $size   = wxDefaultSize      unless defined $size;
    $name   = ""                 unless defined $name;
 
    # begin wxGlade: ChordPro::Wx::SongbookExportPanel_wxg::new
    use ChordPro::Wx::Utils;
    $self = $self->SUPER::new( $parent, $id, $pos, $size, $style, $name );
     
    $self->{sizer_1} = Wx::BoxSizer->new(wxVERTICAL);
     
    $self->{sz_outer} = Wx::BoxSizer->new(wxVERTICAL);
    $self->{sizer_1}->Add($self->{sz_outer}, 1, wxEXPAND, 0);
     
    $self->{sz_toolbar} = Wx::BoxSizer->new(wxHORIZONTAL);
    $self->{sz_outer}->Add($self->{sz_toolbar}, 0, wxBOTTOM|wxEXPAND, 3);
     
    $self->{l_status} = Wx::StaticText->new($self, wxID_ANY, _T("Create a Songbook"));

script/wxchordpro.pl  view on Meta::CPAN

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
 
# Dialog to be shown if Wx is not up to date.
 
use Wx qw[:everything];
use strict;
 
sub new {
    my $self = shift->SUPER::new( undef, wxID_ANY,
                                  "Update Required",
                                  wxDefaultPosition, wxDefaultSize,
                                  wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
 
    # Main sizer.
    my $sz = Wx::BoxSizer->new(wxVERTICAL);
    # sz3: Icon (left), info lines (right side).
    my $sz3 = Wx::BoxSizer->new(wxHORIZONTAL);
    # sz4: Information lines, right side,
    my $sz4 = Wx::BoxSizer->new(wxVERTICAL);



( run in 0.592 second using v1.01-cache-2.11-cpan-c6e0e5ac2a7 )