From dbdabcc9b09bdadf3c1c93ce2e8669327d41edd1 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Wed, 13 Jul 2016 17:49:08 +0200 Subject: [PATCH] better file browser dialog in GUI --- VECTO/File Browser/FB_Dialog.designer.vb | 700 +++++++++++++---------- VECTO/File Browser/FB_Dialog.resx | 3 + VECTO/File Browser/FB_Dialog.vb | 49 +- VECTO/File Browser/cFileBrowser.vb | 253 ++++---- VECTO/GUI/F_GBX.Designer.vb | 16 +- VECTO/GUI/F_MAINForm.Designer.vb | 21 +- 6 files changed, 573 insertions(+), 469 deletions(-) diff --git a/VECTO/File Browser/FB_Dialog.designer.vb b/VECTO/File Browser/FB_Dialog.designer.vb index 0ae8e30332..10b002072e 100644 --- a/VECTO/File Browser/FB_Dialog.designer.vb +++ b/VECTO/File Browser/FB_Dialog.designer.vb @@ -32,324 +32,383 @@ Partial Class FB_Dialog 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() - Me.components = New System.ComponentModel.Container() - Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() - Me.ButtonNewDir = New System.Windows.Forms.Button() - Me.ButtonDesktop = New System.Windows.Forms.Button() - Me.ButtonHisFolder = New System.Windows.Forms.Button() - Me.ButtonFolderBack = New System.Windows.Forms.Button() - Me.TextBoxSearchFolder = New System.Windows.Forms.TextBox() - Me.ListViewFolder = New System.Windows.Forms.ListView() - Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) - Me.ComboBoxDrive = New System.Windows.Forms.ComboBox() - Me.ButtonAll = New System.Windows.Forms.Button() - Me.LabelFileAnz = New System.Windows.Forms.Label() - Me.ComboBoxExt = New System.Windows.Forms.ComboBox() - Me.ButtonHisFile = New System.Windows.Forms.Button() - Me.TextBoxSearchFile = New System.Windows.Forms.TextBox() - Me.ListViewFiles = New System.Windows.Forms.ListView() - Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) - Me.ContextMenuFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.RenameFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.DeleteFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.TextBoxPath = New System.Windows.Forms.TextBox() - Me.ContextMenuHisFolder = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.ContextMenuHisFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.ButtonOK = New System.Windows.Forms.Button() - Me.ButtonCancel = New System.Windows.Forms.Button() - Me.TextBoxCurrent = New System.Windows.Forms.TextBox() - CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SplitContainer1.Panel1.SuspendLayout() - Me.SplitContainer1.Panel2.SuspendLayout() - Me.SplitContainer1.SuspendLayout() - Me.ContextMenuFile.SuspendLayout() - Me.SuspendLayout() - ' - 'SplitContainer1 - ' - Me.SplitContainer1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.SplitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D - Me.SplitContainer1.Location = New System.Drawing.Point(12, 36) - Me.SplitContainer1.Name = "SplitContainer1" - ' - 'SplitContainer1.Panel1 - ' - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) - Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ListViewFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxDrive) - ' - 'SplitContainer1.Panel2 - ' - Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonAll) - Me.SplitContainer1.Panel2.Controls.Add(Me.LabelFileAnz) - Me.SplitContainer1.Panel2.Controls.Add(Me.ComboBoxExt) - Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonHisFile) - Me.SplitContainer1.Panel2.Controls.Add(Me.TextBoxSearchFile) - Me.SplitContainer1.Panel2.Controls.Add(Me.ListViewFiles) - Me.SplitContainer1.Size = New System.Drawing.Size(764, 293) - Me.SplitContainer1.SplitterDistance = 382 - Me.SplitContainer1.TabIndex = 5 - Me.SplitContainer1.TabStop = False - ' - 'ButtonNewDir - ' - Me.ButtonNewDir.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonNewDir.Location = New System.Drawing.Point(202, 3) - Me.ButtonNewDir.Name = "ButtonNewDir" - Me.ButtonNewDir.Size = New System.Drawing.Size(38, 21) - Me.ButtonNewDir.TabIndex = 21 - Me.ButtonNewDir.TabStop = False - Me.ButtonNewDir.Text = "New" - Me.ButtonNewDir.UseVisualStyleBackColor = True - ' - 'ButtonDesktop - ' - Me.ButtonDesktop.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonDesktop.Location = New System.Drawing.Point(246, 3) - Me.ButtonDesktop.Name = "ButtonDesktop" - Me.ButtonDesktop.Size = New System.Drawing.Size(57, 21) - Me.ButtonDesktop.TabIndex = 22 - Me.ButtonDesktop.TabStop = False - Me.ButtonDesktop.Text = "Desktop" - Me.ButtonDesktop.UseVisualStyleBackColor = True - ' - 'ButtonHisFolder - ' - Me.ButtonHisFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonHisFolder.Location = New System.Drawing.Point(309, 3) - Me.ButtonHisFolder.Name = "ButtonHisFolder" - Me.ButtonHisFolder.Size = New System.Drawing.Size(68, 21) - Me.ButtonHisFolder.TabIndex = 24 - Me.ButtonHisFolder.TabStop = False - Me.ButtonHisFolder.Text = "His / Fav" - Me.ButtonHisFolder.UseVisualStyleBackColor = True - ' - 'ButtonFolderBack - ' - Me.ButtonFolderBack.Location = New System.Drawing.Point(63, 3) - Me.ButtonFolderBack.Name = "ButtonFolderBack" - Me.ButtonFolderBack.Size = New System.Drawing.Size(28, 21) - Me.ButtonFolderBack.TabIndex = 20 - Me.ButtonFolderBack.TabStop = False - Me.ButtonFolderBack.Text = "<" - Me.ButtonFolderBack.UseVisualStyleBackColor = True - ' - 'TextBoxSearchFolder - ' - Me.TextBoxSearchFolder.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxSearchFolder.Location = New System.Drawing.Point(3, 266) - Me.TextBoxSearchFolder.Name = "TextBoxSearchFolder" - Me.TextBoxSearchFolder.Size = New System.Drawing.Size(374, 20) - Me.TextBoxSearchFolder.TabIndex = 15 - ' - 'ListViewFolder - ' - Me.ListViewFolder.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ListViewFolder.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader3}) - Me.ListViewFolder.FullRowSelect = True - Me.ListViewFolder.GridLines = True - Me.ListViewFolder.HideSelection = False - Me.ListViewFolder.Location = New System.Drawing.Point(3, 30) - Me.ListViewFolder.MultiSelect = False - Me.ListViewFolder.Name = "ListViewFolder" - Me.ListViewFolder.Size = New System.Drawing.Size(374, 230) - Me.ListViewFolder.TabIndex = 10 - Me.ListViewFolder.UseCompatibleStateImageBehavior = False - Me.ListViewFolder.View = System.Windows.Forms.View.Details - ' - 'ColumnHeader3 - ' - Me.ColumnHeader3.Text = "Directory" - ' - 'ComboBoxDrive - ' - Me.ComboBoxDrive.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.ComboBoxDrive.FormattingEnabled = True - Me.ComboBoxDrive.Location = New System.Drawing.Point(3, 3) - Me.ComboBoxDrive.Name = "ComboBoxDrive" - Me.ComboBoxDrive.Size = New System.Drawing.Size(54, 21) - Me.ComboBoxDrive.TabIndex = 5 - ' - 'ButtonAll - ' - Me.ButtonAll.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonAll.Location = New System.Drawing.Point(239, 3) - Me.ButtonAll.Name = "ButtonAll" - Me.ButtonAll.Size = New System.Drawing.Size(71, 21) - Me.ButtonAll.TabIndex = 19 - Me.ButtonAll.Text = "Select All" - Me.ButtonAll.UseVisualStyleBackColor = True - ' - 'LabelFileAnz - ' - Me.LabelFileAnz.AutoSize = True - Me.LabelFileAnz.Location = New System.Drawing.Point(3, 7) - Me.LabelFileAnz.Name = "LabelFileAnz" - Me.LabelFileAnz.Size = New System.Drawing.Size(37, 13) - Me.LabelFileAnz.TabIndex = 7 - Me.LabelFileAnz.Text = "0 Files" - ' - 'ComboBoxExt - ' - Me.ComboBoxExt.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ComboBoxExt.FormattingEnabled = True - Me.ComboBoxExt.Location = New System.Drawing.Point(291, 266) - Me.ComboBoxExt.Name = "ComboBoxExt" - Me.ComboBoxExt.Size = New System.Drawing.Size(82, 21) - Me.ComboBoxExt.TabIndex = 20 - ' - 'ButtonHisFile - ' - Me.ButtonHisFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonHisFile.Location = New System.Drawing.Point(316, 3) - Me.ButtonHisFile.Name = "ButtonHisFile" - Me.ButtonHisFile.Size = New System.Drawing.Size(57, 21) - Me.ButtonHisFile.TabIndex = 24 - Me.ButtonHisFile.TabStop = False - Me.ButtonHisFile.Text = "History" - Me.ButtonHisFile.UseVisualStyleBackColor = True - ' - 'TextBoxSearchFile - ' - Me.TextBoxSearchFile.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxSearchFile.Location = New System.Drawing.Point(3, 266) - Me.TextBoxSearchFile.Name = "TextBoxSearchFile" - Me.TextBoxSearchFile.Size = New System.Drawing.Size(282, 20) - Me.TextBoxSearchFile.TabIndex = 15 - ' - 'ListViewFiles - ' - Me.ListViewFiles.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ListViewFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1}) - Me.ListViewFiles.ContextMenuStrip = Me.ContextMenuFile - Me.ListViewFiles.FullRowSelect = True - Me.ListViewFiles.GridLines = True - Me.ListViewFiles.HideSelection = False - Me.ListViewFiles.Location = New System.Drawing.Point(3, 30) - Me.ListViewFiles.Name = "ListViewFiles" - Me.ListViewFiles.Size = New System.Drawing.Size(370, 230) - Me.ListViewFiles.TabIndex = 10 - Me.ListViewFiles.UseCompatibleStateImageBehavior = False - Me.ListViewFiles.View = System.Windows.Forms.View.Details - ' - 'ColumnHeader1 - ' - Me.ColumnHeader1.Text = "Filename" - Me.ColumnHeader1.Width = 251 - ' - 'ContextMenuFile - ' - Me.ContextMenuFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) - Me.ContextMenuFile.Name = "ContextMenuFile" - Me.ContextMenuFile.Size = New System.Drawing.Size(148, 48) - ' - 'RenameFileToolStripMenuItem - ' - Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" - Me.RenameFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) - Me.RenameFileToolStripMenuItem.Text = "Rename File..." - ' - 'DeleteFileToolStripMenuItem - ' - Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" - Me.DeleteFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) - Me.DeleteFileToolStripMenuItem.Text = "Delete File..." - ' - 'TextBoxPath - ' - Me.TextBoxPath.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxPath.Location = New System.Drawing.Point(12, 335) - Me.TextBoxPath.Name = "TextBoxPath" - Me.TextBoxPath.Size = New System.Drawing.Size(764, 20) - Me.TextBoxPath.TabIndex = 15 - ' - 'ContextMenuHisFolder - ' - Me.ContextMenuHisFolder.Name = "ContextMenuFolderHis" - Me.ContextMenuHisFolder.Size = New System.Drawing.Size(61, 4) - ' - 'ContextMenuHisFile - ' - Me.ContextMenuHisFile.Name = "ContextMenuFileHis" - Me.ContextMenuHisFile.Size = New System.Drawing.Size(61, 4) - ' - 'ButtonOK - ' - Me.ButtonOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonOK.DialogResult = System.Windows.Forms.DialogResult.OK - Me.ButtonOK.Location = New System.Drawing.Point(620, 361) - Me.ButtonOK.Name = "ButtonOK" - Me.ButtonOK.Size = New System.Drawing.Size(75, 23) - Me.ButtonOK.TabIndex = 20 - Me.ButtonOK.TabStop = False - Me.ButtonOK.Text = "OK" - Me.ButtonOK.UseVisualStyleBackColor = True - ' - 'ButtonCancel - ' - Me.ButtonCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButtonCancel.Location = New System.Drawing.Point(701, 361) - Me.ButtonCancel.Name = "ButtonCancel" - Me.ButtonCancel.Size = New System.Drawing.Size(75, 23) - Me.ButtonCancel.TabIndex = 25 - Me.ButtonCancel.TabStop = False - Me.ButtonCancel.Text = "Cancel" - Me.ButtonCancel.UseVisualStyleBackColor = True - ' - 'TextBoxCurrent - ' - Me.TextBoxCurrent.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxCurrent.Cursor = System.Windows.Forms.Cursors.Hand - Me.TextBoxCurrent.Location = New System.Drawing.Point(12, 14) - Me.TextBoxCurrent.Name = "TextBoxCurrent" - Me.TextBoxCurrent.ReadOnly = True - Me.TextBoxCurrent.Size = New System.Drawing.Size(764, 20) - Me.TextBoxCurrent.TabIndex = 0 - Me.TextBoxCurrent.TabStop = False - ' - 'FB_Dialog - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.CancelButton = Me.ButtonCancel - Me.ClientSize = New System.Drawing.Size(788, 391) - Me.Controls.Add(Me.TextBoxCurrent) - Me.Controls.Add(Me.ButtonCancel) - Me.Controls.Add(Me.ButtonOK) - Me.Controls.Add(Me.TextBoxPath) - Me.Controls.Add(Me.SplitContainer1) - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "FB_Dialog" - Me.ShowIcon = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "File Browser" - Me.SplitContainer1.Panel1.ResumeLayout(False) - Me.SplitContainer1.Panel1.PerformLayout() - Me.SplitContainer1.Panel2.ResumeLayout(False) - Me.SplitContainer1.Panel2.PerformLayout() - CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() - Me.SplitContainer1.ResumeLayout(False) - Me.ContextMenuFile.ResumeLayout(False) - Me.ResumeLayout(False) - Me.PerformLayout() + Me.components = New System.ComponentModel.Container() + Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() + Me.Label1 = New System.Windows.Forms.Label() + Me.ButtonNewDir = New System.Windows.Forms.Button() + Me.ButtonDesktop = New System.Windows.Forms.Button() + Me.ButtonHisFolder = New System.Windows.Forms.Button() + Me.ButtonFolderBack = New System.Windows.Forms.Button() + Me.TextBoxSearchFolder = New System.Windows.Forms.TextBox() + Me.ListViewFolder = New System.Windows.Forms.ListView() + Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ComboBoxDrive = New System.Windows.Forms.ComboBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.ButtonAll = New System.Windows.Forms.Button() + Me.LabelFileAnz = New System.Windows.Forms.Label() + Me.ComboBoxExt = New System.Windows.Forms.ComboBox() + Me.ButtonHisFile = New System.Windows.Forms.Button() + Me.TextBoxSearchFile = New System.Windows.Forms.TextBox() + Me.ListViewFiles = New System.Windows.Forms.ListView() + Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ContextMenuFile = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.RenameFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.DeleteFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.TextBoxPath = New System.Windows.Forms.TextBox() + Me.ContextMenuHisFolder = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ContextMenuHisFile = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ButtonOK = New System.Windows.Forms.Button() + Me.ButtonCancel = New System.Windows.Forms.Button() + Me.TextBoxCurrent = New System.Windows.Forms.TextBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) + Me.Label4 = New System.Windows.Forms.Label() + CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SplitContainer1.Panel1.SuspendLayout() + Me.SplitContainer1.Panel2.SuspendLayout() + Me.SplitContainer1.SuspendLayout() + Me.ContextMenuFile.SuspendLayout() + Me.SuspendLayout() + ' + 'SplitContainer1 + ' + Me.SplitContainer1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.SplitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D + Me.SplitContainer1.Location = New System.Drawing.Point(3, 49) + Me.SplitContainer1.Name = "SplitContainer1" + ' + 'SplitContainer1.Panel1 + ' + Me.SplitContainer1.Panel1.Controls.Add(Me.Label1) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) + Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ListViewFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxDrive) + ' + 'SplitContainer1.Panel2 + ' + Me.SplitContainer1.Panel2.Controls.Add(Me.Label2) + Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonAll) + Me.SplitContainer1.Panel2.Controls.Add(Me.LabelFileAnz) + Me.SplitContainer1.Panel2.Controls.Add(Me.ComboBoxExt) + Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonHisFile) + Me.SplitContainer1.Panel2.Controls.Add(Me.TextBoxSearchFile) + Me.SplitContainer1.Panel2.Controls.Add(Me.ListViewFiles) + Me.SplitContainer1.Size = New System.Drawing.Size(562, 395) + Me.SplitContainer1.SplitterDistance = 280 + Me.SplitContainer1.TabIndex = 5 + Me.SplitContainer1.TabStop = False + ' + 'Label1 + ' + Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(3, 372) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(32, 13) + Me.Label1.TabIndex = 28 + Me.Label1.Text = "Filter:" + ' + 'ButtonNewDir + ' + Me.ButtonNewDir.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonNewDir.Location = New System.Drawing.Point(96, 2) + Me.ButtonNewDir.Name = "ButtonNewDir" + Me.ButtonNewDir.Size = New System.Drawing.Size(38, 23) + Me.ButtonNewDir.TabIndex = 21 + Me.ButtonNewDir.TabStop = False + Me.ButtonNewDir.Text = "New" + Me.ButtonNewDir.UseVisualStyleBackColor = True + ' + 'ButtonDesktop + ' + Me.ButtonDesktop.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonDesktop.Location = New System.Drawing.Point(133, 2) + Me.ButtonDesktop.Name = "ButtonDesktop" + Me.ButtonDesktop.Size = New System.Drawing.Size(57, 23) + Me.ButtonDesktop.TabIndex = 22 + Me.ButtonDesktop.TabStop = False + Me.ButtonDesktop.Text = "Desktop" + Me.ButtonDesktop.UseVisualStyleBackColor = True + ' + 'ButtonHisFolder + ' + Me.ButtonHisFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonHisFolder.Location = New System.Drawing.Point(189, 2) + Me.ButtonHisFolder.Name = "ButtonHisFolder" + Me.ButtonHisFolder.Size = New System.Drawing.Size(87, 23) + Me.ButtonHisFolder.TabIndex = 24 + Me.ButtonHisFolder.TabStop = False + Me.ButtonHisFolder.Text = "History / Fav." + Me.ButtonHisFolder.UseVisualStyleBackColor = True + ' + 'ButtonFolderBack + ' + Me.ButtonFolderBack.Location = New System.Drawing.Point(60, 2) + Me.ButtonFolderBack.Name = "ButtonFolderBack" + Me.ButtonFolderBack.Size = New System.Drawing.Size(28, 23) + Me.ButtonFolderBack.TabIndex = 20 + Me.ButtonFolderBack.TabStop = False + Me.ButtonFolderBack.Text = "<" + Me.ButtonFolderBack.UseVisualStyleBackColor = True + ' + 'TextBoxSearchFolder + ' + Me.TextBoxSearchFolder.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxSearchFolder.Location = New System.Drawing.Point(41, 369) + Me.TextBoxSearchFolder.Name = "TextBoxSearchFolder" + Me.TextBoxSearchFolder.Size = New System.Drawing.Size(234, 20) + Me.TextBoxSearchFolder.TabIndex = 15 + ' + 'ListViewFolder + ' + Me.ListViewFolder.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ListViewFolder.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader3}) + Me.ListViewFolder.FullRowSelect = True + Me.ListViewFolder.GridLines = True + Me.ListViewFolder.HideSelection = False + Me.ListViewFolder.Location = New System.Drawing.Point(3, 27) + Me.ListViewFolder.MultiSelect = False + Me.ListViewFolder.Name = "ListViewFolder" + Me.ListViewFolder.Size = New System.Drawing.Size(272, 339) + Me.ListViewFolder.SmallImageList = Me.ImageList1 + Me.ListViewFolder.TabIndex = 10 + Me.ListViewFolder.UseCompatibleStateImageBehavior = False + Me.ListViewFolder.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader3 + ' + Me.ColumnHeader3.Text = "Sub-Directories" + Me.ColumnHeader3.Width = 368 + ' + 'ComboBoxDrive + ' + Me.ComboBoxDrive.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBoxDrive.FormattingEnabled = True + Me.ComboBoxDrive.Location = New System.Drawing.Point(5, 3) + Me.ComboBoxDrive.Name = "ComboBoxDrive" + Me.ComboBoxDrive.Size = New System.Drawing.Size(54, 21) + Me.ComboBoxDrive.TabIndex = 5 + ' + 'Label2 + ' + Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(3, 372) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(32, 13) + Me.Label2.TabIndex = 29 + Me.Label2.Text = "Filter:" + ' + 'ButtonAll + ' + Me.ButtonAll.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonAll.Location = New System.Drawing.Point(146, 2) + Me.ButtonAll.Name = "ButtonAll" + Me.ButtonAll.Size = New System.Drawing.Size(71, 23) + Me.ButtonAll.TabIndex = 19 + Me.ButtonAll.Text = "Select All" + Me.ButtonAll.UseVisualStyleBackColor = True + ' + 'LabelFileAnz + ' + Me.LabelFileAnz.AutoSize = True + Me.LabelFileAnz.Location = New System.Drawing.Point(3, 7) + Me.LabelFileAnz.Name = "LabelFileAnz" + Me.LabelFileAnz.Size = New System.Drawing.Size(37, 13) + Me.LabelFileAnz.TabIndex = 7 + Me.LabelFileAnz.Text = "0 Files" + ' + 'ComboBoxExt + ' + Me.ComboBoxExt.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ComboBoxExt.FormattingEnabled = True + Me.ComboBoxExt.Location = New System.Drawing.Point(216, 369) + Me.ComboBoxExt.Name = "ComboBoxExt" + Me.ComboBoxExt.Size = New System.Drawing.Size(57, 21) + Me.ComboBoxExt.TabIndex = 20 + ' + 'ButtonHisFile + ' + Me.ButtonHisFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonHisFile.Location = New System.Drawing.Point(216, 2) + Me.ButtonHisFile.Name = "ButtonHisFile" + Me.ButtonHisFile.Size = New System.Drawing.Size(57, 23) + Me.ButtonHisFile.TabIndex = 24 + Me.ButtonHisFile.TabStop = False + Me.ButtonHisFile.Text = "History" + Me.ButtonHisFile.UseVisualStyleBackColor = True + ' + 'TextBoxSearchFile + ' + Me.TextBoxSearchFile.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxSearchFile.Location = New System.Drawing.Point(41, 369) + Me.TextBoxSearchFile.Name = "TextBoxSearchFile" + Me.TextBoxSearchFile.Size = New System.Drawing.Size(174, 20) + Me.TextBoxSearchFile.TabIndex = 15 + ' + 'ListViewFiles + ' + Me.ListViewFiles.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ListViewFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1}) + Me.ListViewFiles.ContextMenuStrip = Me.ContextMenuFile + Me.ListViewFiles.FullRowSelect = True + Me.ListViewFiles.GridLines = True + Me.ListViewFiles.HideSelection = False + Me.ListViewFiles.Location = New System.Drawing.Point(3, 27) + Me.ListViewFiles.Name = "ListViewFiles" + Me.ListViewFiles.Size = New System.Drawing.Size(270, 339) + Me.ListViewFiles.SmallImageList = Me.ImageList1 + Me.ListViewFiles.TabIndex = 10 + Me.ListViewFiles.UseCompatibleStateImageBehavior = False + Me.ListViewFiles.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader1 + ' + Me.ColumnHeader1.Text = "Files" + Me.ColumnHeader1.Width = 364 + ' + 'ContextMenuFile + ' + Me.ContextMenuFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) + Me.ContextMenuFile.Name = "ContextMenuFile" + Me.ContextMenuFile.Size = New System.Drawing.Size(148, 48) + ' + 'RenameFileToolStripMenuItem + ' + Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" + Me.RenameFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) + Me.RenameFileToolStripMenuItem.Text = "Rename File..." + ' + 'DeleteFileToolStripMenuItem + ' + Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" + Me.DeleteFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) + Me.DeleteFileToolStripMenuItem.Text = "Delete File..." + ' + 'TextBoxPath + ' + Me.TextBoxPath.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxPath.Location = New System.Drawing.Point(3, 461) + Me.TextBoxPath.Name = "TextBoxPath" + Me.TextBoxPath.Size = New System.Drawing.Size(562, 20) + Me.TextBoxPath.TabIndex = 15 + ' + 'ContextMenuHisFolder + ' + Me.ContextMenuHisFolder.Name = "ContextMenuFolderHis" + Me.ContextMenuHisFolder.Size = New System.Drawing.Size(61, 4) + ' + 'ContextMenuHisFile + ' + Me.ContextMenuHisFile.Name = "ContextMenuFileHis" + Me.ContextMenuHisFile.Size = New System.Drawing.Size(61, 4) + ' + 'ButtonOK + ' + Me.ButtonOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonOK.DialogResult = System.Windows.Forms.DialogResult.OK + Me.ButtonOK.Location = New System.Drawing.Point(409, 488) + Me.ButtonOK.Name = "ButtonOK" + Me.ButtonOK.Size = New System.Drawing.Size(75, 23) + Me.ButtonOK.TabIndex = 20 + Me.ButtonOK.TabStop = False + Me.ButtonOK.Text = "OK" + Me.ButtonOK.UseVisualStyleBackColor = True + ' + 'ButtonCancel + ' + Me.ButtonCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.ButtonCancel.Location = New System.Drawing.Point(490, 488) + Me.ButtonCancel.Name = "ButtonCancel" + Me.ButtonCancel.Size = New System.Drawing.Size(75, 23) + Me.ButtonCancel.TabIndex = 25 + Me.ButtonCancel.TabStop = False + Me.ButtonCancel.Text = "Cancel" + Me.ButtonCancel.UseVisualStyleBackColor = True + ' + 'TextBoxCurrent + ' + Me.TextBoxCurrent.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxCurrent.Cursor = System.Windows.Forms.Cursors.Hand + Me.TextBoxCurrent.Location = New System.Drawing.Point(5, 23) + Me.TextBoxCurrent.Name = "TextBoxCurrent" + Me.TextBoxCurrent.ReadOnly = True + Me.TextBoxCurrent.Size = New System.Drawing.Size(557, 20) + Me.TextBoxCurrent.TabIndex = 0 + Me.TextBoxCurrent.TabStop = False + ' + 'Label3 + ' + Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(2, 447) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(52, 13) + Me.Label3.TabIndex = 29 + Me.Label3.Text = "Filename:" + ' + 'ImageList1 + ' + Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit + Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) + Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent + ' + 'Label4 + ' + Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(3, 7) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(89, 13) + Me.Label4.TabIndex = 30 + Me.Label4.Text = "Current Directory:" + ' + 'FB_Dialog + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.CancelButton = Me.ButtonCancel + Me.ClientSize = New System.Drawing.Size(569, 515) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.TextBoxCurrent) + Me.Controls.Add(Me.ButtonCancel) + Me.Controls.Add(Me.ButtonOK) + Me.Controls.Add(Me.TextBoxPath) + Me.Controls.Add(Me.SplitContainer1) + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.MinimumSize = New System.Drawing.Size(585, 268) + Me.Name = "FB_Dialog" + Me.ShowIcon = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "File Browser" + Me.SplitContainer1.Panel1.ResumeLayout(False) + Me.SplitContainer1.Panel1.PerformLayout() + Me.SplitContainer1.Panel2.ResumeLayout(False) + Me.SplitContainer1.Panel2.PerformLayout() + CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() + Me.SplitContainer1.ResumeLayout(False) + Me.ContextMenuFile.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() - End Sub + End Sub Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer Friend WithEvents ComboBoxDrive As System.Windows.Forms.ComboBox Friend WithEvents ListViewFolder As System.Windows.Forms.ListView @@ -374,6 +433,11 @@ Partial Class FB_Dialog Friend WithEvents RenameFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents DeleteFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ButtonNewDir As System.Windows.Forms.Button - Friend WithEvents ButtonAll As System.Windows.Forms.Button + Friend WithEvents ButtonAll As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents ImageList1 As System.Windows.Forms.ImageList + Friend WithEvents Label4 As System.Windows.Forms.Label End Class diff --git a/VECTO/File Browser/FB_Dialog.resx b/VECTO/File Browser/FB_Dialog.resx index 1e27a48028..a152ac7649 100644 --- a/VECTO/File Browser/FB_Dialog.resx +++ b/VECTO/File Browser/FB_Dialog.resx @@ -117,6 +117,9 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="ImageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>473, 17</value> + </metadata> <metadata name="ContextMenuFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>329, 17</value> </metadata> diff --git a/VECTO/File Browser/FB_Dialog.vb b/VECTO/File Browser/FB_Dialog.vb index 271a1c2278..f87109f477 100644 --- a/VECTO/File Browser/FB_Dialog.vb +++ b/VECTO/File Browser/FB_Dialog.vb @@ -13,6 +13,7 @@ Option Infer On Imports System.IO Imports System.Text Imports Microsoft.VisualBasic.FileIO +Imports System.Runtime.InteropServices ''' <summary> ''' File Browser dialog. Entirely controlled by cFilebrowser class. @@ -62,7 +63,7 @@ Public Class FB_Dialog End Sub 'Resize - Private Sub FB_Dialog_Resize(sender As Object, e As EventArgs) Handles Me.Resize + Private Sub FB_Dialog_Resize(sender As Object, e As EventArgs) Handles Me.ResizeEnd Resized() End Sub @@ -75,8 +76,11 @@ Public Class FB_Dialog 'Resized ListView Format Private Sub Resized() + 'To autosize to the width of the column heading, set the Width property to -2 ListViewFolder.Columns(0).Width = -2 + ListViewFolder.Columns(0).Width -= 2 ListViewFiles.Columns(0).Width = -2 + ListViewFiles.Columns(0).Width -= 2 End Sub 'SplitterMoved @@ -747,6 +751,20 @@ Public Class FB_Dialog End If End Sub + + Private Structure SHFILEINFO + Public hIcon As IntPtr ' : icon + Public iIcon As Integer ' : icondex + Public dwAttributes As Integer ' : SFGAO_ flags + <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDisplayName As String + <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public szTypeName As String + End Structure + + Private Const SHGFI_ICON = &H100 + Private Const SHGFI_SMALLICON = &H1 + Private Declare Ansi Function SHGetFileInfo Lib "shell32.dll" (pszPath As String, dwFileAttributes As Integer, + ByRef psfi As SHFILEINFO, cbFileInfo As Integer, uFlags As Integer) As IntPtr + 'Load Folder-List Private Sub LoadListFolder() 'Delete Folder-List @@ -756,8 +774,15 @@ Public Class FB_Dialog 'Add Folder Dim di As New DirectoryInfo(_myFolder) Dim aryFi = di.GetDirectories(searchPat) + ImageList1.Images.Clear() + Dim shinfo = New SHFILEINFO() + shinfo.szDisplayName = New String(Chr(0), 260) + shinfo.szTypeName = New String(Chr(0), 80) + SHGetFileInfo(_myFolder, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON) + Dim myIcon = Icon.FromHandle(shinfo.hIcon) + ImageList1.Images.Add(myIcon) For Each fi In aryFi - ListViewFolder.Items.Add(fi.ToString) + ListViewFolder.Items.Add(fi.ToString, 0) Next Catch ex As Exception ListViewFolder.Items.Add("<ERROR: " & ex.Message.ToString & ">") @@ -795,7 +820,14 @@ Public Class FB_Dialog aryFi = di.GetFiles(searchPat) For Each fi In aryFi x += 1 - ListViewFiles.Items.Add(fi.ToString) + Dim shinfo = New SHFILEINFO() + shinfo.szDisplayName = New String(Chr(0), 260) + shinfo.szTypeName = New String(Chr(0), 80) + SHGetFileInfo(Path.Combine(_myFolder, fi.ToString), 0, shinfo, Marshal.SizeOf(shinfo), + SHGFI_ICON Or SHGFI_SMALLICON) + Dim myIcon = Icon.FromHandle(shinfo.hIcon) + ImageList1.Images.Add(myIcon) + ListViewFiles.Items.Add(fi.ToString, x + 1) Next Next If x = 0 Then @@ -874,12 +906,12 @@ lb10: End If End Sub - Private Shared Function fPATH(Pfad As String) As String - Dim x = Pfad.LastIndexOf("\") + Private Shared Function fPATH(path As String) As String + Dim x = path.LastIndexOf("\") If x = -1 Then - Return Microsoft.VisualBasic.Left(Pfad, 0) + Return Microsoft.VisualBasic.Left(path, 0) Else - Return Microsoft.VisualBasic.Left(Pfad, x + 1) + Return Microsoft.VisualBasic.Left(path, x + 1) End If End Function @@ -914,6 +946,9 @@ lb10: _noExt = False End Set End Property + + Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click + End Sub End Class diff --git a/VECTO/File Browser/cFileBrowser.vb b/VECTO/File Browser/cFileBrowser.vb index 66a9353654..a33af6d538 100644 --- a/VECTO/File Browser/cFileBrowser.vb +++ b/VECTO/File Browser/cFileBrowser.vb @@ -8,7 +8,6 @@ ' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ' ' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.Collections ''' <summary> ''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. @@ -22,140 +21,142 @@ Imports System.Collections ''' File history is unique for each ID. Folder history is global. ''' </remarks> Public Class cFileBrowser + Private Initialized As Boolean + Private MyID As String + Private MyExt As String() + Private Dlog As FB_Dialog + Private NoExt As Boolean + Private bFolderBrowser As Boolean + Private bLightMode As Boolean - Private Initialized As Boolean - Private MyID As String - Private MyExt As String() - Private Dlog As FB_Dialog - Private NoExt As Boolean - Private bFolderBrowser As Boolean - Private bLightMode As Boolean + ''' <summary> + ''' New cFileBrowser instance + ''' </summary> + ''' <param name="ID">Needed to save the file history when not using LightMode.</param> + ''' <param name="FolderBrowser">Browse folders instead of files.</param> + ''' <param name="LightMode">If enabled file history is not saved.</param> + ''' <remarks></remarks> + Public Sub New(ID As String, Optional ByVal FolderBrowser As Boolean = False, + Optional ByVal LightMode As Boolean = False) + Initialized = False + MyID = ID + NoExt = True + bFolderBrowser = FolderBrowser + bLightMode = LightMode + End Sub - ''' <summary> - ''' New cFileBrowser instance - ''' </summary> - ''' <param name="ID">Needed to save the file history when not using LightMode.</param> - ''' <param name="FolderBrowser">Browse folders instead of files.</param> - ''' <param name="LightMode">If enabled file history is not saved.</param> - ''' <remarks></remarks> - Public Sub New(ByVal ID As String, Optional ByVal FolderBrowser As Boolean = False, Optional ByVal LightMode As Boolean = False) - Initialized = False - MyID = ID - NoExt = True - bFolderBrowser = FolderBrowser - bLightMode = LightMode - End Sub + ''' <summary> + ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="multiFile">Allow selecting multiple files.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function OpenDialog(path As String, Optional ByVal multiFile As Boolean = False, + Optional ByVal ext As String = "") As Boolean + Return CustomDialog(path, True, False, tFbExtMode.MultiExt, multiFile, ext, "Open") + End Function - ''' <summary> - ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="MultiFile">Allow selecting multiple files.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function OpenDialog(ByVal path As String, Optional ByVal MultiFile As Boolean = False, Optional ByVal Ext As String = "") As Boolean - Return CustomDialog(path, True, False, tFbExtMode.MultiExt, MultiFile, Ext, "Open") - End Function + ''' <summary> + ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="forceExt">Force predefined file extension.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function SaveDialog(path As String, Optional ByVal forceExt As Boolean = True, Optional ByVal ext As String = "") _ + As Boolean + Dim x As tFbExtMode + If forceExt Then + x = tFbExtMode.ForceExt + Else + x = tFbExtMode.SingleExt + End If + Return CustomDialog(path, False, True, x, False, Ext, "Save As") + End Function - ''' <summary> - ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="ForceExt">Force predefined file extension.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function SaveDialog(ByVal path As String, Optional ByVal ForceExt As Boolean = True, Optional ByVal Ext As String = "") As Boolean - Dim x As tFbExtMode - If ForceExt Then - x = tFbExtMode.ForceExt - Else - x = tFbExtMode.SingleExt - End If - Return CustomDialog(path, False, True, x, False, Ext, "Save As") - End Function + ''' <summary> + ''' Custom open/save dialog. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="fileMustExist">Selected file must exist.</param> + ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> + ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> + ''' <param name="multiFile">Allow to select multiple files.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <param name="title">Dialog title.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function CustomDialog(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, extMode As tFbExtMode, + multiFile As Boolean, ext As String, Optional title As String = "File Browser") As Boolean + If Not Initialized Then Init() + Return Dlog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, Ext, title) + End Function - ''' <summary> - ''' Custom open/save dialog. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="FileMustExist">Selected file must exist.</param> - ''' <param name="OverwriteCheck">If file already exists user will be asked to overwrite.</param> - ''' <param name="ExtMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> - ''' <param name="MultiFile">Allow to select multiple files.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <param name="Title">Dialog title.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function CustomDialog(ByVal path As String, ByVal FileMustExist As Boolean, ByVal OverwriteCheck As Boolean, ByVal ExtMode As tFbExtMode, ByVal MultiFile As Boolean, ByVal Ext As String, Optional Title As String = "File Browser") As Boolean - If Not Initialized Then Init() - Return Dlog.Browse(path, FileMustExist, OverwriteCheck, ExtMode, MultiFile, Ext, Title) - End Function + 'Manually update File History + ''' <summary> + ''' Add file to file history. + ''' </summary> + ''' <param name="path">File to be added to file history.</param> + ''' <remarks></remarks> + Public Sub UpdateHistory(path As String) + If Not Initialized Then Init() + Dlog.UpdateHistory(Path) + End Sub - 'Manually update File History - ''' <summary> - ''' Add file to file history. - ''' </summary> - ''' <param name="Path">File to be added to file history.</param> - ''' <remarks></remarks> - Public Sub UpdateHistory(ByVal Path As String) - If Not Initialized Then Init() - Dlog.UpdateHistory(Path) - End Sub + ''' <summary> + ''' Save file history (if not LightMode) and global folder history. + ''' </summary> + ''' <remarks></remarks> + Public Sub Close() + If Initialized Then + Dlog.SaveAndClose() + Initialized = False + End If + Dlog = Nothing + End Sub - ''' <summary> - ''' Save file history (if not LightMode) and global folder history. - ''' </summary> - ''' <remarks></remarks> - Public Sub Close() - If Initialized Then - Dlog.SaveAndClose() - Initialized = False - End If - Dlog = Nothing - End Sub + Private Sub Init() + Dlog = New FB_Dialog(bLightMode) + Dlog.ID = MyID + If Not NoExt Then Dlog.Extensions = MyExt + If bFolderBrowser Then Dlog.SetFolderBrowser() + Initialized = True + End Sub - Private Sub Init() - Dlog = New FB_Dialog(bLightMode) - Dlog.ID = MyID - If Not NoExt Then Dlog.Extensions = MyExt - If bFolderBrowser Then Dlog.SetFolderBrowser() - Initialized = True - End Sub - - ''' <summary> - ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property Extensions() As String() - Get - Return MyExt - End Get - Set(ByVal value As String()) - MyExt = value - NoExt = False - End Set - End Property - - ''' <summary> - ''' Selected file(s) oder folder (if FolderBrowser) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public ReadOnly Property Files() As String() - Get - If Initialized Then - Return Dlog.Files - Else - Return New String() {""} - End If - End Get - End Property + ''' <summary> + ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property Extensions As String() + Get + Return MyExt + End Get + Set(value As String()) + MyExt = value + NoExt = False + End Set + End Property + ''' <summary> + ''' Selected file(s) oder folder (if FolderBrowser) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public ReadOnly Property Files As String() + Get + If Initialized Then + Return Dlog.Files + Else + Return New String() {""} + End If + End Get + End Property End Class diff --git a/VECTO/GUI/F_GBX.Designer.vb b/VECTO/GUI/F_GBX.Designer.vb index 56636a755c..7d8d28905e 100644 --- a/VECTO/GUI/F_GBX.Designer.vb +++ b/VECTO/GUI/F_GBX.Designer.vb @@ -372,9 +372,9 @@ Partial Class F_GBX 'BtRemGear ' Me.BtRemGear.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon - Me.BtRemGear.Location = New System.Drawing.Point(41, 207) + Me.BtRemGear.Location = New System.Drawing.Point(30, 202) Me.BtRemGear.Name = "BtRemGear" - Me.BtRemGear.Size = New System.Drawing.Size(29, 23) + Me.BtRemGear.Size = New System.Drawing.Size(24, 24) Me.BtRemGear.TabIndex = 2 Me.BtRemGear.UseVisualStyleBackColor = True ' @@ -839,9 +839,9 @@ Partial Class F_GBX 'BtAddGear ' Me.BtAddGear.Image = Global.VECTO.My.Resources.Resources.plus_circle_icon - Me.BtAddGear.Location = New System.Drawing.Point(6, 207) + Me.BtAddGear.Location = New System.Drawing.Point(6, 202) Me.BtAddGear.Name = "BtAddGear" - Me.BtAddGear.Size = New System.Drawing.Size(29, 23) + Me.BtAddGear.Size = New System.Drawing.Size(24, 24) Me.BtAddGear.TabIndex = 1 Me.BtAddGear.UseVisualStyleBackColor = True ' @@ -853,7 +853,7 @@ Partial Class F_GBX Me.GroupBox4.Controls.Add(Me.BtAddGear) Me.GroupBox4.Location = New System.Drawing.Point(12, 135) Me.GroupBox4.Name = "GroupBox4" - Me.GroupBox4.Size = New System.Drawing.Size(441, 236) + Me.GroupBox4.Size = New System.Drawing.Size(441, 232) Me.GroupBox4.TabIndex = 2 Me.GroupBox4.TabStop = False Me.GroupBox4.Text = "Gears" @@ -861,11 +861,11 @@ Partial Class F_GBX 'Label32 ' Me.Label32.AutoSize = True - Me.Label32.Location = New System.Drawing.Point(312, 212) + Me.Label32.Location = New System.Drawing.Point(331, 202) Me.Label32.Name = "Label32" - Me.Label32.Size = New System.Drawing.Size(123, 13) + Me.Label32.Size = New System.Drawing.Size(106, 13) Me.Label32.TabIndex = 3 - Me.Label32.Text = "Double-Click to edit gear" + Me.Label32.Text = "(Double-Click to Edit)" ' 'PnInertiaTI ' diff --git a/VECTO/GUI/F_MAINForm.Designer.vb b/VECTO/GUI/F_MAINForm.Designer.vb index b3b053cf6b..cd5b4f9105 100644 --- a/VECTO/GUI/F_MAINForm.Designer.vb +++ b/VECTO/GUI/F_MAINForm.Designer.vb @@ -227,11 +227,12 @@ Partial Class F_MAINForm ' 'btStartV3 ' + Me.btStartV3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.btStartV3.Image = Global.VECTO.My.Resources.Resources.Play_icon Me.btStartV3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft Me.btStartV3.Location = New System.Drawing.Point(6, 83) Me.btStartV3.Name = "btStartV3" - Me.btStartV3.Size = New System.Drawing.Size(105, 41) + Me.btStartV3.Size = New System.Drawing.Size(105, 55) Me.btStartV3.TabIndex = 20 Me.btStartV3.Text = "START V3" Me.btStartV3.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText @@ -241,7 +242,7 @@ Partial Class F_MAINForm ' Me.LbDecl.AutoSize = True Me.LbDecl.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.LbDecl.Location = New System.Drawing.Point(3, 127) + Me.LbDecl.Location = New System.Drawing.Point(4, 141) Me.LbDecl.Name = "LbDecl" Me.LbDecl.Size = New System.Drawing.Size(107, 13) Me.LbDecl.TabIndex = 19 @@ -261,9 +262,9 @@ Partial Class F_MAINForm ' Me.BtGENdown.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.BtGENdown.Image = Global.VECTO.My.Resources.Resources.Actions_arrow_down_icon - Me.BtGENdown.Location = New System.Drawing.Point(1008, 316) + Me.BtGENdown.Location = New System.Drawing.Point(272, 317) Me.BtGENdown.Name = "BtGENdown" - Me.BtGENdown.Size = New System.Drawing.Size(30, 24) + Me.BtGENdown.Size = New System.Drawing.Size(24, 24) Me.BtGENdown.TabIndex = 6 Me.BtGENdown.UseVisualStyleBackColor = True ' @@ -271,9 +272,9 @@ Partial Class F_MAINForm ' Me.BtGENup.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.BtGENup.Image = Global.VECTO.My.Resources.Resources.Actions_arrow_up_icon - Me.BtGENup.Location = New System.Drawing.Point(977, 316) + Me.BtGENup.Location = New System.Drawing.Point(248, 317) Me.BtGENup.Name = "BtGENup" - Me.BtGENup.Size = New System.Drawing.Size(30, 24) + Me.BtGENup.Size = New System.Drawing.Size(24, 24) Me.BtGENup.TabIndex = 4 Me.BtGENup.UseVisualStyleBackColor = True ' @@ -294,7 +295,7 @@ Partial Class F_MAINForm ' Me.ChBoxAllGEN.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.ChBoxAllGEN.AutoSize = True - Me.ChBoxAllGEN.Location = New System.Drawing.Point(188, 320) + Me.ChBoxAllGEN.Location = New System.Drawing.Point(172, 320) Me.ChBoxAllGEN.Name = "ChBoxAllGEN" Me.ChBoxAllGEN.Size = New System.Drawing.Size(70, 17) Me.ChBoxAllGEN.TabIndex = 16 @@ -346,9 +347,9 @@ Partial Class F_MAINForm Me.ButtonGENremove.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.ButtonGENremove.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ButtonGENremove.Image = Global.VECTO.My.Resources.Resources.minus_circle_icon - Me.ButtonGENremove.Location = New System.Drawing.Point(144, 316) + Me.ButtonGENremove.Location = New System.Drawing.Point(138, 316) Me.ButtonGENremove.Name = "ButtonGENremove" - Me.ButtonGENremove.Size = New System.Drawing.Size(30, 24) + Me.ButtonGENremove.Size = New System.Drawing.Size(24, 24) Me.ButtonGENremove.TabIndex = 2 Me.ButtonGENremove.UseVisualStyleBackColor = True ' @@ -371,7 +372,7 @@ Partial Class F_MAINForm Me.ButtonGENadd.Image = Global.VECTO.My.Resources.Resources.plus_circle_icon Me.ButtonGENadd.Location = New System.Drawing.Point(113, 316) Me.ButtonGENadd.Name = "ButtonGENadd" - Me.ButtonGENadd.Size = New System.Drawing.Size(30, 24) + Me.ButtonGENadd.Size = New System.Drawing.Size(24, 24) Me.ButtonGENadd.TabIndex = 1 Me.ButtonGENadd.UseVisualStyleBackColor = True ' -- GitLab