CemuPanel.cs - Added GameDirectoryContextMenu for opening or copying the directory path

This commit is contained in:
miku-666
2023-07-22 15:54:33 +02:00
parent ada7a0cc56
commit 22eff0df73
3 changed files with 46 additions and 11 deletions

View File

@@ -30,6 +30,9 @@
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.TableLayoutPanel layoutPanel;
this.gameDirectoryContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components);
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.radioButtonEur = new System.Windows.Forms.RadioButton();
this.radioButtonUs = new System.Windows.Forms.RadioButton();
this.radioButtonJap = new System.Windows.Forms.RadioButton();
@@ -43,6 +46,7 @@
this.removePckToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
layoutPanel = new System.Windows.Forms.TableLayoutPanel();
layoutPanel.SuspendLayout();
this.gameDirectoryContextMenu.SuspendLayout();
this.DLCContextMenu.SuspendLayout();
this.SuspendLayout();
//
@@ -53,6 +57,7 @@
layoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33332F));
layoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
layoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
layoutPanel.ContextMenuStrip = this.gameDirectoryContextMenu;
layoutPanel.Controls.Add(this.radioButtonEur, 0, 1);
layoutPanel.Controls.Add(this.radioButtonUs, 1, 1);
layoutPanel.Controls.Add(this.radioButtonJap, 2, 1);
@@ -71,6 +76,28 @@
layoutPanel.Size = new System.Drawing.Size(430, 550);
layoutPanel.TabIndex = 4;
//
// gameDirectoryContextMenu
//
this.gameDirectoryContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem,
this.copyToolStripMenuItem});
this.gameDirectoryContextMenu.Name = "gameDirectoryContextMenu";
this.gameDirectoryContextMenu.Size = new System.Drawing.Size(155, 48);
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.openToolStripMenuItem.Text = "Open Directory";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.copyToolStripMenuItem.Text = "Copy Path";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// radioButtonEur
//
this.radioButtonEur.Appearance = System.Windows.Forms.Appearance.Button;
@@ -180,7 +207,6 @@
this.GameDirectoryTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
this.GameDirectoryTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
this.GameDirectoryTextBox.TextChanged += new System.EventHandler(this.GameDirectoryTextBox_TextChanged);
this.GameDirectoryTextBox.Click += new System.EventHandler(this.GameDirectoryTextBox_Click);
//
// BrowseDirectoryBtn
//
@@ -265,6 +291,7 @@
this.Size = new System.Drawing.Size(430, 550);
layoutPanel.ResumeLayout(false);
layoutPanel.PerformLayout();
this.gameDirectoryContextMenu.ResumeLayout(false);
this.DLCContextMenu.ResumeLayout(false);
this.ResumeLayout(false);
@@ -283,5 +310,8 @@
private System.Windows.Forms.ToolStripMenuItem openTexturePackToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addCustomPckToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removePckToolStripMenuItem;
private MetroFramework.Controls.MetroContextMenu gameDirectoryContextMenu;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
}
}

View File

@@ -54,7 +54,7 @@ namespace PckStudio.Features
var xml = new XmlDocument();
xml.Load(settingsPath);
GameDirectoryTextBox.Text = xml.SelectSingleNode("content").SelectSingleNode("mlc_path").InnerText;
GameDirectoryTextBox.ReadOnly = true;
GameDirectoryTextBox.Enabled = false;
BrowseDirectoryBtn.Enabled = false;
}
catch (Exception ex)
@@ -83,7 +83,7 @@ namespace PckStudio.Features
var configNode = xml.SelectSingleNode("config");
var mlcpathNode = configNode.SelectSingleNode("MlcPath");
GameDirectoryTextBox.Text = mlcpathNode.InnerText;
GameDirectoryTextBox.ReadOnly = true;
GameDirectoryTextBox.Enabled = false;
BrowseDirectoryBtn.Enabled = false;
return true;
}
@@ -311,14 +311,6 @@ namespace PckStudio.Features
ListDLCs();
}
private void GameDirectoryTextBox_Click(object sender, EventArgs e)
{
if (GameDirectoryTextBox.ReadOnly)
{
Process.Start(GetContentSubDirectory("WiiU", "DLC"));
}
}
private void DLCTreeView_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.Enter && DLCTreeView.SelectedNode is not null)
@@ -332,5 +324,15 @@ namespace PckStudio.Features
{
e.Handled = true;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(GetContentSubDirectory("WiiU", "DLC"));
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
Clipboard.SetText(GameDirectoryTextBox.Text);
}
}
}

View File

@@ -120,6 +120,9 @@
<metadata name="layoutPanel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="gameDirectoryContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>165, 17</value>
</metadata>
<metadata name="DLCContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>