diff --git a/Form1.Designer.cs b/Form1.Designer.cs index e559d7a..b644226 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -42,6 +42,7 @@ namespace photo_sorter this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.tsi_about = new System.Windows.Forms.ToolStripMenuItem(); this.gbox_preview = new System.Windows.Forms.GroupBox(); + this.btn_delete = new System.Windows.Forms.Button(); this.lbl_counter = new System.Windows.Forms.Label(); this.lbl_current_fname = new System.Windows.Forms.Label(); this.btn_next = new System.Windows.Forms.Button(); @@ -49,6 +50,14 @@ namespace photo_sorter this.btn_sort = new System.Windows.Forms.Button(); this.img_preview = new System.Windows.Forms.PictureBox(); this.gbox_info = new System.Windows.Forms.GroupBox(); + this.cbox_sort_primary = new System.Windows.Forms.ComboBox(); + this.tabctrl_sort_dir = new System.Windows.Forms.TabControl(); + this.tab_primesort = new System.Windows.Forms.TabPage(); + this.lbox_primary_sortlist = new System.Windows.Forms.ListBox(); + this.tab_secondsort = new System.Windows.Forms.TabPage(); + this.lbox_secondary_sortlist = new System.Windows.Forms.ListBox(); + this.cbox_sort_secondary = new System.Windows.Forms.ComboBox(); + this.btn_prerender = new System.Windows.Forms.Button(); this.gbox_photo_type = new System.Windows.Forms.GroupBox(); this.rad_dng = new System.Windows.Forms.RadioButton(); this.rad_png = new System.Windows.Forms.RadioButton(); @@ -66,7 +75,6 @@ namespace photo_sorter this.rad_sort_move = new System.Windows.Forms.RadioButton(); this.rad_sort_copy = new System.Windows.Forms.RadioButton(); this.lbl_sort_secondary = new System.Windows.Forms.Label(); - this.tbox_sort_primary = new System.Windows.Forms.TextBox(); this.lbl_sort_primary = new System.Windows.Forms.Label(); this.status_bar = new System.Windows.Forms.StatusStrip(); this.stat_last_action = new System.Windows.Forms.ToolStripStatusLabel(); @@ -75,18 +83,13 @@ namespace photo_sorter this.pbar = new System.Windows.Forms.ToolStripProgressBar(); this.split_container_main = new System.Windows.Forms.SplitContainer(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); - this.btn_delete = new System.Windows.Forms.Button(); - this.btn_prerender = new System.Windows.Forms.Button(); - this.cbox_sort_secondary = new System.Windows.Forms.ComboBox(); - this.lbox_secondary_sortlist = new System.Windows.Forms.ListBox(); - this.tabctrl_sort_dir = new System.Windows.Forms.TabControl(); - this.tab_secondsort = new System.Windows.Forms.TabPage(); - this.tab_primesort = new System.Windows.Forms.TabPage(); - this.lbox_primary_sortlist = new System.Windows.Forms.ListBox(); this.menuStrip1.SuspendLayout(); this.gbox_preview.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.img_preview)).BeginInit(); this.gbox_info.SuspendLayout(); + this.tabctrl_sort_dir.SuspendLayout(); + this.tab_primesort.SuspendLayout(); + this.tab_secondsort.SuspendLayout(); this.gbox_photo_type.SuspendLayout(); this.gbox_copybool.SuspendLayout(); this.status_bar.SuspendLayout(); @@ -94,9 +97,6 @@ namespace photo_sorter this.split_container_main.Panel1.SuspendLayout(); this.split_container_main.Panel2.SuspendLayout(); this.split_container_main.SuspendLayout(); - this.tabctrl_sort_dir.SuspendLayout(); - this.tab_secondsort.SuspendLayout(); - this.tab_primesort.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -208,6 +208,17 @@ namespace photo_sorter this.gbox_preview.TabStop = false; this.gbox_preview.Text = "Preview"; // + // btn_delete + // + this.btn_delete.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.btn_delete.Location = new System.Drawing.Point(528, 13); + this.btn_delete.Name = "btn_delete"; + this.btn_delete.Size = new System.Drawing.Size(75, 23); + this.btn_delete.TabIndex = 9; + this.btn_delete.Text = "&Delete (!)"; + this.btn_delete.UseVisualStyleBackColor = true; + this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click); + // // lbl_counter // this.lbl_counter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -280,6 +291,7 @@ namespace photo_sorter this.gbox_info.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.gbox_info.Controls.Add(this.cbox_sort_primary); this.gbox_info.Controls.Add(this.tabctrl_sort_dir); this.gbox_info.Controls.Add(this.cbox_sort_secondary); this.gbox_info.Controls.Add(this.btn_prerender); @@ -293,7 +305,6 @@ namespace photo_sorter this.gbox_info.Controls.Add(this.lbl_dest_dir); this.gbox_info.Controls.Add(this.gbox_copybool); this.gbox_info.Controls.Add(this.lbl_sort_secondary); - this.gbox_info.Controls.Add(this.tbox_sort_primary); this.gbox_info.Controls.Add(this.lbl_sort_primary); this.gbox_info.Location = new System.Drawing.Point(3, 3); this.gbox_info.MinimumSize = new System.Drawing.Size(346, 540); @@ -303,6 +314,104 @@ namespace photo_sorter this.gbox_info.TabStop = false; this.gbox_info.Text = "Sorting Info"; // + // cbox_sort_primary + // + this.cbox_sort_primary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.cbox_sort_primary.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append; + this.cbox_sort_primary.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.cbox_sort_primary.FormattingEnabled = true; + this.cbox_sort_primary.Location = new System.Drawing.Point(5, 81); + this.cbox_sort_primary.Name = "cbox_sort_primary"; + this.cbox_sort_primary.Size = new System.Drawing.Size(343, 21); + this.cbox_sort_primary.TabIndex = 2; + this.cbox_sort_primary.Enter += new System.EventHandler(this.cbox_sort_primary_Enter); + this.cbox_sort_primary.Leave += new System.EventHandler(this.cbox_sortfields_Leave); + // + // tabctrl_sort_dir + // + this.tabctrl_sort_dir.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.tabctrl_sort_dir.Controls.Add(this.tab_primesort); + this.tabctrl_sort_dir.Controls.Add(this.tab_secondsort); + this.tabctrl_sort_dir.Location = new System.Drawing.Point(6, 246); + this.tabctrl_sort_dir.Name = "tabctrl_sort_dir"; + this.tabctrl_sort_dir.SelectedIndex = 0; + this.tabctrl_sort_dir.Size = new System.Drawing.Size(340, 236); + this.tabctrl_sort_dir.TabIndex = 0; + // + // tab_primesort + // + this.tab_primesort.Controls.Add(this.lbox_primary_sortlist); + this.tab_primesort.Location = new System.Drawing.Point(4, 22); + this.tab_primesort.Name = "tab_primesort"; + this.tab_primesort.Padding = new System.Windows.Forms.Padding(3); + this.tab_primesort.Size = new System.Drawing.Size(332, 210); + this.tab_primesort.TabIndex = 0; + this.tab_primesort.Text = "Primary Sort Directories"; + // + // lbox_primary_sortlist + // + this.lbox_primary_sortlist.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.lbox_primary_sortlist.FormattingEnabled = true; + this.lbox_primary_sortlist.Location = new System.Drawing.Point(5, 6); + this.lbox_primary_sortlist.Name = "lbox_primary_sortlist"; + this.lbox_primary_sortlist.Size = new System.Drawing.Size(323, 199); + this.lbox_primary_sortlist.TabIndex = 1; + this.lbox_primary_sortlist.DoubleClick += new System.EventHandler(this.lbox_primary_sortlist_SelectItem); + // + // tab_secondsort + // + this.tab_secondsort.Controls.Add(this.lbox_secondary_sortlist); + this.tab_secondsort.Location = new System.Drawing.Point(4, 22); + this.tab_secondsort.Name = "tab_secondsort"; + this.tab_secondsort.Padding = new System.Windows.Forms.Padding(3); + this.tab_secondsort.Size = new System.Drawing.Size(332, 210); + this.tab_secondsort.TabIndex = 1; + this.tab_secondsort.Text = "Secondary Sort Directories"; + // + // lbox_secondary_sortlist + // + this.lbox_secondary_sortlist.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.lbox_secondary_sortlist.FormattingEnabled = true; + this.lbox_secondary_sortlist.Location = new System.Drawing.Point(5, 6); + this.lbox_secondary_sortlist.Name = "lbox_secondary_sortlist"; + this.lbox_secondary_sortlist.Size = new System.Drawing.Size(323, 199); + this.lbox_secondary_sortlist.TabIndex = 0; + this.lbox_secondary_sortlist.DoubleClick += new System.EventHandler(this.lbox_secondary_sortlist_SelectItem); + // + // cbox_sort_secondary + // + this.cbox_sort_secondary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.cbox_sort_secondary.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append; + this.cbox_sort_secondary.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.cbox_sort_secondary.FormattingEnabled = true; + this.cbox_sort_secondary.Location = new System.Drawing.Point(5, 125); + this.cbox_sort_secondary.Name = "cbox_sort_secondary"; + this.cbox_sort_secondary.Size = new System.Drawing.Size(343, 21); + this.cbox_sort_secondary.TabIndex = 3; + this.cbox_sort_secondary.Enter += new System.EventHandler(this.cbox_sort_secondary_Enter); + this.cbox_sort_secondary.Leave += new System.EventHandler(this.cbox_sortfields_Leave); + // + // btn_prerender + // + this.btn_prerender.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btn_prerender.Enabled = false; + this.btn_prerender.Location = new System.Drawing.Point(183, 488); + this.btn_prerender.Name = "btn_prerender"; + this.btn_prerender.Size = new System.Drawing.Size(75, 23); + this.btn_prerender.TabIndex = 903; + this.btn_prerender.Text = "Pre-R&ender"; + this.btn_prerender.UseVisualStyleBackColor = true; + this.btn_prerender.Visible = false; + this.btn_prerender.Click += new System.EventHandler(this.btn_prerender_Click); + // // gbox_photo_type // this.gbox_photo_type.Controls.Add(this.rad_dng); @@ -486,15 +595,6 @@ namespace photo_sorter this.lbl_sort_secondary.TabIndex = 2; this.lbl_sort_secondary.Text = "Secondary Sort (e.g. Subject Name):"; // - // tbox_sort_primary - // - this.tbox_sort_primary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tbox_sort_primary.Location = new System.Drawing.Point(6, 79); - this.tbox_sort_primary.Name = "tbox_sort_primary"; - this.tbox_sort_primary.Size = new System.Drawing.Size(342, 20); - this.tbox_sort_primary.TabIndex = 2; - // // lbl_sort_primary // this.lbl_sort_primary.AutoSize = true; @@ -565,94 +665,6 @@ namespace photo_sorter this.split_container_main.SplitterDistance = 360; this.split_container_main.TabIndex = 4; // - // btn_delete - // - this.btn_delete.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.btn_delete.Location = new System.Drawing.Point(528, 13); - this.btn_delete.Name = "btn_delete"; - this.btn_delete.Size = new System.Drawing.Size(75, 23); - this.btn_delete.TabIndex = 9; - this.btn_delete.Text = "&Delete (!)"; - this.btn_delete.UseVisualStyleBackColor = true; - this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click); - // - // btn_prerender - // - this.btn_prerender.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btn_prerender.Enabled = false; - this.btn_prerender.Location = new System.Drawing.Point(183, 488); - this.btn_prerender.Name = "btn_prerender"; - this.btn_prerender.Size = new System.Drawing.Size(75, 23); - this.btn_prerender.TabIndex = 903; - this.btn_prerender.Text = "Pre-R&ender"; - this.btn_prerender.UseVisualStyleBackColor = true; - this.btn_prerender.Click += new System.EventHandler(this.btn_prerender_Click); - // - // cbox_sort_secondary - // - this.cbox_sort_secondary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cbox_sort_secondary.FormattingEnabled = true; - this.cbox_sort_secondary.Location = new System.Drawing.Point(6, 125); - this.cbox_sort_secondary.Name = "cbox_sort_secondary"; - this.cbox_sort_secondary.Size = new System.Drawing.Size(342, 21); - this.cbox_sort_secondary.TabIndex = 904; - // - // lbox_secondary_sortlist - // - this.lbox_secondary_sortlist.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.lbox_secondary_sortlist.FormattingEnabled = true; - this.lbox_secondary_sortlist.Location = new System.Drawing.Point(5, 6); - this.lbox_secondary_sortlist.Name = "lbox_secondary_sortlist"; - this.lbox_secondary_sortlist.Size = new System.Drawing.Size(323, 199); - this.lbox_secondary_sortlist.TabIndex = 0; - // - // tabctrl_sort_dir - // - this.tabctrl_sort_dir.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.tabctrl_sort_dir.Controls.Add(this.tab_primesort); - this.tabctrl_sort_dir.Controls.Add(this.tab_secondsort); - this.tabctrl_sort_dir.Location = new System.Drawing.Point(6, 246); - this.tabctrl_sort_dir.Name = "tabctrl_sort_dir"; - this.tabctrl_sort_dir.SelectedIndex = 0; - this.tabctrl_sort_dir.Size = new System.Drawing.Size(340, 236); - this.tabctrl_sort_dir.TabIndex = 0; - // - // tab_secondsort - // - this.tab_secondsort.Controls.Add(this.lbox_secondary_sortlist); - this.tab_secondsort.Location = new System.Drawing.Point(4, 22); - this.tab_secondsort.Name = "tab_secondsort"; - this.tab_secondsort.Padding = new System.Windows.Forms.Padding(3); - this.tab_secondsort.Size = new System.Drawing.Size(332, 210); - this.tab_secondsort.TabIndex = 1; - this.tab_secondsort.Text = "Secondary Sort Directories"; - // - // tab_primesort - // - this.tab_primesort.Controls.Add(this.lbox_primary_sortlist); - this.tab_primesort.Location = new System.Drawing.Point(4, 22); - this.tab_primesort.Name = "tab_primesort"; - this.tab_primesort.Padding = new System.Windows.Forms.Padding(3); - this.tab_primesort.Size = new System.Drawing.Size(332, 210); - this.tab_primesort.TabIndex = 0; - this.tab_primesort.Text = "Primary Sort Directories"; - // - // lbox_primary_sortlist - // - this.lbox_primary_sortlist.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.lbox_primary_sortlist.FormattingEnabled = true; - this.lbox_primary_sortlist.Location = new System.Drawing.Point(5, 6); - this.lbox_primary_sortlist.Name = "lbox_primary_sortlist"; - this.lbox_primary_sortlist.Size = new System.Drawing.Size(323, 199); - this.lbox_primary_sortlist.TabIndex = 1; - // // form_main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -664,9 +676,10 @@ namespace photo_sorter this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.MainMenuStrip = this.menuStrip1; - this.MinimumSize = new System.Drawing.Size(1024, 480); + this.MinimumSize = new System.Drawing.Size(1040, 640); this.Name = "form_main"; this.Text = "Skyfall Photo Sorter"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.gbox_preview.ResumeLayout(false); @@ -674,6 +687,9 @@ namespace photo_sorter ((System.ComponentModel.ISupportInitialize)(this.img_preview)).EndInit(); this.gbox_info.ResumeLayout(false); this.gbox_info.PerformLayout(); + this.tabctrl_sort_dir.ResumeLayout(false); + this.tab_primesort.ResumeLayout(false); + this.tab_secondsort.ResumeLayout(false); this.gbox_photo_type.ResumeLayout(false); this.gbox_photo_type.PerformLayout(); this.gbox_copybool.ResumeLayout(false); @@ -684,9 +700,6 @@ namespace photo_sorter this.split_container_main.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.split_container_main)).EndInit(); this.split_container_main.ResumeLayout(false); - this.tabctrl_sort_dir.ResumeLayout(false); - this.tab_secondsort.ResumeLayout(false); - this.tab_primesort.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -712,7 +725,6 @@ namespace photo_sorter private System.Windows.Forms.RadioButton rad_sort_move; private System.Windows.Forms.RadioButton rad_sort_copy; private System.Windows.Forms.Label lbl_sort_secondary; - private System.Windows.Forms.TextBox tbox_sort_primary; private System.Windows.Forms.Label lbl_sort_primary; private System.Windows.Forms.StatusStrip status_bar; private System.Windows.Forms.ToolStripStatusLabel stat_last_action; @@ -747,6 +759,7 @@ namespace photo_sorter private System.Windows.Forms.TabPage tab_primesort; private System.Windows.Forms.ListBox lbox_primary_sortlist; private System.Windows.Forms.TabPage tab_secondsort; + private System.Windows.Forms.ComboBox cbox_sort_primary; } } diff --git a/Form1.cs b/Form1.cs index c697767..ccf22c6 100644 --- a/Form1.cs +++ b/Form1.cs @@ -9,6 +9,7 @@ using System.Drawing; //using System.Text; //using System.Threading.Tasks; using System.Windows.Forms; +using System.Collections;//.ArrayList; using System.IO; using ImageMagick; @@ -50,6 +51,10 @@ namespace photo_sorter { rad_sort_copy.Checked = true; } + else + { + rad_sort_move.Checked = true; + } tbox_dest_dir.Text = Properties.Settings.Default.dest_dir; tbox_source_dir.Text = Properties.Settings.Default.src_dir; @@ -58,6 +63,14 @@ namespace photo_sorter btn_reload_src.Enabled = true; reload_source(); } + if (Properties.Settings.Default.cbi_primary != null) + { + cbox_sort_primary.Items.AddRange(Properties.Settings.Default.cbi_primary.ToArray()); + } + if (Properties.Settings.Default.cbi_secondary != null) + { + cbox_sort_secondary.Items.AddRange(Properties.Settings.Default.cbi_secondary.ToArray()); + } } static class global @@ -122,6 +135,31 @@ namespace photo_sorter } } + private void populate_directory_lists() + { + //string[] pdir = Directory.GetDirectories(global.dest); + //string[] sdir = Directory.GetDirectories(global.dest + "\\" + cbox_sort_primary.Text); + + lbox_primary_sortlist.Items.Clear(); + foreach (var d in Directory.GetDirectories(global.dest)) + { + var dir = new DirectoryInfo(d).Name; + lbox_primary_sortlist.Items.Add(dir); + } + if (cbox_sort_primary.Text.Length > 0) + { + if (Directory.Exists(global.dest + "\\" + cbox_sort_primary.Text)) + { + lbox_secondary_sortlist.Items.Clear(); + foreach (var d in Directory.GetDirectories(global.dest + "\\" + cbox_sort_primary.Text)) + { + var dir = new DirectoryInfo(d).Name; + lbox_secondary_sortlist.Items.Add(dir); + } + } + } + } + private void select_source_dir() { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) @@ -235,6 +273,7 @@ namespace photo_sorter status_msg("Loaded image: " + lbl_current_fname.Text); update_counter(); pbar.Value = 0; + populate_directory_lists(); } public string[] populate_file_names() @@ -347,7 +386,7 @@ namespace photo_sorter public void sort_image() { - string prim_dir = global.dest + '\\' + tbox_sort_primary.Text; + string prim_dir = global.dest + '\\' + cbox_sort_primary.Text; string sec_dir = prim_dir + '\\' + cbox_sort_secondary.Text; string dpath; @@ -359,7 +398,7 @@ namespace photo_sorter return; } - if (tbox_sort_primary.Text == "") + if (cbox_sort_primary.Text == "") { status_msg("Primary sort field required to sort!", 3); //System.Media.SystemSounds.Exclamation.Play(); @@ -403,7 +442,6 @@ namespace photo_sorter } } File.Move(@src_fname, @dst_fname); - //status_msg("Moved " + lbl_current_fname.Text + " to " + dpath); status_msg("Moved " + global.filenames[global.position] + " to " + dpath); remove_index(global.position); update_image(); @@ -447,6 +485,31 @@ namespace photo_sorter status_msg("Unable to copy " + global.filenames[global.position] + " to " + dpath + "!", 4); MessageBox.Show(ex.ToString(), "Critical: IO Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } + // Begin Update comboboxes + if (cbox_sort_primary.Items.Contains(cbox_sort_primary.Text)) + { + //Remove and re-add, to put it at the new end of the list + cbox_sort_primary.Items.Remove(cbox_sort_primary.Text); + cbox_sort_primary.Items.Add(cbox_sort_primary.Text); + } + else + { + cbox_sort_primary.Items.Add(cbox_sort_primary.Text); + } + if (cbox_sort_secondary.Text.Length > 0) + { + if (cbox_sort_secondary.Items.Contains(cbox_sort_secondary.Text)) + { + //Remove and re-add, to put it at the new end of the list + cbox_sort_secondary.Items.Remove(cbox_sort_secondary.Text); + cbox_sort_secondary.Items.Add(cbox_sort_secondary.Text); + } + else + { + cbox_sort_secondary.Items.Add(cbox_sort_secondary.Text); + } + } + // End combobox updating if (!Properties.Settings.Default.copy_on_sort) { Properties.Settings.Default.copy_on_sort = true; @@ -566,17 +629,49 @@ namespace photo_sorter prerender_init(); } + private void cbox_sortfields_Leave(object sender, EventArgs e) + { + populate_directory_lists(); + } + private void cbox_sort_primary_Enter(object sender, EventArgs e) + { + populate_directory_lists(); + tabctrl_sort_dir.SelectedTab = tabctrl_sort_dir.TabPages["tab_primesort"]; + cbox_sort_primary.Focus(); + } + private void cbox_sort_secondary_Enter(object sender, EventArgs e) + { + if (cbox_sort_primary.Text.Length > 0) + { + populate_directory_lists(); + tabctrl_sort_dir.SelectedTab = tabctrl_sort_dir.TabPages["tab_secondsort"]; + cbox_sort_secondary.Focus(); + } + } + private void lbox_primary_sortlist_SelectItem(object sender, EventArgs e) + { + cbox_sort_primary.Text = lbox_primary_sortlist.SelectedItem.ToString(); + populate_directory_lists(); + } + private void lbox_secondary_sortlist_SelectItem(object sender, EventArgs e) + { + cbox_sort_secondary.Text = lbox_secondary_sortlist.SelectedItem.ToString(); + } - /*private void Form1_FormClosing(Object sender, FormClosingEventArgs e) + private void Form1_FormClosing(Object sender, FormClosingEventArgs e) { if (MessageBox.Show("Are you sure you want to quit the Photo Sorter application?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - this.Close(); + ArrayList cbi_primary = new ArrayList(this.cbox_sort_primary.Items); + ArrayList cbi_secondary = new ArrayList(this.cbox_sort_secondary.Items); + Properties.Settings.Default.cbi_primary = cbi_primary; + Properties.Settings.Default.cbi_secondary = cbi_secondary; + Properties.Settings.Default.Save(); } else { e.Cancel = true; } - }*/ + } } } diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index c8b35e6..63f2a69 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -82,5 +82,27 @@ namespace photo_sorter.Properties { this["img_format"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Collections.ArrayList cbi_primary { + get { + return ((global::System.Collections.ArrayList)(this["cbi_primary"])); + } + set { + this["cbi_primary"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Collections.ArrayList cbi_secondary { + get { + return ((global::System.Collections.ArrayList)(this["cbi_secondary"])); + } + set { + this["cbi_secondary"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 01ef709..aff7b3c 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -17,5 +17,11 @@ nef + + + + + + \ No newline at end of file diff --git a/photo_sorter.csproj b/photo_sorter.csproj index 774a521..bd5e482 100644 --- a/photo_sorter.csproj +++ b/photo_sorter.csproj @@ -26,7 +26,7 @@ false true 0 - 1.0.1.0 + 1.0.2.0 false true