Added context menu and game manager tweaks

This commit is contained in:
Michael J. Seiferling
2015-11-29 11:39:25 -06:00
parent 0339a09b08
commit 525c7d3ec3
4 changed files with 115 additions and 33 deletions
+6 -4
View File
@@ -163,7 +163,7 @@ Partial Class frmGameManager
' '
'btnExclude 'btnExclude
' '
Me.btnExclude.Location = New System.Drawing.Point(498, 123) Me.btnExclude.Location = New System.Drawing.Point(69, 122)
Me.btnExclude.Name = "btnExclude" Me.btnExclude.Name = "btnExclude"
Me.btnExclude.Size = New System.Drawing.Size(30, 20) Me.btnExclude.Size = New System.Drawing.Size(30, 20)
Me.btnExclude.TabIndex = 13 Me.btnExclude.TabIndex = 13
@@ -172,7 +172,7 @@ Partial Class frmGameManager
' '
'btnInclude 'btnInclude
' '
Me.btnInclude.Location = New System.Drawing.Point(498, 97) Me.btnInclude.Location = New System.Drawing.Point(69, 97)
Me.btnInclude.Name = "btnInclude" Me.btnInclude.Name = "btnInclude"
Me.btnInclude.Size = New System.Drawing.Size(30, 20) Me.btnInclude.Size = New System.Drawing.Size(30, 20)
Me.btnInclude.TabIndex = 11 Me.btnInclude.TabIndex = 11
@@ -254,17 +254,19 @@ Partial Class frmGameManager
' '
'txtExclude 'txtExclude
' '
Me.txtExclude.Location = New System.Drawing.Point(69, 123) Me.txtExclude.Location = New System.Drawing.Point(105, 123)
Me.txtExclude.Name = "txtExclude" Me.txtExclude.Name = "txtExclude"
Me.txtExclude.Size = New System.Drawing.Size(423, 20) Me.txtExclude.Size = New System.Drawing.Size(423, 20)
Me.txtExclude.TabIndex = 12 Me.txtExclude.TabIndex = 12
Me.txtExclude.Visible = False
' '
'txtFileType 'txtFileType
' '
Me.txtFileType.Location = New System.Drawing.Point(69, 97) Me.txtFileType.Location = New System.Drawing.Point(105, 97)
Me.txtFileType.Name = "txtFileType" Me.txtFileType.Name = "txtFileType"
Me.txtFileType.Size = New System.Drawing.Size(423, 20) Me.txtFileType.Size = New System.Drawing.Size(423, 20)
Me.txtFileType.TabIndex = 10 Me.txtFileType.TabIndex = 10
Me.txtFileType.Visible = False
' '
'chkTimeStamp 'chkTimeStamp
' '
+42 -7
View File
@@ -31,12 +31,17 @@ Partial Class frmIncludeExclude
Me.txtRootFolder = New System.Windows.Forms.TextBox() Me.txtRootFolder = New System.Windows.Forms.TextBox()
Me.btnBrowse = New System.Windows.Forms.Button() Me.btnBrowse = New System.Windows.Forms.Button()
Me.lstBuilder = New System.Windows.Forms.ListView() Me.lstBuilder = New System.Windows.Forms.ListView()
Me.cmsItems = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.cmsEdit = New System.Windows.Forms.ToolStripMenuItem()
Me.cmsRemove = New System.Windows.Forms.ToolStripMenuItem()
Me.cmsAdd = New System.Windows.Forms.ToolStripMenuItem()
Me.btnRemove = New System.Windows.Forms.Button() Me.btnRemove = New System.Windows.Forms.Button()
Me.btnAdd = New System.Windows.Forms.Button() Me.btnAdd = New System.Windows.Forms.Button()
Me.grpFileOptions = New System.Windows.Forms.GroupBox() Me.grpFileOptions = New System.Windows.Forms.GroupBox()
Me.optFileTypes = New System.Windows.Forms.RadioButton() Me.optFileTypes = New System.Windows.Forms.RadioButton()
Me.optIndividualFiles = New System.Windows.Forms.RadioButton() Me.optIndividualFiles = New System.Windows.Forms.RadioButton()
Me.lblItems = New System.Windows.Forms.Label() Me.lblItems = New System.Windows.Forms.Label()
Me.cmsItems.SuspendLayout()
Me.grpFileOptions.SuspendLayout() Me.grpFileOptions.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
@@ -82,13 +87,13 @@ Partial Class frmIncludeExclude
Me.txtRootFolder.Location = New System.Drawing.Point(12, 12) Me.txtRootFolder.Location = New System.Drawing.Point(12, 12)
Me.txtRootFolder.Name = "txtRootFolder" Me.txtRootFolder.Name = "txtRootFolder"
Me.txtRootFolder.ReadOnly = True Me.txtRootFolder.ReadOnly = True
Me.txtRootFolder.Size = New System.Drawing.Size(194, 20) Me.txtRootFolder.Size = New System.Drawing.Size(214, 20)
Me.txtRootFolder.TabIndex = 0 Me.txtRootFolder.TabIndex = 0
Me.txtRootFolder.TabStop = False Me.txtRootFolder.TabStop = False
' '
'btnBrowse 'btnBrowse
' '
Me.btnBrowse.Location = New System.Drawing.Point(212, 12) Me.btnBrowse.Location = New System.Drawing.Point(232, 12)
Me.btnBrowse.Name = "btnBrowse" Me.btnBrowse.Name = "btnBrowse"
Me.btnBrowse.Size = New System.Drawing.Size(30, 20) Me.btnBrowse.Size = New System.Drawing.Size(30, 20)
Me.btnBrowse.TabIndex = 0 Me.btnBrowse.TabIndex = 0
@@ -97,6 +102,7 @@ Partial Class frmIncludeExclude
' '
'lstBuilder 'lstBuilder
' '
Me.lstBuilder.ContextMenuStrip = Me.cmsItems
Me.lstBuilder.LabelEdit = True Me.lstBuilder.LabelEdit = True
Me.lstBuilder.Location = New System.Drawing.Point(322, 38) Me.lstBuilder.Location = New System.Drawing.Point(322, 38)
Me.lstBuilder.Name = "lstBuilder" Me.lstBuilder.Name = "lstBuilder"
@@ -106,13 +112,37 @@ Partial Class frmIncludeExclude
Me.lstBuilder.UseCompatibleStateImageBehavior = False Me.lstBuilder.UseCompatibleStateImageBehavior = False
Me.lstBuilder.View = System.Windows.Forms.View.List Me.lstBuilder.View = System.Windows.Forms.View.List
' '
'cmsItems
'
Me.cmsItems.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmsEdit, Me.cmsRemove, Me.cmsAdd})
Me.cmsItems.Name = "cmsItems"
Me.cmsItems.Size = New System.Drawing.Size(169, 70)
'
'cmsEdit
'
Me.cmsEdit.Name = "cmsEdit"
Me.cmsEdit.Size = New System.Drawing.Size(168, 22)
Me.cmsEdit.Text = "Edit"
'
'cmsRemove
'
Me.cmsRemove.Name = "cmsRemove"
Me.cmsRemove.Size = New System.Drawing.Size(168, 22)
Me.cmsRemove.Text = "Remove"
'
'cmsAdd
'
Me.cmsAdd.Name = "cmsAdd"
Me.cmsAdd.Size = New System.Drawing.Size(168, 22)
Me.cmsAdd.Text = "Add Custom Item"
'
'btnRemove 'btnRemove
' '
Me.btnRemove.Location = New System.Drawing.Point(268, 201) Me.btnRemove.Location = New System.Drawing.Point(268, 201)
Me.btnRemove.Name = "btnRemove" Me.btnRemove.Name = "btnRemove"
Me.btnRemove.Size = New System.Drawing.Size(48, 23) Me.btnRemove.Size = New System.Drawing.Size(48, 23)
Me.btnRemove.TabIndex = 4 Me.btnRemove.TabIndex = 4
Me.btnRemove.Text = "< <" Me.btnRemove.Text = "<"
Me.btnRemove.UseVisualStyleBackColor = True Me.btnRemove.UseVisualStyleBackColor = True
' '
'btnAdd 'btnAdd
@@ -121,7 +151,7 @@ Partial Class frmIncludeExclude
Me.btnAdd.Name = "btnAdd" Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(48, 23) Me.btnAdd.Size = New System.Drawing.Size(48, 23)
Me.btnAdd.TabIndex = 3 Me.btnAdd.TabIndex = 3
Me.btnAdd.Text = "> >" Me.btnAdd.Text = ">"
Me.btnAdd.UseVisualStyleBackColor = True Me.btnAdd.UseVisualStyleBackColor = True
' '
'grpFileOptions 'grpFileOptions
@@ -159,12 +189,12 @@ Partial Class frmIncludeExclude
' '
'lblItems 'lblItems
' '
Me.lblItems.AutoSize = True Me.lblItems.Location = New System.Drawing.Point(322, 16)
Me.lblItems.Location = New System.Drawing.Point(319, 16)
Me.lblItems.Name = "lblItems" Me.lblItems.Name = "lblItems"
Me.lblItems.Size = New System.Drawing.Size(32, 13) Me.lblItems.Size = New System.Drawing.Size(250, 13)
Me.lblItems.TabIndex = 14 Me.lblItems.TabIndex = 14
Me.lblItems.Text = "Items" Me.lblItems.Text = "Items"
Me.lblItems.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
' '
'frmIncludeExclude 'frmIncludeExclude
' '
@@ -188,6 +218,7 @@ Partial Class frmIncludeExclude
Me.ShowIcon = False Me.ShowIcon = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Include / Exclude Builder" Me.Text = "Include / Exclude Builder"
Me.cmsItems.ResumeLayout(False)
Me.grpFileOptions.ResumeLayout(False) Me.grpFileOptions.ResumeLayout(False)
Me.grpFileOptions.PerformLayout() Me.grpFileOptions.PerformLayout()
Me.ResumeLayout(False) Me.ResumeLayout(False)
@@ -207,4 +238,8 @@ Partial Class frmIncludeExclude
Friend WithEvents optFileTypes As System.Windows.Forms.RadioButton Friend WithEvents optFileTypes As System.Windows.Forms.RadioButton
Friend WithEvents optIndividualFiles As System.Windows.Forms.RadioButton Friend WithEvents optIndividualFiles As System.Windows.Forms.RadioButton
Friend WithEvents lblItems As System.Windows.Forms.Label Friend WithEvents lblItems As System.Windows.Forms.Label
Friend WithEvents cmsItems As System.Windows.Forms.ContextMenuStrip
Friend WithEvents cmsEdit As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmsRemove As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmsAdd As System.Windows.Forms.ToolStripMenuItem
End Class End Class
+4 -1
View File
@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAB6
CQAAAk1TRnQBSQFMAgEBAwEAAVABAAFQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CQAAAk1TRnQBSQFMAgEBAwEAAZABAAGQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -168,4 +168,7 @@
AQcBgAF/AgAC/wHwAR8BgAH/AgAC/wH4AT8C/wIACw== AQcBgAF/AgAC/wHwAR8BgAH/AgAC/wH4AT8C/wIACw==
</value> </value>
</data> </data>
<metadata name="cmsItems.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 17</value>
</metadata>
</root> </root>
+63 -21
View File
@@ -33,7 +33,7 @@ Public Class frmIncludeExclude
End Set End Set
End Property End Property
Private Sub BuildBranch(ByVal sDirectory As String, ByVal oNode As TreeNode, ByVal bIsDriveRoot As Boolean) Private Sub BuildBranch(ByVal sDirectory As String, ByVal oNode As TreeNode)
Dim sFolders As String() Dim sFolders As String()
Dim sFiles As String() Dim sFiles As String()
Dim oChild As TreeNode Dim oChild As TreeNode
@@ -49,13 +49,9 @@ Public Class frmIncludeExclude
sFiles = Directory.GetFiles(sDirectory) sFiles = Directory.GetFiles(sDirectory)
If sFolders.Length <> 0 Then If sFolders.Length <> 0 Then
For Each sFolder As String In sFolders For Each sFolder As String In sFolders
If bIsDriveRoot Then oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty).TrimStart("\"), 0, 0)
oChild = New TreeNode(sFolder.Replace(sDirectory, String.Empty), 0, 0) oChild.Name = sFolder
Else
oChild = New TreeNode(sFolder.Replace(sDirectory & "\", String.Empty), 0, 0)
End If
oChild.Name = sFolder
oChild.Tag = 0 oChild.Tag = 0
oNode.Nodes.Add(oChild) oNode.Nodes.Add(oChild)
oPlaceHolder = New TreeNode("GBM_Tree_Placeholder") oPlaceHolder = New TreeNode("GBM_Tree_Placeholder")
@@ -65,12 +61,8 @@ Public Class frmIncludeExclude
End If End If
If sFiles.Length <> 0 Then If sFiles.Length <> 0 Then
For Each sFile As String In sFiles For Each sFile As String In sFiles
If bIsDriveRoot Then oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty).TrimStart("\"), 1, 1)
oChild = New TreeNode(sFile.Replace(sDirectory, String.Empty), 1, 1)
Else
oChild = New TreeNode(sFile.Replace(sDirectory & "\", String.Empty), 1, 1)
End If
oChild.Tag = 1 oChild.Tag = 1
oNode.Nodes.Add(oChild) oNode.Nodes.Add(oChild)
Next Next
@@ -88,20 +80,17 @@ Public Class frmIncludeExclude
Private Sub BuildTrunk() Private Sub BuildTrunk()
Dim oRootNode As TreeNode Dim oRootNode As TreeNode
Dim bIsDriveRoot As Boolean
If Path.GetPathRoot(txtRootFolder.Text) = txtRootFolder.Text Then If Path.GetPathRoot(txtRootFolder.Text) = txtRootFolder.Text Then
oRootNode = New TreeNode(txtRootFolder.Text, 0, 0) oRootNode = New TreeNode(txtRootFolder.Text, 0, 0)
bIsDriveRoot = True
Else Else
oRootNode = New TreeNode(Path.GetFileName(txtRootFolder.Text), 0, 0) oRootNode = New TreeNode(Path.GetFileName(txtRootFolder.Text), 0, 0)
bIsDriveRoot = False
End If End If
treFiles.Nodes.Clear() treFiles.Nodes.Clear()
oRootNode.Name = "Root" oRootNode.Name = "Root"
treFiles.Nodes.Add(oRootNode) treFiles.Nodes.Add(oRootNode)
BuildBranch(txtRootFolder.Text, oRootNode, bIsDriveRoot) BuildBranch(txtRootFolder.Text, oRootNode)
End Sub End Sub
Private Sub RootPathBrowse() Private Sub RootPathBrowse()
@@ -195,6 +184,24 @@ Public Class frmIncludeExclude
Next Next
End Sub End Sub
Private Sub IdentifyEntry(ByRef oListItem As ListViewItem, ByVal sNewLabel As String)
Dim iType As Integer = 1
If sNewLabel.Contains("*") Then
iType = 2
Else
If txtRootFolder.Text <> String.Empty Then
If Directory.Exists(txtRootFolder.Text & "\" & sNewLabel) Then
iType = 0
Else
iType = 1
End If
End If
End If
oListItem.ImageIndex = iType
End Sub
Private Sub CreateNewBuilderString() Private Sub CreateNewBuilderString()
Dim sTempString As String = String.Empty Dim sTempString As String = String.Empty
@@ -208,12 +215,12 @@ Public Class frmIncludeExclude
End Sub End Sub
Private Sub frmIncludeExclude_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub frmIncludeExclude_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = FormName & " Builder" Me.Text = FormName & " Builder"
txtRootFolder.Text = RootFolder txtRootFolder.Text = RootFolder
optFileTypes.Checked = True optFileTypes.Checked = True
lblItems.Text = FormName & " Items" lblItems.Text = FormName & " Items"
If BuilderString <> String.Empty Then ParseBuilderString() If BuilderString <> String.Empty Then ParseBuilderString()
If txtRootFolder.Text <> String.Empty Then BuildTrunk() If txtRootFolder.Text <> String.Empty Then BuildTrunk()
End Sub End Sub
Private Sub frmIncludeExclude_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown Private Sub frmIncludeExclude_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
@@ -239,7 +246,7 @@ Public Class frmIncludeExclude
Private Sub treFiles_BeforeExpand(sender As Object, e As TreeViewCancelEventArgs) Handles treFiles.BeforeExpand Private Sub treFiles_BeforeExpand(sender As Object, e As TreeViewCancelEventArgs) Handles treFiles.BeforeExpand
If Not e.Node.Name = "Root" Then If Not e.Node.Name = "Root" Then
BuildBranch(e.Node.Name, e.Node, False) BuildBranch(e.Node.Name, e.Node)
End If End If
End Sub End Sub
@@ -250,4 +257,39 @@ Public Class frmIncludeExclude
Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
RemoveItem() RemoveItem()
End Sub End Sub
Private Sub cmsItems_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles cmsItems.Opening
If lstBuilder.SelectedItems.Count = 0 Then
cmsEdit.Visible = False
cmsRemove.Visible = False
cmsAdd.Visible = True
Else
cmsEdit.Visible = True
cmsRemove.Visible = True
cmsAdd.Visible = False
End If
End Sub
Private Sub cmsEdit_Click(sender As Object, e As EventArgs) Handles cmsEdit.Click
If lstBuilder.SelectedItems.Count > 0 Then
lstBuilder.SelectedItems(0).BeginEdit()
End If
End Sub
Private Sub cmsRemove_Click(sender As Object, e As EventArgs) Handles cmsRemove.Click
RemoveItem()
End Sub
Private Sub cmsAdd_Click(sender As Object, e As EventArgs) Handles cmsAdd.Click
Dim oNewItem As New ListViewItem("Custom Item", 1)
oNewItem.Selected = True
lstBuilder.Items.Add(oNewItem)
lstBuilder.SelectedItems(0).BeginEdit()
End Sub
Private Sub lstBuilder_AfterLabelEdit(sender As Object, e As LabelEditEventArgs) Handles lstBuilder.AfterLabelEdit
If Not e.Label Is Nothing Then
IdentifyEntry(lstBuilder.Items(e.Item), e.Label)
End If
End Sub
End Class End Class