mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 05:02:36 +01:00
Trying to fix some undo/redo (do not undo to previous subtitle file name in most cases)
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2397 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
a5d8af915a
commit
d5e3ae1c90
@ -151,6 +151,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Keys _mainToggleFocus = Keys.None;
|
||||
Keys _mainListViewToggleDashes = Keys.None;
|
||||
Keys _mainListViewAutoDuration = Keys.None;
|
||||
Keys _mainListViewFocusWaveform = Keys.None;
|
||||
Keys _mainListViewCopyText = Keys.None;
|
||||
Keys _mainEditReverseStartAndEndingForRTL = Keys.None;
|
||||
Keys _waveformVerticalZoom = Keys.None;
|
||||
@ -161,6 +162,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Keys _waveformSearchSilenceForward = Keys.None;
|
||||
Keys _waveformSearchSilenceBack = Keys.None;
|
||||
Keys _waveformAddTextAtHere = Keys.None;
|
||||
Keys _waveformFocusListView = Keys.None;
|
||||
Keys _mainTranslateCustomSearch1 = Keys.None;
|
||||
Keys _mainTranslateCustomSearch2 = Keys.None;
|
||||
Keys _mainTranslateCustomSearch3 = Keys.None;
|
||||
@ -2026,6 +2028,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_subtitle.HistoryItems.RemoveAt(_subtitle.HistoryItems.Count - 1);
|
||||
}
|
||||
|
||||
_subtitle.FileName = _fileName;
|
||||
_subtitle.MakeHistoryForUndo(description, GetCurrentSubtitleFormat(), _fileDateTime, _subtitleAlternate, _subtitleAlternateFileName, _subtitleListViewIndex, textBoxListViewText.SelectionStart, textBoxListViewTextAlternate.SelectionStart);
|
||||
_undoIndex++;
|
||||
|
||||
@ -3333,10 +3336,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
openFileDialog1.InitialDirectory = saveFileDialog1.InitialDirectory;
|
||||
_converted = false;
|
||||
_fileName = saveFileDialog1.FileName;
|
||||
|
||||
_fileName = saveFileDialog1.FileName;
|
||||
_fileDateTime = File.GetLastWriteTime(_fileName);
|
||||
SetTitle();
|
||||
MakeHistoryForUndo(_language.Menu.File.SaveAs);
|
||||
Configuration.Settings.RecentFiles.Add(_fileName, FirstVisibleIndex, FirstSelectedIndex, _videoFileName, _subtitleAlternateFileName);
|
||||
Configuration.Settings.Save();
|
||||
|
||||
@ -3513,7 +3516,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
|
||||
|
||||
_subtitle = new Subtitle(_subtitle.HistoryItems);
|
||||
_subtitleAlternate = new Subtitle();
|
||||
_changeAlternateSubtitleToString = string.Empty;
|
||||
_changeSubtitleToString = string.Empty;
|
||||
_subtitleAlternateFileName = null;
|
||||
textBoxSource.Text = string.Empty;
|
||||
SubtitleListview1.Items.Clear();
|
||||
@ -5219,7 +5223,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
SetupAlternateEdit();
|
||||
}
|
||||
SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
|
||||
|
||||
ResetHistory();
|
||||
RestoreSubtitleListviewIndexes();
|
||||
_converted = true;
|
||||
SetTitle();
|
||||
@ -5380,6 +5384,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
_subtitle.HistoryItems[_undoIndex].RedoFileName = _fileName;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoFileModified = _fileDateTime;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoOriginalFileName = _subtitleAlternateFileName;
|
||||
|
||||
if (selectedIndex >= 0)
|
||||
{
|
||||
@ -5391,8 +5396,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
textBoxListViewTextAlternate.Text;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoLineIndex = selectedIndex;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoLinePosition = textBoxListViewText.SelectionStart;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoLinePositionAlternate =
|
||||
textBoxListViewTextAlternate.SelectionStart;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoLinePositionAlternate = textBoxListViewTextAlternate.SelectionStart;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5414,8 +5418,18 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
string oldFileName = _fileName;
|
||||
DateTime oldFileDateTime = _fileDateTime;
|
||||
|
||||
//DO NOT CHANGE FILE NAME?? _fileName = _subtitle.UndoHistory(_undoIndex, out subtitleFormatFriendlyName, out _fileDateTime, out _subtitleAlternate, out _subtitleAlternateFileName);
|
||||
_subtitle.UndoHistory(_undoIndex, out subtitleFormatFriendlyName, out _fileDateTime, out _subtitleAlternate, out _subtitleAlternateFileName);
|
||||
string oldAlternameFileName = _subtitleAlternateFileName;
|
||||
_fileName = _subtitle.UndoHistory(_undoIndex, out subtitleFormatFriendlyName, out _fileDateTime, out _subtitleAlternate, out _subtitleAlternateFileName);
|
||||
if (string.IsNullOrEmpty(oldAlternameFileName) && !string.IsNullOrEmpty(_subtitleAlternateFileName))
|
||||
{
|
||||
SubtitleListview1.ShowAlternateTextColumn(Configuration.Settings.Language.General.OriginalText);
|
||||
SubtitleListview1.AutoSizeAllColumns(this);
|
||||
}
|
||||
else if (SubtitleListview1.IsAlternateTextColumnVisible && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count == 0)
|
||||
{
|
||||
RemoveAlternate(true);
|
||||
}
|
||||
|
||||
if (!undo)
|
||||
{
|
||||
if (_subtitle.HistoryItems[_undoIndex].RedoParagraphs != null)
|
||||
@ -5438,6 +5452,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
_subtitle.HistoryItems[_undoIndex].RedoParagraphs = null;
|
||||
_subtitle.HistoryItems[_undoIndex].RedoParagraphsAlternate = null;
|
||||
if (SubtitleListview1.IsAlternateTextColumnVisible && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count == 0)
|
||||
{
|
||||
RemoveAlternate(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (string.Compare(oldFileName, _fileName, true) == 0)
|
||||
@ -5482,6 +5500,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (string.Compare(_subtitle.HistoryItems[_undoIndex].RedoFileName, _fileName, true) == 0)
|
||||
_fileDateTime = _subtitle.HistoryItems[_undoIndex].RedoFileModified;
|
||||
_fileName = _subtitle.HistoryItems[_undoIndex].RedoFileName;
|
||||
_subtitleAlternateFileName = _subtitle.HistoryItems[_undoIndex].RedoFileName;
|
||||
ShowStatus(_language.UndoPerformed);
|
||||
}
|
||||
|
||||
@ -10607,6 +10626,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
addParagraphHereToolStripMenuItem_Click(null, null);
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (audioVisualizer.Focused && e.KeyData == _waveformFocusListView)
|
||||
{
|
||||
SubtitleListview1.Focus();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
else if (audioVisualizer.Focused && e.KeyCode == Keys.Delete)
|
||||
{
|
||||
ToolStripMenuItemDeleteClick(null, null);
|
||||
@ -11122,6 +11146,14 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
MakeAutoDurationSelectedLines();
|
||||
}
|
||||
else if (e.KeyData == _mainListViewFocusWaveform)
|
||||
{
|
||||
if (audioVisualizer.CanFocus)
|
||||
{
|
||||
audioVisualizer.Focus();
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
else if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) //Ctrl+vPaste from clipboard
|
||||
{
|
||||
if (Clipboard.ContainsText())
|
||||
@ -13907,6 +13939,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_mainListViewToggleDashes = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewToggleDashes);
|
||||
toolStripMenuItemAlignment.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewAlignment);
|
||||
_mainListViewAutoDuration = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewAutoDuration);
|
||||
_mainListViewFocusWaveform = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewFocusWaveform);
|
||||
_mainEditReverseStartAndEndingForRTL = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainEditReverseStartAndEndingForRTL);
|
||||
_mainListViewCopyText = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewCopyText);
|
||||
toolStripMenuItemColumnDeleteText.ShortcutKeys = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainListViewColumnDeleteText);
|
||||
@ -13949,6 +13982,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_waveformSearchSilenceForward = Utilities.GetKeys(Configuration.Settings.Shortcuts.WaveformSearchSilenceForward);
|
||||
_waveformSearchSilenceBack = Utilities.GetKeys(Configuration.Settings.Shortcuts.WaveformSearchSilenceBack);
|
||||
_waveformAddTextAtHere = Utilities.GetKeys(Configuration.Settings.Shortcuts.WaveformAddTextHere);
|
||||
_waveformFocusListView = Utilities.GetKeys(Configuration.Settings.Shortcuts.WaveformFocusListView);
|
||||
_mainTranslateCustomSearch1 = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch1);
|
||||
_mainTranslateCustomSearch2 = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch2);
|
||||
_mainTranslateCustomSearch3 = Utilities.GetKeys(Configuration.Settings.Shortcuts.MainTranslateCustomSearch3);
|
||||
@ -16577,6 +16611,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_subtitleAlternateFileName = _fileName;
|
||||
_fileName = null;
|
||||
SetupAlternateEdit();
|
||||
ResetHistory();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,6 +632,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewColumnDelete + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewColumnDeleteText));
|
||||
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewColumnInsert + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewColumnInsertText));
|
||||
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewColumnPaste + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewColumnPaste));
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.ListViewFocusWaveform))
|
||||
listViewNode.Nodes.Add(Configuration.Settings.Language.Settings.ListViewFocusWaveform + GetShortcutText(Configuration.Settings.Shortcuts.MainListViewFocusWaveform));
|
||||
treeViewShortcuts.Nodes.Add(listViewNode);
|
||||
|
||||
var textBoxNode = new TreeNode(Configuration.Settings.Language.Settings.TextBox);
|
||||
@ -695,9 +697,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.WaveformPlayFirstSelectedSubtitle))
|
||||
audioVisualizerNode.Nodes.Add(Configuration.Settings.Language.Settings.WaveformPlayFirstSelectedSubtitle + GetShortcutText(Configuration.Settings.Shortcuts.WaveformPlayFirstSelected));
|
||||
audioVisualizerNode.Nodes.Add(Configuration.Settings.Language.Main.VideoControls.InsertNewSubtitleAtVideoPosition + GetShortcutText(Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition));
|
||||
if (!string.IsNullOrEmpty(Configuration.Settings.Language.Settings.WaveformFocusListView))
|
||||
audioVisualizerNode.Nodes.Add(Configuration.Settings.Language.Settings.WaveformFocusListView + GetShortcutText(Configuration.Settings.Shortcuts.WaveformFocusListView));
|
||||
treeViewShortcuts.Nodes.Add(audioVisualizerNode);
|
||||
|
||||
|
||||
foreach (TreeNode node in treeViewShortcuts.Nodes)
|
||||
{
|
||||
node.Text = node.Text.Replace("&", string.Empty);
|
||||
@ -1288,6 +1291,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.Shortcuts.MainListViewColumnInsertText = GetShortcut(node.Text);
|
||||
else if (text == Configuration.Settings.Language.Settings.ListViewColumnPaste.Replace("&", string.Empty))
|
||||
Configuration.Settings.Shortcuts.MainListViewColumnPaste = GetShortcut(node.Text);
|
||||
else if (Configuration.Settings.Language.Settings.ListViewFocusWaveform != null && text == Configuration.Settings.Language.Settings.ListViewFocusWaveform.Replace("&", string.Empty))
|
||||
Configuration.Settings.Shortcuts.MainListViewFocusWaveform = GetShortcut(node.Text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1414,6 +1419,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.Shortcuts.WaveformAddTextHere = GetShortcut(node.Text);
|
||||
else if (Configuration.Settings.Language.Main.VideoControls.InsertNewSubtitleAtVideoPosition != null && text == Configuration.Settings.Language.Main.VideoControls.InsertNewSubtitleAtVideoPosition.Replace("&", string.Empty))
|
||||
Configuration.Settings.Shortcuts.MainWaveformInsertAtCurrentPosition = GetShortcut(node.Text);
|
||||
|
||||
else if (Configuration.Settings.Language.Settings.WaveformFocusListView != null && text == Configuration.Settings.Language.Settings.WaveformFocusListView.Replace("&", string.Empty))
|
||||
Configuration.Settings.Shortcuts.WaveformFocusListView = GetShortcut(node.Text);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public int RedoLinePositionAlternate { get; set; }
|
||||
public string RedoFileName { get; set; }
|
||||
public DateTime RedoFileModified { get; set; }
|
||||
public string RedoOriginalFileName { get; set; }
|
||||
public int LineIndex { get; set; }
|
||||
public int LinePosition { get; set; }
|
||||
public int LinePositionAlternate { get; set; }
|
||||
|
@ -1802,6 +1802,7 @@ can edit in same subtitle file (collaboration)",
|
||||
WaveformAddTextHere = "Add text here (for new selection)",
|
||||
WaveformPlayNewSelection = "Play new selection",
|
||||
WaveformPlayFirstSelectedSubtitle = "Play first selected subtitle",
|
||||
WaveformFocusListView = "Focus list view",
|
||||
GoBack1Frame = "One frame back",
|
||||
GoForward1Frame = "One frame forward",
|
||||
GoBack100Milliseconds = "100 ms back",
|
||||
@ -1836,7 +1837,8 @@ can edit in same subtitle file (collaboration)",
|
||||
ToggleTranslationAndOriginalInPreviews = "Toggle translation and original in video/audio preview",
|
||||
ListViewColumnDelete = "Column, delete text",
|
||||
ListViewColumnInsert = "Column, insert text",
|
||||
ListViewColumnPaste ="Column, paste",
|
||||
ListViewColumnPaste = "Column, paste",
|
||||
ListViewFocusWaveform = "Focus waveform/spectrogram",
|
||||
ShowBeamer = "Start subtitle fullscreen beamer",
|
||||
MainTextBoxMoveLastWordDown = "Move last word down to next subtitle line",
|
||||
MainTextBoxMoveFirstWordFromNextUp = "Move first word from next subtitle line up",
|
||||
|
@ -1697,6 +1697,7 @@
|
||||
public string WaveformAddTextHere { get; set; }
|
||||
public string WaveformPlayNewSelection { get; set; }
|
||||
public string WaveformPlayFirstSelectedSubtitle { get; set; }
|
||||
public string WaveformFocusListView { get; set; }
|
||||
public string GoBack1Frame { get; set; }
|
||||
public string GoForward1Frame { get; set; }
|
||||
public string GoBack100Milliseconds { get; set; }
|
||||
@ -1732,6 +1733,7 @@
|
||||
public string ListViewColumnDelete { get; set; }
|
||||
public string ListViewColumnInsert { get; set; }
|
||||
public string ListViewColumnPaste { get; set; }
|
||||
public string ListViewFocusWaveform { get; set; }
|
||||
public string ShowBeamer { get; set; }
|
||||
public string MainTextBoxMoveLastWordDown { get; set; }
|
||||
public string MainTextBoxMoveFirstWordFromNextUp { get; set; }
|
||||
|
@ -757,6 +757,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public string MainListViewColumnDeleteText { get; set; }
|
||||
public string MainListViewColumnInsertText { get; set; }
|
||||
public string MainListViewColumnPaste { get; set; }
|
||||
public string MainListViewFocusWaveform { get; set; }
|
||||
public string MainTextBoxItalic { get; set; }
|
||||
public string MainTextBoxSplitAtCursor { get; set; }
|
||||
public string MainTextBoxMoveLastWordDown { get; set; }
|
||||
@ -795,6 +796,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public string WaveformSearchSilenceForward { get; set; }
|
||||
public string WaveformSearchSilenceBack { get; set; }
|
||||
public string WaveformAddTextHere { get; set; }
|
||||
public string WaveformFocusListView { get; set; }
|
||||
public string MainTranslateCustomSearch1 { get; set; }
|
||||
public string MainTranslateCustomSearch2 { get; set; }
|
||||
public string MainTranslateCustomSearch3 { get; set; }
|
||||
@ -2168,6 +2170,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
subNode = node.SelectSingleNode("MainListViewColumnPaste");
|
||||
if (subNode != null)
|
||||
settings.Shortcuts.MainListViewColumnPaste = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("MainListViewFocusWaveform");
|
||||
if (subNode != null)
|
||||
settings.Shortcuts.MainListViewFocusWaveform = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("MainEditReverseStartAndEndingForRTL");
|
||||
if (subNode != null)
|
||||
settings.Shortcuts.MainEditReverseStartAndEndingForRTL = subNode.InnerText;
|
||||
@ -2285,6 +2290,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
subNode = node.SelectSingleNode("WaveformAddTextHere");
|
||||
if (subNode != null)
|
||||
settings.Shortcuts.WaveformAddTextHere = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("WaveformFocusListView");
|
||||
if (subNode != null)
|
||||
settings.Shortcuts.WaveformFocusListView = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("MainTranslateCustomSearch1");
|
||||
if (subNode != null)
|
||||
settings.Shortcuts.MainTranslateCustomSearch1 = subNode.InnerText;
|
||||
@ -2785,6 +2793,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
textWriter.WriteElementString("MainListViewColumnDeleteText", settings.Shortcuts.MainListViewColumnDeleteText);
|
||||
textWriter.WriteElementString("MainListViewColumnInsertText", settings.Shortcuts.MainListViewColumnInsertText);
|
||||
textWriter.WriteElementString("MainListViewColumnPaste", settings.Shortcuts.MainListViewColumnPaste);
|
||||
textWriter.WriteElementString("MainListViewFocusWaveform", settings.Shortcuts.MainListViewFocusWaveform);
|
||||
textWriter.WriteElementString("MainEditReverseStartAndEndingForRTL", settings.Shortcuts.MainEditReverseStartAndEndingForRTL);
|
||||
textWriter.WriteElementString("MainTextBoxItalic", settings.Shortcuts.MainTextBoxItalic);
|
||||
textWriter.WriteElementString("MainTextBoxSplitAtCursor", settings.Shortcuts.MainTextBoxSplitAtCursor);
|
||||
@ -2824,6 +2833,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
textWriter.WriteElementString("WaveformSearchSilenceForward", settings.Shortcuts.WaveformSearchSilenceForward);
|
||||
textWriter.WriteElementString("WaveformSearchSilenceBack", settings.Shortcuts.WaveformSearchSilenceBack);
|
||||
textWriter.WriteElementString("WaveformAddTextHere", settings.Shortcuts.WaveformAddTextHere);
|
||||
textWriter.WriteElementString("WaveformFocusListView", settings.Shortcuts.WaveformFocusListView);
|
||||
textWriter.WriteElementString("MainTranslateCustomSearch1", settings.Shortcuts.MainTranslateCustomSearch1);
|
||||
textWriter.WriteElementString("MainTranslateCustomSearch2", settings.Shortcuts.MainTranslateCustomSearch2);
|
||||
textWriter.WriteElementString("MainTranslateCustomSearch3", settings.Shortcuts.MainTranslateCustomSearch3);
|
||||
|
Loading…
Reference in New Issue
Block a user