diff --git a/Form1.Designer.cs b/Form1.Designer.cs index b644226..008a7ba 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -214,7 +214,7 @@ namespace photo_sorter 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.TabIndex = 33; this.btn_delete.Text = "&Delete (!)"; this.btn_delete.UseVisualStyleBackColor = true; this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click); @@ -245,7 +245,7 @@ namespace photo_sorter this.btn_next.Location = new System.Drawing.Point(398, 13); this.btn_next.Name = "btn_next"; this.btn_next.Size = new System.Drawing.Size(75, 23); - this.btn_next.TabIndex = 8; + this.btn_next.TabIndex = 32; this.btn_next.Text = "&Next >>"; this.btn_next.UseVisualStyleBackColor = true; this.btn_next.Click += new System.EventHandler(this.btn_next_Click); @@ -256,7 +256,7 @@ namespace photo_sorter this.btn_prev.Location = new System.Drawing.Point(236, 13); this.btn_prev.Name = "btn_prev"; this.btn_prev.Size = new System.Drawing.Size(75, 23); - this.btn_prev.TabIndex = 6; + this.btn_prev.TabIndex = 30; this.btn_prev.Text = "<< &Previous"; this.btn_prev.UseVisualStyleBackColor = true; this.btn_prev.Click += new System.EventHandler(this.btn_prev_Click); @@ -267,7 +267,7 @@ namespace photo_sorter this.btn_sort.Location = new System.Drawing.Point(317, 13); this.btn_sort.Name = "btn_sort"; this.btn_sort.Size = new System.Drawing.Size(75, 23); - this.btn_sort.TabIndex = 7; + this.btn_sort.TabIndex = 31; this.btn_sort.Text = "&Sort"; this.btn_sort.UseVisualStyleBackColor = true; this.btn_sort.Click += new System.EventHandler(this.btn_sort_Click); @@ -339,7 +339,7 @@ namespace photo_sorter 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; + this.tabctrl_sort_dir.TabIndex = 13; // // tab_primesort // @@ -360,7 +360,7 @@ namespace photo_sorter 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.TabIndex = 14; this.lbox_primary_sortlist.DoubleClick += new System.EventHandler(this.lbox_primary_sortlist_SelectItem); // // tab_secondsort @@ -382,7 +382,7 @@ namespace photo_sorter 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.TabIndex = 15; this.lbox_secondary_sortlist.DoubleClick += new System.EventHandler(this.lbox_secondary_sortlist_SelectItem); // // cbox_sort_secondary @@ -406,7 +406,7 @@ namespace photo_sorter 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.TabIndex = 16; this.btn_prerender.Text = "Pre-R&ender"; this.btn_prerender.UseVisualStyleBackColor = true; this.btn_prerender.Visible = false; @@ -485,7 +485,7 @@ namespace photo_sorter this.btn_reload_src.Location = new System.Drawing.Point(274, 488); this.btn_reload_src.Name = "btn_reload_src"; this.btn_reload_src.Size = new System.Drawing.Size(75, 23); - this.btn_reload_src.TabIndex = 901; + this.btn_reload_src.TabIndex = 17; this.btn_reload_src.Text = "&Reload"; this.btn_reload_src.UseVisualStyleBackColor = true; this.btn_reload_src.Click += new System.EventHandler(this.btn_reload_src_Click); @@ -496,7 +496,7 @@ namespace photo_sorter this.btn_open_src_dir.Location = new System.Drawing.Point(323, 512); this.btn_open_src_dir.Name = "btn_open_src_dir"; this.btn_open_src_dir.Size = new System.Drawing.Size(26, 23); - this.btn_open_src_dir.TabIndex = 902; + this.btn_open_src_dir.TabIndex = 18; this.btn_open_src_dir.Text = "..."; this.btn_open_src_dir.UseVisualStyleBackColor = true; this.btn_open_src_dir.Click += new System.EventHandler(this.btn_open_src_dir_Click); diff --git a/Form1.cs b/Form1.cs index ccf22c6..ed89978 100644 --- a/Form1.cs +++ b/Form1.cs @@ -31,7 +31,7 @@ namespace photo_sorter case "dng": rad_dng.Checked = true; break; - case "jpeg": + case "jpg": rad_jpeg.Checked = true; break; case "png": @@ -79,7 +79,8 @@ namespace photo_sorter public static string src = Properties.Settings.Default.src_dir; public static string[] filenames; public static int filecount; - public static int position = 0; + public static int position = 0; //File position index + public const int cbox_size = 8; //Number of entries allowed in cbox lists } public void status_msg(string msg, int lvl = 1) @@ -171,7 +172,7 @@ namespace photo_sorter if (Properties.Settings.Default.src_dir != global.src) { Properties.Settings.Default.src_dir = global.src; - Properties.Settings.Default.Save(); + //Properties.Settings.Default.Save(); } reload_source(); } @@ -186,7 +187,7 @@ namespace photo_sorter if (Properties.Settings.Default.dest_dir != global.dest) { Properties.Settings.Default.dest_dir = global.dest; - Properties.Settings.Default.Save(); + //Properties.Settings.Default.Save(); } status_msg("Destination directory updated"); } @@ -290,11 +291,6 @@ namespace photo_sorter if (rad_png.Checked) ext = "png"; string[] files = Directory.GetFiles(global.src, "*." + ext); - if (Properties.Settings.Default.img_format != ext) - { - Properties.Settings.Default.img_format = ext; - Properties.Settings.Default.Save(); - } return files; } @@ -451,11 +447,6 @@ namespace photo_sorter status_msg("Unable to move " + global.filenames[global.position] + " to " + dpath + "!", 4); MessageBox.Show(ex.ToString(), "Critical: IO Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } - if (Properties.Settings.Default.copy_on_sort) - { - Properties.Settings.Default.copy_on_sort = false; - Properties.Settings.Default.Save(); - } } else { @@ -489,8 +480,10 @@ namespace photo_sorter 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); + string t = cbox_sort_primary.Text; + cbox_sort_primary.Items.Remove(t); + cbox_sort_primary.Items.Add(t); + cbox_sort_primary.Text = t; } else { @@ -501,20 +494,26 @@ namespace photo_sorter 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); + string t = cbox_sort_secondary.Text; + cbox_sort_secondary.Items.Remove(t); + cbox_sort_secondary.Items.Add(t); + cbox_sort_secondary.Text = t; } else { cbox_sort_secondary.Items.Add(cbox_sort_secondary.Text); } } - // End combobox updating - if (!Properties.Settings.Default.copy_on_sort) + //Prune the lists + while (cbox_sort_primary.Items.Count > global.cbox_size) { - Properties.Settings.Default.copy_on_sort = true; - Properties.Settings.Default.Save(); + cbox_sort_primary.Items.RemoveAt(0); } + while (cbox_sort_secondary.Items.Count > global.cbox_size) + { + cbox_sort_secondary.Items.RemoveAt(0); + } + // End combobox updating } } public void delete_image() @@ -666,6 +665,29 @@ namespace photo_sorter ArrayList cbi_secondary = new ArrayList(this.cbox_sort_secondary.Items); Properties.Settings.Default.cbi_primary = cbi_primary; Properties.Settings.Default.cbi_secondary = cbi_secondary; + + if (rad_sort_copy.Checked) + { + Properties.Settings.Default.copy_on_sort = true; + } + else + { + Properties.Settings.Default.copy_on_sort = false; + } + + string ext = ""; + if (rad_nef.Checked) + ext = "nef"; + if (rad_cr2.Checked) + ext = "cr2"; + if (rad_dng.Checked) + ext = "dng"; + if (rad_jpeg.Checked) + ext = "jpg"; + if (rad_png.Checked) + ext = "png"; + Properties.Settings.Default.img_format = ext; + Properties.Settings.Default.Save(); } else