diff --git a/Controls/AviSynthListView.vb b/Controls/AviSynthListView.vb index 2452c0bc..aef20674 100644 --- a/Controls/AviSynthListView.vb +++ b/Controls/AviSynthListView.vb @@ -39,7 +39,6 @@ Public Class AviSynthListView Sub Load() BlockItemCheck = True Items.Clear() - BeginUpdate() For Each i In ProfileFunc.Invoke.Filters @@ -47,15 +46,13 @@ Public Class AviSynthListView item.Tag = i item.Checked = i.Active item.SubItems.Add(i.Category) - item.SubItems.Add(i.Name) + If i.Name = "" Then item.SubItems.Add(i.Script) Else item.SubItems.Add(i.Name) item.SubItems.Add(i.Script) Items.Add(item) Next AutoResizeColumns(True) - EndUpdate() - BlockItemCheck = False End Sub @@ -117,6 +114,7 @@ Public Class AviSynthListView End If Dim add = Menu.Add("Add") + add.SetImage(Symbol.Add) Dim addFirst = Menu.Add("Add | a") AddHandler add.DropDownOpened, Sub() @@ -133,16 +131,17 @@ Public Class AviSynthListView End Sub If SelectedItems.Count > 0 Then - Menu.Items.Add(New ToolStripSeparator) - Menu.Items.Add(New ActionMenuItem("Remove", AddressOf RemoveClick, "Removes the selected filter.")) + Menu.Add("-") + Menu.Add("Remove", AddressOf RemoveClick, "Removes the selected filter.").SetImage(Symbol.Remove) End If - Menu.Items.Add(New ActionMenuItem("Edit Code...", AddressOf ShowEditor, "Dialog to edit filters.")) - Menu.Items.Add(New ActionMenuItem("Preview Code...", AddressOf CodePreview, "Script code preview.")) - Menu.Items.Add(New ActionMenuItem("Play", Sub() g.PlayScript(p.Script), "Plays the script with the AVI player.", p.SourceFile <> "")) - Menu.Items.Add(New ActionMenuItem("Profiles...", AddressOf g.MainForm.ShowFilterProfilesDialog, "Dialog to edit profiles.")) + Menu.Add("Edit Code...", AddressOf ShowEditor, "Dialog to edit filters.").SetImage(Symbol.Code) + Menu.Add("Preview Code...", AddressOf CodePreview, "Script code preview.") + Menu.Add("Play", Sub() g.PlayScript(p.Script), "Plays the script with the AVI player.").SetImage(Symbol.Play) + Menu.Add("Profiles...", AddressOf g.MainForm.ShowFilterProfilesDialog, "Dialog to edit profiles.") Dim setup = Menu.Add("Filter Setup") + setup.SetImage(Symbol.MultiSelect) g.PopulateProfileMenu(setup.DropDownItems, s.FilterSetupProfiles, AddressOf g.MainForm.ShowFilterSetupProfilesDialog, AddressOf g.MainForm.LoadScriptProfile) End Sub @@ -151,21 +150,30 @@ Public Class AviSynthListView End Sub Sub ReplaceClick(filter As VideoFilter) - filter.Script = Macro.SolveInteractive(filter.Script) + Dim tup = Macro.SolveInteractive(filter.Script) + If tup.cancel Then Exit Sub + If tup.value <> filter.Script Then filter.Path = tup.value.Trim + filter.Script = tup.value Dim index = SelectedItems(0).Index ProfileFunc.Invoke.SetFilter(index, filter) Items(index).Selected = True End Sub Private Sub InsertClick(filter As VideoFilter) - filter.Script = Macro.SolveInteractive(filter.Script) + Dim tup = Macro.SolveInteractive(filter.Script) + If tup.cancel Then Exit Sub + If tup.value <> filter.Script Then filter.Path = tup.value.Trim + filter.Script = tup.value Dim index = SelectedItems(0).Index ProfileFunc.Invoke.InsertFilter(index, filter) Items(index).Selected = True End Sub Private Sub AddClick(filter As VideoFilter) - filter.Script = Macro.SolveInteractive(filter.Script) + Dim tup = Macro.SolveInteractive(filter.Script) + If tup.cancel Then Exit Sub + If tup.value <> filter.Script Then filter.Path = tup.value.Trim + filter.Script = tup.value ProfileFunc.Invoke.AddFilter(filter) Items(Items.Count - 1).Selected = True End Sub @@ -265,8 +273,7 @@ Public Class AviSynthListView f.cbWrap.Visible = False f.tb.Text = p.Script.GetFullScript f.tb.SelectionStart = f.tb.Text.Length - f.tb.SelectionLength = 0 - f.Text = "Script Preview" + f.Text = "Code Preview" f.Width = 800 f.Height = 500 f.bOK.Visible = False diff --git a/Encoding/IntelEncoder.vb b/Encoding/IntelEncoder.vb index ca50583e..36ec80da 100644 --- a/Encoding/IntelEncoder.vb +++ b/Encoding/IntelEncoder.vb @@ -49,7 +49,7 @@ Public Class IntelEncoder SaveProfile(enc) End Sub - ActionMenuItem.Add(f.cms.Items, "Save Profile...", saveProfileAction).Symbol = Symbol.Save + ActionMenuItem.Add(f.cms.Items, "Save Profile...", saveProfileAction).SetImage(Symbol.Save) f.cms.Items.Add(New ActionMenuItem("Check Environment", Sub() g.ShowCode("Check Environment", ProcessHelp.GetStdOut(Package.QSVEncC.Path, "--check-environment")))) f.cms.Items.Add(New ActionMenuItem("Check Hardware", Sub() MsgInfo(ProcessHelp.GetStdOut(Package.QSVEncC.Path, "--check-hw")))) f.cms.Items.Add(New ActionMenuItem("Check Features", Sub() g.ShowCode("Check Features", ProcessHelp.GetStdOut(Package.QSVEncC.Path, "--check-features")))) diff --git a/Encoding/NVIDIAEncoder.vb b/Encoding/NVIDIAEncoder.vb index b7aeda9b..d8146a32 100644 --- a/Encoding/NVIDIAEncoder.vb +++ b/Encoding/NVIDIAEncoder.vb @@ -50,7 +50,7 @@ Public Class NVIDIAEncoder f.cms.Items.Add(New ActionMenuItem("Check Hardware", Sub() MsgInfo(ProcessHelp.GetStdOut(Package.NVEncC.Path, "--check-hw")))) f.cms.Items.Add(New ActionMenuItem("Check Features", Sub() g.ShowCode("Check Features", ProcessHelp.GetStdOut(Package.NVEncC.Path, "--check-features")))) f.cms.Items.Add(New ActionMenuItem("Check Environment", Sub() g.ShowCode("Check Environment", ProcessHelp.GetErrorOut(Package.NVEncC.Path, "--check-environment")))) - ActionMenuItem.Add(f.cms.Items, "Save Profile...", saveProfileAction).Symbol = Symbol.Save + ActionMenuItem.Add(f.cms.Items, "Save Profile...", saveProfileAction).SetImage(Symbol.Save) If f.ShowDialog() = DialogResult.OK Then Params = newParams diff --git a/Encoding/x265.vb b/Encoding/x265.vb index 9b41be94..b040f0c5 100644 --- a/Encoding/x265.vb +++ b/Encoding/x265.vb @@ -156,7 +156,7 @@ Public Class x265Encoder SaveProfile(enc) End Sub - ActionMenuItem.Add(f.cms.Items, "Save Profile...", saveProfileAction).Symbol = Symbol.Save + ActionMenuItem.Add(f.cms.Items, "Save Profile...", saveProfileAction).SetImage(Symbol.Save) If f.ShowDialog() = DialogResult.OK Then Params = newParams diff --git a/Forms/AudioForm.vb b/Forms/AudioForm.vb index 90dc895e..8f0d0426 100644 --- a/Forms/AudioForm.vb +++ b/Forms/AudioForm.vb @@ -41,13 +41,9 @@ Class AudioForm Friend WithEvents FlowLayoutPanel1 As System.Windows.Forms.FlowLayoutPanel Friend WithEvents cbNormalize As StaxRip.UI.CheckBoxEx Friend WithEvents MenuStrip As System.Windows.Forms.MenuStrip - Friend WithEvents CommandLineToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents miCopyComandLine As StaxRip.UI.MenuItemEx - Friend WithEvents miShowPaths As StaxRip.UI.MenuItemEx - Friend WithEvents miExecute As StaxRip.UI.MenuItemEx + Friend WithEvents miCommandLine As System.Windows.Forms.ToolStripMenuItem Friend WithEvents miProfiles As System.Windows.Forms.ToolStripMenuItem Friend WithEvents miHelp As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents miDialogHelp As StaxRip.UI.MenuItemEx Friend WithEvents SimpleUI As StaxRip.SimpleUI Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents numGain As StaxRip.UI.NumEdit @@ -90,13 +86,9 @@ Class AudioForm Me.bnCancel = New StaxRip.UI.ButtonEx() Me.FlowLayoutPanel1 = New System.Windows.Forms.FlowLayoutPanel() Me.MenuStrip = New System.Windows.Forms.MenuStrip() - Me.CommandLineToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.miCopyComandLine = New StaxRip.UI.MenuItemEx() - Me.miExecute = New StaxRip.UI.MenuItemEx() - Me.miShowPaths = New StaxRip.UI.MenuItemEx() + Me.miCommandLine = New System.Windows.Forms.ToolStripMenuItem() Me.miProfiles = New System.Windows.Forms.ToolStripMenuItem() Me.miHelp = New System.Windows.Forms.ToolStripMenuItem() - Me.miDialogHelp = New StaxRip.UI.MenuItemEx() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() Me.FlowLayoutPanel2 = New System.Windows.Forms.FlowLayoutPanel() Me.gbBasic.SuspendLayout() @@ -434,7 +426,7 @@ Class AudioForm ' Me.MenuStrip.AutoSize = False Me.MenuStrip.ImageScalingSize = New System.Drawing.Size(24, 24) - Me.MenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.CommandLineToolStripMenuItem, Me.miProfiles, Me.miHelp}) + Me.MenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miCommandLine, Me.miProfiles, Me.miHelp}) Me.MenuStrip.Location = New System.Drawing.Point(0, 0) Me.MenuStrip.Name = "MenuStrip" Me.MenuStrip.Size = New System.Drawing.Size(972, 42) @@ -443,34 +435,9 @@ Class AudioForm ' 'CommandLineToolStripMenuItem ' - Me.CommandLineToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miCopyComandLine, Me.miExecute, Me.miShowPaths}) - Me.CommandLineToolStripMenuItem.Name = "CommandLineToolStripMenuItem" - Me.CommandLineToolStripMenuItem.Size = New System.Drawing.Size(291, 38) - Me.CommandLineToolStripMenuItem.Text = " Command Line " - ' - 'miCopyComandLine - ' - Me.miCopyComandLine.Help = Nothing - Me.miCopyComandLine.Name = "miCopyComandLine" - Me.miCopyComandLine.Padding = New System.Windows.Forms.Padding(12, 8, 12, 8) - Me.miCopyComandLine.Size = New System.Drawing.Size(458, 68) - Me.miCopyComandLine.Text = "Copy to clipboard" - ' - 'miExecute - ' - Me.miExecute.Help = Nothing - Me.miExecute.Name = "miExecute" - Me.miExecute.Padding = New System.Windows.Forms.Padding(12, 8, 12, 8) - Me.miExecute.Size = New System.Drawing.Size(458, 68) - Me.miExecute.Text = "Execute" - ' - 'miShowPaths - ' - Me.miShowPaths.Help = Nothing - Me.miShowPaths.Name = "miShowPaths" - Me.miShowPaths.Padding = New System.Windows.Forms.Padding(12, 8, 12, 8) - Me.miShowPaths.Size = New System.Drawing.Size(458, 68) - Me.miShowPaths.Text = "Show paths" + Me.miCommandLine.Name = "CommandLineToolStripMenuItem" + Me.miCommandLine.Size = New System.Drawing.Size(291, 38) + Me.miCommandLine.Text = " Command Line " ' 'miProfiles ' @@ -480,19 +447,10 @@ Class AudioForm ' 'miHelp ' - Me.miHelp.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.miDialogHelp}) Me.miHelp.Name = "miHelp" Me.miHelp.Size = New System.Drawing.Size(127, 38) Me.miHelp.Text = " Help " ' - 'miDialogHelp - ' - Me.miDialogHelp.Help = Nothing - Me.miDialogHelp.Name = "miDialogHelp" - Me.miDialogHelp.Padding = New System.Windows.Forms.Padding(12, 8, 12, 8) - Me.miDialogHelp.Size = New System.Drawing.Size(410, 68) - Me.miDialogHelp.Text = "Help" - ' 'TableLayoutPanel1 ' Me.TableLayoutPanel1.AutoSize = True @@ -583,25 +541,21 @@ Class AudioForm numBitrate.Minimum = 16 numBitrate.Maximum = 16000 - numGain.DecimalPlaces = 1 If components Is Nothing Then components = New System.ComponentModel.Container - + rtbCmdlPreview.ScrollBars = RichTextBoxScrollBars.None - miShowPaths.Checked = s.ShowPathsInCommandLine UpdateProfilesMenu() - If g.IsCulture("de") Then - ActionMenuItem.Add(miHelp.DropDownItems, "BeSweet | Kommandozeilenreferenz", Sub() g.ShellExecute("http://brother-john.net/besweet-referenz.html")) - Else - ActionMenuItem.Add(miHelp.DropDownItems, "BeSweet | Commandline Reference", Sub() g.ShellExecute("http://brother-john.net/besweet-reference.html")) - End If + ActionMenuItem.Add(miCommandLine.DropDownItems, "Copy", Sub() Clipboard.SetText(TempProfile.GetCommandLine(True))).SetImage(Symbol.Copy) + ActionMenuItem.Add(miCommandLine.DropDownItems, "Execute", AddressOf Execute).SetImage(Symbol.fa_terminal) + ActionMenuItem.Add(miCommandLine.DropDownItems, "Show", Sub() g.ShowCommandLinePreview(TempProfile.GetCommandLine(True))) - ActionMenuItem.Add(miHelp.DropDownItems, "eac3to wiki", Sub() g.ShellExecute("http://en.wikibooks.org/wiki/Eac3to")) - ActionMenuItem.Add(miHelp.DropDownItems, "ffmpeg help file", Sub() g.ShellExecute(Package.ffmpeg.GetHelpPath)) - ActionMenuItem.Add(miHelp.DropDownItems, "KpeX Audio FAQ", Sub() g.ShellExecute("http://forum.doom9.org/showthread.php?t=68300")) + ActionMenuItem.Add(miHelp.DropDownItems, "Help", AddressOf ShowHelp).SetImage(Symbol.Help) + ActionMenuItem.Add(miHelp.DropDownItems, "eac3to", Sub() g.ShellExecute("http://en.wikibooks.org/wiki/Eac3to")) + ActionMenuItem.Add(miHelp.DropDownItems, "ffmpeg", Sub() g.ShellExecute(Package.ffmpeg.GetHelpPath)) g.SetRenderer(MenuStrip) MenuStrip.Font = New Font("Segoe UI", 9 * s.UIScaleFactor) @@ -677,7 +631,7 @@ Class AudioForm numBitrate.Increment = If(TempProfile.Params.Codec = AudioCodec.AC3, 32D, 1D) tbName.SendMessageCue(TempProfile.Name, False) - rtbCmdlPreview.SetText(TempProfile.GetCommandLine(s.ShowPathsInCommandLine)) + rtbCmdlPreview.SetText(TempProfile.GetCommandLine(False)) UpdateHeight(rtbCmdlPreview) End Sub @@ -777,16 +731,10 @@ Class AudioForm UpdateControls() End Sub - Sub ToogleShowPaths() - s.ShowPathsInCommandLine = Not s.ShowPathsInCommandLine - miShowPaths.Checked = s.ShowPathsInCommandLine - Application.DoEvents() - UpdateControls() - End Sub - Private Sub AudioForm_Shown(sender As Object, e As EventArgs) Handles Me.Shown UpdateControls() Refresh() + ActiveControl = mbCodec For Each i In Language.Languages If i.IsCommon Then @@ -795,8 +743,6 @@ Class AudioForm mbLanguage.Add("More | " + i.ToString.Substring(0, 1).ToUpper + " | " + i.ToString, i) End If Next - - ActiveControl = mbCodec End Sub Private Sub tbName_TextChanged(sender As Object, e As EventArgs) Handles tbName.TextChanged @@ -813,7 +759,10 @@ Class AudioForm miProfiles.DropDownItems.Add("-") - miProfiles.DropDownItems.Add(New ActionMenuItem("Save", Sub() SaveProfile(), "Saves the current settings as profile")) + Dim save = New ActionMenuItem("Save", Sub() SaveProfile(), "Saves the current settings as profile") + save.SetImage(Symbol.Save) + miProfiles.DropDownItems.Add(save) + miProfiles.DropDownItems.Add(New ActionMenuItem("Edit...", Sub() EditProfiles(), "Shows the profiles dialog to edit the audio profiles")) End Sub @@ -1075,15 +1024,7 @@ Class AudioForm UpdateControls() End Sub - Private Sub miCopyComandLine_Click(sender As Object, e As EventArgs) Handles miCopyComandLine.Click - Clipboard.SetText(TempProfile.GetCommandLine(True)) - End Sub - - Private Sub miShowPaths_Click(sender As Object, e As EventArgs) Handles miShowPaths.Click - ToogleShowPaths() - End Sub - - Private Sub miExecute_Click(sender As Object, e As EventArgs) Handles miExecute.Click + Private Sub Execute() If TempProfile.File <> "" Then If Not TempProfile.SupportedInput.Contains(Filepath.GetExt(TempProfile.File)) Then MsgWarn("The input format isn't supported," + BR + "please decode first using:" + BR2 + "Codec: WAV" + BR + "Encoder: ffmpeg") @@ -1096,10 +1037,10 @@ Class AudioForm End Sub Private Sub CommandLineAudioSettingsForm_HelpRequested() Handles Me.HelpRequested - miDialogHelp.PerformClick() + ShowHelp() End Sub - Private Sub miDialogHelp_Click(sender As Object, e As EventArgs) Handles miDialogHelp.Click + Private Sub ShowHelp() Dim f As New HelpForm() f.Doc.WriteStart(Text) f.Doc.WriteTips(TipProvider.GetTips, SimpleUI.ActivePage.TipProvider.GetTips) diff --git a/Forms/CodeEditor.vb b/Forms/CodeEditor.vb index 16a2743d..000df4b1 100644 --- a/Forms/CodeEditor.vb +++ b/Forms/CodeEditor.vb @@ -50,7 +50,7 @@ Class CodeEditor ret.cbActive.Checked = filter.Active ret.cbActive.Text = filter.Category ret.tbName.Text = filter.Name - ret.rtbScript.Text = Macro.SolveInteractive(If(filter.Script = "", "", filter.Script + BR)) + ret.rtbScript.Text = If(filter.Script = "", "", filter.Script + BR) ret.SetColor() Return ret @@ -134,7 +134,7 @@ Class CodeEditor cbActive.Margin = New Padding(0) tbName.Dock = DockStyle.Top - tbName.Margin = New Padding(0, 0, 12, 0) + tbName.Margin = New Padding(0, 0, 0, 0) rtbScript = New RichTextBoxEx(False) rtbScript.EnableAutoDragDrop = True @@ -280,7 +280,7 @@ Class CodeEditor End If Next - If Menu.Items.Count > 0 Then Menu.Items.Add(New ToolStripSeparator) + If Menu.Items.Count > 0 Then Menu.Add("-") For Each i In filterProfiles If i.Name = cbActive.Text Then @@ -303,7 +303,7 @@ Class CodeEditor ActionMenuItem.Add(Menu.Items, "Blank", AddressOf ReplaceClick, New VideoFilter("Misc", "", "")) - Menu.Items.Add(New ToolStripSeparator) + Menu.Add("-") Dim replace = Menu.Add("Replace") Dim insert = Menu.Add("Insert") @@ -334,9 +334,9 @@ Class CodeEditor Next Next End Sub + Dim add = Menu.Add("Add") + add.SetImage(Symbol.Add) - Dim add As New MenuItemEx("Add") - Menu.Items.Add(add) ActionMenuItem.Add(add.DropDownItems, "Blank", AddressOf AddClick, New VideoFilter("Misc", "", "")) AddHandler add.DropDownOpened, Sub() @@ -350,27 +350,33 @@ Class CodeEditor Next Next End Sub + Menu.Add("-") - Menu.Items.Add(New ToolStripSeparator) + Dim removeMenuItem = Menu.Add("Remove", AddressOf RemoveClick) + removeMenuItem.ShortcutKeyDisplayString = KeysHelp.GetKeyString(Keys.Control Or Keys.Delete) + removeMenuItem.SetImage(Symbol.Remove) - Menu.Add("Remove", AddressOf RemoveClick).ShortcutKeyDisplayString = KeysHelp.GetKeyString(Keys.Control Or Keys.Delete) Menu.Add("Profiles...", AddressOf g.MainForm.ShowFilterProfilesDialog, "Dialog to edit profiles.") - Menu.Add("Macros...", AddressOf MacrosForm.ShowDialogForm, "Dialog to edit profiles.") - Menu.Add("Preview Code...", AddressOf CodePreview, "Previews the script with solved macros.") + Menu.Add("Macros...", AddressOf MacrosForm.ShowDialogForm, "Dialog to edit profiles.").SetImage(Symbol.CalculatorPercentage) + Menu.Add("Preview Code...", AddressOf CodePreview, "Previews the script with solved macros.").SetImage(Symbol.Code) Menu.Add("Join Filters", AddressOf JoinFilters, "Joins all filters into one filter.").Enabled = DirectCast(Parent, FlowLayoutPanel).Controls.Count > 1 - Dim mi = Menu.Add("Video Preview...", AddressOf Editor.VideoPreview, "Previews the script with solved macros.") - mi.Enabled = p.SourceFile <> "" - mi.ShortcutKeyDisplayString = "F5" + Dim previewMenuItem = Menu.Add("Video Preview...", AddressOf Editor.VideoPreview, "Previews the script with solved macros.") + previewMenuItem.Enabled = p.SourceFile <> "" + previewMenuItem.ShortcutKeyDisplayString = "F5" - Menu.Add("Play...", AddressOf Editor.Play, "Plays the current script with MPC.") + Menu.Add("Play...", AddressOf Editor.Play, "Plays the current script with MPC.", p.SourceFile <> "").SetImage(Symbol.Play) + Menu.Add("-") - Menu.Items.Add(New ToolStripSeparator) + Dim moveUpMenuItem = Menu.Add("Move Up", AddressOf MoveUp) + moveUpMenuItem.ShortcutKeyDisplayString = KeysHelp.GetKeyString(Keys.Control Or Keys.Up) + moveUpMenuItem.SetImage(Symbol.Up) - Menu.Add("Move Up", AddressOf MoveUp).ShortcutKeyDisplayString = KeysHelp.GetKeyString(Keys.Control Or Keys.Up) - Menu.Add("Move Down", AddressOf MoveDown).ShortcutKeyDisplayString = KeysHelp.GetKeyString(Keys.Control Or Keys.Down) + Dim moveDownMenuItem = Menu.Add("Move Down", AddressOf MoveDown) + moveDownMenuItem.ShortcutKeyDisplayString = KeysHelp.GetKeyString(Keys.Control Or Keys.Down) + moveDownMenuItem.SetImage(Symbol.Down) - Menu.Items.Add(New ToolStripSeparator) + Menu.Add("-") Dim cutAction = Sub() Clipboard.SetText(rtbScript.SelectedText) @@ -384,12 +390,13 @@ Class CodeEditor rtbScript.ScrollToCaret() End Sub - Menu.Add("Cut", cutAction).Enabled = rtbScript.SelectionLength > 0 AndAlso Not rtbScript.ReadOnly - Menu.Add("Copy", copyAction).Enabled = rtbScript.SelectionLength > 0 - Menu.Add("Paste", pasteAction).Enabled = Clipboard.GetText <> "" AndAlso Not rtbScript.ReadOnly + Menu.Add("Cut", cutAction, Nothing, rtbScript.SelectionLength > 0 AndAlso Not rtbScript.ReadOnly).SetImage(Symbol.Cut) + Menu.Add("Copy", copyAction, Nothing, rtbScript.SelectionLength > 0).SetImage(Symbol.Copy) + Menu.Add("Paste", pasteAction, Nothing, Clipboard.GetText <> "" AndAlso Not rtbScript.ReadOnly).SetImage(Symbol.Paste) - Menu.Items.Add(New ToolStripSeparator) + Menu.Add("-") Dim helpMenuItem = Menu.Add("Help") + helpMenuItem.SetImage(Symbol.Help) Dim helpTempMenuItem = Menu.Add("Help | temp") Dim helpAction = Sub() @@ -498,8 +505,7 @@ Class CodeEditor f.cbWrap.Visible = False f.tb.Text = script.GetFullScript f.tb.SelectionStart = f.tb.Text.Length - f.tb.SelectionLength = 0 - f.Text = "Script Preview" + f.Text = "Code Preview" f.Width = 800 f.Height = 500 f.bOK.Visible = False @@ -519,13 +525,20 @@ Class CodeEditor End Sub Sub ReplaceClick(filter As VideoFilter) + Dim tup = Macro.SolveInteractive(filter.Script) + If tup.cancel Then Exit Sub cbActive.Checked = filter.Active cbActive.Text = filter.Category - tbName.Text = filter.Name - rtbScript.Text = Macro.SolveInteractive(filter.Script) + If tup.value <> filter.Script Then tbName.Text = tup.value.Trim Else tbName.Text = filter.Name + rtbScript.Text = tup.value.TrimEnd + BR + rtbScript.SelectionStart = rtbScript.Text.Length End Sub Sub InsertClick(filter As VideoFilter) + Dim tup = Macro.SolveInteractive(filter.Script) + If tup.cancel Then Exit Sub + If tup.value <> filter.Script Then filter.Path = tup.value.Trim + filter.Script = tup.value Dim flow = DirectCast(Parent, FlowLayoutPanel) Dim index = flow.Controls.IndexOf(Me) Dim filterTable = CodeEditor.CreateFilterTable(filter) @@ -533,12 +546,20 @@ Class CodeEditor flow.Controls.Add(filterTable) flow.Controls.SetChildIndex(filterTable, index) flow.ResumeLayout() + filterTable.rtbScript.SelectionStart = filterTable.rtbScript.Text.Length + filterTable.rtbScript.Focus() End Sub - Sub AddClick(f As VideoFilter) + Sub AddClick(filter As VideoFilter) + Dim tup = Macro.SolveInteractive(filter.Script) + If tup.cancel Then Exit Sub + If tup.value <> filter.Script Then filter.Path = tup.value.Trim + filter.Script = tup.value Dim flow = DirectCast(Parent, FlowLayoutPanel) - Dim filterTable = CodeEditor.CreateFilterTable(f) + Dim filterTable = CodeEditor.CreateFilterTable(filter) flow.Controls.Add(filterTable) + filterTable.rtbScript.SelectionStart = filterTable.rtbScript.Text.Length + filterTable.rtbScript.Focus() End Sub End Class End Class \ No newline at end of file diff --git a/Forms/CommandLineForm.vb b/Forms/CommandLineForm.vb index 2c5c8400..db0238f0 100644 --- a/Forms/CommandLineForm.vb +++ b/Forms/CommandLineForm.vb @@ -50,13 +50,10 @@ Class CommandLineForm cbGoTo.SendMessageCue("Search") cbGoTo.Select() - Dim miExe = ActionMenuItem.Add(cms.Items, "Execute Command Line", Sub() params.Execute()) - miExe.Enabled = p.SourceFile <> "" - miExe.Symbol = Symbol.fa_terminal - + cms.Add("Execute Command Line", Sub() params.Execute(), Nothing, p.SourceFile <> "").SetImage(Symbol.fa_terminal) cms.Items.Add(New ActionMenuItem("Copy Command Line", Sub() Clipboard.SetText(params.GetCommandLine(True, True)))) cms.Items.Add(New ActionMenuItem("Show Command Line", Sub() g.ShowCommandLinePreview(params.GetCommandLine(True, True)))) - ActionMenuItem.Add(cms.Items, "Help", Sub() ShowHelp()).Symbol = Symbol.Lightbulb + ActionMenuItem.Add(cms.Items, "Help", Sub() ShowHelp()).SetImage(Symbol.Help) cms.Items.Add(New ActionMenuItem(params.GetPackage.Name + " Help", Sub() g.ShellExecute(params.GetPackage.GetHelpPath))) End Sub diff --git a/Forms/CropForm.vb b/Forms/CropForm.vb index ae0c3d40..a7e9537b 100644 --- a/Forms/CropForm.vb +++ b/Forms/CropForm.vb @@ -506,7 +506,7 @@ Class CropForm ret.Add("-") ret.Add("Crop Options...", NameOf(ShowOptions), Keys.O, Symbol.Settings) ret.Add("Edit Menu...", NameOf(ShowMenuEditor), Keys.M) - ret.Add("Help...", NameOf(ShowHelpDialog), Keys.F1, Symbol.Lightbulb) + ret.Add("Help...", NameOf(ShowHelpDialog), Keys.F1, Symbol.Help) ret.Add("Exit", NameOf(CloseDialog), Keys.Escape) Return ret diff --git a/Forms/MainForm.vb b/Forms/MainForm.vb index 8681ff89..f18848b3 100644 --- a/Forms/MainForm.vb +++ b/Forms/MainForm.vb @@ -1103,13 +1103,13 @@ Public Class MainForm Application.DoEvents() End Sub - + Sub UpdateDynamicMenuAsync() Task.Run(Sub() Thread.Sleep(500) Try - Invoke(Sub() If Native.GetForegroundWindow() = Handle Then UpdateDynamicMenu()) + If Not IsDisposed Then Invoke(Sub() If Native.GetForegroundWindow() = Handle Then UpdateDynamicMenu()) Catch End Try End Sub) @@ -4352,7 +4352,7 @@ Public Class MainForm ret.Add("Tools|Advanced|Event Commands...", NameOf(ShowEventCommandsDialog), Symbol.LightningBolt) ret.Add("Tools|Advanced|Hardcoded Subtitle...", NameOf(ShowHardcodedSubtitleDialog), Keys.Control Or Keys.H, Symbol.Subtitles) ret.Add("Tools|Advanced|LAV Filters video decoder configuration...", NameOf(ShowLAVFiltersConfigDialog), Symbol.Filter) - ret.Add("Tools|Advanced|MediaInfo Folder View...", NameOf(ShowMediaInfoFolderViewDialog), Symbol.fa_info) + ret.Add("Tools|Advanced|MediaInfo Folder View...", NameOf(ShowMediaInfoFolderViewDialog), Symbol.Info) ret.Add("Tools|Advanced|Reset Setting...", NameOf(ResetSettings)) ret.Add("Tools|Advanced|Thumbnails Generator...", NameOf(ShowBatchGenerateThumbnailsDialog)) @@ -5359,41 +5359,24 @@ Public Class MainForm Private Sub gbResize_LinkClick() Handles lgbResize.LinkClick Dim cms = TextCustomMenu.GetMenu(s.TargetImageSizeMenu, lgbResize.Label, components, AddressOf TargetImageMenuClick) - - Dim helpUrl = If(g.IsCulture("de"), - "http://encodingwissen.de/videobild/zielaufloesung", - "http://www.doom9.org/index.html?/aspectratios.htm") - - Dim helpAction = Sub() g.ShellExecute(helpUrl) - - cms.Items.Add(New ToolStripSeparator) - - cms.Items.Add(New ActionMenuItem("Image Options...", Sub() OpenOptionsDialog("Image"))) + Dim helpUrl = If(g.IsCulture("de"), "http://encodingwissen.de/videobild/zielaufloesung", "http://www.doom9.org/index.html?/aspectratios.htm") + cms.Add("-") + cms.Add("Image Options...", Sub() OpenOptionsDialog("Image")).SetImage(Symbol.fa_photo) cms.Items.Add(New ActionMenuItem("Edit Menu...", Sub() s.TargetImageSizeMenu = TextCustomMenu.EditMenu(s.TargetImageSizeMenu, "Target Image Help...", ApplicationSettings.GetDefaultTargetImageSizeMenu, Me))) - cms.Items.Add(New ActionMenuItem("Help...", helpAction)) - + cms.Add("Help...", Sub() g.ShellExecute(helpUrl)).SetImage(Symbol.Help) cms.Show(lgbResize, 0, lgbResize.Label.Height) End Sub Private Sub llSourceParText_Click(sender As Object, e As EventArgs) Handles llSourceParText.Click Dim cms = TextCustomMenu.GetMenu(s.SourceAspectRatioMenu, llSourceParText, components, AddressOf SourceAspectRatioMenuClick) - - Dim helpUrl = If(g.IsCulture("de"), - "http://encodingwissen.de/video/anamorph-quelle.html", - "http://www.doom9.org/index.html?/capture/par.html") - - Dim helpAction = Sub() g.ShellExecute(helpUrl) - + Dim helpUrl = If(g.IsCulture("de"), "http://encodingwissen.de/video/anamorph-quelle.html", "http://www.doom9.org/index.html?/capture/par.html") cms.Items.Insert(0, New ToolStripSeparator) cms.Items.Insert(0, New ActionMenuItem("Automatic 4:3", Sub() SetAutoAspectRatio(False))) cms.Items.Insert(0, New ActionMenuItem("Automatic 16:9", Sub() SetAutoAspectRatio(True))) - - cms.Items.Add(New ToolStripSeparator) - - cms.Items.Add(New ActionMenuItem("Image Options...", Sub() OpenOptionsDialog("Image"))) + cms.Add("-") + cms.Add("Image Options...", Sub() OpenOptionsDialog("Image")).SetImage(Symbol.fa_photo) cms.Items.Add(New ActionMenuItem("Edit Menu...", Sub() s.SourceAspectRatioMenu = TextCustomMenu.EditMenu(s.SourceAspectRatioMenu, "Source Image Help...", ApplicationSettings.GetDefaultSourceAspectRatioMenu, Me))) - cms.Items.Add(New ActionMenuItem("Help...", helpAction)) - + cms.Add("Help...", Sub() g.ShellExecute(helpUrl)).SetImage(Symbol.Help) cms.Show(llSourceParText, 0, llSourceParText.Height) End Sub @@ -5607,18 +5590,18 @@ Public Class MainForm End If End If - m.Items.Add(New ActionMenuItem("Open", a, "Change the audio source file.")) - m.Items.Add(New ActionMenuItem("Play audio", Sub() PlayAudio(ap), "Plays the audio source file with MPC.", exist)) - m.Items.Add(New ActionMenuItem("Play audio and video", Sub() g.PlayScript(p.Script, ap), "Plays the audio source file together with the AviSynth script.", exist)) - m.Items.Add(New ActionMenuItem("MediaInfo", Sub() g.DefaultCommands.ShowMediaInfo(ap.File), "Show MediaInfo for the audio source file.", exist)) - m.Items.Add(New ActionMenuItem("Explore", Sub() g.OpenDirAndSelectFile(ap.File, Handle), "Open the audio source file directory with File Explorer.", exist)) - m.Items.Add(New ActionMenuItem("Execute", Sub() ExecuteAudio(ap), "Processes the audio profile.", exist)) - m.Items.Add("-") - m.Items.Add(New ActionMenuItem("Copy Path", Sub() Clipboard.SetText(ap.File), Nothing, tb.Text <> "")) - m.Items.Add(New ActionMenuItem("Copy Selection", Sub() tb.Copy(), Nothing, tb.Text <> "")) - m.Items.Add(New ActionMenuItem("Paste", Sub() tb.Paste(), Nothing, Clipboard.GetText.Trim <> "")) - m.Items.Add("-") - m.Items.Add(New ActionMenuItem("Clear", Sub() tb.Text = "", "Remove audio file", tb.Text <> "")) + m.Add("Open", a, "Change the audio source file.").SetImage(Symbol.OpenFile) + m.Add("Play Audio", Sub() PlayAudio(ap), "Plays the audio source file with MPC.", exist).SetImage(Symbol.Play) + m.Add("Play audio and video", Sub() g.PlayScript(p.Script, ap), "Plays the audio source file together with the AviSynth script.", exist AndAlso p.Script.Engine = ScriptEngine.AviSynth) + m.Add("MediaInfo...", Sub() g.DefaultCommands.ShowMediaInfo(ap.File), "Show MediaInfo for the audio source file.", exist).SetImage(Symbol.Info) + m.Add("Explore", Sub() g.OpenDirAndSelectFile(ap.File, Handle), "Open the audio source file directory with File Explorer.", exist).SetImage(Symbol.FileExplorer) + m.Add("Execute", Sub() ExecuteAudio(ap), "Processes the audio profile.", exist).SetImage(Symbol.fa_terminal) + m.Add("-") + m.Add("Copy Path", Sub() Clipboard.SetText(ap.File), Nothing, tb.Text <> "") + m.Add("Copy Selection", Sub() Clipboard.SetText(tb.SelectedText), Nothing, tb.Text <> "").SetImage(Symbol.Copy) + m.Add("Paste", Sub() tb.Paste(), Nothing, Clipboard.GetText.Trim <> "").SetImage(Symbol.Paste) + m.Add("-") + m.Add("Remove", Sub() tb.Text = "", "Remove audio file", tb.Text <> "").SetImage(Symbol.Remove) End Sub Sub ExecuteAudio(ap As AudioProfile) @@ -5638,26 +5621,26 @@ Public Class MainForm Sub UpdateTargetFileMenu() TargetFileMenu.Items.Clear() - TargetFileMenu.Items.Add(New ActionMenuItem("Edit...", AddressOf tbTargetFile_DoubleClick, "Change the path of the target file.")) - TargetFileMenu.Items.Add(New ActionMenuItem("Play...", Sub() g.Play(p.TargetFile), "Play the target file.", File.Exists(p.TargetFile))) - TargetFileMenu.Items.Add(New ActionMenuItem("MediaInfo...", Sub() g.DefaultCommands.ShowMediaInfo(p.TargetFile), "Show MediaInfo for the target file.", File.Exists(p.TargetFile))) - TargetFileMenu.Items.Add(New ActionMenuItem("Explore...", Sub() g.OpenDirAndSelectFile(p.TargetFile, Handle), "Open the target file directory with File Explorer.", Directory.Exists(Filepath.GetDir(p.TargetFile)))) - TargetFileMenu.Items.Add("-") - TargetFileMenu.Items.Add(New ActionMenuItem("Copy", Sub() tbTargetFile.Copy(), "", tbTargetFile.Text <> "")) - TargetFileMenu.Items.Add(New ActionMenuItem("Paste", Sub() tbTargetFile.Paste(), "", Clipboard.GetText.Trim <> "")) + TargetFileMenu.Add("Edit...", AddressOf tbTargetFile_DoubleClick, "Change the path of the target file.") + TargetFileMenu.Add("Play...", Sub() g.Play(p.TargetFile), "Play the target file.", File.Exists(p.TargetFile)).SetImage(Symbol.Play) + TargetFileMenu.Add("MediaInfo...", Sub() g.DefaultCommands.ShowMediaInfo(p.TargetFile), "Show MediaInfo for the target file.", File.Exists(p.TargetFile)).SetImage(Symbol.Info) + TargetFileMenu.Add("Explore...", Sub() g.OpenDirAndSelectFile(p.TargetFile, Handle), "Open the target file directory with File Explorer.", Directory.Exists(p.TargetFile.Dir)).SetImage(Symbol.FileExplorer) + TargetFileMenu.Add("-") + TargetFileMenu.Add("Copy", Sub() tbTargetFile.Copy(), "", tbTargetFile.Text <> "").SetImage(Symbol.Copy) + TargetFileMenu.Add("Paste", Sub() tbTargetFile.Paste(), "", Clipboard.GetText.Trim <> "").SetImage(Symbol.Paste) End Sub Sub UpdateSourceFileMenu() SourceFileMenu.Items.Clear() Dim isIndex = FileTypes.VideoIndex.Contains(Filepath.GetExt(p.SourceFile)) - SourceFileMenu.Items.Add(New ActionMenuItem("Open...", AddressOf ShowOpenSourceDialog, "Open source files")) - SourceFileMenu.Items.Add(New ActionMenuItem("Play...", Sub() g.Play(p.SourceFile), "Play the source file.", File.Exists(p.SourceFile) AndAlso Not isIndex)) - SourceFileMenu.Items.Add(New ActionMenuItem("MediaInfo...", Sub() g.DefaultCommands.ShowMediaInfo(p.SourceFile), "Show MediaInfo for the source file.", File.Exists(p.SourceFile) AndAlso Not isIndex)) - SourceFileMenu.Items.Add(New ActionMenuItem("Explore...", Sub() g.OpenDirAndSelectFile(p.SourceFile, Handle), "Open the source file directory with File Explorer.", File.Exists(p.SourceFile))) + SourceFileMenu.Add("Open...", AddressOf ShowOpenSourceDialog, "Open source files").SetImage(Symbol.OpenFile) + SourceFileMenu.Add("Play...", Sub() g.Play(p.SourceFile), "Play the source file.", File.Exists(p.SourceFile) AndAlso Not isIndex).SetImage(Symbol.Play) + SourceFileMenu.Add("MediaInfo...", Sub() g.DefaultCommands.ShowMediaInfo(p.SourceFile), "Show MediaInfo for the source file.", File.Exists(p.SourceFile) AndAlso Not isIndex).SetImage(Symbol.Info) + SourceFileMenu.Add("Explore...", Sub() g.OpenDirAndSelectFile(p.SourceFile, Handle), "Open the source file directory with File Explorer.", File.Exists(p.SourceFile)).SetImage(Symbol.FileExplorer) SourceFileMenu.Items.Add("-") - SourceFileMenu.Items.Add(New ActionMenuItem("Copy", Sub() tbSourceFile.Copy(), "Copies the selected text to the clipboard.", tbSourceFile.Text <> "")) - SourceFileMenu.Items.Add(New ActionMenuItem("Paste", Sub() tbSourceFile.Paste(), "Copies the full source file path to the clipboard.", Clipboard.GetText.Trim <> "")) + SourceFileMenu.Add("Copy", Sub() tbSourceFile.Copy(), "Copies the selected text to the clipboard.", tbSourceFile.Text <> "").SetImage(Symbol.Copy) + SourceFileMenu.Add("Paste", Sub() tbSourceFile.Paste(), "Copies the full source file path to the clipboard.", Clipboard.GetText.Trim <> "").SetImage(Symbol.Paste) End Sub Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles Me.Load diff --git a/Forms/PreviewForm.vb b/Forms/PreviewForm.vb index 268f2818..442ad38a 100644 --- a/Forms/PreviewForm.vb +++ b/Forms/PreviewForm.vb @@ -992,7 +992,7 @@ Class PreviewForm ret.Add("Tools|Add Selection Zone", NameOf(g.DefaultCommands.AddX264Zone), {"%sel_start%", "%sel_end%", "q=40"}) ret.Add("Edit Menu...", NameOf(OpenMenuEditor), Keys.M) - ret.Add("Help...", NameOf(OpenHelp), Keys.F1, Symbol.Lightbulb) + ret.Add("Help...", NameOf(OpenHelp), Keys.F1, Symbol.Help) ret.Add("Exit", NameOf(CloseDialog), Keys.Escape) Return ret diff --git a/General/Misc.vb b/General/Misc.vb index 2bbeb2a8..52477762 100644 --- a/General/Misc.vb +++ b/General/Misc.vb @@ -226,12 +226,10 @@ Public Class GlobalClass If profiles.Count > 0 Then If TypeOf profiles(0) Is VideoEncoder Then - - Dim helpURL = If(g.IsCulture("de"), - "http://encodingwissen.de/codecs", - "http://en.wikipedia.org/wiki/Video_codec") - - ic.Add(New ActionMenuItem("Help...", Sub() g.ShellExecute(helpURL))) + Dim helpURL = If(g.IsCulture("de"), "http://encodingwissen.de/codecs", "http://en.wikipedia.org/wiki/Video_codec") + Dim helpMenuItem = New ActionMenuItem("Help...", Sub() g.ShellExecute(helpURL)) + helpMenuItem.SetImage(Symbol.Help) + ic.Add(helpMenuItem) End If End If End Sub @@ -1868,7 +1866,7 @@ Class Macro ret.Add(New Macro("media_info_audio:", "MediaInfo Audio Property", GetType(String), "Returns a MediaInfo audio property for the video source file.")) ret.Add(New Macro("app:", "Application File Path", GetType(String), "Returns the path of a aplication. Possible names are: " + Package.Items.Values.Select(Function(arg) arg.Name).Join(", "))) ret.Add(New Macro("app_dir:", "Application Directory", GetType(String), "Returns the directory of a aplication. Possible names are: " + Package.Items.Values.Select(Function(arg) arg.Name).Join(", "))) - ret.Add(New Macro("$select:$", "Select", GetType(String), "String selected from dropdown.")) + ret.Add(New Macro("$select:$", "Select", GetType(String), "String selected from dropdown, to show a optional message the first parameter has to start with msg: and to give the items optional captions use caption|value." + BR2 + "Example: $select:msg:hello;cap1|val1;cap2|val2$")) ret.Add(New Macro("$enter_text:$", "Enter Text (Params)", GetType(String), "Text entered in a input box.")) ret.Add(New Macro("$browse_file$", "Browse For File", GetType(String), "Filepath returned from a file browser.")) ret.Add(New Macro("$enter_text$", "Enter Text", GetType(String), "Text entered in a input box.")) @@ -1943,72 +1941,91 @@ Class Macro Return Solve(value, False) End Function - Shared Function SolveInteractive(value As String) As String - If value.Contains("$") Then - If value.Contains("$browse_file$") Then - Using d As New OpenFileDialog - If d.ShowDialog = DialogResult.OK Then value = value.Replace("$browse_file$", d.FileName) - End Using + Shared Function SolveInteractive(value As String) As (value As String, cancel As Boolean) + Dim ret As (value As String, cancel As Boolean) = (value, False) + If ret.value = "" Then Return ret - Return value - End If + If ret.value.Contains("$browse_file$") Then + Using d As New OpenFileDialog + ret.cancel = d.ShowDialog <> DialogResult.OK + If ret.cancel Then Return ret Else ret.value = ret.value.Replace("$browse_file$", d.FileName) + End Using + End If - If value.Contains("$enter_text$") Then - Dim text = InputBox.Show("Please enter some text.") - If text <> "" Then value = value.Replace("$enter_text$", text) - Return value - End If + If Not ret.value.Contains("$") Then Return ret - If value.Contains("$enter_text:") Then - Dim mc = Regex.Matches(value, "\$enter_text:(.+?)\$") + If ret.value.Contains("$enter_text$") Then + Dim inputText = InputBox.Show("Please enter some text.") - For Each i As Match In mc - Dim v = InputBox.Show(i.Groups(1).Value) - If v <> "" Then value = value.Replace(i.Value, v) - Next - - Return value - End If - - If value.Contains("$select:") Then - Dim mc = Regex.Matches(value, "\$select:(.+?)\$") - - For Each i As Match In mc - Dim items = i.Groups(1).Value.SplitNoEmpty(";").ToList - - If items.Count > 0 Then - Dim f As New SelectionBox(Of String) - f.Title = "Select" - - If items?(0)?.StartsWith("msg:") Then - f.Text = items(0).Substring(4) - items.RemoveAt(0) - Else - f.Text = "Please select a item." - End If - - For Each iItem As String In items - If iItem.Contains("|") Then - f.AddItem(iItem.Left("|"), iItem.Right("|")) - Else - f.AddItem(iItem) - End If - Next - - If f.Show = DialogResult.OK Then value = value.Replace(i.Value, f.SelectedItem) - End If - Next - - Return value + If inputText = "" Then + ret.cancel = True + Return ret + Else + ret.value = ret.value.Replace("$enter_text$", inputText) End If End If - Return value + If Not ret.value.Contains("$") Then Return ret + + If ret.value.Contains("$enter_text:") Then + Dim matches = Regex.Matches(ret.value, "\$enter_text:(.+?)\$") + + For Each iMatch As Match In matches + Dim inputText = InputBox.Show(iMatch.Groups(1).Value) + + If inputText = "" Then + ret.cancel = True + Return ret + Else + ret.value = ret.value.Replace(iMatch.Value, inputText) + End If + Next + End If + + If Not ret.value.Contains("$") Then Return ret + + If ret.value.Contains("$select:") Then + Dim matches = Regex.Matches(ret.value, "\$select:(.+?)\$") + + For Each iMatch As Match In matches + Dim items = iMatch.Groups(1).Value.SplitNoEmpty(";").ToList + + If items.Count > 0 Then + Dim sb As New SelectionBox(Of String) + sb.Title = "Select" + + If items?(0)?.StartsWith("msg:") Then + sb.Text = items(0).Substring(4) + items.RemoveAt(0) + Else + sb.Text = "Please select a item." + End If + + For Each iItem As String In items + If iItem.Contains("|") Then + sb.AddItem(iItem.Left("|"), iItem.Right("|")) + Else + sb.AddItem(iItem) + End If + Next + + ret.cancel = sb.Show <> DialogResult.OK + If ret.cancel Then Return ret Else ret.value = ret.value.Replace(iMatch.Value, sb.SelectedItem) + End If + Next + End If + + Return ret End Function Shared Function Solve(value As String, silent As Boolean) As String If value = "" Then Return "" - If Not silent AndAlso value.Contains("$") Then value = SolveInteractive(value) + + If Not silent AndAlso value.Contains("$") Then + Dim tup = SolveInteractive(value) + If Not tup.cancel Then value = tup.value + End If + If Not value.Contains("%") Then Return value If value.Contains("%source_file%") Then value = value.Replace("%source_file%", p.SourceFile) diff --git a/General/Package.vb b/General/Package.vb index 0f43151f..7c842a3b 100644 --- a/General/Package.vb +++ b/General/Package.vb @@ -384,8 +384,7 @@ Public Class Package .AviSynthFilterNames = {"TComb"}, .Description = "TComb is a temporal comb filter.", .WebURL = "http://avisynth.nl/index.php/TComb", - .AviSynthFiltersFunc = Function() { - New VideoFilter("Misc", "TComb", "TComb(mode = 0, fthreshL = 255, othreshL = 255)")}}) + .AviSynthFiltersFunc = Function() {New VideoFilter("Misc", "TComb", "TComb(mode = 0, fthreshL = 255, othreshL = 255)")}}) Add(New PluginPackage With { .Name = "QTGMC", @@ -393,10 +392,7 @@ Public Class Package .URL = "http://avisynth.nl/index.php/QTGMC", .Description = "A very high quality deinterlacer with a range of features for both quality and convenience. These include a simple presets system, extensive noise processing capabilities, support for repair of progressive material, precision source matching, shutter speed simulation, etc. Originally based on TempGaussMC by Didée.", .AviSynthFilterNames = {"QTGMC"}, - .AviSynthFiltersFunc = Function() { - New VideoFilter("Field", "QTGMC | QTGMC Fast", "QTGMC(Preset = ""Fast"")"), - New VideoFilter("Field", "QTGMC | QTGMC Medium", "QTGMC(Preset = ""Medium"")"), - New VideoFilter("Field", "QTGMC | QTGMC Slow", "QTGMC(Preset = ""Slow"")")}, + .AviSynthFiltersFunc = Function() {New VideoFilter("Field", "QTGMC", "QTGMC(Preset = ""$select:msg:Select a preset.;Fast;Medium;Slow$"")")}, .Dependencies = {"masktools2", "mvtools2", "nnedi3", "RgTools"}}) Add(New PluginPackage With { @@ -405,8 +401,7 @@ Public Class Package .URL = "http://avisynth.nl/index.php/SMDegrain", .Description = "SMDegrain, the Simple MDegrain Mod, is mainly a convenience function for using MVTools.", .AviSynthFilterNames = {"SMDegrain"}, - .AviSynthFiltersFunc = Function() { - New VideoFilter("Noise", "SMDegrain", "SMDegrain(tr = 2, thSAD = 250, contrasharp = false, refinemotion = true, lsb = false)")}, + .AviSynthFiltersFunc = Function() {New VideoFilter("Noise", "SMDegrain", "SMDegrain(tr = 2, thSAD = 250, contrasharp = false, refinemotion = true, lsb = false)")}, .Dependencies = {"masktools2", "mvtools2", "nnedi3", "RgTools"}}) Add(New PluginPackage With { diff --git a/General/VideoScript.vb b/General/VideoScript.vb index 8a3531d7..54124e26 100644 --- a/General/VideoScript.vb +++ b/General/VideoScript.vb @@ -575,9 +575,7 @@ Public Class FilterCategory resize.Filters.Add(New VideoFilter(resize.Name, "SincResize", "SincResize(%target_width%, %target_height%)")) resize.Filters.Add(New VideoFilter(resize.Name, "PointResize", "PointResize(%target_width%, %target_height%)")) resize.Filters.Add(New VideoFilter(resize.Name, "Hardware Encoder", "# hardware encoder resizes")) - resize.Filters.Add(New VideoFilter(resize.Name, "Spline | Spline16Resize", "Spline16Resize(%target_width%, %target_height%)")) - resize.Filters.Add(New VideoFilter(resize.Name, "Spline | Spline36Resize", "Spline36Resize(%target_width%, %target_height%)")) - resize.Filters.Add(New VideoFilter(resize.Name, "Spline | Spline64Resize", "Spline64Resize(%target_width%, %target_height%)")) + resize.Filters.Add(New VideoFilter(resize.Name, "Spline", "Spline$select:16;36;64$Resize(%target_width%, %target_height%)")) ret.Add(resize) Dim crop As New FilterCategory("Crop") diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 4061b854..50ab6c41 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -8,4 +8,4 @@ Imports System.Runtime.InteropServices - \ No newline at end of file + \ No newline at end of file diff --git a/UI/Controls/Controls.vb b/UI/Controls/Controls.vb index 3e5ef381..fc25337a 100644 --- a/UI/Controls/Controls.vb +++ b/UI/Controls/Controls.vb @@ -466,10 +466,12 @@ Namespace UI Sub InitMenu() Dim cms As New ContextMenuStripEx() - Dim cutItem = cms.Add("Cut") + cutItem.SetImage(Symbol.Cut) Dim copyItem = cms.Add("Copy", Sub() Clipboard.SetText(SelectedText)) + copyItem.SetImage(Symbol.Copy) Dim pasteItem = cms.Add("Paste") + pasteItem.SetImage(Symbol.Paste) cms.Add("Copy Everything", Sub() Clipboard.SetText(Text)) diff --git a/UI/CustomMenuEditor.vb b/UI/CustomMenuEditor.vb index 42bec003..75f04e04 100644 --- a/UI/CustomMenuEditor.vb +++ b/UI/CustomMenuEditor.vb @@ -590,26 +590,23 @@ Namespace UI Dim enumNames = System.Enum.GetNames(GetType(Symbol)).ToList enumNames.Sort() - For Each i In enumNames + For Each iName In enumNames + If iName.StartsWith("fa_") Then Continue For If IsClosing Then Exit For - Dim symbol = DirectCast(System.Enum.Parse(GetType(Symbol), i), Symbol) - Dim path As String - - If CInt(symbol) > 60000 Then - path = "FontAwesome | " + i.Substring(3, 1).ToUpper + " | " + i.Substring(3).ToTitleCase.Replace("_", " ") - Else - path = "Segoe MDL2 Assets | " + i.Substring(0, 1) + " | " + i - End If - - Dim mi = ActionMenuItem.Add(Of Symbol)(cmsSymbol.Items, path, AddressOf HandleSymbol, symbol) - mi.Symbol = symbol + Dim symbol = DirectCast(System.Enum.Parse(GetType(Symbol), iName), Symbol) + Dim path = "Segoe MDL2 Assets | " + iName.Substring(0, 1).ToUpper + " | " + iName + ActionMenuItem.Add(Of Symbol)(cmsSymbol.Items, path, AddressOf HandleSymbol, symbol).SetImage(symbol) Application.DoEvents() Next - End Sub - Async Sub SetImage(symbol As Symbol, mi As ToolStripMenuItem) - Dim img = Await ImageHelp.GetSymbolImageAsync(symbol) - If Not IsClosing AndAlso Not mi.IsDisposed Then mi.Image = img + For Each iName In enumNames + If Not iName.StartsWith("fa_") Then Continue For + If IsClosing Then Exit For + Dim symbol = DirectCast(System.Enum.Parse(GetType(Symbol), iName), Symbol) + Dim path = "FontAwesome | " + iName.Substring(3, 1).ToUpper + " | " + iName.Substring(3).ToTitleCase.Replace("_", " ") + ActionMenuItem.Add(Of Symbol)(cmsSymbol.Items, path, AddressOf HandleSymbol, symbol).SetImage(symbol) + Application.DoEvents() + Next End Sub Sub HandleSymbol(symbol As Symbol) diff --git a/UI/Menu Types.vb b/UI/Menu Types.vb index a93f1943..bc3d53f1 100644 --- a/UI/Menu Types.vb +++ b/UI/Menu Types.vb @@ -337,18 +337,6 @@ Namespace UI SetImage(symbol, Me) End Sub - Private _Symbol As Symbol - - Property Symbol As Symbol - Get - Return _Symbol - End Get - Set(value As Symbol) - _Symbol = value - SetImage(value, Me) - End Set - End Property - Shared Async Sub SetImage(symbol As Symbol, mi As ToolStripMenuItem) If symbol = Symbol.None Then mi.Image = Nothing @@ -699,21 +687,38 @@ Namespace UI Return ActionMenuItem.Add(Items, path, Nothing) End Function + Function Add(path As String, + action As Action) As ActionMenuItem + + Return Add(path, action, Nothing) + End Function + Function Add(path As String, action As Action, - Optional help As String = Nothing) As ActionMenuItem + help As String) As ActionMenuItem + + Return Add(path, action, help, True) + End Function + + Function Add(path As String, + action As Action, + help As String, + enabled As Boolean) As ActionMenuItem Dim ret = ActionMenuItem.Add(Items, path, action) ret.Form = Form ret.Help = help + ret.Enabled = enabled AddHandler Opening, AddressOf ret.Opening Return ret End Function - Function Add(path As String, action As Action, shortcut As Keys, + Function Add(path As String, + action As Action, + shortcut As Keys, enabledFunc As Func(Of Boolean), Optional help As String = Nothing) As ActionMenuItem diff --git a/md/test-build.md b/md/test-build.md index 8b34e69a..5dcbfa35 100644 --- a/md/test-build.md +++ b/md/test-build.md @@ -21,6 +21,8 @@ https://onedrive.live.com/redir?resid=604D4754F64B0ABC!4140&authkey=!ANUm9V3vTPm - added option to extract timecodes file from MKV (Options > Misc, disabled by default) - added timecodes file option to muxer dialog, can be TXT or MKV - added support for hardcoded subtitles using VapourSynth for srt, ass, idx/vobsub, sup/pgs +- added the possiblity to use special GUI macros like $select:val1;val2$ in filter profiles, this is now used in the defaults for AssumeFPS for instance +- added new menu item icons #### Fixed Bugs @@ -53,6 +55,7 @@ https://onedrive.live.com/redir?resid=604D4754F64B0ABC!4140&authkey=!ANUm9V3vTPm - in case there are more then ten audio files or streams a sub menu is used - audio file detection prefers now dtsma and thd files - filter context menus open a lot quicker +- if the name text box in the code editor is empty the main dialog will show the code #### Updated Tools