diff --git a/DisplayMagician/Properties/AssemblyInfo.cs b/DisplayMagician/Properties/AssemblyInfo.cs index 697a391..f5de862 100644 --- a/DisplayMagician/Properties/AssemblyInfo.cs +++ b/DisplayMagician/Properties/AssemblyInfo.cs @@ -26,8 +26,8 @@ using System.Resources; [assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")] // Version information -[assembly: AssemblyVersion("2.1.0.228")] -[assembly: AssemblyFileVersion("2.1.0.228")] +[assembly: AssemblyVersion("2.1.0.239")] +[assembly: AssemblyFileVersion("2.1.0.239")] [assembly: NeutralResourcesLanguageAttribute( "en" )] [assembly: CLSCompliant(true)] diff --git a/DisplayMagician/UIForms/ShortcutForm.Designer.cs b/DisplayMagician/UIForms/ShortcutForm.Designer.cs index 723267c..58581f1 100644 --- a/DisplayMagician/UIForms/ShortcutForm.Designer.cs +++ b/DisplayMagician/UIForms/ShortcutForm.Designer.cs @@ -93,6 +93,7 @@ namespace DisplayMagician.UIForms this.rb_standalone = new System.Windows.Forms.RadioButton(); this.rb_no_game = new System.Windows.Forms.RadioButton(); this.p_game = new System.Windows.Forms.Panel(); + this.btn_refresh_games_list = new System.Windows.Forms.Button(); this.btn_choose_game_icon = new System.Windows.Forms.Button(); this.pb_game_icon = new System.Windows.Forms.PictureBox(); this.lbl_no_game_libraries = new System.Windows.Forms.Label(); @@ -132,7 +133,6 @@ namespace DisplayMagician.UIForms this.cb_autosuggest = new System.Windows.Forms.CheckBox(); this.btn_hotkey = new System.Windows.Forms.Button(); this.lbl_hotkey_assigned = new System.Windows.Forms.Label(); - this.btn_refresh_games_list = new System.Windows.Forms.Button(); this.tabc_shortcut.SuspendLayout(); this.tabp_display.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit(); @@ -996,6 +996,22 @@ namespace DisplayMagician.UIForms this.p_game.Size = new System.Drawing.Size(1076, 389); this.p_game.TabIndex = 7; // + // btn_refresh_games_list + // + this.btn_refresh_games_list.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btn_refresh_games_list.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed; + this.btn_refresh_games_list.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown; + this.btn_refresh_games_list.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btn_refresh_games_list.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_refresh_games_list.ForeColor = System.Drawing.Color.White; + this.btn_refresh_games_list.Location = new System.Drawing.Point(950, 162); + this.btn_refresh_games_list.Name = "btn_refresh_games_list"; + this.btn_refresh_games_list.Size = new System.Drawing.Size(117, 25); + this.btn_refresh_games_list.TabIndex = 42; + this.btn_refresh_games_list.Text = "Refresh Games List"; + this.btn_refresh_games_list.UseVisualStyleBackColor = true; + this.btn_refresh_games_list.Click += new System.EventHandler(this.btn_refresh_games_list_Click); + // // btn_choose_game_icon // this.btn_choose_game_icon.Enabled = false; @@ -1491,22 +1507,6 @@ namespace DisplayMagician.UIForms this.lbl_hotkey_assigned.Visible = false; this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click); // - // btn_refresh_games_list - // - this.btn_refresh_games_list.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btn_refresh_games_list.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed; - this.btn_refresh_games_list.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown; - this.btn_refresh_games_list.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btn_refresh_games_list.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btn_refresh_games_list.ForeColor = System.Drawing.Color.White; - this.btn_refresh_games_list.Location = new System.Drawing.Point(950, 162); - this.btn_refresh_games_list.Name = "btn_refresh_games_list"; - this.btn_refresh_games_list.Size = new System.Drawing.Size(117, 25); - this.btn_refresh_games_list.TabIndex = 42; - this.btn_refresh_games_list.Text = "Refresh Games List"; - this.btn_refresh_games_list.UseVisualStyleBackColor = true; - this.btn_refresh_games_list.Click += new System.EventHandler(this.btn_refresh_games_list_Click); - // // ShortcutForm // this.AcceptButton = this.btn_save; diff --git a/DisplayMagician/UIForms/ShortcutForm.cs b/DisplayMagician/UIForms/ShortcutForm.cs index 3726b8d..dcb6cfa 100644 --- a/DisplayMagician/UIForms/ShortcutForm.cs +++ b/DisplayMagician/UIForms/ShortcutForm.cs @@ -61,15 +61,16 @@ namespace DisplayMagician.UIForms //private string _userExeIconPath = ""; private List _availableImages = new List(); private ShortcutBitmap _selectedImage = new ShortcutBitmap(); + private bool _firstShow = true; private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); - public ShortcutForm(ShortcutItem shortcutToEdit, bool editingExistingShortcut = false) + public ShortcutForm() { InitializeComponent(); Program.AppSplashScreen = new LoadingForm(); Program.AppSplashScreen.Title = "Preparing images..."; - Program.AppSplashScreen.Description = "Preparing images before showing you the Shortcut information. You will be able to swap your shortcut icon to any image you want, or choose one from a list."; + Program.AppSplashScreen.Description = "Preparing images before showing you the Shortcut information. You will be able to swap your shortcut icon to any image you want, or choose one from a list."; var splashThread = new Thread(new ThreadStart( () => Application.Run(Program.AppSplashScreen))); splashThread.SetApartmentState(ApartmentState.STA); @@ -82,9 +83,6 @@ namespace DisplayMagician.UIForms _profileAdaptor = new ProfileAdaptor(); _gameAdaptor = new GameAdaptor(); - _editingExistingShortcut = editingExistingShortcut; - _shortcutToEdit = shortcutToEdit; - // Style the Saved Profiles list ilv_saved_profiles.MultiSelect = false; ilv_saved_profiles.ThumbnailSize = new Size(100, 100); @@ -126,6 +124,7 @@ namespace DisplayMagician.UIForms public ShortcutItem Shortcut { get => _shortcutToEdit; + set => _shortcutToEdit = value; } public bool EditingExistingShortcut @@ -940,22 +939,63 @@ namespace DisplayMagician.UIForms } } - private void ShortcutForm_Load(object sender, EventArgs e) + private void ClearForm() + { + // Clear the textboxes + txt_alternative_executable.Text = ""; + txt_alternative_game.Text = ""; + txt_args_executable.Text = ""; + txt_args_game.Text = ""; + txt_executable.Text = ""; + txt_game_name.Text = "Please select a game from the list below..."; + txt_run_cmd_afterwards.Text = ""; + txt_run_cmd_afterwards_args.Text = ""; + txt_shortcut_save_name.Text = ""; + + // Set the radio buttons to default + rb_no_change_audio.Checked = true; + rb_change_audio.Checked = false; + rb_keep_audio_volume.Checked = true; + rb_set_audio_volume.Checked = false; + rb_change_capture.Checked = false; + rb_keep_capture_volume.Checked = false; + rb_no_change_capture.Checked = true; + rb_set_capture_volume.Checked = false; + + // Set the game mode on load + rb_launcher.Checked = true; + rb_no_game.Checked = false; + rb_standalone.Checked = false; + + // Set the checkboxes + cb_args_executable.Checked = false; + cb_args_game.Checked = false; + cb_autosuggest.Checked = true; + cb_run_cmd_afterwards.Checked = false; + cb_run_cmd_afterwards_args.Checked = false; + cb_wait_alternative_game.Checked = false; + + // Wipe the pictureboxes if they're in use + if (pb_exe_icon.Image != null) + { + pb_exe_icon.Image = null; + } + if (pb_game_icon.Image != null) + { + pb_game_icon.Image = null; + } + } + + private void LoadShortcut() { Game shortcutGame = null; - - // Parse the game bitmaps now the first time as we need them - // We need to add a refresh button to the shortcut page now! - if (!GameLibraries.GameLibrary.GamesImagesLoaded) - { - GameLibraries.GameLibrary.RefreshGameBitmaps(); - } - // Load all the profiles to prepare things bool foundChosenProfileInLoadedProfiles = false; ProfileItem chosenProfile = null; + ClearForm(); + // Prepare the Game process priority combo box cbx_game_priority.DataSource = new ComboItem[] { new ComboItem{ Value = ProcessPriority.High, Text = "High" }, @@ -982,6 +1022,9 @@ namespace DisplayMagician.UIForms cbx_exe_priority.SelectedIndex = 2; //Normal cbx_exe_priority.Enabled = true; + // Empty the selected game in case this is a reload + txt_alternative_executable.Text = ""; + // Populate all the Audio devices in the audio devices list. // Set the Audio device to the shortcut audio device only if // the Change Audio radiobutton is set @@ -1400,11 +1443,11 @@ namespace DisplayMagician.UIForms { txt_shortcut_save_name.Text = _shortcutToEdit.Name; } - + // Set the selected image and available images (originalBitmap is set during shortcut update) - - + + if (_editingExistingShortcut) { ShortcutBitmap defaultBitmap = new ShortcutBitmap(); @@ -1436,12 +1479,12 @@ namespace DisplayMagician.UIForms // If the game is selected, then grab images from the game if (shortcutGame != null) { - _availableImages.AddRange(ImageUtils.GetMeAllBitmapsFromFile(shortcutGame.IconPath)); + _availableImages.AddRange(ImageUtils.GetMeAllBitmapsFromFile(shortcutGame.IconPath)); if (shortcutGame.ExePath != shortcutGame.IconPath) { _availableImages.AddRange(ImageUtils.GetMeAllBitmapsFromFile(shortcutGame.ExePath)); } - + } // If the different exe to monitor is set, then grab the icons from there too! if (!String.IsNullOrWhiteSpace(_shortcutToEdit.DifferentGameExeToMonitor) && File.Exists(_shortcutToEdit.DifferentGameExeToMonitor)) @@ -1567,8 +1610,8 @@ namespace DisplayMagician.UIForms btn_choose_exe_icon.Enabled = true; } } - } - } + } + } else { // We're editing a new shortcut, so no game or anything selected @@ -1578,7 +1621,7 @@ namespace DisplayMagician.UIForms if (_shortcutToEdit.StartPrograms is List && _shortcutToEdit.StartPrograms.Count > 0) { flp_start_programs.Controls.Clear(); - + Padding firstStartProgramMargin = new Padding(10) { }; Padding otherStartProgramMargin = new Padding(10, 0, 10, 10) { }; @@ -1592,7 +1635,7 @@ namespace DisplayMagician.UIForms continue; } - StartProgramControl startProgramControl = new StartProgramControl(myStartProgram,spOrder); + StartProgramControl startProgramControl = new StartProgramControl(myStartProgram, spOrder); startProgramControl.Dock = DockStyle.None; if (spOrder == 1) { @@ -1601,7 +1644,7 @@ namespace DisplayMagician.UIForms else { startProgramControl.Margin = otherStartProgramMargin; - } + } startProgramControl.Width = flp_start_programs.Width - 40; startProgramControl.MouseDown += new MouseEventHandler(StartProgramControl_MouseDown); startProgramControl.DragOver += new DragEventHandler(StartProgramControl_DragOver); @@ -1615,13 +1658,13 @@ namespace DisplayMagician.UIForms // Setup the single stop program we're beginning with if (_shortcutToEdit.StopPrograms is List && _shortcutToEdit.StopPrograms.Count > 0) { - cb_run_cmd_afterwards.Checked = true; + cb_run_cmd_afterwards.Checked = true; txt_run_cmd_afterwards.Text = _shortcutToEdit.StopPrograms[0].Executable; if (_shortcutToEdit.StopPrograms[0].ExecutableArgumentsRequired) { cb_run_cmd_afterwards_args.Checked = true; txt_run_cmd_afterwards_args.Text = _shortcutToEdit.StopPrograms[0].Arguments; - } + } } else { @@ -1639,8 +1682,26 @@ namespace DisplayMagician.UIForms // Finally enable the save button if it's still valid EnableSaveButtonIfValid(); - // Close the splash screen - CloseTheSplashScreen(); + } + + private void ShortcutForm_Load(object sender, EventArgs e) + { + if (_firstShow) + { + // Parse the game bitmaps now the first time as we need them + // We need to add a refresh button to the shortcut page now! + if (!GameLibraries.GameLibrary.GamesImagesLoaded) + { + GameLibraries.GameLibrary.RefreshGameBitmaps(); + } + + // Close the splash screen + CloseTheSplashScreen(); + _firstShow = false; + } + // Load the shortcut info + LoadShortcut(); + } @@ -2870,6 +2931,7 @@ namespace DisplayMagician.UIForms MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } + } // Class used to populate combo boxes diff --git a/DisplayMagician/UIForms/ShortcutLibraryForm.Designer.cs b/DisplayMagician/UIForms/ShortcutLibraryForm.Designer.cs index 2595b0f..a2bfe9a 100644 --- a/DisplayMagician/UIForms/ShortcutLibraryForm.Designer.cs +++ b/DisplayMagician/UIForms/ShortcutLibraryForm.Designer.cs @@ -219,7 +219,7 @@ this.tsmi_copy, this.tsmi_delete}); this.cms_shortcuts.Name = "cms_shortcuts"; - this.cms_shortcuts.Size = new System.Drawing.Size(216, 136); + this.cms_shortcuts.Size = new System.Drawing.Size(216, 114); // // tsmi_edit // diff --git a/DisplayMagician/UIForms/ShortcutLibraryForm.cs b/DisplayMagician/UIForms/ShortcutLibraryForm.cs index 45ee921..c09dcbb 100644 --- a/DisplayMagician/UIForms/ShortcutLibraryForm.cs +++ b/DisplayMagician/UIForms/ShortcutLibraryForm.cs @@ -265,11 +265,15 @@ namespace DisplayMagician.UIForms private void btn_new_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; + ShortcutItem si = new ShortcutItem(); if (_shortcutForm == null) { - _shortcutForm = new ShortcutForm(new ShortcutItem(), false); - } - //ShortcutRepository.IsValidRefresh(); + _shortcutForm = new ShortcutForm(); + } + //ShortcutRepository.IsValidRefresh() + // Set the Shortcut to as a new shortcut + _shortcutForm.Shortcut = si; + _shortcutForm.EditingExistingShortcut = false; _shortcutForm.ShowDialog(this); if (_shortcutForm.DialogResult == DialogResult.OK) { @@ -317,7 +321,12 @@ namespace DisplayMagician.UIForms this.Cursor = Cursors.WaitCursor; - _shortcutForm = new ShortcutForm(_selectedShortcut,true); + if (_shortcutForm == null) + { + _shortcutForm = new ShortcutForm(); + } + _shortcutForm.Shortcut = _selectedShortcut; + _shortcutForm.EditingExistingShortcut = true; //ilv_saved_shortcuts.SuspendLayout(); _shortcutForm.ShowDialog(this); if (_shortcutForm.DialogResult == DialogResult.OK)