|
@@ -13,9 +13,10 @@ namespace BeatLyrics.Tool.UserControls
|
|
|
{
|
|
|
internal partial class TextArrangeUserControl : UserControl
|
|
|
{
|
|
|
- private static readonly Regex _reg = new Regex("([(\\(]\\p{IsHiragana}+[\\))])", RegexOptions.Compiled);
|
|
|
- private static readonly Regex _reg2 = new Regex("(<ruby=\\p{IsHiragana}+>)", RegexOptions.Compiled);
|
|
|
- private static readonly Regex _reg3 = new Regex("(</ruby>)", RegexOptions.Compiled);
|
|
|
+ private static readonly Regex RegRemoveRuby1 = new Regex("([(\\(]\\p{IsHiragana}+[\\))])", RegexOptions.Compiled);
|
|
|
+ private static readonly Regex RegRemoveRuby2 = new Regex("(<ruby=\\p{IsHiragana}+>)", RegexOptions.Compiled);
|
|
|
+ private static readonly Regex RegRemoveRuby3 = new Regex("(</ruby>)", RegexOptions.Compiled);
|
|
|
+ private static readonly Regex RegRubyConvert = new Regex("(<(.+?)=(\\p{IsHiragana}+)>)", RegexOptions.Compiled);
|
|
|
|
|
|
private LyricFileExt _file;
|
|
|
|
|
@@ -98,7 +99,7 @@ namespace BeatLyrics.Tool.UserControls
|
|
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
|
{
|
|
|
- if (false == ActiveControl is TextBox && keyData == Keys.Space)
|
|
|
+ if (false == ActiveControl is TextBox && (keyData == Keys.Space||keyData==Keys.ProcessKey))
|
|
|
{
|
|
|
if (OggAudioPlayer.IsPlaying) OggAudioPlayer.Stop();
|
|
|
else OggAudioPlayer.Play();
|
|
@@ -107,13 +108,6 @@ namespace BeatLyrics.Tool.UserControls
|
|
|
return base.ProcessCmdKey(ref msg, keyData);
|
|
|
}
|
|
|
|
|
|
- private void TextArrangeUserControl_KeyDown(object sender, KeyEventArgs e)
|
|
|
- {
|
|
|
- if (false == ActiveControl is TextBox && e.KeyCode == Keys.Space)
|
|
|
- {
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void PlayButton_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (OggAudioPlayer.IsPlaying) OggAudioPlayer.Stop();
|
|
@@ -176,11 +170,13 @@ namespace BeatLyrics.Tool.UserControls
|
|
|
|
|
|
private void RemoveRubyButton_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ //TODO: follow ruby format
|
|
|
foreach (LyricDetailExt item in LeftLyricsObjectListView.SelectedObjects)
|
|
|
{
|
|
|
- item.Text = _reg.Replace(item.Text, "");
|
|
|
- item.Text = _reg2.Replace(item.Text, "");
|
|
|
- item.Text = _reg3.Replace(item.Text, "");
|
|
|
+ item.Text = RegRemoveRuby1.Replace(item.Text, "");
|
|
|
+ item.Text = RegRemoveRuby2.Replace(item.Text, "");
|
|
|
+ item.Text = RegRemoveRuby3.Replace(item.Text, "");
|
|
|
+ item.Text = RegRubyConvert.Replace(item.Text, match => match.Groups[2].Value);
|
|
|
LeftLyricsObjectListView.UpdateObject(item);
|
|
|
}
|
|
|
}
|
|
@@ -189,8 +185,9 @@ namespace BeatLyrics.Tool.UserControls
|
|
|
{
|
|
|
foreach (LyricDetailExt item in LeftLyricsObjectListView.SelectedObjects)
|
|
|
{
|
|
|
- var arr = Utils.JapanesePhonetic.GetWords(item.Text);
|
|
|
+ var arr = JapanesePhonetic.GetWords(item.Text);
|
|
|
item.Text = string.Join("", arr.Select(p => p.ToString()));
|
|
|
+ item.TextWithRuby = string.Join("", arr.Select(p => p.ToRubyTmpString()));
|
|
|
LeftLyricsObjectListView.UpdateObject(item);
|
|
|
}
|
|
|
}
|