Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sciurius committed Nov 3, 2022
2 parents 92dfb81 + afdafe5 commit 62294aa
Show file tree
Hide file tree
Showing 21 changed files with 152 additions and 79 deletions.
10 changes: 10 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
5.990 2022-11-03

- !BugFixes
- Fix erroneous error message when pdf.formats.default.title (cs) is [].
- Fix compatibility problems with PDF::Builder.
- Fix page labels for PDF::API2 >= 2.041.
- Eliminate potential splice warning with pagealign-songs.
- Fix resize preferences window.
- Fix problem with copied chords not being registered as agnostic.

5.989 2022-10-21

- !ChordPro functionality
Expand Down
10 changes: 8 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ checkjson :
VM := Win10Pro
WW := w10

wkit :
-VBoxManage startvm ${VM} --type headless
wkit : _wkit1 _wkit _wkit2

_wkit :
test -d /mnt/c/Users || mount /mnt/c
${MAKE} to_c
ssh ${WW} gmake -C Chordpro/pp/windows
scp ${WW}:Chordpro/pp/windows/ChordPro-Installer\*.exe ${HOME}/tmp/

_wkit1 :
-VBoxManage startvm ${VM} --type headless

_wkit2 :
VBoxManage controlvm ${VM} poweroff
VBoxManage snapshot ${VM} restorecurrent

27 changes: 20 additions & 7 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,41 @@ $master =~ s;/Version;;;

my @bins = qw( chordpro wxchordpro );

my @pdfapi = ( 'PDF::API2' => 2.043 ); # default
if ( my $a = $ENV{CHORDPRO_PDF_API} ) {
if ( $a =~ /PDF::Builder/ ) {
@pdfapi = ( 'PDF::Builder' => 3.025 );
}
elsif ( $a =~ /PDF::API2/ ) {
}
else {
@pdfapi = ( $a => 0 );
}
}

