diff --git a/PC3Player/PC3Player/AdvancedSettingsForm.Designer.cs b/PC3Player/PC3Player/AdvancedSettingsForm.Designer.cs index 14412a6..86739b4 100644 --- a/PC3Player/PC3Player/AdvancedSettingsForm.Designer.cs +++ b/PC3Player/PC3Player/AdvancedSettingsForm.Designer.cs @@ -30,6 +30,7 @@ { components = new System.ComponentModel.Container(); PlaylistPlaybackGroupBox = new GroupBox(); + LoopCheckBox = new CheckBox(); IntermissionUnitDropDown = new ComboBox(); IntermissionTimeCounter = new NumericUpDown(); IntermissionCheckBox = new CheckBox(); @@ -83,6 +84,13 @@ SaveButton = new Button(); CancelButton = new Button(); SelectShowFileDialog = new OpenFileDialog(); + PlaybackGroupBox = new GroupBox(); + label20 = new Label(); + label19 = new Label(); + label18 = new Label(); + ResyncTimeOption = new NumericUpDown(); + FrameShiftOption = new NumericUpDown(); + FrameSkipOption = new NumericUpDown(); PlaylistPlaybackGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)IntermissionTimeCounter).BeginInit(); ShowSelectorGroupBox.SuspendLayout(); @@ -90,10 +98,15 @@ ShowSelectorAssignmentGroupBox.SuspendLayout(); AssignmentPanel.SuspendLayout(); SkitContextMenu.SuspendLayout(); + PlaybackGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)ResyncTimeOption).BeginInit(); + ((System.ComponentModel.ISupportInitialize)FrameShiftOption).BeginInit(); + ((System.ComponentModel.ISupportInitialize)FrameSkipOption).BeginInit(); SuspendLayout(); // // PlaylistPlaybackGroupBox // + PlaylistPlaybackGroupBox.Controls.Add(LoopCheckBox); PlaylistPlaybackGroupBox.Controls.Add(IntermissionUnitDropDown); PlaylistPlaybackGroupBox.Controls.Add(IntermissionTimeCounter); PlaylistPlaybackGroupBox.Controls.Add(IntermissionCheckBox); @@ -103,11 +116,21 @@ PlaylistPlaybackGroupBox.Controls.Add(PlaylistStartedDropDown); PlaylistPlaybackGroupBox.Location = new Point(12, 12); PlaylistPlaybackGroupBox.Name = "PlaylistPlaybackGroupBox"; - PlaylistPlaybackGroupBox.Size = new Size(350, 110); + PlaylistPlaybackGroupBox.Size = new Size(350, 138); PlaylistPlaybackGroupBox.TabIndex = 0; PlaylistPlaybackGroupBox.TabStop = false; PlaylistPlaybackGroupBox.Text = "Playlist Playback"; // + // LoopCheckBox + // + LoopCheckBox.AutoSize = true; + LoopCheckBox.Location = new Point(6, 111); + LoopCheckBox.Name = "LoopCheckBox"; + LoopCheckBox.Size = new Size(162, 19); + LoopCheckBox.TabIndex = 5; + LoopCheckBox.Text = "Loop when Playlist is over"; + LoopCheckBox.UseVisualStyleBackColor = true; + // // IntermissionUnitDropDown // IntermissionUnitDropDown.DropDownStyle = ComboBoxStyle.DropDownList; @@ -188,7 +211,7 @@ ShowSelectorGroupBox.Controls.Add(SelectedShowEndDropDown); ShowSelectorGroupBox.Controls.Add(label4); ShowSelectorGroupBox.Controls.Add(ButtonPressDropDown); - ShowSelectorGroupBox.Location = new Point(12, 128); + ShowSelectorGroupBox.Location = new Point(12, 156); ShowSelectorGroupBox.Name = "ShowSelectorGroupBox"; ShowSelectorGroupBox.Size = new Size(350, 165); ShowSelectorGroupBox.TabIndex = 1; @@ -319,7 +342,7 @@ ShowSelectorAssignmentGroupBox.Location = new Point(368, 12); ShowSelectorAssignmentGroupBox.Name = "ShowSelectorAssignmentGroupBox"; ShowSelectorAssignmentGroupBox.Size = new Size(256, 370); - ShowSelectorAssignmentGroupBox.TabIndex = 2; + ShowSelectorAssignmentGroupBox.TabIndex = 3; ShowSelectorAssignmentGroupBox.TabStop = false; ShowSelectorAssignmentGroupBox.Text = "Show Selector Assignment"; // @@ -577,11 +600,11 @@ SkitListView.ContextMenuStrip = SkitContextMenu; SkitListView.GridLines = true; SkitListView.HeaderStyle = ColumnHeaderStyle.Nonclickable; - SkitListView.Location = new Point(12, 299); + SkitListView.Location = new Point(12, 327); SkitListView.MultiSelect = false; SkitListView.Name = "SkitListView"; - SkitListView.Size = new Size(350, 150); - SkitListView.TabIndex = 3; + SkitListView.Size = new Size(350, 201); + SkitListView.TabIndex = 2; SkitListView.UseCompatibleStateImageBehavior = false; SkitListView.View = View.Details; // @@ -610,7 +633,7 @@ // SaveButton // SaveButton.DialogResult = DialogResult.OK; - SaveButton.Location = new Point(549, 424); + SaveButton.Location = new Point(549, 503); SaveButton.Name = "SaveButton"; SaveButton.Size = new Size(75, 25); SaveButton.TabIndex = 10; @@ -621,7 +644,7 @@ // CancelButton // CancelButton.DialogResult = DialogResult.Cancel; - CancelButton.Location = new Point(468, 424); + CancelButton.Location = new Point(468, 503); CancelButton.Name = "CancelButton"; CancelButton.Size = new Size(75, 25); CancelButton.TabIndex = 11; @@ -633,11 +656,83 @@ SelectShowFileDialog.Filter = "UST Showtapes|*.ust"; SelectShowFileDialog.Multiselect = true; // + // PlaybackGroupBox + // + PlaybackGroupBox.Controls.Add(label20); + PlaybackGroupBox.Controls.Add(label19); + PlaybackGroupBox.Controls.Add(label18); + PlaybackGroupBox.Controls.Add(ResyncTimeOption); + PlaybackGroupBox.Controls.Add(FrameShiftOption); + PlaybackGroupBox.Controls.Add(FrameSkipOption); + PlaybackGroupBox.Location = new Point(368, 388); + PlaybackGroupBox.Name = "PlaybackGroupBox"; + PlaybackGroupBox.Size = new Size(256, 109); + PlaybackGroupBox.TabIndex = 4; + PlaybackGroupBox.TabStop = false; + PlaybackGroupBox.Text = "Tracking Adjustments"; + // + // label20 + // + label20.AutoSize = true; + label20.Location = new Point(6, 82); + label20.Name = "label20"; + label20.Size = new Size(67, 15); + label20.TabIndex = 5; + label20.Text = "Frame Shift"; + // + // label19 + // + label19.AutoSize = true; + label19.Location = new Point(6, 53); + label19.Name = "label19"; + label19.Size = new Size(73, 15); + label19.TabIndex = 4; + label19.Text = "Resync Time"; + // + // label18 + // + label18.AutoSize = true; + label18.Location = new Point(6, 24); + label18.Name = "label18"; + label18.Size = new Size(65, 15); + label18.TabIndex = 3; + label18.Text = "Frame Skip"; + // + // ResyncTimeOption + // + ResyncTimeOption.Location = new Point(200, 51); + ResyncTimeOption.Maximum = new decimal(new int[] { 60, 0, 0, 0 }); + ResyncTimeOption.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + ResyncTimeOption.Name = "ResyncTimeOption"; + ResyncTimeOption.Size = new Size(50, 23); + ResyncTimeOption.TabIndex = 1; + ResyncTimeOption.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // FrameShiftOption + // + FrameShiftOption.Location = new Point(200, 80); + FrameShiftOption.Maximum = new decimal(new int[] { 60, 0, 0, 0 }); + FrameShiftOption.Minimum = new decimal(new int[] { 60, 0, 0, int.MinValue }); + FrameShiftOption.Name = "FrameShiftOption"; + FrameShiftOption.Size = new Size(50, 23); + FrameShiftOption.TabIndex = 2; + // + // FrameSkipOption + // + FrameSkipOption.Location = new Point(200, 22); + FrameSkipOption.Maximum = new decimal(new int[] { 10, 0, 0, 0 }); + FrameSkipOption.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + FrameSkipOption.Name = "FrameSkipOption"; + FrameSkipOption.Size = new Size(50, 23); + FrameSkipOption.TabIndex = 0; + FrameSkipOption.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // // AdvancedSettingsForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(636, 461); + ClientSize = new Size(636, 540); + Controls.Add(PlaybackGroupBox); Controls.Add(CancelButton); Controls.Add(SaveButton); Controls.Add(SkitListView); @@ -658,6 +753,11 @@ ShowSelectorAssignmentGroupBox.PerformLayout(); AssignmentPanel.ResumeLayout(false); SkitContextMenu.ResumeLayout(false); + PlaybackGroupBox.ResumeLayout(false); + PlaybackGroupBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)ResyncTimeOption).EndInit(); + ((System.ComponentModel.ISupportInitialize)FrameShiftOption).EndInit(); + ((System.ComponentModel.ISupportInitialize)FrameSkipOption).EndInit(); ResumeLayout(false); } @@ -717,5 +817,13 @@ private ToolStripMenuItem RemoveButton; private OpenFileDialog SelectShowFileDialog; private Panel AssignmentPanel; + private CheckBox LoopCheckBox; + private GroupBox PlaybackGroupBox; + private Label label18; + private NumericUpDown ResyncTimeOption; + private NumericUpDown FrameShiftOption; + private NumericUpDown FrameSkipOption; + private Label label20; + private Label label19; } } \ No newline at end of file diff --git a/PC3Player/PC3Player/AdvancedSettingsForm.cs b/PC3Player/PC3Player/AdvancedSettingsForm.cs index 85b635f..59d0df6 100644 --- a/PC3Player/PC3Player/AdvancedSettingsForm.cs +++ b/PC3Player/PC3Player/AdvancedSettingsForm.cs @@ -13,6 +13,7 @@ IntermissionCheckBox.Checked = EditingObject.PlaylistIntermissionOption; IntermissionTimeCounter.Value = EditingObject.PlaylistIntermissionTimeOption; IntermissionUnitDropDown.SelectedIndex = EditingObject.PlaylistIntermissionUnitOption; + LoopCheckBox.Checked = EditingObject.PlaylistLoopOption; ButtonPressDropDown.SelectedIndex = EditingObject.SelectorButtonPressOption; AlreadyPlayingDropDown.SelectedIndex = EditingObject.SelectorShowAlreadyPlayingOption; @@ -22,6 +23,10 @@ CooldownUnitDropDown.SelectedIndex = EditingObject.SelectorCooldownUnitOption; SkitCheckBox.Checked = EditingObject.SelectorPlaySkitOption; + FrameSkipOption.Value = EditingObject.FramesPerTick; + FrameShiftOption.Value = EditingObject.FrameShift; + ResyncTimeOption.Value = EditingObject.ResyncSeconds; + IntermissionTimeCounter.Enabled = IntermissionCheckBox.Checked; IntermissionUnitDropDown.Enabled = IntermissionCheckBox.Checked; @@ -115,6 +120,7 @@ EditingObject.PlaylistIntermissionOption = IntermissionCheckBox.Checked; EditingObject.PlaylistIntermissionTimeOption = (int)IntermissionTimeCounter.Value; EditingObject.PlaylistIntermissionUnitOption = IntermissionUnitDropDown.SelectedIndex; + EditingObject.PlaylistLoopOption = LoopCheckBox.Checked; EditingObject.SelectorButtonPressOption = ButtonPressDropDown.SelectedIndex; EditingObject.SelectorShowAlreadyPlayingOption = AlreadyPlayingDropDown.SelectedIndex; @@ -124,6 +130,10 @@ EditingObject.SelectorCooldownUnitOption = CooldownUnitDropDown.SelectedIndex; EditingObject.SelectorPlaySkitOption = SkitCheckBox.Checked; + EditingObject.ResyncSeconds = (int)ResyncTimeOption.Value; + EditingObject.FrameShift = (int)FrameShiftOption.Value; + EditingObject.FramesPerTick = (int)FrameSkipOption.Value; + int i = 0; foreach (ComboBox c in AssignmentPanel.Controls) { diff --git a/PC3Player/PC3Player/DataTypes.cs b/PC3Player/PC3Player/DataTypes.cs index 9691e36..353eb32 100644 --- a/PC3Player/PC3Player/DataTypes.cs +++ b/PC3Player/PC3Player/DataTypes.cs @@ -1,4 +1,6 @@ -namespace PC3Player +using System.Diagnostics.Eventing.Reader; + +namespace PC3Player { public class PlaylistShow { @@ -39,6 +41,7 @@ public bool PlaylistIntermissionOption { get; set; } = false; public int PlaylistIntermissionTimeOption { get; set; } = 8; public int PlaylistIntermissionUnitOption { get; set; } = 0; + public bool PlaylistLoopOption { get; set; } = true; public int SelectorButtonPressOption { get; set; } = 0; public int SelectorShowAlreadyPlayingOption { get; set; } = 0; diff --git a/PC3Player/PC3Player/MainForm.Designer.cs b/PC3Player/PC3Player/MainForm.Designer.cs index 29de596..377a583 100644 --- a/PC3Player/PC3Player/MainForm.Designer.cs +++ b/PC3Player/PC3Player/MainForm.Designer.cs @@ -60,6 +60,7 @@ SelectMappingFileDialog = new OpenFileDialog(); SavePlaylistFileDialog = new SaveFileDialog(); OpenPlaylistFileDialog = new OpenFileDialog(); + NewPlaylistButton = new Button(); ControllerGroupBox.SuspendLayout(); PlaybackControlsGroupBox.SuspendLayout(); ShowSelectorGroupBox.SuspendLayout(); @@ -74,7 +75,7 @@ ControllerGroupBox.Controls.Add(ControllerAutoDetectButton); ControllerGroupBox.Location = new Point(12, 12); ControllerGroupBox.Name = "ControllerGroupBox"; - ControllerGroupBox.Size = new Size(236, 84); + ControllerGroupBox.Size = new Size(256, 84); ControllerGroupBox.TabIndex = 0; ControllerGroupBox.TabStop = false; ControllerGroupBox.Text = "Controller: Not Connected"; @@ -83,7 +84,7 @@ // ControllerSelectSerialPortButton.Location = new Point(6, 53); ControllerSelectSerialPortButton.Name = "ControllerSelectSerialPortButton"; - ControllerSelectSerialPortButton.Size = new Size(224, 25); + ControllerSelectSerialPortButton.Size = new Size(244, 25); ControllerSelectSerialPortButton.TabIndex = 1; ControllerSelectSerialPortButton.Text = "Select Serial Port"; ControllerSelectSerialPortButton.UseVisualStyleBackColor = true; @@ -93,7 +94,7 @@ // ControllerAutoDetectButton.Location = new Point(6, 22); ControllerAutoDetectButton.Name = "ControllerAutoDetectButton"; - ControllerAutoDetectButton.Size = new Size(224, 25); + ControllerAutoDetectButton.Size = new Size(244, 25); ControllerAutoDetectButton.TabIndex = 0; ControllerAutoDetectButton.Text = "Auto Detect"; ControllerAutoDetectButton.UseVisualStyleBackColor = true; @@ -106,9 +107,9 @@ PlaybackControlsGroupBox.Controls.Add(SkipButton); PlaybackControlsGroupBox.Controls.Add(PauseButton); PlaybackControlsGroupBox.Controls.Add(StartButton); - PlaybackControlsGroupBox.Location = new Point(12, 344); + PlaybackControlsGroupBox.Location = new Point(12, 376); PlaybackControlsGroupBox.Name = "PlaybackControlsGroupBox"; - PlaybackControlsGroupBox.Size = new Size(236, 99); + PlaybackControlsGroupBox.Size = new Size(256, 99); PlaybackControlsGroupBox.TabIndex = 4; PlaybackControlsGroupBox.TabStop = false; PlaybackControlsGroupBox.Text = "Controls: Not Playing"; @@ -125,9 +126,9 @@ // StopButton // StopButton.Enabled = false; - StopButton.Location = new Point(121, 53); + StopButton.Location = new Point(131, 53); StopButton.Name = "StopButton"; - StopButton.Size = new Size(109, 25); + StopButton.Size = new Size(119, 25); StopButton.TabIndex = 3; StopButton.Text = "Stop"; StopButton.UseVisualStyleBackColor = true; @@ -138,7 +139,7 @@ SkipButton.Enabled = false; SkipButton.Location = new Point(6, 53); SkipButton.Name = "SkipButton"; - SkipButton.Size = new Size(109, 25); + SkipButton.Size = new Size(119, 25); SkipButton.TabIndex = 2; SkipButton.Text = "Skip"; SkipButton.UseVisualStyleBackColor = true; @@ -147,9 +148,9 @@ // PauseButton // PauseButton.Enabled = false; - PauseButton.Location = new Point(121, 22); + PauseButton.Location = new Point(131, 22); PauseButton.Name = "PauseButton"; - PauseButton.Size = new Size(109, 25); + PauseButton.Size = new Size(119, 25); PauseButton.TabIndex = 1; PauseButton.Text = "Pause"; PauseButton.UseVisualStyleBackColor = true; @@ -159,7 +160,7 @@ // StartButton.Location = new Point(6, 22); StartButton.Name = "StartButton"; - StartButton.Size = new Size(109, 25); + StartButton.Size = new Size(119, 25); StartButton.TabIndex = 0; StartButton.Text = "Start Playlist"; StartButton.UseVisualStyleBackColor = true; @@ -172,7 +173,7 @@ ShowSelectorGroupBox.Enabled = false; ShowSelectorGroupBox.Location = new Point(12, 102); ShowSelectorGroupBox.Name = "ShowSelectorGroupBox"; - ShowSelectorGroupBox.Size = new Size(236, 84); + ShowSelectorGroupBox.Size = new Size(256, 84); ShowSelectorGroupBox.TabIndex = 1; ShowSelectorGroupBox.TabStop = false; ShowSelectorGroupBox.Text = "Show Selector: Not Connected"; @@ -181,7 +182,7 @@ // ShowSelectorSelectPortButton.Location = new Point(6, 53); ShowSelectorSelectPortButton.Name = "ShowSelectorSelectPortButton"; - ShowSelectorSelectPortButton.Size = new Size(224, 25); + ShowSelectorSelectPortButton.Size = new Size(244, 25); ShowSelectorSelectPortButton.TabIndex = 1; ShowSelectorSelectPortButton.Text = "Select Serial Port"; ShowSelectorSelectPortButton.UseVisualStyleBackColor = true; @@ -191,7 +192,7 @@ // ShowSelectorAutoDetectButton.Location = new Point(6, 22); ShowSelectorAutoDetectButton.Name = "ShowSelectorAutoDetectButton"; - ShowSelectorAutoDetectButton.Size = new Size(224, 25); + ShowSelectorAutoDetectButton.Size = new Size(244, 25); ShowSelectorAutoDetectButton.TabIndex = 0; ShowSelectorAutoDetectButton.Text = "Auto Detect"; ShowSelectorAutoDetectButton.UseVisualStyleBackColor = true; @@ -199,22 +200,23 @@ // // PlaylistGroupBox // + PlaylistGroupBox.Controls.Add(NewPlaylistButton); PlaylistGroupBox.Controls.Add(AdvancedSettingsButton); PlaylistGroupBox.Controls.Add(AddShowButton); PlaylistGroupBox.Controls.Add(LoadPlaylistButton); PlaylistGroupBox.Controls.Add(SavePlaylistButton); PlaylistGroupBox.Location = new Point(12, 254); PlaylistGroupBox.Name = "PlaylistGroupBox"; - PlaylistGroupBox.Size = new Size(236, 84); + PlaylistGroupBox.Size = new Size(256, 116); PlaylistGroupBox.TabIndex = 3; PlaylistGroupBox.TabStop = false; PlaylistGroupBox.Text = "Playlist: Unsaved"; // // AdvancedSettingsButton // - AdvancedSettingsButton.Location = new Point(121, 22); + AdvancedSettingsButton.Location = new Point(131, 22); AdvancedSettingsButton.Name = "AdvancedSettingsButton"; - AdvancedSettingsButton.Size = new Size(109, 25); + AdvancedSettingsButton.Size = new Size(119, 25); AdvancedSettingsButton.TabIndex = 1; AdvancedSettingsButton.Text = "Advanced"; AdvancedSettingsButton.UseVisualStyleBackColor = true; @@ -224,7 +226,7 @@ // AddShowButton.Location = new Point(6, 22); AddShowButton.Name = "AddShowButton"; - AddShowButton.Size = new Size(109, 25); + AddShowButton.Size = new Size(119, 25); AddShowButton.TabIndex = 0; AddShowButton.Text = "Add Show"; AddShowButton.UseVisualStyleBackColor = true; @@ -232,9 +234,9 @@ // // LoadPlaylistButton // - LoadPlaylistButton.Location = new Point(121, 53); + LoadPlaylistButton.Location = new Point(131, 53); LoadPlaylistButton.Name = "LoadPlaylistButton"; - LoadPlaylistButton.Size = new Size(109, 25); + LoadPlaylistButton.Size = new Size(119, 25); LoadPlaylistButton.TabIndex = 3; LoadPlaylistButton.Text = "Load Playlist"; LoadPlaylistButton.UseVisualStyleBackColor = true; @@ -244,7 +246,7 @@ // SavePlaylistButton.Location = new Point(6, 53); SavePlaylistButton.Name = "SavePlaylistButton"; - SavePlaylistButton.Size = new Size(109, 25); + SavePlaylistButton.Size = new Size(119, 25); SavePlaylistButton.TabIndex = 2; SavePlaylistButton.Text = "Save Playlist"; SavePlaylistButton.UseVisualStyleBackColor = true; @@ -255,7 +257,7 @@ ChannelMappingGroupBox.Controls.Add(LoadChannelMapButton); ChannelMappingGroupBox.Location = new Point(12, 192); ChannelMappingGroupBox.Name = "ChannelMappingGroupBox"; - ChannelMappingGroupBox.Size = new Size(236, 56); + ChannelMappingGroupBox.Size = new Size(256, 56); ChannelMappingGroupBox.TabIndex = 2; ChannelMappingGroupBox.TabStop = false; ChannelMappingGroupBox.Text = "Channel Map: None Loaded"; @@ -264,7 +266,7 @@ // LoadChannelMapButton.Location = new Point(6, 22); LoadChannelMapButton.Name = "LoadChannelMapButton"; - LoadChannelMapButton.Size = new Size(224, 25); + LoadChannelMapButton.Size = new Size(244, 25); LoadChannelMapButton.TabIndex = 0; LoadChannelMapButton.Text = "Load Channel Map"; LoadChannelMapButton.UseVisualStyleBackColor = true; @@ -277,10 +279,10 @@ PlaylistListView.ContextMenuStrip = ShowContextMenu; PlaylistListView.GridLines = true; PlaylistListView.HeaderStyle = ColumnHeaderStyle.Nonclickable; - PlaylistListView.Location = new Point(254, 12); + PlaylistListView.Location = new Point(274, 12); PlaylistListView.MultiSelect = false; PlaylistListView.Name = "PlaylistListView"; - PlaylistListView.Size = new Size(400, 431); + PlaylistListView.Size = new Size(400, 463); PlaylistListView.TabIndex = 5; PlaylistListView.UseCompatibleStateImageBehavior = false; PlaylistListView.View = View.Details; @@ -338,11 +340,21 @@ // OpenPlaylistFileDialog.Filter = "PC3Player Playlists (JSON Files)|*.json"; // + // NewPlaylistButton + // + NewPlaylistButton.Location = new Point(6, 84); + NewPlaylistButton.Name = "NewPlaylistButton"; + NewPlaylistButton.Size = new Size(244, 25); + NewPlaylistButton.TabIndex = 4; + NewPlaylistButton.Text = "New Playlist"; + NewPlaylistButton.UseVisualStyleBackColor = true; + NewPlaylistButton.Click += NewPlaylistButton_Click; + // // MainForm // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(666, 455); + ClientSize = new Size(686, 487); Controls.Add(PlaylistListView); Controls.Add(ChannelMappingGroupBox); Controls.Add(PlaylistGroupBox); @@ -397,5 +409,6 @@ private SaveFileDialog SavePlaylistFileDialog; private OpenFileDialog OpenPlaylistFileDialog; private Label TimeLabel; + private Button NewPlaylistButton; } } diff --git a/PC3Player/PC3Player/MainForm.cs b/PC3Player/PC3Player/MainForm.cs index b3d4196..27aee6a 100644 --- a/PC3Player/PC3Player/MainForm.cs +++ b/PC3Player/PC3Player/MainForm.cs @@ -70,12 +70,6 @@ namespace PC3Player return; } - if (ChannelMappingLoaded) - { - MessageBox.Show("A Channel Map is already loaded.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; - } - if (SelectMappingFileDialog.ShowDialog() == DialogResult.OK) { string tempMappingData = File.ReadAllText(SelectMappingFileDialog.FileName); @@ -93,6 +87,19 @@ namespace PC3Player targetBits.Add(int.Parse(s)); } + if (ChannelMappingLoaded) + { + if (header[3] != Config.Mapping.Type) + { + MessageBox.Show( + $"Selected Channel Map \"{header[2]}\"'s type does not match the old Channel Map's type." + + $"\nOld Channel Map Type: {Config.Mapping.Type}" + + $"\nNew Channel Map Type: {header[3]}" + , "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + if (targetBits.Count != ControllerBits) { MessageBox.Show("The mapped channel count is not equal to the connected controller's bit count.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -117,7 +124,6 @@ namespace PC3Player ChannelMappingLoaded = true; ChannelMappingGroupBox.Text = $"Channel Map: {Config.Mapping.Name}"; - LoadChannelMapButton.Enabled = false; InvalidateSave = true; } } @@ -320,8 +326,8 @@ namespace PC3Player private void AdvancedSettingsButton_Click(object sender, EventArgs e) { AdvancedSettingsForm advancedSettingsForm = new AdvancedSettingsForm(Config); + if (Config != advancedSettingsForm.EditingObject) InvalidateSave = true; if (advancedSettingsForm.ShowDialog() == DialogResult.OK) Config = advancedSettingsForm.EditingObject; - InvalidateSave = true; } private void ShowSelectorAutoDetectButton_Click(object sender, EventArgs e) @@ -428,13 +434,14 @@ namespace PC3Player private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { + if (Playing) Stop(); if (InvalidateSave) if (MessageBox.Show( "You have an unsaved Playlist!\nDo you still want to exit?", "Unsaved Playlist", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation - ) == DialogResult.No) + ) != DialogResult.Yes) e.Cancel = true; } @@ -450,6 +457,18 @@ namespace PC3Player private void LoadPlaylistButton_Click(object sender, EventArgs e) { + if (Playing) + { + if (MessageBox.Show( + "A show is currently playing!\nPerforming this action will stop it.\nAre you sure?", + "Show Playing", + MessageBoxButtons.YesNo, + MessageBoxIcon.Exclamation + ) != DialogResult.Yes) + return; + Stop(); + } + if (!ControllerConnected) { MessageBox.Show("You must connect a Controller first."); @@ -462,7 +481,7 @@ namespace PC3Player "Unsaved Playlist", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation - ) == DialogResult.No) + ) != DialogResult.Yes) return; if (OpenPlaylistFileDialog.ShowDialog() == DialogResult.OK) @@ -491,7 +510,7 @@ namespace PC3Player return; } ChannelMappingGroupBox.Text = $"Channel Map: {tempConfig.Mapping.Name}"; - LoadChannelMapButton.Enabled = false; + ChannelMappingLoaded = true; } int showIndex = 0; @@ -636,6 +655,8 @@ namespace PC3Player private void SelectNextShowtape(StartMethod method) { + ShowtapeFrames = []; + ShowtapeIndex = 0; if (Config.Shows.Count() == 0) { MessageBox.Show("There are no shows in the playlist.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); @@ -659,7 +680,7 @@ namespace PC3Player willStartShow = true; break; case 1: - PlaylistIndex = SelectRandom.Next(Config.Shows.Count() - 1); + PlaylistIndex = SelectRandom.Next(Config.Shows.Count()); willStartShow = true; break; } @@ -668,29 +689,39 @@ namespace PC3Player if (Config.PlaylistIntermissionOption && (!bypassIntermission)) { Intermission = true; - IntermissionTotalTime = IntermissionSecondsLeft = Config.PlaylistIntermissionTimeOption * (Config.PlaylistIntermissionUnitOption == 1 ? 60 : 1); - GUIUpdateTimer.Start(); + IntermissionTotalTime = IntermissionSecondsLeft = Config.PlaylistIntermissionTimeOption * ((Config.PlaylistIntermissionUnitOption == 1) ? 1 : 60); SkipButton.Enabled = true; StopButton.Enabled = true; PauseButton.Enabled = true; - break; + Invoke(delegate { PlaybackControlsGroupBox.Text = "Controls: Intermission"; }); + GUIUpdateTimer.Start(); } - switch (Config.PlaylistShowEndOption) + else { - case 0: - PlaylistIndex++; - if (PlaylistIndex >= Config.Shows.Count()) break; - willStartShow = true; - break; - case 1: - PlaylistIndex = SelectRandom.Next(Config.Shows.Count() - 1); - willStartShow = true; - break; - case 2: - willStartShow = true; - break; - case 3: - break; + switch (Config.PlaylistShowEndOption) + { + case 0: + PlaylistIndex++; + if (PlaylistIndex >= Config.Shows.Count()) + { + if (Config.PlaylistLoopOption) + { + PlaylistIndex = 0; + willStartShow = true; + } + } + else willStartShow = true; + break; + case 1: + PlaylistIndex = SelectRandom.Next(Config.Shows.Count()); + willStartShow = true; + break; + case 2: + willStartShow = true; + break; + case 3: + break; + } } break; } @@ -711,6 +742,8 @@ namespace PC3Player dataProvider = new StreamDataProvider(File.OpenRead("pc3playertempaudio.tmp")); AudioPlayer = new SoundPlayer(dataProvider); + Invoke(delegate { PlaybackControlsGroupBox.Text = $"Controls: Playing {CurrentlyPlaying.Name}"; }); + Mixer.Master.AddComponent(AudioPlayer); Playing = true; AudioPlayer.Play(); @@ -721,27 +754,18 @@ namespace PC3Player StopButton.Enabled = true; SkipButton.Enabled = true; } - else Stop(); } void GUIUpdateTick(object sender, ElapsedEventArgs e) { if (Playing) { - Invoke(delegate - { - PlaybackControlsGroupBox.Text = $"Controls: Playing {CurrentlyPlaying.Name}"; - TimeLabel.Text = $"({TimeSpan.FromSeconds(AudioPlayer.Time).ToString(@"hh\:mm\:ss")}/{CurrentlyPlaying.Length})"; - }); + Invoke(delegate { TimeLabel.Text = $"({TimeSpan.FromSeconds(AudioPlayer.Time).ToString(@"hh\:mm\:ss")}/{CurrentlyPlaying.Length})"; }); } - else if (Intermission) + if (Intermission) { if (IntermissionSecondsLeft == 0) SelectNextShowtape(StartMethod.PlaylistShowEnd); - Invoke(delegate - { - PlaybackControlsGroupBox.Text = "Controls: Intermission"; - TimeLabel.Text = $"({TimeSpan.FromSeconds(IntermissionTotalTime - IntermissionSecondsLeft).ToString(@"hh\:mm\:ss")}/{TimeSpan.FromSeconds(IntermissionTotalTime).ToString(@"hh\:mm\:ss")})"; - }); + Invoke(delegate { TimeLabel.Text = $"({TimeSpan.FromSeconds(IntermissionTotalTime - IntermissionSecondsLeft).ToString(@"hh\:mm\:ss")}/{TimeSpan.FromSeconds(IntermissionTotalTime).ToString(@"hh\:mm\:ss")})"; }); if (!Paused) IntermissionSecondsLeft--; } } @@ -803,7 +827,17 @@ namespace PC3Player private void StartButton_Click(object sender, EventArgs e) { - if (Playing) Stop(); + if (Playing) + { + if (MessageBox.Show( + "A show is currently playing!\nPerforming this action will stop it.\nAre you sure?", + "Show Playing", + MessageBoxButtons.YesNo, + MessageBoxIcon.Exclamation + ) != DialogResult.Yes) + return; + Stop(); + } SelectNextShowtape(StartMethod.PlaylistStart); } @@ -814,12 +848,15 @@ namespace PC3Player FrameTimer.Stop(); ResyncTimer.Stop(); GUIUpdateTimer.Stop(); + ResyncTimer.Dispose(); + FrameTimer.Dispose(); PauseButton.Enabled = false; StopButton.Enabled = false; SkipButton.Enabled = false; if (Playing) Mixer.Master.RemoveComponent(AudioPlayer); Paused = false; - Invoke(delegate { + Invoke(delegate + { PlaybackControlsGroupBox.Text = "Controls: Not Playing"; PauseButton.Text = "Pause"; TimeLabel.Text = "(00:00:00/00:00:00)"; @@ -829,5 +866,35 @@ namespace PC3Player ShowtapeFrames = []; ShowtapeIndex = 0; } + + private void NewPlaylistButton_Click(object sender, EventArgs e) + { + if (Playing) + { + if (MessageBox.Show( + "A show is currently playing!\nPerforming this action will stop it.\nAre you sure?", + "Show Playing", + MessageBoxButtons.YesNo, + MessageBoxIcon.Exclamation + ) != DialogResult.Yes) + return; + Stop(); + } + + if (InvalidateSave) + if (MessageBox.Show( + "You have an unsaved Playlist!\nDo you still want to create a new one?", + "Unsaved Playlist", + MessageBoxButtons.YesNo, + MessageBoxIcon.Exclamation + ) != DialogResult.Yes) + return; + + Config = new PlaylistConfig(); + ChannelMappingGroupBox.Text = "Channel Map: None Loaded"; + PlaylistGroupBox.Text = "Playlist: Unsaved"; + UpdateListView(); + InvalidateSave = false; + } } } diff --git a/PC3Player/PC3Player/Properties/PublishProfiles/FolderProfile.pubxml.user b/PC3Player/PC3Player/Properties/PublishProfiles/FolderProfile.pubxml.user index 735b483..0694e5c 100644 --- a/PC3Player/PC3Player/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/PC3Player/PC3Player/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -2,7 +2,7 @@ - True|2025-07-07T23:13:43.3420483Z||; + True|2025-07-08T03:32:00.3108399Z||;True|2025-07-07T16:13:43.3420483-07:00||; \ No newline at end of file