public Org(string directory) { // Initialization InitializeComponent(); KeyPreview = true; // Hotkeys Setup hotkeys = new Dictionary <Tuple <Keys, Modes>, HotkeysSettings>(); foreach (Keys key in DataExtensions.GetCommonKeysAndButtons()) { foreach (Modes mode in Enum.GetValues(typeof(Modes))) { hotkeys.Add(new Tuple <Keys, Modes>(key, mode), new HotkeysSettings(key)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control, mode), new HotkeysSettings(key | Keys.Control)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control | Keys.Shift, mode), new HotkeysSettings(key | Keys.Control | Keys.Shift)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control | Keys.Alt, mode), new HotkeysSettings(key | Keys.Control | Keys.Alt)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Control | Keys.Shift | Keys.Alt, mode), new HotkeysSettings(key | Keys.Control | Keys.Shift | Keys.Alt)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Shift, mode), new HotkeysSettings(key | Keys.Shift)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Shift | Keys.Alt, mode), new HotkeysSettings(key | Keys.Shift | Keys.Alt)); hotkeys.Add(new Tuple <Keys, Modes>(key | Keys.Alt, mode), new HotkeysSettings(key | Keys.Alt)); } } undoHistory = new Stack <UndoActions>(); pictureBox.MouseWheel += PictureBox_MouseWheel; // PictureBox Context Menu Setup pictureBoxContextMenu = new ContextMenu(); pictureBoxContextMenu.MenuItems.Add("Randomize", PictureBoxContextMenu_Randomize_onClick); pictureBoxContextMenu.MenuItems.Add("Reference", PictureBoxContextMenu_Reference_onClick); pictureBox.ContextMenu = pictureBoxContextMenu; // TreeView Context Menu Setup treeViewContextMenu = new ContextMenu(); treeViewContextMenu.MenuItems.Add("Add to Favorites", TreeViewContextMenu_AddToFavorites_onClick); treeViewContextMenu.MenuItems.Add("Remove from Favorites", TreeViewContextMenu_RemoveFromFavorites_onClick); treeViewContextMenu.MenuItems.Add("Randomize", TreeViewContextMenu_Randomize_onClick); folderBrowser.ContextMenu = treeViewContextMenu; //Dialogs fullScreen = new FullScreen(pictureBox, this); settings = new Settings(this); // Mode Setup mode = Modes.Browse; browseToolStripMenuItem.Checked = true; browseToolStripMenuItem.Tag = Modes.Browse; organizeToolStripMenuItem.Tag = Modes.Organize; randomizeToolStripMenuItem.Tag = Modes.Randomize; // Load Images images = new Images(directory); // TreeView Setup folderBrowser.Nodes.Clear(); favorites = new TreeNode("Favorites") { Tag = "" }; folderBrowser.Nodes.Add(favorites); ListDirectory(folderBrowser); }
public override void Show() { // Modifier panel.Controls.Add(new Label { Text = "Modifier:", TextAlign = ContentAlignment.MiddleRight, Width = 47 }); CheckBox checkBox; panel.Controls.Add(checkBox = new CheckBox { Text = "Ctrl", Width = 47, Tag = Keys.Control }); checkBox.CheckedChanged += CheckBox_CheckedChanged; panel.Controls.Add(checkBox = new CheckBox { Text = "Alt", Width = 47, Tag = Keys.Alt }); checkBox.CheckedChanged += CheckBox_CheckedChanged; panel.Controls.Add(checkBox = new CheckBox { Text = "Shift", Width = 47, Tag = Keys.Shift }); checkBox.CheckedChanged += CheckBox_CheckedChanged; ((FlowLayoutPanel)panel).SetFlowBreak(checkBox, true); // Mode panel.Controls.Add(new Label { Text = "Mode:", TextAlign = ContentAlignment.MiddleRight, Width = 47 }); panel.Controls.Add(currentMode = new ComboBox() { Tag = Keys.M }); foreach (Modes mode in Enum.GetValues(typeof(Modes))) { currentMode.Items.Add(mode); } currentMode.SelectedIndex = 0; currentMode.SelectedIndexChanged += ComboBox_ModeChanged; ((FlowLayoutPanel)panel).SetFlowBreak(currentMode, true); // Key panel.Controls.Add(new Label { Text = "Key:", TextAlign = ContentAlignment.MiddleRight, Width = 47 }); List <HotkeySettings> hotkeySettingsList = new List <HotkeySettings>(); foreach (Keys key in DataExtensions.GetCommonKeysAndButtons()) { hotkeySettingsList.Add(new HotkeySettings(key)); } hotkeys = new ComboBox(); hotkeys.SelectedIndexChanged += LoadHotkeySettings; hotkeys.DataSource = hotkeySettingsList; hotkeys.DisplayMember = "Name"; panel.Controls.Add(hotkeys); ((FlowLayoutPanel)panel).SetFlowBreak(hotkeys, true); // Radio selections HotkeySettings hotkeySettings = (HotkeySettings)hotkeys.SelectedItem; RadioButton radioButton; panel.Controls.Add(radioButton = new RadioButton { Text = "None", Tag = Actions.None }); ((FlowLayoutPanel)panel).SetFlowBreak(radioButton, true); panel.Controls.Add(radioButton = new RadioButton { Text = "Move selected file to ", Tag = Actions.Move }); panel.Controls.Add(textBox_Move = new TextBox { Text = "...", Tag = Actions.Move }); ((FlowLayoutPanel)panel).SetFlowBreak(textBox_Move, true); panel.Controls.Add(new RadioButton { Text = "Copy", Tag = Actions.Copy, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(new RadioButton { Text = "Copy data", Tag = Actions.CopyData, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(radioButton = new RadioButton { Text = "Cut", Tag = Actions.Cut, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); ((FlowLayoutPanel)panel).SetFlowBreak(radioButton, true); panel.Controls.Add(new RadioButton { Text = "Delete", Tag = Actions.Delete, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(checkBox = new CheckBox { Text = "Permanent", Tag = Actions.Delete, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); ((FlowLayoutPanel)panel).SetFlowBreak(checkBox, true); panel.Controls.Add(new RadioButton { Text = "Select all", Tag = Actions.SelectAll, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(new RadioButton { Text = "All previous", Tag = Actions.SelectAllPrevious, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(new RadioButton { Text = "All following", Tag = Actions.SelectAllFollowing, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(new RadioButton { Text = "Fullscreen", Tag = Actions.FullScreen, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(new RadioButton { Text = "Next", Tag = Actions.NextFile, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); panel.Controls.Add(radioButton = new RadioButton { Text = "Previous", Tag = Actions.PreviousFile, AutoSize = true, AutoEllipsis = false, Anchor = AnchorStyles.None }); ((FlowLayoutPanel)panel).SetFlowBreak(radioButton, true); panel.Controls.Add(new RadioButton { Text = "Skip", Tag = Actions.Skip, AutoSize = true, AutoEllipsis = false }); panel.Controls.Add(textBox_Skip = new NumericUpDown { Value = 1, Tag = Actions.Skip }); ((FlowLayoutPanel)panel).SetFlowBreak(textBox_Skip, true); panel.Controls.Add(new RadioButton { Text = "Up Directory", Tag = Actions.UpDirectory, AutoSize = true, AutoEllipsis = false }); panel.Controls.Add(new RadioButton { Text = "Next Directory", Tag = Actions.NextDirectory, AutoSize = true, AutoEllipsis = false }); panel.Controls.Add(new RadioButton { Text = "Previous Directory", Tag = Actions.PreviousDirectory, AutoSize = true, AutoEllipsis = false }); panel.Controls.Add(radioButton = new RadioButton { Text = "Rename", Tag = Actions.Rename }); ((FlowLayoutPanel)panel).SetFlowBreak(radioButton, true); panel.Controls.Add(new RadioButton { Text = "Open with", Tag = Actions.Open, AutoSize = true, AutoEllipsis = false }); panel.Controls.Add(textBox_Open = new TextBox { Text = "...", Tag = Actions.Open }); panel.Controls.Add(exeDialogButton = new Button { Text = "...", Tag = Actions.Open, AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, AutoEllipsis = false }); ((FlowLayoutPanel)panel).SetFlowBreak(exeDialogButton, true); panel.Controls.Add(new RadioButton { Text = "Set mode", Tag = Actions.Mode, AutoSize = true, AutoEllipsis = false }); panel.Controls.Add(textBox_Mode = new ComboBox() { Tag = Actions.Mode }); foreach (Modes mode in Enum.GetValues(typeof(Modes))) { textBox_Mode.Items.Add(mode); } ((FlowLayoutPanel)panel).SetFlowBreak(textBox_Mode, true); panel.Controls.Add(radioButton = new RadioButton { Text = "Undo", Tag = Actions.Undo }); ((FlowLayoutPanel)panel).SetFlowBreak(radioButton, true); Button button; panel.Controls.Add(button = new Button { Text = "Save" }); button.MouseClick += SaveHotkeySettings; panel.Controls.Add(new CheckBox { Text = "For All Modes", Tag = Keys.A, AutoSize = true, AutoEllipsis = false }); panel.Layout += new LayoutEventHandler(SettingsLayoutPanel_Layout); // Load the initial hotkey LoadHotkeySettings(hotkeys, null); }