WriteMakefile
(
NAME => 'App::Music::ChordPro',
ABSTRACT_FROM => $master,
VERSION => $version,
AUTHOR => 'Johan Vromans <jvromans@squirrel.nl>',
LICENSE => "perl",
MIN_PERL_VERSION => 5.010000,
MIN_PERL_VERSION => 5.010001,
INSTALLDIRS => 'site',
EXE_FILES => [ map { "script/$_" } @bins ],
PL_FILES => {
'script/ppchordpro.PL' => [ map { "script/$_" } @bins ]
},

# Always require PDF::API2 and Text::Layout.
# Always require PDF::API2 or PDF::Builder and Text::Layout.
PREREQ_PM => {
'App::Packager' => 1.430,
'PDF::API2' => 2.036,
'Text::Layout' => 0.028,
@pdfapi,
'Text::Layout' => 0.030,
'JSON::PP' => 2.27203,
'String::Interpolate::Named' => 1.01,
'File::LoadLines' => 1.02,
'File::HomeDir' => 1.004,,
'String::Interpolate::Named' => 1.030,
'File::LoadLines' => 1.021,
'File::HomeDir' => 1.004,
'Image::Info' => 1.41,
'List::Util' => 1.33,
'Storable' => 3.08,
Expand All @@ -55,6 +67,7 @@ WriteMakefile
'JSON::PP' => 2.27203,
'String::Interpolate::Named' => 1.01,
'Storable' => 3.08,
@pdfapi,
},

META_MERGE => {
Expand Down
24 changes: 18 additions & 6 deletions docs/content/ChordPro-Reference-RelNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Release info

## 5.990

Released: 2022-11-03


### BugFixes

* Fix erroneous error message when pdf.formats.default.title (cs) is [].
* Fix compatibility problems with PDF::Builder.
* Fix page labels for PDF::API2 >= 2.041.
* Eliminate potential splice warning with pagealign-songs.
* Fix resize preferences window.
* Fix problem with copied chords not being registered as agnostic.

### Social and support

[User community](https://groups.io/g/ChordPro) for feedback and help.

## 5.989

Released: 2022-10-21
Expand Down Expand Up @@ -47,12 +65,6 @@ Released: 2022-10-21
* Fix issue 253.
* Fix issue 255.

### Social and support

[User community](https://groups.io/g/ChordPro) for feedback and help.

[Follow us on Twitter](https://twitter.com/ChordPro_Org) to stay informed about new releases and updates.

## 5.988

Released: 2022-05-17
Expand Down
9 changes: 5 additions & 4 deletions lib/App/Music/ChordPro/Chords.pm
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ sub _known_chord {
$name = $info->name;
}
my $ret = $song_chords{$name} // $config_chords{$name};
return $ret if $ret || !$info;
$ret->{_via} = $ret->{origin} . " chords", return $ret if $ret;
return unless $info;

# Retry agnostic. Not all can do that.
$name = eval { $info->agnostic };
Expand All @@ -313,12 +314,13 @@ sub _known_chord {
if ( $ret ) {
$ret = $info->new($ret);
for ( qw( name display
root root_canon
root root_canon root_mod
bass bass_canon
system parser ) ) {
next unless defined $info->{$_};
$ret->{$_} = $info->{$_};
}
$ret->{_via} = "agnostic" . " " . $ret->{origin} . " chords";
}
$ret;
}
Expand Down Expand Up @@ -407,7 +409,6 @@ sub add_config_chord {
keys => [ $keys && @$keys ? @$keys : () ]
} => $parser->{target};
push( @chordnames, $name );
next if $def->{copy};

# Also store the chord info under a neutral name so it can be
# found when other note name systems are used.
Expand All @@ -421,7 +422,7 @@ sub add_config_chord {
if ( $i && $i->is_chord ) {
$info->{root_ord} = $i->{root_ord};
$config_chords{$name}->{$_} = $i->{$_}
for qw( root_ord ext_canon qual_canon );
for qw( root_ord root_mod ext_canon qual_canon );
$i = $i->agnostic;
}
}
Expand Down
7 changes: 5 additions & 2 deletions lib/App/Music/ChordPro/Chords/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,11 @@ sub agnostic {
my ( $self ) = @_;
return if $self->is_note;
join( " ", "",
$self->{root_ord}, $self->{qual_canon},
$self->{ext_canon}, $self->{bass_ord} // () );
$self->{root_ord},
$self->{root_mod},
$self->{qual_canon},
$self->{ext_canon},
$self->{bass_ord} // () );
}

sub transpose {
Expand Down
2 changes: 1 addition & 1 deletion lib/App/Music/ChordPro/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ sub configurator {
for ( @$t) {
die("Config error in pdf.formats.$class.$tt: ",
scalar(@$_), " fields instead of 3\n")
unless @$_ == 3;
if @$_ && @$_ != 3;
}
}
}
Expand Down
52 changes: 33 additions & 19 deletions lib/App/Music/ChordPro/Output/PDF.pm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sub generate_songbook {

# Align.
if ( $ps->{'pagealign-songs'} && !($page % 2) ) {
$pr->newpage($ps, $page+1);
$pr->newpage($ps, $page);
$page++;
$first_song_aligned //= 1;
}
Expand Down Expand Up @@ -164,7 +164,7 @@ sub generate_songbook {
my $matter = $pdfapi->open( expand_tilde($ps->{'front-matter'}) );
die("Missing front matter: ", $ps->{'front-matter'}, "\n") unless $matter;
for ( 1 .. $matter->pages ) {
$pr->{pdf}->importpage( $matter, $_, $_ );
$pr->{pdf}->import_page( $matter, $_, $_ );
$page++;
}
$pages_of{front} = $matter->pages;
Expand All @@ -186,7 +186,7 @@ sub generate_songbook {
$pr->newpage($ps), $page++, $start_of{back}++
if $ps->{'even-odd-pages'} && ($page % 2);
for ( 1 .. $matter->pages ) {
$pr->{pdf}->importpage( $matter, $_, $page );
$pr->{pdf}->import_page( $matter, $_, $page );
$page++;
}
$pages_of{back} = $matter->pages;
Expand Down Expand Up @@ -2504,29 +2504,43 @@ sub showlayout {
}
}

sub config_pdfapi {
my ( $lib, $verbose ) = @_;
my $pdfapi;

my $t = "config";
# Get PDF library.
if ( $ENV{CHORDPRO_PDF_API} ) {
$t = "CHORDPRO_PDF_API";
$lib = $ENV{CHORDPRO_PDF_API};
}
if ( $lib ) {
unless ( eval( "require $lib" ) ) {
die("Missing PDF library $lib ($t)\n");
}
$pdfapi = $lib;
warn("Using PDF library $lib ($t)\n") if $verbose;
}
else {
for ( qw( PDF::API2 PDF::Builder ) ) {
eval "require $_" or next;
$pdfapi = $_;
warn("Using PDF library $_ (detected)\n") if $verbose;
last;
}
}
die("Missing PDF library\n") unless $pdfapi;
return $pdfapi;
}

sub configurator {
my ( $cfg ) = @_;

# From here, we're mainly dealing with the PDF settings.
my $pdf = $cfg->{pdf};

# Get PDF library.
unless ( $pdfapi ) {
if ( $pdf->{library} ) {
unless ( eval( "require " . $pdf->{library} ) ) {
die("Missing ", $pdf->{library}, " library\n");
}
$pdfapi = $pdf->{library};
}
else {
for ( qw( PDF::Builder PDF::API2 ) ) {
eval "require $_" or next;
$pdfapi = $_;
last;
}
}
die("Missing PDF library\n") unless $pdfapi;
}
$pdfapi //= config_pdfapi( $pdf->{library} );

my $fonts = $pdf->{fonts};

Expand Down
11 changes: 8 additions & 3 deletions lib/App/Music/ChordPro/Output/PDF/Writer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package App::Music::ChordPro::Output::PDF::Writer;
use strict;
use warnings;
use Encode;
use PDF::API2;
use Text::Layout;
use IO::String;
use Carp;
Expand Down Expand Up @@ -371,7 +370,13 @@ sub add_image {
sub newpage {
my ( $self, $ps, $page ) = @_;
#$self->{pdftext}->textend if $self->{pdftext};
$self->{pdfpage} = $self->{pdf}->page($page||0);
$page ||= 0;

# PDF::API2 says $page must refer to an existing page.
# Set to 0 to append.
$page = 0 if $page == $self->{pdf}->pages + 1;

$self->{pdfpage} = $self->{pdf}->page($page);
$self->{pdfpage}->mediabox( $ps->{papersize}->[0],
$ps->{papersize}->[1] );

Expand Down Expand Up @@ -431,7 +436,7 @@ sub pagelabel {
$style eq 'alpha' ? 'a' : 'D',
defined $prefix ? ( prefix => $prefix ) : (),
start => 1 };
$c->( $self->{pdf}, $page, $opts );
$c->( $self->{pdf}, $page, %$opts );
}
else {
my $opts = { -style => $style,
Expand Down
11 changes: 7 additions & 4 deletions lib/App/Music/ChordPro/Song.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ sub parse_chord {
$info = App::Music::ChordPro::Chords::_known_chord($chord);
if ( $info ) {
warn( "Parsing chord: \"$chord\" found \"",
$chord, "\" in song/config chords\n" ) if $debug > 1;
$chord, "\" in ", $info->{_via}, "\n" ) if $debug > 1;
}
else {
$info = App::Music::ChordPro::Chords::parse_chord($chord);
Expand Down Expand Up @@ -1782,9 +1782,10 @@ sub parse_chord {

if ( $info ) {
# Look it up now, the name may change by transcode.
if ( my $i = App::Music::ChordPro::Chords::_known_chord($info) ) {
if ( my $i = App::Music::ChordPro::Chords::_known_chord($info,1) ) {
warn( "Parsing chord: \"$chord\" found ",
$i->name, " for ", $info->name, " in song/config chords\n" ) if $debug > 1;
$i->name, " for ", $info->name,
" in ", $i->{_via}, "\n" ) if $debug > 1;
$info = $i->new({ %$i, name => $info->name }) ;
$unk = 0;
}
Expand All @@ -1798,6 +1799,7 @@ sub parse_chord {
else {
warn( "Parsing chord: \"$chord\" \"", $info->name,
"\" not found in song/config chords\n" ) if $debug;
# warn("XX \'", $info->agnostic, "\'\n");
$unk = 1;
}
}
Expand All @@ -1820,7 +1822,8 @@ sub parse_chord {
if ( my $i = App::Music::ChordPro::Chords::_known_chord($chord) ) {
$info = $i;
warn( "Parsing chord: \"$chord\" found \"",
$chord, "\" in song/config chords\n" ) if $debug > 1;
$chord, "\" in ",
$i->{_via}, "\n" ) if $debug > 1;
$unk = 0;
}
elsif ( $config->{diagrams}->{auto} ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/App/Music/ChordPro/Version.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is generated. Do not edit!
package App::Music::ChordPro::Version;
our $VERSION = "5.989";
our $VERSION = "5.990";
print "$VERSION\n" unless caller;
4 changes: 2 additions & 2 deletions lib/App/Music/ChordPro/Wx/PreferencesDialog.wxg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!-- generated by wxGlade 1.1.0pre on Fri Feb 4 12:01:38 2022 -->
<!-- generated by wxGlade 1.1.0pre on Thu Oct 27 09:39:20 2022 -->

<application encoding="UTF-8" for_version="2.8" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="perl" mark_blocks="1" option="0" overwrite="1" path="PreferencesDialog_wxg.pm" source_extension=".cpp" top_window="d_prefs" use_gettext="1" use_new_namespace="1">
<object class="App::Music::ChordPro::Wx::PreferencesDialog_wxg" name="d_prefs" base="EditDialog">
Expand All @@ -23,7 +23,7 @@
<vgap>5</vgap>
<hgap>5</hgap>
<growable_rows>1</growable_rows>
<growable_cols>0,1</growable_cols>
<growable_cols>1</growable_cols>
<object class="sizeritem">
<span>1, 2</span>
<border>5</border>
Expand Down
3 changes: 1 addition & 2 deletions lib/App/Music/ChordPro/Wx/PreferencesDialog_wxg.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# generated by wxGlade 1.1.0pre on Fri Feb 4 12:01:45 2022
# generated by wxGlade 1.1.0pre on Thu Oct 27 09:38:43 2022
#
# To get wxPerl visit http://www.wxperl.it
#
Expand Down Expand Up @@ -190,7 +190,6 @@ sub new {
$self->{sz_prefs_buttons}->Add($self->{b_prefs_ok}, 0, wxLEFT, 5);

$self->{sizer_2}->AddGrowableRow(1);
$self->{sizer_2}->AddGrowableCol(0);
$self->{sizer_2}->AddGrowableCol(1);

$self->SetSizer($self->{sz_prefs_outer});
Expand Down
2 changes: 1 addition & 1 deletion t/01_prereq.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ my $pdfapi = "PDF::API2";
my $pdfapiv = "2.036";

# PDF::API2 2.036 is ok, 2.042 is better, 2.043 is best.
for ( qw( xPango@1.227 PDF::API2@2.036 PDF::Builder@3.016 ) ) {
for ( qw( PDF::Builder@3.023 PDF::API2@2.036 ) ) {
( $pdfapi, $pdfapiv ) = split( '@', $_ );
eval "require $pdfapi" or next;
eval '$pdfapiv = $pdfapi->VERSION($pdfapiv)' or next;
Expand Down
Loading

0 comments on commit 62294aa

Please sign in to comment.