Permalink
Browse files

-

-
  • Loading branch information...
stax76
stax76 committed Apr 8, 2016
1 parent 38e9fba commit b2a7fe73b713de77617d8274b1cc756c8b2983a5
View
@@ -46,6 +46,7 @@ bin
obj
AviSynth+
.vs
+packages
StaxRip.v12.suo
StaxRip.vbproj.user
@@ -8,7 +8,7 @@ Class AviSynthListView
Private BlockItemCheck As Boolean
WithEvents Menu As New ContextMenuStrip
- Event ScriptChanged()
+ Event Changed()
Sub New()
AllowDrop = True
@@ -23,8 +23,12 @@ Class AviSynthListView
Columns.Add("Type")
Columns.Add("Name")
ContextMenuStrip = Menu
-
SendMessageHideFocus()
+ AddHandler VideoScript.Changed, Sub(script As VideoScript)
+ If Not ProfileFunc Is Nothing AndAlso script Is ProfileFunc.Invoke Then
+ OnChanged()
+ End If
+ End Sub
End Sub
<Browsable(False),
@@ -133,46 +137,42 @@ Class AviSynthListView
End Sub
Sub ShowEditor()
- If ProfileFunc().Invoke.Edit = DialogResult.OK Then
- Load()
- RaiseScriptChanged()
- End If
+ If ProfileFunc().Invoke.Edit = DialogResult.OK Then OnChanged()
End Sub
Sub ReplaceClick(f As VideoFilter)
Dim index = SelectedItems(0).Index
- ProfileFunc.Invoke.Filters(index) = f
- Load()
+ ProfileFunc.Invoke.SetFilter(index, f)
Items(index).Selected = True
- RaiseChangedAsync()
End Sub
Private Sub InsertClick(f As VideoFilter)
Dim index = SelectedItems(0).Index
- ProfileFunc.Invoke.Filters.Insert(index, f)
- Load()
+ ProfileFunc.Invoke.InsertFilter(index, f)
Items(index).Selected = True
- RaiseChangedAsync()
End Sub
Private Sub AddClick(f As VideoFilter)
- ProfileFunc.Invoke.Filters.Add(f)
- Load()
+ ProfileFunc.Invoke.AddFilter(f)
Items(Items.Count - 1).Selected = True
- RaiseChangedAsync()
End Sub
- Sub RaiseScriptChanged()
- RaiseEvent ScriptChanged()
+ Sub OnChanged()
+ Load()
+ RaiseEvent Changed()
+ End Sub
+
+ Sub RaiseChangedAsync()
+ Dim async = Sub()
+ Application.DoEvents()
+ OnChanged()
+ End Sub
+
+ g.MainForm.BeginInvoke(async)
End Sub
Private Sub RemoveClick()
- If Items.Count > 1 Then
- Dim index = SelectedItems(0).Index
- ProfileFunc.Invoke.Filters.RemoveAt(SelectedItems(0).Index)
- Load()
- RaiseChangedAsync()
- End If
+ If Items.Count > 1 Then ProfileFunc.Invoke.RemoveFilterAt(SelectedItems(0).Index)
End Sub
Sub UpdateDocument()
@@ -182,7 +182,7 @@ Class AviSynthListView
ProfileFunc.Invoke.Filters.Add(DirectCast(i.Tag, VideoFilter))
Next
- RaiseEvent ScriptChanged()
+ OnChanged()
End Sub
Protected Overrides Sub OnDragDrop(e As DragEventArgs)
@@ -211,20 +211,8 @@ Class AviSynthListView
End If
End Sub
- Sub RaiseChangedAsync()
- Dim async = Sub()
- Application.DoEvents()
- RaiseEvent ScriptChanged()
- End Sub
-
- g.MainForm.BeginInvoke(async)
- End Sub
-
Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
- If e.Button = MouseButtons.Right Then
- UpdateMenu()
- End If
-
+ If e.Button = MouseButtons.Right Then UpdateMenu()
MyBase.OnMouseUp(e)
End Sub
@@ -88,12 +88,10 @@ Class DemuxingControl
Me.lv.CheckBoxes = True
Me.lv.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1})
Me.lv.DownButton = Me.bnDown
- Me.lv.EditButton = Me.bnEdit
Me.lv.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None
Me.lv.Location = New System.Drawing.Point(0, 0)
Me.lv.MultiSelect = False
Me.lv.Name = "lv"
- Me.lv.RemoveButton = Me.bnRemove
Me.lv.Size = New System.Drawing.Size(300, 303)
Me.lv.TabIndex = 0
Me.lv.UpButton = Me.bnUp
View
@@ -129,7 +129,7 @@ Class x264Control
End If
lv.Columns(0).Width = CInt(Width * (32 / 100))
- lv.Columns(1).Width = CInt(Width * (66 / 100))
+ lv.Columns(1).Width = lv.Width - lv.Columns(0).Width - 4
'couldn't get scaling to work trying everything
llConfigCodec.Left = 5
View
@@ -161,7 +161,7 @@ Class x265Control
Sub UpdateMenu()
cms.Items.Clear()
- Dim offset = If(Params.Mode.Value = RateMode.SingleCRF, 0, 1)
+ Dim offset = If(Params.Mode.Value = x265RateMode.SingleCRF, 0, 1)
If lv.SelectedItems.Count > 0 Then
Select Case lv.SelectedIndices(0)
@@ -194,7 +194,7 @@ Class x265Control
End Sub
Sub SetPreset(value As Integer)
- Dim offset = If(Params.Mode.Value = RateMode.SingleCRF, 0, 1)
+ Dim offset = If(Params.Mode.Value = x265RateMode.SingleCRF, 0, 1)
Params.Preset.Value = value
@@ -208,7 +208,7 @@ Class x265Control
End Sub
Sub SetTune(value As Integer)
- Dim offset = If(Params.Mode.Value = RateMode.SingleCRF, 0, 1)
+ Dim offset = If(Params.Mode.Value = x265RateMode.SingleCRF, 0, 1)
Params.Tune.Value = value
@@ -232,7 +232,7 @@ Class x265Control
End Function
Sub UpdateControls()
- If Params.Mode.Value = RateMode.SingleCRF AndAlso lv.Items.Count < 4 Then
+ If Params.Mode.Value = x265RateMode.SingleCRF AndAlso lv.Items.Count < 4 Then
lv.Items.Clear()
lv.Items.Add(New ListViewItem({"Quality", GetQualityCaption(Params.Quant.Value)}))
lv.Items.Add(New ListViewItem({"Preset", Params.Preset.OptionText}))
@@ -243,8 +243,8 @@ Class x265Control
lv.Items.Add(New ListViewItem({"Tune", Params.Tune.OptionText}))
End If
- Dim offset = If(Params.Mode.Value = RateMode.SingleCRF, 0, 1)
- llCompCheck.Visible = Params.Mode.Value = RateMode.TwoPass Or Params.Mode.Value = RateMode.ThreePass
+ Dim offset = If(Params.Mode.Value = x265RateMode.SingleCRF, 0, 1)
+ llCompCheck.Visible = Params.Mode.Value = x265RateMode.TwoPass Or Params.Mode.Value = x265RateMode.ThreePass
End Sub
Private Sub llAdvanced_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles llConfigCodec.LinkClicked
@@ -7,11 +7,19 @@ Imports VB6 = Microsoft.VisualBasic
Module StringExtensions
<Extension()>
- Function ChangeExt(path As String, value As String) As String
- If path = "" Then Return ""
- If value = "" Then Return path
+ Function FileName(instance As String) As String
+ If instance = "" Then Return ""
+ Dim index = instance.LastIndexOf(Path.DirectorySeparatorChar)
+ If index > -1 Then Return instance.Substring(index + 1)
+ Return instance
+ End Function
+
+ <Extension()>
+ Function ChangeExt(instance As String, value As String) As String
+ If instance = "" Then Return ""
+ If value = "" Then Return instance
If Not value.StartsWith(".") Then value = "." + value
- Return Filepath.GetDirAndBase(path) + value.ToLower
+ Return Filepath.GetDirAndBase(instance) + value.ToLower
End Function
<Extension()>
View
@@ -443,12 +443,20 @@ Class CropForm
End Sub
Private Sub CropForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
- Dim m = p.Script.GetErrorMessage
-
- If Not m Is Nothing Then
- e.Cancel = True
- MsgWarn(m)
- Exit Sub
+ Dim err = p.Script.GetErrorMessage
+
+ If err <> "" Then
+ Using td As New TaskDialog(Of String)
+ td.MainInstruction = "Script Error"
+ td.Content = err
+ td.AddButton("OK", "OK")
+ td.AddButton("Exit", "Exit")
+
+ If td.Show() = "OK" Then
+ e.Cancel = True
+ Exit Sub
+ End If
+ End Using
End If
p.RemindToCrop = False
@@ -144,51 +144,25 @@ Class EventCommandsEditor
lv.UpButton = bnUp
lv.DownButton = bnDown
lv.RemoveButton = bnRemove
- lv.View = View.Details
- lv.FullRowSelect = True
- lv.Columns.Add("")
- lv.HeaderStyle = ColumnHeaderStyle.None
+ lv.SingleSelectionButtons = {bnEdit, bnClone}
+ lv.UpdateControls()
+ lv.EnableListBoxMode()
lv.Scrollable = False
lv.CheckBoxes = True
- lv.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent)
lv.MultiSelect = False
-
- AddHandler lv.Layout, Sub() lv.Columns(0).Width = lv.Width - 4
- AddHandler Load, Sub() lv.Columns(0).Width = lv.Width - 4
-
- For Each i In ObjectHelp.GetCopy(Of List(Of EventCommand))(eventCommands)
- Dim item = lv.Items.Add(i.ToString)
- item.Tag = i
- item.Checked = i.Enabled
- Next
-
- AddHandler lv.ItemCheck, Sub(sender As Object, e As ItemCheckEventArgs)
- lv.Items(e.Index).Selected = True
- DirectCast(lv.SelectedItems(0).Tag, EventCommand).Enabled = e.NewValue = CheckState.Checked
- End Sub
-
- If lv.Items.Count > 0 Then lv.Items(0).Selected = True
- UpdateControls()
+ lv.ItemCheckProperty = NameOf(EventCommand.Enabled)
+ lv.AddItems(ObjectHelp.GetCopy(eventCommands))
+ lv.SelectFirst()
End Sub
Private Sub bnAdd_Click() Handles bnAdd.Click
Dim ec As New EventCommand
Using f As New EventCommandEditor(ec)
- If f.ShowDialog = DialogResult.OK Then
- Dim item = lv.Items.Add(ec.ToString)
- item.Tag = ec
- item.Selected = True
- End If
+ If f.ShowDialog = DialogResult.OK Then lv.AddItem(ec).Selected = True
End Using
End Sub
- Sub UpdateControls()
- bnEdit.Enabled = lv.SelectedItems.Count > 0
- bnClone.Enabled = lv.SelectedItems.Count > 0
- lv.UpdateControls()
- End Sub
-
Private Sub EventCommandsEditor_HelpRequested() Handles Me.HelpRequested
Dim f As New HelpForm
f.Doc.WriteStart(Text)
@@ -197,24 +171,12 @@ Class EventCommandsEditor
End Sub
Private Sub bnClone_Click() Handles bnClone.Click
- Dim ec = DirectCast(ObjectHelp.GetCopy(lv.SelectedItems(0).Tag), EventCommand)
- Dim item = lv.Items.Add(ec.ToString)
- item.Selected = True
- item.Tag = ec
- item.Checked = ec.Enabled
+ lv.AddItem(ObjectHelp.GetCopy(lv.SelectedItem)).Selected = True
End Sub
Private Sub bnEdit_Click(sender As Object, e As EventArgs) Handles bnEdit.Click
- Dim ec = DirectCast(lv.SelectedItems(0).Tag, EventCommand)
-
- Using f As New EventCommandEditor(ec)
- If f.ShowDialog = DialogResult.OK Then
- lv.SelectedItems(0).Text = ec.ToString
- End If
+ Using f As New EventCommandEditor(lv.SelectedItem(Of EventCommand))
+ If f.ShowDialog = DialogResult.OK Then lv.RefreshSelection()
End Using
End Sub
-
- Private Sub lv_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lv.SelectedIndexChanged
- UpdateControls()
- End Sub
End Class
Oops, something went wrong.

0 comments on commit b2a7fe7

Please sign in to comment.