From 96da03128e8faf9337a3a885809ae2a595eafcc1 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Wed, 1 Nov 2017 12:57:00 -0500 Subject: [PATCH] initial filter drop-down --- .../TranslationWindow.Designer.cs | 20 ++++++++++++---- EduNetworkBuilder/TranslationWindow.cs | 23 ++++++++++++++++++- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/EduNetworkBuilder/TranslationWindow.Designer.cs b/EduNetworkBuilder/TranslationWindow.Designer.cs index bad7385..4331067 100644 --- a/EduNetworkBuilder/TranslationWindow.Designer.cs +++ b/EduNetworkBuilder/TranslationWindow.Designer.cs @@ -55,6 +55,7 @@ this.groupBox1 = new System.Windows.Forms.GroupBox(); this.cbFormHighPriority = new System.Windows.Forms.CheckBox(); this.cbFormShowTranslated = new System.Windows.Forms.CheckBox(); + this.cbFormFilter = new System.Windows.Forms.ComboBox(); this.tcTabPages.SuspendLayout(); this.tpMessageTitle.SuspendLayout(); this.tpFormStuff.SuspendLayout(); @@ -228,7 +229,7 @@ this.panelTranslateFormItems.Controls.Add(this.cbFormItemChoice); this.panelTranslateFormItems.Controls.Add(this.cbFormLang2Choice); this.panelTranslateFormItems.Controls.Add(this.cbFormLang1Choice); - this.panelTranslateFormItems.Location = new System.Drawing.Point(6, 117); + this.panelTranslateFormItems.Location = new System.Drawing.Point(6, 126); this.panelTranslateFormItems.Name = "panelTranslateFormItems"; this.panelTranslateFormItems.Size = new System.Drawing.Size(512, 307); this.panelTranslateFormItems.TabIndex = 2; @@ -321,11 +322,12 @@ // // groupBox1 // + this.groupBox1.Controls.Add(this.cbFormFilter); this.groupBox1.Controls.Add(this.cbFormHighPriority); this.groupBox1.Controls.Add(this.cbFormShowTranslated); this.groupBox1.Location = new System.Drawing.Point(12, 82); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(505, 28); + this.groupBox1.Size = new System.Drawing.Size(505, 38); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Show"; @@ -335,7 +337,7 @@ this.cbFormHighPriority.AutoSize = true; this.cbFormHighPriority.Checked = true; this.cbFormHighPriority.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbFormHighPriority.Location = new System.Drawing.Point(100, 7); + this.cbFormHighPriority.Location = new System.Drawing.Point(57, 7); this.cbFormHighPriority.Name = "cbFormHighPriority"; this.cbFormHighPriority.Size = new System.Drawing.Size(107, 21); this.cbFormHighPriority.TabIndex = 3; @@ -345,13 +347,22 @@ // cbFormShowTranslated // this.cbFormShowTranslated.AutoSize = true; - this.cbFormShowTranslated.Location = new System.Drawing.Point(230, 8); + this.cbFormShowTranslated.Location = new System.Drawing.Point(170, 7); this.cbFormShowTranslated.Name = "cbFormShowTranslated"; this.cbFormShowTranslated.Size = new System.Drawing.Size(150, 21); this.cbFormShowTranslated.TabIndex = 4; this.cbFormShowTranslated.Text = "Already Translated"; this.cbFormShowTranslated.UseVisualStyleBackColor = true; // + // cbFormFilter + // + this.cbFormFilter.FormattingEnabled = true; + this.cbFormFilter.Location = new System.Drawing.Point(326, 8); + this.cbFormFilter.Name = "cbFormFilter"; + this.cbFormFilter.Size = new System.Drawing.Size(121, 24); + this.cbFormFilter.TabIndex = 5; + this.cbFormFilter.SelectedIndexChanged += new System.EventHandler(this.cbFormFilter_SelectedIndexChanged); + // // TranslationWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); @@ -408,5 +419,6 @@ private System.Windows.Forms.CheckBox cbFormHighPriority; private System.Windows.Forms.CheckBox cbFormItemTranslated; private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ComboBox cbFormFilter; } } \ No newline at end of file diff --git a/EduNetworkBuilder/TranslationWindow.cs b/EduNetworkBuilder/TranslationWindow.cs index 2d27f53..247f3d0 100644 --- a/EduNetworkBuilder/TranslationWindow.cs +++ b/EduNetworkBuilder/TranslationWindow.cs @@ -51,6 +51,12 @@ namespace EduNetworkBuilder cbFormHighPriority.CheckedChanged += PopulateFormTranslationItems; cbFormShowTranslated.CheckedChanged += PopulateFormTranslationItems; + cbFormFilter.Items.Clear(); + foreach(TranslationFormData TFD in FormData) + { + cbFormFilter.Items.Add(TFD.Prefix); + } + panelTranslateFormItems.Enabled = false; NBSettings mySettings = NB.GetSettings(); @@ -360,13 +366,22 @@ namespace EduNetworkBuilder { cbFormItemChoice.Items.Clear(); TranslationResxFile en = FileFromLangCode("en"); - List Priorities = new List() { "_", "NB_", "DC_" }; + List Priorities = new List() { }; + foreach(TranslationFormData TFD in FormData) + { + if (TFD.Importance > 5) Priorities.Add(TFD.Prefix); + } if(en != null) { foreach(TranslationItem TI in en.Items) { bool AddTranslated = false; bool AddHigh = false; + if (cbFormFilter.Text != "Any") + { + if (!TI.Key.StartsWith(cbFormFilter.Text)) + continue;//Skip it if it does not match the filter. + } if (!TI.translated || cbFormShowTranslated.Checked) AddTranslated = true; if (cbFormHighPriority.Checked) @@ -477,6 +492,12 @@ namespace EduNetworkBuilder } } } + + private void cbFormFilter_SelectedIndexChanged(object sender, EventArgs e) + { + //We want to filter the form based on what we have here. + PopulateFormTranslationItems(); + } } #region TranslationClasses