diff --git a/Source/LibationWinForms/Form1.Designer.cs b/Source/LibationWinForms/Form1.Designer.cs index 1f554c16..98a7b9f7 100644 --- a/Source/LibationWinForms/Form1.Designer.cs +++ b/Source/LibationWinForms/Form1.Designer.cs @@ -28,111 +28,100 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); - this.gridPanel = new System.Windows.Forms.Panel(); - this.filterHelpBtn = new System.Windows.Forms.Button(); - this.filterBtn = new System.Windows.Forms.Button(); - this.filterSearchTb = new System.Windows.Forms.TextBox(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.noAccountsYetAddAccountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.scanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.scanLibraryOfAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.scanLibraryOfSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeLibraryBooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.liberateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.beginBookBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); - this.beginPdfBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); - this.convertAllM4bToMp3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.liberateVisible2ToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); - this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.exportLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.quickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.firstFilterIsDefaultToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.editQuickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.scanningToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.visibleBooksToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); - this.liberateVisibleToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); - this.replaceTagsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.setDownloadedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.accountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.basicSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.visibleCountLbl = new LibationWinForms.FormattableToolStripStatusLabel(); - this.springLbl = new System.Windows.Forms.ToolStripStatusLabel(); - this.backupsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel(); - this.pdfsCountsLbl = new LibationWinForms.FormattableToolStripStatusLabel(); - this.addQuickFilterBtn = new System.Windows.Forms.Button(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.panel1 = new System.Windows.Forms.Panel(); - this.toggleQueueHideBtn = new System.Windows.Forms.Button(); - this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl(); - this.menuStrip1.SuspendLayout(); - this.statusStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // gridPanel - // - this.gridPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + this.filterHelpBtn = new System.Windows.Forms.Button(); + this.filterBtn = new System.Windows.Forms.Button(); + this.filterSearchTb = new System.Windows.Forms.TextBox(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.noAccountsYetAddAccountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.scanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.scanLibraryOfAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.scanLibraryOfSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeLibraryBooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.liberateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.beginBookBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); + this.beginPdfBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); + this.convertAllM4bToMp3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.liberateVisible2ToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); + this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exportLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.quickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.firstFilterIsDefaultToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editQuickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.scanningToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.visibleBooksToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); + this.liberateVisibleToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); + this.replaceTagsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.setDownloadedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.accountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.basicSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.visibleCountLbl = new LibationWinForms.FormattableToolStripStatusLabel(); + this.springLbl = new System.Windows.Forms.ToolStripStatusLabel(); + this.backupsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel(); + this.pdfsCountsLbl = new LibationWinForms.FormattableToolStripStatusLabel(); + this.addQuickFilterBtn = new System.Windows.Forms.Button(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.panel1 = new System.Windows.Forms.Panel(); + this.productsDisplay = new LibationWinForms.ProductsDisplay(); + this.toggleQueueHideBtn = new System.Windows.Forms.Button(); + this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl(); + this.menuStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // filterHelpBtn + // + this.filterHelpBtn.Location = new System.Drawing.Point(15, 3); + this.filterHelpBtn.Margin = new System.Windows.Forms.Padding(15, 3, 4, 3); + this.filterHelpBtn.Name = "filterHelpBtn"; + this.filterHelpBtn.Size = new System.Drawing.Size(26, 27); + this.filterHelpBtn.TabIndex = 3; + this.filterHelpBtn.Text = "?"; + this.filterHelpBtn.UseVisualStyleBackColor = true; + this.filterHelpBtn.Click += new System.EventHandler(this.filterHelpBtn_Click); + // + // filterBtn + // + this.filterBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.filterBtn.Location = new System.Drawing.Point(748, 3); + this.filterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.filterBtn.Name = "filterBtn"; + this.filterBtn.Size = new System.Drawing.Size(88, 27); + this.filterBtn.TabIndex = 2; + this.filterBtn.Text = "Filter"; + this.filterBtn.UseVisualStyleBackColor = true; + this.filterBtn.Click += new System.EventHandler(this.filterBtn_Click); + // + // filterSearchTb + // + this.filterSearchTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.gridPanel.Location = new System.Drawing.Point(15, 33); - this.gridPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.gridPanel.Name = "gridPanel"; - this.gridPanel.Size = new System.Drawing.Size(864, 558); - this.gridPanel.TabIndex = 5; - // - // filterHelpBtn - // - this.filterHelpBtn.Location = new System.Drawing.Point(15, 3); - this.filterHelpBtn.Margin = new System.Windows.Forms.Padding(15, 3, 4, 3); - this.filterHelpBtn.Name = "filterHelpBtn"; - this.filterHelpBtn.Size = new System.Drawing.Size(26, 27); - this.filterHelpBtn.TabIndex = 3; - this.filterHelpBtn.Text = "?"; - this.filterHelpBtn.UseVisualStyleBackColor = true; - this.filterHelpBtn.Click += new System.EventHandler(this.filterHelpBtn_Click); - // - // filterBtn - // - this.filterBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.filterBtn.Location = new System.Drawing.Point(748, 3); - this.filterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.filterBtn.Name = "filterBtn"; - this.filterBtn.Size = new System.Drawing.Size(88, 27); - this.filterBtn.TabIndex = 2; - this.filterBtn.Text = "Filter"; - this.filterBtn.UseVisualStyleBackColor = true; - this.filterBtn.Click += new System.EventHandler(this.filterBtn_Click); - // - // filterSearchTb - // - this.filterSearchTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.filterSearchTb.Location = new System.Drawing.Point(196, 7); - this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.filterSearchTb.Name = "filterSearchTb"; - this.filterSearchTb.Size = new System.Drawing.Size(544, 23); - this.filterSearchTb.TabIndex = 1; - this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.filterSearchTb.Location = new System.Drawing.Point(196, 7); + this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.filterSearchTb.Name = "filterSearchTb"; + this.filterSearchTb.Size = new System.Drawing.Size(544, 23); + this.filterSearchTb.TabIndex = 1; + this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress); + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.importToolStripMenuItem, this.liberateToolStripMenuItem, this.exportToolStripMenuItem, @@ -140,402 +129,415 @@ this.scanningToolStripMenuItem, this.visibleBooksToolStripMenuItem, this.settingsToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); - this.menuStrip1.Size = new System.Drawing.Size(893, 24); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // importToolStripMenuItem - // - this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); + this.menuStrip1.Size = new System.Drawing.Size(893, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // importToolStripMenuItem + // + this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.autoScanLibraryToolStripMenuItem, this.noAccountsYetAddAccountToolStripMenuItem, this.scanLibraryToolStripMenuItem, this.scanLibraryOfAllAccountsToolStripMenuItem, this.scanLibraryOfSomeAccountsToolStripMenuItem, this.removeLibraryBooksToolStripMenuItem}); - this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20); - this.importToolStripMenuItem.Text = "&Import"; - // - // autoScanLibraryToolStripMenuItem - // - this.autoScanLibraryToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.autoScanLibraryToolStripMenuItem.Name = "autoScanLibraryToolStripMenuItem"; - this.autoScanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.autoScanLibraryToolStripMenuItem.Text = "A&uto Scan Library"; - this.autoScanLibraryToolStripMenuItem.Click += new System.EventHandler(this.autoScanLibraryToolStripMenuItem_Click); - // - // noAccountsYetAddAccountToolStripMenuItem - // - this.noAccountsYetAddAccountToolStripMenuItem.Name = "noAccountsYetAddAccountToolStripMenuItem"; - this.noAccountsYetAddAccountToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.noAccountsYetAddAccountToolStripMenuItem.Text = "No accounts yet. A&dd Account..."; - this.noAccountsYetAddAccountToolStripMenuItem.Click += new System.EventHandler(this.noAccountsYetAddAccountToolStripMenuItem_Click); - // - // scanLibraryToolStripMenuItem - // - this.scanLibraryToolStripMenuItem.Name = "scanLibraryToolStripMenuItem"; - this.scanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.scanLibraryToolStripMenuItem.Text = "Scan &Library"; - this.scanLibraryToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryToolStripMenuItem_Click); - // - // scanLibraryOfAllAccountsToolStripMenuItem - // - this.scanLibraryOfAllAccountsToolStripMenuItem.Name = "scanLibraryOfAllAccountsToolStripMenuItem"; - this.scanLibraryOfAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.scanLibraryOfAllAccountsToolStripMenuItem.Text = "Scan Library of &All Accounts"; - this.scanLibraryOfAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfAllAccountsToolStripMenuItem_Click); - // - // scanLibraryOfSomeAccountsToolStripMenuItem - // - this.scanLibraryOfSomeAccountsToolStripMenuItem.Name = "scanLibraryOfSomeAccountsToolStripMenuItem"; - this.scanLibraryOfSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.scanLibraryOfSomeAccountsToolStripMenuItem.Text = "Scan Library of &Some Accounts..."; - this.scanLibraryOfSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfSomeAccountsToolStripMenuItem_Click); - // - // removeLibraryBooksToolStripMenuItem - // - this.removeLibraryBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.importToolStripMenuItem.Name = "importToolStripMenuItem"; + this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20); + this.importToolStripMenuItem.Text = "&Import"; + // + // autoScanLibraryToolStripMenuItem + // + this.autoScanLibraryToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.autoScanLibraryToolStripMenuItem.Name = "autoScanLibraryToolStripMenuItem"; + this.autoScanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.autoScanLibraryToolStripMenuItem.Text = "A&uto Scan Library"; + this.autoScanLibraryToolStripMenuItem.Click += new System.EventHandler(this.autoScanLibraryToolStripMenuItem_Click); + // + // noAccountsYetAddAccountToolStripMenuItem + // + this.noAccountsYetAddAccountToolStripMenuItem.Name = "noAccountsYetAddAccountToolStripMenuItem"; + this.noAccountsYetAddAccountToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.noAccountsYetAddAccountToolStripMenuItem.Text = "No accounts yet. A&dd Account..."; + this.noAccountsYetAddAccountToolStripMenuItem.Click += new System.EventHandler(this.noAccountsYetAddAccountToolStripMenuItem_Click); + // + // scanLibraryToolStripMenuItem + // + this.scanLibraryToolStripMenuItem.Name = "scanLibraryToolStripMenuItem"; + this.scanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.scanLibraryToolStripMenuItem.Text = "Scan &Library"; + this.scanLibraryToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryToolStripMenuItem_Click); + // + // scanLibraryOfAllAccountsToolStripMenuItem + // + this.scanLibraryOfAllAccountsToolStripMenuItem.Name = "scanLibraryOfAllAccountsToolStripMenuItem"; + this.scanLibraryOfAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.scanLibraryOfAllAccountsToolStripMenuItem.Text = "Scan Library of &All Accounts"; + this.scanLibraryOfAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfAllAccountsToolStripMenuItem_Click); + // + // scanLibraryOfSomeAccountsToolStripMenuItem + // + this.scanLibraryOfSomeAccountsToolStripMenuItem.Name = "scanLibraryOfSomeAccountsToolStripMenuItem"; + this.scanLibraryOfSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.scanLibraryOfSomeAccountsToolStripMenuItem.Text = "Scan Library of &Some Accounts..."; + this.scanLibraryOfSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfSomeAccountsToolStripMenuItem_Click); + // + // removeLibraryBooksToolStripMenuItem + // + this.removeLibraryBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.removeAllAccountsToolStripMenuItem, this.removeSomeAccountsToolStripMenuItem}); - this.removeLibraryBooksToolStripMenuItem.Name = "removeLibraryBooksToolStripMenuItem"; - this.removeLibraryBooksToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.removeLibraryBooksToolStripMenuItem.Text = "Remove Library Books"; - this.removeLibraryBooksToolStripMenuItem.Click += new System.EventHandler(this.removeLibraryBooksToolStripMenuItem_Click); - // - // removeAllAccountsToolStripMenuItem - // - this.removeAllAccountsToolStripMenuItem.Name = "removeAllAccountsToolStripMenuItem"; - this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); - this.removeAllAccountsToolStripMenuItem.Text = "All Accounts"; - this.removeAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeAllAccountsToolStripMenuItem_Click); - // - // removeSomeAccountsToolStripMenuItem - // - this.removeSomeAccountsToolStripMenuItem.Name = "removeSomeAccountsToolStripMenuItem"; - this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); - this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts"; - this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click); - // - // liberateToolStripMenuItem - // - this.liberateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.removeLibraryBooksToolStripMenuItem.Name = "removeLibraryBooksToolStripMenuItem"; + this.removeLibraryBooksToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.removeLibraryBooksToolStripMenuItem.Text = "Remove Library Books"; + this.removeLibraryBooksToolStripMenuItem.Click += new System.EventHandler(this.removeLibraryBooksToolStripMenuItem_Click); + // + // removeAllAccountsToolStripMenuItem + // + this.removeAllAccountsToolStripMenuItem.Name = "removeAllAccountsToolStripMenuItem"; + this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.removeAllAccountsToolStripMenuItem.Text = "All Accounts"; + this.removeAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeAllAccountsToolStripMenuItem_Click); + // + // removeSomeAccountsToolStripMenuItem + // + this.removeSomeAccountsToolStripMenuItem.Name = "removeSomeAccountsToolStripMenuItem"; + this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts"; + this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click); + // + // liberateToolStripMenuItem + // + this.liberateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.beginBookBackupsToolStripMenuItem, this.beginPdfBackupsToolStripMenuItem, this.convertAllM4bToMp3ToolStripMenuItem, this.liberateVisible2ToolStripMenuItem}); - this.liberateToolStripMenuItem.Name = "liberateToolStripMenuItem"; - this.liberateToolStripMenuItem.Size = new System.Drawing.Size(61, 20); - this.liberateToolStripMenuItem.Text = "&Liberate"; - // - // beginBookBackupsToolStripMenuItem - // - this.beginBookBackupsToolStripMenuItem.FormatText = "Begin &Book and PDF Backups: {0}"; - this.beginBookBackupsToolStripMenuItem.Name = "beginBookBackupsToolStripMenuItem"; - this.beginBookBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); - this.beginBookBackupsToolStripMenuItem.Text = "Begin &Book and PDF Backups: {0}"; - this.beginBookBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginBookBackupsToolStripMenuItem_Click); - // - // beginPdfBackupsToolStripMenuItem - // - this.beginPdfBackupsToolStripMenuItem.FormatText = "Begin &PDF Only Backups: {0}"; - this.beginPdfBackupsToolStripMenuItem.Name = "beginPdfBackupsToolStripMenuItem"; - this.beginPdfBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); - this.beginPdfBackupsToolStripMenuItem.Text = "Begin &PDF Only Backups: {0}"; - this.beginPdfBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginPdfBackupsToolStripMenuItem_Click); - // - // convertAllM4bToMp3ToolStripMenuItem - // - this.convertAllM4bToMp3ToolStripMenuItem.Name = "convertAllM4bToMp3ToolStripMenuItem"; - this.convertAllM4bToMp3ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); - this.convertAllM4bToMp3ToolStripMenuItem.Text = "Convert all &M4b to Mp3 [Long-running]..."; - this.convertAllM4bToMp3ToolStripMenuItem.Click += new System.EventHandler(this.convertAllM4bToMp3ToolStripMenuItem_Click); - // - // liberateVisible2ToolStripMenuItem - // - this.liberateVisible2ToolStripMenuItem.FormatText = "Liberate &Visible Books: {0}"; - this.liberateVisible2ToolStripMenuItem.Name = "liberateVisible2ToolStripMenuItem"; - this.liberateVisible2ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); - this.liberateVisible2ToolStripMenuItem.Text = "Liberate &Visible Books: {0}"; - this.liberateVisible2ToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible); - // - // exportToolStripMenuItem - // - this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.liberateToolStripMenuItem.Name = "liberateToolStripMenuItem"; + this.liberateToolStripMenuItem.Size = new System.Drawing.Size(61, 20); + this.liberateToolStripMenuItem.Text = "&Liberate"; + // + // beginBookBackupsToolStripMenuItem + // + this.beginBookBackupsToolStripMenuItem.FormatText = "Begin &Book and PDF Backups: {0}"; + this.beginBookBackupsToolStripMenuItem.Name = "beginBookBackupsToolStripMenuItem"; + this.beginBookBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.beginBookBackupsToolStripMenuItem.Text = "Begin &Book and PDF Backups: {0}"; + this.beginBookBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginBookBackupsToolStripMenuItem_Click); + // + // beginPdfBackupsToolStripMenuItem + // + this.beginPdfBackupsToolStripMenuItem.FormatText = "Begin &PDF Only Backups: {0}"; + this.beginPdfBackupsToolStripMenuItem.Name = "beginPdfBackupsToolStripMenuItem"; + this.beginPdfBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.beginPdfBackupsToolStripMenuItem.Text = "Begin &PDF Only Backups: {0}"; + this.beginPdfBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginPdfBackupsToolStripMenuItem_Click); + // + // convertAllM4bToMp3ToolStripMenuItem + // + this.convertAllM4bToMp3ToolStripMenuItem.Name = "convertAllM4bToMp3ToolStripMenuItem"; + this.convertAllM4bToMp3ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.convertAllM4bToMp3ToolStripMenuItem.Text = "Convert all &M4b to Mp3 [Long-running]..."; + this.convertAllM4bToMp3ToolStripMenuItem.Click += new System.EventHandler(this.convertAllM4bToMp3ToolStripMenuItem_Click); + // + // liberateVisible2ToolStripMenuItem + // + this.liberateVisible2ToolStripMenuItem.FormatText = "Liberate &Visible Books: {0}"; + this.liberateVisible2ToolStripMenuItem.Name = "liberateVisible2ToolStripMenuItem"; + this.liberateVisible2ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.liberateVisible2ToolStripMenuItem.Text = "Liberate &Visible Books: {0}"; + this.liberateVisible2ToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible); + // + // exportToolStripMenuItem + // + this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exportLibraryToolStripMenuItem}); - this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20); - this.exportToolStripMenuItem.Text = "E&xport"; - // - // exportLibraryToolStripMenuItem - // - this.exportLibraryToolStripMenuItem.Name = "exportLibraryToolStripMenuItem"; - this.exportLibraryToolStripMenuItem.Size = new System.Drawing.Size(156, 22); - this.exportLibraryToolStripMenuItem.Text = "E&xport Library..."; - this.exportLibraryToolStripMenuItem.Click += new System.EventHandler(this.exportLibraryToolStripMenuItem_Click); - // - // quickFiltersToolStripMenuItem - // - this.quickFiltersToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; + this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20); + this.exportToolStripMenuItem.Text = "E&xport"; + // + // exportLibraryToolStripMenuItem + // + this.exportLibraryToolStripMenuItem.Name = "exportLibraryToolStripMenuItem"; + this.exportLibraryToolStripMenuItem.Size = new System.Drawing.Size(156, 22); + this.exportLibraryToolStripMenuItem.Text = "E&xport Library..."; + this.exportLibraryToolStripMenuItem.Click += new System.EventHandler(this.exportLibraryToolStripMenuItem_Click); + // + // quickFiltersToolStripMenuItem + // + this.quickFiltersToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.firstFilterIsDefaultToolStripMenuItem, this.editQuickFiltersToolStripMenuItem, this.toolStripSeparator1}); - this.quickFiltersToolStripMenuItem.Name = "quickFiltersToolStripMenuItem"; - this.quickFiltersToolStripMenuItem.Size = new System.Drawing.Size(84, 20); - this.quickFiltersToolStripMenuItem.Text = "Quick &Filters"; - // - // firstFilterIsDefaultToolStripMenuItem - // - this.firstFilterIsDefaultToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.firstFilterIsDefaultToolStripMenuItem.Name = "firstFilterIsDefaultToolStripMenuItem"; - this.firstFilterIsDefaultToolStripMenuItem.Size = new System.Drawing.Size(256, 22); - this.firstFilterIsDefaultToolStripMenuItem.Text = "Start Libation with 1st filter &Default"; - this.firstFilterIsDefaultToolStripMenuItem.Click += new System.EventHandler(this.firstFilterIsDefaultToolStripMenuItem_Click); - // - // editQuickFiltersToolStripMenuItem - // - this.editQuickFiltersToolStripMenuItem.Name = "editQuickFiltersToolStripMenuItem"; - this.editQuickFiltersToolStripMenuItem.Size = new System.Drawing.Size(256, 22); - this.editQuickFiltersToolStripMenuItem.Text = "&Edit quick filters..."; - this.editQuickFiltersToolStripMenuItem.Click += new System.EventHandler(this.editQuickFiltersToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(253, 6); - // - // scanningToolStripMenuItem - // - this.scanningToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; - this.scanningToolStripMenuItem.Enabled = false; - this.scanningToolStripMenuItem.Image = global::LibationWinForms.Properties.Resources.import_16x16; - this.scanningToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.scanningToolStripMenuItem.Name = "scanningToolStripMenuItem"; - this.scanningToolStripMenuItem.Size = new System.Drawing.Size(93, 20); - this.scanningToolStripMenuItem.Text = "Scanning..."; - this.scanningToolStripMenuItem.Visible = false; - // - // visibleBooksToolStripMenuItem - // - this.visibleBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.quickFiltersToolStripMenuItem.Name = "quickFiltersToolStripMenuItem"; + this.quickFiltersToolStripMenuItem.Size = new System.Drawing.Size(84, 20); + this.quickFiltersToolStripMenuItem.Text = "Quick &Filters"; + // + // firstFilterIsDefaultToolStripMenuItem + // + this.firstFilterIsDefaultToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.firstFilterIsDefaultToolStripMenuItem.Name = "firstFilterIsDefaultToolStripMenuItem"; + this.firstFilterIsDefaultToolStripMenuItem.Size = new System.Drawing.Size(256, 22); + this.firstFilterIsDefaultToolStripMenuItem.Text = "Start Libation with 1st filter &Default"; + this.firstFilterIsDefaultToolStripMenuItem.Click += new System.EventHandler(this.firstFilterIsDefaultToolStripMenuItem_Click); + // + // editQuickFiltersToolStripMenuItem + // + this.editQuickFiltersToolStripMenuItem.Name = "editQuickFiltersToolStripMenuItem"; + this.editQuickFiltersToolStripMenuItem.Size = new System.Drawing.Size(256, 22); + this.editQuickFiltersToolStripMenuItem.Text = "&Edit quick filters..."; + this.editQuickFiltersToolStripMenuItem.Click += new System.EventHandler(this.editQuickFiltersToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(253, 6); + // + // scanningToolStripMenuItem + // + this.scanningToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; + this.scanningToolStripMenuItem.Enabled = false; + this.scanningToolStripMenuItem.Image = global::LibationWinForms.Properties.Resources.import_16x16; + this.scanningToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.scanningToolStripMenuItem.Name = "scanningToolStripMenuItem"; + this.scanningToolStripMenuItem.Size = new System.Drawing.Size(93, 20); + this.scanningToolStripMenuItem.Text = "Scanning..."; + this.scanningToolStripMenuItem.Visible = false; + // + // visibleBooksToolStripMenuItem + // + this.visibleBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.liberateVisibleToolStripMenuItem, this.replaceTagsToolStripMenuItem, this.setDownloadedToolStripMenuItem, this.removeToolStripMenuItem}); - this.visibleBooksToolStripMenuItem.FormatText = "&Visible Books: {0}"; - this.visibleBooksToolStripMenuItem.Name = "visibleBooksToolStripMenuItem"; - this.visibleBooksToolStripMenuItem.Size = new System.Drawing.Size(108, 20); - this.visibleBooksToolStripMenuItem.Text = "&Visible Books: {0}"; - // - // liberateVisibleToolStripMenuItem - // - this.liberateVisibleToolStripMenuItem.FormatText = "&Liberate: {0}"; - this.liberateVisibleToolStripMenuItem.Name = "liberateVisibleToolStripMenuItem"; - this.liberateVisibleToolStripMenuItem.Size = new System.Drawing.Size(209, 22); - this.liberateVisibleToolStripMenuItem.Text = "&Liberate: {0}"; - this.liberateVisibleToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible); - // - // replaceTagsToolStripMenuItem - // - this.replaceTagsToolStripMenuItem.Name = "replaceTagsToolStripMenuItem"; - this.replaceTagsToolStripMenuItem.Size = new System.Drawing.Size(209, 22); - this.replaceTagsToolStripMenuItem.Text = "Replace &Tags..."; - this.replaceTagsToolStripMenuItem.Click += new System.EventHandler(this.replaceTagsToolStripMenuItem_Click); - // - // setDownloadedToolStripMenuItem - // - this.setDownloadedToolStripMenuItem.Name = "setDownloadedToolStripMenuItem"; - this.setDownloadedToolStripMenuItem.Size = new System.Drawing.Size(209, 22); - this.setDownloadedToolStripMenuItem.Text = "Set \'&Downloaded\' status..."; - this.setDownloadedToolStripMenuItem.Click += new System.EventHandler(this.setDownloadedToolStripMenuItem_Click); - // - // removeToolStripMenuItem - // - this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(209, 22); - this.removeToolStripMenuItem.Text = "&Remove from library..."; - this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); - // - // settingsToolStripMenuItem - // - this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.visibleBooksToolStripMenuItem.FormatText = "&Visible Books: {0}"; + this.visibleBooksToolStripMenuItem.Name = "visibleBooksToolStripMenuItem"; + this.visibleBooksToolStripMenuItem.Size = new System.Drawing.Size(108, 20); + this.visibleBooksToolStripMenuItem.Text = "&Visible Books: {0}"; + // + // liberateVisibleToolStripMenuItem + // + this.liberateVisibleToolStripMenuItem.FormatText = "&Liberate: {0}"; + this.liberateVisibleToolStripMenuItem.Name = "liberateVisibleToolStripMenuItem"; + this.liberateVisibleToolStripMenuItem.Size = new System.Drawing.Size(209, 22); + this.liberateVisibleToolStripMenuItem.Text = "&Liberate: {0}"; + this.liberateVisibleToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible); + // + // replaceTagsToolStripMenuItem + // + this.replaceTagsToolStripMenuItem.Name = "replaceTagsToolStripMenuItem"; + this.replaceTagsToolStripMenuItem.Size = new System.Drawing.Size(209, 22); + this.replaceTagsToolStripMenuItem.Text = "Replace &Tags..."; + this.replaceTagsToolStripMenuItem.Click += new System.EventHandler(this.replaceTagsToolStripMenuItem_Click); + // + // setDownloadedToolStripMenuItem + // + this.setDownloadedToolStripMenuItem.Name = "setDownloadedToolStripMenuItem"; + this.setDownloadedToolStripMenuItem.Size = new System.Drawing.Size(209, 22); + this.setDownloadedToolStripMenuItem.Text = "Set \'&Downloaded\' status..."; + this.setDownloadedToolStripMenuItem.Click += new System.EventHandler(this.setDownloadedToolStripMenuItem_Click); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(209, 22); + this.removeToolStripMenuItem.Text = "&Remove from library..."; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); + // + // settingsToolStripMenuItem + // + this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.accountsToolStripMenuItem, this.basicSettingsToolStripMenuItem, this.toolStripSeparator2, this.aboutToolStripMenuItem}); - this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; - this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); - this.settingsToolStripMenuItem.Text = "&Settings"; - // - // accountsToolStripMenuItem - // - this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem"; - this.accountsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); - this.accountsToolStripMenuItem.Text = "&Accounts..."; - this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click); - // - // basicSettingsToolStripMenuItem - // - this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem"; - this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); - this.basicSettingsToolStripMenuItem.Text = "&Settings..."; - this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(130, 6); - // - // aboutToolStripMenuItem - // - this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(133, 22); - this.aboutToolStripMenuItem.Text = "A&bout..."; - this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); - // - // statusStrip1 - // - this.statusStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; + this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); + this.settingsToolStripMenuItem.Text = "&Settings"; + // + // accountsToolStripMenuItem + // + this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem"; + this.accountsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.accountsToolStripMenuItem.Text = "&Accounts..."; + this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click); + // + // basicSettingsToolStripMenuItem + // + this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem"; + this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.basicSettingsToolStripMenuItem.Text = "&Settings..."; + this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(130, 6); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.aboutToolStripMenuItem.Text = "A&bout..."; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.visibleCountLbl, this.springLbl, this.backupsCountsLbl, this.pdfsCountsLbl}); - this.statusStrip1.Location = new System.Drawing.Point(0, 618); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); - this.statusStrip1.Size = new System.Drawing.Size(893, 22); - this.statusStrip1.TabIndex = 6; - this.statusStrip1.Text = "statusStrip1"; - // - // visibleCountLbl - // - this.visibleCountLbl.FormatText = "Visible: {0}"; - this.visibleCountLbl.Name = "visibleCountLbl"; - this.visibleCountLbl.Size = new System.Drawing.Size(61, 17); - this.visibleCountLbl.Text = "Visible: {0}"; - // - // springLbl - // - this.springLbl.Name = "springLbl"; - this.springLbl.Size = new System.Drawing.Size(379, 17); - this.springLbl.Spring = true; - // - // backupsCountsLbl - // - this.backupsCountsLbl.Name = "backupsCountsLbl"; - this.backupsCountsLbl.Size = new System.Drawing.Size(218, 17); - this.backupsCountsLbl.Text = "[Calculating backed up book quantities]"; - // - // pdfsCountsLbl - // - this.pdfsCountsLbl.FormatText = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}"; - this.pdfsCountsLbl.Name = "pdfsCountsLbl"; - this.pdfsCountsLbl.Size = new System.Drawing.Size(218, 17); - this.pdfsCountsLbl.Text = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}"; - // - // addQuickFilterBtn - // - this.addQuickFilterBtn.Location = new System.Drawing.Point(50, 3); - this.addQuickFilterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.addQuickFilterBtn.Name = "addQuickFilterBtn"; - this.addQuickFilterBtn.Size = new System.Drawing.Size(137, 27); - this.addQuickFilterBtn.TabIndex = 4; - this.addQuickFilterBtn.Text = "Add To Quick Filters"; - this.addQuickFilterBtn.UseVisualStyleBackColor = true; - this.addQuickFilterBtn.Click += new System.EventHandler(this.addQuickFilterBtn_Click); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.panel1); - this.splitContainer1.Panel1.Controls.Add(this.menuStrip1); - this.splitContainer1.Panel1.Controls.Add(this.statusStrip1); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.processBookQueue1); - this.splitContainer1.Size = new System.Drawing.Size(1231, 640); - this.splitContainer1.SplitterDistance = 893; - this.splitContainer1.SplitterWidth = 8; - this.splitContainer1.TabIndex = 7; - // - // panel1 - // - this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.panel1.Controls.Add(this.toggleQueueHideBtn); - this.panel1.Controls.Add(this.gridPanel); - this.panel1.Controls.Add(this.addQuickFilterBtn); - this.panel1.Controls.Add(this.filterHelpBtn); - this.panel1.Controls.Add(this.filterSearchTb); - this.panel1.Controls.Add(this.filterBtn); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 24); - this.panel1.Margin = new System.Windows.Forms.Padding(0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(893, 594); - this.panel1.TabIndex = 7; - // - // toggleQueueHideBtn - // - this.toggleQueueHideBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.toggleQueueHideBtn.Location = new System.Drawing.Point(845, 3); - this.toggleQueueHideBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3); - this.toggleQueueHideBtn.Name = "toggleQueueHideBtn"; - this.toggleQueueHideBtn.Size = new System.Drawing.Size(33, 27); - this.toggleQueueHideBtn.TabIndex = 8; - this.toggleQueueHideBtn.Text = "❱❱❱"; - this.toggleQueueHideBtn.UseVisualStyleBackColor = true; - this.toggleQueueHideBtn.Click += new System.EventHandler(this.ToggleQueueHideBtn_Click); - // - // processBookQueue1 - // - this.processBookQueue1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.processBookQueue1.Dock = System.Windows.Forms.DockStyle.Fill; - this.processBookQueue1.Location = new System.Drawing.Point(0, 0); - this.processBookQueue1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.processBookQueue1.Name = "processBookQueue1"; - this.processBookQueue1.Size = new System.Drawing.Size(330, 640); - this.processBookQueue1.TabIndex = 0; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1231, 640); - this.Controls.Add(this.splitContainer1); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this.menuStrip1; - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.Name = "Form1"; - this.Text = "Libation: Liberate your Library"; - this.Load += new System.EventHandler(this.Form1_Load); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel1.PerformLayout(); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); + this.statusStrip1.Location = new System.Drawing.Point(0, 618); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); + this.statusStrip1.Size = new System.Drawing.Size(893, 22); + this.statusStrip1.TabIndex = 6; + this.statusStrip1.Text = "statusStrip1"; + // + // visibleCountLbl + // + this.visibleCountLbl.FormatText = "Visible: {0}"; + this.visibleCountLbl.Name = "visibleCountLbl"; + this.visibleCountLbl.Size = new System.Drawing.Size(61, 17); + this.visibleCountLbl.Text = "Visible: {0}"; + // + // springLbl + // + this.springLbl.Name = "springLbl"; + this.springLbl.Size = new System.Drawing.Size(379, 17); + this.springLbl.Spring = true; + // + // backupsCountsLbl + // + this.backupsCountsLbl.Name = "backupsCountsLbl"; + this.backupsCountsLbl.Size = new System.Drawing.Size(218, 17); + this.backupsCountsLbl.Text = "[Calculating backed up book quantities]"; + // + // pdfsCountsLbl + // + this.pdfsCountsLbl.FormatText = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}"; + this.pdfsCountsLbl.Name = "pdfsCountsLbl"; + this.pdfsCountsLbl.Size = new System.Drawing.Size(218, 17); + this.pdfsCountsLbl.Text = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}"; + // + // addQuickFilterBtn + // + this.addQuickFilterBtn.Location = new System.Drawing.Point(50, 3); + this.addQuickFilterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.addQuickFilterBtn.Name = "addQuickFilterBtn"; + this.addQuickFilterBtn.Size = new System.Drawing.Size(137, 27); + this.addQuickFilterBtn.TabIndex = 4; + this.addQuickFilterBtn.Text = "Add To Quick Filters"; + this.addQuickFilterBtn.UseVisualStyleBackColor = true; + this.addQuickFilterBtn.Click += new System.EventHandler(this.addQuickFilterBtn_Click); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.panel1); + this.splitContainer1.Panel1.Controls.Add(this.menuStrip1); + this.splitContainer1.Panel1.Controls.Add(this.statusStrip1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.processBookQueue1); + this.splitContainer1.Size = new System.Drawing.Size(1231, 640); + this.splitContainer1.SplitterDistance = 893; + this.splitContainer1.SplitterWidth = 8; + this.splitContainer1.TabIndex = 7; + // + // panel1 + // + this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.panel1.Controls.Add(this.productsDisplay); + this.panel1.Controls.Add(this.toggleQueueHideBtn); + this.panel1.Controls.Add(this.addQuickFilterBtn); + this.panel1.Controls.Add(this.filterHelpBtn); + this.panel1.Controls.Add(this.filterSearchTb); + this.panel1.Controls.Add(this.filterBtn); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 24); + this.panel1.Margin = new System.Windows.Forms.Padding(0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(893, 594); + this.panel1.TabIndex = 7; + // + // productsDisplay + // + this.productsDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.productsDisplay.AutoScroll = true; + this.productsDisplay.Location = new System.Drawing.Point(15, 36); + this.productsDisplay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.productsDisplay.Name = "productsDisplay"; + this.productsDisplay.Size = new System.Drawing.Size(863, 555); + this.productsDisplay.TabIndex = 9; + this.productsDisplay.LiberateClicked += new System.EventHandler(this.ProductsDisplay_LiberateClicked); + this.productsDisplay.VisibleCountChanged += new System.EventHandler(this.productsDisplay_VisibleCountChanged); + this.productsDisplay.InitialLoaded += new System.EventHandler(this.productsDisplay_InitialLoaded); + // + // toggleQueueHideBtn + // + this.toggleQueueHideBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.toggleQueueHideBtn.Location = new System.Drawing.Point(845, 3); + this.toggleQueueHideBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3); + this.toggleQueueHideBtn.Name = "toggleQueueHideBtn"; + this.toggleQueueHideBtn.Size = new System.Drawing.Size(33, 27); + this.toggleQueueHideBtn.TabIndex = 8; + this.toggleQueueHideBtn.Text = "❱❱❱"; + this.toggleQueueHideBtn.UseVisualStyleBackColor = true; + this.toggleQueueHideBtn.Click += new System.EventHandler(this.ToggleQueueHideBtn_Click); + // + // processBookQueue1 + // + this.processBookQueue1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.processBookQueue1.Dock = System.Windows.Forms.DockStyle.Fill; + this.processBookQueue1.Location = new System.Drawing.Point(0, 0); + this.processBookQueue1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.processBookQueue1.Name = "processBookQueue1"; + this.processBookQueue1.Size = new System.Drawing.Size(330, 640); + this.processBookQueue1.TabIndex = 0; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1231, 640); + this.Controls.Add(this.splitContainer1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip1; + this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.Name = "Form1"; + this.Text = "Libation: Liberate your Library"; + this.Load += new System.EventHandler(this.Form1_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); } #endregion - - private System.Windows.Forms.Panel gridPanel; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; private System.Windows.Forms.StatusStrip statusStrip1; @@ -581,5 +583,6 @@ private LibationWinForms.ProcessQueue.ProcessQueueControl processBookQueue1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button toggleQueueHideBtn; + private ProductsDisplay productsDisplay; } } diff --git a/Source/LibationWinForms/Form1.Filter.cs b/Source/LibationWinForms/Form1.Filter.cs index 03e89f9d..2a175e74 100644 --- a/Source/LibationWinForms/Form1.Filter.cs +++ b/Source/LibationWinForms/Form1.Filter.cs @@ -30,7 +30,7 @@ namespace LibationWinForms try { - productsGrid.Filter(filterString); + productsDisplay.Filter(filterString); lastGoodFilter = filterString; } catch (Exception ex) diff --git a/Source/LibationWinForms/Form1.ProcessQueue.cs b/Source/LibationWinForms/Form1.ProcessQueue.cs index 74d30406..8a8178f2 100644 --- a/Source/LibationWinForms/Form1.ProcessQueue.cs +++ b/Source/LibationWinForms/Form1.ProcessQueue.cs @@ -14,14 +14,13 @@ namespace LibationWinForms int WidthChange = 0; private void Configure_ProcessQueue() { - productsGrid.LiberateClicked += ProductsGrid_LiberateClicked; processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut; var coppalseState = Configuration.Instance.GetNonString(nameof(splitContainer1.Panel2Collapsed)); WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth; SetQueueCollapseState(coppalseState); } - private void ProductsGrid_LiberateClicked(object sender, LibraryBook e) + private void ProductsDisplay_LiberateClicked(object sender, LibraryBook e) { if (e.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated) { diff --git a/Source/LibationWinForms/Form1.QuickFilters.cs b/Source/LibationWinForms/Form1.QuickFilters.cs index 8804f083..3908290b 100644 --- a/Source/LibationWinForms/Form1.QuickFilters.cs +++ b/Source/LibationWinForms/Form1.QuickFilters.cs @@ -14,12 +14,6 @@ namespace LibationWinForms Load += updateFiltersMenu; QuickFilters.UseDefaultChanged += updateFirstFilterIsDefaultToolStripMenuItem; QuickFilters.Updated += updateFiltersMenu; - - productsGrid.InitialLoaded += (_, __) => - { - if (QuickFilters.UseDefault) - performFilter(QuickFilters.Filters.FirstOrDefault()); - }; } private object quickFilterTag { get; } = new(); @@ -56,5 +50,11 @@ namespace LibationWinForms private void addQuickFilterBtn_Click(object sender, EventArgs e) => QuickFilters.Add(this.filterSearchTb.Text); private void editQuickFiltersToolStripMenuItem_Click(object sender, EventArgs e) => new EditQuickFilters().ShowDialog(); + + private void productsDisplay_InitialLoaded(object sender, EventArgs e) + { + if (QuickFilters.UseDefault) + performFilter(QuickFilters.Filters.FirstOrDefault()); + } } } diff --git a/Source/LibationWinForms/Form1.VisibleBooks.cs b/Source/LibationWinForms/Form1.VisibleBooks.cs index 65dfecca..a17effa7 100644 --- a/Source/LibationWinForms/Form1.VisibleBooks.cs +++ b/Source/LibationWinForms/Form1.VisibleBooks.cs @@ -17,28 +17,16 @@ namespace LibationWinForms liberateVisibleToolStripMenuItem.Format(0); liberateVisible2ToolStripMenuItem.Format(0); - // bottom-left visible count - productsGrid.VisibleCountChanged += (_, qty) => visibleCountLbl.Format(qty); - // top menu strip visibleBooksToolStripMenuItem.Format(0); - productsGrid.VisibleCountChanged += (_, qty) => { - visibleBooksToolStripMenuItem.Format(qty); - visibleBooksToolStripMenuItem.Enabled = qty > 0; - var notLiberatedCount = productsGrid.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated); - }; - - productsGrid.VisibleCountChanged += setLiberatedVisibleMenuItemAsync; LibraryCommands.BookUserDefinedItemCommitted += setLiberatedVisibleMenuItemAsync; } - private async void setLiberatedVisibleMenuItemAsync(object _, int __) - => await Task.Run(setLiberatedVisibleMenuItem); private async void setLiberatedVisibleMenuItemAsync(object _, EventArgs __) => await Task.Run(setLiberatedVisibleMenuItem); void setLiberatedVisibleMenuItem() { - var notLiberated = productsGrid.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated); + var notLiberated = productsDisplay.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated); this.UIThreadSync(() => { if (notLiberated > 0) @@ -63,7 +51,7 @@ namespace LibationWinForms private async void liberateVisible(object sender, EventArgs e) { SetQueueCollapseState(false); - await Task.Run(() => processBookQueue1.AddDownloadDecrypt(productsGrid.GetVisible())); + await Task.Run(() => processBookQueue1.AddDownloadDecrypt(productsDisplay.GetVisible())); } private void replaceTagsToolStripMenuItem_Click(object sender, EventArgs e) @@ -73,7 +61,7 @@ namespace LibationWinForms if (result != DialogResult.OK) return; - var visibleLibraryBooks = productsGrid.GetVisible(); + var visibleLibraryBooks = productsDisplay.GetVisible(); var confirmationResult = MessageBoxLib.ShowConfirmationDialog( visibleLibraryBooks, @@ -95,7 +83,7 @@ namespace LibationWinForms if (result != DialogResult.OK) return; - var visibleLibraryBooks = productsGrid.GetVisible(); + var visibleLibraryBooks = productsDisplay.GetVisible(); var confirmationResult = MessageBoxLib.ShowConfirmationDialog( visibleLibraryBooks, @@ -112,7 +100,7 @@ namespace LibationWinForms private async void removeToolStripMenuItem_Click(object sender, EventArgs e) { - var visibleLibraryBooks = productsGrid.GetVisible(); + var visibleLibraryBooks = productsDisplay.GetVisible(); var confirmationResult = MessageBoxLib.ShowConfirmationDialog( visibleLibraryBooks, @@ -125,5 +113,20 @@ namespace LibationWinForms var visibleIds = visibleLibraryBooks.Select(lb => lb.Book.AudibleProductId).ToList(); await LibraryCommands.RemoveBooksAsync(visibleIds); } + + private async void productsDisplay_VisibleCountChanged(object sender, int qty) + { + // bottom-left visible count + visibleCountLbl.Format(qty); + + // top menu strip + visibleBooksToolStripMenuItem.Format(qty); + visibleBooksToolStripMenuItem.Enabled = qty > 0; + + //Not used for anything? + var notLiberatedCount = productsDisplay.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated); + + await Task.Run(setLiberatedVisibleMenuItem); + } } } diff --git a/Source/LibationWinForms/Form1.cs b/Source/LibationWinForms/Form1.cs index 0c2f3ce1..43151f73 100644 --- a/Source/LibationWinForms/Form1.cs +++ b/Source/LibationWinForms/Form1.cs @@ -12,24 +12,10 @@ namespace LibationWinForms { public partial class Form1 : Form { - private ProductsDisplay productsGrid { get; } - public Form1() { InitializeComponent(); - if (this.DesignMode) - return; - - { - // I'd actually like these lines to be handled in the designer, but I'm currently getting this error when I try: - // Failed to create component 'ProductsGrid'. The error message follows: - // 'Microsoft.DotNet.DesignTools.Client.DesignToolsServerException: Object reference not set to an instance of an object. - // Since the designer's choking on it, I'm keeping it below the DesignMode check to be safe - productsGrid = new ProductsDisplay { Dock = DockStyle.Fill }; - gridPanel.Controls.Add(productsGrid); - } - // Pre-requisite: // Before calling anything else, including subscribing to events, ensure database exists. If we wait and let it happen lazily, race conditions and errors are likely during new installs using var _ = DbContexts.GetContext(); @@ -67,8 +53,8 @@ namespace LibationWinForms // Configure_Grid(); // since it's just this, can keep here. If it needs more, then give grid it's own 'partial class Form1' { - this.Load += (_, __) => productsGrid.Display(); - LibraryCommands.LibrarySizeChanged += (_, __) => this.UIThreadAsync(() => productsGrid.Display()); + this.Load += (_, __) => productsDisplay.Display(); + LibraryCommands.LibrarySizeChanged += (_, __) => this.UIThreadAsync(() => productsDisplay.Display()); } } diff --git a/Source/LibationWinForms/LibationWinForms.csproj b/Source/LibationWinForms/LibationWinForms.csproj index 979db0ff..2ecd019b 100644 --- a/Source/LibationWinForms/LibationWinForms.csproj +++ b/Source/LibationWinForms/LibationWinForms.csproj @@ -45,9 +45,6 @@ - - UserControl - True True @@ -56,9 +53,6 @@ - - Designer - ResXFileCodeGenerator Resources.Designer.cs diff --git a/Source/LibationWinForms/grid/EditTagsDataGridViewImageButtonColumn.cs b/Source/LibationWinForms/grid/EditTagsDataGridViewImageButtonColumn.cs index 1349325a..db8bb484 100644 --- a/Source/LibationWinForms/grid/EditTagsDataGridViewImageButtonColumn.cs +++ b/Source/LibationWinForms/grid/EditTagsDataGridViewImageButtonColumn.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using Dinah.Core.Windows.Forms; +using System.Drawing; using System.Windows.Forms; namespace LibationWinForms @@ -18,6 +19,12 @@ namespace LibationWinForms protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { + if (rowIndex >= 0 && DataGridView.GetBoundItem(rowIndex) is SeriesEntry) + { + base.Paint(graphics, clipBounds, cellBounds, rowIndex, DataGridViewElementStates.None, null, null, null, cellStyle, advancedBorderStyle, DataGridViewPaintParts.Background | DataGridViewPaintParts.Border); + return; + } + var tagsString = (string)value; var foreColor = tagsString?.Contains("hidden") == true ? HiddenForeColor : DataGridView.DefaultCellStyle.ForeColor; diff --git a/Source/LibationWinForms/grid/FilterableSortableBindingList.cs b/Source/LibationWinForms/grid/FilterableSortableBindingList.cs index e3bcaad0..e309f7fe 100644 --- a/Source/LibationWinForms/grid/FilterableSortableBindingList.cs +++ b/Source/LibationWinForms/grid/FilterableSortableBindingList.cs @@ -8,17 +8,17 @@ using System.Linq; namespace LibationWinForms { /* - * Allows filtering of the underlying SortableBindingList - * by implementing IBindingListView and using SearchEngineCommands - * - * When filtering is applied, the filtered-out items are removed - * from the base list and added to the private FilterRemoved list. - * When filtering is removed, items in the FilterRemoved list are - * added back to the base list. - * - * Remove is overridden to ensure that removed items are removed from - * the base list (visible items) as well as the FilterRemoved list. - */ + * Allows filtering of the underlying SortableBindingList + * by implementing IBindingListView and using SearchEngineCommands + * + * When filtering is applied, the filtered-out items are removed + * from the base list and added to the private FilterRemoved list. + * When filtering is removed, items in the FilterRemoved list are + * added back to the base list. + * + * Remove is overridden to ensure that removed items are removed from + * the base list (visible items) as well as the FilterRemoved list. + */ internal class FilterableSortableBindingList : SortableBindingList1, IBindingListView { /// @@ -50,14 +50,7 @@ namespace LibationWinForms } /// All items in the list, including those filtered out. - public List AllItems() - { - var allItems = Items.Concat(FilterRemoved); - - var series = allItems.Where(i => i is SeriesEntry).Cast().SelectMany(s => s.Children); - - return series.Concat(allItems).ToList(); - } + public List AllItems() => Items.Concat(FilterRemoved).ToList(); private void ApplyFilter(string filterString) { @@ -65,32 +58,41 @@ namespace LibationWinForms RemoveFilter(); FilterString = filterString; - SearchResults = SearchEngineCommands.Search(filterString); - var filteredOut = Items.Where(i => i is LibraryBookEntry).Cast().ExceptBy(SearchResults.Docs.Select(d => d.ProductId), ge => ge.AudibleProductId).Cast().ToList(); - var parents = Items.Where(i => i is SeriesEntry).Cast(); + var booksFilteredIn = Items.LibraryBooks().Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => (GridEntry)lbe); - foreach (var p in parents) + //Find all series containing children that match the search criteria + var seriesFilteredIn = Items.Series().Where(s => s.Children.Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => lbe).Any()); + + var filteredOut = Items.Except(booksFilteredIn.Concat(seriesFilteredIn)).ToList(); + + foreach (var item in filteredOut) { - if (p.Children.Cast().ExceptBy(SearchResults.Docs.Select(d => d.ProductId), ge => ge.AudibleProductId).Count() == p.Children.Count) - { - //Don't show series whose episodes have all been filtered out - filteredOut.Add(p); - } + FilterRemoved.Add(item); + base.Remove(item); } + } - for (int i = 0; i < filteredOut.Count; i++) - { - FilterRemoved.Add(filteredOut[i]); - base.Remove(filteredOut[i]); - } + public void CollapseAll() + { + foreach (var series in Items.Series().ToList()) + CollapseItem(series); + } + + public void ExpandAll() + { + foreach (var series in Items.Series().ToList()) + ExpandItem(series); } public void CollapseItem(SeriesEntry sEntry) { - foreach (var item in Items.Where(b => b is LibraryBookEntry).Cast().Where(b => b.Parent == sEntry).ToList()) - base.Remove(item); + foreach (var episode in Items.Where(b => b.Parent == sEntry).Cast().ToList()) + { + FilterRemoved.Add(episode); + base.Remove(episode); + } sEntry.Liberate.Expanded = false; } @@ -98,16 +100,17 @@ namespace LibationWinForms public void ExpandItem(SeriesEntry sEntry) { var sindex = Items.IndexOf(sEntry); - var children = sEntry.Children.Cast().ToList(); - for (int i = 0; i < children.Count; i++) + + foreach (var episode in FilterRemoved.Where(b => b.Parent == sEntry).Cast().ToList()) { - if (SearchResults is null || SearchResults.Docs.Any(d=> d.ProductId == children[i].AudibleProductId)) - Insert(++sindex, children[i]); - else + if (SearchResults is null || SearchResults.Docs.Any(d => d.ProductId == episode.AudibleProductId)) { - FilterRemoved.Add(children[i]); + FilterRemoved.Remove(episode); + Items.Insert(++sindex, episode); } } + + OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); sEntry.Liberate.Expanded = true; } @@ -116,13 +119,15 @@ namespace LibationWinForms if (FilterString is null) return; int visibleCount = Items.Count; - for (int i = 0; i < FilterRemoved.Count; i++) - { - if (FilterRemoved[i].Parent is null || FilterRemoved[i].Parent.Liberate.Expanded) - base.InsertItem(i + visibleCount, FilterRemoved[i]); - } - FilterRemoved.Clear(); + foreach (var item in FilterRemoved.ToList()) + { + if (item.Parent is null || item.Parent.Liberate.Expanded) + { + FilterRemoved.Remove(item); + base.InsertItem(visibleCount++, item); + } + } if (IsSortedCore) Sort(); diff --git a/Source/LibationWinForms/grid/GridEntry.cs b/Source/LibationWinForms/grid/GridEntry.cs index a9d86b41..e0f19c1c 100644 --- a/Source/LibationWinForms/grid/GridEntry.cs +++ b/Source/LibationWinForms/grid/GridEntry.cs @@ -5,25 +5,37 @@ using LibationFileManager; using System; using System.Collections; using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; +using System.ComponentModel;using System.Drawing; +using System.Linq; namespace LibationWinForms { public interface IHierarchical where T : class { T Parent { get; } - List Children { get; } } - internal class LiberateStatus + + public class LiberateStatus : IComparable { public LiberatedStatus BookStatus; public LiberatedStatus? PdfStatus; public bool IsSeries; public bool Expanded; + + public int CompareTo(object obj) + { + if (obj is not LiberateStatus second) return -1; + + if (IsSeries && !second.IsSeries) return -1; + else if (!IsSeries && second.IsSeries) return 1; + else if (IsSeries && second.IsSeries) return 0; + else if (BookStatus == LiberatedStatus.Liberated && second.BookStatus != LiberatedStatus.Liberated) return -1; + else if (BookStatus != LiberatedStatus.Liberated && second.BookStatus == LiberatedStatus.Liberated) return 1; + else return BookStatus.CompareTo(second.BookStatus); + } } - internal abstract class GridEntry : AsyncNotifyPropertyChanged, IMemberComparable, IHierarchical + public abstract class GridEntry : AsyncNotifyPropertyChanged, IMemberComparable, IHierarchical { protected abstract Book Book { get; } @@ -38,11 +50,15 @@ namespace LibationWinForms NotifyPropertyChanged(); } } + + [Browsable(false)] + public new bool InvokeRequired => base.InvokeRequired; + [Browsable(false)] public GridEntry Parent { get; set; } - public List Children { get; set; } + [Browsable(false)] + public abstract DateTime DateAdded { get; } public abstract string ProductRating { get; protected set; } public abstract string PurchaseDate { get; protected set; } - public abstract DateTime DateAdded { get; } public abstract string MyRating { get; protected set; } public abstract string Series { get; protected set; } public abstract string Title { get; protected set; } @@ -89,12 +105,20 @@ namespace LibationWinForms { typeof(float), new ObjectComparer() }, { typeof(bool), new ObjectComparer() }, { typeof(DateTime), new ObjectComparer() }, - { typeof(LiberatedStatus), new ObjectComparer() }, + { typeof(LiberateStatus), new ObjectComparer() }, }; ~GridEntry() { PictureStorage.PictureCached -= PictureStorage_PictureCached; - } + } + } + + internal static class GridEntryExtensions + { + public static IEnumerable Series(this IEnumerable gridEntries) + => gridEntries.Where(i => i is SeriesEntry).Cast(); + public static IEnumerable LibraryBooks(this IEnumerable gridEntries) + => gridEntries.Where(i => i is LibraryBookEntry).Cast(); } } diff --git a/Source/LibationWinForms/grid/LibraryBookEntry.cs b/Source/LibationWinForms/grid/LibraryBookEntry.cs index e87ae630..c1be718c 100644 --- a/Source/LibationWinForms/grid/LibraryBookEntry.cs +++ b/Source/LibationWinForms/grid/LibraryBookEntry.cs @@ -17,7 +17,7 @@ namespace LibationWinForms /// /// The View Model for a LibraryBook /// - internal class LibraryBookEntry : GridEntry + public class LibraryBookEntry : GridEntry { #region implementation properties NOT exposed to the view // hide from public fields from Data Source GUI with [Browsable(false)] @@ -187,7 +187,7 @@ namespace LibationWinForms { nameof(Category), () => Category }, { nameof(Misc), () => Misc }, { nameof(DisplayTags), () => DisplayTags }, - { nameof(Liberate), () => Liberate.BookStatus }, + { nameof(Liberate), () => Liberate }, { nameof(DateAdded), () => DateAdded }, }; diff --git a/Source/LibationWinForms/grid/MasterDataGridView.cs b/Source/LibationWinForms/grid/MasterDataGridView.cs deleted file mode 100644 index fd3b481a..00000000 --- a/Source/LibationWinForms/grid/MasterDataGridView.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Dinah.Core.Windows.Forms; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace LibationWinForms -{ - - internal class MasterDataGridView : DataGridView - { - internal delegate void LibraryBookEntryClickedEventHandler(DataGridViewCellEventArgs e, LibraryBookEntry entry); - public event LibraryBookEntryClickedEventHandler LibraryBookEntryClicked; - public MasterDataGridView() - { - - } - - - public GridEntry getGridEntry(int rowIndex) => this.GetBoundItem(rowIndex); - - } -} diff --git a/Source/LibationWinForms/grid/ProductsDisplay.Designer.cs b/Source/LibationWinForms/grid/ProductsDisplay.Designer.cs index d15ad85c..a10e1c95 100644 --- a/Source/LibationWinForms/grid/ProductsDisplay.Designer.cs +++ b/Source/LibationWinForms/grid/ProductsDisplay.Designer.cs @@ -28,19 +28,38 @@ /// private void InitializeComponent() { + this.productsGrid = new LibationWinForms.grid.ProductsGrid(); this.SuspendLayout(); // + // productsGrid + // + this.productsGrid.AutoScroll = true; + this.productsGrid.Dock = System.Windows.Forms.DockStyle.Fill; + this.productsGrid.Location = new System.Drawing.Point(0, 0); + this.productsGrid.Name = "productsGrid"; + this.productsGrid.Size = new System.Drawing.Size(1510, 380); + this.productsGrid.TabIndex = 0; + this.productsGrid.LiberateClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryClickedEventHandler(this.productsGrid_LiberateClicked); + this.productsGrid.CoverClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryClickedEventHandler(this.productsGrid_CoverClicked); + this.productsGrid.DetailsClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryClickedEventHandler(this.productsGrid_DetailsClicked); + this.productsGrid.DescriptionClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryRectangleClickedEventHandler(this.productsGrid_DescriptionClicked); + this.productsGrid.VisibleCountChanged += new System.EventHandler(this.productsGrid_VisibleCountChanged); + // // ProductsDisplay // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.productsGrid); this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Name = "ProductsDisplay"; this.Size = new System.Drawing.Size(1510, 380); + this.Load += new System.EventHandler(this.ProductsDisplay_Load); this.ResumeLayout(false); } #endregion + + private grid.ProductsGrid productsGrid; } } diff --git a/Source/LibationWinForms/grid/ProductsDisplay.cs b/Source/LibationWinForms/grid/ProductsDisplay.cs index e0e0fd58..0a9bee61 100644 --- a/Source/LibationWinForms/grid/ProductsDisplay.cs +++ b/Source/LibationWinForms/grid/ProductsDisplay.cs @@ -6,65 +6,35 @@ using System.Threading.Tasks; using System.Windows.Forms; using ApplicationServices; using DataLayer; -using Dinah.Core.Windows.Forms; using FileLiberator; using LibationFileManager; using LibationWinForms.Dialogs; namespace LibationWinForms { - - #region // legacy instructions to update data_grid_view - // INSTRUCTIONS TO UPDATE DATA_GRID_VIEW - // - delete current DataGridView - // - view > other windows > data sources - // - refresh - // OR - // - Add New Data Source - // Object. Next - // LibationWinForms - // AudibleDTO - // GridEntry - // - go to Design view - // - click on Data Sources > ProductItem. dropdown: DataGridView - // - drag/drop ProductItem on design surface - // - // as of august 2021 this does not work in vs2019 with .net5 projects - // VS has improved since then with .net6+ but I haven't checked again - #endregion - - public partial class ProductsDisplay : UserControl { public event EventHandler LiberateClicked; /// Number of visible rows has changed public event EventHandler VisibleCountChanged; - // alias - - private ProductsGrid grid; - public ProductsDisplay() { InitializeComponent(); + } - grid = new ProductsGrid(); - grid.Dock = DockStyle.Fill; - Controls.Add(grid); - - if (this.DesignMode) + private void ProductsDisplay_Load(object sender, EventArgs e) + { + if (DesignMode) return; - grid.LiberateClicked += (_, book) => LiberateClicked?.Invoke(this, book.LibraryBook); - grid.DetailsClicked += Grid_DetailsClicked; - grid.CoverClicked += Grid_CoverClicked; - grid.DescriptionClicked += Grid_DescriptionClicked1; } + #region Button controls private ImageDisplay imageDisplay; - private async void Grid_CoverClicked(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry) + private async void productsGrid_CoverClicked(LibraryBookEntry liveGridEntry) { var picDefinition = new PictureDefinition(liveGridEntry.LibraryBook.Book.PictureLarge ?? liveGridEntry.LibraryBook.Book.PictureId, PictureSize.Native); var picDlTask = Task.Run(() => PictureStorage.GetPictureSynchronously(picDefinition)); @@ -87,7 +57,7 @@ namespace LibationWinForms imageDisplay.CoverPicture = await picDlTask; } - private void Grid_DescriptionClicked1(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry, Rectangle cellRectangle) + private void productsGrid_DescriptionClicked(LibraryBookEntry liveGridEntry, Rectangle cellRectangle) { var displayWindow = new DescriptionDisplay { @@ -101,13 +71,13 @@ namespace LibationWinForms displayWindow.Close(); } - grid.Scroll += CloseWindow; - displayWindow.FormClosed += (_, _) => grid.Scroll -= CloseWindow; + productsGrid.Scroll += CloseWindow; + displayWindow.FormClosed += (_, _) => productsGrid.Scroll -= CloseWindow; displayWindow.Show(this); } - private void Grid_DetailsClicked(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry) + private void productsGrid_DetailsClicked(LibraryBookEntry liveGridEntry) { var bookDetailsForm = new BookDetailsDialog(liveGridEntry.LibraryBook); if (bookDetailsForm.ShowDialog() == DialogResult.OK) @@ -128,13 +98,12 @@ namespace LibationWinForms if (!hasBeenDisplayed) { // bind - grid.bindToGrid(lib); + productsGrid.BindToGrid(lib); hasBeenDisplayed = true; InitialLoaded?.Invoke(this, new()); - VisibleCountChanged?.Invoke(this, grid.GetVisible().Count()); } else - grid.updateGrid(lib); + productsGrid.UpdateGrid(lib); } @@ -143,10 +112,20 @@ namespace LibationWinForms #region Filter public void Filter(string searchString) - => grid.Filter(searchString); + => productsGrid.Filter(searchString); #endregion - internal List GetVisible() => grid.GetVisible().ToList(); + internal List GetVisible() => productsGrid.GetVisible().Select(v => v.LibraryBook).ToList(); + + private void productsGrid_VisibleCountChanged(object sender, int count) + { + VisibleCountChanged?.Invoke(this, count); + } + + private void productsGrid_LiberateClicked(LibraryBookEntry liveGridEntry) + { + LiberateClicked?.Invoke(this, liveGridEntry.LibraryBook); + } } } diff --git a/Source/LibationWinForms/grid/ProductsGrid.Designer.cs b/Source/LibationWinForms/grid/ProductsGrid.Designer.cs index 27496d79..e818ed5b 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.Designer.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.Designer.cs @@ -1,4 +1,4 @@ -namespace LibationWinForms +namespace LibationWinForms.grid { partial class ProductsGrid { @@ -30,7 +30,6 @@ { this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - this.gridEntryBindingSource = new LibationWinForms.SyncBindingSource(this.components); this.gridEntryDataGridView = new System.Windows.Forms.DataGridView(); this.liberateGVColumn = new LibationWinForms.LiberateDataGridViewImageButtonColumn(); this.coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn(); @@ -47,39 +46,32 @@ this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tagAndDetailsGVColumn = new LibationWinForms.EditTagsDataGridViewImageButtonColumn(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - ((System.ComponentModel.ISupportInitialize)(this.gridEntryBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit(); this.SuspendLayout(); // - // gridEntryBindingSource - // - this.gridEntryBindingSource.DataSource = typeof(LibationWinForms.GridEntry); - // // gridEntryDataGridView // this.gridEntryDataGridView.AllowUserToAddRows = false; this.gridEntryDataGridView.AllowUserToDeleteRows = false; this.gridEntryDataGridView.AllowUserToOrderColumns = true; this.gridEntryDataGridView.AllowUserToResizeRows = false; - this.gridEntryDataGridView.AutoGenerateColumns = false; this.gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.liberateGVColumn, - this.coverGVColumn, - this.titleGVColumn, - this.authorsGVColumn, - this.narratorsGVColumn, - this.lengthGVColumn, - this.seriesGVColumn, - this.descriptionGVColumn, - this.categoryGVColumn, - this.productRatingGVColumn, - this.purchaseDateGVColumn, - this.myRatingGVColumn, - this.miscGVColumn, - this.tagAndDetailsGVColumn}); + this.liberateGVColumn, + this.coverGVColumn, + this.titleGVColumn, + this.authorsGVColumn, + this.narratorsGVColumn, + this.lengthGVColumn, + this.seriesGVColumn, + this.descriptionGVColumn, + this.categoryGVColumn, + this.productRatingGVColumn, + this.purchaseDateGVColumn, + this.myRatingGVColumn, + this.miscGVColumn, + this.tagAndDetailsGVColumn}); this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1; - this.gridEntryDataGridView.DataSource = this.gridEntryBindingSource; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); @@ -90,16 +82,15 @@ this.gridEntryDataGridView.DefaultCellStyle = dataGridViewCellStyle1; this.gridEntryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; this.gridEntryDataGridView.Location = new System.Drawing.Point(0, 0); - this.gridEntryDataGridView.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.gridEntryDataGridView.Name = "gridEntryDataGridView"; this.gridEntryDataGridView.ReadOnly = true; this.gridEntryDataGridView.RowHeadersVisible = false; this.gridEntryDataGridView.RowTemplate.Height = 82; this.gridEntryDataGridView.Size = new System.Drawing.Size(1510, 380); this.gridEntryDataGridView.TabIndex = 0; + this.gridEntryDataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellContentClick); this.gridEntryDataGridView.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this.gridEntryDataGridView_CellToolTipTextNeeded); this.gridEntryDataGridView.ColumnDisplayIndexChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnDisplayIndexChanged); - this.gridEntryDataGridView.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnWidthChanged); // // liberateGVColumn // @@ -222,19 +213,18 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScroll = true; this.Controls.Add(this.gridEntryDataGridView); - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Name = "ProductsGrid"; this.Size = new System.Drawing.Size(1510, 380); - ((System.ComponentModel.ISupportInitialize)(this.gridEntryBindingSource)).EndInit(); + this.Load += new System.EventHandler(this.ProductsGrid_Load); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit(); this.ResumeLayout(false); } - #endregion - private LibationWinForms.SyncBindingSource gridEntryBindingSource; + #endregion private System.Windows.Forms.DataGridView gridEntryDataGridView; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private LiberateDataGridViewImageButtonColumn liberateGVColumn; diff --git a/Source/LibationWinForms/grid/ProductsGrid.cs b/Source/LibationWinForms/grid/ProductsGrid.cs index 2d585f27..b119285d 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.cs @@ -1,103 +1,70 @@ -using System; +using DataLayer; +using Dinah.Core.Windows.Forms; +using LibationFileManager; +using System; using System.Collections.Generic; +using System.Data; using System.Drawing; using System.Linq; using System.Windows.Forms; -using ApplicationServices; -using DataLayer; -using Dinah.Core.Windows.Forms; -using LibationFileManager; -namespace LibationWinForms +namespace LibationWinForms.grid { - - #region // legacy instructions to update data_grid_view - // INSTRUCTIONS TO UPDATE DATA_GRID_VIEW - // - delete current DataGridView - // - view > other windows > data sources - // - refresh - // OR - // - Add New Data Source - // Object. Next - // LibationWinForms - // AudibleDTO - // GridEntry - // - go to Design view - // - click on Data Sources > ProductItem. dropdown: DataGridView - // - drag/drop ProductItem on design surface - // - // as of august 2021 this does not work in vs2019 with .net5 projects - // VS has improved since then with .net6+ but I haven't checked again - #endregion - - public partial class ProductsGrid : UserControl { - - internal delegate void LibraryBookEntryClickedEventHandler(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry); - internal delegate void LibraryBookEntryRectangleClickedEventHandler(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry, Rectangle cellRectangle); - internal event LibraryBookEntryClickedEventHandler LiberateClicked; - internal event LibraryBookEntryClickedEventHandler CoverClicked; - internal event LibraryBookEntryClickedEventHandler DetailsClicked; - internal event LibraryBookEntryRectangleClickedEventHandler DescriptionClicked; - public new event EventHandler Scroll; - - private FilterableSortableBindingList bindingList; + public delegate void LibraryBookEntryClickedEventHandler(LibraryBookEntry liveGridEntry); + public delegate void LibraryBookEntryRectangleClickedEventHandler(LibraryBookEntry liveGridEntry, Rectangle cellRectangle); /// Number of visible rows has changed public event EventHandler VisibleCountChanged; + public event LibraryBookEntryClickedEventHandler LiberateClicked; + public event LibraryBookEntryClickedEventHandler CoverClicked; + public event LibraryBookEntryClickedEventHandler DetailsClicked; + public event LibraryBookEntryRectangleClickedEventHandler DescriptionClicked; + public new event EventHandler Scroll; - // alias - private DataGridView _dataGridView => gridEntryDataGridView; + private FilterableSortableBindingList bindingList; + private SyncBindingSource gridEntryBindingSource; public ProductsGrid() { InitializeComponent(); - - if (this.DesignMode) - return; - EnableDoubleBuffering(); - - _dataGridView.CellContentClick += DataGridView_CellContentClick; - _dataGridView.Scroll += (_, s) => Scroll?.Invoke(this, s); - - Load += ProductsGrid_Load; - } - - private void ProductsGrid_Scroll(object sender, ScrollEventArgs e) - { - throw new NotImplementedException(); + //There a bug in designer that causes errors if you add BindingSource to the DataGridView at design time. + gridEntryBindingSource = new SyncBindingSource(); + gridEntryDataGridView.DataSource = gridEntryBindingSource; + gridEntryDataGridView.Scroll += (_, s) => Scroll?.Invoke(this, s); } private void EnableDoubleBuffering() { - var propertyInfo = _dataGridView.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); + var propertyInfo = gridEntryDataGridView.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); - propertyInfo.SetValue(_dataGridView, true, null); + propertyInfo.SetValue(gridEntryDataGridView, true, null); } #region Button controls - private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { // handle grid button click: https://stackoverflow.com/a/13687844 - if (e.RowIndex < 0) + if ( e.RowIndex < 0) return; + var column = gridEntryDataGridView.Columns[e.ColumnIndex]; + var entry = getGridEntry(e.RowIndex); if (entry is LibraryBookEntry lbEntry) { - if (e.ColumnIndex == liberateGVColumn.Index) - LiberateClicked?.Invoke(e, lbEntry); - else if (e.ColumnIndex == tagAndDetailsGVColumn.Index && entry is LibraryBookEntry) - DetailsClicked?.Invoke(e, lbEntry); - else if (e.ColumnIndex == descriptionGVColumn.Index) - DescriptionClicked?.Invoke(e, lbEntry, _dataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false)); - else if (e.ColumnIndex == coverGVColumn.Index) - CoverClicked?.Invoke(e, lbEntry); + if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == liberateGVColumn.DataPropertyName) + LiberateClicked?.Invoke(lbEntry); + else if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == tagAndDetailsGVColumn.DataPropertyName && entry is LibraryBookEntry) + DetailsClicked?.Invoke(lbEntry); + else if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == descriptionGVColumn.DataPropertyName) + DescriptionClicked?.Invoke(lbEntry, gridEntryDataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false)); + else if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == coverGVColumn.DataPropertyName) + CoverClicked?.Invoke(lbEntry); } - else if (entry is SeriesEntry sEntry && e.ColumnIndex == liberateGVColumn.Index) + else if (entry is SeriesEntry sEntry && gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == liberateGVColumn.DataPropertyName) { if (sEntry.Liberate.Expanded) bindingList.CollapseItem(sEntry); @@ -105,16 +72,19 @@ namespace LibationWinForms bindingList.ExpandItem(sEntry); sEntry.NotifyPropertyChanged(nameof(sEntry.Liberate)); + + VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count()); } } - private GridEntry getGridEntry(int rowIndex) => _dataGridView.GetBoundItem(rowIndex); + private GridEntry getGridEntry(int rowIndex) => gridEntryDataGridView.GetBoundItem(rowIndex); #endregion + #region UI display functions - internal void bindToGrid(List dbBooks) + internal void BindToGrid(List dbBooks) { var geList = dbBooks.Where(b => b.Book.ContentType is not ContentType.Episode).Select(b => new LibraryBookEntry(b)).Cast().ToList(); @@ -125,24 +95,28 @@ namespace LibationWinForms foreach (var s in series) { var seriesEntry = new SeriesEntry(); - seriesEntry.Children = episodes.Where(lb => lb.Book.SeriesLink.First().Series == s.Book.SeriesLink.First().Series).Select(lb => new LibraryBookEntry(lb) { Parent = seriesEntry }).Cast().ToList(); + seriesEntry.Children = episodes.Where(lb => lb.Book.SeriesLink.First().Series == s.Book.SeriesLink.First().Series).Select(lb => new LibraryBookEntry(lb) { Parent = seriesEntry }).ToList(); seriesEntry.setSeriesBook(s); + geList.Add(seriesEntry); + geList.AddRange(seriesEntry.Children); } - bindingList = new FilterableSortableBindingList(geList.OrderByDescending(ge => ge.DateAdded)); + bindingList = new FilterableSortableBindingList(geList.OrderByDescending(e => e.DateAdded)); + bindingList.CollapseAll(); gridEntryBindingSource.DataSource = bindingList; + VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count()); } - internal void updateGrid(List dbBooks) + internal void UpdateGrid(List dbBooks) { int visibleCount = bindingList.Count; string existingFilter = gridEntryBindingSource.Filter; //Add absent books to grid, or update current books - var allItmes = bindingList.AllItems().Where(i => i is LibraryBookEntry).Cast(); + var allItmes = bindingList.AllItems().LibraryBooks(); for (var i = dbBooks.Count - 1; i >= 0; i--) { var libraryBook = dbBooks[i]; @@ -155,26 +129,31 @@ namespace LibationWinForms if (libraryBook.Book.ContentType is ContentType.Episode) { - //Find the series that libraryBook, if it exists - var series = bindingList.AllItems().Where(i => i is SeriesEntry).Cast().FirstOrDefault(i => libraryBook.Book.SeriesLink.Any(s => s.Series.Name == i.Series)); + //Find the series that libraryBook belongs to, if it exists + var series = bindingList.AllItems().Series().FirstOrDefault(i => libraryBook.Book.SeriesLink.Any(s => s.Series.Name == i.Series)); if (series is null) { //Series doesn't exist yet, so create and add it - var newSeries = new SeriesEntry { Children = new List { lb } }; + var newSeries = new SeriesEntry { Children = new List { lb } }; newSeries.setSeriesBook(libraryBook.Book.SeriesLink.First()); lb.Parent = newSeries; newSeries.Liberate.Expanded = true; bindingList.Insert(0, newSeries); + series = newSeries; } else { lb.Parent = series; series.Children.Add(lb); } + //Add episode beneath the parent + int seriesIndex = bindingList.IndexOf(series); + bindingList.Insert(seriesIndex + 1, lb); } - //Add the new product - bindingList.Insert(0, lb); + else + //Add the new product + bindingList.Insert(0, lb); } // update existing else @@ -195,24 +174,27 @@ namespace LibationWinForms var removedBooks = bindingList .AllItems() - .Where(i => i is LibraryBookEntry) - .Cast() + .LibraryBooks() .ExceptBy(dbBooks.Select(lb => lb.Book.AudibleProductId), ge => ge.AudibleProductId); + foreach (var removed in removedBooks.Where(b => b.Parent is not null)) + { + ((SeriesEntry)removed.Parent).Children.Remove(removed); + } + //Remove series that have no children var removedSeries = bindingList .AllItems() - .Where(i => i is SeriesEntry) - .Cast() - .Where(i => removedBooks.Count(r => r.Series == i.Series) == i.Children.Count); + .Series() + .Where(i => i.Children.Count == 0); foreach (var removed in removedBooks.Cast().Concat(removedSeries)) //no need to re-filter for removed books bindingList.Remove(removed); if (bindingList.Count != visibleCount) - VisibleCountChanged?.Invoke(this, bindingList.Count); + VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count()); } #endregion @@ -229,24 +211,19 @@ namespace LibationWinForms gridEntryBindingSource.Filter = searchString; if (visibleCount != bindingList.Count) - VisibleCountChanged?.Invoke(this, bindingList.Count); + VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count()); + } #endregion - internal IEnumerable GetVisible() + internal IEnumerable GetVisible() => bindingList - .Where(row => row is LibraryBookEntry) - .Cast() - .Select(row => row.LibraryBook); + .LibraryBooks(); - #region Column Customizations - - // to ensure this is only ever called once: Load instead of 'override OnVisibleChanged' private void ProductsGrid_Load(object sender, EventArgs e) { - if (this.DesignMode) - return; + gridEntryDataGridView.ColumnWidthChanged += gridEntryDataGridView_ColumnWidthChanged; contextMenuStrip1.Items.Add(new ToolStripLabel("Show / Hide Columns")); contextMenuStrip1.Items.Add(new ToolStripSeparator()); @@ -259,7 +236,7 @@ namespace LibationWinForms var cmsKiller = new ContextMenuStrip(); - foreach (DataGridViewColumn column in _dataGridView.Columns) + foreach (DataGridViewColumn column in gridEntryDataGridView.Columns) { var itemName = column.DataPropertyName; var visible = gridColumnsVisibilities.GetValueOrDefault(itemName, true); @@ -288,38 +265,19 @@ namespace LibationWinForms //We must set DisplayIndex properties in ascending order foreach (var itemName in displayIndices.OrderBy(i => i.Value).Select(i => i.Key)) { - var column = _dataGridView.Columns + var column = gridEntryDataGridView.Columns .Cast() .Single(c => c.DataPropertyName == itemName); column.DisplayIndex = displayIndices.GetValueOrDefault(itemName, column.Index); } } - - private void gridEntryDataGridView_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e) - { - var config = Configuration.Instance; - - var dictionary = config.GridColumnsDisplayIndices; - dictionary[e.Column.DataPropertyName] = e.Column.DisplayIndex; - config.GridColumnsDisplayIndices = dictionary; - } - - private void gridEntryDataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) - { - var config = Configuration.Instance; - - var dictionary = config.GridColumnsWidths; - dictionary[e.Column.DataPropertyName] = e.Column.Width; - config.GridColumnsWidths = dictionary; - } - private void HideMenuItem_Click(object sender, EventArgs e) { var menuItem = sender as ToolStripMenuItem; var propertyName = menuItem.Tag as string; - var column = _dataGridView.Columns + var column = gridEntryDataGridView.Columns .Cast() .FirstOrDefault(c => c.DataPropertyName == propertyName); @@ -337,6 +295,15 @@ namespace LibationWinForms } } + private void gridEntryDataGridView_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e) + { + var config = Configuration.Instance; + + var dictionary = config.GridColumnsDisplayIndices; + dictionary[e.Column.DataPropertyName] = e.Column.DisplayIndex; + config.GridColumnsDisplayIndices = dictionary; + } + private void gridEntryDataGridView_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e) { if (e.ColumnIndex == descriptionGVColumn.Index) @@ -345,6 +312,12 @@ namespace LibationWinForms e.ToolTipText = "Click to see full size"; } - #endregion + private void gridEntryDataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) + { + var config = Configuration.Instance; + + var dictionary = config.GridColumnsWidths; + dictionary[e.Column.DataPropertyName] = e.Column.Width; + } } } diff --git a/Source/LibationWinForms/grid/ProductsGrid.resx b/Source/LibationWinForms/grid/ProductsGrid.resx index be5db7af..2a349cc7 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.resx +++ b/Source/LibationWinForms/grid/ProductsGrid.resx @@ -57,7 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 81 + + 17, 17 \ No newline at end of file diff --git a/Source/LibationWinForms/grid/SeriesEntry.cs b/Source/LibationWinForms/grid/SeriesEntry.cs index 6a1e51b8..22252e7b 100644 --- a/Source/LibationWinForms/grid/SeriesEntry.cs +++ b/Source/LibationWinForms/grid/SeriesEntry.cs @@ -12,6 +12,7 @@ namespace LibationWinForms { internal class SeriesEntry : GridEntry { + public List Children { get; set; } public override DateTime DateAdded => Children.Max(c => c.DateAdded); public override string ProductRating { get; protected set; } public override string PurchaseDate { get; protected set; } @@ -24,7 +25,7 @@ namespace LibationWinForms public override string Category { get; protected set; } public override string Misc { get; protected set; } public override string Description { get; protected set; } - public override string DisplayTags => string.Empty; + public override string DisplayTags { get; } = string.Empty; public override LiberateStatus Liberate => _liberate; @@ -41,18 +42,17 @@ namespace LibationWinForms // Immutable properties { - var childLB = Children.Cast(); - int bookLenMins = childLB.Sum(c => c.LibraryBook.Book.LengthInMinutes); + int bookLenMins = Children.Sum(c => c.LibraryBook.Book.LengthInMinutes); - var myAverageRating = new Rating(childLB.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.OverallRating), childLB.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.PerformanceRating), childLB.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.StoryRating)); - var productAverageRating = new Rating(childLB.Average(c => c.LibraryBook.Book.Rating.OverallRating), childLB.Average(c => c.LibraryBook.Book.Rating.PerformanceRating), childLB.Average(c => c.LibraryBook.Book.Rating.StoryRating)); + var myAverageRating = new Rating(Children.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.OverallRating), Children.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.PerformanceRating), Children.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.StoryRating)); + var productAverageRating = new Rating(Children.Average(c => c.LibraryBook.Book.Rating.OverallRating), Children.Average(c => c.LibraryBook.Book.Rating.PerformanceRating), Children.Average(c => c.LibraryBook.Book.Rating.StoryRating)); Title = SeriesBook.Series.Name; Series = SeriesBook.Series.Name; Length = bookLenMins == 0 ? "" : $"{bookLenMins / 60} hr {bookLenMins % 60} min"; MyRating = myAverageRating.ToStarString()?.DefaultIfNullOrWhiteSpace(""); - PurchaseDate = childLB.Min(c => c.LibraryBook.DateAdded).ToString("d"); + PurchaseDate = Children.Min(c => c.LibraryBook.DateAdded).ToString("d"); ProductRating = productAverageRating.ToStarString()?.DefaultIfNullOrWhiteSpace(""); Authors = Book.AuthorNames(); Narrators = Book.NarratorNames(); @@ -73,17 +73,17 @@ namespace LibationWinForms { { nameof(Title), () => Book.SeriesSortable() }, { nameof(Series), () => Book.SeriesSortable() }, - { nameof(Length), () => Children.Cast().Sum(c=>c.LibraryBook.Book.LengthInMinutes) }, - { nameof(MyRating), () => Children.Cast().Average(c=>c.LibraryBook.Book.UserDefinedItem.Rating.FirstScore()) }, - { nameof(PurchaseDate), () => Children.Cast().Min(c=>c.LibraryBook.DateAdded) }, - { nameof(ProductRating), () => Children.Cast().Average(c => c.LibraryBook.Book.Rating.FirstScore()) }, + { nameof(Length), () => Children.Sum(c=>c.LibraryBook.Book.LengthInMinutes) }, + { nameof(MyRating), () => Children.Average(c=>c.LibraryBook.Book.UserDefinedItem.Rating.FirstScore()) }, + { nameof(PurchaseDate), () => Children.Min(c=>c.LibraryBook.DateAdded) }, + { nameof(ProductRating), () => Children.Average(c => c.LibraryBook.Book.Rating.FirstScore()) }, { nameof(Authors), () => string.Empty }, { nameof(Narrators), () => string.Empty }, { nameof(Description), () => string.Empty }, { nameof(Category), () => string.Empty }, { nameof(Misc), () => string.Empty }, { nameof(DisplayTags), () => string.Empty }, - { nameof(Liberate), () => Liberate.BookStatus }, + { nameof(Liberate), () => Liberate }, { nameof(DateAdded), () => DateAdded }, }; } diff --git a/Source/LibationWinForms/grid/SortableBindingList1.cs b/Source/LibationWinForms/grid/SortableBindingList1.cs index 7d12819f..0a0606f5 100644 --- a/Source/LibationWinForms/grid/SortableBindingList1.cs +++ b/Source/LibationWinForms/grid/SortableBindingList1.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace LibationWinForms { @@ -42,22 +40,20 @@ namespace LibationWinForms { List itemsList = (List)Items; - //Array.Sort() and List.Sort() are unstable sorts. OrderBy is stable. - var sortedItems = itemsList.OrderBy((ge) => ge, Comparer).ToList(); + var sortedItems = Items.OrderBy(ge => ge, Comparer).ToList(); var children = sortedItems.Where(i => i.Parent is not null).ToList(); - var parents = sortedItems.Where(i => i.Children is not null).ToList(); - - //Top Level items - var topLevelItems = sortedItems.Except(children); itemsList.Clear(); - itemsList.AddRange(topLevelItems); - foreach (var p in parents) + //Only add parentless items at this stage. After these items are added in the + //correct sorting order, go back and add the children beneath their parents. + itemsList.AddRange(sortedItems.Except(children)); + + foreach (var parent in children.Select(c => c.Parent).Distinct()) { - var pIndex = itemsList.IndexOf(p); - foreach (var c in children.Where(c=> c.Parent == p)) + var pIndex = itemsList.IndexOf(parent); + foreach (var c in children.Where(c=> c.Parent == parent)) itemsList.Insert(++pIndex, c); } } @@ -86,26 +82,5 @@ namespace LibationWinForms OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); } - - protected override int FindCore(PropertyDescriptor property, object key) - { - int count = Count; - - System.Collections.IComparer valueComparer = null; - - for (int i = 0; i < count; ++i) - { - var element = this[i]; - var elemValue = element.GetMemberValue(property.Name); - valueComparer ??= element.GetMemberComparer(elemValue.GetType()); - - if (valueComparer.Compare(elemValue, key) == 0) - { - return i; - } - } - - return -1; - } } }