diff --git a/I18N Commander/UI WinForms/Components/Main.Designer.cs b/I18N Commander/UI WinForms/Components/Main.Designer.cs index 2293456..efcf16a 100644 --- a/I18N Commander/UI WinForms/Components/Main.Designer.cs +++ b/I18N Commander/UI WinForms/Components/Main.Designer.cs @@ -110,9 +110,9 @@ // splitContainerRTB.Panel1 // this.splitContainerRTB.Panel1.Controls.Add(this.textElements); - this.splitContainerRTB.Panel1MinSize = 200; + this.splitContainerRTB.Panel1MinSize = 240; this.splitContainerRTB.Size = new System.Drawing.Size(636, 531); - this.splitContainerRTB.SplitterDistance = 211; + this.splitContainerRTB.SplitterDistance = 240; this.splitContainerRTB.TabIndex = 0; // // textElements @@ -121,7 +121,7 @@ this.textElements.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.textElements.Location = new System.Drawing.Point(0, 0); this.textElements.Name = "textElements"; - this.textElements.Size = new System.Drawing.Size(634, 209); + this.textElements.Size = new System.Drawing.Size(634, 238); this.textElements.TabIndex = 0; // // Main diff --git a/I18N Commander/UI WinForms/Components/TextElements.Designer.cs b/I18N Commander/UI WinForms/Components/TextElements.Designer.cs index bac394c..2369d9d 100644 --- a/I18N Commander/UI WinForms/Components/TextElements.Designer.cs +++ b/I18N Commander/UI WinForms/Components/TextElements.Designer.cs @@ -38,6 +38,7 @@ this.textBoxFilter = new System.Windows.Forms.TextBox(); this.labelFilter = new System.Windows.Forms.Label(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.labelSectionPath = new System.Windows.Forms.Label(); this.tableLayout.SuspendLayout(); this.flowLayoutToolbar.SuspendLayout(); this.SuspendLayout(); @@ -49,13 +50,15 @@ this.tableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); this.tableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayout.Controls.Add(this.flowLayoutToolbar, 0, 0); - this.tableLayout.Controls.Add(this.listTextElements, 1, 0); - this.tableLayout.Controls.Add(this.textBoxFilter, 2, 1); - this.tableLayout.Controls.Add(this.labelFilter, 1, 1); + this.tableLayout.Controls.Add(this.listTextElements, 1, 1); + this.tableLayout.Controls.Add(this.textBoxFilter, 2, 2); + this.tableLayout.Controls.Add(this.labelFilter, 1, 2); + this.tableLayout.Controls.Add(this.labelSectionPath, 1, 0); this.tableLayout.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayout.Location = new System.Drawing.Point(0, 0); this.tableLayout.Name = "tableLayout"; - this.tableLayout.RowCount = 2; + this.tableLayout.RowCount = 3; + this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); this.tableLayout.Size = new System.Drawing.Size(706, 201); @@ -71,7 +74,7 @@ this.flowLayoutToolbar.Location = new System.Drawing.Point(0, 0); this.flowLayoutToolbar.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutToolbar.Name = "flowLayoutToolbar"; - this.tableLayout.SetRowSpan(this.flowLayoutToolbar, 2); + this.tableLayout.SetRowSpan(this.flowLayoutToolbar, 3); this.flowLayoutToolbar.Size = new System.Drawing.Size(66, 201); this.flowLayoutToolbar.TabIndex = 0; // @@ -121,10 +124,10 @@ this.listTextElements.FormattingEnabled = true; this.listTextElements.IntegralHeight = false; this.listTextElements.ItemHeight = 28; - this.listTextElements.Location = new System.Drawing.Point(69, 3); + this.listTextElements.Location = new System.Drawing.Point(69, 43); this.listTextElements.Name = "listTextElements"; this.listTextElements.ScrollAlwaysVisible = true; - this.listTextElements.Size = new System.Drawing.Size(634, 155); + this.listTextElements.Size = new System.Drawing.Size(634, 115); this.listTextElements.TabIndex = 1; // // textBoxFilter @@ -155,6 +158,19 @@ this.toolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; this.toolTip.ToolTipTitle = "Help"; // + // labelSectionPath + // + this.labelSectionPath.AutoSize = true; + this.tableLayout.SetColumnSpan(this.labelSectionPath, 2); + this.labelSectionPath.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelSectionPath.Location = new System.Drawing.Point(69, 0); + this.labelSectionPath.Name = "labelSectionPath"; + this.labelSectionPath.Size = new System.Drawing.Size(634, 40); + this.labelSectionPath.TabIndex = 4; + this.labelSectionPath.Text = "Path"; + this.labelSectionPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.toolTip.SetToolTip(this.labelSectionPath, "The path of the currently selected section"); + // // TextElements // this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); @@ -181,5 +197,6 @@ private ListBox listTextElements; private TextBox textBoxFilter; private Label labelFilter; + private Label labelSectionPath; } } diff --git a/I18N Commander/UI WinForms/Components/TextElements.cs b/I18N Commander/UI WinForms/Components/TextElements.cs index 694aec8..1b044e8 100644 --- a/I18N Commander/UI WinForms/Components/TextElements.cs +++ b/I18N Commander/UI WinForms/Components/TextElements.cs @@ -1,20 +1,39 @@ using DataModel.Database; +using DataModel.Database.Common; +using Microsoft.Extensions.DependencyInjection; +using Processor; namespace UI_WinForms.Components; public partial class TextElements : UserControl { + private readonly DataContext db; + private Section? currentSection; public TextElements() { this.InitializeComponent(); + // Check if we are in the designer: + if(Program.SERVICE_PROVIDER is null) + return; + + // Get the DI context from the main form: + this.db = Program.SERVICE_PROVIDER.GetService()!; + + // Dispose of the context when the control is disposed: + this.Disposed += (_, _) => this.db.Dispose(); + // When the section is changed, update this component: AppEvents.WhenSectionChanged += (sender, section) => { this.currentSection = section; this.buttonAdd.Enabled = this.currentSection is not null; + + // Update the path: + if (this.currentSection is not null) + this.labelSectionPath.Text = SectionProcessor.GetSectionPath(this.db, this.currentSection.DataKey); }; } } \ No newline at end of file