view release on metacpan or search on metacpan
0.972
Fix missing Eb in prefs dialog.
Add scandinavian notes.
0.97
Better handling of errors and exceptions.
Add support for multiple configs, notation systems and transcoding.
Add setting of editor font and size.
0.96
0.84 Sep 22 2017
Add checkbox to suppress user and legacy config files.
Fix problem with (custom) config (needed prefs dialog to be picked up).
0.84 Jul 31 2017
lib/App/Music/ChordPro/Wx/Main.pm view on Meta::CPAN
sub new {
my $self = bless $_[0]->SUPER::new(), __PACKAGE__;
Wx::Event::EVT_IDLE($self, $self->can('OnIdle'));
$self;
}
use constant FONTSIZE => 12;
my @fonts =
( { name => "Monospace",
font => Wx::Font->new( FONTSIZE, wxFONTFAMILY_TELETYPE,
wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL ),
},
{ name => "Serif",
font => Wx::Font->new( FONTSIZE, wxFONTFAMILY_ROMAN,
wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL ),
},
{ name => "Sans serif",
font => Wx::Font->new( FONTSIZE, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL ),
},
);
my $prefctl;
# Explicit (re)initialisation of this class.
sub init {
my ( $self, $options ) = @_;
$prefctl ||=
{
cfgpreset => lc(_T("Default")),
xcode => "",
notation => "",
skipstdcfg => 1,
configfile => "",
pdfviewer => "",
editfont => 0,
editsize => FONTSIZE,
};
if ( $^O =~ /^mswin/i ) {
Wx::ConfigBase::Get->SetPath("/wxchordpro");
}
else {
my $cb;
if ( -d "$ENV{HOME}/.config" ) {
$cb = "$ENV{HOME}/.config/wxchordpro/wxchordpro";
lib/App/Music/ChordPro/Wx/Main.pm view on Meta::CPAN
'',
wxCONFIG_USE_LOCAL_FILE,
));
}
$self->{_verbose} = $options->{verbose};
$self->{_trace} = $options->{trace};
$self->{_debug} = $options->{debug};
$self->GetPreferences;
my $font = $fonts[$self->{prefs_editfont}]->{font};
$font->SetPointSize($self->{prefs_editsize});
$self->{t_source}->SetFont($font);
# Disable menu items if we cannot.
$self->{main_menubar}->FindItem(wxID_UNDO)
->Enable($self->{t_source}->CanUndo);
$self->{main_menubar}->FindItem(wxID_REDO)
->Enable($self->{t_source}->CanRedo);
Wx::Log::SetTimestamp(' ');
if ( @ARGV && -s $ARGV[0] ) {
$self->openfile( shift(@ARGV) );
lib/App/Music/ChordPro/Wx/Main.pm view on Meta::CPAN
next unless /^(.*)\.json$/;
my $base = $1;
$notationlist->[0] = "common", next
if $base eq "common";
push( @$notationlist, $base )
}
}
return $notationlist;
}
sub fonts { \@fonts }
sub opendialog {
my ($self) = @_;
my $fd = Wx::FileDialog->new
($self, _T("Choose ChordPro file"),
"", "",
"ChordPro files (*.cho,*.crd,*.chopro,*.chord,*.chordpro,*.pro)|*.cho;*.crd;*.chopro;*.chord;*.chordpro;*.pro|All files|*.*",
0|wxFD_OPEN|wxFD_FILE_MUST_EXIST,
wxDefaultPosition);
my $ret = $fd->ShowModal;
lib/App/Music/ChordPro/Wx/PreferencesDialog.pm view on Meta::CPAN
my $t = ucfirst(lc($_));
$t =~ s/_/ /g;
$t =~ s/ (.)/" ".uc($1)/eg;
my $n = $ctl->FindString($t);
unless ( $n == wxNOT_FOUND ) {
$ctl->Check( $n, 1 );
}
}
$self->_enablecustom;
$ctl = $self->{ch_editfont};
$ctl->SetSelection( $parent->{prefs_editfont} );
$ctl = $self->{sp_editfont};
$ctl->SetValue( $parent->{prefs_editsize} );
$ctl = $self->{ch_notation};
$ctl->Clear;
my $n = 0;
my $check = 0;
for ( @{ $parent->notationlist } ) {
my $s = ucfirst($_);
$check = $n if $_ eq lc $parent->{prefs_notation};
$s .= " (" . $notdesc->{lc($s)} .")" if $notdesc->{lc($s)};
lib/App/Music/ChordPro/Wx/PreferencesDialog.pm view on Meta::CPAN
sub OnChTranscode {
my ( $self, $event ) = @_;
my $n = $self->{ch_transcode}->GetSelection;
$event->Skip;
}
sub OnChEditFont {
my ($self, $event) = @_;
my $p = $self->GetParent;
my $n = $self->{ch_editfont}->GetSelection;
my $ctl = $p->{t_source};
my $font = $p->fonts->[$n]->{font};
$font->SetPointSize($p->{prefs_editsize});
$ctl->SetFont($font);
$p->{prefs_editfont} = $n;
$event->Skip;
}
sub OnSpEditFont {
my ($self, $event) = @_;
my $p = $self->GetParent;
my $n = $self->{sp_editfont}->GetValue;
my $ctl = $p->{t_source};
my $font = $ctl->GetFont;
$font->SetPointSize($n);
$ctl->SetFont($font);
$p->{prefs_editsize} = $n;
$event->Skip;
}
1;
lib/App/Music/ChordPro/Wx/PreferencesDialog.wxg view on Meta::CPAN
<flag>wxEXPAND</flag>
<object class="wxStaticLine" name="static_line_2" base="EditStaticLine">
<style>wxLI_HORIZONTAL</style>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<border>5</border>
<flag>wxLEFT|wxALIGN_CENTER_VERTICAL</flag>
<object class="wxStaticText" name="l_edit" base="EditStaticText">
<label>Editor font</label>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<border>0</border>
<flag>wxEXPAND</flag>
<object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<border>0</border>
<flag>wxEXPAND</flag>
<object class="wxChoice" name="ch_editfont" base="EditChoice">
<events>
<handler event="EVT_CHOICE">OnChEditFont</handler>
</events>
<selection>0</selection>
<choices>
<choice>Monospaced</choice>
<choice>Serif</choice>
<choice>Sans Serif</choice>
</choices>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<border>0</border>
<object class="wxSpinCtrl" name="sp_editfont" base="EditSpinCtrl">
<events>
<handler event="EVT_SPINCTRL">OnSpEditFont</handler>
</events>
<style>wxSP_ARROW_KEYS</style>
<range>4, 40</range>
<value>14</value>
</object>
</object>
</object>
</object>
lib/App/Music/ChordPro/Wx/PreferencesDialog_wxg.pm view on Meta::CPAN
$style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER
unless defined $style;
$self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self->{l_config} = Wx::StaticText->new($self, wxID_ANY, _T("Configuration"));
$self->{ch_config} = Wx::CheckListBox->new($self, wxID_ANY, wxDefaultPosition, wxDefaultSize, [_T("Default"), _T("Custom")], wxLB_EXTENDED|wxLB_NEEDED_SB);
$self->{cb_skipstdcfg} = Wx::CheckBox->new($self, wxID_ANY, _T("Ignore standard configs"));
$self->{l_cfgfile} = Wx::StaticText->new($self, wxID_ANY, _T("Custom config"));
$self->{t_configfiledialog} = Wx::TextCtrl->new($self, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
$self->{b_configfiledialog} = Wx::Button->new($self, wxID_ANY, _T("\N{U+2026}"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
$self->{ch_editfont} = Wx::Choice->new($self, wxID_ANY, wxDefaultPosition, wxDefaultSize, [_T("Monospaced"), _T("Serif"), _T("Sans Serif")], );
$self->{sp_editfont} = Wx::SpinCtrl->new($self, wxID_ANY, "14", wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 4, 40, 14);
$self->{l_notation} = Wx::StaticText->new($self, wxID_ANY, _T("Notation"));
$self->{ch_notation} = Wx::Choice->new($self, wxID_ANY, wxDefaultPosition, wxDefaultSize, [_T("Common (C, D, E, F, G, A, B)"), _T("German (C, D, E, F, G, A, H)"), _T("Latin (Do, Re, Mi, Fa, Sol, ...)"), _T("Solf\N{U+00e8}ge (Do, Re, Mi, Fa, So, ....
$self->{l_xpose} = Wx::StaticText->new($self, wxID_ANY, _T("Transpose"));
$self->{l_xpose_from} = Wx::StaticText->new($self, wxID_ANY, _T("From"));
$self->{ch_xpose_from} = Wx::Choice->new($self, wxID_ANY, wxDefaultPosition, wxDefaultSize, [_T("C"), _T("C#"), _T("Db"), _T("D"), _T("D#"), _T("Eb"), _T("E"), _T("F"), _T("F#"), _T("Gb"), _T("G"), _T("G#"), _T("Ab"), _T("A"), _T("A#"), _T("Bb"),...
$self->{l_xpose_to} = Wx::StaticText->new($self, wxID_ANY, _T("To"));
$self->{ch_xpose_to} = Wx::Choice->new($self, wxID_ANY, wxDefaultPosition, wxDefaultSize, [_T("C"), _T("C#"), _T("Db"), _T("D"), _T("D#"), _T("Eb"), _T("E"), _T("F"), _T("F#"), _T("Gb"), _T("G"), _T("G#"), _T("Ab"), _T("A"), _T("A#"), _T("Bb"), _...
$self->{rb_xpose_sharp} = Wx::RadioButton->new($self, wxID_ANY, _T("Sharp"));
$self->{rb_xpose_flat} = Wx::RadioButton->new($self, wxID_ANY, _T("Flat"));
$self->{l_transcode} = Wx::StaticText->new($self, wxID_ANY, _T("Transcode to"));
lib/App/Music/ChordPro/Wx/PreferencesDialog_wxg.pm view on Meta::CPAN
$self->{t_pdfviewer} = Wx::TextCtrl->new($self, wxID_ANY, "");
$self->{b_prefs_cancel} = Wx::Button->new($self, wxID_CANCEL, "");
$self->{b_prefs_ok} = Wx::Button->new($self, wxID_OK, "");
$self->__set_properties();
$self->__do_layout();
Wx::Event::EVT_CHECKLISTBOX($self, $self->{ch_config}->GetId, $self->can('OnChConfig'));
Wx::Event::EVT_CHECKBOX($self, $self->{cb_skipstdcfg}->GetId, $self->can('OnSkipStdCfg'));
Wx::Event::EVT_BUTTON($self, $self->{b_configfiledialog}->GetId, $self->can('OnConfigFileDialog'));
Wx::Event::EVT_CHOICE($self, $self->{ch_editfont}->GetId, $self->can('OnChEditFont'));
Wx::Event::EVT_SPINCTRL($self, $self->{sp_editfont}->GetId, $self->can('OnSpEditFont'));
Wx::Event::EVT_CHOICE($self, $self->{ch_notation}->GetId, $self->can('OnChNotation'));
Wx::Event::EVT_CHOICE($self, $self->{ch_xpose_from}->GetId, $self->can('OnXposeFrom'));
Wx::Event::EVT_CHOICE($self, $self->{ch_xpose_to}->GetId, $self->can('OnXposeTo'));
Wx::Event::EVT_RADIOBUTTON($self, $self->{rb_xpose_sharp}->GetId, $self->can('OnXposeSharp'));
Wx::Event::EVT_RADIOBUTTON($self, $self->{rb_xpose_flat}->GetId, $self->can('onXposeFlat'));
Wx::Event::EVT_CHOICE($self, $self->{ch_transcode}->GetId, $self->can('OnChTranscode'));
Wx::Event::EVT_BUTTON($self, $self->{b_prefs_cancel}->GetId, $self->can('OnCancel'));
Wx::Event::EVT_BUTTON($self, $self->{b_prefs_ok}->GetId, $self->can('OnAccept'));
# end wxGlade
lib/App/Music/ChordPro/Wx/PreferencesDialog_wxg.pm view on Meta::CPAN
sub __set_properties {
my $self = shift;
# begin wxGlade: App::Music::ChordPro::Wx::PreferencesDialog_wxg::__set_properties
$self->SetTitle(_T("Preferences"));
$self->{ch_config}->SetMinSize($self->{ch_config}->ConvertDialogSizeToPixels(Wx::Size->new(130, 39)));
$self->{ch_config}->SetSelection(0);
$self->{cb_skipstdcfg}->SetToolTipString(_T("Ignore user and legacy configs, if any"));
$self->{t_configfiledialog}->SetToolTipString(_T("Select a custom config file by pressing the [...] button."));
$self->{b_configfiledialog}->SetMinSize($self->{b_configfiledialog}->ConvertDialogSizeToPixels(Wx::Size->new(38, 14)));
$self->{ch_editfont}->SetSelection(0);
$self->{ch_notation}->SetSelection(0);
$self->{ch_xpose_from}->SetSelection(0);
$self->{ch_xpose_to}->SetSelection(0);
$self->{rb_xpose_sharp}->SetToolTipString(_T("Use sharp chords"));
$self->{rb_xpose_flat}->SetToolTipString(_T("Use flat chords"));
$self->{ch_transcode}->SetSelection(0);
$self->{t_pdfviewer}->SetToolTipString(_T("Alternative PDF previewer.\n %f will be replaced by the file name\n %u will be replaced by the file URL\nLeave empty to use the system default viewer."));
$self->{b_prefs_ok}->SetDefault();
# end wxGlade
}
lib/App/Music/ChordPro/Wx/PreferencesDialog_wxg.pm view on Meta::CPAN
$self->{sizer_2}->Add(5, 5, 0, wxEXPAND, 0);
$self->{sizer_2}->Add($self->{cb_skipstdcfg}, 0, wxALIGN_CENTER_VERTICAL, 0);
$self->{sizer_2}->Add($self->{l_cfgfile}, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
$self->{sizer_1}->Add($self->{t_configfiledialog}, 1, wxEXPAND, 0);
$self->{sizer_1}->Add($self->{b_configfiledialog}, 0, 0, 0);
$self->{sizer_2}->Add($self->{sizer_1}, 1, wxEXPAND|wxRIGHT, 5);
my $static_line_1 = Wx::StaticLine->new($self, wxID_ANY);
$self->{sizer_2}->Add($static_line_1, 0, wxEXPAND, 0);
my $static_line_2 = Wx::StaticLine->new($self, wxID_ANY);
$self->{sizer_2}->Add($static_line_2, 0, wxEXPAND, 0);
my $l_edit = Wx::StaticText->new($self, wxID_ANY, _T("Editor font"));
$self->{sizer_2}->Add($l_edit, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
$self->{sizer_3}->Add($self->{ch_editfont}, 1, wxEXPAND, 0);
$self->{sizer_3}->Add($self->{sp_editfont}, 0, 0, 0);
$self->{sizer_2}->Add($self->{sizer_3}, 1, wxEXPAND, 0);
my $static_line_3 = Wx::StaticLine->new($self, wxID_ANY);
$self->{sizer_2}->Add($static_line_3, 0, wxEXPAND, 0);
my $static_line_4 = Wx::StaticLine->new($self, wxID_ANY);
$self->{sizer_2}->Add($static_line_4, 0, wxEXPAND, 0);
$self->{sizer_2}->Add($self->{l_notation}, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
$self->{sizer_2}->Add($self->{ch_notation}, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5);
$self->{sizer_2}->Add($self->{l_xpose}, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5);
$self->{sz_xpose}->Add($self->{l_xpose_from}, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5);
$self->{sz_xpose}->Add($self->{ch_xpose_from}, 0, 0, 0);