diff --git a/Form1.Designer.cs b/Form1.Designer.cs
index 182b6fc..008a7ba 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();
@@ -65,9 +74,7 @@ namespace photo_sorter
this.gbox_copybool = new System.Windows.Forms.GroupBox();
this.rad_sort_move = new System.Windows.Forms.RadioButton();
this.rad_sort_copy = new System.Windows.Forms.RadioButton();
- this.tbox_sort_secondary = new System.Windows.Forms.TextBox();
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();
@@ -76,11 +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.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();
@@ -199,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 = 33;
+ 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)));
@@ -225,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);
@@ -236,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);
@@ -247,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);
@@ -271,6 +291,10 @@ 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);
this.gbox_info.Controls.Add(this.gbox_photo_type);
this.gbox_info.Controls.Add(this.btn_reload_src);
this.gbox_info.Controls.Add(this.btn_open_src_dir);
@@ -280,18 +304,114 @@ namespace photo_sorter
this.gbox_info.Controls.Add(this.tbox_dest_dir);
this.gbox_info.Controls.Add(this.lbl_dest_dir);
this.gbox_info.Controls.Add(this.gbox_copybool);
- this.gbox_info.Controls.Add(this.tbox_sort_secondary);
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(280, 320);
+ this.gbox_info.MinimumSize = new System.Drawing.Size(346, 540);
this.gbox_info.Name = "gbox_info";
this.gbox_info.Size = new System.Drawing.Size(354, 540);
this.gbox_info.TabIndex = 2;
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 = 13;
+ //
+ // 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 = 14;
+ 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 = 15;
+ 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 = 16;
+ 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);
@@ -301,7 +421,7 @@ namespace photo_sorter
this.gbox_photo_type.Controls.Add(this.rad_cr2);
this.gbox_photo_type.Location = new System.Drawing.Point(7, 151);
this.gbox_photo_type.Name = "gbox_photo_type";
- this.gbox_photo_type.Size = new System.Drawing.Size(142, 137);
+ this.gbox_photo_type.Size = new System.Drawing.Size(211, 89);
this.gbox_photo_type.TabIndex = 4;
this.gbox_photo_type.TabStop = false;
this.gbox_photo_type.Text = "File Type";
@@ -319,7 +439,7 @@ namespace photo_sorter
// rad_png
//
this.rad_png.AutoSize = true;
- this.rad_png.Location = new System.Drawing.Point(6, 111);
+ this.rad_png.Location = new System.Drawing.Point(156, 42);
this.rad_png.Name = "rad_png";
this.rad_png.Size = new System.Drawing.Size(48, 17);
this.rad_png.TabIndex = 8;
@@ -329,7 +449,7 @@ namespace photo_sorter
// rad_jpeg
//
this.rad_jpeg.AutoSize = true;
- this.rad_jpeg.Location = new System.Drawing.Point(6, 88);
+ this.rad_jpeg.Location = new System.Drawing.Point(156, 19);
this.rad_jpeg.Name = "rad_jpeg";
this.rad_jpeg.Size = new System.Drawing.Size(45, 17);
this.rad_jpeg.TabIndex = 7;
@@ -365,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);
@@ -376,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);
@@ -466,15 +586,6 @@ namespace photo_sorter
this.rad_sort_copy.Text = "Copy";
this.rad_sort_copy.UseVisualStyleBackColor = true;
//
- // tbox_sort_secondary
- //
- this.tbox_sort_secondary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tbox_sort_secondary.Location = new System.Drawing.Point(6, 123);
- this.tbox_sort_secondary.Name = "tbox_sort_secondary";
- this.tbox_sort_secondary.Size = new System.Drawing.Size(342, 20);
- this.tbox_sort_secondary.TabIndex = 3;
- //
// lbl_sort_secondary
//
this.lbl_sort_secondary.AutoSize = true;
@@ -484,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;
@@ -553,7 +655,7 @@ namespace photo_sorter
// split_container_main.Panel1
//
this.split_container_main.Panel1.Controls.Add(this.gbox_info);
- this.split_container_main.Panel1MinSize = 320;
+ this.split_container_main.Panel1MinSize = 350;
//
// split_container_main.Panel2
//
@@ -563,17 +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.Visible = false;
- //
// form_main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -583,10 +674,12 @@ namespace photo_sorter
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.split_container_main);
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);
@@ -594,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);
@@ -628,9 +724,7 @@ namespace photo_sorter
private System.Windows.Forms.GroupBox gbox_copybool;
private System.Windows.Forms.RadioButton rad_sort_move;
private System.Windows.Forms.RadioButton rad_sort_copy;
- private System.Windows.Forms.TextBox tbox_sort_secondary;
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;
@@ -658,6 +752,14 @@ namespace photo_sorter
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.Button btn_delete;
+ private System.Windows.Forms.Button btn_prerender;
+ private System.Windows.Forms.ComboBox cbox_sort_secondary;
+ private System.Windows.Forms.ListBox lbox_secondary_sortlist;
+ private System.Windows.Forms.TabControl tabctrl_sort_dir;
+ 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 8d495ea..935077c 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;
@@ -30,7 +31,7 @@ namespace photo_sorter
case "dng":
rad_dng.Checked = true;
break;
- case "jpeg":
+ case "jpg":
rad_jpeg.Checked = true;
break;
case "png":
@@ -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
@@ -66,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)
@@ -122,6 +136,38 @@ 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);
+ }
+ }
+ lbox_secondary_sortlist.Enabled = true;
+ }
+ else
+ {
+ lbox_secondary_sortlist.Items.Clear();
+ lbox_secondary_sortlist.Items.Add("-- Select Primary Sort --");
+ lbox_secondary_sortlist.Enabled = false;
+ }
+ }
+
private void select_source_dir()
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
@@ -133,7 +179,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();
}
@@ -148,7 +194,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");
}
@@ -235,6 +281,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()
@@ -251,11 +298,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;
}
@@ -273,52 +315,51 @@ namespace photo_sorter
}
}
- protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
+ protected override bool ProcessCmdKey(ref Message msg, Keys key_data)
{
if (tsi_enableGlobalHotkeys.Checked)
{
- if (keyData == Keys.Enter)
+ switch (key_data)
{
- sort_image();
- return true;
- }
- if (keyData == Keys.PageUp)
- {
- if (global.filecount > 1)
- prev_image();
- return true;
- }
- if (keyData == Keys.PageDown)
- {
- if (global.filecount > 1)
- next_image();
- return true;
- }
- if (keyData == Keys.Home)
- {
- if (global.filecount > 1)
- {
- status_msg("Loading first image...");
- global.position = 0;
- update_image();
- }
- return true;
- }
- if (keyData == Keys.End)
- {
- if (global.filecount > 1)
- {
- status_msg("Loading final image...");
- global.position = global.filecount - 1;
- update_image();
- }
- return true;
+ case Keys.PageUp:
+ if (global.filecount > 1)
+ prev_image();
+ return true;
+ case Keys.PageDown:
+ if (global.filecount > 1)
+ next_image();
+ return true;
+ case Keys.Control | Keys.Home:
+ if (global.filecount > 1)
+ {
+ status_msg("Loading first image...");
+ global.position = 0;
+ update_image();
+ }
+ return true;
+ case Keys.Control | Keys.End:
+ if (global.filecount > 1)
+ {
+ status_msg("Loading final image...");
+ global.position = global.filecount - 1;
+ update_image();
+ }
+ return true;
+ case Keys.Enter:
+ sort_image();
+ return true;
+ case Keys.Shift | Keys.Delete:
+ delete_image();
+ return true;
+ case Keys.Shift | Keys.Enter:
+ delete_image();
+ return true;
}
}
- return base.ProcessCmdKey(ref msg, keyData);
+ return base.ProcessCmdKey(ref msg, key_data);
}
- public void next_image()
+ public void next_image()
{
status_msg("Loading next image...");
if (global.position < global.filecount - 1)
@@ -348,8 +389,8 @@ namespace photo_sorter
public void sort_image()
{
- string prim_dir = global.dest + '\\' + tbox_sort_primary.Text;
- string sec_dir = prim_dir + '\\' + tbox_sort_secondary.Text;
+ string prim_dir = global.dest + '\\' + cbox_sort_primary.Text;
+ string sec_dir = prim_dir + '\\' + cbox_sort_secondary.Text;
string dpath;
if (global.dest == "")
@@ -360,14 +401,14 @@ 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();
//MessageBox.Show("Primary sort directory name is required!", "Error: Primary Sort", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
- if (tbox_sort_secondary.Text == "")
+ if (cbox_sort_secondary.Text == "")
{
dpath = prim_dir;
}
@@ -404,7 +445,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();
@@ -414,11 +454,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
{
@@ -448,11 +483,74 @@ 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);
}
- if (!Properties.Settings.Default.copy_on_sort)
+ // Begin Update comboboxes
+ if (cbox_sort_primary.Items.Contains(cbox_sort_primary.Text))
{
- Properties.Settings.Default.copy_on_sort = true;
- Properties.Settings.Default.Save();
+ //Remove and re-add, to put it at the new end of the list
+ string t = cbox_sort_primary.Text;
+ cbox_sort_primary.Items.Remove(t);
+ cbox_sort_primary.Items.Add(t);
+ cbox_sort_primary.Text = t;
}
+ 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
+ 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);
+ }
+ }
+ //Prune the lists
+ while (cbox_sort_primary.Items.Count > global.cbox_size)
+ {
+ 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()
+ {
+ if (MessageBox.Show("Are you sure you want to delete this photo?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ string src_fname = global.filenames[global.position];
+ try
+ {
+ File.Delete(src_fname);
+ status_msg("Deleted file: " + src_fname, 2);
+ remove_index(global.position);
+ update_image();
+ }
+ catch (IOException ex)
+ {
+ status_msg("Unable to delete " + src_fname + "!", 4);
+ MessageBox.Show(ex.ToString(), "Critical: IO Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ public void prerender_init()
+ {
+ if (MessageBox.Show("WARNING: Pre-rendering your photos may take a long time, and the preview image quality will be lower than normal.\n\nWould you like to proceed?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ MessageBox.Show("Pre-rendering would normally have started, but instead, nothing interesting happens.");
+ }
+ else
+ {
+ MessageBox.Show("You've chickened out and abandoned the pre-render process. Nothing interesting happens.");
}
}
@@ -485,7 +583,7 @@ namespace photo_sorter
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
- MessageBox.Show("Photo Sorter v1.0.1\n\nThis application is Copyright \u00A9 Skyfall Tech, 2022-2023.\n\nPlease visit https://www.skyfall.tech/ for more information.");
+ MessageBox.Show("Photo Sorter v1.0.2\n\nThis application is Copyright \u00A9 Aaron Johnson, 2023.\n\nPlease visit https://www.skyfall.tech/ for more information.");
}
private void btn_open_src_dir_Click(object sender, EventArgs e)
@@ -515,7 +613,7 @@ namespace photo_sorter
private void globalHotkeysListToolStripMenuItem_Click(object sender, EventArgs e)
{
- MessageBox .Show("Global Hotkeys\n\nPgUp == Previous image\nPgDn == Next image\nHome == Go to first unsorted image\nEnd == Go to final unsorted image\n\nEnter == Sort photo to current options\n");
+ MessageBox .Show("Global Hotkeys\n\nPgUp == Previous image\nPgDn == Next image\nCtrl + Home == Go to first unsorted image\nCtrl + End == Go to final unsorted image\n\nEnter == Sort photo to current options\n\nShift + Delete OR Shift + Enter == Delete image\n");
}
private void tsi_enableGlobalHotkeys_Click(object sender, EventArgs e)
@@ -527,17 +625,82 @@ namespace photo_sorter
Properties.Settings.Default.Save();
}
+ private void btn_delete_Click(object sender, EventArgs e)
+ {
+ delete_image();
+ }
- /*private void Form1_FormClosing(Object sender, FormClosingEventArgs e)
+ private void btn_prerender_Click(object sender, EventArgs e)
+ {
+ 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)
{
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;
+
+ 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
{
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 3efbb7c..bd5e482 100644
--- a/photo_sorter.csproj
+++ b/photo_sorter.csproj
@@ -25,8 +25,8 @@
false
false
true
- 2
- 1.0.1.2
+ 0
+ 1.0.2.0
false
true