diff --git a/lib/ChordPro/Output/PDF.pm b/lib/ChordPro/Output/PDF.pm index 9c008dd9..0678f84e 100644 --- a/lib/ChordPro/Output/PDF.pm +++ b/lib/ChordPro/Output/PDF.pm @@ -98,7 +98,7 @@ sub generate_songbook { Creator => $name ); while ( my ( $k, $v ) = each %{ $ps->{info} } ) { next unless defined($v) && $v ne ""; - next if $k eq "title" && $options->{title} && $k eq '%{title}'; + next if $k eq "title" && $options->{title} && $v eq '%{title}'; $info{ucfirst($k)} = fmt_subst( $sb->{songs}->[0], $v ); } diff --git a/lib/ChordPro/Song.pm b/lib/ChordPro/Song.pm index 095f1197..e4715357 100644 --- a/lib/ChordPro/Song.pm +++ b/lib/ChordPro/Song.pm @@ -441,6 +441,9 @@ sub parse_song { $_ = shift(@a); unshift( @$lines, @a ); $skipcnt += @a; + if ( $config->{debug}->{echo} ) { + warn(sprintf("==[%3d]=> %s\n", $diag->{line}, $_ ) ); + } } } } diff --git a/lib/ChordPro/Version.pm b/lib/ChordPro/Version.pm index dd0c6b2a..ab745d55 100644 --- a/lib/ChordPro/Version.pm +++ b/lib/ChordPro/Version.pm @@ -1,4 +1,4 @@ # This file is generated. Do not edit! package ChordPro::Version; -our $VERSION = "6.101.0"; +our $VERSION = "6.101_002"; print "$VERSION\n" unless caller; diff --git a/lib/ChordPro/Wx/Config.pm b/lib/ChordPro/Wx/Config.pm index 5accc2b4..488c0922 100755 --- a/lib/ChordPro/Wx/Config.pm +++ b/lib/ChordPro/Wx/Config.pm @@ -114,6 +114,7 @@ my %prefs = editorwrap => 1, editorwrapindent => 2, + livepreview => 0, # Messages. msgsfont => 0, # inital, later "Monospace 10" etc. diff --git a/lib/ChordPro/Wx/EditorPanel.pm b/lib/ChordPro/Wx/EditorPanel.pm index 17f131b3..0e4645d8 100755 --- a/lib/ChordPro/Wx/EditorPanel.pm +++ b/lib/ChordPro/Wx/EditorPanel.pm @@ -37,6 +37,9 @@ BUILD { # Setup WebView, if possible. $self->setup_webview if $::options->{webview}//1; + # Inline "Preview Tasks" controls in the toolbar, left of Settings. + $self->setup_preview_tasks_bar; + # Single pane. $self->unsplit; @@ -75,6 +78,7 @@ method refresh() { else { $self->{bmp_songbook}->Show(0); } + $self->refresh_preview_tasks_bar; $self->{sz_toolbar}->Layout; my $mod = $self->{t_editor}->IsModified; diff --git a/lib/ChordPro/Wx/Main.pm b/lib/ChordPro/Wx/Main.pm index 8ee3acb2..7651383e 100755 --- a/lib/ChordPro/Wx/Main.pm +++ b/lib/ChordPro/Wx/Main.pm @@ -419,27 +419,28 @@ method OnIdle($event) { $f .= " (modified)" if $mod; } $f = "ChordPro — $f" if $state{windowtitle}; - $self->SetTitle($f); + $self->SetTitle($f) unless $self->GetTitle eq $f; if ( $state{mode} eq "editor") { my $t = $self->{p_editor}->{t_editor}->GetText; if ( $t =~ /^\{\s*t(?:itle)?[: ]+([^\}]*)\}/m ) { - $self->{p_editor}->{l_status}->SetLabel(demarkup($1)); + my $title = demarkup($1); + my $l_status = $self->{p_editor}->{l_status}; + $l_status->SetLabel($title) unless $l_status->GetLabel eq $title; } + } - if ( $state{editchanged} - && $self->{p_editor}->{sw_lr}->IsSplit ) { - - if ( $state{have_webview} - && $preferences{enable_htmlviewer} ) { - $self->{p_editor}->preview([]); - $state{editchanged} = 0; - } - else { - # Preview is no longer actual -- how to signal? - } + if ( $state{editchanged} && $state{mode} eq "editor" ) { + my $panel = $self->{p_editor}; + if ( $preferences{livepreview} + && $state{have_webview} + && !$preferences{enable_pdfviewer} + && $panel->{sw_lr}->IsSplit ) { + $panel->preview( [ $panel->preview_tasks_args ] ); + $state{editchanged} = 0; } + # else: preview is stale; nothing to do. } } @@ -555,6 +556,10 @@ method OnPreferences($event) { $state{panel}->update_preferences unless $state{mode} eq "initial"; $self->setup_menubar; + + # Style/config may have changed; mark the preview as stale so the + # OnIdle live-preview path picks it up. + $state{editchanged}++; } # On the recents list, click selects and displays the file name. diff --git a/lib/ChordPro/Wx/PanelRole.pm b/lib/ChordPro/Wx/PanelRole.pm index 9b145b4a..b14f6c5a 100644 --- a/lib/ChordPro/Wx/PanelRole.pm +++ b/lib/ChordPro/Wx/PanelRole.pm @@ -146,7 +146,7 @@ method OnPreferences($event) { } method OnPreview($event) { # for menu - $self->preview( [] ); + $self->preview( [ $self->preview_tasks_args ] ); $self->previewtooltip; } @@ -157,78 +157,242 @@ method OnPreviewClose($event) { } method OnPreviewLyricsOnly($event) { - $self->preview( [ '--lyrics-only' ] ); + # Legacy menu shortcut: toggle the toolbar checkbox and preview. + $self->{cb_task_lyrics_only}->SetValue(1) + if $self->{cb_task_lyrics_only}; + $self->preview( [ $self->preview_tasks_args ] ); $self->previewtooltip; } -method OnPreviewMore($event) { - - # C D E F G A B C - state @xpmap = qw( 0 1 1 2 3 3 4 5 6 6 7 8 8 9 10 10 11 12 ); - state @sfmap = qw( 0 7 -5 2 9 -3 4 -1 6 -6 1 8 -4 3 10 -2 5 0 ); +method OnPreviewNoDiagrams($event) { + # Legacy menu shortcut: toggle the toolbar checkbox and preview. + $self->{cb_task_no_diagrams}->SetValue(1) + if $self->{cb_task_no_diagrams}; + $self->preview( [ $self->preview_tasks_args ] ); + $self->previewtooltip; +} - unless ( $self->{d_render} ) { - require ChordPro::Wx::RenderDialog; - $self->{d_render} = ChordPro::Wx::RenderDialog->new - ( $self, wxID_ANY, "Tasks" ); - restorewinpos( $self->{d_render}, "render" ); - } - else { - $self->{d_render} ->refresh; +# Build the inline "Preview Tasks" section in the panel toolbar, +# inserted left of the Settings button. The section is enabled +# only while the preview pane is showing. +method setup_preview_tasks_bar() { + my $sz = $self->{sz_toolbar}; + return unless $sz; + + # Outer (vertical) sizer: title on top, controls row below. + my $outer = $self->{sz_preview_tasks} = Wx::BoxSizer->new(wxVERTICAL); + + # ---- Section title ---- + $self->{l_preview_tasks} = Wx::StaticText->new + ( $self, wxID_ANY, _T("Preview Tasks"), + wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL ); + $self->{l_preview_tasks}->SetForegroundColour(Wx::Colour->new(0, 104, 217)); + $self->{l_preview_tasks}->SetFont + ( Wx::Font->new( 10, wxFONTFAMILY_DEFAULT, + wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, 0, "" ) ); + $self->{l_preview_tasks}->SetToolTip + (_T("Options that apply to the preview")); + $outer->Add( $self->{l_preview_tasks}, 0, + wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 2 ); + + # Inner (horizontal) sizer holds the actual task widgets. + my $tb = Wx::BoxSizer->new(wxHORIZONTAL); + $outer->Add( $tb, 0, wxEXPAND, 0 ); + + # ---- Transpose ---- + $self->{l_xpose} = Wx::StaticText->new( $self, wxID_ANY, _T("Transpose") ); + $self->{l_xpose}->SetToolTip + (_T("Transpose the song. Negative values transpose down.")); + $tb->Add( $self->{l_xpose}, 0, + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 ); + + $self->{sp_xpose} = Wx::SpinCtrl->new + ( $self, wxID_ANY, "0", wxDefaultPosition, [ 65, -1 ], + wxSP_ARROW_KEYS, -12, 12, 0 ); + $self->{sp_xpose}->SetToolTip + (_T("Number of semitones to transpose. Negative is down.")); + $tb->Add( $self->{sp_xpose}, 0, wxALIGN_CENTER_VERTICAL, 0 ); + Wx::Event::EVT_SPINCTRL( $self, $self->{sp_xpose}->GetId, + $self->can("OnPreviewTaskChanged") ); + Wx::Event::EVT_TEXT( $self, $self->{sp_xpose}->GetId, + $self->can("OnPreviewTaskChanged") ); + + $self->{ch_acc} = Wx::Choice->new + ( $self, wxID_ANY, wxDefaultPosition, wxDefaultSize, + [ _T("Auto"), _T("Sharps"), _T("Flats"), _T("Key") ] ); + $self->{ch_acc}->SetSelection(0); + $self->{ch_acc}->SetToolTip(_T("Accidentals after transposing.\n". + "Auto: sharps when up, flats when down.\n". + "Key: use the song's transposed key.")); + $tb->Add( $self->{ch_acc}, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + Wx::Event::EVT_CHOICE( $self, $self->{ch_acc}->GetId, + $self->can("OnPreviewTaskChanged") ); + + $tb->Add( Wx::StaticLine->new( $self, wxID_ANY, + wxDefaultPosition, [ -1, 22 ], + wxLI_VERTICAL ), + 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 6 ); + + # ---- Task checkboxes ---- + $self->{cb_task_no_diagrams} = Wx::CheckBox->new + ( $self, wxID_ANY, _T("No diagrams") ); + $self->{cb_task_no_diagrams}->SetToolTip(_T("Suppress the chord diagrams")); + $tb->Add( $self->{cb_task_no_diagrams}, 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + Wx::Event::EVT_CHECKBOX( $self, $self->{cb_task_no_diagrams}->GetId, + $self->can("OnPreviewTaskChanged") ); + + $self->{cb_task_lyrics_only} = Wx::CheckBox->new + ( $self, wxID_ANY, _T("Lyrics only") ); + $self->{cb_task_lyrics_only}->SetToolTip + (_T("Only lyrics (no chords, ABC, LilyPond, ...)")); + $tb->Add( $self->{cb_task_lyrics_only}, 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + Wx::Event::EVT_CHECKBOX( $self, $self->{cb_task_lyrics_only}->GetId, + $self->can("OnPreviewTaskChanged") ); + + $self->{cb_task_decapo} = Wx::CheckBox->new + ( $self, wxID_ANY, _T("Decapo") ); + $self->{cb_task_decapo}->SetToolTip + (_T("Show the chords as they sound, eliminating the need for a capo setting")); + $tb->Add( $self->{cb_task_decapo}, 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + Wx::Event::EVT_CHECKBOX( $self, $self->{cb_task_decapo}->GetId, + $self->can("OnPreviewTaskChanged") ); + + # Placeholder for custom tasks; populated in refresh_preview_tasks_bar. + $self->{sz_customtasks_bar} = Wx::BoxSizer->new(wxHORIZONTAL); + $tb->Add( $self->{sz_customtasks_bar}, 0, + wxALIGN_CENTER_VERTICAL, 0 ); + + # Final separator before the existing buttons. + $tb->Add( Wx::StaticLine->new( $self, wxID_ANY, + wxDefaultPosition, [ -1, 22 ], + wxLI_VERTICAL ), + 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 6 ); + + # Insert the section in front of the Settings button. + # GetItemCount/GetItem aren't exposed on Wx::BoxSizer in this wxPerl; + # GetChildren returns a list (not an arrayref) of Wx::SizerItem, so + # collect it in list context. + my @items = $sz->GetChildren; + my $idx = scalar @items; # default: append at end + for ( my $i = 0; $i < @items; $i++ ) { + my $w = eval { $items[$i]->GetWindow }; + if ( $w && $w == $self->{bmp_preferences} ) { + $idx = $i; + last; + } } + $sz->Insert( $idx, $outer, 0, wxALIGN_CENTER_VERTICAL, 0 ); - my $d = $self->{d_render}; - my $ret = $d->ShowModal; - return unless $ret == wxID_OK; + # Initialize from saved state. + $state{"xpose_$_"} ||= 0 + for qw( enabled semitones accidentals ); + $self->{sp_xpose}->SetValue( $state{xpose_semitones} || 0 ); + $self->{ch_acc}->SetSelection( $state{xpose_accidentals} || 0 ); - my @args; - if ( $d->{cb_task_no_diagrams}->IsChecked ) { - push( @args, "--no-chord-grids" ); - } - if ( $d->{cb_task_lyrics_only}->IsChecked ) { - push( @args, "--lyrics-only", - "--define=delegates.abc.omit=1", - "--define=delegates.ly.omit=1" ); - } - if ( $d->{cb_task_decapo}->IsChecked ) { - push( @args, "--decapo" ); + $self->update_preview_tasks_state; +} + +# (Re)populate the custom-tasks checkboxes. Safe to call when the +# preset list has changed (e.g. on first refresh, or after Settings). +method refresh_preview_tasks_bar() { + return unless $self->{sz_customtasks_bar}; + + # Drop existing custom checkboxes. + my $i = 0; + while ( my $cb = delete $self->{"cb_customtask_$i"} ) { + $self->{sz_customtasks_bar}->Detach($cb); + $cb->Destroy; + $i++; } - # Transpose. See also Preview.pm. - $state{"xpose_$_"} ||= 0 - for qw( enabled semitones accidentals ); - if ( $state{xpose_enabled} ) { - my $pfx; - if ( $state{xpose_accidentals} == XP_SHARP ) { - $pfx = "s" + my $tasks = $state{presets}{tasks}; + if ( $tasks && %$tasks ) { + my $index = 0; + for my $task ( sort keys %$tasks ) { + my $cb = Wx::CheckBox->new + ( $self, wxID_ANY, $tasks->{$task}->{title} ); + $cb->SetToolTip(_T("Custom task: ").$tasks->{$task}->{title}); + $self->{"cb_customtask_$index"} = $cb; + $self->{sz_customtasks_bar}->Add + ( $cb, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + Wx::Event::EVT_CHECKBOX( $self, $cb->GetId, + $self->can("OnPreviewTaskChanged") ); + $index++; } - elsif ( $state{xpose_accidentals} == XP_FLAT ) { - $pfx = "f" - } - else { - $pfx = ""; - } - push( @ARGV, '--transpose', $state{xpose_semitones} . $pfx ); } + $self->{sz_toolbar}->Layout if $self->{sz_toolbar}; + $self->update_preview_tasks_state; +} + +# Enable/disable the entire preview-tasks section based on whether +# the preview pane is currently showing. +method update_preview_tasks_state() { + my $shown = $self->{sw_lr} && $self->{sw_lr}->IsSplit; + for my $name ( qw( l_preview_tasks + l_xpose + sp_xpose + ch_acc + cb_task_no_diagrams + cb_task_lyrics_only + cb_task_decapo ) ) { + $self->{$name}->Enable($shown) if $self->{$name}; + } + my $i = 0; + while ( my $cb = $self->{"cb_customtask_$i"} ) { + $cb->Enable($shown); + $i++; + } +} + +# Collect arguments from the toolbar controls. Also syncs the +# transpose state into %state so Preview.pm picks it up. +method preview_tasks_args() { + my @args; + return @args unless $self->{cb_task_no_diagrams}; # bar not built + + push( @args, "--no-chord-grids" ) + if $self->{cb_task_no_diagrams}->IsChecked; + push( @args, "--lyrics-only", + "--define=delegates.abc.omit=1", + "--define=delegates.ly.omit=1" ) + if $self->{cb_task_lyrics_only}->IsChecked; + push( @args, "--decapo" ) + if $self->{cb_task_decapo}->IsChecked; my $i = 0; - while ( exists $d->{"cb_customtask_$i"} ) { - if ( $d->{"cb_customtask_$i"}->IsChecked ) { - push( @args, "--config", - $state{presets}{tasks}{lc $d->{"cb_customtask_$i"}->GetLabel}->{file} ); + while ( my $cb = $self->{"cb_customtask_$i"} ) { + if ( $cb->IsChecked ) { + my $info = $state{presets}{tasks}{ lc $cb->GetLabel }; + push( @args, "--config", $info->{file} ) if $info; } $i++; } - $self->preview( \@args ); - $self->previewtooltip; + + # Sync transpose state for Preview.pm. See also Preview.pm. + # Transpose is "enabled" iff the user picked a non-zero offset. + my $semi = $self->{sp_xpose}->GetValue; + $state{xpose_enabled} = $semi ? 1 : 0; + $state{xpose_semitones} = $semi; + $state{xpose_accidentals} = $self->{ch_acc}->GetSelection; + + return @args; } -method OnPreviewNoDiagrams($event) { - $self->preview( [ '--no-chord-grids' ] ); - $self->previewtooltip; +# Bound to all Preview-Tasks toolbar widgets. Marks the preview as +# stale so OnIdle picks it up if Live Preview is enabled and the +# preview pane is open. +method OnPreviewTaskChanged($event) { + $state{editchanged}++; } method OnPreviewSave($event) { + unless ( $self->prv && $self->prv->have_preview ) { + # Generate a preview on the fly, without launching a viewer. + $self->preview( [], noviewer => 1 ); + } if ( $self->prv && $self->prv->have_preview ) { return $self->prv->save; } @@ -334,6 +498,7 @@ method previewtooltip() { $self->{bmb_preview}->SetToolTip(_T("Generate and show a new preview")); $mi->Check(0); } + $self->update_preview_tasks_state; $self->panel_focus; } diff --git a/lib/ChordPro/Wx/Preview.pm b/lib/ChordPro/Wx/Preview.pm index 2690f89d..42c658b2 100755 --- a/lib/ChordPro/Wx/Preview.pm +++ b/lib/ChordPro/Wx/Preview.pm @@ -233,7 +233,10 @@ method preview( $args, %opts ) { for qw( chordpro.css chordpro_print.css ); } - if ( !$preferences{enable_pdfviewer} + if ( $opts{noviewer} ) { + # Caller (e.g. Export to PDF) just wants the file generated. + } + elsif ( !$preferences{enable_pdfviewer} && $panel->{webview}->isa('Wx::WebView') ) { for ( $panel ) { @@ -244,7 +247,7 @@ method preview( $args, %opts ) { unless ( $_->{sw_lr}->IsSplit ) { $_->{sw_lr}->SplitVertically ( $_->{p_left}, $_->{p_right}, - $state{sash}{$_->panel."_lr"} // 0.5 ); + $state{sash}{$_->panel."_lr"} // 0 ); } } @@ -254,8 +257,7 @@ method preview( $args, %opts ) { ( $panel, $panel->{webview}, $self->can("OnWebViewError") ); use URI::file; - my $wf = URI::file->new($preview_file); - $wf =~ s;///([A-Z]):/;///$1|/;; + my $wf = URI::file->new($preview_file)->as_string; $self->log( 'I', "Preview " . substr($wf,0,128) ); $panel->{webview}->LoadURL($wf); } diff --git a/lib/ChordPro/Wx/SettingsDialog.pm b/lib/ChordPro/Wx/SettingsDialog.pm index bf3fea4f..ed6ea805 100755 --- a/lib/ChordPro/Wx/SettingsDialog.pm +++ b/lib/ChordPro/Wx/SettingsDialog.pm @@ -231,6 +231,7 @@ method fetch_prefs() { $self->prefs2colours; $self->{cb_editorwrap}->SetValue($preferences{editorwrap}); $self->{sp_editorwrap}->SetValue($preferences{editorwrapindent}); + $self->{cb_livepreview}->SetValue($preferences{livepreview}); # Messages. $self->{fp_messages}->SetSelectedFont( Wx::Font->new($preferences{msgsfont}) ); @@ -309,6 +310,7 @@ method store_prefs() { $self->colours2prefs; $preferences{editorwrap} = $self->{cb_editorwrap}->IsChecked; $preferences{editorwrapindent} = $self->{sp_editorwrap}->GetValue; + $preferences{livepreview} = $self->{cb_livepreview}->IsChecked; # Messages. $preferences{msgsfont} = $self->{fp_messages}->GetSelectedFont->GetNativeFontInfoDesc; @@ -622,6 +624,10 @@ method OnEditorWrapIndent( $event ) { $self->{t_editor}->refresh; } +method OnLivePreview( $event ) { + $preferences{livepreview} = $self->{cb_livepreview}->IsChecked; +} + method OnCbTmplFile($event) { my $n = $self->{cb_tmplfile}->IsChecked; $self->{fp_tmplfile}->Enable($n); diff --git a/lib/ChordPro/Wx/SettingsDialog.wxg b/lib/ChordPro/Wx/SettingsDialog.wxg index 6146e106..68d52474 100644 --- a/lib/ChordPro/Wx/SettingsDialog.wxg +++ b/lib/ChordPro/Wx/SettingsDialog.wxg @@ -890,6 +890,18 @@ + + 1, 2 + 0 + wxALIGN_CENTER_VERTICAL + + + OnLivePreview + + Automatically refresh the preview while editing + + + diff --git a/lib/ChordPro/Wx/SettingsDialog_wxg.pm b/lib/ChordPro/Wx/SettingsDialog_wxg.pm index 797b294d..b0b26461 100644 --- a/lib/ChordPro/Wx/SettingsDialog_wxg.pm +++ b/lib/ChordPro/Wx/SettingsDialog_wxg.pm @@ -318,7 +318,11 @@ sub new { $self->{fp_tmplfile} = ChordPro::Wx::FileDirPickerCtrl->new($self->{nb_editor}, wxID_ANY, "", "Select a template for new songs", "ChordPro files (*.cho,*.crd,*.chopro,*.chord,*.chordpro,*.pro)|*.cho;*.crd;*.chopro;*.chord;*.chordpro;*.pro;*.txt"); $self->{fp_tmplfile}->SetToolTip(_T("Template for new songs")); $self->{sizer_10}->Add($self->{fp_tmplfile}, Wx::GBPosition->new(4, 1), Wx::GBSpan->new(1, 1), wxEXPAND, 0); - + + $self->{cb_livepreview} = Wx::CheckBox->new($self->{nb_editor}, wxID_ANY, _T("Live preview")); + $self->{cb_livepreview}->SetToolTip(_T("Automatically refresh the preview while editing")); + $self->{sizer_10}->Add($self->{cb_livepreview}, Wx::GBPosition->new(5, 0), Wx::GBSpan->new(1, 2), wxALIGN_CENTER_VERTICAL, 0); + $self->{nb_messages} = Wx::Panel->new($self->{nb_preferences}, wxID_ANY); $self->{nb_preferences}->AddPage($self->{nb_messages}, _T("Messages")); @@ -462,6 +466,7 @@ sub new { Wx::Event::EVT_COLOURPICKER_CHANGED($self, $self->{cp_annbg}->GetId, $self->can('OnColourAnnBGChanged')); Wx::Event::EVT_TEXT($self, $self->{t_prefext}->GetId, $self->can('OnPrefExtChanged')); Wx::Event::EVT_CHECKBOX($self, $self->{cb_tmplfile}->GetId, $self->can('OnCbTmplFile')); + Wx::Event::EVT_CHECKBOX($self, $self->{cb_livepreview}->GetId, $self->can('OnLivePreview')); Wx::Event::EVT_FONTPICKER_CHANGED($self, $self->{fp_messages}->GetId, $self->can('OnMessagesFontPickerChanged')); Wx::Event::EVT_CHECKBOX($self, $self->{cb_pdfviewer}->GetId, $self->can('OnPDFViewer')); Wx::Event::EVT_CHECKBOX($self, $self->{cb_htmlviewer}->GetId, $self->can('OnHTMLViewer')); @@ -726,6 +731,15 @@ sub OnCbTmplFile { } +sub OnLivePreview { + my ($self, $event) = @_; + # wxGlade: ChordPro::Wx::SettingsDialog_wxg::OnLivePreview + warn "Event handler (OnLivePreview) not implemented"; + $event->Skip; + # end wxGlade +} + + sub OnMessagesFontPickerChanged { my ($self, $event) = @_; # wxGlade: ChordPro::Wx::SettingsDialog_wxg::OnMessagesFontPickerChanged diff --git a/lib/ChordPro/Wx/SongbookExportPanel.pm b/lib/ChordPro/Wx/SongbookExportPanel.pm index c754fcb0..c1f2cf96 100644 --- a/lib/ChordPro/Wx/SongbookExportPanel.pm +++ b/lib/ChordPro/Wx/SongbookExportPanel.pm @@ -36,6 +36,9 @@ BUILD { # Setup WebView, if possible. $self->setup_webview if $::options->{webview}//1; + # Inline "Preview Tasks" controls in the toolbar, left of Settings. + $self->setup_preview_tasks_bar; + # Single pane. $self->unsplit; } @@ -84,6 +87,7 @@ method refresh() { my $font = Wx::Font->new($preferences{msgsfont}); $self->{t_messages}->SetFont($font); setup_messages_ctxmenu($self); + $self->refresh_preview_tasks_bar; $self->previewtooltip; $self->messagestooltip; $self->set_focus; diff --git a/lib/ChordPro/Wx/Utils.pm b/lib/ChordPro/Wx/Utils.pm index 32db4495..0766bbe3 100644 --- a/lib/ChordPro/Wx/Utils.pm +++ b/lib/ChordPro/Wx/Utils.pm @@ -192,14 +192,12 @@ sub setup_menubar( $self ) { ] ], [ wxID_ANY, M_EDITOR|M_SONGBOOK, "Tasks", - [ [ wxID_ANY, M_EDITOR|M_SONGBOOK, "Default Preview\tCtrl-P", - "Preview with default formatting", "OnPreview" ], + [ [ wxID_ANY, M_EDITOR|M_SONGBOOK, "Preview\tCtrl-P", + "Generate the preview using the toolbar settings", "OnPreview" ], [ wxID_ANY, M_EDITOR|M_SONGBOOK, "No Chord Diagrams", "Preview without chord diagrams", "OnPreviewNoDiagrams" ], [ wxID_ANY, M_EDITOR|M_SONGBOOK, "Lyrics Only", "Preview with just the lyrics", "OnPreviewLyricsOnly" ], - [ wxID_ANY, M_EDITOR|M_SONGBOOK, "More...", - "Transpose, transcode, and more", "OnPreviewMore" ], [], ] ],